aboutsummaryrefslogtreecommitdiff
path: root/request.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2022-11-04 13:49:28 +0700
committerShulhan <ms@kilabit.info>2022-11-04 19:01:07 +0700
commit0eef440900eda71b3a257707e49e0ad53be5353f (patch)
tree7682364bc2f6ac826afd27fe71980ede98160b73 /request.go
parent1846d3fc5d6a364986c073afccc66936ab3e469d (diff)
downloadduitku-0eef440900eda71b3a257707e49e0ad53be5353f.tar.xz
all: implement API for online transfer inquiry
The RtolInquiry method get the information of the name of the account owner of the transfer destination. After getting this information, customers can determine whether the purpose of such a transfer is in accordance with the intended or not. If appropriate, the customer can proceed to the transfer process. Ref: https://docs.duitku.com/disbursement/en/#transfer-online
Diffstat (limited to 'request.go')
-rw-r--r--request.go16
1 files changed, 12 insertions, 4 deletions
diff --git a/request.go b/request.go
index 043a414..b446b32 100644
--- a/request.go
+++ b/request.go
@@ -7,19 +7,27 @@ import (
"crypto/sha256"
"encoding/hex"
"fmt"
+ "strconv"
"time"
)
// request define common HTTP request fields.
type request struct {
- UserID string `json:"userID"`
- Email string `json:"email"`
+ // Merchant email, filled from ClientOptions.Email.
+ Email string `json:"email"`
+
+ // Hash of some fields in the request along with its ApiKey.
Signature string `json:"signature"`
- Timestamp int64 `json:"timestamp"`
+
+ // Merchant ID, filled from ClientOptions.UserID.
+ UserID int64 `json:"userId"`
+
+ // Unix Timestamp in milliseconds.
+ Timestamp int64 `json:"timestamp"`
}
func createRequest(opts ClientOptions) (req request) {
- req.UserID = opts.UserID
+ req.UserID, _ = strconv.ParseInt(opts.UserID, 10, 64)
req.Email = opts.Email
req.Timestamp = time.Now().UnixMilli()