Skip to content

Commit

Permalink
adds apm paymen
Browse files Browse the repository at this point in the history
  • Loading branch information
semihshn committed Sep 21, 2023
1 parent 169e3cb commit 662a2f3
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
4 changes: 4 additions & 0 deletions adapter/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const (
ApmTypePAYPAL ApmType = "PAYPAL"
ApmTypeKLARNA ApmType = "KLARNA"
ApmTypeAFTERPAY ApmType = "AFTERPAY"
ApmTypeKASPI ApmType = "KASPI"
ApmTypeSTRIPE ApmType = "STRIPE"
ApmTypeFUND_TRANSFER ApmType = "FUND_TRANSFER"
ApmTypeCASH_ON_DELIVERY ApmType = "CASH_ON_DELIVERY"
Expand All @@ -86,6 +87,7 @@ const (
PAYPAL PaymentProvider = "PAYPAL"
KLARNA PaymentProvider = "KLARNA"
AFTERPAY PaymentProvider = "AFTERPAY"
KASPI PaymentProvider = "KASPI"
APPLEPAY PaymentProvider = "APPLEPAY"
GOOGLEPAY PaymentProvider = "GOOGLEPAY"
HEPSIPAY PaymentProvider = "HEPSIPAY"
Expand Down Expand Up @@ -121,6 +123,7 @@ const (
AED Currency = "AED"
IQD Currency = "IQD"
AZN Currency = "AZN"
KZT Currency = "KZT"
)

// payment group declaration
Expand Down Expand Up @@ -149,6 +152,7 @@ const (
PaymentMethod_PAYPAL PaymentMethod = "PAYPAL"
PaymentMethod_KLARNA PaymentMethod = "KLARNA"
PaymentMethod_AFTERPAY PaymentMethod = "AFTERPAY"
PaymentMethod_KASPI PaymentMethod = "KASPI"
PaymentMethod_STRIPE PaymentMethod = "STRIPE"
)

Expand Down
28 changes: 28 additions & 0 deletions tests/payment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,34 @@ func TestPayment_InitAfterpayApmPayment(t *testing.T) {
}
}

func TestPayment_InitKaspiApmPayment(t *testing.T) {
request := adapter.InitApmPaymentRequest{
ApmType: craftgate.ApmTypeKASPI,
Price: 1,
PaidPrice: 1,
Currency: craftgate.KZT,
PaymentGroup: craftgate.LISTING_OR_SUBSCRIPTION,
ConversationId: "foo-bar",
CallbackUrl: "https://www.your-website.com/callback",
Items: []craftgate.PaymentItem{
{
Name: "Item 1",
Price: 0.6,
},
{
Name: "Item 2",
Price: 0.4,
},
},
}
res, err := paymentClient.Payment.InitApmPayment(context.Background(), request)
_, _ = spew.Printf("%#v\n", res)

if err != nil {
t.Errorf("Error %s", err)
}
}

func TestPayment_CompleteApmPayment(t *testing.T) {
request := adapter.CompleteApmPaymentRequest{
PaymentId: 123,
Expand Down

0 comments on commit 662a2f3

Please sign in to comment.