Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pos apm #37

Merged
merged 14 commits into from
Oct 6, 2023
Merged
Prev Previous commit
Next Next commit
fix indent
  • Loading branch information
reywyn committed Jun 20, 2023
commit 4e9821e9ef35d401353f29aefac77033dc8595bf
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ root = true

[*]
indent_style = space
indent_size = 4
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
Expand Down
88 changes: 44 additions & 44 deletions tests/fraud_test.go
Original file line number Diff line number Diff line change
@@ -1,78 +1,78 @@
package tests

import (
"context"
"github.com/craftgate/craftgate-go-client/adapter"
craftgate "github.com/craftgate/craftgate-go-client/adapter"
"github.com/davecgh/go-spew/spew"
"testing"
"context"
"github.com/craftgate/craftgate-go-client/adapter"
craftgate "github.com/craftgate/craftgate-go-client/adapter"
"github.com/davecgh/go-spew/spew"
"testing"
)

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

func Test_SearchFraudChecks(t *testing.T) {
request := adapter.SearchFraudChecksRequest{
Page: 0, Size: 10,
}
request := adapter.SearchFraudChecksRequest{
Page: 0, Size: 10,
}

res, err := fraudClient.Fraud.SearchFraudChecks(context.Background(), request)
_, _ = spew.Printf("%#v\n", res)
res, err := fraudClient.Fraud.SearchFraudChecks(context.Background(), request)
_, _ = spew.Printf("%#v\n", res)

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

func Test_RetrieveAllFraudValueList(t *testing.T) {
res, err := fraudClient.Fraud.RetrieveAllFraudValueList(context.Background())
_, _ = spew.Printf("%#v\n", res)
res, err := fraudClient.Fraud.RetrieveAllFraudValueList(context.Background())
_, _ = spew.Printf("%#v\n", res)

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

func Test_RetrieveFraudValueList(t *testing.T) {
res, err := fraudClient.Fraud.RetrieveFraudValueList(context.Background(), "blockedBuyerIdList")
_, _ = spew.Printf("%#v\n", res)
res, err := fraudClient.Fraud.RetrieveFraudValueList(context.Background(), "blockedBuyerIdList")
_, _ = spew.Printf("%#v\n", res)

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

func Test_CreateFraudValueList(t *testing.T) {
err := fraudClient.Fraud.CreateFraudValueList(context.Background(), "myTestList")
err := fraudClient.Fraud.CreateFraudValueList(context.Background(), "myTestList")

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

func Test_DeleteFraudValueList(t *testing.T) {
err := fraudClient.Fraud.DeleteFraudValueList(context.Background(), "myTestList")
err := fraudClient.Fraud.DeleteFraudValueList(context.Background(), "myTestList")

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

func Test_AddValueToFraudValueList(t *testing.T) {
request := adapter.FraudValueListRequest{
ListName: "ipList",
Value: "999.999.999.999",
}
err := fraudClient.Fraud.AddValueToFraudValueList(context.Background(), request)

if err != nil {
t.Errorf("Error %s", err)
}
request := adapter.FraudValueListRequest{
ListName: "ipList",
Value: "999.999.999.999",
}
err := fraudClient.Fraud.AddValueToFraudValueList(context.Background(), request)

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

func Test_RemoveValueFromFraudValueList(t *testing.T) {
err := fraudClient.Fraud.RemoveValueFromFraudValueList(context.Background(), "ipList", "999.999.999.999")
err := fraudClient.Fraud.RemoveValueFromFraudValueList(context.Background(), "ipList", "999.999.999.999")

if err != nil {
t.Errorf("Error %s", err)
}
if err != nil {
t.Errorf("Error %s", err)
}
}
98 changes: 49 additions & 49 deletions tests/pay_by_link_test.go
Original file line number Diff line number Diff line change
@@ -1,78 +1,78 @@
package tests

import (
"context"
"github.com/craftgate/craftgate-go-client/adapter"
craftgate "github.com/craftgate/craftgate-go-client/adapter"
"github.com/davecgh/go-spew/spew"
"testing"
"context"
"github.com/craftgate/craftgate-go-client/adapter"
craftgate "github.com/craftgate/craftgate-go-client/adapter"
"github.com/davecgh/go-spew/spew"
"testing"
)

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

func Test_CreateProduct(t *testing.T) {
request := adapter.CreateProductRequest{
Name: "A new Product",
Channel: "API",
Price: 10,
Currency: craftgate.Currency_TRY,
EnabledInstallments: []int{1, 2, 3, 6},
}
request := adapter.CreateProductRequest{
Name: "A new Product",
Channel: "API",
Price: 10,
Currency: craftgate.Currency_TRY,
EnabledInstallments: []int{1, 2, 3, 6},
}

res, err := payByLinkClient.PayByLink.CreateProduct(context.Background(), request)
_, _ = spew.Printf("%#v\n", res)
res, err := payByLinkClient.PayByLink.CreateProduct(context.Background(), request)
_, _ = spew.Printf("%#v\n", res)

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

func Test_UpdateProduct(t *testing.T) {
request := adapter.UpdateProductRequest{
Name: "A new Product",
Status: craftgate.Status_ACTIVE,
Channel: "API",
Price: 10,
Currency: craftgate.Currency_TRY,
EnabledInstallments: []int{1, 2, 3, 6, 9},
}
request := adapter.UpdateProductRequest{
Name: "A new Product",
Status: craftgate.Status_ACTIVE,
Channel: "API",
Price: 10,
Currency: craftgate.Currency_TRY,
EnabledInstallments: []int{1, 2, 3, 6, 9},
}

res, err := payByLinkClient.PayByLink.UpdateProduct(context.Background(), 1, request)
_, _ = spew.Printf("%#v\n", res)
res, err := payByLinkClient.PayByLink.UpdateProduct(context.Background(), 1, request)
_, _ = spew.Printf("%#v\n", res)

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

func Test_RetrieveProduct(t *testing.T) {
res, err := payByLinkClient.PayByLink.RetrieveProduct(context.Background(), 1)
_, _ = spew.Printf("%#v\n", res)
res, err := payByLinkClient.PayByLink.RetrieveProduct(context.Background(), 1)
_, _ = spew.Printf("%#v\n", res)

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

func Test_DeleteProduct(t *testing.T) {
err := payByLinkClient.PayByLink.DeleteProduct(context.Background(), 1)
err := payByLinkClient.PayByLink.DeleteProduct(context.Background(), 1)

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

func Test_SearchProducts(t *testing.T) {
request := adapter.SearchProductsRequest{
Page: 0,
Size: 10,
Currency: craftgate.Currency_TRY,
}
request := adapter.SearchProductsRequest{
Page: 0,
Size: 10,
Currency: craftgate.Currency_TRY,
}

res, err := payByLinkClient.PayByLink.SearchProducts(context.Background(), request)
_, _ = spew.Printf("%#v\n", res)
res, err := payByLinkClient.PayByLink.SearchProducts(context.Background(), request)
_, _ = spew.Printf("%#v\n", res)

if err != nil {
t.Errorf("Error %s", err)
}
if err != nil {
t.Errorf("Error %s", err)
}
}
22 changes: 11 additions & 11 deletions tests/settlement_test.go
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
package tests

import (
"context"
"github.com/craftgate/craftgate-go-client/adapter"
craftgate "github.com/craftgate/craftgate-go-client/adapter"
"github.com/davecgh/go-spew/spew"
"testing"
"context"
"github.com/craftgate/craftgate-go-client/adapter"
craftgate "github.com/craftgate/craftgate-go-client/adapter"
"github.com/davecgh/go-spew/spew"
"testing"
)

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

func TestSettlement_CreateInstantWalletSettlement(t *testing.T) {
request := adapter.CreateInstantWalletSettlementRequest{ExcludedSubMerchantMemberIds: []int64{1, 2}}
request := adapter.CreateInstantWalletSettlementRequest{ExcludedSubMerchantMemberIds: []int64{1, 2}}

res, err := settlementClient.Settlement.CreateInstantWalletSettlement(context.Background(), request)
_, _ = spew.Printf("%#v\n", res)
res, err := settlementClient.Settlement.CreateInstantWalletSettlement(context.Background(), request)
_, _ = spew.Printf("%#v\n", res)

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