账单类型实现

This commit is contained in:
egzosn
2021-02-23 01:39:35 +08:00
parent db4c051007
commit b3540dc41f
16 changed files with 538 additions and 31 deletions

View File

@@ -26,6 +26,7 @@ import java.util.TreeMap;
import com.alibaba.fastjson.JSONObject;
import com.egzosn.pay.common.api.BasePayService;
import com.egzosn.pay.common.bean.BillType;
import com.egzosn.pay.common.bean.MethodType;
import com.egzosn.pay.common.bean.PayMessage;
import com.egzosn.pay.common.bean.PayOrder;
@@ -661,6 +662,7 @@ public class UnionPayService extends BasePayService<UnionPayConfigStorage> {
* @param billType 账单类型
* @return 返回fileContent 请自行将数据落地
*/
@Deprecated
@Override
public Map<String, Object> downloadbill(Date billDate, String billType) {
Map<String, Object> params = this.getCommonParam();
@@ -684,6 +686,37 @@ public class UnionPayService extends BasePayService<UnionPayConfigStorage> {
throw new PayErrorException(new PayException("failure", "验证签名失败", response.toString()));
}
/**
* 下载对账单
*
* @param billDate 账单时间
* @param billType 账单类型
* @return 返回fileContent 请自行将数据落地
*/
@Override
public Map<String, Object> downloadBill(Date billDate, BillType billType) {
Map<String, Object> params = this.getCommonParam();
UnionTransactionType.FILE_TRANSFER.convertMap(params);
params.put(SDKConstants.param_settleDate, DateUtils.formatDate(billDate, DateUtils.MMDD));
params.put(SDKConstants.param_fileType, billType.getTarType());
params.remove(SDKConstants.param_backUrl);
params.remove(SDKConstants.param_currencyCode);
this.setSign(params);
String responseStr = getHttpRequestTemplate().postForObject(this.getFileTransUrl(), params, String.class);
JSONObject response = UriVariables.getParametersToMap(responseStr);
if (this.verify(response)) {
if (SDKConstants.OK_RESP_CODE.equals(response.get(SDKConstants.param_respCode))) {
return response;
}
throw new PayErrorException(new PayException(response.get(SDKConstants.param_respCode).toString(), response.get(SDKConstants.param_respMsg).toString(), response.toString()));
}
throw new PayErrorException(new PayException("failure", "验证签名失败", response.toString()));
}
/**
* 创建消息

View File

@@ -0,0 +1,12 @@
package com.egzosn.pay.union.bean;
/**
* 银联账单类型
* @author Egan
* <pre>
* email egzosn@gmail.com
* date 2021/2/23
* </pre>
*/
public enum UnionPayBillType {
}