Skip to content

Commit

Permalink
Add GarantiPay v2 integration (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
onurpolattimur committed Mar 22, 2024
1 parent d353f48 commit 1e3bc06
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
7 changes: 4 additions & 3 deletions adapter/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,10 @@ const (

// pos apm payment provider declaration
const (
PosApmPaymentProvider_YKB_WORLD_PAY PosApmPaymentProvider = "YKB_WORLD_PAY"
PosApmPaymentProvider_APPLEPAY PosApmPaymentProvider = "APPLEPAY"
PosApmPaymentProvider_GOOGLEPAY PosApmPaymentProvider = "GOOGLEPAY"
PosApmPaymentProvider_YKB_WORLD_PAY PosApmPaymentProvider = "YKB_WORLD_PAY"
PosApmPaymentProvider_YKB_WORLD_PAY_SHOPPING_LOAN PosApmPaymentProvider = "YKB_WORLD_PAY_SHOPPING_LOAN"
PosApmPaymentProvider_GOOGLEPAY PosApmPaymentProvider = "GOOGLEPAY"
PosApmPaymentProvider_GARANTI_PAY PosApmPaymentProvider = "GARANTI_PAY"
)

// payment status declaration
Expand Down
35 changes: 34 additions & 1 deletion tests/payment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ func TestPayment_CompleteApmPayment(t *testing.T) {
}
}

func TestPayment_InitPosApmPayment(t *testing.T) {
func TestPayment_InitYkbWorldPayPosApmPayment(t *testing.T) {
request := adapter.InitPosApmPaymentRequest{
Price: 1.25,
PaidPrice: 1.25,
Expand Down Expand Up @@ -566,6 +566,39 @@ func TestPayment_InitPosApmPayment(t *testing.T) {
}
}

func TestPayment_InitGarantiPayPosApmPayment(t *testing.T) {
request := adapter.InitPosApmPaymentRequest{
Price: 1.25,
PaidPrice: 1.25,
Currency: craftgate.Currency_TRY,
PaymentGroup: craftgate.PaymentGroup_LISTING_OR_SUBSCRIPTION,
ConversationId: "foo-bar",
PaymentProvider: craftgate.PosApmPaymentProvider_GARANTI_PAY,
CallbackUrl: "https://www.your-website.com/callback",
Items: []craftgate.PaymentItem{
{
Name: "Item 1",
Price: 1,
ExternalId: "1",
},
{
Name: "Item 2",
Price: 0.25,
ExternalId: "2",
},
},
AdditionalParams: map[string]string{
"integrationType": "WEB2APP",
},
}
res, err := paymentClient.Payment.InitPosApmPayment(context.Background(), request)
_, _ = spew.Printf("%#v\n", res)

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

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

0 comments on commit 1e3bc06

Please sign in to comment.