structs

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2021 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ServerOrderParsers = map[string]func(*ServerOrder){
	`EOS`: func(s *ServerOrder) {
		s.Invoice.Address = "mgtestflight"
		s.Invoice.Memo = fmt.Sprintf("MP:%s", s.Invoice.OrderID)
	},
}

ServerOrderParsers 响应订单数据解析器

Functions

This section is empty.

Types

type Callback

type Callback struct {
	MerchantOrderID string  `json:"merchant_order_id"`
	OrderID         string  `json:"order_id"`
	Status          string  `json:"status"`         // 状态
	PriceAmount     float64 `json:"price_amount"`   // muggalepay 实际交易金额
	PriceCurrency   string  `json:"price_currency"` // muggalepay 实际交易币种
	PayAmount       float64 `json:"pay_amount"`     // 我方原始金额(即我们自己提交过去的金额)
	PayCurrency     string  `json:"pay_currency"`   // 我方原始金额币种
	CreatedAt       string  `json:"created_at"`
	CreatedAtT      int64   `json:"created_at_t"`
	Token           string  `json:"token"`
	Meta            Meta    `json:"meta"`
}

Callback 回调数据

type Invoice

type Invoice struct {
	InvoiceID       string  `json:"invoice_id"`
	OrderID         string  `json:"order_id"`
	PayAmount       float64 `json:"pay_amount"`   // 客户支付的金额
	PayCurrency     string  `json:"pay_currency"` // 客户支付的币种
	Status          string  `json:"status"`
	CreatedAt       string  `json:"created_at"`
	CreatedAtT      int64   `json:"created_at_t"`
	ExpiredAt       string  `json:"expired_at"`
	ExpiredAtT      int64   `json:"expired_at_t"`
	MerchantOrderID string  `json:"merchant_order_id"`
	ReceiveAmount   float64 `json:"receive_amount"`   // 实际收款金额
	ReceiveCurrency string  `json:"receive_currency"` // 实际收款币种
	Qrcode          string  `json:"qrcode"`
	QrcodeLg        string  `json:"qrcodeLg"`
	Address         string  `json:"address"`
	Memo            string  `json:"memo"`
}

Invoice 客户在mugglepay上的金额信息

type Merchant

type Merchant struct {
	AcceptBTC         bool                   `json:"accept_btc"`
	AcceptUSDT        bool                   `json:"accept_usdt"`
	AcceptBCH         bool                   `json:"accept_bch"`
	AcceptETH         bool                   `json:"accept_eth"`
	AcceptEOS         bool                   `json:"accept_eos"`
	AcceptLTC         bool                   `json:"accept_ltc"`
	AcceptBNB         bool                   `json:"accept_bnb"`
	AcceptBUSD        bool                   `json:"accept_busd"`
	AcceptCUSD        bool                   `json:"accept_cusd"`
	AcceptAlipay      bool                   `json:"accept_alipay"`
	AcceptWechat      bool                   `json:"accept_wechat"`
	WalletUserHash    string                 `json:"wallet_user_hash"`
	WalletUserEnabled bool                   `json:"wallet_user_enabled"`
	EmailVerified     bool                   `json:"email_verified"`
	Price             map[string]interface{} `json:"price"`
	Permission        string                 `json:"permission"`
}

Merchant 商家信息

type Meta

type Meta struct {
	Payment     string `json:"payment"`
	TotalMmount string `json:"total_amount"`
	TradeNo     string `json:"trade_no"`
	OutTradeNo  string `json:"out_trade_no"`
}

Meta 支付宝、微信等法币平台交易信息

type Order

type Order struct {
	MerchantOrderID string  `json:"merchant_order_id"` // required. 自己系统的订单号
	PriceAmount     float64 `json:"price_amount"`      // required. 金额
	PriceCurrency   string  `json:"price_currency"`    // required. 金额币种
	PayCurrency     string  `json:"pay_currency"`      // 支付方式,自己实现选择支付方式的时候提供。e.g. ALIPAY, ALIGLOBAL, WECHAT, BTC, LTC, ETH, EOS, BCH, LBTC (for Lightening BTC), CUSD (for Celo Dollars)
	Title           string  `json:"title"`
	Description     string  `json:"description"`
	CallbackURL     string  `json:"callback_url"`
	CancelURL       string  `json:"cancel_url"`
	SuccessURL      string  `json:"success_url"`
	Mobile          bool    `json:"mobile"`
	Fast            bool    `json:"fast"`
	Token           string  `json:"token"`
}

Order 提交订单数据

func (*Order) Sign

func (o *Order) Sign(secret string)

Sign 签名

type ResponseOrder added in v0.0.5

type ResponseOrder struct {
	OrderID         string  `json:"order_id"`          // muggalepay 订单ID
	UserID          int64   `json:"user_id"`           // muggalepay 付款用户ID
	MerchantOrderID string  `json:"merchant_order_id"` // 自己系统的订单ID
	Title           string  `json:"title"`
	Description     string  `json:"description"`
	CallbackURL     string  `json:"callback_url"`
	CancelURL       string  `json:"cancel_url"`
	SuccessURL      string  `json:"success_url"`
	PriceAmount     float64 `json:"price_amount"`   // muggalepay 实际交易金额
	PriceCurrency   string  `json:"price_currency"` // muggalepay 实际交易币种
	Status          string  `json:"status"`
	Notified        string  `json:"notified"`
	CreatedAt       string  `json:"created_at"`
	UpdatedAt       string  `json:"updated_at"`
	PayAmount       float64 `json:"pay_amount"`   // 我方原始金额(即我们自己提交过去的金额)
	PayCurrency     string  `json:"pay_currency"` // 我方原始金额币种
	IsSelf          bool    `json:"is_self"`
	Mobile          bool    `json:"mobile"`
	Fast            bool    `json:"fast"`
	Token           string  `json:"token"`
	PaidAt          string  `json:"paid_at"`
	ReceiveCurrency string  `json:"receive_currency"`
}

ResponseOrder 接口返回订单信息

type ResponseRefundOrder added in v0.0.7

type ResponseRefundOrder struct {
	OrderID         string  `json:"order_id"`          // muggalepay 订单ID
	UserID          int64   `json:"user_id"`           // muggalepay 付款用户ID
	MerchantOrderID string  `json:"merchant_order_id"` // 自己系统的订单ID
	Title           string  `json:"title"`
	Description     string  `json:"description"`
	CallbackURL     string  `json:"callback_url"`
	CancelURL       string  `json:"cancel_url"`
	SuccessURL      string  `json:"success_url"`
	PriceAmount     float64 `json:"price_amount"`   // muggalepay 实际交易金额
	PriceCurrency   string  `json:"price_currency"` // muggalepay 实际交易币种
	Status          string  `json:"status"`
	Notified        string  `json:"notified"`
	IsSelf          bool    `json:"is_self"`
	PaidAt          string  `json:"paid_at"`
	ReceiveCurrency string  `json:"receive_currency"`
	CreatedAt       string  `json:"created_at"`
	UpdatedAt       string  `json:"updated_at"`
}

ResponseRefundOrder 退款时接口返回的订单信息

type ServerOrder

type ServerOrder struct {
	Status     int           `json:"status"`
	Order      ResponseOrder `json:"order"`
	Merchant   Merchant      `json:"merchant"`
	PaymentURL string        `json:"payment_url"`
	Invoice    Invoice       `json:"invoice"`
	Permission string        `json:"permission"`

	// Failed:
	// MugglePay Server will always return status 400. If API failed, it will return error_code and error as its object.
	Error     string `json:"error"`
	ErrorCode string `json:"error_code"`
}

ServerOrder 接口返回数据

func (*ServerOrder) Parse added in v0.0.4

func (s *ServerOrder) Parse() *ServerOrder

Parse 解析响应订单数据

type ServerRefund added in v0.0.7

type ServerRefund struct {
	Status int                 `json:"status"`
	Order  ResponseRefundOrder `json:"order"`
	// Failed:
	// MugglePay Server will always return status 400. If API failed, it will return error_code and error as its object.
	Error     string `json:"error"`
	ErrorCode string `json:"error_code"`
}

ServerRefund 退款时返回信息

Jump to

Keyboard shortcuts

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