zotapay

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// VERSION string of SDK
	VERSION string = "v1.0.16"
	// SANDBOX endpoint URL
	SANDBOX string = "https://api.zotapay-sandbox.com"
	// LIVE production endpoint URL
	LIVE string = "https://api.zotapay.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DepositCCOrder

type DepositCCOrder struct {
	MerchantOrderID     string `json:"merchantOrderID"`
	MerchantOrderDesc   string `json:"merchantOrderDesc"`
	OrderAmount         string `json:"orderAmount"`
	OrderCurrency       string `json:"orderCurrency"`
	CustomerEmail       string `json:"customerEmail"`
	CustomerFirstName   string `json:"customerFirstName"`
	CustomerLastName    string `json:"customerLastName"`
	CustomerAddress     string `json:"customerAddress"`
	CustomerCountryCode string `json:"customerCountryCode"`
	CustomerCity        string `json:"customerCity"`
	CustomerState       string `json:"customerState"`
	CustomerZipCode     string `json:"customerZipCode"`
	CustomerPhone       string `json:"customerPhone"`
	CustomerIP          string `json:"customerIP"`
	CustomerBankCode    string `json:"customerBankCode"`
	RedirectURL         string `json:"redirectUrl"`
	CallbackURL         string `json:"callbackUrl"`
	CustomParam         string `json:"customParam"`
	CheckoutURL         string `json:"checkoutUrl"`
	Language            string `json:"language"`
	Signature           string `json:"signature"`

	//credit card data
	CardNumber          string `json:"cardNumber"`
	CardHolderName      string `json:"cardHolderName"`
	CardExpirationMonth string `json:"cardExpirationMonth"`
	CardExpirationYear  string `json:"cardExpirationYear"`
	CardCvv             string `json:"cardCvv"`
}

DepositCCOrder represents credit card deposit order

type DepositCCResult

type DepositCCResult struct {
	Code    string              `json:"code"`
	Data    DepositCCResultData `json:"data"`
	Message string              `json:"message"`
}

DepositCCResult represents credit card deposit response from Zotapay API

func (*DepositCCResult) SetMockResponse

func (mock *DepositCCResult) SetMockResponse()

SetMockResponse will set *DepositCCResult as mocked response on the next deposit request To be used only for test purposes

type DepositCCResultData

type DepositCCResultData struct {
	Status          string `json:"status"`
	MerchantOrderID string `json:"merchantOrderID"`
	OrderID         string `json:"orderID"`
}

type DepositOrder

type DepositOrder struct {
	MerchantOrderID           string `json:"merchantOrderID"`
	MerchantOrderDesc         string `json:"merchantOrderDesc"`
	OrderAmount               string `json:"orderAmount"`
	OrderCurrency             string `json:"orderCurrency"`
	CustomerEmail             string `json:"customerEmail"`
	CustomerFirstName         string `json:"customerFirstName"`
	CustomerLastName          string `json:"customerLastName"`
	CustomerAddress           string `json:"customerAddress"`
	CustomerCountryCode       string `json:"customerCountryCode"`
	CustomerCity              string `json:"customerCity"`
	CustomerState             string `json:"customerState"`
	CustomerZipCode           string `json:"customerZipCode"`
	CustomerPhone             string `json:"customerPhone"`
	CustomerIP                string `json:"customerIP"`
	CustomerBankCode          string `json:"customerBankCode"`
	CustomerBankAccountNumber string `json:"customerBankAccountNumber"`
	RedirectURL               string `json:"redirectUrl"`
	CallbackURL               string `json:"callbackUrl"`
	CustomParam               string `json:"customParam"`
	CheckoutURL               string `json:"checkoutUrl"`
	Language                  string `json:"language"`
	Signature                 string `json:"signature"`
}

DepositOrder represents deposit order

type DepositResult

type DepositResult struct {
	Code    string            `json:"code"`
	Data    DepositResultData `json:"data"`
	Message string            `json:"message"`
}

DepositResult represents the response from Zotapay API

func (*DepositResult) SetMockResponse

func (mock *DepositResult) SetMockResponse()

SetMockResponse will set *DepositResult as mocked response on the next deposit request To be used only for test purposes

type DepositResultData

type DepositResultData struct {
	DepositURL      string `json:"depositUrl"`
	MerchantOrderID string `json:"merchantOrderID"`
	OrderID         string `json:"orderID"`
}

type OrderStatus

type OrderStatus struct {
	MerchantID      string `url:"merchantID"`
	MerchantOrderID string `url:"merchantOrderID"`
	OrderID         string `url:"orderID"`
	Timestamp       string `url:"timestamp"`
	Signature       string `url:"signature"`
}

OrderStatus represents check order status

type OrderStatusResult

type OrderStatusResult struct {
	Code                  string `json:"code"`
	OrderStatusResultData `json:"data"`
	Message               string `json:"message"`
}

OrderStatusResult represents the response from Zotapay API

func (*OrderStatusResult) SetMockResponse

func (mock *OrderStatusResult) SetMockResponse()

SetMockResponse will set *OrderStatusResult as mocked response on the next order status request To be used only for test purposes

type OrderStatusResultData

type OrderStatusResultData struct {
	Type                  string `json:"type"`
	Status                string `json:"status"`
	ErrorMessage          string `json:"errorMessage"`
	EndpointID            string `json:"endpointID"`
	ExternalTransactionID string `json:"externalTransactionID"`
	OrderID               string `json:"orderID"`
	MerchantOrderID       string `json:"merchantOrderID"`
	Amount                string `json:"amount"`
	Currency              string `json:"currency"`
	CustomerEmail         string `json:"customerEmail"`
	CustomParam           string `json:"customParam"`
	ExtraData             struct {
		Dcc              bool   `json:"dcc"`
		SelectedBankCode string `json:"selectedBankCode"`
		SelectedBankName string `json:"selectedBankName"`
	} `json:"extraData"`
	Request struct {
		MerchantID      string `json:"merchantID"`
		OrderID         string `json:"orderID"`
		MerchantOrderID string `json:"merchantOrderID"`
		Timestamp       string `json:"timestamp"`
	} `json:"request"`
}

type OrdersReport

type OrdersReport struct {
	MerchantID  string `url:"merchantID"`
	DateType    string `url:"dateType"`
	EndpointIds string `url:"endpointIds"`
	FromDate    string `url:"fromDate"`
	RequestID   string `url:"requestID"`
	Statuses    string `url:"statuses"`
	Timestamp   string `url:"timestamp"`
	ToDate      string `url:"toDate"`
	Types       string `url:"types"`
	Signature   string `url:"signature"`
}

OrdersReport represents order report request

type OrdersReportResult

type OrdersReportResult struct {
	Code         string `json:"code"`
	OrdersReport string `json:"data"`
	Message      string `json:"message"`
}

OrdersReportResult represents the response from Zotapay API

func (*OrdersReportResult) SetMockResponse

func (mock *OrdersReportResult) SetMockResponse()

SetMockResponse will set *OrdersReportResult as mocked response on the next order report request To be used only for test purposes

type PayoutOrder

type PayoutOrder struct {
	MerchantOrderID                string `json:"merchantOrderID"`
	MerchantOrderDesc              string `json:"merchantOrderDesc"`
	OrderAmount                    string `json:"orderAmount"`
	OrderCurrency                  string `json:"orderCurrency"`
	CustomerEmail                  string `json:"customerEmail"`
	CustomerFirstName              string `json:"customerFirstName"`
	CustomerLastName               string `json:"customerLastName"`
	CustomerPhone                  string `json:"customerPhone"`
	CustomerIP                     string `json:"customerIP"`
	CallbackURL                    string `json:"callbackUrl"`
	CustomerBankCode               string `json:"customerBankCode"`
	CustomerBankAccountNumber      string `json:"customerBankAccountNumber"`
	CustomerBankAccountName        string `json:"customerBankAccountName"`
	CustomerBankBranch             string `json:"customerBankBranch"`
	CustomerBankAddress            string `json:"customerBankAddress"`
	CustomerBankZipCode            string `json:"customerBankZipCode"`
	CustomerBankProvince           string `json:"customerBankProvince"`
	CustomerBankArea               string `json:"customerBankArea"`
	CustomerBankRoutingNumber      string `json:"customerBankRoutingNumber"`
	CustomParam                    string `json:"customParam"`
	CheckoutURL                    string `json:"checkoutUrl"`
	RedirectUrl                    string `json:"redirectUrl"`
	CustomerCountryCode            string `json:"customerCountryCode"`
	CustomerPersonalID             string `json:"customerPersonalID"`
	CustomerBankAccountNumberDigit string `json:"customerBankAccountNumberDigit"`
	CustomerBankAccountType        string `json:"customerBankAccountType"`
	CustomerBankSwiftCode          string `json:"customerBankSwiftCode"`
	CustomerBankBranchDigit        string `json:"customerBankBranchDigit"`
	Signature                      string `json:"signature"`
}

PayoutOrder represents payout order

type PayoutResult

type PayoutResult struct {
	Code    string           `json:"code"`
	Data    PayoutResultData `json:"data"`
	Message string           `json:"message"`
}

PayoutResult represents the payout response from Zotapay API

func (*PayoutResult) SetMockResponse

func (mock *PayoutResult) SetMockResponse()

SetMockResponse will set *PayoutResult as mocked response on the next payout request To be used only for test purposes

type PayoutResultData

type PayoutResultData struct {
	MerchantOrderID string `json:"merchantOrderID"`
	OrderID         string `json:"orderID"`
}

type SDK

type SDK struct {
	MerchantID        string
	MerchantSecretKey string
	EndpointID        string
	ApiBaseURL        string
	HttpClient        httpClient
}

SDK represents the base SDK structure all properties are required, except HttpClient HttpClient implement httpClient interface if is empty will be initialized

func (*SDK) Callback

func (s *SDK) Callback(b []byte) (callback, error)

Callback parse the callback data into callback struct and validate the Signature

func (*SDK) Deposit

func (s *SDK) Deposit(d DepositOrder) (res DepositResult, err error)

Deposit init validation of the SDK struct and the DepositOrder generate sign and init a deposit request to Zotapay API

func (*SDK) DepositCC

func (s *SDK) DepositCC(d DepositCCOrder) (res DepositCCResult, err error)

DepositCC init validation of the SDK struct and the DepositCCOrder generate sign and init a credit card deposit request to Zotapay API

func (*SDK) OrderStatus

func (s *SDK) OrderStatus(d OrderStatus) (res OrderStatusResult, err error)

OrderStatus init validation of the SDK struct and the OrderStatus generate sign and init order status request to Zotapay API

func (*SDK) OrdersReport

func (s *SDK) OrdersReport(d OrdersReport) (res OrdersReportResult, err error)

OrdersReport init validation of the SDK struct and the OrdersReport generate sign and init a orders report request to Zotapay API

func (*SDK) Payout

func (s *SDK) Payout(p PayoutOrder) (res PayoutResult, err error)

Payout init validation of the SDK struct and PayoutOrder generate sign and init a payout request to Zotapay API

func (*SDK) Redirect

func (s *SDK) Redirect(url url.URL) (r redirect, err error)

Redirect parse the redirect query params into redirect struct and validate the Signature

Jump to

Keyboard shortcuts

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