This commit is contained in:
egzosn
2020-11-13 22:29:47 +08:00
parent a3f5fe8016
commit 012b71739d
18 changed files with 48 additions and 49 deletions

View File

@@ -115,9 +115,9 @@ public class AliPayController {
@RequestMapping(value = "toPay.html", produces = "text/html;charset=UTF-8")
public String toPay( BigDecimal price) {
//及时收款
PayOrder order = new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), AliTransactionType.PAGE);
PayOrder order = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), AliTransactionType.PAGE);
//WAP
// PayOrder order = new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), AliTransactionType.WAP);
// PayOrder order = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), AliTransactionType.WAP);
// Map orderInfo = service.orderInfo(order);
// return service.buildRequest(orderInfo, MethodType.POST);
@@ -137,7 +137,7 @@ public class AliPayController {
public Map<String, Object> app() {
Map<String, Object> data = new HashMap<>();
data.put("code", 0);
PayOrder order = new PayOrder("订单title", "摘要", new BigDecimal(0.01), UUID.randomUUID().toString().replace("-", ""));
PayOrder order = new PayOrder("订单title", "摘要", BigDecimal.valueOf(0.01), UUID.randomUUID().toString().replace("-", ""));
//App支付
order.setTransactionType(AliTransactionType.APP);
data.put("orderInfo", UriVariables.getMapToParameters(service.app(order)));
@@ -155,7 +155,7 @@ public class AliPayController {
public byte[] toQrPay( BigDecimal price) throws IOException {
//获取对应的支付账户操作工具可根据账户id
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(service.genQrPay( new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, System.currentTimeMillis()+"", AliTransactionType.SWEEPPAY)), "JPEG", baos);
ImageIO.write(service.genQrPay( new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, System.currentTimeMillis()+"", AliTransactionType.SWEEPPAY)), "JPEG", baos);
return baos.toByteArray();
}
/**
@@ -168,7 +168,7 @@ public class AliPayController {
@RequestMapping(value = "getQrPay.json")
public String getQrPay(BigDecimal price) throws IOException {
//获取对应的支付账户操作工具可根据账户id
return service.getQrPay( new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, System.currentTimeMillis()+"", AliTransactionType.SWEEPPAY));
return service.getQrPay( new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, System.currentTimeMillis()+"", AliTransactionType.SWEEPPAY));
}
@@ -182,9 +182,9 @@ public class AliPayController {
public Map<String, Object> microPay(BigDecimal price, String authCode) {
//获取对应的支付账户操作工具可根据账户id
//条码付
PayOrder order = new PayOrder("egan order", "egan order", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), AliTransactionType.BAR_CODE);
PayOrder order = new PayOrder("egan order", "egan order", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), AliTransactionType.BAR_CODE);
//声波付
// PayOrder order = new PayOrder("egan order", "egan order", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), AliTransactionType.WAVE_CODE);
// PayOrder order = new PayOrder("egan order", "egan order", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), AliTransactionType.WAVE_CODE);
//设置授权码,条码等
order.setAuthCode(authCode);
//支付结果

View File

@@ -65,7 +65,7 @@ public class FuiouPayController {
@RequestMapping(value = "toPay.html", produces = "text/html;charset=UTF-8")
public String toPay( BigDecimal price) {
//支付订单基础信息
PayOrder order = new PayOrder("订单title", "摘要", new BigDecimal(0.01) , UUID.randomUUID().toString().replace("-", "").substring(2));
PayOrder order = new PayOrder("订单title", "摘要", BigDecimal.valueOf(0.01) , UUID.randomUUID().toString().replace("-", "").substring(2));
order.setTransactionType(FuiouTransactionType.B2C);
//获取支付所需的信息
// Map<String, Object> directOrderInfo = service.orderInfo(order);

View File

@@ -88,7 +88,7 @@ public class PayController {
//获取对应的支付账户操作工具可根据账户id
PayResponse payResponse = service.getPayResponse(payId);
PayOrder order = new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType));
PayOrder order = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType));
// ------ 微信H5使用----
order.setSpbillCreateIp(request.getHeader("X-Real-IP"));
StringBuffer requestURL = request.getRequestURL();
@@ -123,7 +123,7 @@ public class PayController {
//获取对应的支付账户操作工具可根据账户id
PayResponse payResponse = service.getPayResponse(2);
PayOrder order = new PayOrder("订单title", "摘要", new BigDecimal(0.01), UUID.randomUUID().toString().replace("-", ""), WxTransactionType.MWEB);
PayOrder order = new PayOrder("订单title", "摘要", BigDecimal.valueOf(0.01), UUID.randomUUID().toString().replace("-", ""), WxTransactionType.MWEB);
order.setSpbillCreateIp(request.getHeader("X-Real-IP"));
StringBuffer requestURL = request.getRequestURL();
//设置网页地址
@@ -150,7 +150,7 @@ public class PayController {
//获取对应的支付账户操作工具可根据账户id
PayResponse payResponse = service.getPayResponse(payId);
PayOrder order = new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType("JSAPI"));
PayOrder order = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType("JSAPI"));
order.setOpenid(openid);
Map orderInfo = payResponse.getService().orderInfo(order);
@@ -173,7 +173,7 @@ public class PayController {
PayResponse payResponse = service.getPayResponse(payId);
Map<String, Object> data = new HashMap<>();
data.put("code", 0);
PayOrder order = new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType));
PayOrder order = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType));
data.put("orderInfo", payResponse.getService().app(order));
return data;
}
@@ -192,7 +192,7 @@ public class PayController {
//获取对应的支付账户操作工具可根据账户id
PayResponse payResponse = service.getPayResponse(payId);
PayOrder order = new PayOrder("egan order", "egan order", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType));
PayOrder order = new PayOrder("egan order", "egan order", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType));
//设置授权码,条码等
order.setAuthCode(authCode);
//支付结果
@@ -225,7 +225,7 @@ public class PayController {
PayResponse payResponse = service.getPayResponse(payId);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(payResponse.getService().genQrPay(new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, System.currentTimeMillis() + "", PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType))), "JPEG", baos);
ImageIO.write(payResponse.getService().genQrPay(new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, System.currentTimeMillis() + "", PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType))), "JPEG", baos);
return baos.toByteArray();
}
/**
@@ -240,7 +240,7 @@ public class PayController {
//获取对应的支付账户操作工具可根据账户id
//获取对应的支付账户操作工具可根据账户id
PayResponse payResponse = service.getPayResponse(payId);
return payResponse.getService().getQrPay( new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, System.currentTimeMillis() + "", PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType)));
return payResponse.getService().getQrPay( new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, System.currentTimeMillis() + "", PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType)));
}
/**
* 获取一码付二维码图像
@@ -288,7 +288,7 @@ public class PayController {
StringBuilder html = new StringBuilder();
//订单
PayOrder payOrder = new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, System.currentTimeMillis() + "");
PayOrder payOrder = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, System.currentTimeMillis() + "");
String ua = request.getHeader("user-agent");
if (ua.contains("MicroMessenger")) {
payOrder.setTransactionType(WxTransactionType.NATIVE);

View File

@@ -68,7 +68,7 @@ public class PayPalPayController {
@RequestMapping(value = "toPay.html", produces = "text/html;charset=UTF-8")
public String toPay(BigDecimal price) {
//及时收款
PayOrder order = new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), PayPalTransactionType.sale);
PayOrder order = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), PayPalTransactionType.sale);
// Map orderInfo = service.orderInfo(order);
// return service.buildRequest(orderInfo, MethodType.POST);
@@ -93,7 +93,7 @@ public class PayPalPayController {
order.setCurType(DefaultCurType.USD);
order.setDescription(" description ");
order.setTradeNo("paypal 平台的单号");
order.setRefundAmount(new BigDecimal(0.01));
order.setRefundAmount(BigDecimal.valueOf(0.01));
return service.refund(order);
}

View File

@@ -97,10 +97,10 @@ public class UnionPayController {
@RequestMapping(value = "toPay.html", produces = "text/html;charset=UTF-8")
public String toPay( BigDecimal price) {
//网关支付(WEB)/手机网页支付
PayOrder order = new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""),
PayOrder order = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""),
WEB);
//企业网银支付B2B支付
// PayOrder order = new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), UnionTransactionType.B2B);
// PayOrder order = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), UnionTransactionType.B2B);
// Map orderInfo = service.orderInfo(order);
// return service.buildRequest(orderInfo, MethodType.POST);
@@ -117,7 +117,7 @@ public class UnionPayController {
@RequestMapping(value = "toPay.json")
public Map<String, Object> sendHttpRequest( BigDecimal price) {
//手机控件支付产品
PayOrder order = new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", "")
PayOrder order = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", "")
,UnionTransactionType.WAP);
return service.app(order);
}
@@ -133,7 +133,7 @@ public class UnionPayController {
public Map<String, Object> app() {
Map<String, Object> data = new HashMap<>();
data.put("code", 0);
PayOrder order = new PayOrder("订单title", "摘要", new BigDecimal(0.01), SignUtils.randomStr());
PayOrder order = new PayOrder("订单title", "摘要", BigDecimal.valueOf(0.01), SignUtils.randomStr());
//App支付
order.setTransactionType(UnionTransactionType.APP);
@@ -155,7 +155,7 @@ public class UnionPayController {
public byte[] toWxQrPay( BigDecimal price) throws IOException {
//获取对应的支付账户操作工具可根据账户id
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(service.genQrPay( new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, System.currentTimeMillis()+"", UnionTransactionType.APPLY_QR_CODE)), "JPEG", baos);
ImageIO.write(service.genQrPay( new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, System.currentTimeMillis()+"", UnionTransactionType.APPLY_QR_CODE)), "JPEG", baos);
return baos.toByteArray();
}
/**
@@ -168,7 +168,7 @@ public class UnionPayController {
@RequestMapping(value = "getQrPay.json")
public String getQrPay(BigDecimal price) throws IOException {
//获取对应的支付账户操作工具可根据账户id
return service.getQrPay( new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, System.currentTimeMillis()+"", UnionTransactionType.APPLY_QR_CODE));
return service.getQrPay( new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, System.currentTimeMillis()+"", UnionTransactionType.APPLY_QR_CODE));
}
/**
@@ -181,7 +181,7 @@ public class UnionPayController {
public Map<String, Object> microPay(BigDecimal price, String authCode) {
//获取对应的支付账户操作工具可根据账户id
//条码付
PayOrder order = new PayOrder("egan order", "egan order", null == price ? new BigDecimal(0.01) : price, SignUtils.randomStr(), UnionTransactionType.CONSUME);
PayOrder order = new PayOrder("egan order", "egan order", null == price ? BigDecimal.valueOf(0.01) : price, SignUtils.randomStr(), UnionTransactionType.CONSUME);
//设置授权码,条码等
order.setAuthCode(authCode);
//支付结果

View File

@@ -38,7 +38,6 @@ public class WxPayController {
//ssl 退款证书相关 不使用可注释
private static String KEYSTORE = "ssl 退款证书";
private static String STORE_PASSWORD = "ssl 证书对应的密码, 默认为商户号";
@PostConstruct
public void init() {
@@ -67,7 +66,7 @@ public class WxPayController {
//TODO 这里也支持输入流的入参。
// httpConfigStorage.setKeystore(WxPayController.class.getResourceAsStream("/证书文件"));
httpConfigStorage.setKeystore(KEYSTORE);
httpConfigStorage.setStorePassword(STORE_PASSWORD);
httpConfigStorage.setStorePassword("ssl 证书对应的密码, 默认为商户号");
//设置ssl证书对应的存储方式这里默认为文件地址
httpConfigStorage.setCertStoreType(CertStoreType.PATH);
}
@@ -97,7 +96,7 @@ public class WxPayController {
*/
@RequestMapping(value = "toPay.html", produces = "text/html;charset=UTF-8")
public String toPay( HttpServletRequest request, BigDecimal price) {
PayOrder order = new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price , UUID.randomUUID().toString().replace("-", ""), WxTransactionType.MWEB);
PayOrder order = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price , UUID.randomUUID().toString().replace("-", ""), WxTransactionType.MWEB);
order.setSpbillCreateIp(request.getHeader("X-Real-IP"));
StringBuffer requestURL = request.getRequestURL();
//设置网页地址
@@ -121,7 +120,7 @@ public class WxPayController {
@RequestMapping(value = "jsapi" )
public Map toPay(String openid, BigDecimal price) {
PayOrder order = new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), WxTransactionType.JSAPI);
PayOrder order = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), WxTransactionType.JSAPI);
order.setOpenid(openid);
Map orderInfo = service.orderInfo(order);
@@ -141,7 +140,7 @@ public class WxPayController {
public Map<String, Object> app() {
Map<String, Object> data = new HashMap<>();
data.put("code", 0);
PayOrder order = new PayOrder("订单title", "摘要", new BigDecimal(0.01), UUID.randomUUID().toString().replace("-", ""));
PayOrder order = new PayOrder("订单title", "摘要", BigDecimal.valueOf(0.01), UUID.randomUUID().toString().replace("-", ""));
//App支付
order.setTransactionType(WxTransactionType.APP);
data.put("orderInfo", service.app(order));
@@ -159,7 +158,7 @@ public class WxPayController {
public byte[] toWxQrPay( BigDecimal price) throws IOException {
//获取对应的支付账户操作工具可根据账户id
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(service.genQrPay( new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, System.currentTimeMillis()+"", WxTransactionType.NATIVE)), "JPEG", baos);
ImageIO.write(service.genQrPay( new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, System.currentTimeMillis()+"", WxTransactionType.NATIVE)), "JPEG", baos);
return baos.toByteArray();
}
@@ -173,7 +172,7 @@ public class WxPayController {
@RequestMapping(value = "getQrPay.json")
public String getQrPay(BigDecimal price) throws IOException {
//获取对应的支付账户操作工具可根据账户id
return service.getQrPay( new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, System.currentTimeMillis()+"", WxTransactionType.NATIVE));
return service.getQrPay( new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, System.currentTimeMillis()+"", WxTransactionType.NATIVE));
}
/**
* 刷卡付,pos主动扫码付款(条码付)
@@ -185,7 +184,7 @@ public class WxPayController {
public Map<String, Object> microPay( BigDecimal price, String authCode) {
//获取对应的支付账户操作工具可根据账户id
//条码付
PayOrder order = new PayOrder("egan order", "egan order", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), WxTransactionType.MICROPAY);
PayOrder order = new PayOrder("egan order", "egan order", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), WxTransactionType.MICROPAY);
//设置授权码,条码等
order.setAuthCode(authCode);
//支付结果
@@ -212,7 +211,7 @@ public class WxPayController {
@RequestMapping(value = "facePay")
public Map<String, Object> facePay(BigDecimal price, String authCode, String openid) {
//获取对应的支付账户操作工具可根据账户id
PayOrder order = new PayOrder("egan order", "egan order", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), WxTransactionType.FACEPAY);
PayOrder order = new PayOrder("egan order", "egan order", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), WxTransactionType.FACEPAY);
//设置人脸凭证
order.setAuthCode(authCode);
// 用户在商户 appid下的唯一标识