Openbravo Issue Tracking System - Retail Modules | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0039103 | Retail Modules | Web POS | public | 2018-08-08 12:42 | 2019-01-28 18:33 |
Reporter | gorkaion | ||||
Assigned To | rqueralta | ||||
Priority | urgent | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | OS | 5 | OS Version | ||
Product Version | |||||
Target Version | Fixed in Version | RR18Q4 | |||
Merge Request Status | |||||
Review Assigned To | marvintm | ||||
OBNetwork customer | |||||
Support ticket | |||||
Regression level | |||||
Regression date | |||||
Regression introduced in release | |||||
Regression introduced by commit | |||||
Triggers an Emergency Pack | No | ||||
Summary | 0039103: Wrong payment amoutns when there are payments in different currencies | ||||
Description | On an order with 3 different payments: 1st non cash payment (credit card for example) 2nd foreign cash payment. 3rd store currency cash payment. The third payment generates a change amount. If the change amount converted to the foreign cash is zero the original amount of the 2nd cash payments is reduced by the change amount. This results on payments for less amount of the order gross. When the payment is synchronized to the backend the difference in the amount is added to the 1st payment. | ||||
Steps To Reproduce | Create a store using AED currency. Ensure that credit card and cash financial accounts are in AED. Set a conversion rate to USD so 3.6USD are 1EUR. Ensure that there is cash to return change in AED. Create a ticket for a total amount of 552.78AED. Add a card payment of 100AED Add a USD Cash payment of 100 USD -> converted to 360AED Add a cash payment of 92.79AED The total amount paid is 552.79AED so a change of 0.01AED is required. Click on Done button. Notice that the amounts of the payments are changed to: USD Cash payment -> 100USD (359.99AED) Cash Payment -> 92.78 Go to backend and check the payment details of the order, the amounts are: Credit card: 100.01 USD Cash 359.99 Cash: 92.78 The credit card and USD cash amounts are wrong. | ||||
Proposed Solution | The issue is in the following lines of hte adjustPayments: p.set('origAmount', OB.DEC.mul(p.get('amount'), p.get('rate'))); //Here we are trying to know if the current payment is making the pending to pay 0. //to know that we are suming up every payments except the current one (getSumOfOrigAmounts) //then we substract this amount from the total (getDifferenceBetweenPaymentsAndTotal) //and finally we transform this difference to the foreign amount //if the payment in the foreign amount makes pending to pay zero, then we will ensure that the payment //in the default currency is satisfied if (OB.DEC.compare(OB.DEC.sub(this.getDifferenceRemovingSpecificPayment(p), OB.DEC.abs(p.get('amount')))) === OB.DEC.Zero) { multiCurrencyDifference = this.getDifferenceBetweenPaymentsAndTotal(p); if (OB.DEC.abs(p.get('origAmount')) !== OB.DEC.abs(multiCurrencyDifference)) { p.set('origAmount', multiCurrencyDifference); } } The this.getDifferenceRemovingSpecificPayment(p) method for the USD cash is returning 100USD as it is the rounded conversion of 359.99 to USD. If the change amount is higher the method does not return 100 and the payment is not modified. | ||||
Additional Information | |||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | wrong-payments.json (18,692) 2018-08-08 12:43 https://issues.openbravo.com/file_download.php?file_id=12039&type=bug | ||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2018-08-08 12:42 | gorkaion | New Issue | |||
2018-08-08 12:42 | gorkaion | Assigned To | => Retail | ||
2018-08-08 12:42 | gorkaion | Resolution time | => 1535493600 | ||
2018-08-08 12:42 | gorkaion | Triggers an Emergency Pack | => No | ||
2018-08-08 12:43 | gorkaion | File Added: wrong-payments.json | |||
2018-08-08 12:45 | gorkaion | Note Added: 0106193 | |||
2018-08-09 14:45 | rqueralta | Assigned To | Retail => rqueralta | ||
2018-08-09 14:46 | rqueralta | Status | new => scheduled | ||
2018-08-15 21:12 | hgbot | Checkin | |||
2018-08-15 21:12 | hgbot | Note Added: 0106356 | |||
2018-08-15 21:12 | hgbot | Status | scheduled => resolved | ||
2018-08-15 21:12 | hgbot | Resolution | open => fixed | ||
2018-08-15 21:12 | hgbot | Fixed in SCM revision | => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/8374a14c75162946681011922a7bcc6557014f0b [^] | ||
2018-08-23 11:55 | marvintm | Review Assigned To | => marvintm | ||
2018-08-23 11:55 | marvintm | Status | resolved => closed | ||
2018-08-23 11:55 | marvintm | Fixed in Version | => RR18Q4 | ||
2018-11-13 15:54 | hgbot | Checkin | |||
2018-11-13 15:54 | hgbot | Note Added: 0107888 | |||
2019-01-10 14:00 | hgbot | Checkin | |||
2019-01-10 14:00 | hgbot | Note Added: 0108894 | |||
2019-01-28 18:33 | hgbot | Checkin | |||
2019-01-28 18:33 | hgbot | Note Added: 0109285 |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|