aboutsummaryrefslogtreecommitdiff
path: root/response.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2022-11-30 11:38:02 +0700
committerShulhan <ms@kilabit.info>2022-11-30 11:46:03 +0700
commit8b09c9242786c89c230648527d39fbdf0276fc5c (patch)
tree2a5963ba4b55fb7ba613024d86aa859740fb5cdd /response.go
parentd87a6303817bb41d5d4f21a4652fc7b4a32ed581 (diff)
downloadduitku-8b09c9242786c89c230648527d39fbdf0276fc5c.tar.xz
all: do not check for response Code on transfer
As long as the response body is valid, return it to caller and let them check the response code manually. This is to allow user to log the request and full response.
Diffstat (limited to 'response.go')
-rw-r--r--response.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/response.go b/response.go
index 1474ae2..6fb5049 100644
--- a/response.go
+++ b/response.go
@@ -3,8 +3,9 @@
package duitku
+// List of known response code.
const (
- resCodeSuccess = `00` // Approved or completed successfully.
+ 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.
@@ -36,3 +37,8 @@ type Response struct {
Code string `json:"responseCode"`
Desc string `json:"responseDesc"`
}
+
+// IsSuccess return true if the response code equal to 00.
+func (res *Response) IsSuccess() bool {
+ return res.Code == ResCodeSuccess
+}