Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add masterpass loyalty retrieve endpoint #188

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions samples/masterpass/RetrieveLoyalties.js
Original file line number Diff line number Diff line change
@@ -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));
6 changes: 6 additions & 0 deletions src/adapter/MasterpassPaymentAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -37,4 +39,8 @@ export default class MasterpassPaymentAdapter extends BaseAdapter {
async complete3DSMasterpassPayment(request: MasterpassPaymentThreeDSCompleteRequest): Promise<PaymentResponse> {
return this._client.post('/payment/v2/masterpass-payments/3ds-complete', request);
}

async retrieveLoyalties(request: MasterpassRetrieveLoyaltiesRequest): Promise<RetrieveLoyaltiesResponse> {
return this._client.post('/payment/v2/masterpass-payments/loyalties/retrieve', request);
}
}
7 changes: 7 additions & 0 deletions src/request/MasterpassRetrieveLoyaltiesRequest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type MasterpassRetrieveLoyaltiesRequest = {
msisdn: string;
binNumber: string;
cardName: string;
};

export default MasterpassRetrieveLoyaltiesRequest;
Loading