Attached Files | issue 40061 posterminal formatter.patch [^] (13,796 bytes) 2019-01-30 16:35 [Show Content] [Hide Content]# HG changeset patch
# User Ranjith S R <ranjith@qualiantech.com>
# Date 1548861487 -19800
# Wed Jan 30 20:48:07 2019 +0530
# Node ID 22b071f5c3ce0a7f3ea684bee0d72d4c13429bd9
# Parent 64c74df0d918194d0a8d0a3c4d56bbe9aef7f51e
Related to issue 40061 : Applied New Java Formatting
diff -r 64c74df0d918 -r 22b071f5c3ce src/org/openbravo/retail/posterminal/UpdateCashup.java
--- a/src/org/openbravo/retail/posterminal/UpdateCashup.java Fri Dec 14 15:28:47 2018 +0530
+++ b/src/org/openbravo/retail/posterminal/UpdateCashup.java Wed Jan 30 20:48:07 2019 +0530
@@ -52,12 +52,13 @@
// to get the lock on the record. The reason for this is to prevent the same cash up from being
// processed twice in case of very quick duplicated requests.
// These shouldn't happen in general but may happen specifically in case of unreliable networks
- OBPOSApplications posTerminal = OBDal.getInstance().get(OBPOSApplications.class,
- jsonCashup.getString("posterminal"));
+ OBPOSApplications posTerminal = OBDal.getInstance()
+ .get(OBPOSApplications.class, jsonCashup.getString("posterminal"));
Date cashUpReportDate = null;
Date lastCashUpReportDate = null;
OBPOSAppCashup cashUp = null;
- Query cashUpQuery = OBDal.getInstance().getSession()
+ Query cashUpQuery = OBDal.getInstance()
+ .getSession()
.createQuery("from OBPOS_App_Cashup where id=:cashUpId");
cashUpQuery.setParameter("cashUpId", cashUpId);
// The record will be locked to this process until it ends. Other requests to process this cash
@@ -76,8 +77,8 @@
PropertyByType.DATETIME,
(cashUpReportString).subSequence(0, (cashUpReportString).lastIndexOf("Z")) + ":00");
} else {
- cashUpReportDate = (Date) JsonToDataConverter.convertJsonToPropertyValue(
- PropertyByType.DATETIME, cashUpReportString);
+ cashUpReportDate = (Date) JsonToDataConverter
+ .convertJsonToPropertyValue(PropertyByType.DATETIME, cashUpReportString);
}
}
@@ -108,7 +109,8 @@
} catch (JSONException e) {
throw new OBException("Cashup JSON seems to be corrupted: ", e);
} catch (Exception e) {
- Query maybeCashupWasCreatedInParallel = OBDal.getInstance().getSession()
+ Query maybeCashupWasCreatedInParallel = OBDal.getInstance()
+ .getSession()
.createQuery("from OBPOS_App_Cashup where id=:cashUpId");
maybeCashupWasCreatedInParallel.setParameter("cashUpId", cashUpId);
cashUp = (OBPOSAppCashup) maybeCashupWasCreatedInParallel.uniqueResult();
@@ -128,9 +130,8 @@
}
// If the cashup is new or the incoming cashup report is newer, update the cashUp info
- if (cashUp.getLastcashupreportdate() == null
- || (lastCashUpReportDate != null && lastCashUpReportDate.getTime() >= cashUp
- .getLastcashupreportdate().getTime())) {
+ if (cashUp.getLastcashupreportdate() == null || (lastCashUpReportDate != null
+ && lastCashUpReportDate.getTime() >= cashUp.getLastcashupreportdate().getTime())) {
if (jsonCashup.has("objToSend")) {
JSONObject jsonInfoCashUp = new JSONObject(jsonCashup.getString("objToSend"));
// JSONObject jsonInfoCashUp = (JSONObject) jsonCashup.get("objToSend");
@@ -145,8 +146,8 @@
}
// Associate master/slave cashup
- if ((posTerminal.isMaster() && posTerminal.getOBPOSApplicationsMasterterminalIDList().size() != cashUp
- .getOBPOSAppCashupObposParentCashupIDList().size())
+ if ((posTerminal.isMaster() && posTerminal.getOBPOSApplicationsMasterterminalIDList()
+ .size() != cashUp.getOBPOSAppCashupObposParentCashupIDList().size())
|| (posTerminal.getMasterterminal() != null && cashUp.getObposParentCashup() == null)) {
associateMasterSlave(cashUp, posTerminal);
}
@@ -163,8 +164,8 @@
* @throws JSONException
*/
private static void updateCashUpInfo(OBPOSAppCashup cashup, JSONObject jsonCashup,
- Date cashUpDate, Date cashUpReportDate, Date lastCashUpReportDate) throws JSONException,
- OBException {
+ Date cashUpDate, Date cashUpReportDate, Date lastCashUpReportDate)
+ throws JSONException, OBException {
if (cashup.isProcessed() && jsonCashup.getString("isprocessed").equalsIgnoreCase("N")) {
throw new OBException("The cashup is processed, and it can not be set as unprocessed");
@@ -173,8 +174,8 @@
cashup.setGrosssales(new BigDecimal(jsonCashup.getString("grossSales")));
cashup.setNetreturns(new BigDecimal(jsonCashup.getString("netReturns")));
cashup.setGrossreturns(new BigDecimal(jsonCashup.getString("grossReturns")));
- cashup.setTotalretailtransactions(new BigDecimal(jsonCashup
- .getString("totalRetailTransactions")));
+ cashup.setTotalretailtransactions(
+ new BigDecimal(jsonCashup.getString("totalRetailTransactions")));
cashup.setProcessed(jsonCashup.getString("isprocessed").equalsIgnoreCase("Y"));
cashup.setCashUpDate(cashUpDate);
cashup.setLastcashupreportdate(lastCashUpReportDate);
@@ -183,16 +184,10 @@
// In case of Slave/Master Check if slave is processed or not
for (OBPOSAppCashup slaveCashup : cashup.getOBPOSAppCashupObposParentCashupIDList()) {
if (!slaveCashup.isProcessed()) {
- log.debug("Master/Slave association ("
- + new Date()
- + "): Unlink slave terminal: "
- + slaveCashup.getPOSTerminal().getName()
- + " and Cashup id: "
- + slaveCashup.getId()
- + " linked with master terminal: "
- + cashup.getPOSTerminal().getName()
- + " and Cashup id: "
- + cashup.getId()
+ log.debug("Master/Slave association (" + new Date() + "): Unlink slave terminal: "
+ + slaveCashup.getPOSTerminal().getName() + " and Cashup id: " + slaveCashup.getId()
+ + " linked with master terminal: " + cashup.getPOSTerminal().getName()
+ + " and Cashup id: " + cashup.getId()
+ " because slave terminal has no transactions and it will be associated with the next master terminal cashup");
slaveCashup.setObposParentCashup(null);
OBDal.getInstance().save(slaveCashup);
@@ -203,8 +198,8 @@
}
private static void updateOrCreateCashupInfo(String cashUpId, JSONObject jsonCashup,
- Date cashUpDate, Date cashUpReportDate, Date lastCashUpReportDate) throws JSONException,
- OBException {
+ Date cashUpDate, Date cashUpReportDate, Date lastCashUpReportDate)
+ throws JSONException, OBException {
OBPOSAppCashup cashup = OBDal.getInstance().get(OBPOSAppCashup.class, cashUpId);
// Update cashup info
updateCashUpInfo(cashup, jsonCashup, cashUpDate, cashUpReportDate, lastCashUpReportDate);
@@ -223,18 +218,19 @@
JSONArray paymentCashupInfo = jsonCashup.getJSONArray("cashPaymentMethodInfo");
for (int i = 0; i < paymentCashupInfo.length(); ++i) {
JSONObject payment = paymentCashupInfo.getJSONObject(i);
- if ((payment.has("newPaymentMethod") && payment.getString("newPaymentMethod")
- .equals("true"))
- || (payment.has("usedInCurrentTrx") && payment.getString("usedInCurrentTrx").equals(
- "true"))) {
+ if ((payment.has("newPaymentMethod")
+ && payment.getString("newPaymentMethod").equals("true"))
+ || (payment.has("usedInCurrentTrx")
+ && payment.getString("usedInCurrentTrx").equals("true"))) {
+
// Set Amount To Keep
if (jsonCashup.has("cashCloseInfo")) {
// Get the paymentMethod id
JSONArray cashCloseInfo = jsonCashup.getJSONArray("cashCloseInfo");
for (int j = 0; j < cashCloseInfo.length(); ++j) {
JSONObject paymentMethod = cashCloseInfo.getJSONObject(j);
- if (paymentMethod.getString("paymentTypeId").equals(
- payment.getString("paymentMethodId"))) {
+ if (paymentMethod.getString("paymentTypeId")
+ .equals(payment.getString("paymentMethodId"))) {
payment.put("amountToKeep",
paymentMethod.getJSONObject("paymentMethod").getString("amountToKeep"));
BigDecimal expected = BigDecimal.ZERO;
@@ -245,9 +241,9 @@
difference = new BigDecimal(paymentMethod.getString("difference"));
} else if (paymentMethod.has("foreignExpected")) {
expected = new BigDecimal(paymentMethod.getString("foreignExpected"));
- difference = new BigDecimal(
- paymentMethod.has("foreignDifference") ? paymentMethod
- .getString("foreignDifference") : paymentMethod.getString("difference"));
+ difference = new BigDecimal(paymentMethod.has("foreignDifference")
+ ? paymentMethod.getString("foreignDifference")
+ : paymentMethod.getString("difference"));
}
payment.put("totalCounted",
expected.add(difference).setScale(2, RoundingMode.HALF_UP).toString());
@@ -268,8 +264,8 @@
*/
private static void createPaymentMethodCashUp(OBPOSAppCashup cashup, JSONObject jsonCashup)
throws JSONException {
- OBPOSPaymentMethodCashup newPaymentMethodCashUp = OBDal.getInstance().get(
- OBPOSPaymentMethodCashup.class, jsonCashup.get("id"));
+ OBPOSPaymentMethodCashup newPaymentMethodCashUp = OBDal.getInstance()
+ .get(OBPOSPaymentMethodCashup.class, jsonCashup.get("id"));
if (newPaymentMethodCashUp == null) {
newPaymentMethodCashUp = OBProvider.getInstance().get(OBPOSPaymentMethodCashup.class);
@@ -277,8 +273,8 @@
newPaymentMethodCashUp.setId(jsonCashup.get("id"));
cashup.getOBPOSPaymentmethodcashupList().add(newPaymentMethodCashUp);
}
- JSONPropertyToEntity.fillBobFromJSON(newPaymentMethodCashUp.getEntity(),
- newPaymentMethodCashUp, jsonCashup);
+ JSONPropertyToEntity.fillBobFromJSON(newPaymentMethodCashUp.getEntity(), newPaymentMethodCashUp,
+ jsonCashup);
newPaymentMethodCashUp.setCashUp(cashup);
newPaymentMethodCashUp.setOrganization(cashup.getOrganization());
@@ -292,15 +288,17 @@
newPaymentMethodCashUp.setTotalreturns(new BigDecimal(jsonCashup.getString("totalReturns")));
newPaymentMethodCashUp.setTotalDeposits(new BigDecimal(jsonCashup.getString("totalDeposits")));
newPaymentMethodCashUp.setTotalDrops(new BigDecimal(jsonCashup.getString("totalDrops")));
- newPaymentMethodCashUp.setTotalCounted(jsonCashup.has("totalCounted") ? new BigDecimal(
- jsonCashup.getString("totalCounted")) : BigDecimal.ZERO);
- newPaymentMethodCashUp.setAmountToKeep(jsonCashup.has("amountToKeep") ? new BigDecimal(
- jsonCashup.getString("amountToKeep")) : BigDecimal.ZERO);
+ newPaymentMethodCashUp.setTotalCounted(
+ jsonCashup.has("totalCounted") ? new BigDecimal(jsonCashup.getString("totalCounted"))
+ : BigDecimal.ZERO);
+ newPaymentMethodCashUp.setAmountToKeep(
+ jsonCashup.has("amountToKeep") ? new BigDecimal(jsonCashup.getString("amountToKeep"))
+ : BigDecimal.ZERO);
newPaymentMethodCashUp.setRate(new BigDecimal(jsonCashup.getString("rate")));
newPaymentMethodCashUp.setIsocode((String) jsonCashup.get("isocode"));
- OBPOSAppPayment appPayment = OBDal.getInstance().get(OBPOSAppPayment.class,
- jsonCashup.getString("paymentMethodId"));
+ OBPOSAppPayment appPayment = OBDal.getInstance()
+ .get(OBPOSAppPayment.class, jsonCashup.getString("paymentMethodId"));
newPaymentMethodCashUp.setPaymentType(appPayment);
String name = appPayment.getCommercialName();
@@ -316,8 +314,8 @@
*/
private static void createTaxCashUp(OBPOSAppCashup cashup, JSONObject jsonCashup)
throws JSONException {
- OBPOSTaxCashup newTax = OBDal.getInstance().get(OBPOSTaxCashup.class,
- jsonCashup.getString("id"));
+ OBPOSTaxCashup newTax = OBDal.getInstance()
+ .get(OBPOSTaxCashup.class, jsonCashup.getString("id"));
if (newTax == null) {
newTax = OBProvider.getInstance().get(OBPOSTaxCashup.class);
newTax.setNewOBObject(true);
@@ -342,8 +340,8 @@
+ OBPOSAppCashup.PROPERTY_ISPROCESSEDBO + " = 'N' and "
+ OBPOSAppCashup.PROPERTY_ISPROCESSED + " = 'N' and "
+ OBPOSAppCashup.PROPERTY_OBPOSPARENTCASHUP + " is null";
- OBQuery<OBPOSAppCashup> appCashupQuery = OBDal.getInstance().createQuery(
- OBPOSAppCashup.class, query);
+ OBQuery<OBPOSAppCashup> appCashupQuery = OBDal.getInstance()
+ .createQuery(OBPOSAppCashup.class, query);
appCashupQuery.setNamedParameter("terminalId", posTerminal.getId());
List<OBPOSAppCashup> appCashupList = appCashupQuery.list();
for (OBPOSAppCashup appCashup : appCashupList) {
@@ -377,8 +375,8 @@
query = OBPOSAppCashup.PROPERTY_POSTERMINAL + ".id = :terminalId and "
+ OBPOSAppCashup.PROPERTY_ISPROCESSEDBO + " = 'N' and "
+ OBPOSAppCashup.PROPERTY_ISPROCESSED + " = 'N' ";
- OBQuery<OBPOSAppCashup> appCashupQuery = OBDal.getInstance().createQuery(
- OBPOSAppCashup.class, query);
+ OBQuery<OBPOSAppCashup> appCashupQuery = OBDal.getInstance()
+ .createQuery(OBPOSAppCashup.class, query);
appCashupQuery.setNamedParameter("terminalId", posTerminal.getMasterterminal().getId());
List<OBPOSAppCashup> appCashupList = appCashupQuery.list();
if (appCashupList.size() > 0 && cashUp.getObposParentCashup() == null) {
issue 40061 posterminal fix.patch [^] (5,654 bytes) 2019-01-30 16:36 [Show Content] [Hide Content]# HG changeset patch
# User Ranjith S R <ranjith@qualiantech.com>
# Date 1548862494 -19800
# Wed Jan 30 21:04:54 2019 +0530
# Node ID 814e2c1990ea261a9a7e62914bdd0c2e3ab2bfc6
# Parent 22b071f5c3ce0a7f3ea684bee0d72d4c13429bd9
Fixed issue 40061 : PaymentMethodCashup should be updated when Cashup is Done
* PaymentMethodCashup should be created/updated for the following cases
1) when cashup is closed
2) when ticket is closed with respective payment
diff -r 22b071f5c3ce -r 814e2c1990ea src/org/openbravo/retail/posterminal/UpdateCashup.java
--- a/src/org/openbravo/retail/posterminal/UpdateCashup.java Wed Jan 30 20:48:07 2019 +0530
+++ b/src/org/openbravo/retail/posterminal/UpdateCashup.java Wed Jan 30 21:04:54 2019 +0530
@@ -1,6 +1,6 @@
/*
************************************************************************************
- * Copyright (C) 2016-2018 Openbravo S.L.U.
+ * Copyright (C) 2016-2019 Openbravo S.L.U.
* Licensed under the Openbravo Commercial License version 1.0
* You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
* or in the legal folder of this module distribution.
@@ -28,12 +28,11 @@
import org.openbravo.dal.service.OBQuery;
import org.openbravo.mobile.core.process.JSONPropertyToEntity;
import org.openbravo.mobile.core.process.PropertyByType;
-import org.openbravo.service.importprocess.ImportEntryManager;
import org.openbravo.service.json.JsonToDataConverter;
public class UpdateCashup {
- private static final Logger log = Logger.getLogger(ImportEntryManager.class);
+ private static final Logger log = Logger.getLogger(UpdateCashup.class);
/**
* Get and update a cashup. If cashup not exist it's created, otherwise update the cashup data
@@ -217,39 +216,44 @@
if (jsonCashup.has("cashPaymentMethodInfo")) {
JSONArray paymentCashupInfo = jsonCashup.getJSONArray("cashPaymentMethodInfo");
for (int i = 0; i < paymentCashupInfo.length(); ++i) {
+ boolean createPaymentMethods = false;
JSONObject payment = paymentCashupInfo.getJSONObject(i);
if ((payment.has("newPaymentMethod")
&& payment.getString("newPaymentMethod").equals("true"))
|| (payment.has("usedInCurrentTrx")
&& payment.getString("usedInCurrentTrx").equals("true"))) {
+ createPaymentMethods = true;
+ }
- // Set Amount To Keep
- if (jsonCashup.has("cashCloseInfo")) {
- // Get the paymentMethod id
- JSONArray cashCloseInfo = jsonCashup.getJSONArray("cashCloseInfo");
- for (int j = 0; j < cashCloseInfo.length(); ++j) {
- JSONObject paymentMethod = cashCloseInfo.getJSONObject(j);
- if (paymentMethod.getString("paymentTypeId")
- .equals(payment.getString("paymentMethodId"))) {
- payment.put("amountToKeep",
- paymentMethod.getJSONObject("paymentMethod").getString("amountToKeep"));
- BigDecimal expected = BigDecimal.ZERO;
- BigDecimal difference = BigDecimal.ZERO;
- BigDecimal rate = new BigDecimal(payment.getString("rate"));
- if (rate.compareTo(BigDecimal.ONE) == 0) {
- expected = new BigDecimal(paymentMethod.getString("expected"));
- difference = new BigDecimal(paymentMethod.getString("difference"));
- } else if (paymentMethod.has("foreignExpected")) {
- expected = new BigDecimal(paymentMethod.getString("foreignExpected"));
- difference = new BigDecimal(paymentMethod.has("foreignDifference")
- ? paymentMethod.getString("foreignDifference")
- : paymentMethod.getString("difference"));
- }
- payment.put("totalCounted",
- expected.add(difference).setScale(2, RoundingMode.HALF_UP).toString());
+ // Set Amount To Keep
+ if (jsonCashup.has("cashCloseInfo")) {
+ // Get the paymentMethod id
+ JSONArray cashCloseInfo = jsonCashup.getJSONArray("cashCloseInfo");
+ for (int j = 0; j < cashCloseInfo.length(); ++j) {
+ JSONObject paymentMethod = cashCloseInfo.getJSONObject(j);
+ if (paymentMethod.getString("paymentTypeId")
+ .equals(payment.getString("paymentMethodId"))) {
+ payment.put("amountToKeep",
+ paymentMethod.getJSONObject("paymentMethod").getString("amountToKeep"));
+ BigDecimal expected = BigDecimal.ZERO;
+ BigDecimal difference = BigDecimal.ZERO;
+ BigDecimal rate = new BigDecimal(payment.getString("rate"));
+ if (rate.compareTo(BigDecimal.ONE) == 0) {
+ expected = new BigDecimal(paymentMethod.getString("expected"));
+ difference = new BigDecimal(paymentMethod.getString("difference"));
+ } else if (paymentMethod.has("foreignExpected")) {
+ expected = new BigDecimal(paymentMethod.getString("foreignExpected"));
+ difference = new BigDecimal(paymentMethod.has("foreignDifference")
+ ? paymentMethod.getString("foreignDifference")
+ : paymentMethod.getString("difference"));
}
+ payment.put("totalCounted",
+ expected.add(difference).setScale(2, RoundingMode.HALF_UP).toString());
+ createPaymentMethods = true;
}
}
+ }
+ if (createPaymentMethods) {
createPaymentMethodCashUp(cashup, payment);
}
}
issue 40061 pimobile test.patch [^] (7,431 bytes) 2019-01-30 16:36 [Show Content] [Hide Content]# HG changeset patch
# User Ranjith S R <ranjith@qualiantech.com>
# Date 1548860382 -19800
# Wed Jan 30 20:29:42 2019 +0530
# Node ID 82bbc1f120bd9e2d5f1b96e77a386179bc37b3db
# Parent cdc990e1691cf3b538e411a826b37138e749d1eb
Verifies issue 40061 : Added Automated Test "I40061_VerifyCountedAmountAfterCashup"
diff -r cdc990e1691c -r 82bbc1f120bd src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/cashup/I40061_VerifyCountedAmountAfterCashup.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/cashup/I40061_VerifyCountedAmountAfterCashup.java Wed Jan 30 20:29:42 2019 +0530
@@ -0,0 +1,157 @@
+/*
+ *************************************************************************
+ * 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) 2019 Openbravo S.L.U.
+ * All Rights Reserved.
+ * Contributor(s):
+ ************************************************************************
+ *
+ * @author RAN
+ *
+ */
+
+package org.openbravo.test.mobile.retail.pack.selenium.tests.cashup;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import org.junit.Test;
+import org.openbravo.test.mobile.core.selenium.SeleniumHelper;
+import org.openbravo.test.mobile.retail.extmodules.selenium.TestIdExtModules;
+import org.openbravo.test.mobile.retail.mobilecore.database.DatabaseHelperSelect;
+import org.openbravo.test.mobile.retail.mobilecore.javascript.SynchronizationMonitor;
+import org.openbravo.test.mobile.retail.mobilecore.utils.ApplicationWindow;
+import org.openbravo.test.mobile.retail.multiserver.selenium.TestIdMultiserver;
+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 I40061_VerifyCountedAmountAfterCashup extends WebPOSTerminalHelper {
+
+ @Test
+ public void test() {
+ WebPOSAPI.cleanCashup(this);
+ // Create and Pay Receipt by Cash
+ addProduct();
+ tap(TestIdPack.BUTTON_PAY);
+ tap(TestIdPack.BUTTON_PAY_EXACT);
+ tap(TestIdPack.BUTTON_PAY_DONE);
+ verify(TestIdPack.LABEL_TOTALTOPAY, "0.00");
+
+ // Create and Pay Receipt by Card
+ addProduct();
+ tap(TestIdPack.BUTTON_PAY);
+ tap(TestIdPack.BUTTON_CARD);
+ tap(TestIdPack.BUTTON_PAY_EXACT);
+ tap(TestIdPack.BUTTON_PAY_DONE);
+ verify(TestIdPack.LABEL_TOTALTOPAY, "0.00");
+
+ // Create and Pay Receipt by USA Cash
+ addProduct();
+ tap(TestIdPack.BUTTON_PAY);
+ tap(TestIdPack.BUTTON_CASHUSA);
+ tap(TestIdPack.BUTTON_PAY_EXACT);
+ tap(TestIdPack.BUTTON_PAY_DONE);
+ verify(TestIdPack.LABEL_TOTALTOPAY, "0.00");
+
+ final String cashupId = (String) SeleniumHelper
+ .executeScriptWithReturn("OB.MobileApp.model.get('terminal').cashUpId");
+
+ // Do Cashup
+ // Count Cash, Card, USA Cash
+ // Keep 100 in Cash and USA Cash
+ tap(TestIdPack.BUTTON_MENU);
+ tap(TestIdPack.BUTTON_MENU_CASHUP);
+ SynchronizationMonitor.waitUntilCurrentWindowIsRendered(ApplicationWindow.CASHUP);
+ verify(TestIdExtModules.LABEL_CASHUP_TITLE, "Cash Up");
+ final String cashupDate = (String) SeleniumHelper
+ .executeScriptWithReturn("OB.OBPOSCashUp.UI.CashUp.getTitleExtensions()");
+ verify(TestIdPack.LABEL_CASHUP_STEP2_TITLE, "Step 1 of 4: Count Cash" + cashupDate);
+ tap(TestIdPack.BUTTON_CASHUP_COUNTCASH_50);
+ tap(TestIdPack.BUTTON_CASHUP_COUNTCASH_50);
+ tap(TestIdPack.BUTTON_CASHUP_COUNTCASH_50);
+ tap(TestIdPack.BUTTON_CASHUP_COUNTCASH_050);
+ tap(TestIdPack.BUTTON_CASHUP_NEXT);
+
+ verify(TestIdPack.LABEL_CASHUP_STEP3_TITLE, "Step 2 of 4: Count Cash" + cashupDate);
+ tap(TestIdMultiserver.BUTTON_CASHUP_CARD_OK);
+ tap(TestIdMultiserver.BUTTON_CASHUP_CASHUSA_OK);
+ tap(TestIdMultiserver.BUTTON_CASHUP_VOUCHER_OK);
+ tap(TestIdMultiserver.BUTTON_CASHUP_NEXT);
+
+ verify(TestIdPack.LABEL_CASHUP_STEP4_TITLE, "Step 3 of 4: Select Cash to keep" + cashupDate);
+ tap(TestIdPack.BUTTON_CASHUP_KEEPVARIABLEAMOUNT);
+ tap(TestIdPack.BUTTON_KEYPAD_1);
+ tap(TestIdPack.BUTTON_KEYPAD_0);
+ tap(TestIdPack.BUTTON_KEYPAD_0);
+ tap(TestIdPack.BUTTON_KEYPAD_ENTER);
+ tap(TestIdPack.BUTTON_CASHUP_NEXT);
+
+ verify(TestIdPack.LABEL_CASHUP_STEP4_TITLE,
+ "Step 3 of 4: Select USA Cash to keep" + cashupDate);
+ tap(TestIdPack.BUTTON_CASHUP_KEEPVARIABLEAMOUNT);
+ tap(TestIdPack.BUTTON_KEYPAD_1);
+ tap(TestIdPack.BUTTON_KEYPAD_0);
+ tap(TestIdPack.BUTTON_KEYPAD_0);
+ tap(TestIdPack.BUTTON_KEYPAD_ENTER);
+ tap(TestIdPack.BUTTON_CASHUP_NEXT);
+
+ verify(TestIdPack.LABEL_CASHUP_STEP4_TITLE, "Step 3 of 4: Select Voucher to keep" + cashupDate);
+ tap(TestIdPack.BUTTON_CASHUP_KEEPNOTHING);
+ tap(TestIdPack.BUTTON_CASHUP_NEXT);
+
+ verify(TestIdPack.LABEL_CASHUP_STEP5_TITLE, "Step 4 of 4: Post, print and close" + cashupDate);
+ tap(TestIdPack.BUTTON_CASHUP_POSTPRINTANDCLOSE);
+ verify(TestIdExtModules.LABEL_POPUP_TITLE, "Good job!");
+ tap(TestIdPack.BUTTON_POPUP_OK);
+ verify(TestIdPack.LABEL_TOTALTOPAY, "0.00");
+
+ final String sql = String.format("select ap.name, pmc.totalcounted, pmc.amounttokeep "
+ + "from obpos_paymentmethodcashup pmc join obpos_app_payment ap on ap.obpos_app_payment_id = pmc.obpos_app_payment_id "
+ + "where pmc.obpos_app_cashup_id = '%s' and pmc.totalcounted > 0 order by ap.name",
+ cashupId);
+ new DatabaseHelperSelect() {
+
+ @Override
+ protected void yieldResultSet(final ResultSet rs) throws SQLException {
+ switch (rs.getString("name")) {
+ // Cash
+ case "Card":
+ assertThat((float) 150.50, equalTo(rs.getFloat("totalcounted")));
+ assertThat((float) 0.00, equalTo(rs.getFloat("amounttokeep")));
+ break;
+ // Card
+ case "Cash":
+ assertThat((float) 150.50, equalTo(rs.getFloat("totalcounted")));
+ assertThat((float) 100.00, equalTo(rs.getFloat("amounttokeep")));
+ break;
+ case "USA Cash":
+ assertThat((float) 197.81, equalTo(rs.getFloat("totalcounted")));
+ assertThat((float) 100.00, equalTo(rs.getFloat("amounttokeep")));
+ break;
+ }
+ }
+ }.execute(sql, 3);
+ }
+
+ private void addProduct() {
+ // Create and Pay Receipt by Cash
+ tap(TestIdPack.BUTTON_BROWSE);
+ tap(TestIdPack.BUTTON_CATEGORY_BESTSELLERS);
+ tap(TestIdPack.BUTTON_PRODUCT_BESTSELLERS_AVALANCHETRANSCEIVER);
+ verify(TestIdPack.LABEL_TOTALTOPAY, "150.50");
+ }
+}
issue40019ScriptFixData_v2.sql [^] (3,066 bytes) 2019-09-10 10:25 |