Skip to content

Commit

Permalink
Merge pull request #37 from veritrans/add-expiry-optional-params-for-…
Browse files Browse the repository at this point in the history
…snap

add expiry param for snap
  • Loading branch information
rizdaprasetya authored May 13, 2019
2 parents 7a8941d + 282992a commit ff7f567
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions request.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ type TransactionDetails struct {
GrossAmt int64 `json:"gross_amount"`
}

// ExpiryDetail : Represent SNAP expiry details
type ExpiryDetail struct {
StartTime string `json:"start_time,omitempty"`
Unit string `json:"unit"`
Duration int64 `json:"duration"`
}

// CreditCardDetail : Represent credit card detail
type CreditCardDetail struct {
Secure bool `json:"secure,omitempty"`
Expand Down Expand Up @@ -196,6 +203,7 @@ type SnapReq struct {
EnabledPayments []PaymentType `json:"enabled_payments"`
Items *[]ItemDetail `json:"item_details,omitempty"`
CustomerDetail *CustDetail `json:"customer_details,omitempty"`
Expiry *ExpiryDetail `json:"expiry,omitempty"`
CreditCard *CreditCardDetail `json:"credit_card,omitempty"`
Gopay *GopayDetail `json:"gopay,omitempty"`
CustomField1 string `json:"custom_field1"`
Expand Down
5 changes: 5 additions & 0 deletions snap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ func TestSnapCreateToken(t *testing.T) {
Name: "Someitem",
},
},
Expiry: &midtrans.ExpiryDetail{
// StartTime: "2019-05-13 18:00:00 +0700",
Unit: "hour",
Duration: 48,
},
Gopay: &midtrans.GopayDetail{
EnableCallback: true,
CallbackUrl: "https://example.com/gopay/finish",
Expand Down

0 comments on commit ff7f567

Please sign in to comment.