Commit 00bdc4d5 by NitefullWind

1. 修复POS传来金额带小数时支付金额错误Bug。

parent 741dc34f
...@@ -170,13 +170,13 @@ void FMPePayPrivate::Init() ...@@ -170,13 +170,13 @@ void FMPePayPrivate::Init()
hash[FMP_EPAY_BUSINESSDATE] = _origin_request[FMP_EPAY_BUSINESSDATE].toVariant(); hash[FMP_EPAY_BUSINESSDATE] = _origin_request[FMP_EPAY_BUSINESSDATE].toVariant();
QJsonObject trans = _origin_request["transactions"].toObject(); QJsonObject trans = _origin_request["transactions"].toObject();
if (_origin_request["fm_cmd"].toInt() == 10031) { if (_origin_request["fm_cmd"].toInt() == 10031) {
hash["amount"] = trans["order_amount"].toInt() - trans["paid_amount"].toInt(); hash["amount"] = (int)(trans["order_amount"].toDouble()+0.005) - (int)(trans["paid_amount"].toDouble()+0.005);
} }
else if (_origin_request["fm_cmd"].toInt() == 10041) { else if (_origin_request["fm_cmd"].toInt() == 10041) {
hash["amount"] = trans["refund_amount"].toVariant(); hash["amount"] = (int)(trans["refund_amount"].toDouble()+0.005);
hash[FMP_JKEY_FM_ORDERID] = trans[FMP_JKEY_FM_ORDERID].toVariant(); hash[FMP_JKEY_FM_ORDERID] = trans[FMP_JKEY_FM_ORDERID].toVariant();
if (trans.contains("refund_amount") && trans["refund_amount"].toInt() != 0 if (trans.contains("refund_amount") && (int)(trans["refund_amount"].toDouble()+0.005) != 0
&& trans.contains(FMP_JKEY_FM_ORDERID) && !trans[FMP_JKEY_FM_ORDERID].toString().isEmpty() && trans.contains(FMP_JKEY_FM_ORDERID) && !trans[FMP_JKEY_FM_ORDERID].toString().isEmpty()
|| trans.contains(FMP_JKEY_PAY_TRANSID) && !trans[FMP_JKEY_PAY_TRANSID].toString().isEmpty()) { || trans.contains(FMP_JKEY_PAY_TRANSID) && !trans[FMP_JKEY_PAY_TRANSID].toString().isEmpty()) {
connect(this, &FMPePayPrivate::finished, this, &FMPePayPrivate::confirmClicked); connect(this, &FMPePayPrivate::finished, this, &FMPePayPrivate::confirmClicked);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment