alipay-hk 切换到live环境

This commit is contained in:
2024-05-23 15:48:55 +08:00
parent 5318e5d32a
commit 5ebf0669f5
11 changed files with 68 additions and 19 deletions

View File

@@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDD+NUduhLJcb2Z
ryLwtIHdmjfh6Wn73E9umHmdPf6yF7IbDoTDBmIAfaPU/oiLgrka3fKGCkn/yHvW
QcL+Ry96/Uu+iIN9SbG5vPVvLtLfx+5++IE8p3RxcSDQggqFuJ+osebXeVIrOcTZ
s7nXCqGenTcagv2eJESiq712fcBvY1wVgilT6ERVQy+zdvwAOiS6wXF/51AueP+E
rNDHuPLkGH6JhLtO4LffeYgM/Th7eCl/WWLkiVMSoeJt7vWFe4bYV/IYW1qI2aQX
H1DYmvwgDfDv8jRORD9D191YBqq1l3Tw7VSjFrpydFvSK46dbXKBj3oA5ZiJ+Ttj
ZCtBRiOdAgMBAAECggEAUKl4Fs9C8lV1o+85Y3f4yBy1CbCIZhltPGlYDUe6MNWe
ApL8REW5Sthr+bx2uW2qAQv/yfosMTL0/eB9gSoNugLODXOlI4mUtI25O/U66M8j
NHHWx/9o51SYHBqaeCXg2Y+4I1KVZqNVigH26TNACMhPKQNnnpLxCT/FMSNbdLzo
wfFMyjN7R3Hc8ZB1C2zx+fLJm1DNZeOJOHAkW1LprlotRv6eq3lOwZaDDUTB5xhT
0Erev3djC/R08Fne1y09ukar8z0tX3Fm9SzHJDFVoh1HOYPWayCiAxOhip+JnFct
rtK5jjuB8DAP4Q1k12yOWUFwb6NOG9Hf/G6XExRPBQKBgQD1P2SnKD1IlNSrvVJn
2HzKnBVllVo50fbv7SpnP8H1B5vt2Qo/mgOGtzbeXyK4mcLFaWg9++BrsjTXwZFi
wmKeJgNI822DPhF5qQhK7Cc+WMwesufGrTnmRUOEFYehz9ffZBvMa1s/ObIEyLcr
tYitT74+nFdRPtr+8PN06QMEcwKBgQDMkGFW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aiNmkFx9Q2Jr8
IA3w7/I0TkQ/Q9fdWAaqtZd08O1Uoxa6cnRb0iuOnW1ygY96AOWYifk7Y2QrQUYj
nQIDAQAB
-----END PUBLIC KEY-----

View File

@@ -34,7 +34,8 @@ public class AlipayHKRequestUtil {
RequestBody body = RequestBody.create(mediaType, jsonString);
Request request = new Request.Builder()
.url("https://aqs-api.sandbox-codpayment.com/v1/service")
// .url("https://aqs-api.sandbox-codpayment.com/v1/service")
.url("https://aqs-api.codpayment.com/v1/service")
.method("POST", body)
.addHeader("Content-Type", "application/json;charset=utf-8")
.build();

View File

@@ -15,7 +15,7 @@ public class OrderInfo extends BaseEntity{
private Long productId;//支付产品id
private Integer totalFee;//订单金额(元)
private Float totalFee;//订单金额(元)
private String codeUrl;//订单二维码连接

View File

@@ -9,7 +9,8 @@ public class Product extends BaseEntity{
private String title; //商品名称
private Integer price; //价格(分)
// private Integer price; //价格(分)
private Float price; //价格(元)
private Integer credits; // 积分
}

View File

@@ -13,9 +13,11 @@ public class RefundInfo extends BaseEntity{
private String refundId;//支付系统退款单号(微信)
private Integer totalFee;//原订单金额(分)
// private Integer totalFee;//原订单金额(分)
private Float totalFee;//原订单金额(分)
private Integer refund;//退款金额(分)
// private Integer refund;//退款金额(分)
private Float refund;//退款金额(分)
private String reason;//退款原因

View File

@@ -318,7 +318,7 @@ public class AliPayServiceImpl implements AliPayService {
CreditsEventsEnum.BUY_CREDITS.getValue(),
"positive");
// 更新积分
creditsService.buyCredits(orderByOrderNo.getAccountId(),orderByOrderNo.getTotalFee() / Integer.parseInt(CreditsEventsEnum.PRICE.getValue()));
creditsService.buyCredits(orderByOrderNo.getAccountId(),(int)(orderByOrderNo.getTotalFee() / Float.parseFloat(CreditsEventsEnum.PRICE.getValue())));
}
}
@@ -390,7 +390,8 @@ public class AliPayServiceImpl implements AliPayService {
AliPayTradeStateEnum.REFUND_SUCCESS.getType()); //退款成功
// 更新积分状态
OrderInfo orderByOrderNo = orderInfoService.getOrderByOrderNo(orderNo);
creditsService.creditsRefund(orderByOrderNo.getAccountId(), orderByOrderNo.getTotalFee() / Integer.parseInt(CreditsEventsEnum.PRICE.getValue()));
// creditsService.creditsRefund(orderByOrderNo.getAccountId(), orderByOrderNo.getTotalFee() / Integer.parseInt(CreditsEventsEnum.PRICE.getValue()));
creditsService.creditsRefund(orderByOrderNo.getAccountId(), (int)(orderByOrderNo.getTotalFee() / Float.parseFloat(CreditsEventsEnum.PRICE.getValue())));
} else {
log.info("调用失败,返回码 ===> " + response.getCode() + ", 返回描述 ===> " + response.getMsg());

View File

@@ -21,12 +21,12 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.locks.ReentrantLock;
@Service
@@ -70,7 +70,7 @@ public class AlipayHKServiceImpl implements AlipayHKService {
HashMap<String, Object> param = new HashMap<>();
String orderRef = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
param.put("order_ref", orderRef);
param.put("amount", Integer.parseInt(CreditsEventsEnum.PRICE.getValue()) * amount);
param.put("amount", Float.parseFloat(CreditsEventsEnum.PRICE.getValue()) * amount);
param.put("subject", "AiDA Credits Purchase");
// ALIPAYHK 或者 ALIPAYCN
param.put("wallet", wallet);
@@ -147,7 +147,7 @@ public class AlipayHKServiceImpl implements AlipayHKService {
//2 判断 total_amount 是否确实为该订单的实际金额(即商户订单创建时的金额)
Long totalAmount = alipayHKCallbackDTO.getAmount();
Long totalFee = order.getTotalFee().longValue();
if(totalAmount != totalFee){
if(!Objects.equals(totalAmount, totalFee)){
log.error("金额校验失败");
return result;
}

View File

@@ -54,7 +54,8 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
orderInfo.setTitle("积分购买 X" + amount );
orderInfo.setOrderNo(OrderNoUtils.getOrderNo()); //订单号 ??
// orderInfo.setProductId(amount);
orderInfo.setTotalFee(Integer.parseInt(CreditsEventsEnum.PRICE.getValue()) * amount); // 元 HKD
// orderInfo.setTotalFee(Integer.parseInt(CreditsEventsEnum.PRICE.getValue()) * amount); // 元 HKD
orderInfo.setTotalFee(Float.parseFloat(CreditsEventsEnum.PRICE.getValue()) * amount); // 元 HKD
orderInfo.setOrderStatus(OrderStatusEnum.NOT_PAY.getType()); //未支付
orderInfo.setPaymentType(paymentType);
baseMapper.insert(orderInfo);

View File

@@ -486,7 +486,8 @@ public class PayPalCheckoutServiceImpl implements PayPalCheckoutService {
// 更新积分状态
OrderInfo orderByOrderNo = orderInfoService.getOrderByOrderNo(orderId);
creditsService.creditsRefund(orderByOrderNo.getAccountId(), orderByOrderNo.getTotalFee() / Integer.parseInt(CreditsEventsEnum.PRICE.getValue()));
// creditsService.creditsRefund(orderByOrderNo.getAccountId(), orderByOrderNo.getTotalFee() / Integer.parseInt(CreditsEventsEnum.PRICE.getValue()));
creditsService.creditsRefund(orderByOrderNo.getAccountId(), (int)(orderByOrderNo.getTotalFee() / Float.parseFloat(CreditsEventsEnum.PRICE.getValue())));
log.info("退款成功");
result = Boolean.TRUE;
} else {
@@ -591,7 +592,7 @@ public class PayPalCheckoutServiceImpl implements PayPalCheckoutService {
CreditsEventsEnum.BUY_CREDITS.getValue(),
"positive");
// 更新积分
creditsService.buyCredits(orderInfo.getAccountId(), orderInfo.getTotalFee() / Integer.parseInt(CreditsEventsEnum.PRICE.getValue()));
creditsService.buyCredits(orderInfo.getAccountId(), (int)(orderInfo.getTotalFee() / Float.parseFloat(CreditsEventsEnum.PRICE.getValue())));
}
}
@@ -633,7 +634,8 @@ public class PayPalCheckoutServiceImpl implements PayPalCheckoutService {
CreditsEventsEnum.BUY_CREDITS.getValue(),
"positive");
// 更新积分
creditsService.buyCredits(orderByOrderNo.getAccountId(),orderByOrderNo.getTotalFee() / Integer.parseInt(CreditsEventsEnum.PRICE.getValue()));
// creditsService.buyCredits(orderByOrderNo.getAccountId(),orderByOrderNo.getTotalFee() / Integer.parseInt(CreditsEventsEnum.PRICE.getValue()));
creditsService.buyCredits(orderByOrderNo.getAccountId(),(int)(orderByOrderNo.getTotalFee() / Float.parseFloat(CreditsEventsEnum.PRICE.getValue())));
}
}

View File

@@ -34,11 +34,15 @@ alipay.notify-url=http://18.167.251.121:10090/api/ali-pay/trade/notify
#alipay.notify-url=https://3b38-18-167-251-121.ngrok-free.app/api/ali-pay/trade/notify
alipayHK.merchantId=3015240422190522
alipayHK.segmentId=2971373831
alipayHK.AESKey=UzRC2CncDUP6VlEd
alipayHK.rsaPrivateKey=files/CODE-CREATE LIMITED-3015240422190522-merchant.private.key.txt
alipayHK.rsaPublicKey=files/CODE-CREATE LIMITED.merchant.aqs.public.key.pem
#alipayHK.merchantId=3015240422190522
#alipayHK.segmentId=2971373831
#alipayHK.AESKey=UzRC2CncDUP6VlEd
alipayHK.merchantId=2088841167357411
alipayHK.segmentId=1771653121
alipayHK.AESKey=uTEbeOZBgXKbSqGz
alipayHK.rsaPrivateKey=files/Code-Create Limited-2088841167357411-merchant.private.key.txt
alipayHK.rsaPublicKey=files/Code-Create Limited.merchant.aqs.public.key.pem
alipayHK.api.url=https://aqs-api.sandbox-codpayment.com/