diff options
| -rw-r--r-- | client.go | 2 | ||||
| -rw-r--r-- | response.go | 56 |
2 files changed, 30 insertions, 28 deletions
@@ -236,7 +236,7 @@ func (cl *Client) ListBank() (banks []Bank, err error) { if err != nil { return nil, fmt.Errorf(`%s: %s`, logp, err) } - if res.Code != ResCodeSuccess { + if res.Code != StatusCodeSuccess { return nil, fmt.Errorf(`%s: %s: %s`, logp, res.Code, res.Desc) } diff --git a/response.go b/response.go index 6fb5049..7b34695 100644 --- a/response.go +++ b/response.go @@ -3,33 +3,35 @@ package duitku -// List of known response code. +// List of known [status codes]. +// +// [status codes]: https://docs.duitku.com/disbursement/en/#status-code const ( - ResCodeSuccess = `00` // Approved or completed successfully. - resCodeError = `EE` // General Error. - resCodeErrTimeout = `TO` // Response time out from ATM Bersama Network (Do not retry). - resCodeErrLink = `LD` // Link problem between Duitku and ATM Bersama Network. - resCodeErrNF = `NF` // Transaction has not recorded on Remittance gateway. - resCodeErrAccountInvalid = `76` // Invalid destination account. - resCodeErrCallbackWait = `80` // Waiting for callback. - resCodeErrOther = `-100` // Other error (do not retry). - resCodeErrUserID = `-120` // User not found. - resCodeErrUserBlocked = `-123` // User has been blocked. - resCodeErrAmount = `-141` // Amount transfer invalid. - resCodeErrTxFinish = `-142` // Transaction already Finished. - resCodeErrBankH2H = `-148` // Bank not support H2H. - resCodeErrBankNotFound = `-149` // Bank not found. - resCodeErrCallbackNotFound = `-161` // Callback URL not found. - resCodeErrSignature = `-191` // Wrong signature. - resCodeErrAccountBlocked = `-192` // Account number is blacklisted. - resCodeErrEmail = `-213` // Email is not valid. - resCodeErrTransferNotFound = `-420` // Transfer not Found. - resCodeErrFundInsufficient = `-510` // Insufficient Fund. - resCodeErrFundLimit = `-920` // Limit Exceeded. - resCodeErrIP = `-930` // IP not whitelisted. - resCodeErrVendorTimeout = `-951` // Time Out Vendor. - resCodeErrParam = `-952` // Invalid Parameter. - resCodeErrTimestampExpired = `-960` // Timestamp is expired (5 minutes). + StatusCodeSuccess = `00` // Approved or completed successfully. + StatusCodeError = `EE` // General Error. + StatusCodeErrTimeout = `TO` // Response time out from ATM Bersama Network (Do not retry). + StatusCodeErrLink = `LD` // Link problem between Duitku and ATM Bersama Network. + StatusCodeErrNF = `NF` // Transaction has not recorded on Remittance gateway. + StatusCodeErrAccountInvalid = `76` // Invalid destination account. + StatusCodeErrCallbackWait = `80` // Waiting for callback. + StatusCodeErrOther = `-100` // Other error (do not retry). + StatusCodeErrUserID = `-120` // User not found. + StatusCodeErrUserBlocked = `-123` // User has been blocked. + StatusCodeErrAmount = `-141` // Amount transfer invalid. + StatusCodeErrTxFinish = `-142` // Transaction already Finished. + StatusCodeErrBankH2H = `-148` // Bank not support H2H. + StatusCodeErrBankNotFound = `-149` // Bank not found. + StatusCodeErrCallbackNotFound = `-161` // Callback URL not found. + StatusCodeErrSignature = `-191` // Wrong signature. + StatusCodeErrAccountBlocked = `-192` // Account number is blacklisted. + StatusCodeErrEmail = `-213` // Email is not valid. + StatusCodeErrTransferNotFound = `-420` // Transfer not Found. + StatusCodeErrFundInsufficient = `-510` // Insufficient Fund. + StatusCodeErrFundLimit = `-920` // Limit Exceeded. + StatusCodeErrIP = `-930` // IP not whitelisted. + StatusCodeErrVendorTimeout = `-951` // Time Out Vendor. + StatusCodeErrParam = `-952` // Invalid Parameter. + StatusCodeErrTimestampExpired = `-960` // Timestamp is expired (5 minutes). ) // Response contains commons fields for each HTTP response. @@ -40,5 +42,5 @@ type Response struct { // IsSuccess return true if the response code equal to 00. func (res *Response) IsSuccess() bool { - return res.Code == ResCodeSuccess + return res.Code == StatusCodeSuccess } |
