77 lines
		
	
	
		
			5.0 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
		
		
			
		
	
	
			77 lines
		
	
	
		
			5.0 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| 
								 | 
							
								package coingatedto
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								import "github.com/shopspring/decimal"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								type OrderRequest struct {
							 | 
						||
| 
								 | 
							
									OrderID         string          `json:"order_id"`         // 订单ID
							 | 
						||
| 
								 | 
							
									PriceAmount     decimal.Decimal `json:"price_amount"`     // 价格金额
							 | 
						||
| 
								 | 
							
									PriceCurrency   string          `json:"price_currency"`   // 价格货币
							 | 
						||
| 
								 | 
							
									ReceiveCurrency string          `json:"receive_currency"` // 接收货币
							 | 
						||
| 
								 | 
							
									Title           string          `json:"title"`            // 标题
							 | 
						||
| 
								 | 
							
									Description     string          `json:"description"`      // 描述
							 | 
						||
| 
								 | 
							
									CallbackURL     string          `json:"callback_url"`     // 回调URL
							 | 
						||
| 
								 | 
							
									CancelUrl       string          `json:"cancel_url"`       //取消跳转url
							 | 
						||
| 
								 | 
							
									SuccessUrl      string          `json:"success_url"`      //成功跳转地址
							 | 
						||
| 
								 | 
							
									// OrderID:PriceAmount:PriceCurrency 然后在rsa加密
							 | 
						||
| 
								 | 
							
									Token          string `json:"token"`           //回调token
							 | 
						||
| 
								 | 
							
									PurchaserEmail string `json:"purchaser_email"` //付款方邮箱
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								type OrderResponse struct {
							 | 
						||
| 
								 | 
							
									ID                     int           `json:"id"`                      // 订单ID
							 | 
						||
| 
								 | 
							
									Status                 string        `json:"status"`                  // 订单状态
							 | 
						||
| 
								 | 
							
									Title                  string        `json:"title"`                   // 标题
							 | 
						||
| 
								 | 
							
									DoNotConvert           bool          `json:"do_not_convert"`          // 不转换
							 | 
						||
| 
								 | 
							
									OrderableType          string        `json:"orderable_type"`          // 可订购类型
							 | 
						||
| 
								 | 
							
									OrderableID            int           `json:"orderable_id"`            // 可订购ID
							 | 
						||
| 
								 | 
							
									UUID                   string        `json:"uuid"`                    // UUID
							 | 
						||
| 
								 | 
							
									PaymentGateway         *string       `json:"payment_gateway"`         // 支付网关 (可为 nil)
							 | 
						||
| 
								 | 
							
									PriceCurrency          string        `json:"price_currency"`          // 价格货币
							 | 
						||
| 
								 | 
							
									PriceAmount            string        `json:"price_amount"`            // 价格金额
							 | 
						||
| 
								 | 
							
									LightningNetwork       bool          `json:"lightning_network"`       // 闪电网络
							 | 
						||
| 
								 | 
							
									ReceiveCurrency        string        `json:"receive_currency"`        // 接收货币
							 | 
						||
| 
								 | 
							
									ReceiveAmount          string        `json:"receive_amount"`          // 接收金额
							 | 
						||
| 
								 | 
							
									CreatedAt              string        `json:"created_at"`              // 创建时间
							 | 
						||
| 
								 | 
							
									OrderID                string        `json:"order_id"`                // 订单ID
							 | 
						||
| 
								 | 
							
									PaymentURL             string        `json:"payment_url"`             // 支付URL
							 | 
						||
| 
								 | 
							
									UnderpaidAmount        string        `json:"underpaid_amount"`        // 欠款金额
							 | 
						||
| 
								 | 
							
									OverpaidAmount         string        `json:"overpaid_amount"`         // 超额支付金额
							 | 
						||
| 
								 | 
							
									IsRefundable           bool          `json:"is_refundable"`           // 是否可退款
							 | 
						||
| 
								 | 
							
									PaymentRequestURI      *string       `json:"payment_request_uri"`     // 支付请求URI (可为 nil)
							 | 
						||
| 
								 | 
							
									Refunds                []interface{} `json:"refunds"`                 // 退款信息
							 | 
						||
| 
								 | 
							
									Voids                  []interface{} `json:"voids"`                   // 作废信息
							 | 
						||
| 
								 | 
							
									Fees                   []interface{} `json:"fees"`                    // 费用信息
							 | 
						||
| 
								 | 
							
									BlockchainTransactions []interface{} `json:"blockchain_transactions"` // 区块链交易信息
							 | 
						||
| 
								 | 
							
									Token                  string        `json:"token"`                   // 令牌
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								type OrderCallBackResponse struct {
							 | 
						||
| 
								 | 
							
									ID              int                `json:"id" form:"id"`                             // 订单ID
							 | 
						||
| 
								 | 
							
									OrderID         string             `json:"order_id" form:"order_id"`                 // 订单号
							 | 
						||
| 
								 | 
							
									Status          string             `json:"status" form:"status"`                     // 订单状态
							 | 
						||
| 
								 | 
							
									PayAmount       string             `json:"pay_amount" form:"pay_amount"`             // 支付金额
							 | 
						||
| 
								 | 
							
									PayCurrency     string             `json:"pay_currency" form:"pay_currency"`         // 支付货币
							 | 
						||
| 
								 | 
							
									PriceAmount     string             `json:"price_amount" form:"price_amount"`         // 价格金额
							 | 
						||
| 
								 | 
							
									PriceCurrency   string             `json:"price_currency" form:"price_currency"`     // 价格货币
							 | 
						||
| 
								 | 
							
									ReceiveCurrency string             `json:"receive_currency" form:"receive_currency"` // 接收货币
							 | 
						||
| 
								 | 
							
									ReceiveAmount   string             `json:"receive_amount" form:"receive_amount"`     // 接收金额
							 | 
						||
| 
								 | 
							
									CreatedAt       string             `json:"created_at" form:"create_at"`              // 创建时间
							 | 
						||
| 
								 | 
							
									Token           string             `json:"token" form:"token"`                       // 令牌
							 | 
						||
| 
								 | 
							
									UnderpaidAmount string             `json:"underpaid_amount" form:"underpaid_amount"` // 欠款金额
							 | 
						||
| 
								 | 
							
									OverpaidAmount  string             `json:"overpaid_amount" form:"overpaid_amount"`   // 超额支付金额
							 | 
						||
| 
								 | 
							
									IsRefundable    bool               `json:"is_refundable" form:"is_refundable"`       // 是否可退款
							 | 
						||
| 
								 | 
							
									Fees            []OrderCallBackFee `json:"fees" form:"fees"`                         // 费用信息
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								type OrderCallBackFee struct {
							 | 
						||
| 
								 | 
							
									Type     string            `json:"type"`     // 费用类型
							 | 
						||
| 
								 | 
							
									Amount   string            `json:"amount"`   // 费用金额
							 | 
						||
| 
								 | 
							
									Currency OrderCallCurrency `json:"currency"` // 货币信息 {"id":1,"symbol":"BTC"}
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								type OrderCallCurrency struct {
							 | 
						||
| 
								 | 
							
									ID     int    `json:"id"`     // 货币ID
							 | 
						||
| 
								 | 
							
									Symbol string `json:"symbol"` // 货币符号
							 | 
						||
| 
								 | 
							
								}
							 |