From 548c92ff835de375e2b35add255bd4bf77a3e632 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Fri, 17 Mar 2023 13:57:34 +0700 Subject: all: change the MerchantTxStatus parameter to struct The idea is to allow the caller to know the Signature of request after call to MerchantTxStatus and possibly log the whole request. While at it, we change the method name to MerchantPaymentStatus and the type from transactionStatus to PaymentStatus, and from TxStatusResponse to PaymentStatusResponse. --- client_test.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'client_test.go') diff --git a/client_test.go b/client_test.go index 109712d..e54a825 100644 --- a/client_test.go +++ b/client_test.go @@ -258,15 +258,19 @@ func TestClient_MerchantInquiry(t *testing.T) { // Test checking the transaction status. var ( - txResp *TxStatusResponse + paymentReq = &PaymentStatus{ + MerchantCode: req.PaymentMethod, + OrderID: req.MerchantOrderId, + } + paymentResp *PaymentStatusResponse ) - txResp, err = testClientMerchant.MerchantTxStatus(req.MerchantOrderId, req.PaymentMethod) + paymentResp, err = testClientMerchant.MerchantPaymentStatus(paymentReq) if err != nil { t.Fatal(err) } - got, err = json.MarshalIndent(txResp, ``, ` `) + got, err = json.MarshalIndent(paymentResp, ``, ` `) if err != nil { t.Fatal(err) } @@ -274,8 +278,8 @@ func TestClient_MerchantInquiry(t *testing.T) { 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)) + t.Logf(`MerchantPaymentStatus: response: %s`, got) + test.Assert(t, `MerchantPaymentStatus`, string(exp), string(got)) } func TestClient_MerchantPaymentMethod(t *testing.T) { -- cgit v1.3