diff --git a/src/adapter/PaymentAdapter.ts b/src/adapter/PaymentAdapter.ts index 2643dc4..fe19865 100644 --- a/src/adapter/PaymentAdapter.ts +++ b/src/adapter/PaymentAdapter.ts @@ -1,6 +1,7 @@ import {ClientCreationOptions} from '../lib/HttpClient'; import {calculateHash} from '../lib/utils'; +import ApplePayMerchantSessionCreateRequest from '../request/ApplePayMerchantSessionCreateRequest'; import ApprovePaymentTransactionsRequest from '../request/ApprovePaymentTransactionsRequest'; import CompleteApmPaymentRequest from '../request/CompleteApmPaymentRequest'; import CompletePosApmPaymentRequest from '../request/CompletePosApmPaymentRequest'; @@ -176,6 +177,10 @@ export default class PaymentAdapter extends BaseAdapter { return this._client.put(`/payment/v1/payment-transactions/${paymentTransactionId}`, request); } + async createApplePayMerchantSession(request: ApplePayMerchantSessionCreateRequest): Promise { + return this._client.post(`/payment/v1/apple-pay/merchant-sessions`, request); + } + async is3DSecureCallbackVerified(threeDSecureCallbackKey: string, params: Map): Promise { const hash = params['hash']; let hashString: string = [ diff --git a/src/model/TokenizedCardType.ts b/src/model/TokenizedCardType.ts new file mode 100644 index 0000000..4d9aa6f --- /dev/null +++ b/src/model/TokenizedCardType.ts @@ -0,0 +1,5 @@ +enum TokenizedCardType { + APPLE_PAY = 'APPLE_PAY' +} + +export default TokenizedCardType; diff --git a/src/model/index.ts b/src/model/index.ts index 28e188f..5e5dd88 100644 --- a/src/model/index.ts +++ b/src/model/index.ts @@ -32,6 +32,7 @@ import SettlementEarningsDestination from './SettlementEarningsDestination'; import SettlementSource from './SettlementSource'; import SettlementType from './SettlementType'; import Status from './Status'; +import TokenizedCardType from './TokenizedCardType'; import TransactionPayoutStatus from './TransactionPayoutStatus'; import TransactionStatus from './TransactionStatus'; import WalletTransactionRefundTransactionType from './WalletTransactionRefundTransactionType'; @@ -79,5 +80,6 @@ export = { WalletTransactionType, ReportFileType, WebhookEventType, - WebhookStatus + WebhookStatus, + TokenizedCardType }; diff --git a/src/request/ApplePayMerchantSessionCreateRequest.ts b/src/request/ApplePayMerchantSessionCreateRequest.ts new file mode 100644 index 0000000..5543e44 --- /dev/null +++ b/src/request/ApplePayMerchantSessionCreateRequest.ts @@ -0,0 +1,9 @@ +type ApplePayMerchantSessionCreateRequest = { + merchantIdentifier: string; + displayName: string; + initiative: string; + initiativeContext: string; + validationUrl: string; +}; + +export default ApplePayMerchantSessionCreateRequest; diff --git a/src/request/dto/Card.ts b/src/request/dto/Card.ts index 60172e0..ba4e174 100644 --- a/src/request/dto/Card.ts +++ b/src/request/dto/Card.ts @@ -1,4 +1,5 @@ import {Loyalty} from '../../model/Loyalty'; +import TokenizedCardType from '../../model/TokenizedCardType'; export type PaymentCard = { cardAlias?: string; @@ -24,4 +25,11 @@ export type First6Last4CardWithIdentityNumber = { lastFourDigits: string; }; -export type Card = PaymentCard | StoredCard | First6Last4CardWithIdentityNumber; +export type TokenizedCard = { + tokenizedCard: { + type: TokenizedCardType; + data: any; + }; +}; + +export type Card = PaymentCard | StoredCard | First6Last4CardWithIdentityNumber | TokenizedCard;