Skip to content

Commit

Permalink
v1.5.68 (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
iGoogle-ink authored Dec 27, 2021
1 parent 770bafb commit 25cfb58
Show file tree
Hide file tree
Showing 9 changed files with 852 additions and 119 deletions.
2 changes: 1 addition & 1 deletion constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const (
OK = "OK"
DebugOff = 0
DebugOn = 1
Version = "1.5.67"
Version = "1.5.68"
)

type DebugSwitch int8
19 changes: 19 additions & 0 deletions doc/wechat_v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,25 @@ wechat.V3DecryptScoreNotifyCipherText()
* <font color='#07C160' size='4'>电商收付通(商户进件)</font>
* 二级商户进件:`client.V3EcommerceApply()`
* 查询申请状态:`client.V3EcommerceApplyStatus()`
* <font color='#07C160' size='4'>电商收付通(分账)</font>
* 请求分账:`client.V3EcommerceProfitShare()`
* 查询分账结果:`client.V3EcommerceProfitShareResult()`
* 请求分账回退:`client.V3EcommerceProfitShareReturn()`
* 查询分账回退结果:`client.V3EcommerceProfitShareReturnResult()`
* 完结分账:`client.V3EcommerceProfitShareFinish()`
* 查询订单剩余待分金额:`client.V3EcommerceProfitShareUnsplitAmount()`
* 添加分账接收方:`client.V3EcommerceProfitShareAddReceiver()`
* 删除分账接收方:`client.V3EcommerceProfitShareDeleteReceiver()`
* <font color='#07C160' size='4'>电商收付通(补差)</font>
* 请求补差:`client.V3EcommerceProfitShare()`
* 请求补差回退:`client.V3EcommerceSubsidiesReturn()`
* 取消补差:`client.V3EcommerceSubsidiesCancel()`
* <font color='#07C160' size='4'>电商收付通(退款)</font>
* 申请退款:`client.V3EcommerceRefund()`
* 查询退款ById:`client.V3EcommerceRefundQueryById()`
* 查询退款ByNo:`client.V3EcommerceRefundQueryByNo()`
* 垫付退款回补:`client.V3EcommerceRefundAdvance()`
* 查询垫付回补结果:`client.V3EcommerceRefundAdvanceResult()`


### 微信v3公共 API
Expand Down
8 changes: 8 additions & 0 deletions release_note.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
版本号:Release 1.5.68
修改记录:
(1) 微信V3:修复 client.V3ComplaintResponse()、client.V3ComplaintComplete(), complaintId 参数类型错误问题
(2) 微信V3:新增 电商收付通(分账)相关接口,详情查看v3文档最下方的接口列表
(3) 微信V3:新增 电商收付通(补差)相关接口,详情查看v3文档最下方的接口列表
(4) 微信V3:新增 电商收付通(退款)相关接口,详情查看v3文档最下方的接口列表
(5) 微信V3:返回参数中字段,ID写法全部改写为Id写法

版本号:Release 1.5.67
修改记录:
(1) 微信V3:配合微信文档修改,拆分服务商 批量转账 相关接口,接口如下:
Expand Down
61 changes: 0 additions & 61 deletions wechat/v3/applyment_for_sub.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,64 +152,3 @@ func (c *ClientV3) V3Apply4SubQuerySettlement(ctx context.Context, subMchId stri
}
return wxRsp, c.verifySyncSign(si)
}

// 二级商户进件API
// 注意:本接口会提交一些敏感信息,需调用 client.V3EncryptText() 进行加密。部分图片参数,请先调用 client.V3MediaUploadImage() 上传,获取MediaId
// Code = 0 is success
// 电商文档:https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter7_1_1.shtml
func (c *ClientV3) V3EcommerceApply(ctx context.Context, bm gopay.BodyMap) (*EcommerceApplyRsp, error) {
authorization, err := c.authorization(MethodPost, v3EcommerceApply, bm)
if err != nil {
return nil, err
}
res, si, bs, err := c.doProdPost(ctx, bm, v3EcommerceApply, authorization)
if err != nil {
return nil, err
}
wxResp := &EcommerceApplyRsp{Code: Success, SignInfo: si}
wxResp.Response = new(EcommerceApply)
if err = json.Unmarshal(bs, wxResp.Response); err != nil {
return nil, fmt.Errorf("json.Unmarshal(%s):%w", string(bs), err)
}
if res.StatusCode != http.StatusOK {
wxResp.Code = res.StatusCode
wxResp.Error = string(bs)
return wxResp, nil
}
return wxResp, c.verifySyncSign(si)
}

// 查询申请状态API
// 注意:applyId 和 outRequestNo 二选一
// Code = 0 is success
// 电商文档:https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter7_1_2.shtml
func (c *ClientV3) V3EcommerceApplyStatus(ctx context.Context, applyId int64, outRequestNo string) (*EcommerceApplyStatusRsp, error) {
if applyId == 0 && outRequestNo == gopay.NULL {
return nil, fmt.Errorf("applyId[%d] and outRequestNo[%s] empty at the same time", applyId, outRequestNo)
}
var url string
if applyId != 0 {
url = fmt.Sprintf(v3EcommerceApplyQueryById, applyId)
} else {
url = fmt.Sprintf(v3EcommerceApplyQueryByNo, outRequestNo)
}
authorization, err := c.authorization(MethodGet, url, nil)
if err != nil {
return nil, err
}
res, si, bs, err := c.doProdGet(ctx, url, authorization)
if err != nil {
return nil, err
}
wxRsp := &EcommerceApplyStatusRsp{Code: Success, SignInfo: si}
wxRsp.Response = new(EcommerceApplyStatus)
if err = json.Unmarshal(bs, wxRsp.Response); err != nil {
return nil, fmt.Errorf("json.Unmarshal(%s):%w", string(bs), err)
}
if res.StatusCode != http.StatusOK {
wxRsp.Code = res.StatusCode
wxRsp.Error = string(bs)
return wxRsp, nil
}
return wxRsp, c.verifySyncSign(si)
}
4 changes: 2 additions & 2 deletions wechat/v3/complaint.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func (c *ClientV3) V3ComplaintDetail(ctx context.Context, complaintId string) (w
// Code = 0 is success
// 商户文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter10_2_14.shtml
// 服务商文档:https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter10_2_14.shtml
func (c *ClientV3) V3ComplaintResponse(ctx context.Context, complaintId, bm gopay.BodyMap) (wxRsp *EmptyRsp, err error) {
func (c *ClientV3) V3ComplaintResponse(ctx context.Context, complaintId string, bm gopay.BodyMap) (wxRsp *EmptyRsp, err error) {
url := fmt.Sprintf(v3ComplaintResponse, complaintId)
authorization, err := c.authorization(MethodPost, url, bm)
if err != nil {
Expand All @@ -256,7 +256,7 @@ func (c *ClientV3) V3ComplaintResponse(ctx context.Context, complaintId, bm gopa
// Code = 0 is success
// 商户文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter10_2_15.shtml
// 服务商文档:https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter10_2_15.shtml
func (c *ClientV3) V3ComplaintComplete(ctx context.Context, complaintId, bm gopay.BodyMap) (wxRsp *EmptyRsp, err error) {
func (c *ClientV3) V3ComplaintComplete(ctx context.Context, complaintId string, bm gopay.BodyMap) (wxRsp *EmptyRsp, err error) {
url := fmt.Sprintf(v3ComplaintComplete, complaintId)
authorization, err := c.authorization(MethodPost, url, bm)
if err != nil {
Expand Down
28 changes: 23 additions & 5 deletions wechat/v3/constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ const (
v3DomesticRefund = "/v3/refund/domestic/refunds" // 申请退款
v3DomesticRefundQuery = "/v3/refund/domestic/refunds/%s" // 查询单笔退款

// 退款(电商收付通)
v3CommerceRefund = "/v3/ecommerce/refunds/apply"
v3CommerceRefundQuery = "/v3/ecommerce/refunds/id/%s"

// 账单
v3TradeBill = "/v3/bill/tradebill" // 申请交易账单 GET
v3FundFlowBill = "/v3/bill/fundflowbill" // 申请资金账单 GET
Expand Down Expand Up @@ -162,7 +158,7 @@ const (
v3ComplaintComplete = "/v3/merchant-service/complaints-v2/%s/complete" // 反馈处理完成 POST
v3ComplaintUploadImage = "/v3/merchant-service/images/upload" // 商户上传反馈图片 POST

// 分账
// 分账(服务商)
v3ProfitShareOrder = "/v3/profitsharing/orders" // 请求分账 POST
v3ProfitShareQuery = "/v3/profitsharing/orders/%s" // 查询分账结果 GET
v3ProfitShareReturn = "/v3/profitsharing/return-orders" // 请求分账回退 POST
Expand Down Expand Up @@ -217,6 +213,28 @@ const (
v3EcommerceApplyQueryById = "/v3/ecommerce/applyments/%d" // applyment_id 通过申请单ID查询申请状态 GET
v3EcommerceApplyQueryByNo = "/v3/ecommerce/applyments/out-request-no/%s" // out_request_no 通过业务申请编号查询申请状态 GET

// 电商收付通(分账)
v3EcommerceProfitShare = "/v3/ecommerce/profitsharing/orders" // 请求分账 POST
v3EcommerceProfitShareQuery = "/v3/ecommerce/profitsharing/orders" // 查询分账结果 GET
v3EcommerceProfitShareReturn = "/v3/ecommerce/profitsharing/returnorders" // 请求分账回退 POST
v3EcommerceProfitShareReturnResult = "/v3/ecommerce/profitsharing/returnorders" // 查询分账回退结果 GET
v3EcommerceProfitShareFinish = "/v3/ecommerce/profitsharing/finish-order" // 完结分账 POST
v3EcommerceProfitShareUnsplitAmount = "/v3/ecommerce/profitsharing/orders/%s/amounts" // transaction_id 查询订单剩余待分金额 GET
v3EcommerceProfitShareAddReceiver = "/v3/ecommerce/profitsharing/receivers/add" // 添加分账接收方 POST
v3EcommerceProfitShareDeleteReceiver = "/v3/ecommerce/profitsharing/receivers/delete" // 删除分账接收方 POST

// 电商收付通(补差)
v3EcommerceSubsidies = "/v3/ecommerce/subsidies/create" // 请求补差 POST
v3EcommerceSubsidiesReturn = "/v3/ecommerce/subsidies/return" // 请求补差回退 POST
v3EcommerceSubsidiesCancel = "/v3/ecommerce/subsidies/cancel" // 取消补差 POST

// 电商收付通(退款)
v3CommerceRefund = "/v3/ecommerce/refunds/apply" // 申请退款 POST
v3CommerceRefundQueryById = "/v3/ecommerce/refunds/id/%s" // refund_id 通过微信支付退款单号查询退款 GET
v3CommerceRefundQueryByNo = "/v3/ecommerce/refunds/out-refund-no/%s" // out_refund_no 通过商户退款单号查询退款 GET
v3CommerceRefundAdvance = "/v3/ecommerce/refunds/%s/return-advance" // refund_id 垫付退款回补 POST
v3CommerceRefundAdvanceResult = "/v3/ecommerce/refunds/%s/return-advance" // refund_id 查询垫付回补结果 GET

// 特约商户进件申请单状态
ApplyStateEditing = "APPLYMENT_STATE_EDITTING" // 编辑中
ApplyStateAuditing = "APPLYMENT_STATE_AUDITING" // 审核中
Expand Down
Loading

0 comments on commit 25cfb58

Please sign in to comment.