diff --git a/samples/masterpass/RetrieveLoyalties.js b/samples/masterpass/RetrieveLoyalties.js new file mode 100644 index 0000000..5958d30 --- /dev/null +++ b/samples/masterpass/RetrieveLoyalties.js @@ -0,0 +1,17 @@ +const Craftgate = require("../../dist"); + +const craftgate = new Craftgate.Client({ + apiKey: "api-key", + secretKey: "secret-key", + baseUrl: "https://sandbox-api.craftgate.io" +}); + +const request = { + cardName: "YKB Test Kart", + msisdn: "900000000000", + binNumber: "404809" +}; + +craftgate.masterpass().retrieveLoyalties(request) + .then(result => console.info("Retrieve loyalties successful", result)) + .catch(err => console.error("Retrieve loyalties failed", err)); diff --git a/src/adapter/MasterpassPaymentAdapter.ts b/src/adapter/MasterpassPaymentAdapter.ts index 2cc051d..d0a8da7 100644 --- a/src/adapter/MasterpassPaymentAdapter.ts +++ b/src/adapter/MasterpassPaymentAdapter.ts @@ -5,11 +5,13 @@ import MasterpassPaymentCompleteRequest from '../request/MasterpassPaymentComple import MasterpassPaymentThreeDSCompleteRequest from '../request/MasterpassPaymentThreeDSCompleteRequest'; import MasterpassPaymentThreeDSInitRequest from '../request/MasterpassPaymentThreeDSInitRequest'; import MasterpassPaymentTokenGenerateRequest from '../request/MasterpassPaymentTokenGenerateRequest'; +import MasterpassRetrieveLoyaltiesRequest from '../request/MasterpassRetrieveLoyaltiesRequest'; import CheckMasterpassUserResponse from '../response/CheckMasterpassUserResponse'; import MasterpassPaymentThreeDSInitResponse from '../response/MasterpassPaymentThreeDSInitResponse'; import MasterpassPaymentTokenGenerateResponse from '../response/MasterpassPaymentTokenGenerateResponse'; import PaymentResponse from '../response/PaymentResponse'; +import RetrieveLoyaltiesResponse from '../response/RetrieveLoyaltiesResponse'; import BaseAdapter from './BaseAdapter'; @@ -37,4 +39,8 @@ export default class MasterpassPaymentAdapter extends BaseAdapter { async complete3DSMasterpassPayment(request: MasterpassPaymentThreeDSCompleteRequest): Promise { return this._client.post('/payment/v2/masterpass-payments/3ds-complete', request); } + + async retrieveLoyalties(request: MasterpassRetrieveLoyaltiesRequest): Promise { + return this._client.post('/payment/v2/masterpass-payments/loyalties/retrieve', request); + } } diff --git a/src/request/MasterpassRetrieveLoyaltiesRequest.ts b/src/request/MasterpassRetrieveLoyaltiesRequest.ts new file mode 100644 index 0000000..4914bc3 --- /dev/null +++ b/src/request/MasterpassRetrieveLoyaltiesRequest.ts @@ -0,0 +1,7 @@ +type MasterpassRetrieveLoyaltiesRequest = { + msisdn: string; + binNumber: string; + cardName: string; +}; + +export default MasterpassRetrieveLoyaltiesRequest;