Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
reywyn committed Jun 12, 2023
1 parent 0343a8b commit 3d7b72e
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 125 deletions.
2 changes: 1 addition & 1 deletion tests/settlement_reporting_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestSettlementReporting_RetrievePayoutDetails(t *testing.T) {

func TestSettlementReporting_SearchPayoutRows(t *testing.T) {
request := adapter.SearchPayoutRowRequest{
FileStatus: craftgate.FileStatusCREATED,
FileStatus: craftgate.FileStatus_CREATED,
StartDate: time.Now().AddDate(0, 0, -180),
EndDate: time.Now(),
}
Expand Down
248 changes: 124 additions & 124 deletions tests/wallet_test.go
Original file line number Diff line number Diff line change
@@ -1,194 +1,194 @@
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"
"time"
"context"
"github.com/craftgate/craftgate-go-client/adapter"
craftgate "github.com/craftgate/craftgate-go-client/adapter"
"github.com/davecgh/go-spew/spew"
"testing"
"time"
)

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

func TestWallet_RetrieveMemberWallet(t *testing.T) {
res, err := walletClient.Wallet.RetrieveMemberWallet(context.Background(), 1)
_, _ = spew.Printf("%#v\n", res)
res, err := walletClient.Wallet.RetrieveMemberWallet(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 TestWallet_RetrieveMerchantMemberWallet(t *testing.T) {
res, err := walletClient.Wallet.RetrieveMerchantMemberWallet(context.Background())
_, _ = spew.Printf("%#v\n", res)
res, err := walletClient.Wallet.RetrieveMerchantMemberWallet(context.Background())
_, _ = spew.Printf("%#v\n", res)

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

func TestWallet_ResetMerchantMemberWalletBalance(t *testing.T) {
request := adapter.ResetMerchantMemberWalletBalanceRequest{WalletAmount: -10}
res, err := walletClient.Wallet.ResetMerchantMemberWalletBalance(context.Background(), request)
_, _ = spew.Printf("%#v\n", res)
request := adapter.ResetMerchantMemberWalletBalanceRequest{WalletAmount: -10}
res, err := walletClient.Wallet.ResetMerchantMemberWalletBalance(context.Background(), request)
_, _ = spew.Printf("%#v\n", res)

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

func TestWallet_SearchWalletTransactions(t *testing.T) {
request := adapter.SearchWalletTransactionsRequest{
WalletTransactionTypes: []craftgate.WalletTransactionType{craftgate.DEPOSIT_FROM_CARD},
}
res, err := walletClient.Wallet.SearchWalletTransactions(context.Background(), 1, request)
_, _ = spew.Printf("%#v\n", res)
request := adapter.SearchWalletTransactionsRequest{
WalletTransactionTypes: []craftgate.WalletTransactionType{craftgate.WalletTransactionType_DEPOSIT_FROM_CARD},
}
res, err := walletClient.Wallet.SearchWalletTransactions(context.Background(), 1, request)
_, _ = spew.Printf("%#v\n", res)

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

func TestWallet_RetrieveRefundableAmountOfWalletTransaction(t *testing.T) {
res, err := walletClient.Wallet.RetrieveRefundableAmountOfWalletTransaction(context.Background(), 1)
_, _ = spew.Printf("%#v\n", res)
res, err := walletClient.Wallet.RetrieveRefundableAmountOfWalletTransaction(context.Background(), 1)
_, _ = spew.Printf("%#v\n", res)

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

func TestWallet_RefundWalletTransaction(t *testing.T) {
request := adapter.RefundWalletTransactionRequest{RefundPrice: 10}
res, err := walletClient.Wallet.RefundWalletTransaction(context.Background(), 1, request)
_, _ = spew.Printf("%#v\n", res)
request := adapter.RefundWalletTransactionRequest{RefundPrice: 10}
res, err := walletClient.Wallet.RefundWalletTransaction(context.Background(), 1, request)
_, _ = spew.Printf("%#v\n", res)

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

func TestWallet_RetrieveRefundWalletTransactions(t *testing.T) {
res, err := walletClient.Wallet.RetrieveRefundWalletTransactions(context.Background(), 1)
_, _ = spew.Printf("%#v\n", res)
res, err := walletClient.Wallet.RetrieveRefundWalletTransactions(context.Background(), 1)
_, _ = spew.Printf("%#v\n", res)

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

func TestWallet_SendRemittance(t *testing.T) {
request := adapter.RemittanceRequest{
Price: 100,
MemberId: 1,
Description: "bonus",
RemittanceReasonType: "REDEEM_ONLY_LOYALTY",
}
res, err := walletClient.Wallet.SendRemittance(context.Background(), request)
_, _ = spew.Printf("%#v\n", res)
request := adapter.RemittanceRequest{
Price: 100,
MemberId: 1,
Description: "bonus",
RemittanceReasonType: "REDEEM_ONLY_LOYALTY",
}
res, err := walletClient.Wallet.SendRemittance(context.Background(), request)
_, _ = spew.Printf("%#v\n", res)

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

func TestWallet_ReceiveRemittance(t *testing.T) {
request := adapter.RemittanceRequest{
Price: 10,
MemberId: 1,
Description: "bonus",
RemittanceReasonType: "REDEEM_ONLY_LOYALTY",
}
res, err := walletClient.Wallet.ReceiveRemittance(context.Background(), request)
_, _ = spew.Printf("%#v\n", res)
request := adapter.RemittanceRequest{
Price: 10,
MemberId: 1,
Description: "bonus",
RemittanceReasonType: "REDEEM_ONLY_LOYALTY",
}
res, err := walletClient.Wallet.ReceiveRemittance(context.Background(), request)
_, _ = spew.Printf("%#v\n", res)

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

func TestWallet_RetrieveRemittance(t *testing.T) {
res, err := walletClient.Wallet.RetrieveRemittance(context.Background(), 1)
_, _ = spew.Printf("%#v\n", res)
res, err := walletClient.Wallet.RetrieveRemittance(context.Background(), 1)
_, _ = spew.Printf("%#v\n", res)

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

func TestWallet_CreateWithdraw(t *testing.T) {
request := adapter.CreateWithdrawRequest{
Price: 5,
MemberId: 1,
Description: "Para çekme talebi",
Currency: "TRY",
}
res, err := walletClient.Wallet.CreateWithdraw(context.Background(), request)
_, _ = spew.Printf("%#v\n", res)
request := adapter.CreateWithdrawRequest{
Price: 5,
MemberId: 1,
Description: "Para çekme talebi",
Currency: "TRY",
}
res, err := walletClient.Wallet.CreateWithdraw(context.Background(), request)
_, _ = spew.Printf("%#v\n", res)

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

func TestWallet_CancelWithdraw(t *testing.T) {
res, err := walletClient.Wallet.CancelWithdraw(context.Background(), 1)
_, _ = spew.Printf("%#v\n", res)
res, err := walletClient.Wallet.CancelWithdraw(context.Background(), 1)
_, _ = spew.Printf("%#v\n", res)

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

func TestWallet_RetrieveWithdraw(t *testing.T) {
res, err := walletClient.Wallet.RetrieveWithdraw(context.Background(), 1)
_, _ = spew.Printf("%#v\n", res)
res, err := walletClient.Wallet.RetrieveWithdraw(context.Background(), 1)
_, _ = spew.Printf("%#v\n", res)

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

func TestWallet_SearchWithdraws(t *testing.T) {
request := adapter.SearchWithdrawsRequest{
Currency: "TRY",
MinWithdrawPrice: 0,
MaxWithdrawPrice: 10000,
MinCreatedDate: time.Now().AddDate(0, 0, -180),
MaxCreatedDate: time.Now(),
}
res, err := walletClient.Wallet.SearchWithdraws(context.Background(), request)
request := adapter.SearchWithdrawsRequest{
Currency: "TRY",
MinWithdrawPrice: 0,
MaxWithdrawPrice: 10000,
MinCreatedDate: time.Now().AddDate(0, 0, -180),
MaxCreatedDate: time.Now(),
}
res, err := walletClient.Wallet.SearchWithdraws(context.Background(), request)

_, _ = spew.Printf("%#v\n", res)
_, _ = spew.Printf("%#v\n", res)

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

func TestWallet_CreateMemberWallet(t *testing.T) {
request := adapter.CreateMemberWalletRequest{
NegativeAmountLimit: 0,
Currency: "TRY",
}
res, err := walletClient.Wallet.CreateMemberWallet(context.Background(), 1, request)
_, _ = spew.Printf("%#v\n", res)
request := adapter.CreateMemberWalletRequest{
NegativeAmountLimit: 0,
Currency: "TRY",
}
res, err := walletClient.Wallet.CreateMemberWallet(context.Background(), 1, request)
_, _ = spew.Printf("%#v\n", res)

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

func TestWallet_UpdateMemberWallet(t *testing.T) {
request := adapter.UpdateMemberWalletRequest{
NegativeAmountLimit: -10,
}
res, err := walletClient.Wallet.UpdateMemberWallet(context.Background(), 1, 1, request)
_, _ = spew.Printf("%#v\n", res)

if err != nil {
t.Errorf("Error %s", err.Error())
}
request := adapter.UpdateMemberWalletRequest{
NegativeAmountLimit: -10,
}
res, err := walletClient.Wallet.UpdateMemberWallet(context.Background(), 1, 1, request)
_, _ = spew.Printf("%#v\n", res)

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

0 comments on commit 3d7b72e

Please sign in to comment.