|
|
@@ -111,8 +111,6 @@ public class PayPalService{
|
|
|
public Payment createPayment(Long orderId,String successUrl) throws PayPalRESTException {
|
|
|
redisService.set(RedisService.key.ABROAD_SUCCESS_URL.getName() + orderId,successUrl,RedisService.key.ABROAD_SUCCESS_URL.getTimeout());
|
|
|
OrderDon orderDon = orderDonService.getById(orderId);
|
|
|
- BigDecimal money = orderDon.getMoney().divide(new BigDecimal(7),2,RoundingMode.HALF_DOWN);
|
|
|
- //orderDon.setAbroadMoney(money);
|
|
|
orderDon.setType(OrderDon.Type.PAYPAL);
|
|
|
orderDonService.updateById(orderDon);
|
|
|
if (OrderDon.Status.hasPayment.equals(orderDon.getStatus())) {
|
|
|
@@ -139,7 +137,7 @@ public class PayPalService{
|
|
|
Amount amount = new Amount();
|
|
|
amount.setCurrency("USD");
|
|
|
// 支付的总价,paypal会校验 total = subTotal + tax + ...
|
|
|
- BigDecimal totalMoney = money.divide(new BigDecimal(100), 2, RoundingMode.HALF_DOWN);
|
|
|
+ BigDecimal totalMoney = orderDon.getMoney().divide(new BigDecimal(100), 2, RoundingMode.HALF_DOWN);
|
|
|
amount.setTotal(totalMoney.toString());
|
|
|
// 设置各种费用
|
|
|
Details details = new Details();
|
|
|
@@ -186,7 +184,7 @@ public class PayPalService{
|
|
|
|
|
|
|
|
|
public Boolean refund(OrderRefundReq refundReq, OrderDon orderDon) throws PayPalRESTException {
|
|
|
- BigDecimal net = refundReq.getRefundMoney().divide(new BigDecimal(7),2,RoundingMode.HALF_DOWN).subtract(orderDon.getAbroadTransactionFee());;
|
|
|
+ BigDecimal net = refundReq.getRefundMoney().subtract(orderDon.getAbroadTransactionFee());
|
|
|
log.info("paypal return order:{},money:{}",orderDon.getId(),net);
|
|
|
PaypalPayConfig paypalPayConfig = paypalPayConfigService.getById(1);
|
|
|
APIContext apiContext = getAPIContext(paypalPayConfig.getClientId(), paypalPayConfig.getClientSecret(),paypalPayConfig.getMode());
|