-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b9dc2d4
commit d1098a2
Showing
3 changed files
with
181 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,90 @@ | ||
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) | ||
} | ||
} | ||
|
||
func TestSettlement_CreateMerchantPayoutAccount(t *testing.T) { | ||
request := adapter.CreatePayoutAccountRequest{ | ||
AccountType: craftgate.PayoutAccountTypeWISE, | ||
ExternalAccountId: "wiseRecipientId", | ||
Currency: craftgate.USD, | ||
AccountOwner: craftgate.AccountOwnerMERCHANT, | ||
} | ||
|
||
res, err := settlementClient.Settlement.CreatePayoutAccount(context.Background(), request) | ||
_, _ = spew.Printf("%#v\n", res) | ||
|
||
if err != nil { | ||
t.Errorf("Error %s", err) | ||
} | ||
} | ||
|
||
func TestSettlement_CreateSubMerchantPayoutAccount(t *testing.T) { | ||
request := adapter.CreatePayoutAccountRequest{ | ||
AccountType: craftgate.PayoutAccountTypeWISE, | ||
ExternalAccountId: "wiseRecipientId", | ||
Currency: craftgate.EUR, | ||
AccountOwner: craftgate.AccountOwnerSUB_MERCHANT_MEMBER, | ||
SubMerchantMemberId: 1, | ||
} | ||
|
||
res, err := settlementClient.Settlement.CreatePayoutAccount(context.Background(), request) | ||
_, _ = spew.Printf("%#v\n", res) | ||
|
||
if err != nil { | ||
t.Errorf("Error %s", err) | ||
} | ||
} | ||
|
||
func TestSettlement_UpdatePayoutAccount(t *testing.T) { | ||
request := adapter.UpdatePayoutAccountRequest{ | ||
AccountType: craftgate.PayoutAccountTypeWISE, | ||
ExternalAccountId: "wiseRecipientId2", | ||
} | ||
|
||
err := settlementClient.Settlement.UpdatePayoutAccount(context.Background(), 18, request) | ||
|
||
if err != nil { | ||
t.Errorf("Error %s", err) | ||
} | ||
} | ||
|
||
func TestSettlement_DeletePayoutAccount(t *testing.T) { | ||
err := settlementClient.Settlement.DeletePayoutAccount(context.Background(), 18) | ||
|
||
if err != nil { | ||
t.Errorf("Error %s", err) | ||
} | ||
} | ||
|
||
func TestSettlement_SearchPayoutAccounts(t *testing.T) { | ||
request := adapter.SearchPayoutAccountRequest{ | ||
Currency: craftgate.USD, | ||
AccountOwner: craftgate.AccountOwnerMERCHANT, | ||
} | ||
|
||
res, err := settlementClient.Settlement.SearchPayoutAccounts(context.Background(), request) | ||
_, _ = spew.Printf("%#v\n", res) | ||
|
||
if err != nil { | ||
t.Errorf("Error %s", err) | ||
} | ||
} |