饿先达扒网页接口,微信支付新增接口
This commit is contained in:
@@ -52,6 +52,7 @@ const (
|
||||
Relation = "PARTNER"
|
||||
AccountTypeWx = "PERSONAL_WECHATID"
|
||||
AccountTypeOpen = "PERSONAL_OPENID"
|
||||
CheckName = "NO_CHECK"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -59,6 +60,8 @@ var (
|
||||
"secapi/pay/multiprofitsharing": "secapi/pay/multiprofitsharing",
|
||||
"pay/profitsharingaddreceiver": "pay/profitsharingaddreceiver",
|
||||
"pay/profitsharingremovereceiver": "pay/profitsharingremovereceiver",
|
||||
"secapi/pay/profitsharingreturn": "secapi/pay/profitsharingreturn",
|
||||
"secapi/pay/profitsharingfinish": "secapi/pay/profitsharingfinish",
|
||||
}
|
||||
)
|
||||
|
||||
@@ -324,7 +327,7 @@ type ProfitSharingReceiverResult struct {
|
||||
|
||||
type ReturnProfitSharingParam struct {
|
||||
RequestBase
|
||||
OrderID string `json:"order_id" xml:"order_id"`
|
||||
// OrderID string `json:"order_id" xml:"order_id"`
|
||||
OutOrderNo string `json:"out_order_no" xml:"out_order_no"`
|
||||
OutReturnNo string `json:"out_return_no" xml:"out_return_no"`
|
||||
ReturnAccountType string `json:"return_account_type" xml:"return_account_type"`
|
||||
@@ -355,6 +358,30 @@ type ReturnProfitSharingResult struct {
|
||||
FinishTime string `json:"finish_time" xml:"finish_time"`
|
||||
}
|
||||
|
||||
type FinishProfitSharingParam struct {
|
||||
RequestBase
|
||||
TransactionID string `json:"transaction_id" xml:"transaction_id"`
|
||||
OutOrderNo string `json:"out_order_no" xml:"out_order_no"`
|
||||
Description string `json:"description" xml:"description"`
|
||||
}
|
||||
|
||||
type FinishProfitSharingResult struct {
|
||||
ReturnCode string `json:"return_code" xml:"return_code"`
|
||||
ReturnMsg string `json:"return_msg" xml:"return_msg"`
|
||||
|
||||
ResultCode string `json:"result_code" xml:"result_code"`
|
||||
ErrCode string `json:"err_code,omitempty" xml:"err_code,omitempty"`
|
||||
ErrCodeDes string `json:"err_code_des,omitempty" xml:"err_code_des,omitempty"`
|
||||
AppID string `json:"appid" xml:"appid"`
|
||||
MchID string `json:"mch_id" xml:"mch_id"`
|
||||
NonceStr string `json:"nonce_str" xml:"nonce_str"`
|
||||
Sign string `json:"sign" xml:"sign"`
|
||||
|
||||
TransactionID string `json:"transaction_id" xml:"transaction_id"`
|
||||
OutOrderNo string `json:"out_order_no" xml:"out_order_no"`
|
||||
OrderID string `json:"order_id" xml:"order_id"`
|
||||
}
|
||||
|
||||
func New(appID, appKey, mchID string, config ...*platformapi.APIConfig) *API {
|
||||
curConfig := platformapi.DefAPIConfig
|
||||
if len(config) > 0 {
|
||||
@@ -616,7 +643,17 @@ func (a *API) DeleteProfitSharingReceiver(param *ProfitSharingReceiverParam) (re
|
||||
//分账回退
|
||||
//https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_7&index=7
|
||||
func (a *API) ReturnProfitSharing(param *ReturnProfitSharingParam) (result *ReturnProfitSharingResult, err error) {
|
||||
retVal, err := a.AccessAPI("pay/profitsharingreturn", param)
|
||||
retVal, err := a.AccessAPI("secapi/pay/profitsharingreturn", param)
|
||||
if err == nil {
|
||||
err = a.translateResult(retVal, &result)
|
||||
}
|
||||
return result, err
|
||||
}
|
||||
|
||||
//完结分账
|
||||
//https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_5&index=6
|
||||
func (a *API) FinishProfitSharing(param *FinishProfitSharingParam) (result *FinishProfitSharingResult, err error) {
|
||||
retVal, err := a.AccessAPI("secapi/pay/profitsharingfinish", param)
|
||||
if err == nil {
|
||||
err = a.translateResult(retVal, &result)
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ func TestCreateUnifiedOrder(t *testing.T) {
|
||||
OutTradeNo: orderNo,
|
||||
SpbillCreateIP: "114.114.114.114",
|
||||
TradeType: TradeTypeNative,
|
||||
TotalFee: 10,
|
||||
TotalFee: 20,
|
||||
ProfitSharing: OptYes,
|
||||
})
|
||||
if err != nil {
|
||||
@@ -105,8 +105,8 @@ func TestXml2Json(t *testing.T) {
|
||||
|
||||
func TestMultiProfitSharing(t *testing.T) {
|
||||
result, err := api.MultiProfitSharing(&MultiProfitSharingParam{
|
||||
TransactionID: "4200000519202002065628033681",
|
||||
OutOrderNo: "1895BA2948A411EA88B97824AF852DFE",
|
||||
TransactionID: "4200000506202002122465150534",
|
||||
OutOrderNo: "A18546A84D6111EA8D8A7824AF852DFE",
|
||||
Receivers: `[{"type":"PERSONAL_OPENID","account":"ojWb10ND2JBY_hOic5phWQNChWC0","amount":1,"description":"分到个人"}]`,
|
||||
})
|
||||
if err != nil {
|
||||
@@ -115,14 +115,25 @@ func TestMultiProfitSharing(t *testing.T) {
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestFinishProfitSharing(t *testing.T) {
|
||||
result, err := api.FinishProfitSharing(&FinishProfitSharingParam{
|
||||
TransactionID: "4200000506202002122465150534",
|
||||
OutOrderNo: "A18546A84D6111EA8D8A7824AF852DFE",
|
||||
Description: "测试",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestTransfers(t *testing.T) {
|
||||
orderNo := utils.GetUUID()
|
||||
result, err := api.Transfers(&TransfersParam{
|
||||
PartnerTradeNo: orderNo,
|
||||
OpenID: "ojWb10ND2JBY_hOic5phWQNChWC0",
|
||||
CheckName: "FORCE_CHECK",
|
||||
ReUserName: "苏尹岚",
|
||||
Amount: 10,
|
||||
OpenID: "ojWb10M_8kV8NT0aZJa6A5umG1c8",
|
||||
CheckName: "NO_CHECK",
|
||||
Amount: 100,
|
||||
Desc: "测试",
|
||||
SpbillCreateIP: "114.114.114.114",
|
||||
})
|
||||
@@ -158,3 +169,19 @@ func TestDeleteProfitSharingReceiver(t *testing.T) {
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestReturnProfitSharing(t *testing.T) {
|
||||
orderNo := utils.GetUUID()
|
||||
result, err := api.ReturnProfitSharing(&ReturnProfitSharingParam{
|
||||
OutOrderNo: "A18546A84D6111EA8D8A7824AF852DFE",
|
||||
OutReturnNo: orderNo,
|
||||
ReturnAccountType: "MERCHANT_ID",
|
||||
ReturnAccount: "1390686702",
|
||||
ReturnAmount: 1000,
|
||||
Description: "测试",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user