aboutsummaryrefslogtreecommitdiff
path: root/client_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-02-01 14:56:51 +0700
committerShulhan <ms@kilabit.info>2023-02-01 15:26:41 +0700
commit78469f295acd5931d64c8af483c0261ff2eb6183 (patch)
treeff055c4b6759ff4e40f8bc3175de1968cb21e8a5 /client_test.go
parentdd24a0248dc011fe43540b7a8f1487ed7d1e5d90 (diff)
downloadduitku-78469f295acd5931d64c8af483c0261ff2eb6183.tar.xz
all: implement API to check merchant transaction status
The MerchantTxStatus method check the payment status by its orderID and payment method. Reference: https://docs.duitku.com/api/en/#check-transaction
Diffstat (limited to 'client_test.go')
-rw-r--r--client_test.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/client_test.go b/client_test.go
index 832bf3a..2c58db5 100644
--- a/client_test.go
+++ b/client_test.go
@@ -254,6 +254,28 @@ func TestClient_MerchantInquiry(t *testing.T) {
t.Logf(`MerchantInquiry: response: %s`, got)
test.Assert(t, `MerchantInquiry`, string(exp), string(got))
+
+ // Test checking the transaction status.
+
+ var (
+ txResp *TxStatusResponse
+ )
+
+ txResp, err = testClientMerchant.MerchantTxStatus(req.MerchantOrderId, req.PaymentMethod)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ got, err = json.MarshalIndent(txResp, ``, ` `)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ tag = `tx_status_response.json`
+ exp = tdata.Output[tag]
+ exp = bytes.ReplaceAll(exp, []byte(`$ref`), []byte(resp.Reference))
+ t.Logf(`MerchantTxStatus: response: %s`, got)
+ test.Assert(t, `MerchantTxStatus`, string(exp), string(got))
}
func TestClient_MerchantPaymentMethod(t *testing.T) {