diff options
| author | Shulhan <ms@kilabit.info> | 2022-11-04 19:26:30 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2022-11-04 19:26:30 +0700 |
| commit | f56f142d9a9b10beac2081695cfbbbff481d4297 (patch) | |
| tree | 93b1fe112dd2bc5e0db0055165f710e6d3ba2b00 | |
| parent | 84e72cd4f383db1bfbf8b04471911217538bd49d (diff) | |
| download | duitku-f56f142d9a9b10beac2081695cfbbbff481d4297.tar.xz | |
all: export the request and response types
This is to make documentation for the type that embed those types more
clear.
| -rw-r--r-- | balance.go | 2 | ||||
| -rw-r--r-- | client.go | 4 | ||||
| -rw-r--r-- | request.go | 6 | ||||
| -rw-r--r-- | response.go | 4 | ||||
| -rw-r--r-- | rtol_inquiry.go | 2 | ||||
| -rw-r--r-- | rtol_inquiry_response.go | 2 | ||||
| -rw-r--r-- | rtol_transfer.go | 2 | ||||
| -rw-r--r-- | rtol_transfer_response.go | 2 |
8 files changed, 12 insertions, 12 deletions
@@ -4,7 +4,7 @@ import "github.com/shuLhan/share/lib/math/big" // Balance contains the current user balances. type Balance struct { - response + Response // Current balance before settlement. Current *big.Rat `json:"balance"` @@ -60,7 +60,7 @@ func NewClient(opts ClientOptions) (cl *Client, err error) { func (cl *Client) DisbursementCheckBalance() (bal *Balance, err error) { var ( logp = `DisbursementCheckBalance` - req = createRequest(cl.opts) + req = CreateRequest(cl.opts) httpRes *http.Response resBody []byte @@ -89,7 +89,7 @@ func (cl *Client) DisbursementCheckBalance() (bal *Balance, err error) { func (cl *Client) DisbursementListBank() (banks []Bank, err error) { var ( logp = `DisbursementListBank` - req = createRequest(cl.opts) + req = CreateRequest(cl.opts) res = struct { Data interface{} `json:"Banks"` Code string `json:"responseCode"` @@ -11,8 +11,8 @@ import ( "time" ) -// request define common HTTP request fields. -type request struct { +// Request define common HTTP request fields. +type Request struct { // Merchant email, filled from ClientOptions.Email. Email string `json:"email"` @@ -26,7 +26,7 @@ type request struct { Timestamp int64 `json:"timestamp"` } -func createRequest(opts ClientOptions) (req request) { +func CreateRequest(opts ClientOptions) (req Request) { req.UserID, _ = strconv.ParseInt(opts.UserID, 10, 64) req.Email = opts.Email req.Timestamp = time.Now().UnixMilli() diff --git a/response.go b/response.go index 791b732..1474ae2 100644 --- a/response.go +++ b/response.go @@ -31,8 +31,8 @@ const ( resCodeErrTimestampExpired = `-960` // Timestamp is expired (5 minutes). ) -// response contains commons fields for each HTTP response. -type response struct { +// Response contains commons fields for each HTTP response. +type Response struct { Code string `json:"responseCode"` Desc string `json:"responseDesc"` } diff --git a/rtol_inquiry.go b/rtol_inquiry.go index 33ab55d..17cd824 100644 --- a/rtol_inquiry.go +++ b/rtol_inquiry.go @@ -26,7 +26,7 @@ type RtolInquiry struct { // Customer name provided by merchant. SenderName string `json:"senderName"` - request + Request // Customer ID provided by merchant. SenderID int64 `json:"senderID"` diff --git a/rtol_inquiry_response.go b/rtol_inquiry_response.go index 1edc7a0..9e940f6 100644 --- a/rtol_inquiry_response.go +++ b/rtol_inquiry_response.go @@ -4,7 +4,7 @@ import "github.com/shuLhan/share/lib/math/big" // RtolInquiryResponse contains response from inquiry for Online Transfer. type RtolInquiryResponse struct { - response + Response // Email sent when inquiry process. Email string `json:"email"` diff --git a/rtol_transfer.go b/rtol_transfer.go index db6eabc..75b22b6 100644 --- a/rtol_transfer.go +++ b/rtol_transfer.go @@ -36,7 +36,7 @@ type rtolTransfer struct { // Description of transfer purpose. Purpose string `json:"purpose"` - request + Request // Disbursement transfer amount. Amount int64 `json:"amountTransfer"` diff --git a/rtol_transfer_response.go b/rtol_transfer_response.go index 3ce6eab..5392b76 100644 --- a/rtol_transfer_response.go +++ b/rtol_transfer_response.go @@ -11,5 +11,5 @@ type RtolTransferResponse struct { CustRefNumber string `json:"custRefNumber"` Amount *big.Rat `json:"amountTransfer"` - response + Response } |
