You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
116 lines
7.8 KiB
116 lines
7.8 KiB
package grepay |
|
|
|
const ( |
|
payURL = "https://api.metagopayments.com/cashier/pay.ac" |
|
withdrawURL = "https://paypout.metagopayments.com/cashier/TX0001.ac" |
|
oid = "8240601257" |
|
mid = "24061200002795" |
|
key = "1B5B3E0FE86054BD16F15C29CF4AC0B3" |
|
) |
|
|
|
type PayReq struct { |
|
Version string `json:"version"` // 版本号,固定值:2.1 |
|
OrgNo string `json:"orgNo"` // 机构号,平台下发的机构编号 |
|
CustId string `json:"custId"` // 商户编号,平台提供的商户编号 |
|
CustOrderNo string `json:"custOrderNo"` // 商户订单编号,客户方生成的订单编号,不能重复 |
|
TranType string `json:"tranType"` // 交易类型(传数字编码) 0512 |
|
ClearType string `json:"clearType"` // 清算方式,传数字编码,默认为01 |
|
PayAmt int `json:"payAmt"` // 支付金额, 单位是分(整数) |
|
BackUrl string `json:"backUrl"` // 后台回调地址,支付完成时回调客户方结果接收地址 |
|
FrontUrl string `json:"frontUrl"` // 前台回调地址,支付结果同步通知到前端 |
|
// BankCode string `json:"bankCode"` // 银行编码,可选字段 |
|
GoodsName string `json:"goodsName"` // 商品名称,不可使用中文 |
|
OrderDesc string `json:"orderDesc"` // 订单描述,不可使用中文 |
|
BuyIp string `json:"buyIp"` // 购买者IP,商户提交订单的IP |
|
UserName string `json:"userName"` // 付款人姓名,不可用中国的用户名 |
|
UserEmail string `json:"userEmail"` // 付款人邮箱,不可用中国的邮箱 |
|
UserPhone string `json:"userPhone"` // 付款人手机号,不可用中国的手机号 |
|
// UserCitizenId string `json:"userCitizenId,omitempty"` // 巴西唯一税号(CPF/CNPJ),特殊交易类型必填 |
|
// UserDeviceId string `json:"userDeviceId,omitempty"` // 用户设备ID,可选字段 |
|
CountryCode string `json:"countryCode"` // 国家编码,固定值: BR |
|
Currency string `json:"currency"` // 币种,固定值: BRL |
|
// City string `json:"city,omitempty"` // 商户用户的城市名称,可选字段 |
|
// Street string `json:"street,omitempty"` // 商户用户的街道名称,可选字段 |
|
// HouseNumber string `json:"houseNumber,omitempty"` // 商户用户的门牌号,可选字段 |
|
Sign string `json:"sign"` // 签名,根据规则加签后的结果 |
|
} |
|
|
|
type PayResp struct { |
|
OrgNo string `json:"orgNo"` // 机构编号,平台下发的机构编号 |
|
OrdStatus string `json:"ordStatus,omitempty"` // 订单状态,可选字段 |
|
Code string `json:"code"` // 请求接口状态返回码 |
|
Msg string `json:"msg"` // 返回描述 |
|
CustId string `json:"custId"` // 平台提供的商户编号 |
|
CustOrderNo string `json:"custOrderNo"` // 商户订单编号 |
|
PrdOrdNo string `json:"prdOrdNo,omitempty"` // 平台订单号,可作为查询依据的订单号,订单处理成功时返回 |
|
ContentType string `json:"contentType,omitempty"` // 业务内容类型,可选字段 |
|
BusContent string `json:"busContent,omitempty"` // 订单处理成功时返回的业务内容,如支付页面的URL链接 |
|
OrdDesc string `json:"ordDesc,omitempty"` // 状态描述,订单状态存在时,描述状态代表的含义 |
|
Sign string `json:"sign"` // 签名,根据规则加签后的结果 |
|
} |
|
|
|
type PayCallbackReq struct { |
|
Version string `json:"version"` // 版本号,返回和支付接口上送的一致 |
|
OrgNo string `json:"orgNo"` // 机构编号,平台下发的机构编号 |
|
CustId string `json:"custId"` // 平台提供的商户编号 |
|
CustOrderNo string `json:"custOrderNo"` // 商户订单编号,客户方生成的订单编号, 不能重复 |
|
PrdOrdNo string `json:"prdOrdNo"` // 平台订单号,可作为查询依据 |
|
OrdAmt string `json:"ordAmt"` // 订单金额,单位为分 |
|
OrdTime string `json:"ordTime"` // 订单时间,格式: yyyyMMddHHmmss |
|
PayAmt string `json:"payAmt"` // 支付金额,单位为分 |
|
OrdStatus string `json:"ordStatus"` // 订单状态 |
|
Sign string `json:"sign"` // 签名,根据规则加签以后的结果 |
|
} |
|
|
|
type WithdrawReq struct { |
|
Version string `json:"version"` // 版本号,固定值:2.1 |
|
OrgNo string `json:"orgNo"` // 机构编号,平台下发的机构编号 |
|
CustId string `json:"custId"` // 平台提供的商户编号 |
|
CustOrdNo string `json:"custOrdNo"` // 商户订单编号,客户方生成的订单编号,不能重复 |
|
CasType string `json:"casType"` // 清算类型,固定值00(T0结算) |
|
Country string `json:"country"` // 国家编码,固定值:BR |
|
Currency string `json:"currency"` // 币种编码,固定值:BRL |
|
CasAmt int64 `json:"casAmt"` // 代付金额,单位是分 |
|
DeductWay string `json:"deductWay"` // 手续费扣除方式,固定值02:账户余额中扣除 |
|
CallBackUrl string `json:"callBackUrl"` // 回调地址 |
|
Account string `json:"account"` // 代付子账户名称 |
|
PayoutType string `json:"payoutType"` // 代付类型,可选值:Card, PIX |
|
AccountName string `json:"accountName"` // 收款人姓名 |
|
// PayeeBankCode string `json:"payeeBankCode,omitempty"` // 银行编码,payoutType为Card时必填 |
|
CardType string `json:"cardType"` // 代付类型的收款方式 cpf |
|
// CnapsCode string `json:"cnapsCode,omitempty"` // 巴西通道分行代码 |
|
// CardNo string `json:"cardNo,omitempty"` // 银行卡号,payoutType为Card时必填 |
|
PanNum string `json:"panNum"` // PAN Card 编码,必须传CPF(个人) |
|
WalletId string `json:"walletId"` // 电子钱包收款账号,payoutType为PIX时必填 |
|
// UpiId string `json:"upiId,omitempty"` // UPI 的收款账号,对接巴西渠道时为空 |
|
AccountType string `json:"accountType"` // 账户类型,默认值1:对私 |
|
Phone string `json:"phone"` // 收款人手机号 |
|
Email string `json:"email"` // 收款人邮箱 |
|
CasDesc string `json:"casDesc"` // 代付备注(禁止使用中文) |
|
// AccountDigit string `json:"accountDigit,omitempty"` // 账户校验位,一般为银行卡最后一位校验位 |
|
Sign string `json:"sign"` // 签名,根据规则加签以后的结果 |
|
} |
|
|
|
type WithdrawResp struct { |
|
OrgNo string `json:"orgNo"` // 机构编号,平台下发的机构编号 |
|
OrdStatus string `json:"ordStatus,omitempty"` // 订单状态 |
|
Code string `json:"code"` // 请求接口返回码 |
|
Msg string `json:"msg"` // 返回描述 |
|
CustId string `json:"custId"` // 平台提供的商户编号 |
|
CustOrdNo string `json:"custOrdNo"` // 客户订单编号,原样返回 |
|
CasOrdNo string `json:"casOrdNo,omitempty"` // 平台订单号,可作为查询依据 |
|
CasAmt string `json:"casAmt"` // 代付金额,该字段值为100时则为1雷亚尔 |
|
CasTime string `json:"casTime"` // 代付时间,格式:yyyyMMddHHmmss |
|
Sign string `json:"sign"` // 签名,根据规则加签以后的结果 |
|
} |
|
|
|
type WithdrawCallbackReq struct { |
|
OrgNo string `json:"orgNo"` // 机构编号,平台下发的机构编号 |
|
CustId string `json:"custId"` // 平台提供的商户编号 |
|
CustOrderNo string `json:"custOrderNo"` // 商户订单编号,客户方生成的订单编号,不能重复 |
|
PrdOrdNo string `json:"prdOrdNo"` // 平台订单号,作为查询依据 |
|
PayAmt string `json:"payAmt"` // 代付订单金额,单位是分 |
|
OrdStatus string `json:"ordStatus"` // 代付订单状态 |
|
CasDesc string `json:"casDesc"` // 代付单描述 |
|
Sign string `json:"sign"` // 签名,根据规则加签以后的结果 |
|
}
|
|
|