mirror of
https://gitee.com/egzosn/pay-java-parent.git
synced 2026-05-19 07:31:36 +08:00
解决支付精度问题
This commit is contained in:
@@ -148,7 +148,7 @@ public class FuiouPayService extends BasePayService {
|
||||
LinkedHashMap<String, Object> parameters = new LinkedHashMap<String, Object>();
|
||||
parameters.put("mchnt_cd", payConfigStorage.getPid());//商户代码
|
||||
parameters.put("order_id", order.getOutTradeNo());//商户订单号
|
||||
parameters.put("order_amt", (int)(order.getPrice().doubleValue() * 100));//交易金额
|
||||
parameters.put("order_amt", order.getPrice().multiply(new BigDecimal(100)).setScale( 0, BigDecimal.ROUND_HALF_UP).intValue());//交易金额
|
||||
// parameters.put("cur_type", null == order.getCurType() ? FuiouCurType.CNY:order.getCurType());//交易币种
|
||||
parameters.put("order_pay_type", order.getTransactionType());//支付类型
|
||||
parameters.put("page_notify_url", payConfigStorage.getReturnUrl());//商户接受支付结果通知地址
|
||||
@@ -452,5 +452,10 @@ public class FuiouPayService extends BasePayService {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
BigDecimal decimal = new BigDecimal(2295.204);
|
||||
System.out.println(decimal.toString());
|
||||
System.out.println(decimal.multiply(new BigDecimal(100)).setScale( 0, BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ public class WxPayService extends BasePayService {
|
||||
parameters.put("body", order.getSubject());// 购买支付信息
|
||||
parameters.put("out_trade_no", order.getOutTradeNo());// 订单号
|
||||
parameters.put("spbill_create_ip", "192.168.1.150");
|
||||
parameters.put("total_fee", order.getPrice().multiply(new BigDecimal(100)).intValue());// 总金额单位为分
|
||||
parameters.put("total_fee", order.getPrice().multiply(new BigDecimal(100)).setScale( 0, BigDecimal.ROUND_HALF_UP).intValue());// 总金额单位为分
|
||||
|
||||
parameters.put("attach", order.getBody());
|
||||
parameters.put("notify_url", payConfigStorage.getNotifyUrl());
|
||||
|
||||
Reference in New Issue
Block a user