-
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.
adds bank account tracking adapter to retrieve bank account tracking …
…record
- Loading branch information
Alican Akkus
authored and
Alican Akkus
committed
Jul 24, 2023
1 parent
95bdfa7
commit 020deb7
Showing
4 changed files
with
90 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package adapter | ||
|
||
import ( | ||
"context" | ||
"net/http" | ||
) | ||
|
||
type BankAccountTracking struct { | ||
Client *Client | ||
} | ||
|
||
func (api *BankAccountTracking) SearchRecords(ctx context.Context, request SearchBankAccountTrackingRecordRequest) (*DataResponse[BankAccountTrackingRecordResponse], error) { | ||
newRequest, err := api.Client.NewRequest(ctx, http.MethodGet, "/bank-account-tracking/v1/merchant-bank-account-trackings/records", request) | ||
if err != nil { | ||
return nil, err | ||
} | ||
response := &Response[DataResponse[BankAccountTrackingRecordResponse]]{} | ||
err = api.Client.Do(ctx, newRequest, response) | ||
|
||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return response.Data, nil | ||
} |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
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" | ||
) | ||
|
||
var bankAccountTrackingClient, _ = craftgate.New("api-key", "secret-key", "https://sandbox-api.craftgate.io") | ||
|
||
func TestPayment_SearchBankAccountTrackingRecords(t *testing.T) { | ||
request := adapter.SearchBankAccountTrackingRecordRequest{ | ||
Page: 0, | ||
Size: 10, | ||
Currency: craftgate.Currency("TRY"), | ||
} | ||
|
||
res, err := bankAccountTrackingClient.BankAccountTracking.SearchRecords(context.Background(), request) | ||
_, _ = spew.Printf("%#v\n", res) | ||
|
||
if err != nil { | ||
t.Errorf("Error %s", err) | ||
} | ||
} |