Skip to content
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
16 changes: 16 additions & 0 deletions samples/payment/CompleteTokenflexApmPayment.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: 1,
additionalParams: {"otpCode": "784294"}
};

craftgate.payment().completeApmPayment(request)
.then(result => console.info('Tokenflex Apm complete payment successful', result))
.catch(err => console.error('Failed to complete Tokenflex Apm payment', err));
16 changes: 16 additions & 0 deletions samples/payment/CompleteTokenflexGiftApmPayment.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: 1,
additionalParams: {"otpCode": "784294"}
};

craftgate.payment().completeApmPayment(request)
.then(result => console.info('Tokenflex Gift Apm complete payment successful', result))
.catch(err => console.error('Failed to complete Tokenflex Gift Apm payment', err));
36 changes: 36 additions & 0 deletions samples/payment/InitTokenflexApmPayment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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.Tokenflex,
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',
additionalParams: {
paymentCode: 123456
},
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'
}
]
};

craftgate.payment().initApmPayment(request)
.then(result => console.info('Tokenflex Apm init payment successful', result))
.catch(err => console.error('Failed to init Tokenflex Apm payment', err));
36 changes: 36 additions & 0 deletions samples/payment/InitTokenflexGiftApmPayment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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.TokenflexGift,
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',
additionalParams: {
paymentCode: 123456
},
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'
}
]
};

craftgate.payment().initApmPayment(request)
.then(result => console.info('Tokenflex Gift Apm init payment successful', result))
.catch(err => console.error('Failed to init Tokenflex Gift Apm payment', err));
4 changes: 3 additions & 1 deletion src/model/ApmType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ enum ApmType {
Sodexo = 'SODEXO',
SodexoGift = 'SODEXO_GIFT',
Edenred = 'EDENRED',
Setcard = 'SETCARD',
EdenredGift = 'EDENRED_GIFT',
Tokenflex = 'TOKENFLEX',
TokenflexGift = 'TOKENFLEX_GIFT',
Setcard = 'SETCARD',
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',
Tokenflex = 'TOKENFLEX',
TokenflexGift = 'TOKENFLEX_GIFT',
Alipay = 'ALIPAY',
Paypal = 'PAYPAL',
Klarna = 'KLARNA',
Expand Down
3 changes: 2 additions & 1 deletion src/model/PaymentProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ enum PaymentProvider {
Sodexo = 'SODEXO',
Edenred = 'EDENRED',
Metropol = 'METROPOL',
Tokenflex = 'TOKENFLEX',
Kaspi = 'KASPI',
InstantTransfer = 'INSTANTA_TRANSFER',
InstantTransfer = 'INSTANT_TRANSFER',
Tompay = 'TOMPAY',
YkbWorldPay = 'YKB_WORLD_PAY',
ApplePay = 'APPLEPAY',
Expand Down