Skip to content
Merged
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
16 changes: 16 additions & 0 deletions samples/payment/CompleteSetcardGiftApmPayment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const Craftgate = require('../../dist');

const craftgate = new Craftgate.Client({
apiKey: 'api-key',
secretKey: 'secret-key',
baseUrl: 'https://sandbox-api.craftgate.io'
});

const request = {
paymentId: 1349,
additionalParams: {"otpCode": "784294"}
};

craftgate.payment().completeApmPayment(request)
.then(result => console.info('Setcard Gift Apm complete payment successful', result))
.catch(err => console.error('Failed to complete Setcard Gift Apm payment', err));
35 changes: 35 additions & 0 deletions samples/payment/InitSetcardGiftApmPayment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const Craftgate = require('../../dist');

const craftgate = new Craftgate.Client({
apiKey: 'api-key',
secretKey: 'secret-key',
baseUrl: 'https://sandbox-api.craftgate.io'
});

const request = {
apmType: Craftgate.Model.ApmType.SetcardGift,
price: 1.0,
paidPrice: 1.0,
currency: Craftgate.Model.Currency.TRY,
paymentGroup: Craftgate.Model.PaymentGroup.ListingOrSubscription,
conversationId: '456d1297-908e-4bd6-a13b-4be31a6e47d5',
callbackUrl: 'https://www.your-website.com/craftgate-apm-callback',
apmUserIdentity: '6036819041742253',
items: [
{
name: 'Item 1',
price: 0.4,
externalId: '123d1297-839e-4bd6-a13b-4be31a6e12a8'
},
{
name: 'Item 2',
price: 0.6,
externalId: '789d1297-839e-4bd6-a13b-4be31a6e13f7'
}
],
additionalParams: {"cardNumber": "7599640961180814"}
};

craftgate.payment().initApmPayment(request)
.then(result => console.info('Setcard Gift Apm init payment successful', result))
.catch(err => console.error('Failed to init Setcard Gift Apm payment', err));
1 change: 1 addition & 0 deletions src/model/ApmType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ enum ApmType {
Tokenflex = 'TOKENFLEX',
TokenflexGift = 'TOKENFLEX_GIFT',
Setcard = 'SETCARD',
SetcardGift = 'SETCARD_GIFT',
Metropol = 'METROPOL',
PayPal = 'PAYPAL',
Klarna = 'KLARNA',
Expand Down
2 changes: 2 additions & 0 deletions src/model/PaymentMethod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ enum PaymentMethod {
SodexoGift = 'SODEXO_GIFT',
Edenred = 'EDENRED',
EdenredGift = 'EDENRED_GIFT',
Setcard = 'SETCARD',
SetcardGift = 'SETCARD_GIFT',
Tokenflex = 'TOKENFLEX',
TokenflexGift = 'TOKENFLEX_GIFT',
Alipay = 'ALIPAY',
Expand Down
Loading