mirror of
https://gitee.com/egzosn/pay-java-parent.git
synced 2026-05-31 04:49:54 +08:00
代码整理与优化,刷脸支付案例
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original huodull or egan.
|
||||
* Copyright 2017 the original egan
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original huodull or egan.
|
||||
* Copyright 2002-2017 the original egan or egan.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -46,7 +46,7 @@ public class PayOrder {
|
||||
*/
|
||||
private String spbillCreateIp;
|
||||
/**
|
||||
* 付款条码串 与设备号类似???
|
||||
* 付款条码串,人脸凭证,有关支付代码相关的,
|
||||
*/
|
||||
private String authCode;
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original huodull or egan.
|
||||
* Copyright 2002-2017 the original egan or egan.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -136,9 +136,9 @@ public class AliPayController {
|
||||
public Map<String, Object> microPay(BigDecimal price, String authCode) throws IOException {
|
||||
//获取对应的支付账户操作工具(可根据账户id)
|
||||
//条码付
|
||||
PayOrder order = new PayOrder("huodull order", "huodull 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 ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), AliTransactionType.BAR_CODE);
|
||||
//声波付
|
||||
// PayOrder order = new PayOrder("huodull order", "huodull 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 ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), AliTransactionType.WAVE_CODE);
|
||||
//设置授权码,条码等
|
||||
order.setAuthCode(authCode);
|
||||
//支付结果
|
||||
|
||||
@@ -181,7 +181,7 @@ public class PayController {
|
||||
//获取对应的支付账户操作工具(可根据账户id)
|
||||
PayResponse payResponse = service.getPayResponse(payId);
|
||||
|
||||
PayOrder order = new PayOrder("huodull order", "huodull 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 ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType));
|
||||
//设置授权码,条码等
|
||||
order.setAuthCode(authCode);
|
||||
//支付结果
|
||||
|
||||
@@ -167,7 +167,7 @@ public class UnionPayController {
|
||||
public Map<String, Object> microPay(BigDecimal price, String authCode) throws IOException {
|
||||
//获取对应的支付账户操作工具(可根据账户id)
|
||||
//条码付
|
||||
PayOrder order = new PayOrder("huodull order", "huodull order", null == price ? new BigDecimal(0.01) : price, SignUtils.randomStr(), UnionTransactionType.CONSUME);
|
||||
PayOrder order = new PayOrder("egan order", "egan order", null == price ? new BigDecimal(0.01) : price, SignUtils.randomStr(), UnionTransactionType.CONSUME);
|
||||
//设置授权码,条码等
|
||||
order.setAuthCode(authCode);
|
||||
//支付结果
|
||||
|
||||
@@ -182,7 +182,7 @@ public class WxPayController {
|
||||
public Map<String, Object> microPay( BigDecimal price, String authCode) throws IOException {
|
||||
//获取对应的支付账户操作工具(可根据账户id)
|
||||
//条码付
|
||||
PayOrder order = new PayOrder("huodull order", "huodull order", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), WxTransactionType.MICROPAY);
|
||||
PayOrder order = new PayOrder("egan order", "egan order", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), WxTransactionType.MICROPAY);
|
||||
//设置授权码,条码等
|
||||
order.setAuthCode(authCode);
|
||||
//支付结果
|
||||
@@ -199,6 +199,36 @@ public class WxPayController {
|
||||
return params;
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷卡付,pos主动扫码付款(条码付)
|
||||
* @param price 金额
|
||||
* @param authCode 人脸凭证
|
||||
* @param openid 用户在商户 appid下的唯一标识
|
||||
* @return 支付结果
|
||||
*/
|
||||
@RequestMapping(value = "facePay")
|
||||
public Map<String, Object> facePay(BigDecimal price, String authCode, String openid) throws IOException {
|
||||
//获取对应的支付账户操作工具(可根据账户id)
|
||||
//条码付
|
||||
PayOrder order = new PayOrder("egan order", "egan order", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), WxTransactionType.MICROPAY);
|
||||
//设置授权码,条码等
|
||||
order.setAuthCode(authCode);
|
||||
order.setOpenid(openid);
|
||||
|
||||
//支付结果
|
||||
Map<String, Object> params = service.microPay(order);
|
||||
//校验
|
||||
if (service.verify(params)) {
|
||||
|
||||
//支付校验通过后的处理
|
||||
//......业务逻辑处理块........
|
||||
|
||||
|
||||
}
|
||||
//这里开发者自行处理
|
||||
return params;
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付回调地址 方式一
|
||||
*
|
||||
|
||||
@@ -102,7 +102,7 @@ public class ApyAccountRepository {
|
||||
ApyAccount apyAccount5 = new ApyAccount();
|
||||
apyAccount5.setPayId(5);
|
||||
apyAccount5.setPartner("100086190");//Program ID
|
||||
apyAccount5.setSeller("Huodull6190");//Username
|
||||
apyAccount5.setSeller("egan6190");//Username
|
||||
apyAccount5.setStorePassword("12BkDT8152Zj");//API password
|
||||
apyAccount5.setInputCharset("UTF-8");
|
||||
apyAccount5.setPayType(PayType.payoneer);
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.egzosn.pay.common.bean.CertStoreType;
|
||||
import com.egzosn.pay.common.bean.MsgType;
|
||||
import com.egzosn.pay.common.bean.TransactionType;
|
||||
import com.egzosn.pay.common.http.HttpConfigStorage;
|
||||
import com.egzosn.pay.demo.service.handler.WxPayMessageHandler;
|
||||
import com.egzosn.pay.fuiou.api.FuiouPayConfigStorage;
|
||||
import com.egzosn.pay.fuiou.api.FuiouPayService;
|
||||
import com.egzosn.pay.fuiou.bean.FuiouTransactionType;
|
||||
@@ -107,7 +108,9 @@ public enum PayType implements BasePayType {
|
||||
//设置ssl证书对应的存储方式,这里默认为文件地址
|
||||
httpConfigStorage.setCertStoreType(CertStoreType.PATH);
|
||||
return new WxPayService(wxPayConfigStorage, httpConfigStorage);*/
|
||||
return new WxPayService(wxPayConfigStorage);
|
||||
WxPayService wxPayService = new WxPayService(wxPayConfigStorage);
|
||||
wxPayService.setPayMessageHandler(new WxPayMessageHandler(1));
|
||||
return wxPayService;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -68,7 +68,7 @@ public class PayResponse {
|
||||
// //代理密码
|
||||
// httpConfigStorage.setHttpProxyPassword("password");
|
||||
//设置ssl证书路径 https证书设置 方式二
|
||||
httpConfigStorage.setKeystorePath(apyAccount.getKeystorePath());
|
||||
httpConfigStorage.setKeystore(apyAccount.getKeystorePath());
|
||||
//设置ssl证书对应的密码
|
||||
httpConfigStorage.setStorePassword(apyAccount.getStorePassword());
|
||||
return httpConfigStorage;
|
||||
|
||||
@@ -36,7 +36,7 @@ public class PayTest {
|
||||
|
||||
if (1==1){
|
||||
|
||||
String auth = Base64.encode("Huodull6190:12BkDT8152Zj".getBytes());
|
||||
String auth = Base64.encode("egan6190:12BkDT8152Zj".getBytes());
|
||||
System.out.println(auth);
|
||||
return;
|
||||
}
|
||||
@@ -49,7 +49,7 @@ public class PayTest {
|
||||
CredentialsProvider credsProvider = new BasicCredentialsProvider();
|
||||
credsProvider.setCredentials(
|
||||
new AuthScope(uri.getHost(), uri.getPort()),
|
||||
new UsernamePasswordCredentials("Huodull6190", "12BkDT8152Zj"));
|
||||
new UsernamePasswordCredentials("egan6190", "12BkDT8152Zj"));
|
||||
|
||||
CloseableHttpClient httpclient = HttpClients.custom()
|
||||
.setDefaultCredentialsProvider(credsProvider)
|
||||
@@ -73,7 +73,7 @@ public class PayTest {
|
||||
|
||||
// PayoneerRequestBean bean = new PayoneerRequestBean("666");
|
||||
String referenceId = UUID.randomUUID().toString().replace("-", "");
|
||||
PayoneerRequestBean bean = new PayoneerRequestBean("8a2950f959043699015904453b330057","1.01", referenceId, CurType.USD,"huodull order");
|
||||
PayoneerRequestBean bean = new PayoneerRequestBean("8a2950f959043699015904453b330057","1.01", referenceId, CurType.USD,"egan order");
|
||||
// PayoneerRequestBean bean = JSON.parseObject("{\"amount\":\"1.00\",\"client_reference_id\":\""+ System.nanoTime()+"\",\"currency\":\"USD\",\"description\":\"aaabb\",\"payee_id\":\"asdfg13\"}", PayoneerRequestBean.class);
|
||||
System.out.println(JSON.toJSONString(bean));
|
||||
StringEntity entity = new StringEntity(JSON.toJSONString(bean), ContentType.APPLICATION_JSON);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original huodull or egan.
|
||||
* Copyright 2002-2017 the original egan or egan.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
Reference in New Issue
Block a user