Project:
View Issue Details[ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||||||
ID | ||||||||||||
0037812 | ||||||||||||
Type | Category | Severity | Reproducibility | Date Submitted | Last Update | |||||||
defect | [Retail Modules] Return Receipt | minor | have not tried | 2018-02-01 17:34 | 2023-07-11 08:50 | |||||||
Reporter | plujan | View Status | public | |||||||||
Assigned To | Retail | |||||||||||
Priority | normal | Resolution | open | Fixed in Version | ||||||||
Status | scheduled | Fix in branch | Fixed in SCM revision | |||||||||
Projection | none | ETA | none | Target Version | ||||||||
OS | Any | Database | Any | Java version | ||||||||
OS Version | Database version | Ant version | ||||||||||
Product Version | SCM revision | |||||||||||
Review Assigned To | ||||||||||||
Regression level | ||||||||||||
Regression date | ||||||||||||
Regression introduced in release | main | |||||||||||
Regression introduced by commit | ||||||||||||
Triggers an Emergency Pack | No | |||||||||||
Summary | 0037812: [RR18q1] Potential functional loop with returns and multiple currencies | |||||||||||
Description | In case the terminal accepts multiple currencies, it might happen that a return could not be completed if there is not enough cash in one currency to the whole return. See steps. | |||||||||||
Steps To Reproduce | 1. Use a terminal with no cash (i.e. keeping 0 for everything after a recent cashup) 2. Create a ticket by adding the Camping Pack, for a total of 385€ 3. Pay 200 USD and 232.84 EUR 4. Now select the option "Verified Returns" and seek for the ticket created above. 5. Click the total amount to return the money. Since there is no enough money in the drawer to return 385€, a message saying that there is not enough cash is shown. Neither I can return the money the customer gave me (Warning message "Solve first payments issues to add more payments"). Neither I can return USA Cash since I do not have enough to return the total amount, even I should be able to return to the customer 200 USD and 232.84 EUR | |||||||||||
Tags | No tags attached. | |||||||||||
Attached Files | issue 37812 source posterminal.patch [^] (25,671 bytes) 2018-03-28 08:14 [Show Content] [Hide Content]# HG changeset patch # User Ranjith S R <ranjith@qualiantech.com> # Date 1522217513 -19800 # Wed Mar 28 11:41:53 2018 +0530 # Node ID 9e7064168d63ab317cd47a612b7b7dfdba0a7ff5 # Parent 5348d4e8468ad80a86af03633b1ab88a370a89f6 Related to issue 37812 : Payment should be allowed based on cash available instead of receipt pending amount * Refactored checkEnoughCashAvailable, Moved the validation from view to modal * Before adding payments, checkEnoughCashAvailable should be called to ensure cash is available diff -r 5348d4e8468a -r 9e7064168d63 web/org.openbravo.retail.posterminal/js/model/order.js --- a/web/org.openbravo.retail.posterminal/js/model/order.js Tue Mar 27 18:15:39 2018 -0400 +++ b/web/org.openbravo.retail.posterminal/js/model/order.js Wed Mar 28 11:41:53 2018 +0530 @@ -4146,6 +4146,129 @@ return differenceInDefaultCurrency; } }, + checkEnoughCashAvailable: function (paymentStatus, selectedPayment, button, cashAvailable, enoughCashCallback) { + var requiredCash, reversedCash, hasEnoughCash = true, + hasAllEnoughCash = true, + reversedPayments = [], + currentSelectedPaymentCashAmount = OB.DEC.Zero; + + requiredCash = cashAvailable || OB.DEC.Zero; + + function processCashMgmtMaster(cashMgntCallback) { + new OB.DS.Process('org.openbravo.retail.posterminal.ProcessCashMgmtMaster').exec({ + cashUpId: OB.POS.modelterminal.get('terminal').cashUpId, + terminalSlave: OB.POS.modelterminal.get('terminal').isslave + }, function (data) { + if (data && data.exception) { + // Error handler + OB.log('error', data.exception.message); + OB.UTIL.showConfirmation.display( + OB.I18N.getLabel('OBPOS_CashMgmtError'), OB.I18N.getLabel('OBPOS_ErrorServerGeneric') + data.exception.message, [{ + label: OB.I18N.getLabel('OBPOS_LblRetry'), + action: function () { + processCashMgmtMaster(cashMgntCallback); + } + }], { + autoDismiss: false, + onHideFunction: function () { + cashMgntCallback(false, null); + } + }); + } else { + cashMgntCallback(true, data); + } + }); + } + + function checkSlaveCashAvailable(slaveCashCallback) { + var currentCash = OB.DEC.Zero; + if (selectedPayment && selectedPayment.paymentMethod.iscash) { + currentCash = selectedPayment.currentCash || OB.DEC.Zero; + } + if ((OB.POS.modelterminal.get('terminal').ismaster || OB.POS.modelterminal.get('terminal').isslave) && selectedPayment.paymentMethod.iscash && selectedPayment.paymentMethod.isshared) { + // Load current cashup info from slaves + processCashMgmtMaster(function (success, data) { + if (success) { + _.each(data, function (pay) { + if (pay.searchKey === selectedPayment.payment.searchKey) { + currentCash = OB.DEC.add(currentCash, pay.startingCash + pay.totalDeposits + pay.totalSales - pay.totalReturns - pay.totalDrops); + } + }); + } + slaveCashCallback(currentCash); + }); + } else { + slaveCashCallback(currentCash); + } + } + + checkSlaveCashAvailable(function (currentCash) { + // If there are reverse payments search for those of cash payment method. It will be needed to check if there is enough cash to reverse those payments. + if (paymentStatus.isReversal) { + paymentStatus.payments.each(function (payment) { + var paymentmethod = OB.POS.terminal.terminal.paymentnames[payment.get('kind')]; + if (!payment.get('isPrePayment') && paymentmethod.paymentMethod.iscash) { + reversedCash = OB.DEC.sub(reversedPayments[payment.get('kind')] || OB.DEC.Zero, payment.get('origAmount')); + reversedPayments[payment.get('kind')] = reversedCash; + if (selectedPayment !== paymentmethod && OB.DEC.compare(OB.DEC.sub(paymentmethod.currentCash, reversedCash)) < 0) { + hasEnoughCash = false; + } else { + currentSelectedPaymentCashAmount = reversedCash; + } + } + }); + } + + if (hasEnoughCash) { + if (OB.UTIL.isNullOrUndefined(selectedPayment) || !selectedPayment.paymentMethod.iscash) { + requiredCash = OB.DEC.Zero; + } else if ((button === 'Done' || button === 'Credit') && !_.isUndefined(paymentStatus) && (paymentStatus.isNegative)) { + requiredCash = OB.DEC.add(currentSelectedPaymentCashAmount, paymentStatus.pendingAmt); + paymentStatus.payments.each(function (payment) { + var paymentmethod; + if (payment.get('kind') === selectedPayment.payment.searchKey && !payment.get('isPrePayment') && !payment.get('reversedPaymentId')) { + requiredCash = OB.DEC.add(requiredCash, payment.get('origAmount')); + } else { + paymentmethod = OB.POS.terminal.terminal.paymentnames[payment.get('kind')]; + if (paymentmethod && payment.get('origAmount') > paymentmethod.currentCash && payment.get('isCash')) { + hasAllEnoughCash = false; + } + } + }); + } else if (button === 'AddPayment' && !_.isUndefined(paymentStatus) && (paymentStatus.isNegative)) { + paymentStatus.payments.each(function (payment) { + var paymentmethod; + if (payment.get('kind') === selectedPayment.payment.searchKey && !payment.get('isPrePayment') && !payment.get('reversedPaymentId')) { + requiredCash = OB.DEC.add(requiredCash, payment.get('origAmount')); + } else { + paymentmethod = OB.POS.terminal.terminal.paymentnames[payment.get('kind')]; + if (paymentmethod && payment.get('origAmount') > paymentmethod.currentCash && payment.get('isCash')) { + hasAllEnoughCash = false; + } + } + }); + } else if (!_.isUndefined(paymentStatus)) { + if (button === 'Layaway' || button === 'Credit') { + requiredCash = OB.DEC.add(currentSelectedPaymentCashAmount, paymentStatus.changeAmt); + } else { + requiredCash = OB.DEC.sub(OB.DEC.add(currentSelectedPaymentCashAmount, paymentStatus.changeAmt), paymentStatus.pendingAmt); + } + } + + if (!_.isUndefined(requiredCash) && requiredCash === 0) { + hasEnoughCash = true; + } else if (!_.isUndefined(requiredCash)) { + hasEnoughCash = OB.DEC.compare(OB.DEC.sub(currentCash, requiredCash)) >= 0; + } + } + + if (hasEnoughCash && ((button === 'Layaway' || button === 'Credit') || ((button === 'Done' || button === 'AddPayment') && hasAllEnoughCash))) { + return enoughCashCallback(true); + } else { + return enoughCashCallback(false); // check failed. + } + }); + }, adjustPayment: function () { var i, max, p; var payments = this.get('payments'); @@ -4263,8 +4386,7 @@ }, addPayment: function (payment, callback) { - var payments, total; - var i, max, p, order; + var i, max, p, order, payments, total; if (this.get('isPaid') && !payment.get('isReversePayment') && !this.get('doCancelAndReplace') && this.getPrePaymentQty() === OB.DEC.sub(this.getTotal(), this.getCredit()) && !this.isNewReversed()) { OB.UTIL.showWarning(OB.I18N.getLabel('OBPOS_CannotIntroducePayment')); @@ -4290,98 +4412,112 @@ return; } - payments = this.get('payments'); - total = OB.DEC.abs(this.getTotal()); - OB.UTIL.HookManager.executeHooks('OBPOS_preAddPayment', { - paymentToAdd: payment, - payments: payments, - receipt: this, - callback: callback - }, function (args) { - var executeFinalCallback = function (saveChanges) { - if (saveChanges) { - order.adjustPayment(); - order.trigger('displayTotal'); - order.save(); - order.trigger('saveCurrent'); + function addPaymentToOrder() { + payments = order.get('payments'); + total = OB.DEC.abs(order.getTotal()); + OB.UTIL.HookManager.executeHooks('OBPOS_preAddPayment', { + paymentToAdd: payment, + payments: payments, + receipt: order, + callback: callback + }, function (args) { + var executeFinalCallback = function (saveChanges) { + if (saveChanges) { + order.adjustPayment(); + order.trigger('displayTotal'); + order.save(); + order.trigger('saveCurrent'); + } + OB.UTIL.HookManager.executeHooks('OBPOS_postAddPayment', { + paymentAdded: payment, + payments: payments, + receipt: order, + callback: callback + }, function (args) { + if (args.callback instanceof Function) { + args.callback(order); + } + }); + }; + + if (args && args.cancellation) { + if (payment.get('reverseCallback')) { + var reverseCallback = payment.get('reverseCallback'); + reverseCallback(); } - OB.UTIL.HookManager.executeHooks('OBPOS_postAddPayment', { - paymentAdded: payment, - payments: payments, - receipt: order, - callback: callback - }, function (args) { - if (args.callback instanceof Function) { - args.callback(order); - } - }); - }; - - if (args && args.cancellation) { - if (payment.get('reverseCallback')) { - var reverseCallback = payment.get('reverseCallback'); - reverseCallback(); + executeFinalCallback(false); + return; } - executeFinalCallback(false); - return; - } - // search for an existing payment only if is not a reverser payment. - if (!payment.get('reversedPaymentId')) { - if (!payment.get('paymentData')) { - // search for an existing payment only if there is not paymentData info or if there is, when there is any other paymentData with same groupingCriteria. - // this avoids to merge for example card payments of different cards. - for (i = 0, max = payments.length; i < max; i++) { - p = payments.at(i); - if (p.get('kind') === payment.get('kind') && !p.get('isPrePayment') && !p.get('reversedPaymentId')) { - p.set('amount', OB.DEC.add(payment.get('amount'), p.get('amount'))); - if (p.get('rate') && p.get('rate') !== '1') { - p.set('origAmount', OB.DEC.add(payment.get('origAmount'), OB.DEC.mul(p.get('origAmount'), p.get('rate')))); + // search for an existing payment only if is not a reverser payment. + if (!payment.get('reversedPaymentId')) { + if (!payment.get('paymentData')) { + // search for an existing payment only if there is not paymentData info or if there is, when there is any other paymentData with same groupingCriteria. + // this avoids to merge for example card payments of different cards. + for (i = 0, max = payments.length; i < max; i++) { + p = payments.at(i); + if (p.get('kind') === payment.get('kind') && !p.get('isPrePayment') && !p.get('reversedPaymentId')) { + p.set('amount', OB.DEC.add(payment.get('amount'), p.get('amount'))); + if (p.get('rate') && p.get('rate') !== '1') { + p.set('origAmount', OB.DEC.add(payment.get('origAmount'), OB.DEC.mul(p.get('origAmount'), p.get('rate')))); + } + payment.set('date', new Date()); + executeFinalCallback(true); + return; } - payment.set('date', new Date()); - executeFinalCallback(true); - return; } - } - } else { - for (i = 0, max = payments.length; i < max; i++) { - p = payments.at(i); - if (p.get('kind') === payment.get('kind') && p.get('paymentData') && payment.get('paymentData') && p.get('paymentData').groupingCriteria && payment.get('paymentData').groupingCriteria && p.get('paymentData').groupingCriteria === payment.get('paymentData').groupingCriteria && !p.get('reversedPaymentId') && !p.get('isPrePayment')) { - p.set('amount', OB.DEC.add(payment.get('amount'), p.get('amount'))); - if (p.get('rate') && p.get('rate') !== '1') { - p.set('origAmount', OB.DEC.add(payment.get('origAmount'), OB.DEC.mul(p.get('origAmount'), p.get('rate')))); + } else { + for (i = 0, max = payments.length; i < max; i++) { + p = payments.at(i); + if (p.get('kind') === payment.get('kind') && p.get('paymentData') && payment.get('paymentData') && p.get('paymentData').groupingCriteria && payment.get('paymentData').groupingCriteria && p.get('paymentData').groupingCriteria === payment.get('paymentData').groupingCriteria && !p.get('reversedPaymentId') && !p.get('isPrePayment')) { + p.set('amount', OB.DEC.add(payment.get('amount'), p.get('amount'))); + if (p.get('rate') && p.get('rate') !== '1') { + p.set('origAmount', OB.DEC.add(payment.get('origAmount'), OB.DEC.mul(p.get('origAmount'), p.get('rate')))); + } + payment.set('date', new Date()); + executeFinalCallback(true); + return; } - payment.set('date', new Date()); - executeFinalCallback(true); - return; } } } - } - if (payment.get('openDrawer') && (payment.get('allowOpenDrawer') || payment.get('isCash'))) { - order.set('openDrawer', payment.get('openDrawer')); - } - payment.set('date', new Date()); - payment.set('id', OB.UTIL.get_UUID()); - payment.set('obposAppCashup', OB.POS.modelterminal.get('terminal').cashUpId); - payment.set('oBPOSPOSTerminal', OB.MobileApp.model.get('terminal').id); - payment.set('orderGross', order.getGross()); - payment.set('isPaid', order.get('isPaid')); - payment.set('isReturnOrder', order.getPaymentStatus().isNegative); - if (order.get('doCancelAndReplace') && order.get('replacedorder')) { - // Added properties to payment related with cancel an replace order - payment.set('cancelAndReplace', order.get('doCancelAndReplace')); - } - - payments.add(payment, { - at: payment.get('index') + if (payment.get('openDrawer') && (payment.get('allowOpenDrawer') || payment.get('isCash'))) { + order.set('openDrawer', payment.get('openDrawer')); + } + payment.set('date', new Date()); + payment.set('id', OB.UTIL.get_UUID()); + payment.set('obposAppCashup', OB.POS.modelterminal.get('terminal').cashUpId); + payment.set('oBPOSPOSTerminal', OB.MobileApp.model.get('terminal').id); + payment.set('orderGross', order.getGross()); + payment.set('isPaid', order.get('isPaid')); + payment.set('isReturnOrder', order.getPaymentStatus().isNegative); + if (order.get('doCancelAndReplace') && order.get('replacedorder')) { + // Added properties to payment related with cancel an replace order + payment.set('cancelAndReplace', order.get('doCancelAndReplace')); + } + + payments.add(payment, { + at: payment.get('index') + }); + // If there is a reversed payment set isReversed properties + if (payment.get('reversedPayment')) { + payment.get('reversedPayment').set('isReversed', true); + } + executeFinalCallback(true); + return; + }); // call with callback, no args + } + + if (!payment.get('isReversePayment') && !payment.get('isChange')) { + this.checkEnoughCashAvailable(this.getPaymentStatus(), OB.MobileApp.model.paymentnames[payment.get('kind')], 'AddPayment', OB.DEC.mul(payment.get('amount'), payment.get('rate') || OB.DEC.One), function (success) { + if (success) { + addPaymentToOrder(); + } else { + OB.UTIL.showWarning(OB.I18N.getLabel('OBPOS_NoEnoughCash')); + } }); - // If there is a reversed payment set isReversed properties - if (payment.get('reversedPayment')) { - payment.get('reversedPayment').set('isReversed', true); - } - executeFinalCallback(true); - return; - }); // call with callback, no args + } else { + addPaymentToOrder(); + } }, overpaymentExists: function () { diff -r 5348d4e8468a -r 9e7064168d63 web/org.openbravo.retail.posterminal/js/pointofsale/view/payment.js --- a/web/org.openbravo.retail.posterminal/js/pointofsale/view/payment.js Tue Mar 27 18:15:39 2018 -0400 +++ b/web/org.openbravo.retail.posterminal/js/pointofsale/view/payment.js Wed Mar 28 11:41:53 2018 +0530 @@ -192,7 +192,7 @@ components: [{ name: 'noenoughchangelbl', showing: false, - type: 'error' + type: 'info' }, { name: 'changeexceedlimit', showing: false, @@ -535,69 +535,6 @@ } }, - checkEnoughCashAvailable: function (paymentstatus, selectedPayment, scope, button, callback) { - var requiredCash, hasEnoughCash = true, - hasAllEnoughCash = true, - reversedPayments = [], - currentSelectedPaymentCashAmount = OB.DEC.Zero, - reversedCash; - // Check slave cash - this.checkSlaveCashAvailable(selectedPayment, this, function (currentCash) { - // If there are reverse payments search for those of cash payment method. It will be needed to check if there is enough cash to reverse those payments. - if (paymentstatus.isReversal) { - paymentstatus.payments.each(function (payment) { - var paymentmethod = OB.POS.terminal.terminal.paymentnames[payment.get('kind')]; - if (!payment.get('isPrePayment') && paymentmethod.paymentMethod.iscash) { - reversedCash = OB.DEC.sub(reversedPayments[payment.get('kind')] || OB.DEC.Zero, payment.get('origAmount')); - reversedPayments[payment.get('kind')] = reversedCash; - if (selectedPayment !== paymentmethod && OB.DEC.compare(OB.DEC.sub(paymentmethod.currentCash, reversedCash)) < 0) { - hasEnoughCash = false; - } else { - currentSelectedPaymentCashAmount = reversedCash; - } - } - }); - } - - if (hasEnoughCash) { - if (OB.UTIL.isNullOrUndefined(selectedPayment) || !selectedPayment.paymentMethod.iscash) { - requiredCash = OB.DEC.Zero; - } else if ((button === 'Done' || button === 'Credit') && !_.isUndefined(paymentstatus) && (paymentstatus.isNegative)) { - requiredCash = OB.DEC.add(currentSelectedPaymentCashAmount, paymentstatus.pendingAmt); - paymentstatus.payments.each(function (payment) { - var paymentmethod; - if (payment.get('kind') === selectedPayment.payment.searchKey && !payment.get('isPrePayment') && !payment.get('reversedPaymentId')) { - requiredCash = OB.DEC.add(requiredCash, payment.get('origAmount')); - } else { - paymentmethod = OB.POS.terminal.terminal.paymentnames[payment.get('kind')]; - if (paymentmethod && payment.get('amount') > paymentmethod.currentCash && payment.get('isCash')) { - hasAllEnoughCash = false; - } - } - }); - } else if (!_.isUndefined(paymentstatus)) { - if (button === 'Layaway' || button === 'Credit') { - requiredCash = OB.DEC.add(currentSelectedPaymentCashAmount, paymentstatus.changeAmt); - } else { - requiredCash = OB.DEC.sub(OB.DEC.add(currentSelectedPaymentCashAmount, paymentstatus.changeAmt), paymentstatus.pendingAmt); - } - } - - if (!_.isUndefined(requiredCash) && requiredCash === 0) { - hasEnoughCash = true; - } else if (!_.isUndefined(requiredCash)) { - hasEnoughCash = OB.DEC.compare(OB.DEC.sub(currentCash, requiredCash)) >= 0; - } - } - - if (hasEnoughCash && ((button === 'Layaway' || button === 'Credit') || (button === 'Done' && hasAllEnoughCash))) { - return callback.call(scope, true); - } else { - return callback.call(scope, false); // check failed. - } - }); - }, - checkValidOverpayment: function (paymentstatus) { var requiredOverpayment = paymentstatus.overpayment, overPaymentUsed = _.last(paymentstatus.payments.models), @@ -734,22 +671,22 @@ if (paymentstatus.change && selectedPayment.paymentMethod.isshared) { resultOK = true; } else { - resultOK = this.checkEnoughCashAvailable(paymentstatus, selectedPayment, this, 'Done', function (success) { + resultOK = this.receipt.checkEnoughCashAvailable(paymentstatus, selectedPayment, 'Done', OB.DEC.Zero, function (success) { var lsuccess = success; if (lsuccess) { - lsuccess = this.checkValidPaymentMethod(paymentstatus, selectedPayment); + lsuccess = me.checkValidPaymentMethod(paymentstatus, selectedPayment); } else { - this.$.noenoughchangelbl.show(); - this.$.donebutton.setLocalDisabled(true); - this.$.exactbutton.setLocalDisabled(true); + me.$.noenoughchangelbl.show(); + me.$.donebutton.setLocalDisabled(true); + me.$.exactbutton.setLocalDisabled(true); } me.receipt.stopAddingPayments = !_.isEmpty(me.getShowingErrorMessages()); - this.setStatusButtons(lsuccess, 'Done'); - this.checkEnoughCashAvailable(paymentstatus, selectedPayment, this, 'Layaway', function (success) { - this.setStatusButtons(success, 'Layaway'); + me.setStatusButtons(lsuccess, 'Done'); + me.receipt.checkEnoughCashAvailable(paymentstatus, selectedPayment, 'Layaway', OB.DEC.Zero, function (success) { + me.setStatusButtons(success, 'Layaway'); }); - this.checkEnoughCashAvailable(paymentstatus, selectedPayment, this, 'Credit', function (success) { - this.setStatusButtons(success, 'Credit'); + me.receipt.checkEnoughCashAvailable(paymentstatus, selectedPayment, 'Credit', OB.DEC.Zero, function (success) { + me.setStatusButtons(success, 'Credit'); }); }); } @@ -933,55 +870,6 @@ } }, - checkSlaveCashAvailable: function (selectedPayment, scope, callback) { - - function processCashMgmtMaster(cashMgntCallback) { - new OB.DS.Process('org.openbravo.retail.posterminal.ProcessCashMgmtMaster').exec({ - cashUpId: OB.POS.modelterminal.get('terminal').cashUpId, - terminalSlave: OB.POS.modelterminal.get('terminal').isslave - }, function (data) { - if (data && data.exception) { - // Error handler - OB.log('error', data.exception.message); - OB.UTIL.showConfirmation.display( - OB.I18N.getLabel('OBPOS_CashMgmtError'), OB.I18N.getLabel('OBPOS_ErrorServerGeneric') + data.exception.message, [{ - label: OB.I18N.getLabel('OBPOS_LblRetry'), - action: function () { - processCashMgmtMaster(cashMgntCallback); - } - }], { - autoDismiss: false, - onHideFunction: function () { - cashMgntCallback(false, null); - } - }); - } else { - cashMgntCallback(true, data); - } - }); - } - - var currentCash = OB.DEC.Zero; - if (selectedPayment && selectedPayment.paymentMethod.iscash) { - currentCash = selectedPayment.currentCash || OB.DEC.Zero; - } - if ((OB.POS.modelterminal.get('terminal').ismaster || OB.POS.modelterminal.get('terminal').isslave) && selectedPayment.paymentMethod.iscash && selectedPayment.paymentMethod.isshared) { - // Load current cashup info from slaves - processCashMgmtMaster(function (success, data) { - if (success) { - _.each(data, function (pay) { - if (pay.searchKey === selectedPayment.payment.searchKey) { - currentCash = OB.DEC.add(currentCash, pay.startingCash + pay.totalDeposits + pay.totalSales - pay.totalReturns - pay.totalDrops); - } - }); - } - callback.call(scope, currentCash); - }); - } else { - callback.call(scope, currentCash); - } - }, - initComponents: function () { this.inherited(arguments); this.$.errorLabelArea.render(); issue 37812 source test.patch [^] (6,682 bytes) 2018-03-28 08:14 [Show Content] [Hide Content] # HG changeset patch # User Ranjith S R <ranjith@qualiantech.com> # Date 1522217526 -19800 # Wed Mar 28 11:42:06 2018 +0530 # Node ID 19aa3ceab793e634929b284f0290ac6c3ea9d186 # Parent 00fd4150c2ef6a646b4054aae8b5d9d8efd8b8dd Verifies issue 37812 : Added automated test 'I37812_VerifyAvailableCashOnReturn' diff -r 00fd4150c2ef -r 19aa3ceab793 src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I37812_VerifyAvailableCashOnReturn.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I37812_VerifyAvailableCashOnReturn.java Wed Mar 28 11:42:06 2018 +0530 @@ -0,0 +1,130 @@ +/* + ************************************************************************* + * The contents of this file are subject to the Openbravo Public License + * Version 1.0 (the "License"), being the Mozilla Public License + * Version 1.1 with a permitted attribution clause; you may not use this + * file except in compliance with the License. You may obtain a copy of + * the License at http://www.openbravo.com/legal/license.html + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. + * The Original Code is Openbravo ERP. + * The Initial Developer of the Original Code is Openbravo S.L.U. + * All portions are Copyright (C) 2018 Openbravo S.L.U. + * All Rights Reserved. + * Contributor(s): + ************************************************************************ + * + * @author RAN + * + */ +package org.openbravo.test.mobile.retail.pack.selenium.tests.receipts; + +import org.junit.Test; +import org.openbravo.test.mobile.retail.mobilecore.javascript.BackboneHelper; +import org.openbravo.test.mobile.retail.pack.API.WebPOSAPI; +import org.openbravo.test.mobile.retail.pack.selenium.TestIdPack; +import org.openbravo.test.mobile.retail.pack.selenium.terminals.WebPOSTerminalHelper; + +public class I37812_VerifyAvailableCashOnReturn extends WebPOSTerminalHelper { + + @Test + public void test() { + WebPOSAPI.cleanCashup(this); + final String customer = get(TestIdPack.BUTTON_RECEIPT_CUSTOMER); + + // Create Receipt + tap(TestIdPack.BUTTON_SEARCH); + write(TestIdPack.FIELD_SEARCH_TEXT, TestIdPack.BUTTON_SEARCHPRODUCT_CAMPING.getRowName()); + tap(TestIdPack.BUTTON_SEARCH_EXECUTE); + tap(TestIdPack.BUTTON_SEARCHPRODUCT_CAMPING); + verify(TestIdPack.LABEL_TOTALTOPAY, "385.00"); + final String receiptNo = BackboneHelper.getDocumentNo(); + tap(TestIdPack.BUTTON_PAY); + tap(TestIdPack.BUTTON_CASHUSA); + tap(TestIdPack.BUTTON_PAYMENTSWITCH); + tap(TestIdPack.BUTTON_KEYPAD_2); + tap(TestIdPack.BUTTON_KEYPAD_0); + tap(TestIdPack.BUTTON_KEYPAD_0); + tap(TestIdPack.BUTTON_KEYPAD_ENTER); + tap(TestIdPack.BUTTON_CASH); + tap(TestIdPack.BUTTON_PAY_EXACT); + tap(TestIdPack.BUTTON_PAY_DONE); + verify(TestIdPack.LABEL_TOTALTOPAY, "0.00"); + + // Verify Cash Available on return receipt + tap(TestIdPack.BUTTON_MENU); + tap(TestIdPack.BUTTON_MENU_VERIFIEDRETURN); + write(TestIdPack.FIELD_SEARCH_RECEIPT, receiptNo); + tap(TestIdPack.BUTTON_VERIFIEDRETURNS_SEARCH); + verify(TestIdPack.LABEL_VERIFIEDRETURNS_ROW1_TITLE, + String.format("%s - %s", receiptNo, customer)); + tap(TestIdPack.BUTTON_VERIFIEDRETURNS_ROW1); + verify(TestIdPack.LABEL_POPUP_DOCUMENTNO, receiptNo); + tap(TestIdPack.BUTTON_VERIFIEDRETURNS_LINES_CHECKALL); + tap(TestIdPack.BUTTON_POPUP_APPLY); + tap(TestIdPack.BUTTON_PAY); + verify(TestIdPack.LABEL_RECEIPT_PAY_REMAINING, "385.00€"); + isDisabled(TestIdPack.BUTTON_PAY_EXACT, true); + isVisible(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, true); + tap(TestIdPack.BUTTON_CASHUSA); + verify(TestIdPack.LABEL_RECEIPT_PAY_REMAINING, "$506.03"); + isDisabled(TestIdPack.BUTTON_PAY_EXACT, true); + isVisible(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, true); + // Available USA Cash - 200 + tap(TestIdPack.BUTTON_PAYMENTSWITCH); + tap(TestIdPack.BUTTON_KEYPAD_2); + tap(TestIdPack.BUTTON_KEYPAD_2); + tap(TestIdPack.BUTTON_KEYPAD_2); + tap(TestIdPack.BUTTON_KEYPAD_ENTER); + verify(TestIdPack.LABEL_RECEIPT_PAY_REMAINING, "$506.03"); + tap(TestIdPack.BUTTON_KEYPAD_2); + tap(TestIdPack.BUTTON_KEYPAD_0); + tap(TestIdPack.BUTTON_KEYPAD_0); + tap(TestIdPack.BUTTON_KEYPAD_ENTER); + verify(TestIdPack.LABEL_RECEIPT_ADDEDPAYMENT_ROW1_NAME, "USA Cash"); + verify(TestIdPack.LABEL_RECEIPT_PAY_REMAINING, "$306.04"); + tap(TestIdPack.BUTTON_CASH); + isDisabled(TestIdPack.BUTTON_PAY_EXACT, false); + tap(TestIdPack.BUTTON_PAY_EXACT); + verify(TestIdPack.LABEL_RECEIPT_ADDEDPAYMENT_ROW1_NAME, "USA Cash"); + verify(TestIdPack.LABEL_RECEIPT_ADDEDPAYMENT_ROW1_AMOUNT, "152.16"); + verify(TestIdPack.LABEL_RECEIPT_ADDEDPAYMENT_ROW2_NAME, "Cash"); + verify(TestIdPack.LABEL_RECEIPT_ADDEDPAYMENT_ROW2_AMOUNT, "232.84"); + + // Available Cash - 232.84 + tap(TestIdPack.BUTTON_RECEIPT_PAYMENT_ROW2_REMOVE); + tap(TestIdPack.BUTTON_RECEIPT_PAYMENT_ROW1_REMOVE); + tap(TestIdPack.BUTTON_PAY); + verify(TestIdPack.LABEL_RECEIPT_PAY_REMAINING, "385.00€"); + isDisabled(TestIdPack.BUTTON_PAY_EXACT, true); + tap(TestIdPack.BUTTON_PAYMENTSWITCH); + tap(TestIdPack.BUTTON_KEYPAD_2); + tap(TestIdPack.BUTTON_KEYPAD_3); + tap(TestIdPack.BUTTON_KEYPAD_3); + tap(TestIdPack.BUTTON_KEYPAD_ENTER); + verify(TestIdPack.LABEL_RECEIPT_PAY_REMAINING, "385.00€"); + tap(TestIdPack.BUTTON_KEYPAD_2); + tap(TestIdPack.BUTTON_KEYPAD_3); + tap(TestIdPack.BUTTON_KEYPAD_2); + tap(TestIdPack.BUTTON_KEYPAD_DOT); + tap(TestIdPack.BUTTON_KEYPAD_8); + tap(TestIdPack.BUTTON_KEYPAD_4); + tap(TestIdPack.BUTTON_KEYPAD_ENTER); + verify(TestIdPack.LABEL_RECEIPT_PAY_REMAINING, "152.16€"); + tap(TestIdPack.BUTTON_CASHUSA); + isDisabled(TestIdPack.BUTTON_PAY_EXACT, false); + tap(TestIdPack.BUTTON_PAYMENTSWITCH); + tap(TestIdPack.BUTTON_KEYPAD_2); + tap(TestIdPack.BUTTON_KEYPAD_0); + tap(TestIdPack.BUTTON_KEYPAD_0); + tap(TestIdPack.BUTTON_KEYPAD_ENTER); + verify(TestIdPack.LABEL_RECEIPT_ADDEDPAYMENT_ROW1_NAME, "Cash"); + verify(TestIdPack.LABEL_RECEIPT_ADDEDPAYMENT_ROW1_AMOUNT, "232.84"); + verify(TestIdPack.LABEL_RECEIPT_ADDEDPAYMENT_ROW2_NAME, "USA Cash"); + verify(TestIdPack.LABEL_RECEIPT_ADDEDPAYMENT_ROW2_AMOUNT, "152.16"); + tap(TestIdPack.BUTTON_PAY_DONE); + verify(TestIdPack.LABEL_TOTALTOPAY, "0.00"); + } +} \ No newline at end of file | |||||||||||
Relationships [ Relation Graph ] [ Dependency Graph ] | ||||||||
|
Issue History | |||
Date Modified | Username | Field | Change |
2018-02-01 17:34 | plujan | New Issue | |
2018-02-01 17:34 | plujan | Assigned To | => Retail |
2018-02-01 17:34 | plujan | Regression introduced in release | => main |
2018-02-01 17:34 | plujan | Triggers an Emergency Pack | => No |
2018-02-13 15:55 | ranjith_qualiantech_com | Assigned To | Retail => ranjith_qualiantech_com |
2018-03-01 07:00 | ranjith_qualiantech_com | Status | new => scheduled |
2018-03-28 08:14 | ranjith_qualiantech_com | File Added: issue 37812 source posterminal.patch | |
2018-03-28 08:14 | ranjith_qualiantech_com | File Added: issue 37812 source test.patch | |
2019-11-19 10:48 | ranjith_qualiantech_com | Relationship added | related to 0042143 |
2023-07-11 08:50 | ranjith_qualiantech_com | Assigned To | ranjith_qualiantech_com => Retail |
Copyright © 2000 - 2009 MantisBT Group |