Documentation ¶
Index ¶
- Constants
- type AccessTokenInfo
- type ActorContext
- type ActorTypeEnum
- type Amount
- type AmountDetail
- type ApplyAccessToken
- type AuditInfo
- 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) ApplyAccessToken(reqBody *RequestApplyAccessToken) (res ResponseBody, err error)
- 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) InquiryUserInfo(reqBody *InquiryUserInfoRequest, accessToken string) (res InquiryUserInfoResponse, err error)
- func (gateway *CoreGateway) Order(reqBody *OrderRequestData, accessToken string) (res ResponseBody, err error)
- func (gateway *CoreGateway) OrderDetail(reqBody *OrderDetailRequestData, accessToken string) (res ResponseBody, err error)
- func (gateway *CoreGateway) Refund(reqBody *RefundRequestData, accessToken string) (res ResponseBody, err error)
- func (gateway *CoreGateway) UserProfile(reqBody *UserProfileRequestData, accessToken string) (res ResponseBody, err error)
- func (gateway *CoreGateway) VerifySignature(res []byte, signature string) (err error)
- type EnvInfo
- type Good
- type InputUserInfo
- type InquiryUserInfoRequest
- type InquiryUserInfoResponse
- type LogOption
- type Logger
- func (l *Logger) Ctx(ctx context.Context) *Logger
- func (l *Logger) Debug(format string, v ...interface{})
- func (l *Logger) Error(format string, v ...interface{})
- func (l *Logger) Info(format string, v ...interface{})
- func (l *Logger) Method(name string) *Logger
- func (l *Logger) Str(key string, val string) *Logger
- func (l *Logger) Trace(format string, v ...interface{})
- func (l *Logger) Warn(format string, v ...interface{})
- type NotificationUrl
- type Order
- type OrderDetailData
- type OrderDetailRequestData
- type OrderRequestData
- type OrderResponseData
- type PayFinishRequest
- type PayFinishResponse
- type PayMethodEnum
- type PayOptionInfo
- type PaymentPreference
- type PaymentView
- type RefundDestinationEnum
- type RefundRequestData
- type RefundResponseData
- type Request
- type RequestApplyAccessToken
- type RequestBody
- type RequestBodyPayFinish
- type RequestHeader
- type RequestPayFinish
- type Response
- type ResponseBody
- type ResponseBodyPayFinish
- type ResponseHeader
- type ResponsePayFinish
- type ResultInfo
- type ResultUserInfo
- type ShippingInfo
- type Signer
- type StatusDetail
- type TimeDetail
- type Unsigner
- type UserAddress
- type UserInfo
- type UserProfileRequestData
- type UserProfileResponseData
- type UserResourceInfos
Constants ¶
View Source
const ( TYPE_ORDER = "ORDER" TYPE_PAY_NOTIFY = "PAY_NOTIFY" )
View Source
const ( ORDER_PATH = "alipayplus/acquiring/order/createOrder.htm" QUERY_PATH = "alipayplus/acquiring/order/query.htm" REFUND_PATH = "alipayplus/acquiring/refund/refund.htm" APPLY_ACCESS_TOKEN_PATH = "dana/oauth/auth/applyToken.htm" USER_PROFILE_PATH = "alipayplus/member/query/queryUserProfile.htm" DANA_TIME_LAYOUT = "2006-01-02T15:04:05-07:00" CURRENCY_IDR = "IDR" INQUIRY_USER_INFO_PATH = "v1/customers/user/inquiryUserInfoByAccessToken.htm" FUNCTION_CREATE_ORDER = "dana.acquiring.order.createOrder" FUNCTION_QUERY_ORDER = "dana.acquiring.order.query" FUNCTION_REFUND = "dana.acquiring.refund.refund" FUNCTION_APPLY_ACCESS_TOKEN = "dana.oauth.auth.applyToken" FUNCTION_USER_PROFILE = "dana.member.query.queryUserProfile" FUNCTION_INQUIRY_USER_INFO = "customers.openapi.user.inquiryUserInfoByAccessToken" )
View Source
const ( APPLICATION_NAME = "sangu-dana" LOG_KEY_REQ_ID = "req_id" LOG_KEY_METHOD = "method" LOG_KEY_CALLER = "caller" LOG_LEVEL_TRACE = "trace" LOG_LEVEL_DEBUG = "debug" LOG_LEVEL_INFO = "info" LOG_LEVEL_WARN = "warn" LOG_LEVEL_ERROR = "error" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessTokenInfo ¶ added in v0.6.0
type ActorContext ¶ added in v0.5.0
type ActorTypeEnum ¶ added in v0.5.0
type ActorTypeEnum int
const ( User ActorTypeEnum = iota Merchant MerchantOperator BackOffice System )
func (ActorTypeEnum) String ¶ added in v0.5.0
func (a ActorTypeEnum) String() string
type AmountDetail ¶ added in v0.4.1
type AmountDetail struct { OrderAmount Amount `json:"orderAmount" valid:"required"` PayAmount Amount `json:"payAmount" valid:"optional"` VoidAmount Amount `json:"voidAmount" valid:"optional"` ConfirmAmount Amount `json:"confirmAmount" valid:"optional"` RefundAmount Amount `json:"refundAmount" valid:"optional"` ChargebackAmount Amount `json:"chargebackAmount" valid:"optional"` ChargeAmount Amount `json:"chargeAmount" valid:"optional"` }
type ApplyAccessToken ¶ added in v0.6.0
type ApplyAccessToken struct { ResultInfo ResultInfo `json:"resultInfo"` AccessTokenInfo AccessTokenInfo `json:"accessTokenInfo"` }
type Client ¶
type Client struct { BaseUrl string Version string ClientId string ClientSecret string PrivateKey []byte PublicKey []byte LogLevel int Logger Logger SignatureEnabled bool }
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) ApplyAccessToken ¶ added in v0.6.0
func (gateway *CoreGateway) ApplyAccessToken(reqBody *RequestApplyAccessToken) (res ResponseBody, err error)
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) InquiryUserInfo ¶ added in v0.10.0
func (gateway *CoreGateway) InquiryUserInfo(reqBody *InquiryUserInfoRequest, accessToken string) (res InquiryUserInfoResponse, err error)
func (*CoreGateway) Order ¶
func (gateway *CoreGateway) Order(reqBody *OrderRequestData, accessToken string) (res ResponseBody, err error)
func (*CoreGateway) OrderDetail ¶ added in v0.4.1
func (gateway *CoreGateway) OrderDetail(reqBody *OrderDetailRequestData, accessToken string) (res ResponseBody, err error)
func (*CoreGateway) Refund ¶ added in v0.5.0
func (gateway *CoreGateway) Refund(reqBody *RefundRequestData, accessToken string) (res ResponseBody, err error)
func (*CoreGateway) UserProfile ¶ added in v0.8.0
func (gateway *CoreGateway) UserProfile(reqBody *UserProfileRequestData, accessToken string) (res ResponseBody, err error)
func (*CoreGateway) VerifySignature ¶ added in v0.3.0
func (gateway *CoreGateway) VerifySignature(res []byte, 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 InputUserInfo ¶ added in v0.4.1
type InquiryUserInfoRequest ¶ added in v0.10.0
type InquiryUserInfoResponse ¶ added in v0.10.0
type InquiryUserInfoResponse struct { Result ResultInfo `json:"result" valid:"required"` UserInfo ResultUserInfo `json:"userInfo" valid:"required"` }
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 OrderDetailData ¶ added in v0.4.1
type OrderDetailData struct { ResultInfo ResultInfo `json:"resultInfo" valid:"required"` AcquirementID string `json:"acquirementId" valid:"optional"` MerchantTransID string `json:"merchantTransId" valid:"optional"` Buyer InputUserInfo `json:"buyer" valid:"optional"` Seller InputUserInfo `json:"seller" valid:"optional"` OrderTitle string `json:"orderTitle" valid:"optional"` ExtendedInfo string `json:"extendedInfo" valid:"optional"` AmountDetail AmountDetail `json:"amountDetail" valid:"optional"` TimeDetail TimeDetail `json:"timeDetail" valid:"optional"` StatusDetail StatusDetail `json:"statusDetail" valid:"optional"` Goods []Good `json:"goods" valid:"optional"` ShippingInfo []ShippingInfo `json:"shippingInfo" valid:"optional"` OrderMemo string `json:"orderMemo" valid:"optional"` PaymentViews []PaymentView `json:"paymentViews" valid:"optional"` }
type OrderDetailRequestData ¶ added in v0.4.1
type OrderRequestData ¶ added in v0.4.1
type OrderRequestData 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 OrderResponseData ¶ added in v0.4.1
type OrderResponseData struct { MerchantTransID string `json:"merchantTransId,omitempty" valid:"optional"` AcquirementID string `json:"acquirementId,omitempty" valid:"optional"` CheckoutURL string `json:"checkoutUrl,omitempty" valid:"optional"` ResultInfo ResultInfo `json:"resultInfo" valid:"required"` }
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 PayMethodEnum ¶ added in v0.4.1
type PayMethodEnum int
const ( Balance PayMethodEnum = iota Coupon NetBanking CreditCard DebitCard VirtualAccount Otc DirectDebitCreditCard DirectDebitDebitCard )
func (PayMethodEnum) String ¶ added in v0.4.1
func (p PayMethodEnum) String() string
type PayOptionInfo ¶ added in v0.4.1
type PayOptionInfo struct { PayMethod string `json:"payMethod" valid:"required"` PayAmount Amount `json:"payAmount" valid:"required"` TransAmount Amount `json:"transAmount" valid:"optional"` ChargeAmount Amount `json:"chargeAmount" valid:"optional"` ExtendInfo string `json:"extendInfo" valid:"optional"` PayOptionBillExtendInfo string `json:"payOptionBillExtendInfo" valid:"optional"` }
type PaymentPreference ¶
type PaymentPreference struct {
DisabledPayMethods string `json:"disabledPayMethods"`
}
type PaymentView ¶ added in v0.4.1
type PaymentView struct { CashierRequestID string `json:"cashierRequestId" valid:"required"` PaidTime string `json:"paidTime" valid:"required"` PayOptionInfos []PayOptionInfo `json:"payOptionInfos" valid:"required"` PayRequestExtendInfo string `json:"payRequestExtendInfo" valid:"optional"` ExtendInfo string `json:"extendInfo" valid:"optional"` }
type RefundDestinationEnum ¶ added in v0.5.0
type RefundDestinationEnum int
const ( ToBalance RefundDestinationEnum = iota ToSource )
func (RefundDestinationEnum) String ¶ added in v0.5.0
func (r RefundDestinationEnum) String() string
type RefundRequestData ¶ added in v0.5.0
type RefundRequestData struct { RequestID string `json:"requestId" valid:"required"` MerchantID string `json:"merchantId" valid:"required"` AcquirementID string `json:"acquirementId,omitempty" valid:"optional"` RefundAmount Amount `json:"refundAmount,omitempty" valid:"required"` RefundAppliedTime time.Time `json:"refundAppliedTime,omitempty" valid:"optional"` ActorType string `json:"actorType,omitempty" valid:"optional"` RefundReason string `json:"refundReason,omitempty" valid:"optional"` ReturnChargeToPayer bool `json:"returnChargeToPayer,omitempty" valid:"optional"` Destination string `json:"destination,omitempty" valid:"optional"` ExtendInfo string `json:"extendInfo,omitempty" valid:"optional"` EnvInfo EnvInfo `json:"envInfo,omitempty" valid:"optional"` AuditInfo AuditInfo `json:"auditInfo,omitempty" valid:"optional"` ActorContext ActorContext `json:"actorContext,omitempty" valid:"optional"` }
type RefundResponseData ¶ added in v0.5.0
type RefundResponseData struct { ResultInfo ResultInfo `json:"resultInfo" valid:"required"` RequestID string `json:"requestId,omitempty" valid:"optional"` RefundID string `json:"refundId,omitempty" valid:"optional"` }
type Request ¶
type Request struct { Head RequestHeader `json:"head" valid:"required"` Body interface{} `json:"body" valid:"required"` }
type RequestApplyAccessToken ¶ added in v0.6.0
type RequestBody ¶
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 interface{} `json:"body" valid:"required"` }
type ResponseBody ¶
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 ResultInfo struct { ResultStatus string `json:"resultStatus" valid:"optional"` ResultCodeID string `json:"resultCodeId" valid:"optional"` ResultMsg string `json:"resultMsg" valid:"optional"` ResultCode string `json:"resultCode" valid:"optional"` ResultMessage string `json:"resultMessage" valid:"optional"` }
type ResultUserInfo ¶ added in v0.10.0
type ResultUserInfo struct { UserContactInfoEmail string `json:"USER_CONTACTINFO_EMAIL" valid:"optional"` UserName string `json:"USER_NAME" valid:"optional"` UserAddress []UserAddress `json:"USER_ADDRESS" valid:"optional"` UserContactInfo string `json:"USER_CONTACTINFO" valid:"optional"` }
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"` }
type Signer ¶
type Signer interface { // Sign returns raw signature for the given data. This method // will apply the hash specified for the keytype to the data. Sign(data []byte) ([]byte, error) }
A Signer is can create signatures that verify against a public key.
type StatusDetail ¶ added in v0.4.1
type TimeDetail ¶ added in v0.4.1
type TimeDetail struct { CreatedTime string `json:"createdTime" valid:"required"` ExpiryTime string `json:"expiryTime" valid:"required"` PaidTimes []string `json:"paidTimes" valid:"optional"` ConfirmedTimes []string `json:"confirmedTimes" valid:"optional"` CancelledTime string `json:"cancelledTime" valid:"optional"` }
type Unsigner ¶
type Unsigner interface { // Sign returns raw signature for the given data. This method // will apply the hash specified for the keytype to the data. Unsign(data []byte, sig []byte) error }
A Signer is can create signatures that verify against a public key.
type UserAddress ¶ added in v0.10.0
type UserProfileRequestData ¶ added in v0.8.0
type UserProfileRequestData struct {
UserResources []string `json:"userResources" valid:"required"`
}
type UserProfileResponseData ¶ added in v0.8.0
type UserProfileResponseData struct { ResultInfo ResultInfo `json:"resultInfo" valid:"required"` UserResourceInfos []UserResourceInfos `json:"userResourceInfos" valid:"required"` }
type UserResourceInfos ¶ added in v0.8.0
type UserResourceInfos struct { ResourceType string `json:"resourceType"` Value interface{} `json:"value"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.