# HG changeset patch
# User Silambarasan Sekar <silambarasan@qualiantech.com>
# Date 1477053888 -19800
#      Fri Oct 21 18:14:48 2016 +0530
# Node ID 4337ebb4781ba82218cd9f9ba567046abe330037
# Parent  1c4a6b8c3b6b02156d92e7c9ac9fd09e0691cdf4
Added Test Case for is Refundable Payment

diff -r 1c4a6b8c3b6b -r 4337ebb4781b src-test/org/openbravo/test/mobile/retail/pack/selenium/TestIdPack.java
--- a/src-test/org/openbravo/test/mobile/retail/pack/selenium/TestIdPack.java	Fri Oct 28 13:02:10 2016 -0600
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/TestIdPack.java	Fri Oct 21 18:14:48 2016 +0530
@@ -139,6 +139,8 @@
       "bodyContent_defaultBox"); //
   public static TestIdConstructor COMBO_USER_PROFILE_ROLE_LIST = new TestIdConstructor(
       "bodyContent_roleList", EnyoKind.BUTTON); //
+  public static TestIdConstructor LOYALITY_CARD_POPUP_CANCEL = new TestIdConstructor(
+      "bodyButtons_cancelDialogButton", EnyoKind.BUTTON); //
 
   // ISLAYAWAY LABEL
   public static TestIdConstructor LABEL_ISLAYAWAY = new TestIdConstructor(
diff -r 1c4a6b8c3b6b -r 4337ebb4781b src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/initialchecks/VerifyNoRefundPayment.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/initialchecks/VerifyNoRefundPayment.java	Fri Oct 21 18:14:48 2016 +0530
@@ -0,0 +1,84 @@
+/*
+ *************************************************************************
+ * 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) 2014 Openbravo S.L.U.
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+
+package org.openbravo.test.mobile.retail.pack.selenium.tests.initialchecks;
+
+/**
+ * author: Simbu
+ */
+import org.junit.Test;
+import org.openbravo.test.mobile.retail.mobilecore.database.DatabaseHelperInsertUpdateOrDelete;
+import org.openbravo.test.mobile.retail.pack.selenium.TestIdPack;
+import org.openbravo.test.mobile.retail.pack.selenium.terminals.WebPOSTerminalHelper;
+
+public class VerifyNoRefundPayment extends WebPOSTerminalHelper {
+  final String VBSCreditPaymentMethodId = "4785B70E9C1048AB9E9E7B26CFEF6E31";
+
+  @Test
+  public void test() {
+    tap(TestIdPack.BUTTON_BROWSE);
+    tap(TestIdPack.BUTTON_CATEGORY_BESTSELLERS);
+    tap(TestIdPack.BUTTON_PRODUCT_BESTSELLERS_AVALANCHETRANSCEIVER);
+    verify(TestIdPack.LABEL_TOTALTOPAY, "150.50");
+    tap(TestIdPack.BUTTON_PAY);
+    // tap(TestIdPack.LOYALITY_CARD_POPUP_CANCEL);
+    isDisabled(TestIdPack.BUTTON_PAYMENT_CARD, false);
+    tap(TestIdPack.BUTTON_PAY_EXACT);
+    tap(TestIdPack.BUTTON_PAY_DONE);
+    verify(TestIdPack.LABEL_TOTALTOPAY, "0.00");
+
+    updateDb("N");
+    reload();
+
+    // Return
+    tap(TestIdPack.BUTTON_BROWSE);
+    tap(TestIdPack.BUTTON_CATEGORY_BESTSELLERS);
+    tap(TestIdPack.BUTTON_PRODUCT_BESTSELLERS_INSECTREPELLENT);
+    tap(TestIdPack.BUTTON_MENU);
+    tap(TestIdPack.BUTTON_MENU_RETURNTHISRECEIPT);
+    tap(TestIdPack.BUTTON_PAY);
+    isDisabled(TestIdPack.BUTTON_PAYMENT_CARD, true);
+
+    /*
+     * tap(TestIdPack.BUTTON_PAY); tap(TestIdPack.LOYALITY_CARD_POPUP_CANCEL);
+     */
+    tap(TestIdPack.BUTTON_PAY_EXACT);
+    tap(TestIdPack.BUTTON_PAY_DONE);
+    verify(TestIdPack.LABEL_TOTALTOPAY, "0.00");
+
+  }
+
+  public void updateDb(final String flag) {
+    // OBPOS_creditcard disable
+    final String setNotRefundable = String.format(
+        "update obpos_app_payment_type set refundpayment='%s' "
+            + "where obpos_app_payment_type_id='%s'", flag, VBSCreditPaymentMethodId);
+    new DatabaseHelperInsertUpdateOrDelete().execute(setNotRefundable, 1);
+  }
+
+  @Override
+  public void afterWithReload() {
+    updateDb("Y");
+  }
+
+  @Override
+  public void beforeWithReload() {
+    updateDb("Y");
+  }
+}
