Documentation ¶
Overview ¶
Package yuansfer the golang SDK for Yuansfer Payment API.
Index ¶
- Constants
- Variables
- func LoadConfiguration(c Configuration)
- func VerifySignNotify(values url.Values, token string) (m map[string]string, r bool)
- func Version() string
- type AddResponse
- type AddRet
- type Cancel
- type Client
- type Configuration
- type CreateQrcode
- type Credential
- type GoodsInformation
- type InStoreAdd
- type InStorePay
- type Network
- type PayResponse
- type PayRet
- type Prepay
- type Process
- type QrcodeRet
- type QryResponse
- type QryReverse
- type Query
- type Refund
- type RefundBody
- type RefundResponse
- type Ret
- type ReverseRet
- type SecurePay
- type SecurePayResponse
- type SecurePayRet
- type Yuansfer
Constants ¶
const ( URISecurePay = "/online/v3/secure-pay" URIYipApp = "/micropay/v3/prepay" URIYipProcess = "/creditpay/v3/process" URIRefund = "/app-data-search/v3/refund" URICancel = "/app-data-search/v3/cancel" URIRetrieve = "/app-data-search/v3/tran-query" URIPosAdd = "/app-instore/v3/add" URIPosPay = "/app-instore/v3/pay" URIPosCreateQRC = "/app-instore/v3/create-trans-qrcode" GatewaySandbox = "https://mapi.yuansfer.yunkeguan.com" GatewayProduction = "https://mapi.yuansfer.com" )
Variables ¶
Functions ¶
func LoadConfiguration ¶
func LoadConfiguration(c Configuration)
func VerifySignNotify ¶
VerifySignNotify checks the parameters from Yuansfer with the value of verifySign.
Types ¶
type AddResponse ¶
type AddResponse struct { Result string `json:"ret_code"` RetMsg string `json:"ret_msg"` Transaction AddRet `json:"transaction"` }
AddResponse is the Response from the Yuansfer service.
type AddRet ¶
type AddRet struct { TransactionNo string `json:"transactionNo"` OriginalTransactionNo string `json:"originalTransactionNo"` MerchantNo string `json:"merchantNo"` StoreNo string `json:"storeNo"` StoreAdminNo string `json:"storeAdminNo"` Amount string `json:"amount"` RefundAmount string `json:"refundAmount"` TransactionType string `json:"transactionType"` TransactionStatus string `json:"transactionStatus"` Currency string `json:"currency"` CreateTime string `json:"createTime"` PaymentTime string `json:"paymentTime"` ExchangeRate string `json:"exchangeRate"` Vendor string `json:"vendor"` }
AddRet is the Response from the Yuansfer service.
type Cancel ¶
type Cancel struct { GroupNo string `json:"merGroupNo,omitempty"` MerchantNo string `json:"merchantNo"` StoreNo string `json:"storeNo"` VerifySign string `json:"verifySign"` Reference string `json:"reference,omitempty"` TransactionNo string `json:"transactionNo,omitempty"` }
Cancel to cancel/reverse a transaction
func (*Cancel) LoadCredentials ¶
func (c *Cancel) LoadCredentials()
func (Cancel) PostToYuansfer ¶
PostToYuansfer is for api call to the Yuansfer service
type Client ¶
type Client struct { URI string HTTPStatus int // Body indicates both Request Body & Response Body Body []byte }
func NewHttpClient ¶
type Configuration ¶
type Configuration struct { Credential Credential `toml:"credentials"` Network Network `toml:"http"` }
type CreateQrcode ¶
type CreateQrcode struct { GroupNo string `json:"merGroupNo,omitempty"` MerchantNo string `json:"merchantNo"` StoreNo string `json:"storeNo"` VerifySign string `json:"verifySign"` Amount string `json:"amount"` StoreAdminNo string `json:"storeAdminNo"` Currency string `json:"currency"` Vendor string `json:"vendor"` Reference string `json:"reference"` IpnURL string `json:"ipnUrl"` }
CreateQrcode is uesed to create transaction and get QR code for customers to scan to pay
func (*CreateQrcode) LoadCredentials ¶
func (s *CreateQrcode) LoadCredentials()
func (CreateQrcode) PostToYuansfer ¶
func (s CreateQrcode) PostToYuansfer() ([]byte, error)
PostToYuansfer is for api call to the Yuansfer gateway
type Credential ¶
type GoodsInformation ¶
type GoodsInformation struct { GoodsName string `json:"goods_name"` Quantity string `json:"quantity"` }
GoodsInformation is a JSON encoded string of an array of items that the customer purchases from the merchant. Special characters are not supported. e.g.: [{"goods_name":"name1","quantity":"quantity1"},{"goods_name":"name2","quantity":"quantity2"}]
type InStoreAdd ¶
type InStoreAdd struct { GroupNo string `json:"merGroupNo,omitempty"` MerchantNo string `json:"merchantNo"` StoreNo string `json:"storeNo"` VerifySign string `json:"verifySign"` Amount string `json:"amount"` StoreAdminNo string `json:"storeAdminNo"` IpnUrl string `json:"ipnUrl"` Reference string `json:"reference"` }
InStoreAdd initiates a Barcode/QR Code Payment request and creates a transaction order.
func (*InStoreAdd) LoadCredentials ¶
func (s *InStoreAdd) LoadCredentials()
func (InStoreAdd) PostToYuansfer ¶
func (s InStoreAdd) PostToYuansfer() ([]byte, error)
PostToYuansfer is for api call to the Yuansfer gateway
type InStorePay ¶
type InStorePay struct { GroupNo string `json:"merGroupNo,omitempty"` MerchantNo string `json:"merchantNo"` StoreNo string `json:"storeNo"` VerifySign string `json:"verifySign"` PaymentBarcode string `json:"paymentBarcode"` StoreAdminNo string `json:"storeAdminNo"` TransactionNo string `json:"transactionNo"` Vendor string `json:"vendor"` }
InStorePay to complete the QRC payment added previously.
func (*InStorePay) LoadCredentials ¶
func (s *InStorePay) LoadCredentials()
func (InStorePay) PostToYuansfer ¶
func (s InStorePay) PostToYuansfer() ([]byte, error)
PostToYuansfer is for api call to the Yuansfer gateway
type Network ¶
type Network struct { RequestTimeout time.Duration `toml:"request_timeout"` ConnectTimeout time.Duration `toml:"connect_timeout"` SocketTimeout time.Duration `toml:"socket_timeout"` }
Network contains common configuration.
type PayResponse ¶
type PayResponse struct { Result string `json:"ret_code"` RetMsg string `json:"ret_msg"` Transaction AddRet `json:"transaction"` }
PayResponse is the response from the Yuansfer service.
type PayRet ¶
type PayRet struct { TransactionNo string `json:"transactionNo"` OriginalTransactionNo string `json:"originalTransactionNo"` MerchantNo string `json:"merchantNo"` StoreNo string `json:"storeNo"` StoreAdminNo string `json:"storeAdminNo"` Amount string `json:"amount"` RefundAmount string `json:"refundAmount"` TransactionType string `json:"transactionType"` TransactionStatus string `json:"transactionStatus"` Currency string `json:"currency"` CreateTime string `json:"createTime"` PaymentTime string `json:"paymentTime"` ExchangeRate string `json:"exchangeRate"` Vendor string `json:"vendor"` }
PayRet is the response from the Yuansfer service.
type Prepay ¶
type Prepay struct { GroupNo string `json:"merGroupNo,omitempty"` MerchantNo string `json:"merchantNo"` StoreNo string `json:"storeNo"` VerifySign string `json:"verifySign"` Currency string `json:"currency"` SettleCurrency string `json:"settleCurrency"` Amount string `json:"amount"` Vendor string `json:"vendor"` // Vendor, possible values are alipay, wechatpay Reference string `json:"reference"` IpnURL string `json:"ipnUrl"` // InpURL The instant Payment Notification Handler URL. IPN URL must be secure. Description string `json:"description"` Note string `json:"note"` Terminal string `json:"terminal"` // Terminal including MINIPROGRAM, APP Timeout string `json:"timeout"` Openid string `json:"openid,omitempty"` }
Prepay does the mobile payment for the In-APP and/or WeChat Mini program solutions.
func (*Prepay) LoadCredentials ¶
func (p *Prepay) LoadCredentials()
func (Prepay) PostToYuansfer ¶
PostToYuansfer is for api call to the Yuansfer gateway
type Process ¶
type Process struct { GroupNo string `json:"merGroupNo"` MerchantNo string `json:"merchantNo"` StoreNo string `json:"storeNo"` VerifySign string `json:"verifySign"` // PaymentMethodNonce received from user end. PaymentMethodNonce string `json:"paymentMethodNonce"` // PaymentMethod indicates which payment method client selected, // accessible values: paypal_account, venmo_account, credit_card, android_pay_card, apple_pay_card PaymentMethod string `json:"paymentMethod"` TransactionNo string `json:"transactionNo"` CustomerNo string `json:"customerNo,omitempty"` // DeviceData received from user end provided by Braintree JS-SDK DeviceData string `json:"deviceData"` }
func (*Process) LoadCredentials ¶
func (p *Process) LoadCredentials()
func (Process) PostToYuansfer ¶
PostToYuansfer is for api call to the Yuansfer gateway
type QrcodeRet ¶
type QrcodeRet struct { Reference string `json:"reference"` RectCode string `json:"ret_code"` DeepLink string `json:"deepLink"` TransactionNo string `json:"transactionNo"` TimeOut string `json:"timeout"` QrcodeURL string `json:"qrcodeUrl"` }
QrcodeRet is the Response from the Yuansfer service
type QryResponse ¶
QryResponse is the response from the Yuansfer service.
type QryReverse ¶
type QryReverse struct { RetCode string `json:"ret_code"` RetMsg string `json:"ret_msg"` Result ReverseRet `json:"refundTransaction"` }
QryReverse is the response from the Yuansfer service.
type Query ¶
type Query struct { GroupNo string `json:"merGroupNo,omitempty"` MerchantNo string `json:"merchantNo"` StoreNo string `json:"storeNo"` VerifySign string `json:"verifySign"` Reference string `json:"reference,omitempty"` TransactionNo string `json:"transactionNo,omitempty"` }
Query obtain transaction details by ID of the transaction in the merchant’s system.
func (*Query) LoadCredentials ¶
func (q *Query) LoadCredentials()
func (Query) PostToYuansfer ¶
PostToYuansfer is for api call to the Yuansfer gateway
type Refund ¶
type Refund struct { GroupNo string `json:"merGroupNo,omitempty"` MerchantNo string `json:"merchantNo"` StoreNo string `json:"storeNo"` VerifySign string `json:"verifySign"` Amount string `json:"refundAmount"` Currency string `json:"currency"` // Reference indicates the payment transaction id. Reference string `json:"reference,omitempty"` TransactionNo string `json:"transactionNo,omitempty"` // RefundReference used for refund transaction RefundReference string `json:"refundReference,omitempty"` SettleCurrency string `json:"settleCurrency,omitempty"` }
Refund To refund payments.
func (*Refund) LoadCredentials ¶
func (r *Refund) LoadCredentials()
func (Refund) PostToYuansfer ¶
PostToYuansfer is for api call to the Yuansfer gateway
type RefundBody ¶
type RefundBody struct { OldTransactionID string `json:"oldTransactionId"` RefundTransactionID string `json:"refundTransactionId"` Reference string `json:"reference"` Status string `json:"status"` }
RefundBody is the response from the Yuansfer service.
type RefundResponse ¶
type RefundResponse struct { Result RefundBody `json:"result"` RetMsg string `json:"ret_msg"` RetCode string `json:"ret_code"` }
RefundResponse is the response from the Yuansfer service.
type Ret ¶
type Ret struct { Reference string `json:"reference"` YuansferID string `json:"yuansferId"` Amount string `json:"amount"` Status string `json:"status"` RefundInfo []refundInfo `json:"refundInfo"` Currency string `json:"currency"` }
Ret is the response from the Yuansfer service.
type ReverseRet ¶
type ReverseRet struct { ExchangeRate string `json:"exchangeRate"` Currency string `json:"currency"` Amount string `json:"amount"` CreateTime string `json:"createTime"` MerchantNo string `json:"merchantNo"` OriginalTransactionNo string `json:"originalTransactionNo"` PaymentTime string `json:"paymentTime"` RefundAmount string `json:"refundAmount"` StoreAdminNo string `json:"storeAdminNo"` StoreNo string `json:"storeNo"` TransactionNo string `json:"transactionNo"` TransactionStatus string `json:"transactionStatus"` TransactionType string `json:"transactionType"` Reference string `json:"reference"` }
ReverseRet is the response from the Yuansfer service.
type SecurePay ¶
type SecurePay struct { GroupNo string `json:"merGroupNo,omitempty"` MerchantNo string `json:"merchantNo"` StoreNo string `json:"storeNo"` VerifySign string `json:"verifySign"` Currency string `json:"currency"` // SettleCurrency refers to settlement currency, default value is USD SettleCurrency string `json:"settleCurrency,omitempty"` Amount string `json:"amount"` Vendor string `json:"vendor"` Reference string `json:"reference"` Terminal string `json:"terminal"` IpnURL string `json:"ipnUrl"` CallbackURL string `json:"callbackUrl,omitempty"` Note string `json:"note,omitempty"` Description string `json:"description,omitempty"` Timeout string `json:"timeout,omitempty"` GoodsInfo string `json:"goodsInfo,omitempty"` CreditType string `json:"creditType,omitempty"` CustomerNo string `json:"customerNo,omitempty"` OSType string `json:"osType,omitempty"` // IOS, ANDROID available }
SecurePay contains the attributes of online payment request.
func (*SecurePay) Format ¶
func (s *SecurePay) Format(goodsInfos []GoodsInformation) (err error)
Format changes GoodsInfo to string.
func (*SecurePay) LoadCredentials ¶
func (s *SecurePay) LoadCredentials()
func (SecurePay) PostToYuansfer ¶
PostToYuansfer is for api call to the Yuansfer gateway
func (*SecurePay) SetCredidentails ¶
type SecurePayResponse ¶
type SecurePayResponse struct { Result string `json:"ret_code"` RetMsg string `json:"ret_msg"` Response SecurePayRet `json:"result"` }
AddResponse is the Response from the Yuansfer service.
type SecurePayRet ¶
type SecurePayRet struct { Amount string `json:"amount"` Currency string `json:"currency"` TransactionNo string `json:"transactionNo"` Reference string `json:"reference"` CashierURL string `json:"cashierUrl"` SettleCurrency string `json:"settleCurrency"` }
AddRet is the Response from the Yuansfer service.