Skip to content

Commit

Permalink
Adds instant transfer with Compay integration as apm
Browse files Browse the repository at this point in the history
  • Loading branch information
semihshn committed Mar 20, 2024
1 parent cf1f940 commit f27292f
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions tests/instant_transfer_payment_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package tests

import (
"context"
"testing"

"github.com/craftgate/craftgate-go-client/adapter"
craftgate "github.com/craftgate/craftgate-go-client/adapter"
"github.com/davecgh/go-spew/spew"
"github.com/stretchr/testify/require"
)

var instantTransferPaymentClient, _ = craftgate.New("api-key", "secret-key", "https://sandbox-api.craftgate.io")

func TestRetrieveActiveBanks(t *testing.T) {
res, err := instantTransferPaymentClient.Payment.RetrieveActiveBanks(context.Background())

Check failure on line 16 in tests/instant_transfer_payment_test.go

View workflow job for this annotation

GitHub Actions / build

instantTransferPaymentClient.Payment.RetrieveActiveBanks undefined (type *adapter.Payment has no field or method RetrieveActiveBanks)

Check failure on line 16 in tests/instant_transfer_payment_test.go

View workflow job for this annotation

GitHub Actions / build

instantTransferPaymentClient.Payment.RetrieveActiveBanks undefined (type *adapter.Payment has no field or method RetrieveActiveBanks)
require.NotEmpty(t, res.Items)
if err != nil {
t.Errorf("Error %s", err)
}
}

func TestInitCompayAPMPayment(t *testing.T) {
additionalParams := make(map[string]string)
additionalParams["bankCode"] = "0"

request := adapter.InitApmPaymentRequest{
ApmType: craftgate.ApmType_COMPAY,

Check failure on line 28 in tests/instant_transfer_payment_test.go

View workflow job for this annotation

GitHub Actions / build

undefined: craftgate.ApmType_COMPAY (typecheck)

Check failure on line 28 in tests/instant_transfer_payment_test.go

View workflow job for this annotation

GitHub Actions / build

undefined: craftgate.ApmType_COMPAY (typecheck)
Price: 1,
PaidPrice: 1,
Currency: craftgate.Currency_TRY,
PaymentGroup: craftgate.PaymentGroup_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,
},
},
AdditionalParams: additionalParams,
}
res, err := instantTransferPaymentClient.Payment.InitApmPayment(context.Background(), request)
_, _ = spew.Printf("%#v\n", res)

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

0 comments on commit f27292f

Please sign in to comment.