🆕 #2692【企业微信】增加家校应用-班级收款接口支持

This commit is contained in:
0katekate0
2022-06-14 09:48:27 +08:00
committed by GitHub
parent a9fe0b29d4
commit 1f3f133772
7 changed files with 184 additions and 1 deletions

View File

@@ -2,7 +2,9 @@ package me.chanjar.weixin.cp.api;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.cp.bean.school.WxCpCustomizeHealthInfo;
import me.chanjar.weixin.cp.bean.school.WxCpPaymentResult;
import me.chanjar.weixin.cp.bean.school.WxCpResultList;
import me.chanjar.weixin.cp.bean.school.WxCpTrade;
import javax.validation.constraints.NotNull;
import java.util.List;
@@ -57,4 +59,27 @@ public interface WxCpSchoolService {
*/
WxCpResultList getHealthQrCode(@NotNull List<String> userIds, @NotNull Integer type) throws WxErrorException;
/**
* 获取学生付款结果
* 请求方式: POSTHTTPS
* 请求地址: https://qyapi.weixin.qq.com/cgi-bin/school/get_payment_result?access_token=ACCESS_TOKEN
*
* @param paymentId
* @return
* @throws WxErrorException
*/
WxCpPaymentResult getPaymentResult(@NotNull String paymentId) throws WxErrorException;
/**
* 获取订单详情
* 请求方式: POSTHTTPS
* 请求地址: https://qyapi.weixin.qq.com/cgi-bin/school/get_trade?access_token=ACCESS_TOKEN
*
* @param paymentId
* @param tradeNo
* @return
* @throws WxErrorException
*/
WxCpTrade getTrade(@NotNull String paymentId, @NotNull String tradeNo) throws WxErrorException;
}

View File

@@ -7,7 +7,9 @@ import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.cp.api.WxCpSchoolService;
import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.bean.school.WxCpCustomizeHealthInfo;
import me.chanjar.weixin.cp.bean.school.WxCpPaymentResult;
import me.chanjar.weixin.cp.bean.school.WxCpResultList;
import me.chanjar.weixin.cp.bean.school.WxCpTrade;
import javax.validation.constraints.NotNull;
import java.util.List;
@@ -64,4 +66,23 @@ public class WxCpSchoolServiceImpl implements WxCpSchoolService {
return WxCpResultList.fromJson(responseContent);
}
@Override
public WxCpPaymentResult getPaymentResult(@NotNull String paymentId) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(GET_PAYMENT_RESULT);
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("payment_id", paymentId);
String responseContent = this.cpService.post(apiUrl, jsonObject.toString());
return WxCpPaymentResult.fromJson(responseContent);
}
@Override
public WxCpTrade getTrade(@NotNull String paymentId, @NotNull String tradeNo) throws WxErrorException {
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(GET_TRADE);
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("payment_id", paymentId);
jsonObject.addProperty("trade_no", tradeNo);
String responseContent = this.cpService.post(apiUrl, jsonObject.toString());
return WxCpTrade.fromJson(responseContent);
}
}