Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

微信有分账功能,是否可加入开发计划 #186

Closed
CodinngLee opened this issue Nov 14, 2018 · 3 comments
Closed

微信有分账功能,是否可加入开发计划 #186

CodinngLee opened this issue Nov 14, 2018 · 3 comments

Comments

@CodinngLee
Copy link

CodinngLee commented Nov 14, 2018

https://pay.weixin.qq.com/wiki/doc/api/allocation_sl.php?chapter=25_1

@liyiorg
Copy link
Owner

liyiorg commented Nov 15, 2018

@CodinngLee
dev 分支已开发相关接口, 由于手上没有相关接口的调用权限,请反馈接口调用情况,是否存在问题。

PayMchAPI.secapiPayProfitsharing
PayMchAPI.payProfitsharingquery
PayMchAPI.payProfitsharingaddreceiver
PayMchAPI.payProfitsharingremovereceiver

@CodinngLee
Copy link
Author

@CodinngLee
dev 分支已开发相关接口, 由于手上没有相关接口的调用权限,请反馈接口调用情况,是否存在问题。

PayMchAPI.secapiPayProfitsharing
PayMchAPI.payProfitsharingquery
PayMchAPI.payProfitsharingaddreceiver
PayMchAPI.payProfitsharingremovereceiver

ok,我司已成功申请接口,近期开发。

@CodinngLee
Copy link
Author

目前2.8.25版分账模块有几处问题
1、缺少请求多次分账接口,且是双向认证,需要用LocalHttpClient.keyStoreExecuteXmlResult https://pay.weixin.qq.com/wiki/doc/api/allocation_sl.php?chapter=25_6&index=2
以下代码补充可实现
public static SecapiPayProfitsharingResult secapiPayMultiprofitsharing(SecapiPayProfitsharing secapiPayProfitsharing,String key){
Map<String,String> map = MapUtil.objectToMap(secapiPayProfitsharing, "receivers");
if(secapiPayProfitsharing.getReceivers() != null){
map.put("receivers", JsonUtil.toJSONString(secapiPayProfitsharing.getReceivers()));
}
String sign = SignatureUtil.generateSign(map,secapiPayProfitsharing.getSign_type() == null? "HMAC-SHA256": secapiPayProfitsharing.getSign_type(),key);
secapiPayProfitsharing.setSign(sign);
String xml = XMLConverUtil.convertToXML(secapiPayProfitsharing);
HttpUriRequest httpUriRequest = RequestBuilder.post()
.setHeader(xmlHeader)
.setUri(baseURI()+ "/secapi/pay/multiprofitsharing")
.setEntity(new StringEntity(xml,Charset.forName("utf-8")))
.build();
return LocalHttpClient.keyStoreExecuteXmlResult(secapiPayProfitsharing.getMch_id()
, httpUriRequest, SecapiPayProfitsharingResult.class, secapiPayProfitsharing.getSign_type(),key);
}

2、PayProfitsharingOperation缺少receiver 属性的get set方法

3、缺少分账完结接口,是双向认证 https://pay.weixin.qq.com/wiki/doc/api/allocation_sl.php?chapter=25_5&index=6
增加SecapiPayProfitsharingfinishResult文件
import weixin.popular.bean.paymch.MchBase;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "xml")
@XmlAccessorType(XmlAccessType.FIELD)
public class SecapiPayProfitsharingfinishResult extends MchBase {

private String transaction_id;

private String out_order_no;

private String order_id;

private Integer amount;

public String getTransaction_id() {
    return transaction_id;
}

public void setTransaction_id(String transaction_id) {
    this.transaction_id = transaction_id;
}

public String getOut_order_no() {
    return out_order_no;
}

public void setOut_order_no(String out_order_no) {
    this.out_order_no = out_order_no;
}

public String getOrder_id() {
    return order_id;
}

public void setOrder_id(String order_id) {
    this.order_id = order_id;
}

public Integer getAmount() {
    return amount;
}

public void setAmount(Integer amount) {
    this.amount = amount;
}

}
增加SecapiPayProfitsharingfinish文件
import weixin.popular.bean.paymch.MchBase;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "xml")
@XmlAccessorType(XmlAccessType.FIELD)
public class SecapiPayProfitsharingfinish extends MchBase {

private String transaction_id;

private String out_order_no;

private Integer amount;

private String description;

public String getTransaction_id() {
    return transaction_id;
}

public void setTransaction_id(String transaction_id) {
    this.transaction_id = transaction_id;
}

public String getOut_order_no() {
    return out_order_no;
}

public void setOut_order_no(String out_order_no) {
    this.out_order_no = out_order_no;
}

public Integer getAmount() {
    return amount;
}

public void setAmount(Integer amount) {
    this.amount = amount;
}

public String getDescription() {
    return description;
}

public void setDescription(String description) {
    this.description = description;
}

}
新增完结方法
public static SecapiPayProfitsharingfinishResult secapiProfitsharingfinish(SecapiPayProfitsharingfinish secapiPayProfitsharingfinish,String key) {
Map<String,String> map = MapUtil.objectToMap(secapiPayProfitsharingfinish);
String sign = SignatureUtil.generateSign(map,secapiPayProfitsharingfinish.getSign_type() == null?
"HMAC-SHA256": secapiPayProfitsharingfinish.getSign_type(),key);
secapiPayProfitsharingfinish.setSign(sign);
String xml = XMLConverUtil.convertToXML(secapiPayProfitsharingfinish);
HttpUriRequest httpUriRequest = RequestBuilder.post()
.setHeader(xmlHeader)
.setUri(baseURI() + "/secapi/pay/profitsharingfinish")
.setEntity(new StringEntity(xml,Charset.forName("utf-8")))
.build();
return LocalHttpClient.keyStoreExecuteXmlResult(secapiPayProfitsharingfinish.getMch_id()
, httpUriRequest, SecapiPayProfitsharingfinishResult.class, secapiPayProfitsharingfinish.getSign_type(),key);
}

4、payProfitsharingaddreceiver方法调用出错
请改为以下:
Map<String,String> map = MapUtil.objectToMap(payProfitsharingOperation
, "receiver");
if(payProfitsharingOperation.getReceiver() != null){
map.put("receiver", JsonUtil.toJSONString(payProfitsharingOperation.getReceiver()));
}

5、分账请求方法secapiPayProfitsharing调用出错,请改为双向认证执行
LocalHttpClient.keyStoreExecuteXmlResult

liyiorg pushed a commit that referenced this issue Jan 29, 2019
@liyiorg liyiorg closed this as completed Feb 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants