Documentation
¶
Index ¶
- Constants
- type Amount
- type Client
- func (c *Client) Call(method, path string, header map[string]string, body io.Reader, v interface{}) error
- func (c *Client) ExecuteRequest(req *http.Request, v interface{}) error
- func (c *Client) NewRequest(method string, fullPath string, headers map[string]string, body io.Reader) (*http.Request, error)
- type CoreGateway
- func (gateway *CoreGateway) Call(method, path string, header map[string]string, body io.Reader, v interface{}) error
- func (gateway *CoreGateway) GenerateSignature(req interface{}) (signature string, err error)
- func (gateway *CoreGateway) Order(reqBody *RequestBody) (res OrderResponse, err error)
- func (gateway *CoreGateway) VerifySignature(res interface{}, signature string) (err error)
- type EnvInfo
- type Good
- type NotificationUrl
- type Order
- type OrderRequest
- type OrderResponse
- type PayFinishRequest
- type PayFinishResponse
- type PaymentPreference
- type Request
- type RequestBody
- type RequestBodyPayFinish
- type RequestHeader
- type RequestPayFinish
- type Response
- type ResponseBody
- type ResponseBodyPayFinish
- type ResponseHeader
- type ResponsePayFinish
- type ResultInfo
- type ShippingInfo
- type Signer
- type Unsigner
Constants ¶
View Source
const ( TYPE_ORDER = "ORDER" TYPE_PAY_NOTIFY = "PAY_NOTIFY" )
View Source
const ( //ORDER_PATH = "https://api-sandbox.saas.dana.id/alipayplus/acquiring/order/createOrder.htm" ORDER_PATH = "alipayplus/acquiring/order/createOrder.htm" QUERY_PATH = "alipayplus/acquiring/order/query.htm" DANA_TIME_LAYOUT = "2006-01-02T15:04:05.000-07:00" CURRENCY_IDR = "IDR" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { BaseUrl string Version string Function string ClientId string ClientSecret string PrivateKey []byte PublicKey []byte LogLevel int Logger *log.Logger }
Client struct
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 Dana 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 ¶
ExecuteRequest : execute 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) GenerateSignature ¶ added in v0.3.0
func (gateway *CoreGateway) GenerateSignature(req interface{}) (signature string, err error)
func (*CoreGateway) Order ¶
func (gateway *CoreGateway) Order(reqBody *RequestBody) (res OrderResponse, err error)
func (*CoreGateway) VerifySignature ¶ added in v0.3.0
func (gateway *CoreGateway) VerifySignature(res interface{}, signature string) (err error)
type EnvInfo ¶
type EnvInfo struct { SessionID string `json:"sessionId,omitempty"` TokenID string `json:"tokenId,omitempty"` WebsiteLanguage string `json:"websiteLanguage,omitempty"` ClientIP string `json:"clientIp,omitempty"` OsType string `json:"osType,omitempty"` AppVersion string `json:"appVersion,omitempty"` SdkVersion string `json:"sdkVersion,omitempty"` SourcePlatform string `json:"sourcePlatform"` TerminalType string `json:"terminalType"` ClientKey string `json:"clientKey,omitempty"` OrderTerminalType string `json:"orderTerminalType"` OrderOsType string `json:"orderOsType,omitempty"` MerchantAppVersion string `json:"merchantAppVersion,omitempty"` ExtendInfo string `json:"extendInfo,omitempty"` }
type Good ¶
type Good struct { MerchantGoodsID string `json:"merchantGoodsId,omitempty"` Description string `json:"description"` Category string `json:"category,omitempty"` Price Amount `json:"price"` Unit string `json:"unit,omitempty"` Quantity string `json:"quantity,omitempty"` MerchantShippingID string `json:"merchantShippingId,omitempty"` SnapshotURL string `json:"snapshotUrl,omitempty"` ExtendInfo string `json:"extendInfo,omitempty"` }
type NotificationUrl ¶
type Order ¶
type Order struct { OrderTitle string `json:"orderTitle"` OrderAmount Amount `json:"orderAmount"` MerchantTransID string `json:"merchantTransId"` MerchantTransType string `json:"merchantTransType,omitempty"` OrderMemo string `json:"orderMemo,omitempty"` CreatedTime string `json:"createdTime,omitempty"` ExpiryTime string `json:"expiryTime,omitempty"` Goods []Good `json:"goods,omitempty"` ShippingInfo []ShippingInfo `json:"shippingInfo,omitempty"` }
type OrderRequest ¶
type OrderResponse ¶
type PayFinishRequest ¶ added in v0.2.0
type PayFinishRequest struct { Request RequestPayFinish `json:"request"` Signature string `json:"signature"` }
type PayFinishResponse ¶ added in v0.2.0
type PayFinishResponse struct { Response ResponsePayFinish `json:"response"` Signature string `json:"signature"` }
type PaymentPreference ¶
type PaymentPreference struct {
DisabledPayMethods string `json:"disabledPayMethods"`
}
type Request ¶
type Request struct { Head RequestHeader `json:"head" valid:"required"` Body *RequestBody `json:"body" valid:"required"` }
type RequestBody ¶
type RequestBody struct { Order Order `json:"order" valid:"required"` MerchantID string `json:"merchantId" valid:"required"` Mcc string `json:"mcc,omitempty" valid:"optional"` ProductCode string `json:"productCode" valid:"required"` EnvInfo EnvInfo `json:"envInfo" valid:"required"` NotificationUrls *[]NotificationUrl `json:"notificationUrls,omitempty" valid:"optional"` ExtendInfo string `json:"extendInfo,omitempty" valid:"optional"` PaymentPreference *PaymentPreference `json:"paymentPreference,omitempty" valid:"optional"` }
type RequestBodyPayFinish ¶ added in v0.2.0
type RequestBodyPayFinish struct { AcquirementID string `json:"acquirementId"` MerchantTransID string `json:"merchantTransId"` FinishedTime string `json:"finishedTime"` CreatedTime string `json:"createdTime"` MerchantID string `json:"merchantId"` OrderAmount Amount `json:"orderAmount"` AcquirementStatus string `json:"acquirementStatus"` ExtendInfo string `json:"extendInfo"` }
type RequestHeader ¶
type RequestHeader struct { Version string `json:"version" valid:"required"` Function string `json:"function" valid:"required"` ClientID string `json:"clientId" valid:"required"` ReqTime string `json:"reqTime" valid:"required"` ReqMsgID string `json:"reqMsgId" valid:"required"` ClientSecret string `json:"clientSecret" valid:"required"` AccessToken string `json:"accessToken,omitempty" valid:"optional"` Reserve string `json:"reserve,omitempty" valid:"optional"` }
type RequestPayFinish ¶ added in v0.2.0
type RequestPayFinish struct { Head RequestHeader `json:"head"` Body RequestBodyPayFinish `json:"body"` }
type Response ¶
type Response struct { Head ResponseHeader `json:"head" valid:"required"` Body ResponseBody `json:"body" valid:"required"` }
type ResponseBody ¶
type ResponseBody struct { MerchantTransID string `json:"merchantTransId" valid:"optional"` AcquirementID string `json:"acquirementId" valid:"optional"` CheckoutURL string `json:"checkoutUrl" valid:"optional"` ResultInfo ResultInfo `json:"resultInfo" valid:"required"` }
type ResponseBodyPayFinish ¶ added in v0.2.0
type ResponseBodyPayFinish struct {
ResultInfo ResultInfo `json:"resultInfo"`
}
type ResponseHeader ¶
type ResponsePayFinish ¶ added in v0.2.0
type ResponsePayFinish struct { Head ResponseHeader `json:"head"` Body ResponseBodyPayFinish `json:"body"` }
type ResultInfo ¶
type ShippingInfo ¶
type ShippingInfo struct { MerchantShippingID string `json:"merchantShippingId"` TrackingNo string `json:"trackingNo,omitempty"` Carrier string `json:"carrier,omitempty"` ChargeAmount Amount `json:"chargeAmount,omitempty"` CountryName string `json:"countryName"` StateName string `json:"stateName"` CityName string `json:"cityName"` AreaName string `json:"areaName,omitempty"` Address1 string `json:"address1"` Address2 string `json:"address2,omitempty"` FirstName string `json:"firstName"` LastName string `json:"lastName"` MobileNo string `json:"mobileNo,omitempty"` PhoneNo string `json:"phoneNo,omitempty"` ZipCode string `json:"zipCode"` Email string `json:"email,omitempty"` FaxNo string `json:"faxNo,omitempty"` }
Click to show internal directories.
Click to hide internal directories.