1
0
mirror of synced 2025-12-23 18:48:00 +08:00

#1309 增加发送和查询企业微信红包的接口

This commit is contained in:
酱油99号
2019-12-03 17:09:31 +08:00
committed by Binary Wang
parent c1c801c420
commit d4d830fe3a
9 changed files with 608 additions and 39 deletions

View File

@@ -1,8 +1,6 @@
package com.github.binarywang.wxpay.service.impl;
import com.github.binarywang.wxpay.bean.entpay.EntPayBankRequest;
import com.github.binarywang.wxpay.bean.entpay.EntPayBankResult;
import com.github.binarywang.wxpay.bean.entpay.EntPayRequest;
import com.github.binarywang.wxpay.bean.entpay.*;
import com.github.binarywang.wxpay.constant.WxPayConstants.CheckNameOption;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.github.binarywang.wxpay.service.WxPayService;
@@ -10,7 +8,10 @@ import com.github.binarywang.wxpay.testbase.ApiTestModule;
import com.google.inject.Inject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.*;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import java.util.concurrent.TimeUnit;
/**
* <pre>
@@ -94,4 +95,57 @@ public class EntPayServiceImplTest {
public void testQueryPayBank() throws Exception {
this.logger.info(this.payService.getEntPayService().queryPayBank("123").toString());
}
/**
* 发送企业红包
* @throws Exception the exception
*/
@Test
public void testSendEnterpriseRedpack() {
EntPayRedpackRequest request = new EntPayRedpackRequest();
request.setMchId("1");
//商户单号
request.setMchBillNo(request.getMchId()+"20191202"+"1");
//企业微信corpid即为此appId
request.setWxAppId("1");
// request.setSenderName("1");
// request.setSenderHeaderMediaId("2");
request.setAgentId("1");
request.setReOpenid("1");
//目前企业微信api红包最低1块钱
request.setTotalAmount(1000);
request.setWishing("1");
request.setActName("1");
request.setRemark("1");
EntPayRedpackResult redpackResult = null;
try {
redpackResult = this.payService.getEntPayService().sendEnterpriseRedpack(request);
} catch (WxPayException e) {
}
this.logger.info(redpackResult.toString());
}
/**
* 查询企业红包
* @throws Exception
*/
@Test
public void testQueryEnterpriseRedpack() throws Exception {
while (true) {
EntPayRedpackQueryRequest request = new EntPayRedpackQueryRequest();
request.setAppid("1");
request.setMchId("1");
request.setMchBillNo("1");
try {
EntPayRedpackQueryResult result = this.payService.getEntPayService().queryEnterpriseRedpack(request);
this.logger.info(result.toString());
} catch (Exception e) {
}
TimeUnit.SECONDS.sleep(3);
}
}
}