-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* bnpl payment integration * bnpl payment integration * bnpl payment integration * bnpl payment integration * bnpl payment integration * bnpl payment integration * updates based on comments * updates based on comments * updates based on comments * updates based on comments * fixes bnplcard item type typo * fixes type name --------- Co-authored-by: Burak BALDIRLIOGLU <[email protected]>
- Loading branch information
1 parent
e6da759
commit 9374503
Showing
15 changed files
with
226 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const Craftgate = require('../../dist'); | ||
|
||
const craftgate = new Craftgate.Client({ | ||
apiKey: 'api-key', | ||
secretKey: 'secret-key', | ||
baseUrl: 'https://sandbox-api.craftgate.io' | ||
}); | ||
|
||
craftgate.payment().approveBnplPayment(1) | ||
.then(results => console.info('Approve bnpl payment response ', results)) | ||
.catch(err => console.error('Failed to approve bnpl payment', err)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = { | ||
price: 10000, | ||
currency: Craftgate.Model.Currency.TRY, | ||
apmType : Craftgate.Model.ApmType.Maslak, | ||
items: [ | ||
{ | ||
id: "200", | ||
name: "Test Elektronik 2", | ||
brandName:"iphone", | ||
type: Craftgate.Model.BnplCartItemType.Other, | ||
unitPrice: 3000, | ||
quantity: 2, | ||
}, | ||
{ | ||
id: "100", | ||
name: "Test Elektronik 1", | ||
brandName:"Samsung", | ||
type: Craftgate.Model.BnplCartItemType.MobilePhoneOver5000Try, | ||
unitPrice: 4000, | ||
quantity: 1, | ||
} | ||
] | ||
}; | ||
|
||
craftgate.payment().retrieveBnplOffers(request) | ||
.then(results => console.info('Approve bnpl payment response', results)) | ||
.catch(err => console.error('Failed to approve bnpl payment', err)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
const Craftgate = require('../../dist'); | ||
|
||
const craftgate = new Craftgate.Client({ | ||
apiKey: 'api-key', | ||
secretKey: 'secret-key', | ||
baseUrl: 'https://sandbox-api.craftgate.io' | ||
}); | ||
|
||
const request = { | ||
price: 10000, | ||
paidPrice : 10000, | ||
currency: Craftgate.Model.Currency.TRY, | ||
apmType : Craftgate.Model.ApmType.Maslak, | ||
apmOrderId: "", | ||
paymentGroup : Craftgate.Model.PaymentGroup.Product, | ||
conversationId : "29393-mXld92ko3", | ||
externalId : "external_id-345", | ||
callbackUrl : "callback", | ||
bankCode: "103", | ||
items: [ | ||
{ | ||
externalId: "38983903", | ||
name: "item-1", | ||
price: 6000, | ||
}, | ||
{ | ||
externalId: "92983294", | ||
name: "item-2", | ||
price: 4000, | ||
} | ||
], | ||
cartItems: [ | ||
{ | ||
id: "200", | ||
name: "Test Elektronik 2", | ||
brandName:"iphone", | ||
type: Craftgate.Model.BnplCartItemType.Other, | ||
unitPrice: 3000, | ||
quantity: 2, | ||
}, | ||
{ | ||
id: "100", | ||
name: "Test Elektronik 1", | ||
brandName:"Samsung", | ||
type: Craftgate.Model.BnplCartItemType.MobilePhoneOver5000Try, | ||
unitPrice: 4000, | ||
quantity: 1, | ||
} | ||
] | ||
}; | ||
|
||
craftgate.payment().initBnplPayment(request) | ||
.then(results => console.info('Init bnpl payment response', results)) | ||
.catch(err => console.error('Failed to Init bnpl payment', err)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
enum BnplCartItemType { | ||
MobilePhoneOver5000Try = 'MOBILE_PHONE_OVER_5000_TRY', | ||
MobilePhoneBelow5000Try = 'MOBILE_PHONE_BELOW_5000_TRY', | ||
Tablet = 'TABLET', | ||
Computer = 'COMPUTER', | ||
ConstructionMarket = 'CONSTRUCTION_MARKET', | ||
Gold = 'GOLD', | ||
DigitalProduct = 'DIGITAL_PRODUCTS', | ||
Supermarket = 'SUPERMARKET', | ||
WhiteGoods = 'WHITE_GOODS', | ||
WearableTechnology = 'WEARABLE_TECHNOLOGY', | ||
SmallHomeAppliance = 'SMALL_HOME_APPLIANCES', | ||
Tv = 'TV', | ||
GameConsoles = 'GAMES_CONSOLES', | ||
AirConditionerAndHeater = 'AIR_CONDITIONER_AND_HEATER', | ||
Electronics = 'ELECTRONICS', | ||
Accessories = 'ACCESSORIES', | ||
MomAndBabyAndKids = 'MOM_AND_BABY_AND_KIDS', | ||
Shoes = 'SHOES', | ||
Clothing = 'CLOTHING', | ||
CosmeticsAndPersonalCare = 'COSMETICS_AND_PERSONAL_CARE', | ||
Furniture = 'FURNITURE', | ||
HomeLiving = 'HOME_LIVING', | ||
AutomobileMotorcycle = 'AUTOMOBILE_MOTORCYCLE', | ||
Other = 'OTHER' | ||
} | ||
|
||
export default BnplCartItemType; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import ApmType from '../model/ApmType'; | ||
import Currency from '../model/Currency'; | ||
|
||
import BnplPaymentCartItem from './dto/BnplPaymentCartItem'; | ||
|
||
type BnplPaymentOfferRequest = { | ||
apmType: ApmType; | ||
merchantApmId: number; | ||
price: number; | ||
currency: Currency; | ||
items: BnplPaymentCartItem[]; | ||
}; | ||
|
||
export default BnplPaymentOfferRequest; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import BnplPaymentCartItem from './dto/BnplPaymentCartItem'; | ||
import InitApmPaymentRequest from './InitApmPaymentRequest'; | ||
|
||
type InitBnplPaymentRequest = InitApmPaymentRequest & { | ||
bankCode: string; | ||
cartItems: BnplPaymentCartItem[]; | ||
}; | ||
|
||
export default InitBnplPaymentRequest; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import BnplCartItemType from '../../model/BnplCartItemType'; | ||
|
||
type BnplPaymentCartItem = { | ||
id: string; | ||
name: string; | ||
brandName: string; | ||
type: BnplCartItemType; | ||
unitPrice: number; | ||
quantity: number; | ||
}; | ||
|
||
export default BnplPaymentCartItem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import BnplBankOffer from './dto/BnplBankOffer'; | ||
|
||
type BnplPaymentOfferResponse = { | ||
offerId: string; | ||
price: number; | ||
bankOffers: BnplBankOffer[]; | ||
}; | ||
|
||
export default BnplPaymentOfferResponse; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import ApmAdditionalAction from '../model/ApmAdditionalAction'; | ||
import PaymentStatus from '../model/PaymentStatus'; | ||
|
||
import PaymentError from './dto/PaymentError'; | ||
|
||
type InitBnplPaymentResponse = { | ||
paymentId: number; | ||
redirectUrl: string; | ||
paymentStatus: PaymentStatus; | ||
apmAdditionalAction: ApmAdditionalAction; | ||
paymentError: PaymentError; | ||
}; | ||
|
||
export default InitBnplPaymentResponse; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
type BnplBankOffer = { | ||
bankCode: string; | ||
bankName: string; | ||
bankIconUrl: string; | ||
bankTableBannerMessage: string; | ||
bankSmallBannerMessage: string; | ||
isSupportNonCustomer: boolean; | ||
bankOfferTerms: BnplBankOfferTerm[]; | ||
}; | ||
|
||
export default BnplBankOffer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
type BnplBankOfferTerm = { | ||
term: number; | ||
amount: number; | ||
totalAmount: number; | ||
interestRate: number; | ||
annualInterestRate: number; | ||
}; |