Help us shape the future of Go! Take the 2026 Go Developer Survey

bri

package module
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2020 License: MIT Imports: 15 Imported by: 0

README

BRI Sangu

Usage blueprint

  1. There is a type named Client (bri.Client) that should be instantiated through NewClient which hold any possible setting to the library.
  2. There is a gateway classes which you will be using depending on whether you used. The gateway type need a Client instance.
  3. Any activity (token request) is done in the gateway level.

Example

    briClient := bri.NewClient()
    briClient.BaseUrl = "BRI_BASE_URL"
    briClient.ClientId = "BRI_CLIENT_ID"
    briClient.ClientSecret = "BRI_CLIENT_SECRET"

    coreGateway := bri.CoreGateway{
        Client: briClient,
    }

    res, _ := coreGateway.GetToken()

Documentation

Index

Constants

View Source
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

This section is empty.

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"`
}

CardTokenOTPResponse defines response for direct debit - create card token OTP

type CardTokenOTPResponseData added in v0.6.0

type CardTokenOTPResponseData struct {
	Status string `json:"status"`
	Token  string `json:"token"`
}

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"`
}

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 Client

type Client struct {
	BaseUrl      string
	ClientId     string
	ClientSecret string
	LogLevel     int
	Logger       *log.Logger
}

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{}) 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) ExecuteRequest

func (c *Client) ExecuteRequest(req *http.Request, v interface{}) error

ExecuteRequest : execute request

func (*Client) NewRequest

func (c *Client) NewRequest(method string, fullPath string, headers map[string]string, body io.Reader) (*http.Request, error)

NewRequest : send new 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{}) error

Call : base method to call Core 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 string, req PaymentChargeOTPRequest) (res PaymentChargeOTPResponse, 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 PaymentChargeOTPVerifyResponse, 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) 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) UpdateVA

func (gateway *CoreGateway) UpdateVA(token string, req CreateVaRequest) (res VaResponse, err error)

type CreateVaRequest

type CreateVaRequest struct {
	InstitutionCode string `json:"institutionCode"`
	BrivaNo         string `json:"brivaNo"`
	CustCode        string `json:"custCode"`
	Name            string `json:"nama"`
	Amount          string `json:"amount"`
	Description     string `json:"keterangan"`
	ExpiredDate     string `json:"expiredDate"`
}

type GetReportVaRequest

type GetReportVaRequest struct {
	InstitutionCode string
	BrivaNo         string
	StartDate       string
	EndDate         string
}

type Location added in v0.6.0

type Location struct {
	Lat string `json:"lat"`
	Lon string `json:"lon"`
}

Location defines location data

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 PaymentChargeOTPResponse added in v0.6.0

type PaymentChargeOTPResponse struct {
	Body PaymentChargeOTPResponseData `json:"body"`
}

PaymentChargeOTPResponse defines response for direct debit - create payment charge OTP

type PaymentChargeOTPResponseData added in v0.6.0

type PaymentChargeOTPResponseData struct {
	ChargeToken string `json:"charge_token"`
	Status      string `json:"status"`
}

PaymentChargeOTPResponseData defines data response 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 PaymentChargeOTPVerifyResponse added in v0.6.0

type PaymentChargeOTPVerifyResponse struct {
	Body PaymentChargeOTPResponseData `json:"body"`
}

PaymentChargeOTPVerifyResponse defines response for direct debit - create payment charge OTP verify

type PaymentChargeOTPVerifyResponseData added in v0.6.0

type PaymentChargeOTPVerifyResponseData struct {
	Status        string                 `json:"status"`
	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"`
}

PaymentChargeOTPVerifyResponseData defines data response for direct debit - create payment charge OTP verify

type TokenResponse

type TokenResponse struct {
	AccessToken string   `json:"access_token"`
	ExpiredTime string   `json:"expires_in"`
	ProductList []string `json:"api_product_list_json"`
}

type VaData

type VaData struct {
	InstitutionCode string `json:"institutionCode"`
	BrivaNo         string `json:"brivaNo"`
	CustCode        string `json:"custCode"`
	Name            string `json:"nama"`
	Amount          string `json:"amount"`
	Description     string `json:"keterangan"`
	ExpiredDate     string `json:"expiredDate"`
}

type VaReportData

type VaReportData struct {
	BrivaNo     string `json:"brivaNo"`
	CustCode    string `json:"custCode"`
	Nama        string `json:"nama"`
	Amount      string `json:"amount"`
	Description string `json:"keterangan"`
	PaymentDate string `json:"paymentDate"`
	TellerId    string `json:"tellerid"`
	AccountNo   string `json:"no_rek"`
}

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"`
}

type VaResponse

type VaResponse struct {
	Status              bool   `json:"status"`
	ResponseCode        string `json:"responseCode"`
	ResponseDescription string `json:"responseDescription"`
	ErrDesc             string `json:"errDesc"`
	Data                VaData `json:"data"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL