Skip to content

Commit

Permalink
Added missing refund properties (#79)
Browse files Browse the repository at this point in the history
## Description

Add missing refund properties to refund model.
  • Loading branch information
AnasNaouchi authored May 7, 2024
1 parent 73e1350 commit ebcefbe
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
14 changes: 10 additions & 4 deletions operations/refund_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,24 @@ import (

func TestRefund(t *testing.T) {
const (
ChargeID = "chrg_test_4yq7duw15p9hdrjp8oq"
TransactionID = "trxn_test_4yqmv79fzpy0gmz5mmq"
RefundID = "rfnd_test_4yqmv79ahghsiz23y3c"
ChargeID = "chrg_test_4yq7duw15p9hdrjp8oq"
TransactionID = "trxn_test_4yqmv79fzpy0gmz5mmq"
RefundID = "rfnd_test_4yqmv79ahghsiz23y3c"
Status = "closed"
FundingCurrency = "THB"
FundingAmount = int64(10000)
)

client := testutil.NewFixedClient(t)

refund := &omise.Refund{}
client.MustDo(refund, &RetrieveRefund{ChargeID, RefundID})
r.Equal(t, RefundID, refund.ID)
r.Equal(t, ChargeID, refund.Charge)
r.Equal(t, TransactionID, refund.Transaction)
r.Equal(t, Status, refund.Status)
r.Equal(t, FundingCurrency, refund.FundingCurrency)
r.Equal(t, FundingAmount, refund.FundingAmount)

refund = &omise.Refund{}
client.MustDo(refund, &CreateRefund{
Expand Down
14 changes: 9 additions & 5 deletions refund.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ package omise
// See https://www.omise.co/refunds-api for more information.
type Refund struct {
Base
Amount int64 `json:"amount"`
Currency string `json:"currency"`
Charge string `json:"charge"`
Transaction string `json:"transaction"`
Metadata map[string]interface{} `json:"metadata"`
Status string `json:"status"`
Voided bool `json:"voided"`
FundingAmount int64 `json:"funding_amount"`
Amount int64 `json:"amount"`
Currency string `json:"currency"`
FundingCurrency string `json:"funding_currency"`
Charge string `json:"charge"`
Transaction string `json:"transaction"`
Metadata map[string]interface{} `json:"metadata"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@
"currency": "thb",
"charge": "chrg_test_4yq7duw15p9hdrjp8oq",
"transaction": "trxn_test_4yqmv79fzpy0gmz5mmq",
"created": "2015-01-16T07:23:45Z"
"created": "2015-01-16T07:23:45Z",
"funding_currency": "THB",
"funding_amount": 10000,
"status": "closed"
}

0 comments on commit ebcefbe

Please sign in to comment.