api

package
v0.0.0-...-432dbe7 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrderCreateUrl  = "/openapi/v2/order/create"
	OrderQueryUrl   = "/openapi/v2/order/query"
	OrderResendUrl  = "/openapi/v2/order/resend"
	ProductQueryUrl = "/openapi/v2/product/query"
	BalanceQueryUrl = "/openapi/v2/balance/query"
)
View Source
const (
	BaseUrlProd    = "openapi.1688sup.com"     // 正式 URL
	BaseUrlSandbox = "test.openapi.1688sup.cn" // 沙箱 URL
)

Variables

This section is empty.

Functions

func BalanceQuery

func BalanceQuery(ctx context.Context, client *sdk.Client, merchantId string) (*BalanceQueryResp, *ErrorResp, error)

BalanceQuery 获取余额

func OrderCreate

func OrderCreate(ctx context.Context, client *sdk.Client, merchantId string, req *OrderCreateReq) (*OrderCreateResp, *ErrorResp, error)

OrderCreate 下单接口

func OrderQuery

func OrderQuery(ctx context.Context, client *sdk.Client, merchantId string, req *OrderQueryReq) (*OrderQueryResp, *ErrorResp, error)

OrderQuery 查询接口

func OrderResend

func OrderResend(ctx context.Context, client *sdk.Client, merchantId string, req *OrderResendReq) (*OrderResendResp, *ErrorResp, error)

OrderResend 重新发送卡密短信

func ProductQuery

func ProductQuery(ctx context.Context, client *sdk.Client, merchantId string) (*ProductQueryResp, *ErrorResp, error)

ProductQuery 获取商品

Types

type BalanceQueryResp

type BalanceQueryResp struct {
	Balance float64 `json:"balance"`
}

type Cards

type Cards struct {
	No       string `json:"no"`
	Pwd      string `json:"pwd"`
	Deadline string `json:"deadline"`
	CardType int    `json:"cardType"`
}

type ErrorResp

type ErrorResp struct {
	Code     int         `json:"code"`
	Message  string      `json:"message"`
	Reason   string      `json:"reason"`
	Metadata interface{} `json:"metadata"`
}

type OrderCreateReq

type OrderCreateReq struct {
	OutTradeNo      string `json:"outTradeNo"`      // 合作商系统内部订单号,同一商户下不可重复, 同微信、支付宝的out_trade_no类似
	ProductId       string `json:"productId"`       // 商品编码
	Number          int    `json:"number"`          // 购买数量,目前只能固定是1
	NotifyUrl       string `json:"notifyUrl"`       // 异步通知地址
	RechargeAccount string `json:"rechargeAccount"` // 充值账号
	Extends         string `json:"extends"`         // 部分特殊商品需要,具体可联系商务
	Attach          string `json:"attach"`          //透传参数,当传了此参数时,查询和回调接口中将原样携带此参数
	UnitPrice       int64  `json:"unitPrice"`       //交易商品单价,单位:毫(1元等于10000亳) 0或不传表示不限制 当此价格小于采购价时,下单失败
	AccountType     int64  `json:"accountType"`     //账号类型:极少数特殊类型商品需要传此参数
}

type OrderCreateResp

type OrderCreateResp struct {
	OrderNo string `json:"orderNo"`
	Extra   string `json:"extra"`
}

type OrderQueryReq

type OrderQueryReq struct {
	OutTradeNo string `json:"outTradeNo"` // 合作商系统内部订单号,同一商户下不可重复, 同微信、支付宝的out_trade_no类似
}

type OrderQueryResp

type OrderQueryResp struct {
	TradeStatus     string  `json:"tradeStatus"`
	OrderNo         string  `json:"orderNo"`
	TradeStateDesc  string  `json:"tradeStateDesc"`
	Cards           []Cards `json:"cards"`
	MchId           int     `json:"mchId"`
	OutTradeNo      string  `json:"outTradeNo"`
	UnitPrice       float64 `json:"unitPrice"`
	Attach          string  `json:"attach"`
	Extra           string  `json:"extra"`
	RechargeAccount string  `json:"rechargeAccount"` // 充值账号
}

func (*OrderQueryResp) DecodeCard

func (c *OrderQueryResp) DecodeCard(secretKey string) (result map[string]string, err error)

DecodeCard 解密卡密

type OrderResendReq

type OrderResendReq struct {
	OutTradeNo string `json:"outTradeNo"` // 商户侧订单号长度只能是1-64位
	OrderNo    string `json:"orderNo"`    // 平台订单号;与outTradeNo二选一。如果传了outTradeNo参数,则此参数无效
}

type OrderResendResp

type OrderResendResp struct {
	IsSuccess bool `json:"isSuccess"`
}

type Product

type Product struct {
	ProductId     string  `json:"productId"`
	ProductName   string  `json:"productName"`
	ProductType   string  `json:"productType"`
	FaceValue     float64 `json:"faceValue"`
	PurchasePrice float64 `json:"purchasePrice"`
	TemplateId    string  `json:"templateId"`
}

type ProductQueryResp

type ProductQueryResp struct {
	Products []Product `json:"products"`
}

Jump to

Keyboard shortcuts

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