微信
This commit is contained in:
@@ -48,6 +48,10 @@ const (
|
||||
|
||||
OptYes = "Y"
|
||||
OptNo = "N"
|
||||
|
||||
Relation = "PARTNER"
|
||||
AccountTypeWx = "PERSONAL_WECHATID"
|
||||
AccountTypeOpen = "PERSONAL_OPENID"
|
||||
)
|
||||
|
||||
type API struct {
|
||||
@@ -239,7 +243,7 @@ type PayRefundResult struct {
|
||||
TransactionID string `json:"transaction_id"`
|
||||
}
|
||||
|
||||
type MultiProfitSharing struct {
|
||||
type MultiProfitSharingParam struct {
|
||||
RequestBase
|
||||
TransactionID string `json:"transaction_id" xml:"transaction_id"`
|
||||
OutOrderNo string `json:"out_order_no" xml:"out_order_no"`
|
||||
@@ -263,7 +267,7 @@ type MultiProfitSharingResult struct {
|
||||
OrderID string `json:"order_id" xml:"order_id"`
|
||||
}
|
||||
|
||||
type Transfers struct {
|
||||
type TransfersParam struct {
|
||||
RequestBase
|
||||
PartnerTradeNo string `json:"partner_trade_no" xml:"partner_trade_no"`
|
||||
OpenID string `json:"openid" xml:"openid"`
|
||||
@@ -291,7 +295,7 @@ type TransfersResult struct {
|
||||
PaymentTime string `json:"payment_time" xml:"payment_time"`
|
||||
}
|
||||
|
||||
type ProfitSharingReceiver struct {
|
||||
type ProfitSharingReceiverParam struct {
|
||||
RequestBase
|
||||
Receiver CData `json:"receiver" xml:"receiver"`
|
||||
}
|
||||
@@ -310,7 +314,7 @@ type ProfitSharingReceiverResult struct {
|
||||
Receiver string `json:"receiver" xml:"receiver"`
|
||||
}
|
||||
|
||||
type ReturnProfitSharing struct {
|
||||
type ReturnProfitSharingParam struct {
|
||||
RequestBase
|
||||
OrderID string `json:"order_id" xml:"order_id"`
|
||||
OutOrderNo string `json:"out_order_no" xml:"out_order_no"`
|
||||
@@ -425,7 +429,7 @@ func (a *API) AccessAPI(action string, requestParam IRequestBase) (retVal map[st
|
||||
requestParam.SetMchID(action, a.mchID)
|
||||
requestParam.SetNonceStr(utils.GetUUID())
|
||||
var sigType string
|
||||
if action != specialAction {
|
||||
if action == specialAction {
|
||||
sigType = sigTypeSha256
|
||||
requestParam.SetSignType(sigType)
|
||||
} else {
|
||||
@@ -560,7 +564,7 @@ func (a *API) PayRefund(param *PayRefundParam) (refundResult *PayRefundResult, e
|
||||
|
||||
//请求多次分账
|
||||
//https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_6&index=2
|
||||
func (a *API) MultiProfitSharing(param *MultiProfitSharing) (result *MultiProfitSharingResult, err error) {
|
||||
func (a *API) MultiProfitSharing(param *MultiProfitSharingParam) (result *MultiProfitSharingResult, err error) {
|
||||
retVal, err := a.AccessAPI("secapi/pay/multiprofitsharing", param)
|
||||
if err == nil {
|
||||
err = a.translateResult(retVal, &result)
|
||||
@@ -570,7 +574,7 @@ func (a *API) MultiProfitSharing(param *MultiProfitSharing) (result *MultiProfit
|
||||
|
||||
//企业付款
|
||||
//https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=14_2
|
||||
func (a *API) Transfers(param *Transfers) (result *TransfersResult, err error) {
|
||||
func (a *API) Transfers(param *TransfersParam) (result *TransfersResult, err error) {
|
||||
retVal, err := a.AccessAPI(specialAction, param)
|
||||
if err == nil {
|
||||
err = a.translateResult(retVal, &result)
|
||||
@@ -580,7 +584,7 @@ func (a *API) Transfers(param *Transfers) (result *TransfersResult, err error) {
|
||||
|
||||
//添加分账接收方
|
||||
//https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_3&index=4
|
||||
func (a *API) AddProfitSharingReceiver(param *ProfitSharingReceiver) (result *ProfitSharingReceiverResult, err error) {
|
||||
func (a *API) AddProfitSharingReceiver(param *ProfitSharingReceiverParam) (result *ProfitSharingReceiverResult, err error) {
|
||||
retVal, err := a.AccessAPI("pay/profitsharingaddreceiver", param)
|
||||
if err == nil {
|
||||
err = a.translateResult(retVal, &result)
|
||||
@@ -590,7 +594,7 @@ func (a *API) AddProfitSharingReceiver(param *ProfitSharingReceiver) (result *Pr
|
||||
|
||||
//删除分账接收方
|
||||
//https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_4&index=5
|
||||
func (a *API) DeleteProfitSharingReceiver(param *ProfitSharingReceiver) (result *ProfitSharingReceiverResult, err error) {
|
||||
func (a *API) DeleteProfitSharingReceiver(param *ProfitSharingReceiverParam) (result *ProfitSharingReceiverResult, err error) {
|
||||
retVal, err := a.AccessAPI("pay/profitsharingremovereceiver", param)
|
||||
if err == nil {
|
||||
err = a.translateResult(retVal, &result)
|
||||
@@ -600,7 +604,7 @@ func (a *API) DeleteProfitSharingReceiver(param *ProfitSharingReceiver) (result
|
||||
|
||||
//分账回退
|
||||
//https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_7&index=7
|
||||
func (a *API) ReturnProfitSharing(param *ReturnProfitSharing) (result *ReturnProfitSharingResult, err error) {
|
||||
func (a *API) ReturnProfitSharing(param *ReturnProfitSharingParam) (result *ReturnProfitSharingResult, err error) {
|
||||
retVal, err := a.AccessAPI("pay/profitsharingreturn", param)
|
||||
if err == nil {
|
||||
err = a.translateResult(retVal, &result)
|
||||
|
||||
Reference in New Issue
Block a user