Documentation
¶
Index ¶
- Constants
- Variables
- type CardTokenOTPRequest
- type CardTokenOTPRequestData
- type CardTokenOTPResponse
- type CardTokenOTPResponseData
- type CardTokenOTPVerifyRequest
- type CardTokenOTPVerifyRequestData
- type CardTokenOTPVerifyResponse
- type CardTokenOTPVerifyResponseData
- type ChargeDetailRequest
- type ChargeDetailRequestData
- type ChargeDetailResponse
- type ChargeDetailResponseData
- type Client
- func (c *Client) Call(method, path string, header map[string]string, body io.Reader, v interface{}, ...) error
- func (c *Client) DirectDebitHostUseSandboxPrefix(use bool)
- func (c *Client) ExecuteRequest(req *http.Request, v interface{}, vErr interface{}) error
- func (c *Client) NewRequest(method string, fullPath string, headers map[string]string, body io.Reader) (*http.Request, error)
- type CoreGateway
- func (gateway *CoreGateway) Call(method, path string, header map[string]string, body io.Reader, v interface{}, ...) error
- func (gateway *CoreGateway) CallDirectDebit(method, path string, header map[string]string, body io.Reader, v interface{}) error
- func (g *CoreGateway) CreateCardTokenOTP(token string, req CardTokenOTPRequest) (res CardTokenOTPResponse, err error)
- func (g *CoreGateway) CreateCardTokenOTPVerify(token string, req CardTokenOTPVerifyRequest) (res CardTokenOTPVerifyResponse, err error)
- func (g *CoreGateway) CreatePaymentChargeOTP(token, idempotencyKey string, req PaymentChargeOTPRequest) (res PaymentChargeResponse, err error)
- func (g *CoreGateway) CreatePaymentChargeOTPVerify(token string, req PaymentChargeOTPVerifyRequest) (res PaymentChargeResponse, err error)
- func (gateway *CoreGateway) CreateVA(token string, req CreateVaRequest) (res VaResponse, err error)
- func (g *CoreGateway) DeleteCardToken(token string, req DeleteCardTokenRequest) (res DeleteCardTokenResponse, err error)
- func (gateway *CoreGateway) DeleteVA(token string, institutionCode string, brivaNo string, custCode string) (res VaResponse, respErr ErrorResponse, err error)
- func (g *CoreGateway) GetChargeDetail(token string, req ChargeDetailRequest) (res ChargeDetailResponse, err error)
- func (gateway *CoreGateway) GetReportVA(token string, req GetReportVaRequest) (res VaReportResponse, err error)
- func (gateway *CoreGateway) GetToken() (res TokenResponse, err error)
- func (g *CoreGateway) RefundDirectDebit(token string, idempotencyKey string, req RefundRequest) (res RefundResponse, err error)
- func (gateway *CoreGateway) UpdateVA(token string, req CreateVaRequest) (res VaResponse, err error)
- type CreateVaRequest
- type DeleteCardTokenRequest
- type DeleteCardTokenRequestData
- type DeleteCardTokenResponse
- type DeleteCardTokenResponseData
- type ErrorDetail
- type ErrorResponse
- type ErrorStatus
- type GetReportVaRequest
- type Location
- type PaymentChargeOTPRequest
- type PaymentChargeOTPRequestData
- type PaymentChargeOTPVerifyRequest
- type PaymentChargeOTPVerifyRequestData
- type PaymentChargeResponse
- type PaymentChargeResponseData
- type RefundRequest
- type RefundRequestData
- type RefundResponse
- type RefundResponseData
- type TokenResponse
- type VaData
- type VaReportData
- type VaReportResponse
- type VaResponse
Constants ¶
const ( TOKEN_PATH = "/oauth/client_credential/accesstoken?grant_type=client_credentials" VA_PATH = "/v1/briva" VA_REPORT_PATH = "/v1/briva/report" BRI_TIME_FORMAT = "2006-01-02T15:04:05.999Z" )
Variables ¶
var ErrPendingTransaction = errors.New("Transaction is pending")
ErrPendingTransaction defines error if BRI response with http status 200 but html error body. Transaction should be pending and need to be inquired.
Functions ¶
This section is empty.
Types ¶
type CardTokenOTPRequest ¶ added in v0.6.0
type CardTokenOTPRequest struct {
Body CardTokenOTPRequestData `json:"body"`
}
CardTokenOTPRequest defines payload for direct debit - create card token OTP
type CardTokenOTPRequestData ¶ added in v0.6.0
type CardTokenOTPRequestData struct {
CardPan string `json:"card_pan"`
PhoneNumber string `json:"phone_number"`
Email string `json:"email"`
OtpBriStatus string `json:"otp_bri_status"`
}
CardTokenOTPRequestData defines item data payload for direct debit - create card token OTP
type CardTokenOTPResponse ¶ added in v0.6.0
type CardTokenOTPResponse struct {
Body CardTokenOTPResponseData `json:"body"`
ErrorResponse
}
CardTokenOTPResponse defines response for direct debit - create card token OTP
type CardTokenOTPResponseData ¶ added in v0.6.0
CardTokenOTPResponseData defines data response for direct debit - create card token OTP
type CardTokenOTPVerifyRequest ¶ added in v0.6.0
type CardTokenOTPVerifyRequest struct {
Body CardTokenOTPVerifyRequestData `json:"body"`
}
CardTokenOTPVerifyRequest defines payload for direct debit - create card token OTP verify
type CardTokenOTPVerifyRequestData ¶ added in v0.6.0
type CardTokenOTPVerifyRequestData struct {
RegistrationToken string `json:"registration_token"`
Passcode string `json:"passcode"`
}
CardTokenOTPVerifyRequestData defines item data payload for direct debit - create card token OTP verify
type CardTokenOTPVerifyResponse ¶ added in v0.6.0
type CardTokenOTPVerifyResponse struct {
Body CardTokenOTPVerifyResponseData `json:"body"`
ErrorResponse
}
CardTokenOTPVerifyResponse defines response for direct debit - create card token OTP verify
type CardTokenOTPVerifyResponseData ¶ added in v0.6.0
type CardTokenOTPVerifyResponseData struct {
Status string `json:"status"`
PhoneNumber string `json:"phone_number"`
DeviceID string `json:"device_id"`
CardToken string `json:"card_token"`
Location Location `json:"location"`
Last4 string `json:"last4"`
Email string `json:"email"`
CardType string `json:"card_type"`
LimitTransaction string `json:"limit_transaction"`
Metadata map[string]interface{} `json:"metadata"`
}
CardTokenOTPVerifyResponseData defines data response for direct debit - create card token OTP verify
type ChargeDetailRequest ¶ added in v0.9.0
type ChargeDetailRequest struct {
Body ChargeDetailRequestData `json:"body"`
}
ChargeDetailRequest defines payload for direct debit - charge detail
type ChargeDetailRequestData ¶ added in v0.9.0
type ChargeDetailRequestData struct {
PaymentID string `json:"payment_id"`
Remarks string `json:"remarks"`
Metadata map[string]interface{} `json:"metadata"`
}
ChargeDetailRequestData defines data payload for direct debit - charge detail
type ChargeDetailResponse ¶ added in v0.9.0
type ChargeDetailResponse struct {
Body ChargeDetailResponseData `json:"body"`
ErrorResponse
}
ChargeDetailResponse defines response for direct debit - charge detail
type ChargeDetailResponseData ¶ added in v0.9.0
type ChargeDetailResponseData struct {
Status string `json:"status"`
Amount string `json:"amount"`
Currency string `json:"currency"`
PaymentID string `json:"payment_id"`
RemarksMerchant string `json:"remarks_merchant"`
PaymentStatus string `json:"payment_status"`
RefundHistory []RefundResponseData `json:"refund_history"`
DeviceID string `json:"device_id"`
Location Location `json:"location"`
Metadata map[string]interface{} `json:"metadata"`
}
ChargeDetailResponseData defines data response for direct debit - charge detail
type Client ¶
type Client struct {
BaseUrl string
DirectDebitBaseURL string
ClientId string
ClientSecret string
APIKey string
LogLevel int
Timeout time.Duration
Logger *log.Logger
IsProduction bool
}
func NewClient ¶
func NewClient() Client
NewClient : this function will always be called when the library is in use
func (*Client) Call ¶
func (c *Client) Call(method, path string, header map[string]string, body io.Reader, v interface{}, vErr interface{}) error
Call the BRI API at specific `path` using the specified HTTP `method`. The result will be given to `v` if there is no error. If any error occurred, the return of this function is the error itself, otherwise nil.
func (*Client) DirectDebitHostUseSandboxPrefix ¶ added in v0.7.1
DirectDebitHostUseSandboxPrefix used to modify direct debit staging url to use /sandbox/* path due to different host
func (*Client) ExecuteRequest ¶
ExecuteRequest : execute request
type CoreGateway ¶
type CoreGateway struct {
Client Client
}
CoreGateway struct
func (*CoreGateway) Call ¶
func (gateway *CoreGateway) Call(method, path string, header map[string]string, body io.Reader, v interface{}, vErr interface{}) error
Call : base method to call Core API
func (*CoreGateway) CallDirectDebit ¶ added in v0.7.0
func (gateway *CoreGateway) CallDirectDebit(method, path string, header map[string]string, body io.Reader, v interface{}) error
CallDirectDebit will call direct debit api
func (*CoreGateway) CreateCardTokenOTP ¶ added in v0.6.0
func (g *CoreGateway) CreateCardTokenOTP(token string, req CardTokenOTPRequest) (res CardTokenOTPResponse, err error)
CreateCardTokenOTP verifies that the information provided by the customers matches the bank data. This API will alse send OTP code confirmation to user if user phonenumber is valid.
func (*CoreGateway) CreateCardTokenOTPVerify ¶ added in v0.6.0
func (g *CoreGateway) CreateCardTokenOTPVerify(token string, req CardTokenOTPVerifyRequest) (res CardTokenOTPVerifyResponse, err error)
CreateCardTokenOTPVerify is used to verify OTP from create card token OTP url.
func (*CoreGateway) CreatePaymentChargeOTP ¶ added in v0.6.0
func (g *CoreGateway) CreatePaymentChargeOTP(token, idempotencyKey string, req PaymentChargeOTPRequest) (res PaymentChargeResponse, err error)
CreatePaymentChargeOTP is used for payment of direct link transactions based on card number via card_token acquired from binding process (create a card token). This API will alse send OTP code confirmation to user if user phonenumber is valid.
func (*CoreGateway) CreatePaymentChargeOTPVerify ¶ added in v0.6.0
func (g *CoreGateway) CreatePaymentChargeOTPVerify(token string, req PaymentChargeOTPVerifyRequest) (res PaymentChargeResponse, err error)
CreatePaymentChargeOTPVerify is used to verify OTP from create payment charge OTP url.
func (*CoreGateway) CreateVA ¶
func (gateway *CoreGateway) CreateVA(token string, req CreateVaRequest) (res VaResponse, err error)
func (*CoreGateway) DeleteCardToken ¶ added in v0.7.0
func (g *CoreGateway) DeleteCardToken(token string, req DeleteCardTokenRequest) (res DeleteCardTokenResponse, err error)
DeleteCardToken is used to unbind user's direct debit card token
func (*CoreGateway) DeleteVA ¶ added in v0.7.2
func (gateway *CoreGateway) DeleteVA(token string, institutionCode string, brivaNo string, custCode string) (res VaResponse, respErr ErrorResponse, err error)
func (*CoreGateway) GetChargeDetail ¶ added in v0.9.0
func (g *CoreGateway) GetChargeDetail(token string, req ChargeDetailRequest) (res ChargeDetailResponse, err error)
GetChargeDetail returns charge direct debit charge detail
func (*CoreGateway) GetReportVA ¶
func (gateway *CoreGateway) GetReportVA(token string, req GetReportVaRequest) (res VaReportResponse, err error)
func (*CoreGateway) GetToken ¶
func (gateway *CoreGateway) GetToken() (res TokenResponse, err error)
func (*CoreGateway) RefundDirectDebit ¶ added in v0.9.0
func (g *CoreGateway) RefundDirectDebit(token string, idempotencyKey string, req RefundRequest) (res RefundResponse, err error)
RefundDirectDebit will refund direct debit transaction
func (*CoreGateway) UpdateVA ¶
func (gateway *CoreGateway) UpdateVA(token string, req CreateVaRequest) (res VaResponse, err error)
type CreateVaRequest ¶
type DeleteCardTokenRequest ¶ added in v0.7.0
type DeleteCardTokenRequest struct {
Body DeleteCardTokenRequestData `json:"body"`
}
DeleteCardTokenRequest defines payload for direct debit - delete card token
type DeleteCardTokenRequestData ¶ added in v0.7.0
type DeleteCardTokenRequestData struct {
CardToken string `json:"card_token"`
}
DeleteCardTokenRequestData defines data payload for direct debit - delete card token
type DeleteCardTokenResponse ¶ added in v0.7.0
type DeleteCardTokenResponse struct {
Body DeleteCardTokenResponseData `json:"body"`
ErrorResponse
}
DeleteCardTokenResponse defines response for direct debit - delete card token
type DeleteCardTokenResponseData ¶ added in v0.7.0
type DeleteCardTokenResponseData struct {
Status string `json:"status"`
}
DeleteCardTokenResponseData defines data response for direct debit - delete card token
type ErrorDetail ¶ added in v0.6.1
ErrorDetail defines response error detail. Example:
{
"error": {
"code": "0920",
"message": "Expired OTP"
}
}
type ErrorResponse ¶ added in v0.6.1
type ErrorResponse struct {
Error ErrorDetail `json:"error"`
StatusCode int `json:"status_code"`
Status ErrorStatus `json:"status"`
}
ErrorResponse defines response data if error request.Example:
{
"error": {
"code": "0920",
"message": "Expired OTP"
},
"status_code": 400,
"status": {
"code": "0602",
"desc": "Invalid signature"
},
"recorded_at": "2020-03-12T03:58:46Z"
}
type ErrorStatus ¶ added in v0.6.1
ErrorStatus defines error data if unauthorized. Example:
{
"status": {
"code": "0602",
"desc": "Invalid signature"
}
}
type GetReportVaRequest ¶
type PaymentChargeOTPRequest ¶ added in v0.6.0
type PaymentChargeOTPRequest struct {
Body PaymentChargeOTPRequestData `json:"body"`
}
PaymentChargeOTPRequest defines payload for direct debit - create payment charge OTP
type PaymentChargeOTPRequestData ¶ added in v0.6.0
type PaymentChargeOTPRequestData struct {
CardToken string `json:"card_token"`
Amount string `json:"amount"`
Currency string `json:"currency"`
Remarks string `json:"remarks"`
OtpBriStatus string `json:"otp_bri_status"`
Metadata map[string]interface{} `json:"metadata"`
}
PaymentChargeOTPRequestData defines data payload for direct debit - create payment charge OTP
type PaymentChargeOTPVerifyRequest ¶ added in v0.6.0
type PaymentChargeOTPVerifyRequest struct {
Body PaymentChargeOTPVerifyRequestData `json:"body"`
}
PaymentChargeOTPVerifyRequest defines payload for direct debit - create payment charge OTP verify
type PaymentChargeOTPVerifyRequestData ¶ added in v0.6.0
type PaymentChargeOTPVerifyRequestData struct {
CardToken string `json:"card_token"`
ChargeToken string `json:"charge_token"`
Passcode string `json:"passcode"`
}
PaymentChargeOTPVerifyRequestData defines data payload for direct debit - create payment charge OTP
type PaymentChargeResponse ¶ added in v0.6.1
type PaymentChargeResponse struct {
Body PaymentChargeResponseData `json:"body"`
ErrorResponse
}
PaymentChargeResponse defines response for direct debit - create payment charge [using OTP or not]
type PaymentChargeResponseData ¶ added in v0.6.1
type PaymentChargeResponseData struct {
Status string `json:"status"`
ChargeToken string `json:"charge_token"`
PaymentID string `json:"payment_id"`
Amount string `json:"amount"`
Currency string `json:"currency"`
Remarks string `json:"remarks"`
DeviceID string `json:"device_id"`
PaymentStatus string `json:"payment_status"`
Location Location `json:"location"`
Metadata map[string]interface{} `json:"metadata"`
}
PaymentChargeResponseData defines data response for direct debit - create payment charge [using OTP or not]
type RefundRequest ¶ added in v0.9.0
type RefundRequest struct {
Body RefundRequestData `json:"body"`
}
RefundRequest defines payload for direct debit - refund
type RefundRequestData ¶ added in v0.9.0
type RefundRequestData struct {
CardToken string `json:"card_token"`
Amount string `json:"amount"`
PaymentID string `json:"payment_id"`
Currency string `json:"currency"`
Reason string `json:"reason"`
Metadata map[string]interface{} `json:"metadata"`
}
RefundRequestData defines data payload for direct debit - refund
type RefundResponse ¶ added in v0.9.0
type RefundResponse struct {
Body RefundResponseData `json:"body"`
ErrorResponse
}
RefundResponse defines response for direct debit - refund
type RefundResponseData ¶ added in v0.9.0
type RefundResponseData struct {
Status string `json:"status"`
RefundID string `json:"refund_id"`
PaymentID string `json:"payment_id"`
Amount string `json:"amount"`
Fee string `json:"fee"`
Currency string `json:"currency"`
Reason string `json:"reason"`
RefundStatus string `json:"refund_status"`
DeviceID string `json:"device_id"`
Location Location `json:"location"`
Metadata map[string]interface{} `json:"metadata"`
Date string `json:"date"`
}
RefundResponseData defines data response for direct debit - refund
type TokenResponse ¶
type VaReportData ¶
type VaReportResponse ¶
type VaReportResponse struct {
Status bool `json:"status"`
ResponseCode string `json:"responseCode"`
Description string `json:"responseDescription"`
ErrDesc string `json:"errDesc"`
Data []VaReportData `json:"data"`
}