Skip to content

Commit

Permalink
Merge pull request #126 from rjjatson/feature/add-transaction-client
Browse files Browse the repository at this point in the history
Add transaction client to the collective API
  • Loading branch information
adityarx authored May 26, 2023
2 parents 0bb367e + 708f683 commit 55ed3b0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions client/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/xendit/xendit-go/qrcode"
"github.com/xendit/xendit-go/recurringpayment"
"github.com/xendit/xendit-go/retailoutlet"
"github.com/xendit/xendit-go/transaction"
"github.com/xendit/xendit-go/virtualaccount"
)

Expand All @@ -35,6 +36,7 @@ type API struct {
Disbursement *disbursement.Client
QRCode *qrcode.Client
Customer *customer.Client
Transaction *transaction.Client
}

func (a *API) init() {
Expand All @@ -50,6 +52,7 @@ func (a *API) init() {
a.Disbursement = &disbursement.Client{Opt: &a.opt, APIRequester: a.apiRequester}
a.QRCode = &qrcode.Client{Opt: &a.opt, APIRequester: a.apiRequester}
a.Customer = &customer.Client{Opt: &a.opt, APIRequester: a.apiRequester}
a.Transaction = &transaction.Client{Opt: &a.opt, APIRequester: a.apiRequester}
}

// New creates a new Xendit API client
Expand Down
6 changes: 3 additions & 3 deletions transaction/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/xendit/xendit-go/utils/validator"
)

// Client is the client used to invoke invoice API.
// Client is the client used to invoke transaction API
type Client struct {
Opt *xendit.Option
APIRequester xendit.APIRequester
Expand Down Expand Up @@ -50,12 +50,12 @@ func (c *Client) GetTransactionnWithContext(ctx context.Context, data *GetTransa
return response, nil
}

// GetListTransaction gets list transaction
// GetListTransaction gets list transactions
func (c *Client) GetListTransaction(data *GetListTransactionParams) (*xendit.ListTransactions, *xendit.Error) {
return c.GetListTransactionWithContext(context.Background(), data)
}

// GetListTransactionWithContext gets list transaction with context
// GetListTransactionWithContext gets list transactions with context
func (c *Client) GetListTransactionWithContext(ctx context.Context, data *GetListTransactionParams) (*xendit.ListTransactions, *xendit.Error) {
if err := validator.ValidateRequired(ctx, data); err != nil {
return nil, validator.APIValidatorErr(err)
Expand Down

0 comments on commit 55ed3b0

Please sign in to comment.