libduitku

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2020 License: MIT Imports: 13 Imported by: 0

README

libduitku

Documentation

Index

Constants

View Source
const (
	// CreditCard is a default value of credit card (VISA/Master) from duitku.
	CreditCard string = "VC"
	// BCAKlikPay is a default value of BCA KlikPay from duitku.
	BCAKlikPay string = "BK"
	// MandiriVirtualAccount is a default value of Mandiri Virtual Account from duitku.
	MandiriVirtualAccount string = "M1"
	// PermataBankVirtualAccount is a default value of Permata Bank Virtual Account from duitku.
	PermataBankVirtualAccount string = "BT"
	// ATMBersama is a default value of ATM Bersama from duitku.
	ATMBersama string = "A1"
	// CIMBNiagaVirtualAccount is a default value of CIMB Niaga Virtual Account from duitku.
	CIMBNiagaVirtualAccount string = "B1"
	// BNIVirtualAccount is a default value of BNI Virtual Account from duitku.
	BNIVirtualAccount string = "I1"
	// MaybankVirtualAccount is a default value of Maybank Virtual Account from duitku.
	MaybankVirtualAccount string = "VA"
	// Ritel is a default value of Ritel from duitku.
	Ritel string = "FT"
	// OVO is a default value of OVO from duitku.
	OVO string = "OV"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Banks

type Banks struct {
	BankCode string `json:"bankCode"`
	BankName string `json:"bankName"`
}

Banks struct model

type CallbackResponse

type CallbackResponse struct {
	MerchantCode    string `json:"merchantCode"`
	Amount          string `json:"amount"`
	MerchantOrderID string `json:"merchantOrderId"`
	ProductDetail   string `json:"productDetail"`
	AdditionalParam string `json:"additionalParam"`
	PaymentCode     string `json:"paymentCode"`
	ResultCode      string `json:"resultCode"`
	MerchantUserID  string `json:"merchantUserId"`
	Reference       string `json:"reference"`
	Signature       string `json:"signature"`
}

CallbackResponse struct model

type CheckTransactionRequest

type CheckTransactionRequest struct {
	MerchantCode    string `json:"merchantCode"`
	MerchantOrderID string `json:"merchantOrderId"`
	Signature       string `json:"signature"`
}

CheckTransactionRequest struct model

type CheckTransactionResponse

type CheckTransactionResponse struct {
	MerchantCode  string `json:"merchantCode"`
	Amount        string `json:"amount"`
	Reference     string `json:"reference"`
	Fee           string `json:"fee"`
	StatusCode    string `json:"statusCode"`
	StatusMessage string `json:"statusMessage"`
}

CheckTransactionResponse struct model

type Client

type Client struct {
	Host               string
	MerchantCode       string
	APIKey             string
	ReturnURL          string
	CallbackURL        string
	DisbursementUserID int
	DisbursementEmail  string
	DisbursementKey    string
	LogLevel           int
	Logger             *log.Logger
}

Client is a struct of duitku

func NewClient

func NewClient() Client

NewClient is used to initial client

func (*Client) Call

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

Call is ...

func (*Client) ExecuteRequest

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

ExecuteRequest is ...

func (*Client) NewRequest

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

NewRequest test is ...

type CoreDuitku

type CoreDuitku struct {
	Client Client
}

CoreDuitku is ...

func (*CoreDuitku) Call

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

Call is used to call ...

func (*CoreDuitku) CheckTransaction

func (core *CoreDuitku) CheckTransaction(orderID string) (res CheckTransactionResponse, err error)

CheckTransaction is used to check status transaction to duitku

func (*CoreDuitku) DisbursementInquiry

func (core *CoreDuitku) DisbursementInquiry(req DisbursementInquiryRequest) (res DisbursementResponse, err error)

DisbursementInquiry is used to ...

func (*CoreDuitku) DisbursementTransfer

func (core *CoreDuitku) DisbursementTransfer(req DisbursementTransferRequest) (res DisbursementResponse, err error)

DisbursementTransfer is used to ...

func (*CoreDuitku) InquiryCheckBalance

func (core *CoreDuitku) InquiryCheckBalance() (res DisbursementResponse, err error)

InquiryCheckBalance is used to ...

func (*CoreDuitku) InquiryListBank

func (core *CoreDuitku) InquiryListBank() (res DisbursementResponse, err error)

InquiryListBank is used to inquery list bank

func (*CoreDuitku) InquiryStatus

func (core *CoreDuitku) InquiryStatus(disburseID string) (res DisbursementResponse, err error)

InquiryStatus is used to chech status disbursement

func (*CoreDuitku) RequestTransaction

func (core *CoreDuitku) RequestTransaction(req TransactionRequest) (res TransactionResponse, err error)

RequestTransaction is used to request payment to Duitku

type DisbursementInquiryRequest

type DisbursementInquiryRequest struct {
	UserID         int    `json:"userId,omitempty"`
	DisburseID     string `json:"disburseId,omitempty"`
	AmountTransfer int    `json:"amountTransfer,omitempty"`
	BankAccount    string `json:"bankAccount,omitempty"`
	BankCode       string `json:"bankCode,omitempty"`
	Email          string `json:"email,omitempty"`
	Purpose        string `json:"purpose,omitempty"`
	Timestamp      int64  `json:"timestamp,omitempty"`
	SenderID       int    `json:"senderId,omitempty"`
	SenderName     string `json:"senderName,omitempty"`
	Signature      string `json:"signature,required"`
}

DisbursementInquiryRequest struct model

type DisbursementResponse

type DisbursementResponse struct {
	UserID           int             `json:"userId,omitempty"`
	Balance          decimal.Decimal `json:"balance,omitempty"`
	EffectiveBalance decimal.Decimal `json:"effectiveBalance,omitempty"`
	Email            string          `json:"email,omitempty"`
	Reference        string          `json:"reference,omitempty"`
	BankCode         string          `json:"bankCode,omitempty"`
	BankAccount      string          `json:"bankAccount,omitempty"`
	AmountTransfer   decimal.Decimal `json:"amountTransfer,omitempty"`
	CustRefNumber    string          `json:"custRefNumber,omitempty"`
	AccountName      string          `json:"accountName,omitempty"`
	DisburseID       int             `json:"disburseId,omitempty"`
	ResponseCode     string          `json:"responseCode,omitempty"`
	ResponseDesc     string          `json:"responseDesc,omitempty"`
	Banks            []Banks         `json:"banks,omitempty"`
}

DisbursementResponse struct model

type DisbursementTransferRequest

type DisbursementTransferRequest struct {
	DisburseID     int    `json:"disburseId"`
	UserID         int    `json:"userId"`
	Email          string `json:"email"`
	BankCode       string `json:"bankCode"`
	BankAccount    string `json:"bankAccount"`
	AmountTransfer int    `json:"amountTransfer"`
	AccountName    string `json:"accountName"`
	CustRefNumber  string `json:"custRefNumber"`
	Purpose        string `json:"purpose"`
	Timestamp      int64  `json:"timestamp"`
	Signature      string `json:"signature"`
}

DisbursementTransferRequest struct model

type ErrorResponse

type ErrorResponse struct {
	Error   error  `json:"error"`
	Status  int    `json:"status"`
	Message string `json:"message"`
}

ErrorResponse is struct response error of services

type ItemDetail

type ItemDetail struct {
	Name     string `json:"name,required"`
	Quantity int    `json:"quantity,required"`
	Price    int    `json:"price,required"`
}

ItemDetail struct models

type RedirectResponse

type RedirectResponse struct {
	MerchantOrderID string `json:"merchantOrderId"`
	Reference       string `json:"reference"`
	ResultCode      string `json:"resultCode"`
}

RedirectResponse struct model

type TransactionRequest

type TransactionRequest struct {
	MerchantCode     string       `json:"merchantCode,required"`
	PaymentAmount    int          `json:"paymentAmount,required"`
	MerchantOrderID  string       `json:"merchantOrderId,required"`
	ProductDetails   string       `json:"productDetails,required"`
	Email            string       `json:"email,required"`
	AdditionalParam  string       `json:"additionalParam,omitempty"`
	PaymentMethod    string       `json:"paymentMethod,required"`
	MerchantUserInfo string       `json:"merchantUserInfo,omitompty"`
	CustomerVAName   string       `json:"customerVaName,required"`
	PhoneNumber      string       `json:"phoneNumber,required"`
	ItemDetails      []ItemDetail `json:"itemDetails,required"`
	ReturnURL        string       `json:"returnUrl,required"`
	CallbackURL      string       `json:"callbackUrl,required"`
	Signature        string       `json:"signature,required"`
	ExpiryPeriod     int          `json:"expiryPeriod,omitempty"` // 5, 10 or 60 (in minutes)
}

TransactionRequest struct model

type TransactionResponse

type TransactionResponse struct {
	MerchantCode         string `json:"merchantCode"`
	Reference            string `json:"reference"`
	PaymentURL           string `json:"paymentUrl"`
	VirtualAccountNumber string `json:"vaNumber"`
	Amount               string `json:"amount"`
	QRString             string `json:"qrString"`
}

TransactionResponse struct model

Jump to

Keyboard shortcuts

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