bca

package module
v0.1.2-beta Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TOKEN_PATH = "/api/oauth/token"
	VA_PATH    = "/va/payments"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseUrl      string
	ClientID     string
	ClientSecret string
	ApiKey       string
	ApiSecret    string
	CompanyID    string
	CompanyCode  string
	Origin       string
	LogLevel     int
	Logger       *log.Logger
}

Client struct to initial bca package

func NewClient

func NewClient() Client

NewClient function init client rest http

func (*Client) Call

func (c *Client) Call(method, path string, header map[string]string, body io.Reader, v interface{}) error

Call the 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) GetToken

func (gateway *CoreGateway) GetToken() (res TokenResponse, err error)

func (*CoreGateway) InquiryCustomerNumber

func (gateway *CoreGateway) InquiryCustomerNumber(token string, req InquiryByCustomerNumber) (resp InquiryByCustomerNumberResp, err error)

func (*CoreGateway) InquiryRequestID

func (gateway *CoreGateway) InquiryRequestID(token string, req InquiryByRequestID) (resp InquiryByCustomerNumberResp, err error)

type InquiryByCustomerNumber

type InquiryByCustomerNumber struct {
	CompanyCode    string
	CustomerNumber string
}

type InquiryByCustomerNumberResp

type InquiryByCustomerNumberResp struct {
	TransactionData []struct {
		DetailBills []struct {
			BillReference string `json:"BillReference"`
			BillNumber    string `json:"BillNumber"`
		} `json:"DetailBills"`
		PaymentFlagStatus string    `json:"PaymentFlagStatus"`
		RequestID         string    `json:"RequestID"`
		Reference         string    `json:"Reference"`
		TotalAmount       string    `json:"TotalAmount"`
		TransactionDate   time.Time `json:"TransactionDate"`
		PaidAmount        string    `json:"PaidAmount"`
	} `json:"TransactionData"`
}

type InquiryByRequestID

type InquiryByRequestID struct {
	CompanyCode string
	RequestID   string
}

type Signature

type Signature struct {
	HTTPMethod  string
	RelativeURL string
	Timestamp   string
	RequestBody string
	AccessToken string
	APISecret   string
}

type TokenResponse

type TokenResponse struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	ExpiresIn   int    `json:"expires_in"`
	Scope       string `json:"scope"`
}

Jump to

Keyboard shortcuts

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