Attached Files | issue 35830 possible fix source posterminal 8335.patch [^] (10,714 bytes) 2017-05-30 13:44 [Show Content] [Hide Content]# HG changeset patch
# User Ranjith S R <ranjith@qualiantech.com>
# Date 1496144289 -19800
# Tue May 30 17:08:09 2017 +0530
# Node ID 80531ce0a8bb2b494802703208e46491783263c7
# Parent 6e7556bd0d9982ed6f9832720e89b7b325c54554
Related to issue 35830 : Payment method amount should be prevalidated if it is configured with provider
diff -r 6e7556bd0d99 -r 80531ce0a8bb src-db/database/sourcedata/AD_MESSAGE.xml
--- a/src-db/database/sourcedata/AD_MESSAGE.xml Mon May 29 11:50:13 2017 +0200
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml Tue May 30 17:08:09 2017 +0530
@@ -607,7 +607,7 @@
<!--0E92603689384A99BA501760F099AB46--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
<!--0E92603689384A99BA501760F099AB46--> <ISACTIVE><![CDATA[Y]]></ISACTIVE>
<!--0E92603689384A99BA501760F099AB46--> <VALUE><![CDATA[OBPOS_NoEnoughCash]]></VALUE>
-<!--0E92603689384A99BA501760F099AB46--> <MSGTEXT><![CDATA[There is not enough cash available.]]></MSGTEXT>
+<!--0E92603689384A99BA501760F099AB46--> <MSGTEXT><![CDATA[There is not enough cash available]]></MSGTEXT>
<!--0E92603689384A99BA501760F099AB46--> <MSGTYPE><![CDATA[I]]></MSGTYPE>
<!--0E92603689384A99BA501760F099AB46--> <AD_MODULE_ID><![CDATA[FF808181326CC34901326D53DBCF0018]]></AD_MODULE_ID>
<!--0E92603689384A99BA501760F099AB46--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
@@ -5525,6 +5525,18 @@
<!--9AAC477E73BD4EF78C1DBA133F2E04D9--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
<!--9AAC477E73BD4EF78C1DBA133F2E04D9--></AD_MESSAGE>
+<!--9ABD838BA24749CFB31BDB44AA4BCC54--><AD_MESSAGE>
+<!--9ABD838BA24749CFB31BDB44AA4BCC54--> <AD_MESSAGE_ID><![CDATA[9ABD838BA24749CFB31BDB44AA4BCC54]]></AD_MESSAGE_ID>
+<!--9ABD838BA24749CFB31BDB44AA4BCC54--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--9ABD838BA24749CFB31BDB44AA4BCC54--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--9ABD838BA24749CFB31BDB44AA4BCC54--> <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--9ABD838BA24749CFB31BDB44AA4BCC54--> <VALUE><![CDATA[OBPOS_ErrorInProviderAddPayment]]></VALUE>
+<!--9ABD838BA24749CFB31BDB44AA4BCC54--> <MSGTEXT><![CDATA[%0, if amount %1 is added under %2 payment method]]></MSGTEXT>
+<!--9ABD838BA24749CFB31BDB44AA4BCC54--> <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--9ABD838BA24749CFB31BDB44AA4BCC54--> <AD_MODULE_ID><![CDATA[FF808181326CC34901326D53DBCF0018]]></AD_MODULE_ID>
+<!--9ABD838BA24749CFB31BDB44AA4BCC54--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
+<!--9ABD838BA24749CFB31BDB44AA4BCC54--></AD_MESSAGE>
+
<!--9ADC48AFE274433C82DE67C1CBCA18EF--><AD_MESSAGE>
<!--9ADC48AFE274433C82DE67C1CBCA18EF--> <AD_MESSAGE_ID><![CDATA[9ADC48AFE274433C82DE67C1CBCA18EF]]></AD_MESSAGE_ID>
<!--9ADC48AFE274433C82DE67C1CBCA18EF--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
diff -r 6e7556bd0d99 -r 80531ce0a8bb web/org.openbravo.retail.posterminal/js/pointofsale/view/keyboard-toolbars.js
--- a/web/org.openbravo.retail.posterminal/js/pointofsale/view/keyboard-toolbars.js Mon May 29 11:50:13 2017 +0200
+++ b/web/org.openbravo.retail.posterminal/js/pointofsale/view/keyboard-toolbars.js Tue May 30 17:08:09 2017 +0530
@@ -93,7 +93,8 @@
}
if (OB.DEC.compare(amount) > 0) {
- var provider, receiptToPay, me = this;
+ var provider, receiptToPay, me = this,
+ paymentLine, auxReceipt;
if (this.model.get('leftColumnViewManager').isOrder()) {
receiptToPay = this.receipt;
}
@@ -108,20 +109,43 @@
provider = paymentMethod.refundProvider;
}
+ paymentLine = new OB.Model.PaymentLine({
+ 'kind': key,
+ 'name': name,
+ 'amount': amount,
+ 'rate': rate,
+ 'mulrate': mulrate,
+ 'isocode': isocode,
+ 'allowOpenDrawer': paymentMethod.allowopendrawer,
+ 'isCash': paymentMethod.iscash,
+ 'openDrawer': paymentMethod.openDrawer,
+ 'printtwice': paymentMethod.printtwice
+ });
+
if (provider) {
- this.doShowPopup({
- popup: 'modalpayment',
- args: {
- 'receipt': receiptToPay,
- 'provider': provider,
- 'key': key,
- 'name': name,
- 'paymentMethod': paymentMethod,
- 'amount': amount,
- 'rate': rate,
- 'mulrate': mulrate,
- 'isocode': isocode
- }
+ auxReceipt = new OB.Model.Order();
+ OB.UTIL.clone(receiptToPay, auxReceipt);
+ auxReceipt.set('id', null);
+ auxReceipt.addPayment(paymentLine, function () {
+ receiptToPay.trigger('checkValidPaymentsByReceipt', auxReceipt, amount, function (result) {
+ OB.Dal.remove(auxReceipt);
+ if (result) {
+ me.doShowPopup({
+ popup: 'modalpayment',
+ args: {
+ 'receipt': receiptToPay,
+ 'provider': provider,
+ 'key': key,
+ 'name': name,
+ 'paymentMethod': paymentMethod,
+ 'amount': amount,
+ 'rate': rate,
+ 'mulrate': mulrate,
+ 'isocode': isocode
+ }
+ });
+ }
+ });
});
} else {
// Calculate total amount to pay with selected PaymentMethod
@@ -154,18 +178,7 @@
currency: '',
symbolAtRight: true
});
- this.model.addPayment(new OB.Model.PaymentLine({
- 'kind': key,
- 'name': name,
- 'amount': amount,
- 'rate': rate,
- 'mulrate': mulrate,
- 'isocode': isocode,
- 'allowOpenDrawer': paymentMethod.allowopendrawer,
- 'isCash': paymentMethod.iscash,
- 'openDrawer': paymentMethod.openDrawer,
- 'printtwice': paymentMethod.printtwice
- }), callback);
+ this.model.addPayment(paymentLine, callback);
}
}
}
diff -r 6e7556bd0d99 -r 80531ce0a8bb web/org.openbravo.retail.posterminal/js/pointofsale/view/payment.js
--- a/web/org.openbravo.retail.posterminal/js/pointofsale/view/payment.js Mon May 29 11:50:13 2017 +0200
+++ b/web/org.openbravo.retail.posterminal/js/pointofsale/view/payment.js Tue May 30 17:08:09 2017 +0530
@@ -292,6 +292,24 @@
this.receipt.on('extrainfo', function (info) {
this.updateExtraInfo(info);
}, this);
+ this.receipt.on('checkValidPaymentsByReceipt', function (auxReceipt, amount, callback) {
+ var me = this,
+ selectedPayment = OB.MobileApp.model.paymentnames[auxReceipt.get('selectedPayment') || OB.MobileApp.model.get('paymentcash')];
+ this.$.errorLabelArea.hide();
+ this.checkValidPayments(auxReceipt.getPaymentStatus(), selectedPayment, function () {
+ var firstShowingObject = me.getFirstShowingObject(me.errorLabels),
+ hasPaymentError = _.isEmpty(firstShowingObject);
+ me.hideErrorMessages(auxReceipt.getPaymentStatus());
+ me.$.errorLabelArea.show();
+ if (!hasPaymentError) {
+ OB.UTIL.showConfirmation.display('', OB.I18N.getLabel('OBPOS_ErrorInProviderAddPayment', [firstShowingObject.getContent(), amount, selectedPayment.payment.commercialName]));
+ me.receipt.stopAddingPayments = false;
+ }
+ if (callback) {
+ callback(hasPaymentError);
+ }
+ });
+ }, this);
},
updateExtraInfo: function (info) {
@@ -653,20 +671,18 @@
return check;
},
- checkValidPayments: function (paymentstatus, selectedPayment) {
- var resultOK, me = this;
+ checkValidPayments: function (paymentstatus, selectedPayment, callback) {
+ var resultOK, callbackFunc, me = this;
if (!selectedPayment) {
return;
}
- // Hide all error labels. Error labels are shown by check... functions
- if (_.isNull(paymentstatus.overpayment)) {
- this.$.changeexceedlimit.hide();
- this.$.overpaymentnotavailable.hide();
- this.$.overpaymentexceedlimit.hide();
- }
- this.$.noenoughchangelbl.hide();
- this.$.onlycashpaymentmethod.hide();
+ this.hideErrorMessages(paymentstatus);
+ callbackFunc = function () {
+ if (callback) {
+ callback();
+ }
+ };
// Do the checkins
this.receipt.stopAddingPayments = !_.isEmpty(this.getShowingErrorMessages());
@@ -676,6 +692,7 @@
// avoid checking for shared paymentMethod
if (paymentstatus.change && selectedPayment.paymentMethod.isshared) {
resultOK = true;
+ callbackFunc();
} else {
resultOK = this.checkEnoughCashAvailable(paymentstatus, selectedPayment, this, 'Done', function (success) {
var lsuccess = success;
@@ -694,6 +711,7 @@
this.checkEnoughCashAvailable(paymentstatus, selectedPayment, this, 'Credit', function (success) {
this.setStatusButtons(success, 'Credit');
});
+ callbackFunc();
});
}
} else if (!this.receipt.stopAddingPayments) {
@@ -701,13 +719,14 @@
this.$.exactbutton.setLocalDisabled(false);
this.$.layawayaction.setLocalDisabled(false);
this.$.creditsalesaction.setLocalDisabled(false);
+ callbackFunc();
}
-
} else {
me.receipt.stopAddingPayments = !_.isEmpty(me.getShowingErrorMessages());
// Finally set status of buttons
this.setStatusButtons(resultOK, 'Done');
this.setStatusButtons(resultOK, 'Layaway');
+ callbackFunc();
}
if (resultOK) {
this.$.noenoughchangelbl.hide();
@@ -773,6 +792,21 @@
errorLabelArray.push(this.$.extrainfo);
return errorLabelArray;
},
+ hideErrorMessages: function (paymentstatus) {
+ // Hide all error labels. Error labels are shown by check... functions
+ if (_.isNull(paymentstatus.overpayment)) {
+ this.$.changeexceedlimit.hide();
+ this.$.overpaymentnotavailable.hide();
+ this.$.overpaymentexceedlimit.hide();
+ }
+ this.$.noenoughchangelbl.hide();
+ this.$.onlycashpaymentmethod.hide();
+
+ this.$.donebutton.setLocalDisabled(false);
+ this.$.exactbutton.setLocalDisabled(false);
+ this.$.layawayaction.setLocalDisabled(false);
+ this.$.creditsalesaction.setLocalDisabled(false);
+ },
getFirstShowingObject: function (errorLabelArray) {
var showingObj = '',
i;
@@ -826,7 +860,7 @@
var arrayContent = this.errorLabels[i];
if (arrayContent.showing && arrayContent.type === 'error') {
count = count + 1;
- msgToReturn = msgToReturn + '\n' + count + ')' + arrayContent.content;
+ msgToReturn = msgToReturn + '\n' + count + ') ' + arrayContent.content;
}
}
}
issue 35830 possible fix test 8335.patch [^] (12,822 bytes) 2017-05-30 13:44 [Show Content] [Hide Content]# HG changeset patch
# User Ranjith S R <ranjith@qualiantech.com>
# Date 1496144337 -19800
# Tue May 30 17:08:57 2017 +0530
# Node ID 46519d00f9327538068fa3821f89d8ae7e0527c1
# Parent 46eab94d419af1ab92ab1475c494dea468bdb885
Verifies issue 35830 : Added automated test 'I35830_VerifyPreValidationPaymentProvider'
diff -r 46eab94d419a -r 46519d00f932 src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I35830_VerifyPreValidationPaymentProvider.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I35830_VerifyPreValidationPaymentProvider.java Tue May 30 17:08:57 2017 +0530
@@ -0,0 +1,109 @@
+/*
+ *************************************************************************
+ * 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) 2017 Openbravo S.L.U.
+ * All Rights Reserved.
+ * Contributor(s):
+ ************************************************************************
+ *
+ * @author RAN
+ *
+ */
+
+package org.openbravo.test.mobile.retail.pack.selenium.tests.receipts;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import org.junit.Test;
+import org.openbravo.test.mobile.core.selenium.SeleniumHelper;
+import org.openbravo.test.mobile.retail.mobilecore.annotations.TestClassAnnotations;
+import org.openbravo.test.mobile.retail.mobilecore.database.DatabaseHelperInsertUpdateOrDelete;
+import org.openbravo.test.mobile.retail.pack.database.WebPOSDatabaseConstants;
+import org.openbravo.test.mobile.retail.pack.selenium.TestIdPack;
+import org.openbravo.test.mobile.retail.pack.selenium.terminals.WebPOSTerminalHelper;
+
+@TestClassAnnotations(isHighVolumeCompatible = true)
+public class I35830_VerifyPreValidationPaymentProvider extends WebPOSTerminalHelper {
+
+ final String modalpayment = "terminal_containerWindow_pointOfSale_modalpayment";
+
+ @Test
+ public void test() {
+ tap(TestIdPack.BUTTON_SEARCH);
+ write(TestIdPack.FIELD_SEARCH_TEXT,
+ TestIdPack.BUTTON_SEARCHPRODUCT_HEADLAMPULTRALIGHT.getRowName());
+ tap(TestIdPack.BUTTON_SEARCH_EXECUTE);
+ tap(TestIdPack.BUTTON_SEARCHPRODUCT_HEADLAMPULTRALIGHT);
+ verify(TestIdPack.LABEL_TOTALTOPAY, "18.90");
+ tap(TestIdPack.BUTTON_PAY);
+ isVisible(TestIdPack.BUTTON_PAY_EXACT, true);
+ isVisible(TestIdPack.BUTTON_PAY_DONE, false);
+
+ // Do Card Overpayment
+ tap(TestIdPack.BUTTON_CARD);
+ tap(TestIdPack.BUTTON_KEYPAD_3);
+ tap(TestIdPack.BUTTON_KEYPAD_3);
+ tap(TestIdPack.BUTTON_KEYPAD_ENTER);
+ isVisible(TestIdPack.CONFIRMATION_POPUP, true);
+ final String errorMsg = (String) SeleniumHelper
+ .executeScriptWithReturn("OB.I18N.getLabel('OBPOS_ErrorInProviderAddPayment', [OB.I18N.getLabel('OBPOS_OverpaymentNotAvailable'), "
+ + "33, OB.MobileApp.model.paymentnames[OB.MobileApp.model.receipt.get('selectedPayment')].payment.commercialName])");
+ verify(TestIdPack.LABEL_POPUP_CONFIRMATION_TITLE, errorMsg);
+ tap(TestIdPack.BUTTON_POPUP_CONFIRMATION_OK);
+
+ // Do Card Exact Payment
+ tap(TestIdPack.BUTTON_PAY_EXACT);
+ TestIdPack.POPUP_MODALPAYMENT.enyoNode().waitUntilIsReady();
+ verify(TestIdPack.POPUP_MODALPAYMENT_TITLE, "Process payment: 18.90");
+ isVisibleDom(modalpayment, true);
+ tap(TestIdPack.POPUP_MODALPAYMENT_OKBUTTON);
+
+ verify(TestIdPack.LABEL_RECEIPT_PAY_EXACT, "Exact amount paid.");
+ isVisible(TestIdPack.LABEL_RECEIPT_PAY_EXACT, true);
+ verify(TestIdPack.LABEL_RECEIPT_ADDEDPAYMENT_ROW1_NAME, "Card");
+ verify(TestIdPack.LABEL_RECEIPT_ADDEDPAYMENT_ROW1_AMOUNT, "18.90");
+ tap(TestIdPack.BUTTON_PAY_DONE);
+ verify(TestIdPack.LABEL_TOTALTOPAY, "0.00");
+ }
+
+ private void isVisibleDom(final String idDom, final boolean isVisibleExpected) {
+ logger.info(String.format("Verifying that the button '%s' is %svisible", idDom,
+ isVisibleExpected ? "" : "not "));
+ final String isVisibleScript = String.format(
+ "document.getElementById('%s').style.display === 'none'", idDom);
+ final boolean isVisible = !(Boolean) SeleniumHelper.executeScriptWithReturn(isVisibleScript);
+ assertThat(
+ String.format("'%s' was expected %sto be visible", idDom, isVisibleExpected ? "" : "not "),
+ isVisible, equalTo(isVisibleExpected));
+ }
+
+ @Override
+ public void beforeWithReload() {
+ updatePaymentType(true);
+ }
+
+ @Override
+ public void afterWithReload() {
+ updatePaymentType(false);
+ }
+
+ private void updatePaymentType(final boolean isForTest) {
+ final String sql = String.format("update obpos_app_payment_type "
+ + "set paymentprovider = %s, overpayment_limit = %s "
+ + "where obpos_app_payment_type_id = '%s'", isForTest ? "'OB.UI.MockPayment'" : null,
+ isForTest ? "'0'" : null, WebPOSDatabaseConstants.VBS_OBPOS_APP_PAYMENT_TYPE_CARD);
+
+ new DatabaseHelperInsertUpdateOrDelete().execute(sql, 1);
+ }
+}
diff -r 46eab94d419a -r 46519d00f932 src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/reversepayments/NoCashWhenReverse.java
--- a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/reversepayments/NoCashWhenReverse.java Tue May 30 11:29:48 2017 +0200
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/reversepayments/NoCashWhenReverse.java Tue May 30 17:08:57 2017 +0530
@@ -54,8 +54,8 @@
tap(TestIdPack.BUTTON_SEARCH_EXECUTE);
tap(TestIdPack.BUTTON_SEARCHPRODUCT_AVALANCHETRANSCEIVER);
- String receiptNo = BackboneHelper.getDocumentNo();
- String customer = get(TestIdPack.BUTTON_RECEIPT_CUSTOMER);
+ final String receiptNo = BackboneHelper.getDocumentNo();
+ final String customer = get(TestIdPack.BUTTON_RECEIPT_CUSTOMER);
// Finish the receipt
tap(TestIdPack.BUTTON_PAY);
@@ -98,10 +98,10 @@
// Check is not cash available
tap(TestIdPack.BUTTON_CARD);
isVisible(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, true);
- verify(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, "There is not enough cash available.");
+ verify(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, "There is not enough cash available");
isDisabled(TestIdPack.BUTTON_PAY_EXACT, true);
tap(TestIdPack.BUTTON_CASHUSA);
- verify(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, "There is not enough cash available.");
+ verify(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, "There is not enough cash available");
isDisabled(TestIdPack.BUTTON_PAY_EXACT, true);
tap(TestIdPack.BUTTON_CASH);
isVisible(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, false);
@@ -226,10 +226,10 @@
// Check is not cash available
tap(TestIdPack.BUTTON_CASH);
isVisible(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, true);
- verify(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, "There is not enough cash available.");
+ verify(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, "There is not enough cash available");
isDisabled(TestIdPack.BUTTON_PAY_EXACT, true);
tap(TestIdPack.BUTTON_CASHUSA);
- verify(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, "There is not enough cash available.");
+ verify(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, "There is not enough cash available");
isDisabled(TestIdPack.BUTTON_PAY_EXACT, true);
tap(TestIdPack.BUTTON_CASH);
@@ -250,8 +250,8 @@
tap(TestIdPack.BUTTON_SEARCH_EXECUTE);
tap(TestIdPack.BUTTON_SEARCHPRODUCT_AVALANCHETRANSCEIVER);
- String receiptNo = BackboneHelper.getDocumentNo();
- String customer = get(TestIdPack.BUTTON_RECEIPT_CUSTOMER);
+ final String receiptNo = BackboneHelper.getDocumentNo();
+ final String customer = get(TestIdPack.BUTTON_RECEIPT_CUSTOMER);
// Finish the receipt
tap(TestIdPack.BUTTON_MENU);
@@ -292,11 +292,11 @@
// Check is not cash available
tap(TestIdPack.BUTTON_CARD);
isVisible(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, true);
- verify(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, "There is not enough cash available.");
+ verify(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, "There is not enough cash available");
isDisabled(TestIdPack.BUTTON_PAY_EXACT, true);
isDisabled(TestIdPack.BUTTON_LAYAWAY, true);
tap(TestIdPack.BUTTON_CASHUSA);
- verify(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, "There is not enough cash available.");
+ verify(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, "There is not enough cash available");
isDisabled(TestIdPack.BUTTON_PAY_EXACT, true);
isDisabled(TestIdPack.BUTTON_LAYAWAY, true);
tap(TestIdPack.BUTTON_CASH);
@@ -336,8 +336,8 @@
tap(TestIdPack.BUTTON_SEARCH_EXECUTE);
tap(TestIdPack.BUTTON_SEARCHPRODUCT_AVALANCHETRANSCEIVER);
- String receiptNo = BackboneHelper.getDocumentNo();
- String customer = get(TestIdPack.BUTTON_RECEIPT_CUSTOMER);
+ final String receiptNo = BackboneHelper.getDocumentNo();
+ final String customer = get(TestIdPack.BUTTON_RECEIPT_CUSTOMER);
// Finish the receipt
tap(TestIdPack.BUTTON_PAY);
@@ -380,11 +380,11 @@
// Check is not cash available
tap(TestIdPack.BUTTON_CARD);
isVisible(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, true);
- verify(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, "There is not enough cash available.");
+ verify(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, "There is not enough cash available");
isDisabled(TestIdPack.BUTTON_PAY_EXACT, true);
isDisabled(TestIdPack.BUTTON_PAY_USECREDIT, true);
tap(TestIdPack.BUTTON_CASHUSA);
- verify(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, "There is not enough cash available.");
+ verify(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, "There is not enough cash available");
isDisabled(TestIdPack.BUTTON_PAY_EXACT, true);
isDisabled(TestIdPack.BUTTON_PAY_USECREDIT, true);
tap(TestIdPack.BUTTON_CASH);
@@ -539,11 +539,11 @@
// Check is not cash available
tap(TestIdPack.BUTTON_CASH);
isVisible(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, true);
- verify(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, "There is not enough cash available.");
+ verify(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, "There is not enough cash available");
isDisabled(TestIdPack.BUTTON_PAY_EXACT, true);
isDisabled(TestIdPack.BUTTON_PAY_USECREDIT, true);
tap(TestIdPack.BUTTON_CASHUSA);
- verify(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, "There is not enough cash available.");
+ verify(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, "There is not enough cash available");
isDisabled(TestIdPack.BUTTON_PAY_EXACT, true);
isDisabled(TestIdPack.BUTTON_PAY_USECREDIT, true);
tap(TestIdPack.BUTTON_CASH);
@@ -592,8 +592,8 @@
tap(TestIdPack.BUTTON_SEARCH_EXECUTE);
tap(TestIdPack.BUTTON_SEARCHPRODUCT_AVALANCHETRANSCEIVER);
- String receiptNo = BackboneHelper.getDocumentNo();
- String customer = get(TestIdPack.BUTTON_RECEIPT_CUSTOMER);
+ final String receiptNo = BackboneHelper.getDocumentNo();
+ final String customer = get(TestIdPack.BUTTON_RECEIPT_CUSTOMER);
// Finish the receipt
tap(TestIdPack.BUTTON_MENU);
@@ -634,12 +634,12 @@
// Check is not cash available
tap(TestIdPack.BUTTON_CARD);
isVisible(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, true);
- verify(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, "There is not enough cash available.");
+ verify(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, "There is not enough cash available");
isDisabled(TestIdPack.BUTTON_PAY_EXACT, true);
isDisabled(TestIdPack.BUTTON_LAYAWAY, true);
isDisabled(TestIdPack.BUTTON_PAY_USECREDIT, true);
tap(TestIdPack.BUTTON_CASHUSA);
- verify(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, "There is not enough cash available.");
+ verify(TestIdPack.LABEL_RECEIPT_PAY_NOTENOUGHCASH, "There is not enough cash available");
isDisabled(TestIdPack.BUTTON_PAY_EXACT, true);
isDisabled(TestIdPack.BUTTON_LAYAWAY, true);
isDisabled(TestIdPack.BUTTON_PAY_USECREDIT, true);
issue 35830 possible fix source posterminal v2.patch [^] (11,377 bytes) 2017-06-07 10:05 [Show Content] [Hide Content]# HG changeset patch
# User Ranjith S R <ranjith@qualiantech.com>
# Date 1496822493 -19800
# Wed Jun 07 13:31:33 2017 +0530
# Node ID 87726c2ebd6168dacefabf4136fd57c5a79fe11a
# Parent 7c326d82a3b44bc239b3c046024ab0437e71f037
Related to issue 35830 : Payment method amount should be prevalidated if it is configured with provider
diff -r 7c326d82a3b4 -r 87726c2ebd61 src-db/database/sourcedata/AD_MESSAGE.xml
--- a/src-db/database/sourcedata/AD_MESSAGE.xml Mon Jun 05 12:16:17 2017 +0200
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml Wed Jun 07 13:31:33 2017 +0530
@@ -607,7 +607,7 @@
<!--0E92603689384A99BA501760F099AB46--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
<!--0E92603689384A99BA501760F099AB46--> <ISACTIVE><![CDATA[Y]]></ISACTIVE>
<!--0E92603689384A99BA501760F099AB46--> <VALUE><![CDATA[OBPOS_NoEnoughCash]]></VALUE>
-<!--0E92603689384A99BA501760F099AB46--> <MSGTEXT><![CDATA[There is not enough cash available.]]></MSGTEXT>
+<!--0E92603689384A99BA501760F099AB46--> <MSGTEXT><![CDATA[There is not enough cash available]]></MSGTEXT>
<!--0E92603689384A99BA501760F099AB46--> <MSGTYPE><![CDATA[I]]></MSGTYPE>
<!--0E92603689384A99BA501760F099AB46--> <AD_MODULE_ID><![CDATA[FF808181326CC34901326D53DBCF0018]]></AD_MODULE_ID>
<!--0E92603689384A99BA501760F099AB46--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
@@ -5537,6 +5537,18 @@
<!--9AAC477E73BD4EF78C1DBA133F2E04D9--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
<!--9AAC477E73BD4EF78C1DBA133F2E04D9--></AD_MESSAGE>
+<!--9ABD838BA24749CFB31BDB44AA4BCC54--><AD_MESSAGE>
+<!--9ABD838BA24749CFB31BDB44AA4BCC54--> <AD_MESSAGE_ID><![CDATA[9ABD838BA24749CFB31BDB44AA4BCC54]]></AD_MESSAGE_ID>
+<!--9ABD838BA24749CFB31BDB44AA4BCC54--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--9ABD838BA24749CFB31BDB44AA4BCC54--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--9ABD838BA24749CFB31BDB44AA4BCC54--> <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--9ABD838BA24749CFB31BDB44AA4BCC54--> <VALUE><![CDATA[OBPOS_ErrorInProviderAddPayment]]></VALUE>
+<!--9ABD838BA24749CFB31BDB44AA4BCC54--> <MSGTEXT><![CDATA[%0, if amount %1 is added under %2 payment method]]></MSGTEXT>
+<!--9ABD838BA24749CFB31BDB44AA4BCC54--> <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--9ABD838BA24749CFB31BDB44AA4BCC54--> <AD_MODULE_ID><![CDATA[FF808181326CC34901326D53DBCF0018]]></AD_MODULE_ID>
+<!--9ABD838BA24749CFB31BDB44AA4BCC54--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
+<!--9ABD838BA24749CFB31BDB44AA4BCC54--></AD_MESSAGE>
+
<!--9ADC48AFE274433C82DE67C1CBCA18EF--><AD_MESSAGE>
<!--9ADC48AFE274433C82DE67C1CBCA18EF--> <AD_MESSAGE_ID><![CDATA[9ADC48AFE274433C82DE67C1CBCA18EF]]></AD_MESSAGE_ID>
<!--9ADC48AFE274433C82DE67C1CBCA18EF--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
diff -r 7c326d82a3b4 -r 87726c2ebd61 web/org.openbravo.retail.posterminal/js/pointofsale/view/keyboard-toolbars.js
--- a/web/org.openbravo.retail.posterminal/js/pointofsale/view/keyboard-toolbars.js Mon Jun 05 12:16:17 2017 +0200
+++ b/web/org.openbravo.retail.posterminal/js/pointofsale/view/keyboard-toolbars.js Wed Jun 07 13:31:33 2017 +0530
@@ -93,7 +93,8 @@
}
if (OB.DEC.compare(amount) > 0) {
- var provider, receiptToPay, me = this;
+ var provider, receiptToPay, me = this,
+ paymentLine, auxReceipt;
if (this.model.get('leftColumnViewManager').isOrder()) {
receiptToPay = this.receipt;
}
@@ -108,20 +109,51 @@
provider = paymentMethod.refundProvider;
}
+ paymentLine = new OB.Model.PaymentLine({
+ 'kind': key,
+ 'name': name,
+ 'amount': amount,
+ 'rate': rate,
+ 'mulrate': mulrate,
+ 'isocode': isocode,
+ 'allowOpenDrawer': paymentMethod.allowopendrawer,
+ 'isCash': paymentMethod.iscash,
+ 'openDrawer': paymentMethod.openDrawer,
+ 'printtwice': paymentMethod.printtwice
+ });
+
if (provider) {
- this.doShowPopup({
- popup: 'modalpayment',
- args: {
- 'receipt': receiptToPay,
- 'provider': provider,
- 'key': key,
- 'name': name,
- 'paymentMethod': paymentMethod,
- 'amount': amount,
- 'rate': rate,
- 'mulrate': mulrate,
- 'isocode': isocode
- }
+ if (this.model.get('leftColumnViewManager').isOrder()) {
+ auxReceipt = new OB.Model.Order();
+ } else if (this.model.get('leftColumnViewManager').isMultiOrder()) {
+ auxReceipt = new OB.Model.MultiOrders();
+ }
+ OB.UTIL.clone(receiptToPay, auxReceipt);
+ auxReceipt.set('id', null);
+ auxReceipt.addPayment(paymentLine, function () {
+ receiptToPay.trigger('checkValidPaymentsByReceipt', auxReceipt, amount, function (result) {
+ if (me.model.get('leftColumnViewManager').isOrder()) {
+ OB.Dal.remove(auxReceipt);
+ } else if (me.model.get('leftColumnViewManager').isMultiOrder()) {
+ auxReceipt.resetValues();
+ }
+ if (result) {
+ me.doShowPopup({
+ popup: 'modalpayment',
+ args: {
+ 'receipt': receiptToPay,
+ 'provider': provider,
+ 'key': key,
+ 'name': name,
+ 'paymentMethod': paymentMethod,
+ 'amount': amount,
+ 'rate': rate,
+ 'mulrate': mulrate,
+ 'isocode': isocode
+ }
+ });
+ }
+ });
});
} else {
// Calculate total amount to pay with selected PaymentMethod
@@ -154,18 +186,7 @@
currency: '',
symbolAtRight: true
});
- this.model.addPayment(new OB.Model.PaymentLine({
- 'kind': key,
- 'name': name,
- 'amount': amount,
- 'rate': rate,
- 'mulrate': mulrate,
- 'isocode': isocode,
- 'allowOpenDrawer': paymentMethod.allowopendrawer,
- 'isCash': paymentMethod.iscash,
- 'openDrawer': paymentMethod.openDrawer,
- 'printtwice': paymentMethod.printtwice
- }), callback);
+ this.model.addPayment(paymentLine, callback);
}
}
}
diff -r 7c326d82a3b4 -r 87726c2ebd61 web/org.openbravo.retail.posterminal/js/pointofsale/view/payment.js
--- a/web/org.openbravo.retail.posterminal/js/pointofsale/view/payment.js Mon Jun 05 12:16:17 2017 +0200
+++ b/web/org.openbravo.retail.posterminal/js/pointofsale/view/payment.js Wed Jun 07 13:31:33 2017 +0530
@@ -245,7 +245,8 @@
}],
receiptChanged: function () {
- var me = this;
+ var me = this,
+ validatePaymentsByReceipt;
this.$.payments.setCollection(this.receipt.get('payments'));
this.$.multiPayments.setCollection(this.model.get('multiOrders').get('payments'));
this.receipt.on('change:payment change:change calculategross change:bp change:gross', function () {
@@ -292,6 +293,30 @@
this.receipt.on('extrainfo', function (info) {
this.updateExtraInfo(info);
}, this);
+
+ validatePaymentsByReceipt = function (auxReceipt, amount, callback) {
+ var selectedPayment = OB.MobileApp.model.paymentnames[auxReceipt.get('selectedPayment') || OB.MobileApp.model.get('paymentcash')];
+ me.$.errorLabelArea.hide();
+ me.checkValidPayments(auxReceipt.getPaymentStatus(), selectedPayment, function () {
+ var firstShowingObject = me.getFirstShowingObject(me.errorLabels),
+ hasPaymentError = _.isEmpty(firstShowingObject);
+ me.resetLabelAndButton();
+ if (!hasPaymentError) {
+ OB.UTIL.showConfirmation.display('', OB.I18N.getLabel('OBPOS_ErrorInProviderAddPayment', [firstShowingObject.getContent(), amount, selectedPayment.payment.commercialName]));
+ me.receipt.stopAddingPayments = false;
+ }
+ if (callback) {
+ callback(hasPaymentError);
+ }
+ });
+ };
+
+ this.receipt.on('checkValidPaymentsByReceipt', function (auxReceipt, amount, callback) {
+ validatePaymentsByReceipt(auxReceipt, amount, callback);
+ }, this);
+ this.model.get('multiOrders').on('checkValidPaymentsByReceipt', function (auxReceipt, amount, callback) {
+ validatePaymentsByReceipt(auxReceipt, amount, callback);
+ }, this);
},
updateExtraInfo: function (info) {
@@ -653,8 +678,8 @@
return check;
},
- checkValidPayments: function (paymentstatus, selectedPayment) {
- var resultOK, me = this;
+ checkValidPayments: function (paymentstatus, selectedPayment, callback) {
+ var resultOK, callbackFunc, me = this;
if (!selectedPayment) {
return;
@@ -667,6 +692,11 @@
}
this.$.noenoughchangelbl.hide();
this.$.onlycashpaymentmethod.hide();
+ callbackFunc = function () {
+ if (callback) {
+ callback();
+ }
+ };
// Do the checkins
this.receipt.stopAddingPayments = !_.isEmpty(this.getShowingErrorMessages());
@@ -676,6 +706,7 @@
// avoid checking for shared paymentMethod
if (paymentstatus.change && selectedPayment.paymentMethod.isshared) {
resultOK = true;
+ callbackFunc();
} else {
resultOK = this.checkEnoughCashAvailable(paymentstatus, selectedPayment, this, 'Done', function (success) {
var lsuccess = success;
@@ -694,6 +725,7 @@
this.checkEnoughCashAvailable(paymentstatus, selectedPayment, this, 'Credit', function (success) {
this.setStatusButtons(success, 'Credit');
});
+ callbackFunc();
});
}
} else if (!this.receipt.stopAddingPayments) {
@@ -701,13 +733,14 @@
this.$.exactbutton.setLocalDisabled(false);
this.$.layawayaction.setLocalDisabled(false);
this.$.creditsalesaction.setLocalDisabled(false);
+ callbackFunc();
}
-
} else {
me.receipt.stopAddingPayments = !_.isEmpty(me.getShowingErrorMessages());
// Finally set status of buttons
this.setStatusButtons(resultOK, 'Done');
this.setStatusButtons(resultOK, 'Layaway');
+ callbackFunc();
}
if (resultOK) {
this.$.noenoughchangelbl.hide();
@@ -773,6 +806,19 @@
errorLabelArray.push(this.$.extrainfo);
return errorLabelArray;
},
+ resetLabelAndButton: function () {
+ this.$.changeexceedlimit.hide();
+ this.$.overpaymentnotavailable.hide();
+ this.$.overpaymentexceedlimit.hide();
+ this.$.noenoughchangelbl.hide();
+ this.$.onlycashpaymentmethod.hide();
+ this.$.errorLabelArea.show();
+
+ this.$.donebutton.setLocalDisabled(false);
+ this.$.exactbutton.setLocalDisabled(false);
+ this.$.layawayaction.setLocalDisabled(false);
+ this.$.creditsalesaction.setLocalDisabled(false);
+ },
getFirstShowingObject: function (errorLabelArray) {
var showingObj = '',
i;
@@ -826,7 +872,7 @@
var arrayContent = this.errorLabels[i];
if (arrayContent.showing && arrayContent.type === 'error') {
count = count + 1;
- msgToReturn = msgToReturn + '\n' + count + ')' + arrayContent.content;
+ msgToReturn = msgToReturn + '\n' + count + ') ' + arrayContent.content;
}
}
}
|