#392 微信支付增加企业付款到银行卡的相关接口

This commit is contained in:
Binary Wang
2017-12-21 00:33:07 +08:00
parent 230fc9f16c
commit 34a974bc28
14 changed files with 449 additions and 100 deletions

View File

@@ -1,45 +0,0 @@
package com.github.binarywang.wxpay.service;
import com.github.binarywang.wxpay.bean.entpay.EntPayQueryResult;
import com.github.binarywang.wxpay.bean.entpay.EntPayRequest;
import com.github.binarywang.wxpay.bean.entpay.EntPayResult;
import com.github.binarywang.wxpay.bean.request.WxEntPayRequest;
import com.github.binarywang.wxpay.bean.result.WxEntPayQueryResult;
import com.github.binarywang.wxpay.bean.result.WxEntPayResult;
import com.github.binarywang.wxpay.exception.WxPayException;
/**
* <pre>
* 企业付款相关服务类
* Created by BinaryWang on 2017/12/19.
* </pre>
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
*/
public interface EntPaySerivce {
/**
* <pre>
* 企业付款业务是基于微信支付商户平台的资金管理能力为了协助商户方便地实现企业向个人付款针对部分有开发能力的商户提供通过API完成企业付款的功能。
* 比如目前的保险行业向客户退保、给付、理赔。
* 企业付款将使用商户的可用余额需确保可用余额充足。查看可用余额、充值、提现请登录商户平台“资金管理”https://pay.weixin.qq.com/进行操作。
* 注意:与商户微信支付收款资金并非同一账户,需要单独充值。
* 文档详见:https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=14_2
* 接口链接https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers
* </pre>
*
* @param request 请求对象
*/
EntPayResult entPay(EntPayRequest request) throws WxPayException;
/**
* <pre>
* 查询企业付款API
* 用于商户的企业付款操作进行结果查询,返回付款操作详细结果。
* 文档详见:https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=14_3
* 接口链接https://api.mch.weixin.qq.com/mmpaymkttransfers/gettransferinfo
* </pre>
*
* @param partnerTradeNo 商户订单号
*/
EntPayQueryResult queryEntPay(String partnerTradeNo) throws WxPayException;
}

View File

@@ -0,0 +1,72 @@
package com.github.binarywang.wxpay.service;
import com.github.binarywang.wxpay.bean.entpay.*;
import com.github.binarywang.wxpay.exception.WxPayException;
/**
* <pre>
* 企业付款相关服务类.
* Created by BinaryWang on 2017/12/19.
* </pre>
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
*/
public interface EntPayService {
/**
* <pre>
* 企业付款API.
* 企业付款业务是基于微信支付商户平台的资金管理能力为了协助商户方便地实现企业向个人付款针对部分有开发能力的商户提供通过API完成企业付款的功能。
* 比如目前的保险行业向客户退保、给付、理赔。
* 企业付款将使用商户的可用余额需确保可用余额充足。查看可用余额、充值、提现请登录商户平台“资金管理”https://pay.weixin.qq.com/进行操作。
* 注意:与商户微信支付收款资金并非同一账户,需要单独充值。
* 文档详见: https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=14_2
* 接口链接https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers
* </pre>
*
* @param request 请求对象
*/
EntPayResult entPay(EntPayRequest request) throws WxPayException;
/**
* <pre>
* 查询企业付款API.
* 用于商户的企业付款操作进行结果查询,返回付款操作详细结果。
* 文档详见:https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=14_3
* 接口链接https://api.mch.weixin.qq.com/mmpaymkttransfers/gettransferinfo
* </pre>
*
* @param partnerTradeNo 商户订单号
*/
EntPayQueryResult queryEntPay(String partnerTradeNo) throws WxPayException;
/**
* <pre>
* 获取RSA加密公钥API.
* RSA算法使用说明非对称加密算法算法采用RSA/ECB/OAEPPadding模式
* 1、 调用获取RSA公钥API获取RSA公钥落地成本地文件假设为public.pem
* 2、 确定public.pem文件的存放路径同时修改代码中文件的输入路径加载RSA公钥
* 3、 用标准的RSA加密库对敏感信息进行加密选择RSA_PKCS1_OAEP_PADDING填充模式
* egJava的填充方式要选 " RSA/ECB/OAEPWITHSHA-1ANDMGF1PADDING"
* 4、 得到进行rsa加密并转base64之后的密文
* 5、 将密文传给微信侧相应字段如付款接口enc_bank_no/enc_true_name
*
* 接口默认输出PKCS#1格式的公钥商户需根据自己开发的语言选择公钥格式
* 文档详见:https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=24_7&index=4
* 接口链接https://fraud.mch.weixin.qq.com/risk/getpublickey
* </pre>
*/
String getPublicKey() throws WxPayException;
/**
* 企业付款到银行卡.
* <pre>
* 用于企业向微信用户银行卡付款
* 目前支持接口API的方式向指定微信用户的银行卡付款。
* 文档详见https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=24_2
* 接口链接https://api.mch.weixin.qq.com/mmpaysptrans/pay_bank
* </pre>
*
* @param request 请求对象
*/
EntPayBankResult payToBankCard(EntPayBankRequest request) throws WxPayException;
}

View File

@@ -2,9 +2,7 @@ package com.github.binarywang.wxpay.service;
import com.github.binarywang.wxpay.bean.WxPayApiData;
import com.github.binarywang.wxpay.bean.coupon.*;
import com.github.binarywang.wxpay.bean.entpay.EntPayQueryResult;
import com.github.binarywang.wxpay.bean.entpay.EntPayRequest;
import com.github.binarywang.wxpay.bean.entpay.EntPayResult;
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult;
import com.github.binarywang.wxpay.bean.request.*;
@@ -54,12 +52,12 @@ public interface WxPayService {
/**
* 获取企业付款服务类
*/
EntPaySerivce getEntPaySerivce();
EntPayService getEntPayService();
/**
* 设置企业付款服务类,允许开发者自定义实现类
*/
void setEntPaySerivce(EntPaySerivce entPaySerivce);
void setEntPayService(EntPayService entPayService);
/**
* <pre>
@@ -211,13 +209,13 @@ public interface WxPayService {
WxPayRedpackQueryResult queryRedpack(String mchBillNo) throws WxPayException;
/**
* 请使用this.getEntPayService().entPay()方法{@link EntPaySerivce#entPay(EntPayRequest)}
* 请使用this.getEntPayService().entPay()方法{@link EntPayService#entPay(EntPayRequest)}
*/
@Deprecated
WxEntPayResult entPay(WxEntPayRequest request) throws WxPayException;
/**
* 请使用this.getEntPayService().queryEntPay()方法 {@link EntPaySerivce#queryEntPay(String)}
* 请使用this.getEntPayService().queryEntPay()方法 {@link EntPayService#queryEntPay(String)}
*/
@Deprecated
WxEntPayQueryResult queryEntPay(String partnerTradeNo) throws WxPayException;

View File

@@ -3,8 +3,6 @@ package com.github.binarywang.wxpay.service.impl;
import com.github.binarywang.utils.qrcode.QrcodeUtils;
import com.github.binarywang.wxpay.bean.WxPayApiData;
import com.github.binarywang.wxpay.bean.coupon.*;
import com.github.binarywang.wxpay.bean.entpay.EntPayQueryResult;
import com.github.binarywang.wxpay.bean.entpay.EntPayResult;
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult;
import com.github.binarywang.wxpay.bean.order.WxPayAppOrderResult;
@@ -17,7 +15,7 @@ import com.github.binarywang.wxpay.constant.WxPayConstants.BillType;
import com.github.binarywang.wxpay.constant.WxPayConstants.SignType;
import com.github.binarywang.wxpay.constant.WxPayConstants.TradeType;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.github.binarywang.wxpay.service.EntPaySerivce;
import com.github.binarywang.wxpay.service.EntPayService;
import com.github.binarywang.wxpay.service.WxPayService;
import com.github.binarywang.wxpay.util.SignUtils;
import com.google.common.base.Joiner;
@@ -52,18 +50,18 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
protected final Logger log = LoggerFactory.getLogger(this.getClass());
protected static ThreadLocal<WxPayApiData> wxApiData = new ThreadLocal<>();
private EntPaySerivce entPaySerivce = new EntPayServiceImpl(this);
private EntPayService entPayService = new EntPayServiceImpl(this);
protected WxPayConfig config;
@Override
public EntPaySerivce getEntPaySerivce() {
return entPaySerivce;
public EntPayService getEntPayService() {
return entPayService;
}
@Override
public void setEntPaySerivce(EntPaySerivce entPaySerivce) {
this.entPaySerivce = entPaySerivce;
public void setEntPayService(EntPayService entPayService) {
this.entPayService = entPayService;
}
@Override
@@ -87,7 +85,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
@Override
public WxPayRefundResult refund(WxPayRefundRequest request) throws WxPayException {
request.checkAndSign(this.getConfig(), false);
request.checkAndSign(this.getConfig());
String url = this.getPayBaseUrl() + "/secapi/pay/refund";
String responseContent = this.post(url, request.toXML(), true);
@@ -105,7 +103,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
request.setOutRefundNo(StringUtils.trimToNull(outRefundNo));
request.setRefundId(StringUtils.trimToNull(refundId));
request.checkAndSign(this.getConfig(), false);
request.checkAndSign(this.getConfig());
String url = this.getPayBaseUrl() + "/pay/refundquery";
String responseContent = this.post(url, request.toXML(), false);
@@ -153,7 +151,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
@Override
public WxPaySendRedpackResult sendRedpack(WxPaySendRedpackRequest request) throws WxPayException {
request.checkAndSign(this.getConfig(), false);
request.checkAndSign(this.getConfig());
String url = this.getPayBaseUrl() + "/mmpaymkttransfers/sendredpack";
if (request.getAmtType() != null) {
@@ -171,7 +169,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
WxPayRedpackQueryRequest request = new WxPayRedpackQueryRequest();
request.setMchBillNo(mchBillNo);
request.setBillType(BillType.MCHT);
request.checkAndSign(this.getConfig(), false);
request.checkAndSign(this.getConfig());
String url = this.getPayBaseUrl() + "/mmpaymkttransfers/gethbinfo";
String responseContent = this.post(url, request.toXML(), true);
@@ -185,7 +183,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
WxPayOrderQueryRequest request = new WxPayOrderQueryRequest();
request.setOutTradeNo(StringUtils.trimToNull(outTradeNo));
request.setTransactionId(StringUtils.trimToNull(transactionId));
request.checkAndSign(this.getConfig(), false);
request.checkAndSign(this.getConfig());
String url = this.getPayBaseUrl() + "/pay/orderquery";
String responseContent = this.post(url, request.toXML(), false);
@@ -207,7 +205,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
WxPayOrderCloseRequest request = new WxPayOrderCloseRequest();
request.setOutTradeNo(StringUtils.trimToNull(outTradeNo));
request.checkAndSign(this.getConfig(), false);
request.checkAndSign(this.getConfig());
String url = this.getPayBaseUrl() + "/pay/closeorder";
String responseContent = this.post(url, request.toXML(), false);
@@ -289,7 +287,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
@Override
public WxPayUnifiedOrderResult unifiedOrder(WxPayUnifiedOrderRequest request) throws WxPayException {
request.checkAndSign(this.getConfig(), false);
request.checkAndSign(this.getConfig());
String url = this.getPayBaseUrl() + "/pay/unifiedorder";
String responseContent = this.post(url, request.toXML(), false);
@@ -350,13 +348,13 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
@Override
@Deprecated
public WxEntPayResult entPay(WxEntPayRequest request) throws WxPayException {
return WxEntPayResult.createFrom(this.getEntPaySerivce().entPay(request));
return WxEntPayResult.createFrom(this.getEntPayService().entPay(request));
}
@Override
@Deprecated
public WxEntPayQueryResult queryEntPay(String partnerTradeNo) throws WxPayException {
return WxEntPayQueryResult.createFrom(this.getEntPaySerivce().queryEntPay(partnerTradeNo));
return WxEntPayQueryResult.createFrom(this.getEntPayService().queryEntPay(partnerTradeNo));
}
@Override
@@ -403,7 +401,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
@Override
public void report(WxPayReportRequest request) throws WxPayException {
request.checkAndSign(this.getConfig(), false);
request.checkAndSign(this.getConfig());
String url = this.getPayBaseUrl() + "/payitil/report";
String responseContent = this.post(url, request.toXML(), false);
@@ -423,7 +421,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
request.setTarType(tarType);
request.setDeviceInfo(deviceInfo);
request.checkAndSign(this.getConfig(), false);
request.checkAndSign(this.getConfig());
String url = this.getPayBaseUrl() + "/pay/downloadbill";
@@ -547,7 +545,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
@Override
public WxPayMicropayResult micropay(WxPayMicropayRequest request) throws WxPayException {
request.checkAndSign(this.getConfig(), false);
request.checkAndSign(this.getConfig());
String url = this.getPayBaseUrl() + "/pay/micropay";
String responseContent = this.post(url, request.toXML(), false);
@@ -558,7 +556,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
@Override
public WxPayOrderReverseResult reverseOrder(WxPayOrderReverseRequest request) throws WxPayException {
request.checkAndSign(this.getConfig(), false);
request.checkAndSign(this.getConfig());
String url = this.getPayBaseUrl() + "/secapi/pay/reverse";
String responseContent = this.post(url, request.toXML(), true);
@@ -569,7 +567,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
@Override
public String shorturl(WxPayShorturlRequest request) throws WxPayException {
request.checkAndSign(this.getConfig(), false);
request.checkAndSign(this.getConfig());
String url = this.getPayBaseUrl() + "/tools/shorturl";
String responseContent = this.post(url, request.toXML(), false);
@@ -585,7 +583,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
@Override
public String authcode2Openid(WxPayAuthcode2OpenidRequest request) throws WxPayException {
request.checkAndSign(this.getConfig(), false);
request.checkAndSign(this.getConfig());
String url = this.getPayBaseUrl() + "/tools/authcodetoopenid";
String responseContent = this.post(url, request.toXML(), false);
@@ -602,7 +600,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
@Override
public String getSandboxSignKey() throws WxPayException {
WxPayDefaultRequest request = new WxPayDefaultRequest();
request.checkAndSign(this.getConfig(), false);
request.checkAndSign(this.getConfig());
String url = "https://api.mch.weixin.qq.com/sandboxnew/pay/getsignkey";
String responseContent = this.post(url, request.toXML(), false);
@@ -613,7 +611,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
@Override
public WxPayCouponSendResult sendCoupon(WxPayCouponSendRequest request) throws WxPayException {
request.checkAndSign(this.getConfig(), false);
request.checkAndSign(this.getConfig());
String url = this.getPayBaseUrl() + "/mmpaymkttransfers/send_coupon";
String responseContent = this.post(url, request.toXML(), true);
@@ -624,7 +622,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
@Override
public WxPayCouponStockQueryResult queryCouponStock(WxPayCouponStockQueryRequest request) throws WxPayException {
request.checkAndSign(this.getConfig(), false);
request.checkAndSign(this.getConfig());
String url = this.getPayBaseUrl() + "/mmpaymkttransfers/query_coupon_stock";
String responseContent = this.post(url, request.toXML(), false);
@@ -635,7 +633,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
@Override
public WxPayCouponInfoQueryResult queryCouponInfo(WxPayCouponInfoQueryRequest request) throws WxPayException {
request.checkAndSign(this.getConfig(), false);
request.checkAndSign(this.getConfig());
String url = this.getPayBaseUrl() + "/mmpaymkttransfers/querycouponsinfo";
String responseContent = this.post(url, request.toXML(), false);
@@ -664,7 +662,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
request.setLimit(limit);
request.setSignType(SignType.HMAC_SHA256);
request.checkAndSign(this.getConfig(), true);
request.checkAndSign(this.getConfig());
String url = this.getPayBaseUrl() + "/billcommentsp/batchquerycomment";

View File

@@ -1,13 +1,25 @@
package com.github.binarywang.wxpay.service.impl;
import com.github.binarywang.wxpay.bean.entpay.EntPayQueryRequest;
import com.github.binarywang.wxpay.bean.entpay.EntPayQueryResult;
import com.github.binarywang.wxpay.bean.entpay.EntPayRequest;
import com.github.binarywang.wxpay.bean.entpay.EntPayResult;
import com.github.binarywang.wxpay.bean.entpay.*;
import com.github.binarywang.wxpay.bean.request.WxPayDefaultRequest;
import com.github.binarywang.wxpay.bean.result.BaseWxPayResult;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.github.binarywang.wxpay.service.EntPaySerivce;
import com.github.binarywang.wxpay.service.EntPayService;
import com.github.binarywang.wxpay.service.WxPayService;
import com.github.binarywang.wxpay.util.SignUtils;
import org.apache.commons.codec.binary.Base64;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.jce.provider.JCERSAPublicKey;
import org.bouncycastle.openssl.PEMReader;
import org.bouncycastle.openssl.PasswordFinder;
import javax.crypto.Cipher;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.security.Security;
/**
* <pre>
@@ -16,7 +28,7 @@ import com.github.binarywang.wxpay.service.WxPayService;
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
*/
public class EntPayServiceImpl implements EntPaySerivce {
public class EntPayServiceImpl implements EntPayService {
private WxPayService payService;
public EntPayServiceImpl(WxPayService payService) {
@@ -25,7 +37,7 @@ public class EntPayServiceImpl implements EntPaySerivce {
@Override
public EntPayResult entPay(EntPayRequest request) throws WxPayException {
request.checkAndSign(this.payService.getConfig(), false);
request.checkAndSign(this.payService.getConfig());
String url = this.payService.getPayBaseUrl() + "/mmpaymkttransfers/promotion/transfers";
String responseContent = this.payService.post(url, request.toXML(), true);
@@ -38,7 +50,7 @@ public class EntPayServiceImpl implements EntPaySerivce {
public EntPayQueryResult queryEntPay(String partnerTradeNo) throws WxPayException {
EntPayQueryRequest request = new EntPayQueryRequest();
request.setPartnerTradeNo(partnerTradeNo);
request.checkAndSign(this.payService.getConfig(), false);
request.checkAndSign(this.payService.getConfig());
String url = this.payService.getPayBaseUrl() + "/mmpaymkttransfers/gettransferinfo";
String responseContent = this.payService.post(url, request.toXML(), true);
@@ -47,4 +59,82 @@ public class EntPayServiceImpl implements EntPaySerivce {
return result;
}
@Override
public String getPublicKey() throws WxPayException {
WxPayDefaultRequest request = new WxPayDefaultRequest();
request.setMchId(this.payService.getConfig().getMchId());
request.setNonceStr(String.valueOf(System.currentTimeMillis()));
request.setSign(SignUtils.createSign(request, null, this.payService.getConfig().getMchKey(),
true));
String url = "https://fraud.mch.weixin.qq.com/risk/getpublickey";
String responseContent = this.payService.post(url, request.toXML(), true);
GetPublicKeyResult result = BaseWxPayResult.fromXML(responseContent, GetPublicKeyResult.class);
result.checkResult(this.payService, request.getSignType(), true);
return result.getPubKey();
}
@Override
public EntPayBankResult payToBankCard(EntPayBankRequest request) throws WxPayException {
File publicKeyFile = this.buildPublicKeyFile();
request.setEncBankNo(this.encryptRSA(publicKeyFile, request.getEncBankNo()));
request.setEncTrueName(this.encryptRSA(publicKeyFile, request.getEncTrueName()));
publicKeyFile.deleteOnExit();
request.checkAndSign(this.payService.getConfig());
String url = this.payService.getPayBaseUrl() + "/mmpaysptrans/pay_bank";
String responseContent = this.payService.post(url, request.toXML(), true);
EntPayBankResult result = BaseWxPayResult.fromXML(responseContent, EntPayBankResult.class);
result.checkResult(this.payService, request.getSignType(), true);
return result;
}
private String encryptRSA(File publicKeyFile, String srcString) throws WxPayException {
try {
Security.addProvider(new BouncyCastleProvider());
Cipher cipher = Cipher.getInstance("RSA/ECB/OAEPWithSHA1AndMGF1Padding");
PasswordFinder passwordFinder = new PasswordFinder() {
@Override
public char[] getPassword() {
return "".toCharArray();
}
};
try (PEMReader reader = new PEMReader(new FileReader(publicKeyFile), passwordFinder)) {
JCERSAPublicKey publicKey = (JCERSAPublicKey) reader.readObject();
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
byte[] encrypt = cipher.doFinal(srcString.getBytes());
return Base64.encodeBase64String(encrypt);
}
} catch (Exception e) {
throw new WxPayException("加密出错", e);
}
}
private File buildPublicKeyFile() throws WxPayException {
try {
String publicKeyStr = this.getPublicKey();
Path tmpFile = Files.createTempFile("payToBank", ".pem");
Files.write(tmpFile, publicKeyStr.getBytes());
return tmpFile.toFile();
} catch (Exception e) {
throw new WxPayException("生成加密公钥文件时发生异常", e);
}
}
public static void main(String[] args) throws WxPayException, IOException {
String key = "-----BEGIN RSA PUBLIC KEY-----\n" +
"MIIBCgKCAQEAtEeUSop/YGqZ53Y++R9NapFSZmorj+SL/brmJUU7+hyClEnPOeG/\n" +
"v6/ZrX9qo25JAojrBDbqaW9L+HtzI141vusarRYIGPvVqTV30L5db0Yq7AmX7Hs9\n" +
"s+nEtoMAwMWUzQPXLUs2mt6rpu85HwAIK3F4Xb+OFIbXCJTbDvWYtQssn07lr+IY\n" +
"jPA00sON71egmuRrCoQClkhf0vgrhj7eHUCRZRJ2zf4UU31fHv+kO441hVD5TTP8\n" +
"bjJvFm6TW3sgQE8aCDbomtu+syk4Tv/4ONCqxG8d/kF1TlU+idGWEU179uR/KSjP\n" +
"p7kM7BoaY2goFgYAe4DsI8Fh33dCOiKyVwIDAQAB\n" +
"-----END RSA PUBLIC KEY-----";
Path tmpFile = Files.createTempFile("payToBank", ".pem");
Files.write(tmpFile, key.getBytes());
System.out.println(new EntPayServiceImpl(null).encryptRSA(tmpFile.toFile(), "111111"));
}
}