diff options
| author | Shulhan <ms@kilabit.info> | 2022-11-18 18:05:19 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2022-11-18 18:05:19 +0700 |
| commit | 80af1ff2a264a875fbd8dbf0a0ae8926c1ef396e (patch) | |
| tree | 364f2b3ca4cfe8b43bfe13ad0614c660b090787e /rtol_transfer.go | |
| parent | f98eb44cd053677b921753912e1b908f4510b28d (diff) | |
| download | duitku-80af1ff2a264a875fbd8dbf0a0ae8926c1ef396e.tar.xz | |
all: export types RtolTransfer, ClearingTransfer and method Sign
The idea is to allow testing the client from other module without
using the provided APIs.
Diffstat (limited to 'rtol_transfer.go')
| -rw-r--r-- | rtol_transfer.go | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/rtol_transfer.go b/rtol_transfer.go index 9766092..4ba8718 100644 --- a/rtol_transfer.go +++ b/rtol_transfer.go @@ -11,7 +11,7 @@ import ( "time" ) -// rtolTransfer containts request to transfer amount from merchant to +// RtolTransfer containts request to transfer amount from merchant to // customer's bank account, using the previous data obtained from the inquiry // process. // @@ -20,7 +20,7 @@ import ( // disburseId + secretKey). // // Ref: https://docs.duitku.com/disbursement/en/#online-transfer-transfer-request -type rtolTransfer struct { +type RtolTransfer struct { // Bank Account owner, obtained after getting a response from the // inquiry process. AccountName string `json:"accountName"` @@ -48,10 +48,10 @@ type rtolTransfer struct { DisburseID int64 `json:"disburseId"` } -// newRtolTransfer create new rtolTransfer request from request and response +// NewRtolTransfer create new RtolTransfer request from request and response // of RtolInquiry. -func newRtolTransfer(inquiryReq *RtolInquiry, inquiryRes *RtolInquiryResponse) (req *rtolTransfer) { - req = &rtolTransfer{ +func NewRtolTransfer(inquiryReq *RtolInquiry, inquiryRes *RtolInquiryResponse) (req *RtolTransfer) { + req = &RtolTransfer{ Amount: inquiryReq.Amount, Purpose: inquiryReq.Purpose, @@ -64,7 +64,9 @@ func newRtolTransfer(inquiryReq *RtolInquiry, inquiryRes *RtolInquiryResponse) ( return req } -func (req *rtolTransfer) sign(opts ClientOptions) { +// Sign the request, fill the UserID, Email, Timestamp, and generate the +// Signature. +func (req *RtolTransfer) Sign(opts ClientOptions) { var ( now = time.Now() |
