aboutsummaryrefslogtreecommitdiff
path: root/client.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.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.go')
-rw-r--r--client.go15
1 files changed, 6 insertions, 9 deletions
diff --git a/client.go b/client.go
index 68790b1..98ba946 100644
--- a/client.go
+++ b/client.go
@@ -322,24 +322,21 @@ func (cl *Client) MerchantPaymentMethod(req *PaymentMethod) (resp *PaymentMethod
return resp, nil
}
-// [MerchantTxStatus] get the status of payment from customer.
+// [MerchantPaymentStatus] get the status of payment from customer.
//
-// [MerchantTxStatus]: https://docs.duitku.com/api/en/#check-transaction
-func (cl *Client) MerchantTxStatus(orderID, paymentMethod string) (resp *TxStatusResponse, err error) {
+// [MerchantPaymentStatus]: https://docs.duitku.com/api/en/#check-transaction
+func (cl *Client) MerchantPaymentStatus(req *PaymentStatus) (resp *PaymentStatusResponse, err error) {
var (
- logp = `MerchantTxStatus`
- req = transactionStatus{
- OrderID: orderID,
- }
+ logp = `MerchantPaymentStatus`
params url.Values
httpRes *http.Response
resBody []byte
)
- req.sign(cl.opts, paymentMethod)
+ req.sign(cl.opts)
- params, err = libhttp.MarshalForm(req)
+ params, err = libhttp.MarshalForm(*req)
if err != nil {
return nil, fmt.Errorf(`%s: %w`, logp, err)
}