Documentation ¶
Index ¶
- Constants
- type BodyMap
- type Client
- func (c Client) FormatPrivateKey(privateKey string) string
- func (c Client) FormatPublicKey(publicKey string) string
- func (Client) FormatURLParam(body BodyMap) string
- func (Client) GenerateBizContent(body interface{}) string
- func (c Client) NotifyPay(bodyStr string) (params TradeNotifyParamsItem, err error)
- func (c Client) TradeCommon(body TradeCommonBody) (rsp []byte, err error)
- func (c Client) TradeCommonCode(body TradeCommonBody) (rsp TradeCommonCodeResponse, err error)
- func (c Client) TradeCommonJsApi(body TradeCommonBody) (rsp TradeCommonJsApiResponse, err error)
- func (c Client) TradeQuery(body TradeQueryBody) (rsp TradeQueryResponse, err error)
- type CommonNotify
- type CommonResponse
- type Config
- type TradeCommonBody
- type TradeCommonCodeResponse
- type TradeCommonJsApiResponse
- type TradeNotifyParams
- type TradeNotifyParamsItem
- type TradeQueryBody
- type TradeQueryResponse
Constants ¶
View Source
const ( // 服务基地址 BaseUrlProd = "https://po.yunzongnet.com/api/v2/gateway" // 生产环境地址 BaseUrlDev = "http://crouter.yunzongnet.com/parking-order/ds/api/v2/gateway" // 测试环境地址 // 常量 CharsetUtf8 = "UTF-8" Version2 = "2.0" SignTypeRsa2 = "RSA2" // 支付类型 PayTypeAlipay = "ALIPAY" // 支付宝 PayTypeWechat = "WECHAT" // 微信 // 支付方式 PayMethodJsApi = "JSAPIPAY" // 用户扫码支付(jsapi) PayMethodCode = "CODEPAY" // (条码付)扫码枪支付 PayMethodAuto = "AUTOPAY" // 无感支付 PayMethodProactive = "PROACTIVE" // 微信免密支付 // 交易状态 TradeStatusWait = "WAIT_BUYER_PAY" // 等待买家付款 TradeStatusSuccess = "SUCCESS" // 交易支付成功 TradeStatusFail = "FAIL" // 支付失败 // 缴费场景 BusinessTypeCommon = "2" // 通用缴费 BusinessTypePackage = "3" // 月租缴费 // 返回码 CodeSuccess = "10000" // 成功 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
云停支付客户端
func NewClient ¶
func NewClient( isProd bool, publicKey string, privateKey string, ytKey string, config Config, ) (client *Client)
初始化云停支付客户端
func (Client) FormatPrivateKey ¶
将私钥字符串转换为RSA私钥格式
func (Client) FormatPublicKey ¶
将公钥字符串转换为RSA公钥格式
func (Client) NotifyPay ¶
func (c Client) NotifyPay(bodyStr string) (params TradeNotifyParamsItem, err error)
支付通知的处理
func (Client) TradeCommon ¶
func (c Client) TradeCommon(body TradeCommonBody) (rsp []byte, err error)
通用支付接口
func (Client) TradeCommonCode ¶
func (c Client) TradeCommonCode(body TradeCommonBody) (rsp TradeCommonCodeResponse, err error)
条码付支付接口
func (Client) TradeCommonJsApi ¶
func (c Client) TradeCommonJsApi(body TradeCommonBody) (rsp TradeCommonJsApiResponse, err error)
JSAPI支付接口
func (Client) TradeQuery ¶
func (c Client) TradeQuery(body TradeQueryBody) (rsp TradeQueryResponse, err error)
交易查询接口
type CommonNotify ¶
type CommonNotify struct { NotifyTime string `json:"notify_time"` // 通知时间,格式为“yyyy-MM-dd HH:mm:ss” NotifyType string `json:"notify_type"` // 通知类型 Version string `json:"version"` // 版本号 Sign string `json:"sign"` // 签名字符串 SignType string `json:"sign_type"` // 签名类型 }
通用通知包
type CommonResponse ¶
type CommonResponse struct { Code string `json:"code"` // 网关返回码 Message string `json:"msg"` // 描述信息 Sign string `json:"sign"` // 签名字符串 SignType string `json:"sign_type"` // 签名类型 BizContent string `json:"biz_content"` // 业务实体 }
通用应答包
type TradeCommonBody ¶
type TradeCommonBody struct { PayType string `json:"pay_type"` // 支付类型,参见constant/PayType PayMethod string `json:"pay_method"` // 支付方式,参见constant/PayMethod ParkingId string `json:"parking_id"` // 停车场ID AuthCode string `json:"auth_code,omitempty"` // 支付宝或微信的二维码值,条码付的时候必传 TotalAmount string `json:"total_amount"` // 订单总金额,单位为分 OutTradeNo string `json:"out_trade_no"` // 商户交易号,停车管理系统生成的交易号,商户维度内不可重复 OutOrderId string `json:"out_order_id,omitempty"` // 商户订单号,可以重复,仅用于业务响应和回调通知时原样返回 Subject string `json:"subject"` // 订单标题,如“停车缴费” 或拼装成“停车缴费:京A123456-5元” Attach string `json:"attach,omitempty"` // 附加数据(128字符),在查询API和支付通知中原样返回,可作为自定义参数使用 Remark string `json:"remark,omitempty"` // 备注字段,用于备注该笔交易 NotifyUrl string `json:"notify_url,omitempty"` // 支付成功回调地址 CallbackUrl string `json:"callback_url,omitempty"` // 支付成功后页面跳转地址,用于展示ISV的支付成功后续业务地址,可携带get参数 BusinessType string `json:"business_type,omitempty"` // 缴费场景 2: 通用缴费; 3: 月租缴费 PlateNo string `json:"plate_no,omitempty"` // 车牌号 }
通用支付接口参数
type TradeCommonCodeResponse ¶
type TradeCommonCodeResponse struct { MerchantId string `json:"mch_id"` // 商户号 ParkingId string `json:"parking_id"` // 停车场ID,跟请求一致 PayType string `json:"pay_type"` // 支付方式, ALIPAY或WECHAT TradeNo string `json:"trade_no"` // 云停平台订单号 OutTradeNo string `json:"out_trade_no"` // 商户订单号,跟请求的订单号一致 OutOrderId string `json:"out_order_id,omitempty"` // 商户订单号,可以重复,如果请求时传递了该参数,则原样返回 ChannelTradeNo string `json:"channel_trade_no,omitempty"` // 支付渠道交易号(微信和支付宝) TotalAmount string `json:"total_amount"` // 订单总金额,单位为分,注意:主扫不返回,被扫返回,例:收费5元则返回值为500 DiscountAmount string `json:"discount_amount,omitempty"` // 优惠金额,有优惠券核销时,显示抵扣金额,单位为分 DiscountDetails string `json:"discount_details,omitempty"` // 有优惠券抵扣的时候返回,优惠券列表的JSON串,详见:优惠券说明 SettlementAmount string `json:"settlement_amount"` // 待付款金额,对应支付成功后的应结算金额,待付款金额=订单总金额-优惠金额,无优惠时等于total_amount,注意:主扫不返回,被扫返回 PayTime string `json:"pay_time,omitempty"` // 支付完成时间,对账以此时间为准,时间格式为:“yyyy-MM-dd HH:mm:ss” Attach string `json:"attach,omitempty"` // 附加数据,原样返回 UserId string `json:"user_id,omitempty"` // 用户标识(微信openid,支付宝userid) InvoiceUrl string `json:"invoice_url"` // 开发票地址,商户开通了电子发票时返回,订单支付成功后生效 TradeStatus string `json:"trade_status"` // 交易订单状态。WAIT_BUYER_PAY(等待买家付款),SUCCESS(交易支付成功),FAIL(支付失败) SUCCESS }
type TradeCommonJsApiResponse ¶
type TradeCommonJsApiResponse struct { MerchantId string `json:"mch_id"` // 商户号 ParkingId string `json:"parking_id"` // 停车场ID,跟请求一致 TradeNo string `json:"trade_no"` // 云停平台订单号 OutTradeNo string `json:"out_trade_no"` // 商户订单号,跟请求的订单号一致 OutOrderId string `json:"out_order_id,omitempty"` // 商户订单号,可以重复,如果请求时传递了该参数,则原样返回 TotalAmount string `json:"total_amount"` // 订单总金额,单位为分,注意:主扫不返回,被扫返回,例:收费5元则返回值为500 DiscountAmount string `json:"discount_amount,omitempty"` // 优惠金额,有优惠券核销时,显示抵扣金额,单位为分 DiscountDetails string `json:"discount_details,omitempty"` // 有优惠券抵扣的时候返回,优惠券列表的JSON串,详见:优惠券说明 SettlementAmount string `json:"settlement_amount"` // 待付款金额,对应支付成功后的应结算金额,待付款金额=订单总金额-优惠金额,无优惠时等于total_amount,注意:主扫不返回,被扫返回 InvoiceUrl string `json:"invoice_url"` // 开发票地址,商户开通了电子发票时返回,订单支付成功后生效 TradeUrl string `json:"trade_url"` // 支付地址,有待付款金额时必返回 }
type TradeNotifyParams ¶
type TradeNotifyParams struct { CommonNotify BizContent TradeNotifyParamsItem `json:"biz_content"` // 业务参数组装的json数据,详情见业务参数 }
电子支付异步通知的参数
type TradeNotifyParamsItem ¶
type TradeNotifyParamsItem struct { MerchantId string `json:"mch_id"` // 商户号 ParkingId string `json:"parking_id"` // 停车场ID,跟请求一致 PayType string `json:"pay_type"` // 支付方式, ALIPAY或WECHAT PayMethod string `json:"pay_method"` // 支付方式 TradeStatus string `json:"trade_status"` // 交易订单状态。WAIT_BUYER_PAY(等待买家付款),SUCCESS(交易支付成功),FAIL(支付失败) SUCCESS PlateNo string `json:"plate_no"` // 车牌号 TradeNo string `json:"trade_no"` // 云停平台订单号 OutTradeNo string `json:"out_trade_no"` // 商户订单号,跟请求的订单号一致 OutOrderId string `json:"out_order_id,omitempty"` // 商户订单号,可以重复,如果请求时传递了该参数,则原样返回 ChannelTradeNo string `json:"channel_trade_no,omitempty"` // 支付渠道交易号(微信和支付宝) Subject string `json:"subject"` // 订单标题 TotalAmount string `json:"total_amount"` // 订单总金额,单位为分,注意:主扫不返回,被扫返回,例:收费5元则返回值为500 DiscountAmount string `json:"discount_amount,omitempty"` // 优惠金额,有优惠券核销时,显示抵扣金额,单位为分 DiscountDetails string `json:"discount_details,omitempty"` // 有优惠券抵扣的时候返回,优惠券列表的JSON串,详见:优惠券说明 SettlementAmount string `json:"settlement_amount"` // 待付款金额,对应支付成功后的应结算金额,待付款金额=订单总金额-优惠金额,无优惠时等于total_amount,注意:主扫不返回,被扫返回 PayTime string `json:"pay_time,omitempty"` // 支付完成时间,对账以此时间为准,时间格式为:“yyyy-MM-dd HH:mm:ss” Attach string `json:"attach,omitempty"` // 附加数据,原样返回 UserId string `json:"user_id,omitempty"` // 用户标识(微信openid,支付宝userid) }
type TradeQueryBody ¶
type TradeQueryBody struct { ParkingId string `json:"parking_id"` // 停车场ID OutTradeNo string `json:"out_trade_no"` // (二选一) 商户订单号 TradeNo string `json:"trade_no"` // (二选一) 交易流水号 }
交易查询接口参数
type TradeQueryResponse ¶
type TradeQueryResponse struct { MerchantId string `json:"mch_id"` // 商户号 ParkingId string `json:"parking_id"` // 停车场ID,跟请求一致 PayType string `json:"pay_type"` // 支付方式, ALIPAY或WECHAT TradeNo string `json:"trade_no"` // 云停平台订单号 OutTradeNo string `json:"out_trade_no"` // 商户订单号,跟请求的订单号一致 ChannelTradeNo string `json:"channel_trade_no,omitempty"` // 支付渠道交易号(微信和支付宝) TotalAmount string `json:"total_amount"` // 订单总金额,单位为分,注意:主扫不返回,被扫返回,例:收费5元则返回值为500 DiscountAmount string `json:"discount_amount,omitempty"` // 优惠金额,有优惠券核销时,显示抵扣金额,单位为分 DiscountDetails string `json:"discount_details,omitempty"` // 有优惠券抵扣的时候返回,优惠券列表的JSON串,详见:优惠券说明 SettlementAmount string `json:"settlement_amount"` // 待付款金额,对应支付成功后的应结算金额,待付款金额=订单总金额-优惠金额,无优惠时等于total_amount,注意:主扫不返回,被扫返回 PayTime string `json:"pay_time,omitempty"` // 支付完成时间,对账以此时间为准,时间格式为:“yyyy-MM-dd HH:mm:ss” Attach string `json:"attach,omitempty"` // 附加数据,原样返回 UserId string `json:"user_id,omitempty"` // 用户标识(微信openid,支付宝userid) TradeStatus string `json:"trade_status"` // 交易订单状态。WAIT_BUYER_PAY(等待买家付款),SUCCESS(交易支付成功),FAIL(支付失败) SUCCESS }
Click to show internal directories.
Click to hide internal directories.