Skip to content

Commit

Permalink
Merge pull request #25 from slzhffktm/ewallet-api-version
Browse files Browse the repository at this point in the history
Changes for new OVO Create Payment Flow
  • Loading branch information
stanleynguyen authored Feb 25, 2020
2 parents 952d2f4 + 207e3f8 commit 43c8181
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
16 changes: 9 additions & 7 deletions ewallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ const (
// EWallet contains data from Xendit's API response of e-wallet related requests.
// For more details see https://xendit.github.io/apireference/?bash#ewallets.
type EWallet struct {
EWalletType EWalletTypeEnum `json:"ewallet_type"`
ExternalID string `json:"external_id"`
Status string `json:"status"`
Amount float64 `json:"amount"`
TransactionDate *time.Time `json:"transaction_date,omitempty"`
CheckoutURL string `json:"checkout_url,omitempty"`
BusinessID string `json:"business_id,omitempty"`
EWalletType EWalletTypeEnum `json:"ewallet_type"`
ExternalID string `json:"external_id"`
Status string `json:"status"`
Amount float64 `json:"amount"`
TransactionDate *time.Time `json:"transaction_date,omitempty"`
CheckoutURL string `json:"checkout_url,omitempty"`
BusinessID string `json:"business_id,omitempty"`
Created *time.Time `json:"created,omitempty"`
EWalletTransactionID string `json:"e_wallet_transaction_id,omitempty"`
}
3 changes: 3 additions & 0 deletions ewallet/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ func (c *Client) CreatePaymentWithContext(ctx context.Context, data *CreatePayme
if data.ForUserID != "" {
header.Add("for-user-id", data.ForUserID)
}
if data.XApiVersion != "" {
header.Add("X-API-VERSION", data.XApiVersion)
}

err := c.APIRequester.Call(
ctx,
Expand Down
1 change: 1 addition & 0 deletions ewallet/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type Item struct {

// CreatePaymentParams contains parameters for CreatePayment
type CreatePaymentParams struct {
XApiVersion string `json:"-"`
ForUserID string `json:"-"`
EWalletType xendit.EWalletTypeEnum `json:"ewallet_type" validate:"required"`
ExternalID string `json:"external_id" validate:"required"`
Expand Down

0 comments on commit 43c8181

Please sign in to comment.