diff --git a/operations/refund_test.go b/operations/refund_test.go index f682127a..e64b1c05 100644 --- a/operations/refund_test.go +++ b/operations/refund_test.go @@ -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{ diff --git a/refund.go b/refund.go index 1d268ff1..f891d3e0 100644 --- a/refund.go +++ b/refund.go @@ -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"` } diff --git a/testdata/fixtures/api.omise.co/charges/chrg_test_4yq7duw15p9hdrjp8oq/refunds/rfnd_test_4yqmv79ahghsiz23y3c-get.json b/testdata/fixtures/api.omise.co/charges/chrg_test_4yq7duw15p9hdrjp8oq/refunds/rfnd_test_4yqmv79ahghsiz23y3c-get.json index 558df35a..32a464c7 100644 --- a/testdata/fixtures/api.omise.co/charges/chrg_test_4yq7duw15p9hdrjp8oq/refunds/rfnd_test_4yqmv79ahghsiz23y3c-get.json +++ b/testdata/fixtures/api.omise.co/charges/chrg_test_4yq7duw15p9hdrjp8oq/refunds/rfnd_test_4yqmv79ahghsiz23y3c-get.json @@ -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" }