YouChuKoffee/app/http/entities/front/Youchu.go

149 lines
4.8 KiB
Go

package front
import "encoding/json"
type YouChuRequest struct {
Request string `json:"request"`
Signature string `json:"signature"`
AccessToken string `json:"accessToken"`
EncryptKey string `json:"encryptKey"`
}
type YouChuLoginRequest struct {
Body YouChuLoginBody `json:"body"`
Head YouChuRequestHeader `json:"head"`
}
type YouChuLoginResponse struct {
RespCode string `json:"respCode"` //000000-成功 069801-系统繁忙,请稍后重试 820007-未查询到客户号
RespMsg string `json:"respMsg"` //描 述 (失败时必填)
Phone string `json:"phone"`
CustNo string `json:"custNo"` //客户编号
IdtLastFour string `json:"idtLastFour"`
CustName string `json:"custName"`
CustFlag string `json:"custFlag"`
}
type YouChuLoginBody struct {
CustNo string `json:"custNo"`
ReqTransTime string `json:"reqTransTime"`
Code string `json:"code"`
}
type YouChuRequestBody struct {
Body YouChuOrderRequest `json:"body"`
Head YouChuRequestHeader `json:"head"`
}
type YouChuRequestHeader struct {
PartnerTxSriNo string `json:"partnerTxSriNo"`
ReqTime string `json:"reqTime"`
Method string `json:"method"`
Version string `json:"version"`
MerchantId string `json:"merchantId"`
AppID string `json:"appID"`
AccessType string `json:"accessType"`
Reserve string `json:"reserve"`
}
type YouChuOrderRequest struct {
BusiMainId string `json:"busiMainId"`
ReqTransTime string `json:"reqTransTime"`
Data OrderQuery `json:"data"`
}
type OrderQuery struct {
TxnCode string `json:"txnCode"` //固定值 1004
SourceId string `json:"sourceId"` //固定值 16
ReqDate string `json:"reqDate"` //YYYYMMDDHHmmss
ReqTraceId string `json:"reqTraceId"` //订单号
MchtNo string `json:"mchtNo"` //收单商户号
OldSeqNo string `json:"oldSeqNo"` //收单商户号
TxnDt string `json:"txnDt"` //YYYYMMDD
}
type InsertOrderResponse struct {
OrderNo string `json:"order_no"`
NotifyUrl string `json:"notify_url"`
}
type YouChuOrderQueryResponse struct {
RespCode string `json:"code"`
RespMsg string `json:"respMsg"`
RespCd string `json:"respCd"`
ReqTraceId string `json:"reqTraceId"` //请求方流水号或者订单号,
OrderNo string `json:"orderNo"` //统一收单订单号
OrderSta string `json:"orderSta"` //03-支付成功 04-支付失败 05-检查失败
TxnFg string `json:"txnFg"` //0-正常 2-已部分退货 3- 已全部退货
}
type YouChuOrderRefundResponse struct {
RespCode string `json:"code"`
RespMsg string `json:"respMsg"`
RespCd string `json:"respCd"`
TxnCode string `json:"txnCode"`
SourceId string `json:"sourceId"`
ReqTraceId string `json:"ReqTraceId"`
RefundOrderNo string `json:"refundOrderNo"`
RefundOrderSta string `json:"refundOrderSta"`
MchtNo string `json:"mchtNo"`
TxnAmt string `json:"txnAmt"`
}
type YouChuOrderRefundRequest struct {
Body RefundRequestBody `json:"body"`
Head YouChuRequestHeader `json:"head"`
}
type RefundRequestBody struct {
BusiMainId string `json:"busiMainId"`
ReqTransTime string `json:"reqTransTime"`
Data RefundRequestData `json:"data"`
}
type RefundRequestData struct {
TxnCode string `json:"txnCode"` //固定值 1004
SourceId string `json:"sourceId"` //固定值 16
ReqDate string `json:"reqDate"` //YYYYMMDDHHmmss
ReqTraceId string `json:"reqTraceId"` //订单号
MchtNo string `json:"mchtNo"` //收单商户号
OrgTxnSeq string `json:"orgTxnSeq"` //收单系统订单号
OrgTxnAmt string `json:"orgTxnAmt"` //原交易金额
TxnAmt string `json:"txnAmt"` //退货金额
RefundDesc string `json:"refundDesc"` //退货原因
}
type YouChuOrderNotifyRequest struct {
TxnCode string `json:"txnCode"`
SourceId string `json:"sourceId"`
ReqDate string `json:"reqDate"`
ReqTraceId string `json:"reqTraceId"`
OrderNo string `json:"orderNo"`
TxnAmt string `json:"txnAmt"`
OrderSta string `json:"orderSta"` //03-支付成功 04-支付失败05-检查失败
MchtNo string `json:"mchtNo"`
TermId string `json:"termId"`
TxnFlag string `json:"txnFlag"` //01-消费 03-退货
TxnKind string `json:"txnKind"` //01-银行卡 02-微信 03-支付宝
}
type YouChuOrderNotifyResponse struct {
RespCode string `json:"respCode"` //000000 表示通知成功
RespMsg string `json:"respMsg"`
}
func (this *YouChuOrderRequest) ToMap() (resultMap map[string]interface{}) {
// Marshal the struct to JSON, ignoring omitempty fields.
jsonBytes, err := json.Marshal(this)
if err != nil {
return
}
// Unmarshal the JSON into a map to get the final result.
err = json.Unmarshal(jsonBytes, &resultMap)
if err != nil {
return
}
return resultMap
}