aboutsummaryrefslogtreecommitdiff
path: root/client_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-03-17 13:57:34 +0700
committerShulhan <ms@kilabit.info>2023-03-17 13:57:34 +0700
commit548c92ff835de375e2b35add255bd4bf77a3e632 (patch)
treeae5e4557904dd0a59f690431dc25f0be14e102d7 /client_test.go
parent3d29a1cf144c785c8a210c1e85061968446b2433 (diff)
downloadduitku-548c92ff835de375e2b35add255bd4bf77a3e632.tar.xz
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.
Diffstat (limited to 'client_test.go')
-rw-r--r--client_test.go14
1 files changed, 9 insertions, 5 deletions
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) {