mirror of
https://gitee.com/egzosn/pay-java-parent.git
synced 2026-05-22 09:26:54 +08:00
发起支付简化交易类型,方法能够确定交易类型的全部以方法为基准,如果自行设置了但发现不一样就报错提示
This commit is contained in:
@@ -379,6 +379,18 @@ public class UnionPayService extends BasePayService<UnionPayConfigStorage> {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toPay(PayOrder order) {
|
||||
|
||||
if (null == order.getTransactionType()){
|
||||
order.setTransactionType(UnionTransactionType.WEB);
|
||||
}else if (UnionTransactionType.WEB != order.getTransactionType() && UnionTransactionType.WAP != order.getTransactionType() && UnionTransactionType.B2B != order.getTransactionType()){
|
||||
throw new PayErrorException(new PayException("-1", "错误的交易类型:" + order.getTransactionType()));
|
||||
}
|
||||
|
||||
return super.toPay(order);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取输出二维码,用户返回给支付端,
|
||||
*
|
||||
@@ -387,6 +399,7 @@ public class UnionPayService extends BasePayService<UnionPayConfigStorage> {
|
||||
*/
|
||||
@Override
|
||||
public String getQrPay(PayOrder order) {
|
||||
order.setTransactionType(UnionTransactionType.APPLY_QR_CODE);
|
||||
Map<String, Object> params = orderInfo(order);
|
||||
String responseStr = getHttpRequestTemplate().postForObject(this.getBackTransUrl(), params, String.class);
|
||||
Map<String, Object> response = UriVariables.getParametersToMap(responseStr);
|
||||
@@ -411,6 +424,7 @@ public class UnionPayService extends BasePayService<UnionPayConfigStorage> {
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> microPay(PayOrder order) {
|
||||
order.setTransactionType(UnionTransactionType.CONSUME);
|
||||
Map<String, Object> params = orderInfo(order);
|
||||
String responseStr = getHttpRequestTemplate().postForObject(this.getBackTransUrl(), params, String.class);
|
||||
return UriVariables.getParametersToMap(responseStr);
|
||||
|
||||
Reference in New Issue
Block a user