svn commit: r1128865 [23/27] - in /ofbiz/branches/jackrabbit20100709: ./ applications/accounting/config/ applications/accounting/src/org/ofbiz/accounting/invoice/ applications/accounting/src/org/ofbiz/accounting/payment/ applications/accounting/src/org...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1128865 [23/27] - in /ofbiz/branches/jackrabbit20100709: ./ applications/accounting/config/ applications/accounting/src/org/ofbiz/accounting/invoice/ applications/accounting/src/org/ofbiz/accounting/payment/ applications/accounting/src/org...

sascharodekamp
Modified: ofbiz/branches/jackrabbit20100709/specialpurpose/webpos/script/org/ofbiz/webpos/event/PaymentEvents.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/specialpurpose/webpos/script/org/ofbiz/webpos/event/PaymentEvents.xml?rev=1128865&r1=1128864&r2=1128865&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/specialpurpose/webpos/script/org/ofbiz/webpos/event/PaymentEvents.xml (original)
+++ ofbiz/branches/jackrabbit20100709/specialpurpose/webpos/script/org/ofbiz/webpos/event/PaymentEvents.xml Sun May 29 11:02:09 2011
@@ -19,235 +19,285 @@ under the License.
 -->
 <simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/simple-methods.xsd">
     <simple-method method-name="payCash" short-description="Pay Cash" login-required="true">
-        <if-not-empty field="parameters.confirm">
-            <set field="posTerminalId" value="null"/>
-            <call-class-method class-name="org.ofbiz.webpos.WebPosEvents" method-name="getWebPosSession" ret-field="webPosSession">
-                <field field="request" type="javax.servlet.http.HttpServletRequest"/>
-                <field field="posTerminalId" type="String"/>
-            </call-class-method>
-            <if-not-empty field="webPosSession">
-                <call-object-method obj-field="webPosSession" method-name="getCurrentTransaction" ret-field="webPosTransaction"/>
-                <check-errors/>
-                <set field="amount" from-field="parameters.amount" type="String"/>
-                <set field="allowNegative" value="false" type="Boolean"/>
-                <set field="allowPositive" value="true" type="Boolean"/>
-                <set field="minDecimal" value="0" type="Integer"/>
-                <set field="maxDecimal" value="3" type="Integer"/>
-                <call-class-method class-name="org.ofbiz.base.util.UtilValidate" method-name="isDouble" ret-field="isDouble">
-                    <field field="amount" type="String"/>
-                    <field field="allowNegative" type="boolean"/>
-                    <field field="allowPositive" type="boolean"/>
-                    <field field="minDecimal" type="int"/>
-                    <field field="maxDecimal" type="int"/>
-                </call-class-method>
-                <if-compare field="isDouble" operator="equals" value="true">
-                    <set field="paymentType" value="CASH"/>
-                    <call-object-method obj-field="webPosTransaction" method-name="clearPayment">
-                        <field field="paymentType" type="String"/>
-                    </call-object-method>
-                    <check-errors/>
-                    <set from-field="parameters.amount" field="amounStr"/>
-                    <call-object-method obj-field="webPosTransaction" method-name="processAmount" ret-field="amount">
-                        <field field="amounStr" type="String"/>
-                    </call-object-method>
-                    <check-errors/>
-                    <log level="info" message="Processing [Cash] Amount : ${amount}"/>
-                    <set field="refNum" value=""/>
-                    <set field="authCode" value=""/>
-                    <call-object-method obj-field="webPosTransaction" method-name="addPayment">
-                        <field field="paymentType" type="String"/>
-                        <field field="amount" type="BigDecimal"/>
-                        <field field="refNum" type="String"/>
-                        <field field="authCode" type="String"/>
-                    </call-object-method>
-                    <check-errors/>
-                <else>
-                    <add-error><fail-property resource="WebPosUiLabels" property="WebPosPayCashNotValidAmount"/></add-error>
+        <clear-field field="posTerminalId"/>
+        <call-class-method class-name="org.ofbiz.webpos.WebPosEvents" method-name="getWebPosSession" ret-field="webPosSession">
+            <field field="request" type="javax.servlet.http.HttpServletRequest"/>
+            <field field="posTerminalId" type="String"/>
+        </call-class-method>
+        <if-not-empty field="webPosSession">
+            <call-object-method obj-field="webPosSession" method-name="getCurrentTransaction" ret-field="webPosTransaction"/>
+            <check-errors/>
+            <if-empty field="parameters.amountCash">
+                <call-object-method obj-field="webPosTransaction" method-name="getTotalDue" ret-field="context.amountCash"/>
+                <check-errors/>
+            <else>
+                <call-map-processor in-map-name="parameters" out-map-name="context">
+                    <simple-map-processor name="inputValidate">
+                        <process field="amountCash">
+                            <convert type="BigDecimal" to-field="amountCash" replace="true" set-if-null="false">
+                                <fail-property resource="WebPosUiLabels" property="WebPosPayCashNotValidAmount"/>
+                            </convert>
+                        </process>
+                    </simple-map-processor>
+                </call-map-processor>
+                <check-errors/>
+            </else>
+            </if-empty>
+            <if-empty field="context.amountCash">
+                <add-error><fail-property resource="WebPosUiLabels" property="WebPosPayCashNotValidAmount"/></add-error>
+                <check-errors/>
+            <else>
+                <call-object-method obj-field="webPosTransaction" method-name="getTotalDue" ret-field="totalDue"/>
+                <if-compare field="totalDue" operator="less-equals" value="0.00" type="BigDecimal">
+                    <add-error><fail-property resource="WebPosUiLabels" property="WebPosTransactionTotalDueZero"/></add-error>
                     <check-errors/>
-                </else>
                 </if-compare>
-            <else>
-                <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotLoggedIn"/></add-error>
+                <if-compare-field field="totalDue" operator="less" to-field="context.amountCash" type="BigDecimal">
+                    <add-error><fail-property resource="WebPosUiLabels" property="WebPosPayCashGreaterThanTotalDue"/></add-error>
+                    <check-errors/>
+                </if-compare-field>                
+                <log level="info" message="Processing [Cash] Amount : ${context.amountCash}"/>
+                <set field="paymentType" value="CASH"/>
+                <set field="refNum" value=""/>
+                <set field="authCode" value=""/>
+                <call-object-method obj-field="webPosTransaction" method-name="addPayment">
+                    <field field="paymentType" type="String"/>
+                    <field field="context.amountCash" type="BigDecimal"/>
+                    <field field="refNum" type="String"/>
+                    <field field="authCode" type="String"/>
+                </call-object-method>
                 <check-errors/>
             </else>
-            </if-not-empty>
+            </if-empty>
+        <else>
+            <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotLoggedIn"/></add-error>
+            <check-errors/>
+        </else>
         </if-not-empty>
     </simple-method>
-
+    
     <simple-method method-name="payCheck" short-description="Pay Check" login-required="true">
-        <if-not-empty field="parameters.confirm">
-            <set field="posTerminalId" value="null"/>
-            <call-class-method class-name="org.ofbiz.webpos.WebPosEvents" method-name="getWebPosSession" ret-field="webPosSession">
-                <field field="request" type="javax.servlet.http.HttpServletRequest"/>
-                <field field="posTerminalId" type="String"/>
-            </call-class-method>
-            <if-not-empty field="webPosSession">
-                <call-object-method obj-field="webPosSession" method-name="getCurrentTransaction" ret-field="webPosTransaction"/>
-                <check-errors/>
-                <set field="amount" from-field="parameters.amount" type="String"/>
-                <set field="allowNegative" value="false" type="Boolean"/>
-                <set field="allowPositive" value="true" type="Boolean"/>
-                <set field="minDecimal" value="0" type="Integer"/>
-                <set field="maxDecimal" value="3" type="Integer"/>
-                <call-class-method class-name="org.ofbiz.base.util.UtilValidate" method-name="isDouble" ret-field="isDouble">
-                    <field field="amount" type="String"/>
-                    <field field="allowNegative" type="boolean"/>
-                    <field field="allowPositive" type="boolean"/>
-                    <field field="minDecimal" type="int"/>
-                    <field field="maxDecimal" type="int"/>
-                </call-class-method>
-                <if-compare field="isDouble" operator="equals" value="true">
-                    <set field="paymentType" value="PERSONAL_CHECK"/>
-                    <call-object-method obj-field="webPosTransaction" method-name="checkPaymentMethodType" ret-field="paymentCheck">
+        <clear-field field="posTerminalId"/>
+        <call-class-method class-name="org.ofbiz.webpos.WebPosEvents" method-name="getWebPosSession" ret-field="webPosSession">
+            <field field="request" type="javax.servlet.http.HttpServletRequest"/>
+            <field field="posTerminalId" type="String"/>
+        </call-class-method>
+        <if-not-empty field="webPosSession">
+            <call-object-method obj-field="webPosSession" method-name="getCurrentTransaction" ret-field="webPosTransaction"/>
+            <check-errors/>
+            <if-empty field="parameters.amountCheck">
+                <call-object-method obj-field="webPosTransaction" method-name="getTotalDue" ret-field="context.amountCheck"/>
+                <check-errors/>
+            <else>
+                <call-map-processor in-map-name="parameters" out-map-name="context">
+                    <simple-map-processor name="inputValidate">
+                        <process field="amountCheck">
+                            <convert type="BigDecimal" to-field="amountCheck" replace="true" set-if-null="false">
+                                <fail-property resource="WebPosUiLabels" property="WebPosPayCheckNotValidAmount"/>
+                            </convert>
+                        </process>
+                    </simple-map-processor>
+                </call-map-processor>
+                <check-errors/>
+            </else>
+            </if-empty>
+            <if-not-empty field="context.amountCheck">
+                <call-object-method obj-field="webPosTransaction" method-name="getTotalDue" ret-field="totalDue"/>
+                <if-compare field="totalDue" operator="less-equals" value="0.00" type="BigDecimal">
+                    <add-error><fail-property resource="WebPosUiLabels" property="WebPosTransactionTotalDueZero"/></add-error>
+                    <check-errors/>
+                </if-compare>
+                <if-compare-field field="totalDue" operator="less" to-field="context.amountCheck" type="BigDecimal">
+                    <add-error><fail-property resource="WebPosUiLabels" property="WebPosPayCheckGreaterThanTotalDue"/></add-error>
+                    <check-errors/>
+                </if-compare-field>
+                <set field="paymentType" value="PERSONAL_CHECK"/>
+                <call-object-method obj-field="webPosTransaction" method-name="checkPaymentMethodType" ret-field="paymentCheck">
+                    <field field="paymentType" type="String"/>
+                </call-object-method>
+                <check-errors/>
+                <call-class-method class-name="org.ofbiz.webpos.transaction.WebPosTransaction" method-name="getNoPaymentCode" ret-field="noPaymentCode"/>
+                <call-class-method class-name="org.ofbiz.webpos.transaction.WebPosTransaction" method-name="getExternalPaymentCode" ret-field="externalPaymentCode"/>
+                <!--  No Payment -->
+                <if-compare-field field="paymentCheck" operator="equals" to-field="noPaymentCode">
+                    <call-object-method obj-field="webPosTransaction" method-name="clearPayment">
                         <field field="paymentType" type="String"/>
                     </call-object-method>
                     <check-errors/>
-                    <call-class-method class-name="org.ofbiz.webpos.transaction.WebPosTransaction" method-name="getNoPaymentCode" ret-field="noPaymentCode"/>
-                    <call-class-method class-name="org.ofbiz.webpos.transaction.WebPosTransaction" method-name="getExternalPaymentCode" ret-field="externalPaymentCode"/>
-                    <!--  No Payment -->
-                    <if-compare-field field="paymentCheck" operator="equals" to-field="noPaymentCode">
-                        <call-object-method obj-field="webPosTransaction" method-name="clearPayment">
-                            <field field="paymentType" type="String"/>
-                        </call-object-method>
-                        <check-errors/>
-                        <call-object-method obj-field="webPosTransaction" method-name="processNoPayment">
-                            <field field="paymentType" type="String"/>
-                        </call-object-method>
-                        <check-errors/>
-                    <else>
-                        <!--  External Payment -->
-                        <if-compare-field field="paymentCheck" operator="equals" to-field="externalPaymentCode">
-                            <if-not-empty field="parameters.refNum">
-                                <set field="refNum" from-field="parameters.refNum"/>
-                                <call-object-method obj-field="webPosTransaction" method-name="processExternalPayment">
-                                    <field field="paymentType" type="String"/>
-                                    <field field="amount" type="String"/>
-                                    <field field="refNum" type="String"/>
-                                </call-object-method>
-                                <check-errors/>
-                            <else>
-                                <add-error><fail-property resource="WebPosUiLabels" property="WebPosPaymentCheckMissingRefNum"/></add-error>
-                                <check-errors/>
-                            </else>
-                            </if-not-empty>
-                        <!--  Internal Payment not yet supported -->
+                    <call-object-method obj-field="webPosTransaction" method-name="processNoPayment">
+                        <field field="paymentType" type="String"/>
+                    </call-object-method>
+                    <check-errors/>
+                <else>
+                    <!--  External Payment -->
+                    <if-compare-field field="paymentCheck" operator="equals" to-field="externalPaymentCode">
+                        <if-not-empty field="parameters.refNum">
+                            <set field="refNum" from-field="parameters.refNum"/>
+                            <call-object-method obj-field="webPosTransaction" method-name="processExternalPayment">
+                                <field field="paymentType" type="String"/>
+                                <field field="context.amountCheck" type="BigDecimal"/>
+                                <field field="refNum" type="String"/>
+                            </call-object-method>
+                            <check-errors/>
                         <else>
-                            <add-error><fail-property resource="WebPosUiLabels" property="WebPosPaymentCheckInternal"/></add-error>
+                            <add-error><fail-property resource="WebPosUiLabels" property="WebPosPaymentCheckMissingRefNum"/></add-error>
                             <check-errors/>
                         </else>
-                        </if-compare-field>
+                        </if-not-empty>
+                    <!--  Internal Payment not yet supported -->
+                    <else>
+                        <add-error><fail-property resource="WebPosUiLabels" property="WebPosPaymentCheckInternal"/></add-error>
+                        <check-errors/>
                     </else>
                     </if-compare-field>
-                <else>
-                    <add-error><fail-property resource="WebPosUiLabels" property="WebPosPayCheckNotValidAmount"/></add-error>
-                    <check-errors/>
                 </else>
-                </if-compare>
+                </if-compare-field>
             <else>
-                <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotLoggedIn"/></add-error>
+                <add-error><fail-property resource="WebPosUiLabels" property="WebPosPayCheckNotValidAmount"/></add-error>
                 <check-errors/>
             </else>
             </if-not-empty>
+        <else>
+            <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotLoggedIn"/></add-error>
+            <check-errors/>
+        </else>
         </if-not-empty>
     </simple-method>
-
+    
     <simple-method method-name="payGiftCard" short-description="Pay Gift Card" login-required="true">
-        <if-not-empty field="parameters.confirm">
-            <set field="posTerminalId" value="null"/>
-            <call-class-method class-name="org.ofbiz.webpos.WebPosEvents" method-name="getWebPosSession" ret-field="webPosSession">
-                <field field="request" type="javax.servlet.http.HttpServletRequest"/>
-                <field field="posTerminalId" type="String"/>
-            </call-class-method>
-            <if-not-empty field="webPosSession">
-                <call-object-method obj-field="webPosSession" method-name="getCurrentTransaction" ret-field="webPosTransaction"/>
-                <check-errors/>
-                <set field="amount" from-field="parameters.amount" type="String"/>
-                <set field="allowNegative" value="false" type="Boolean"/>
-                <set field="allowPositive" value="true" type="Boolean"/>
-                <set field="minDecimal" value="0" type="Integer"/>
-                <set field="maxDecimal" value="3" type="Integer"/>
-                <call-class-method class-name="org.ofbiz.base.util.UtilValidate" method-name="isDouble" ret-field="isDouble">
-                    <field field="amount" type="String"/>
-                    <field field="allowNegative" type="boolean"/>
-                    <field field="allowPositive" type="boolean"/>
-                    <field field="minDecimal" type="int"/>
-                    <field field="maxDecimal" type="int"/>
-                </call-class-method>
-                <if-compare field="isDouble" operator="equals" value="true">
-                    <set field="paymentType" value="GIFT_CARD"/>
-                    <call-object-method obj-field="webPosTransaction" method-name="checkPaymentMethodType" ret-field="paymentCheck">
+        <clear-field field="posTerminalId"/>
+        <call-class-method class-name="org.ofbiz.webpos.WebPosEvents" method-name="getWebPosSession" ret-field="webPosSession">
+            <field field="request" type="javax.servlet.http.HttpServletRequest"/>
+            <field field="posTerminalId" type="String"/>
+        </call-class-method>
+        <if-not-empty field="webPosSession">
+            <call-object-method obj-field="webPosSession" method-name="getCurrentTransaction" ret-field="webPosTransaction"/>
+            <check-errors/>
+            <if-empty field="parameters.amountGiftCard">
+                <call-object-method obj-field="webPosTransaction" method-name="getTotalDue" ret-field="context.amountGiftCard"/>
+                <check-errors/>
+            <else>
+                <call-map-processor in-map-name="parameters" out-map-name="context">
+                    <simple-map-processor name="inputValidate">
+                        <process field="amountGiftCard">
+                            <convert type="BigDecimal" to-field="amountGiftCard" replace="true" set-if-null="false">
+                                <fail-property resource="WebPosUiLabels" property="WebPosPayGiftCardNotValidAmount"/>
+                            </convert>
+                        </process>
+                    </simple-map-processor>
+                </call-map-processor>
+                <check-errors/>
+            </else>
+            </if-empty>
+            <if-not-empty field="context.amountGiftCard">
+                <call-object-method obj-field="webPosTransaction" method-name="getTotalDue" ret-field="totalDue"/>
+                <if-compare field="totalDue" operator="less-equals" value="0.00" type="BigDecimal">
+                    <add-error><fail-property resource="WebPosUiLabels" property="WebPosTransactionTotalDueZero"/></add-error>
+                    <check-errors/>
+                </if-compare>
+                <if-compare-field field="totalDue" operator="less" to-field="context.amountGiftCard" type="BigDecimal">
+                    <add-error><fail-property resource="WebPosUiLabels" property="WebPosPayGiftCardGreaterThanTotalDue"/></add-error>
+                    <check-errors/>
+                </if-compare-field>
+                <set field="paymentType" value="GIFT_CARD"/>
+                <call-object-method obj-field="webPosTransaction" method-name="checkPaymentMethodType" ret-field="paymentCheck">
+                    <field field="paymentType" type="String"/>
+                </call-object-method>
+                <check-errors/>
+                <call-class-method class-name="org.ofbiz.webpos.transaction.WebPosTransaction" method-name="getNoPaymentCode" ret-field="noPaymentCode"/>
+                <call-class-method class-name="org.ofbiz.webpos.transaction.WebPosTransaction" method-name="getExternalPaymentCode" ret-field="externalPaymentCode"/>
+                <!--  No Payment -->
+                <if-compare-field field="paymentCheck" operator="equals" to-field="noPaymentCode">
+                    <call-object-method obj-field="webPosTransaction" method-name="processNoPayment">
                         <field field="paymentType" type="String"/>
                     </call-object-method>
                     <check-errors/>
-                    <call-class-method class-name="org.ofbiz.webpos.transaction.WebPosTransaction" method-name="getNoPaymentCode" ret-field="noPaymentCode"/>
-                    <call-class-method class-name="org.ofbiz.webpos.transaction.WebPosTransaction" method-name="getExternalPaymentCode" ret-field="externalPaymentCode"/>
-                    <!--  No Payment -->
-                    <if-compare-field field="paymentCheck" operator="equals" to-field="noPaymentCode">
-                        <call-object-method obj-field="webPosTransaction" method-name="processNoPayment">
-                            <field field="paymentType" type="String"/>
-                        </call-object-method>
-                        <check-errors/>
-                    <else>
-                        <!--  External Payment -->
-                        <if-compare-field field="paymentCheck" operator="equals" to-field="externalPaymentCode">
-                            <if-not-empty field="parameters.refNum">
-                                <set field="refNum" from-field="parameters.refNum"/>
-                                <call-object-method obj-field="webPosTransaction" method-name="processExternalPayment">
-                                    <field field="paymentType" type="String"/>
-                                    <field field="amount" type="String"/>
-                                    <field field="refNum" type="String"/>
-                                </call-object-method>
-                                <check-errors/>
-                            <else>
-                                <add-error><fail-property resource="WebPosUiLabels" property="WebPosPaymentGiftCardMissingRefNum"/></add-error>
-                                <check-errors/>
-                            </else>
-                            </if-not-empty>
-                        <!--  Internal Payment not yet supported -->
+                <else>
+                    <!--  External Payment -->
+                    <if-compare-field field="paymentCheck" operator="equals" to-field="externalPaymentCode">
+                        <if-not-empty field="parameters.refNum">
+                            <set field="refNum" from-field="parameters.refNum"/>
+                            <call-object-method obj-field="webPosTransaction" method-name="processExternalPayment">
+                                <field field="paymentType" type="String"/>
+                                <field field="context.amountGiftCard" type="BigDecimal"/>
+                                <field field="refNum" type="String"/>
+                            </call-object-method>
+                            <check-errors/>
                         <else>
-                            <add-error><fail-property resource="WebPosUiLabels" property="WebPosPaymentGiftCardInternal"/></add-error>
+                            <add-error><fail-property resource="WebPosUiLabels" property="WebPosPaymentGiftCardMissingRefNum"/></add-error>
                             <check-errors/>
                         </else>
-                        </if-compare-field>
+                        </if-not-empty>
+                    <!--  Internal Payment not yet supported -->
+                    <else>
+                        <add-error><fail-property resource="WebPosUiLabels" property="WebPosPaymentGiftCardInternal"/></add-error>
+                        <check-errors/>
                     </else>
                     </if-compare-field>
-                <else>
-                    <add-error><fail-property resource="WebPosUiLabels" property="WebPosPayGiftCardNotValidAmount"/></add-error>
-                    <check-errors/>
                 </else>
-                </if-compare>
+                </if-compare-field>
             <else>
-                <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotLoggedIn"/></add-error>
+                <add-error><fail-property resource="WebPosUiLabels" property="WebPosPayGiftCardNotValidAmount"/></add-error>
                 <check-errors/>
             </else>
             </if-not-empty>
+        <else>
+            <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotLoggedIn"/></add-error>
+            <check-errors/>
+        </else>
         </if-not-empty>
     </simple-method>
-
-    <simple-method method-name="payCredit" short-description="Pay Credit Card" login-required="true">
-        <if-not-empty field="parameters.confirm">
-            <set field="posTerminalId" value="null"/>
-            <call-class-method class-name="org.ofbiz.webpos.WebPosEvents" method-name="getWebPosSession" ret-field="webPosSession">
-                <field field="request" type="javax.servlet.http.HttpServletRequest"/>
-                <field field="posTerminalId" type="String"/>
-            </call-class-method>
-            <if-not-empty field="webPosSession">
-                <call-object-method obj-field="webPosSession" method-name="getCurrentTransaction" ret-field="webPosTransaction"/>
-                <check-errors/>
-                <set field="amount" from-field="parameters.amount" type="String"/>
-                <set field="allowNegative" value="false" type="Boolean"/>
-                <set field="allowPositive" value="true" type="Boolean"/>
-                <set field="minDecimal" value="0" type="Integer"/>
-                <set field="maxDecimal" value="3" type="Integer"/>
-                <call-class-method class-name="org.ofbiz.base.util.UtilValidate" method-name="isDouble" ret-field="isDouble">
-                    <field field="amount" type="String"/>
-                    <field field="allowNegative" type="boolean"/>
-                    <field field="allowPositive" type="boolean"/>
-                    <field field="minDecimal" type="int"/>
-                    <field field="maxDecimal" type="int"/>
-                </call-class-method>
-                <if-compare field="isDouble" operator="equals" value="true">
-                <set field="paymentType" value="CREDIT_CARD"/>
+    
+    <simple-method method-name="payCreditCard" short-description="Pay Credit Card" login-required="true">
+        <clear-field field="posTerminalId"/>
+        <call-class-method class-name="org.ofbiz.webpos.WebPosEvents" method-name="getWebPosSession" ret-field="webPosSession">
+            <field field="request" type="javax.servlet.http.HttpServletRequest"/>
+            <field field="posTerminalId" type="String"/>
+        </call-class-method>
+        <if-not-empty field="webPosSession">
+            <call-object-method obj-field="webPosSession" method-name="getCurrentTransaction" ret-field="webPosTransaction"/>
+            <check-errors/>
+            <if-empty field="parameters.amountCreditCard">
+                <call-object-method obj-field="webPosTransaction" method-name="getTotalDue" ret-field="context.amountCreditCard"/>
+                <check-errors/>
+            <else>
+                <call-map-processor in-map-name="parameters" out-map-name="context">
+                    <simple-map-processor name="inputValidate">
+                        <process field="amountCreditCard">
+                            <convert type="BigDecimal" to-field="amountCreditCard" replace="true" set-if-null="false">
+                                <fail-property resource="WebPosUiLabels" property="WebPosPayCreditCardNotValidAmount"/>
+                            </convert>
+                        </process>
+                    </simple-map-processor>
+                </call-map-processor>
+                <check-errors/>
+            </else>
+            </if-empty>            
+            <if-not-empty field="context.amountCreditCard">
+                <call-object-method obj-field="webPosTransaction" method-name="getTotalDue" ret-field="totalDue"/>
+                <if-compare field="totalDue" operator="less-equals" value="0.00" type="BigDecimal">
+                    <add-error><fail-property resource="WebPosUiLabels" property="WebPosTransactionTotalDueZero"/></add-error>
+                    <check-errors/>
+                </if-compare>
+                <if-compare-field field="totalDue" operator="less" to-field="context.amountCreditCard" type="BigDecimal">
+                    <add-error><fail-property resource="WebPosUiLabels" property="WebPosPayCreditCardGreaterThanTotalDue"/></add-error>
+                    <check-errors/>
+                </if-compare-field>
+                <if-compare field="parameters.swipeCard" operator="equals" value="Y">
+                    <if-empty field="parameters.swipeData">
+                        <add-error><fail-property resource="WebPosUiLabels" property="WebPosPaymentSwipeDataEmpty"/></add-error>
+                        <check-errors/>
+                    </if-empty>
+                <else>
+                    <if-empty field="parameters.firstName">
+                        <add-error><fail-property resource="WebPosUiLabels" property="WebPosPayCreditCardFirstNameEmpty"/></add-error>
+                        <check-errors/>
+                    </if-empty>
+                    <if-empty field="parameters.lastName">
+                        <add-error><fail-property resource="WebPosUiLabels" property="WebPosPayCreditCardLastNameEmpty"/></add-error>
+                        <check-errors/>
+                    </if-empty>
+                    <set field="paymentType" value="CREDIT_CARD"/>
                     <call-object-method obj-field="webPosTransaction" method-name="checkPaymentMethodType" ret-field="paymentCheck">
                         <field field="paymentType" type="String"/>
                     </call-object-method>
@@ -267,7 +317,7 @@ under the License.
                                 <set field="refNum" from-field="parameters.refNum"/>
                                 <call-object-method obj-field="webPosTransaction" method-name="processExternalPayment">
                                     <field field="paymentType" type="String"/>
-                                    <field field="amount" type="String"/>
+                                    <field field="context.amountCreditCard" type="BigDecimal"/>
                                     <field field="refNum" type="String"/>
                                 </call-object-method>
                                 <check-errors/>
@@ -285,7 +335,7 @@ under the License.
                                     <field field="cardNum" type="String"/>
                                 </call-class-method>
                                 <if-compare field="isCreditCard" operator="equals" value="false" type="String">
-                                    <add-error><fail-property resource="WebPosUiLabels" property="WebPosPaymentCredictCardInvalid"/></add-error>
+                                    <add-error><fail-property resource="WebPosUiLabels" property="WebPosPaymentCreditCardInvalid"/></add-error>
                                     <check-errors/>
                                 </if-compare>
                                 <!-- test expiration date -->
@@ -294,11 +344,21 @@ under the License.
                                     <string-append string="${parameters.expYear}" field="cardExp"/>
                                     <call-object-method obj-field="cardExp" method-name="length" ret-field="length"/>
                                     <if-compare field="length" operator="not-equals" value="6">
-                                        <add-error><fail-property resource="WebPosUiLabels" property="WebPosPaymentCredictCardInvalidExpiringDate"/></add-error>
+                                        <add-error><fail-property resource="WebPosUiLabels" property="WebPosPaymentCreditCardInvalidExpiringDate"/></add-error>
+                                        <check-errors/>
+                                    </if-compare>
+                                    <set field="cardExpAfterToday" from-field="parameters.expMonth"/>
+                                    <string-append string="/" field="cardExpAfterToday"/>
+                                    <string-append string="${parameters.expYear}" field="cardExpAfterToday"/>
+                                    <call-class-method class-name="org.ofbiz.base.util.UtilValidate" method-name="isDateAfterToday" ret-field="isDateAfterToday">
+                                        <field field="cardExpAfterToday" type="String"/>
+                                    </call-class-method>
+                                    <if-compare field="isDateAfterToday" operator="equals" value="false">
+                                        <add-error><fail-property resource="AccountingUiLabels" property="AccountingCreditCardExpireDateBeforeToday"/></add-error>
                                         <check-errors/>
                                     </if-compare>
                                 <else>
-                                    <add-error><fail-property resource="WebPosUiLabels" property="WebPosPaymentCredictCardInvalidExpiringDate"/></add-error>
+                                    <add-error><fail-property resource="WebPosUiLabels" property="WebPosPaymentCreditCardInvalidExpiringDate"/></add-error>
                                     <check-errors/>
                                 </else>
                                 </if-not-empty>
@@ -307,16 +367,11 @@ under the License.
                                     <set field="securityCode" from-field="parameters.securityCode"/>
                                     <call-object-method obj-field="securityCode" method-name="length" ret-field="length"/>
                                     <if-compare field="length" operator="greater" value="4">
-                                        <add-error><fail-property resource="WebPosUiLabels" property="WebPosPaymentCredictCardInvalidSecurityCode"/></add-error>
+                                        <add-error><fail-property resource="WebPosUiLabels" property="WebPosPaymentCreditCardInvalidSecurityCode"/></add-error>
                                         <check-errors/>
                                     </if-compare>
                                 </if-not-empty>
-                                <set field="amountStr" from-field="parameters.amount"/>
-                                <call-object-method obj-field="webPosTransaction" method-name="processAmount" ret-field="amount">
-                                    <field field="amountStr" type="String"/>
-                                </call-object-method>
-                                <check-errors/>
-                                <log level="info" message="Processing Credit Card Amount : ${amount}"/>
+                                <log level="info" message="Processing Credit Card Amount : ${context.amountCreditCard}"/>
                                 <set from-field="parameters.firstName" field="firstName"/>
                                 <set from-field="parameters.lastName" field="lastName"/>
                                 <call-object-method obj-field="webPosTransaction" method-name="makeCreditCardVo" ret-field="paymentId">
@@ -329,7 +384,7 @@ under the License.
                                 <if-not-empty field="paymentId">
                                     <call-object-method obj-field="webPosTransaction" method-name="addPayment">
                                         <field field="paymentId" type="String"/>
-                                        <field field="amount" type="BigDecimal"/>
+                                        <field field="context.amountCreditCard" type="BigDecimal"/>
                                     </call-object-method>
                                     <check-errors/>
                                     <if-not-empty field="parameters.track2">
@@ -363,7 +418,7 @@ under the License.
                                     </if-not-empty>
                                 </if-not-empty>
                             <else>
-                                <add-error><fail-property resource="WebPosUiLabels" property="WebPosPaymentCredictCardInvalid"/></add-error>
+                                <add-error><fail-property resource="WebPosUiLabels" property="WebPosPaymentCreditCardInvalid"/></add-error>
                                 <check-errors/>
                             </else>
                             </if-not-empty>
@@ -371,230 +426,157 @@ under the License.
                         </if-compare-field>
                     </else>
                     </if-compare-field>
-                <else>
-                    <add-error><fail-property resource="WebPosUiLabels" property="WebPosPayCreditCardNotValidAmount"/></add-error>
-                    <check-errors/>
                 </else>
                 </if-compare>
             <else>
-                <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotLoggedIn"/></add-error>
+                <add-error><fail-property resource="WebPosUiLabels" property="WebPosPayCreditCardNotValidAmount"/></add-error>
                 <check-errors/>
             </else>
             </if-not-empty>
+        <else>
+            <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotLoggedIn"/></add-error>
+            <check-errors/>
+        </else>
         </if-not-empty>
     </simple-method>
-
-    <simple-method method-name="processSale" short-description="Process Sale" login-required="true">
-        <set field="posTerminalId" value="null"/>
+    
+    <simple-method method-name="payFinish" short-description="Process Sale" login-required="true">
+        <clear-field field="posTerminalId"/>
         <call-class-method class-name="org.ofbiz.webpos.WebPosEvents" method-name="getWebPosSession" ret-field="webPosSession">
             <field field="request" type="javax.servlet.http.HttpServletRequest"/>
             <field field="posTerminalId" type="String"/>
         </call-class-method>
         <if-not-empty field="webPosSession">
-            <call-object-method obj-field="webPosSession" method-name="getCurrentTransaction" ret-field="webPosTransaction"/>
+            <call-object-method obj-field="webPosSession" method-name="getCart" ret-field="cart"/>
             <check-errors/>
-            <call-object-method obj-field="webPosTransaction" method-name="processSale" ret-field="changeDue"/>
-            <check-errors/>
-            <log level="info" message="Processe sale for a change due amount of ${changeDue}"/>
+            <if-not-empty field="cart">
+                <call-object-method obj-field="cart" method-name="size" ret-field="cartSize"/>
+                <check-errors/>
+                <if-compare field="cartSize" operator="greater" value="0" type="Integer">
+                    <call-object-method obj-field="cart" method-name="getAdditionalPartyRoleMap" ret-field="partyRoles"/>
+                    <check-errors/>
+                    <call-object-method obj-field="partyRoles" method-name="size" ret-field="partyRolesSize"/>
+                    <check-errors/>
+                    <if-compare field="partyRolesSize" operator="less-equals" value="0">
+                        <add-error><fail-property resource="WebPosUiLabels" property="WebPosSelectOneSalesRep"/></add-error>
+                        <check-errors/>
+                    </if-compare>
+                    <call-object-method obj-field="webPosSession" method-name="getCurrentTransaction" ret-field="webPosTransaction"/>
+                    <check-errors/>
+                    <call-object-method obj-field="webPosTransaction" method-name="getTotalDue" ret-field="totalDue"/>
+                    <check-errors/>
+                    <if-compare field="totalDue" operator="not-equals" value="0.00" type="BigDecimal">
+                        <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotEnoughFunds"/></add-error>
+                        <check-errors/>
+                    </if-compare>
+                    <call-class-method class-name="org.ofbiz.webpos.WebPosEvents" method-name="completeSale">
+                        <field field="request"  type="javax.servlet.http.HttpServletRequest"/>
+                        <field field="response" type="javax.servlet.http.HttpServletResponse"/>
+                    </call-class-method>
+                </if-compare>
+            </if-not-empty>
         <else>
             <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotLoggedIn"/></add-error>
             <check-errors/>
         </else>
         </if-not-empty>
     </simple-method>
-
-    <simple-method method-name="setRefNum" short-description="Set Payment Reference Number" login-required="true">
-        <if-not-empty field="parameters.confirm">
-            <set field="posTerminalId" value="null"/>
-            <call-class-method class-name="org.ofbiz.webpos.WebPosEvents" method-name="getWebPosSession" ret-field="webPosSession">
-                <field field="request" type="javax.servlet.http.HttpServletRequest"/>
-                <field field="posTerminalId" type="String"/>
-            </call-class-method>
-            <if-not-empty field="webPosSession">
-                <call-object-method obj-field="webPosSession" method-name="getCurrentTransaction" ret-field="webPosTransaction"/>
-                <check-errors/>
-                <set field="payment" value="0" type="Integer"/>
-                <call-object-method obj-field="webPosTransaction" method-name="getNumberOfPayments" ret-field="numPayments"/>
-                <check-errors/>
-                <while>
-                    <condition>
-                        <if-compare-field field="payment" to-field="numPayments" operator="less"/>
-                    </condition>
-                    <then>
-                        <call-object-method obj-field="webPosTransaction" method-name="getPaymentMethodTypeId" ret-field="paymentMethodTypeId">
-                            <field field="payment" type="int"/>
-                        </call-object-method>
-                        <check-errors/>
-                        <if-not-empty field="paymentMethodTypeId">
-                            <if-compare field="paymentMethodTypeId" value="PERSONAL_CHECK" operator="equals">
-                                <log level="always" message="refNumCheck ${parameters.refNumCheck}"/>
-                                <if-not-empty field="parameters.refNumCheck">
-                                    <set field="idx" from-field="payment"/>
-                                    <set field="refNum" from-field="parameters.refNumCheck"/>
-                                    <call-object-method obj-field="webPosTransaction" method-name="setPaymentRefNum">
-                                        <field field="idx" type="int"/>
-                                        <field field="refNum" type="String"/>
-                                        <field field="authCode" type="String"/>
+    
+    <simple-method method-name="clearPayment" short-description="Clear Payment" login-required="true">
+        <clear-field field="posTerminalId"/>
+        <call-class-method class-name="org.ofbiz.webpos.WebPosEvents" method-name="getWebPosSession" ret-field="webPosSession">
+            <field field="request" type="javax.servlet.http.HttpServletRequest"/>
+            <field field="posTerminalId" type="String"/>
+        </call-class-method>
+        <if-not-empty field="webPosSession">
+            <call-object-method obj-field="webPosSession" method-name="getCurrentTransaction" ret-field="webPosTransaction"/>
+            <check-errors/>
+            <set field="payment" value="0" type="Integer"/>
+            <call-object-method obj-field="webPosTransaction" method-name="getNumberOfPayments" ret-field="numPayments"/>
+            <check-errors/>
+            <while>
+                <condition>
+                    <if-compare-field field="payment" to-field="numPayments" operator="less"/>
+                </condition>
+                <then>
+                    <call-object-method obj-field="webPosTransaction" method-name="getPaymentMethodTypeId" ret-field="paymentMethodTypeId">
+                        <field field="payment" type="int"/>
+                    </call-object-method>
+                    <check-errors/>
+                    <if-not-empty field="paymentMethodTypeId">
+                        <if-not-empty field="parameters.clearCash">
+                            <if-compare field="parameters.clearCash" value="Y" operator="equals">
+                                <if-compare field="paymentMethodTypeId" value="CASH" operator="equals">
+                                    <call-object-method obj-field="webPosTransaction" method-name="clearPayment">
+                                        <field field="payment" type="int"/>
                                     </call-object-method>
                                     <check-errors/>
-                                    <log level="info" message="Set the reference number ${idx} to ${refNum} for payment CHECK"/>
-                                <else>
-                                    <set field="payment" from-field="numPayments"/>
-                                    <add-error><fail-property resource="WebPosUiLabels" property="WebPosPaymentCheckMissingRefNum"/></add-error>
+                                    <log level="info" message="Cleared CASH payment ${payment}"/>
+                                    <call-object-method obj-field="webPosTransaction" method-name="getNumberOfPayments" ret-field="numPayments"/>
                                     <check-errors/>
-                                </else>
-                                </if-not-empty>
+                                    <set field="payment" value="-1" type="Integer"/>
+                                </if-compare>
                             </if-compare>
-                            <if-compare field="paymentMethodTypeId" value="GIFT_CARD" operator="equals">
-                                <log level="always" message="refNumGift ${parameters.refNumGift}"/>
-                                <if-not-empty field="parameters.refNumGift">
-                                    <set field="idx" from-field="payment"/>
-                                    <set field="refNum" from-field="parameters.refNumGift"/>
-                                    <call-object-method obj-field="webPosTransaction" method-name="setPaymentRefNum">
-                                        <field field="idx" type="int"/>
-                                        <field field="refNum" type="String"/>
-                                        <field field="authCode" type="String"/>
+                        </if-not-empty>
+                        <if-not-empty field="parameters.clearCheck">
+                            <if-compare field="parameters.clearCheck" value="Y" operator="equals">
+                                <if-compare field="paymentMethodTypeId" value="PERSONAL_CHECK" operator="equals">
+                                    <call-object-method obj-field="webPosTransaction" method-name="clearPayment">
+                                        <field field="payment" type="int"/>
                                     </call-object-method>
                                     <check-errors/>
-                                    <log level="info" message="Set the reference number ${idx} to ${refNum} for payment GIFT CARD"/>
-                                <else>
-                                    <set field="payment" from-field="numPayments"/>
-                                    <add-error><fail-property resource="WebPosUiLabels" property="WebPosPaymentGiftCardMissingRefNum"/></add-error>
+                                    <log level="info" message="Cleared CHECK payment ${payment}"/>
+                                    <call-object-method obj-field="webPosTransaction" method-name="getNumberOfPayments" ret-field="numPayments"/>
                                     <check-errors/>
-                                </else>
-                                </if-not-empty>
+                                    <set field="payment" value="-1" type="Integer"/>
+                                </if-compare>
                             </if-compare>
-                            <if-compare field="paymentMethodTypeId" value="CREDIT_CARD" operator="equals">
-                                <log level="always" message="refNumCredit ${parameters.refNumCredit}"/>
-                                <if-not-empty field="parameters.refNumCredit">
-                                    <set field="idx" from-field="payment"/>
-                                    <set field="refNum" from-field="parameters.refNumCredit"/>
-                                    <call-object-method obj-field="webPosTransaction" method-name="setPaymentRefNum">
-                                        <field field="idx" type="int"/>
-                                        <field field="refNum" type="String"/>
-                                        <field field="authCode" type="String"/>
+                        </if-not-empty>
+                        <if-not-empty field="parameters.clearGift">
+                            <if-compare field="parameters.clearGift" value="Y" operator="equals">
+                                <if-compare field="paymentMethodTypeId" value="GIFT_CARD" operator="equals">
+                                    <call-object-method obj-field="webPosTransaction" method-name="clearPayment">
+                                        <field field="payment" type="int"/>
                                     </call-object-method>
                                     <check-errors/>
-                                    <log level="info" message="Set the reference number ${idx} to ${refNum} for payment CREDIT CARD"/>
-                                <else>
-                                    <set field="payment" from-field="numPayments"/>
-                                    <add-error><fail-property resource="WebPosUiLabels" property="WebPosPaymentCredictCardMissingRefNum"/></add-error>
+                                    <log level="info" message="Cleared GIFT CARD payment ${payment}"/>
+                                    <call-object-method obj-field="webPosTransaction" method-name="getNumberOfPayments" ret-field="numPayments"/>
                                     <check-errors/>
-                                </else>
-                                </if-not-empty>
+                                    <set field="payment" value="-1" type="Integer"/>
+                                </if-compare>
                             </if-compare>
                         </if-not-empty>
-                        <calculate field="payment" type="Integer">
-                            <calcop field="payment" operator="add"/>
-                            <number value="1"/>
-                        </calculate>
-                    </then>
-                </while>
-            <else>
-                <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotLoggedIn"/></add-error>
-                <check-errors/>
-            </else>
-            </if-not-empty>
-        </if-not-empty>
-    </simple-method>
-
-    <simple-method method-name="clearPayment" short-description="Clear Payment" login-required="true">
-        <if-not-empty field="parameters.confirm">
-            <set field="posTerminalId" value="null"/>
-            <call-class-method class-name="org.ofbiz.webpos.WebPosEvents" method-name="getWebPosSession" ret-field="webPosSession">
-                <field field="request" type="javax.servlet.http.HttpServletRequest"/>
-                <field field="posTerminalId" type="String"/>
-            </call-class-method>
-            <if-not-empty field="webPosSession">
-                <call-object-method obj-field="webPosSession" method-name="getCurrentTransaction" ret-field="webPosTransaction"/>
-                <check-errors/>
-                <set field="payment" value="0" type="Integer"/>
-                <call-object-method obj-field="webPosTransaction" method-name="getNumberOfPayments" ret-field="numPayments"/>
-                <check-errors/>
-                <while>
-                    <condition>
-                        <if-compare-field field="payment" to-field="numPayments" operator="less"/>
-                    </condition>
-                    <then>
-                        <call-object-method obj-field="webPosTransaction" method-name="getPaymentMethodTypeId" ret-field="paymentMethodTypeId">
-                            <field field="payment" type="int"/>
-                        </call-object-method>
-                        <check-errors/>
-                        <if-not-empty field="paymentMethodTypeId">
-                            <if-not-empty field="parameters.clearCash">
-                                <if-compare field="parameters.clearCash" value="Y" operator="equals">
-                                    <if-compare field="paymentMethodTypeId" value="CASH" operator="equals">
-                                        <call-object-method obj-field="webPosTransaction" method-name="clearPayment">
-                                            <field field="payment" type="int"/>
-                                        </call-object-method>
-                                        <check-errors/>
-                                        <log level="info" message="Cleared CASH payment ${payment}"/>
-                                        <call-object-method obj-field="webPosTransaction" method-name="getNumberOfPayments" ret-field="numPayments"/>
-                                        <check-errors/>
-                                        <set field="payment" value="-1" type="Integer"/>
-                                    </if-compare>
-                                </if-compare>
-                            </if-not-empty>
-                            <if-not-empty field="parameters.clearCheck">
-                                <if-compare field="parameters.clearCheck" value="Y" operator="equals">
-                                    <if-compare field="paymentMethodTypeId" value="PERSONAL_CHECK" operator="equals">
-                                        <call-object-method obj-field="webPosTransaction" method-name="clearPayment">
-                                            <field field="payment" type="int"/>
-                                        </call-object-method>
-                                        <check-errors/>
-                                        <log level="info" message="Cleared CHECK payment ${payment}"/>
-                                        <call-object-method obj-field="webPosTransaction" method-name="getNumberOfPayments" ret-field="numPayments"/>
-                                        <check-errors/>
-                                        <set field="payment" value="-1" type="Integer"/>
-                                    </if-compare>
-                                </if-compare>
-                            </if-not-empty>
-                            <if-not-empty field="parameters.clearGift">
-                                <if-compare field="parameters.clearGift" value="Y" operator="equals">
-                                    <if-compare field="paymentMethodTypeId" value="GIFT_CARD" operator="equals">
-                                        <call-object-method obj-field="webPosTransaction" method-name="clearPayment">
-                                            <field field="payment" type="int"/>
-                                        </call-object-method>
-                                        <check-errors/>
-                                        <log level="info" message="Cleared GIFT CARD payment ${payment}"/>
-                                        <call-object-method obj-field="webPosTransaction" method-name="getNumberOfPayments" ret-field="numPayments"/>
-                                        <check-errors/>
-                                        <set field="payment" value="-1" type="Integer"/>
-                                    </if-compare>
-                                </if-compare>
-                            </if-not-empty>
-                            <if-not-empty field="parameters.clearCredit">
-                                <if-compare field="parameters.clearCredit" value="Y" operator="equals">
-                                    <if-compare field="paymentMethodTypeId" value="CREDIT_CARD" operator="equals">
-                                        <call-object-method obj-field="webPosTransaction" method-name="clearPayment">
-                                            <field field="payment" type="int"/>
-                                        </call-object-method>
-                                        <check-errors/>
-                                        <log level="info" message="Cleared CREDIT CARD payment ${payment}"/>
-                                        <call-object-method obj-field="webPosTransaction" method-name="getNumberOfPayments" ret-field="numPayments"/>
-                                        <check-errors/>
-                                        <set field="payment" value="-1" type="Integer"/>
-                                    </if-compare>
+                        <if-not-empty field="parameters.clearCredit">
+                            <if-compare field="parameters.clearCredit" value="Y" operator="equals">
+                                <if-compare field="paymentMethodTypeId" value="CREDIT_CARD" operator="equals">
+                                    <call-object-method obj-field="webPosTransaction" method-name="clearPayment">
+                                        <field field="payment" type="int"/>
+                                    </call-object-method>
+                                    <check-errors/>
+                                    <log level="info" message="Cleared CREDIT CARD payment ${payment}"/>
+                                    <call-object-method obj-field="webPosTransaction" method-name="getNumberOfPayments" ret-field="numPayments"/>
+                                    <check-errors/>
+                                    <set field="payment" value="-1" type="Integer"/>
                                 </if-compare>
-                            </if-not-empty>
+                            </if-compare>
                         </if-not-empty>
-                        <calculate field="payment" type="Integer">
-                            <calcop field="payment" operator="add"/>
-                            <number value="1"/>
-                        </calculate>
-                    </then>
-                </while>
-            <else>
-                <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotLoggedIn"/></add-error>
-                <check-errors/>
-            </else>
-            </if-not-empty>
+                    </if-not-empty>
+                    <calculate field="payment" type="Integer">
+                        <calcop field="payment" operator="add"/>
+                        <number value="1"/>
+                    </calculate>
+                </then>
+            </while>
+        <else>
+            <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotLoggedIn"/></add-error>
+            <check-errors/>
+        </else>
         </if-not-empty>
         <return response-code="success"/>
     </simple-method>
-
+    
     <simple-method method-name="clearAllPayments" short-description="Clear All Payments" login-required="true">
-        <set field="posTerminalId" value="null"/>
+        <clear-field field="posTerminalId"/>
         <call-class-method class-name="org.ofbiz.webpos.WebPosEvents" method-name="getWebPosSession" ret-field="webPosSession">
             <field field="request" type="javax.servlet.http.HttpServletRequest"/>
             <field field="posTerminalId" type="String"/>

Modified: ofbiz/branches/jackrabbit20100709/specialpurpose/webpos/script/org/ofbiz/webpos/event/PromoEvents.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/specialpurpose/webpos/script/org/ofbiz/webpos/event/PromoEvents.xml?rev=1128865&r1=1128864&r2=1128865&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/specialpurpose/webpos/script/org/ofbiz/webpos/event/PromoEvents.xml (original)
+++ ofbiz/branches/jackrabbit20100709/specialpurpose/webpos/script/org/ofbiz/webpos/event/PromoEvents.xml Sun May 29 11:02:09 2011
@@ -19,34 +19,32 @@ under the License.
 -->
 <simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/simple-methods.xsd">
     <simple-method method-name="addPromoCode" short-description="Add Promotion Code" login-required="true">
-        <if-not-empty field="parameters.confirm">
-            <set field="posTerminalId" value="null"/>
-            <call-class-method class-name="org.ofbiz.webpos.WebPosEvents" method-name="getWebPosSession" ret-field="webPosSession">
-                <field field="request" type="javax.servlet.http.HttpServletRequest"/>
-                <field field="posTerminalId" type="String"/>
-            </call-class-method>
-            <if-not-empty field="webPosSession">
-                <call-object-method obj-field="webPosSession" method-name="getCurrentTransaction" ret-field="webPosTransaction"/>
+        <clear-field field="posTerminalId"/>
+        <call-class-method class-name="org.ofbiz.webpos.WebPosEvents" method-name="getWebPosSession" ret-field="webPosSession">
+            <field field="request" type="javax.servlet.http.HttpServletRequest"/>
+            <field field="posTerminalId" type="String"/>
+        </call-class-method>
+        <if-not-empty field="webPosSession">
+            <call-object-method obj-field="webPosSession" method-name="getCurrentTransaction" ret-field="webPosTransaction"/>
+            <check-errors/>
+            <call-object-method obj-field="webPosTransaction" method-name="isOpen" ret-field="isOpen"/>
+            <if-compare field="isOpen" operator="equals" value="true" type="String">
+                <set field="promoCode" from-field="parameters.promoCode"/>
+                <call-object-method obj-field="webPosTransaction" method-name="addProductPromoCode" ret-field="result">
+                    <field field="promoCode" type="String"/>
+                </call-object-method>
                 <check-errors/>
-                <call-object-method obj-field="webPosTransaction" method-name="isOpen" ret-field="isOpen"/>
-                <if-compare field="isOpen" operator="equals" value="true" type="String">
-                    <set field="promoCode" from-field="parameters.promoCode"/>
-                    <call-object-method obj-field="webPosTransaction" method-name="addProductPromoCode" ret-field="result">
-                        <field field="promoCode" type="String"/>
-                    </call-object-method>
-                    <check-errors/>
-                    <!-- TODO handle exceptions and errors -->
-                    <log level="info" message="Added product promotion code ${promoCode}"/>
-                <else>
-                    <add-error><fail-property resource="WebPosUiLabels" property="WebPosPromoCodeTerminalNotOpened"/></add-error>
-                    <check-errors/>
-                </else>
-                </if-compare>
+                <!-- TODO handle exceptions and errors -->
+                <log level="info" message="Added product promotion code ${promoCode}"/>
             <else>
-                <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotLoggedIn"/></add-error>
+                <add-error><fail-property resource="WebPosUiLabels" property="WebPosPromoCodeTerminalNotOpened"/></add-error>
                 <check-errors/>
             </else>
-            </if-not-empty>
+            </if-compare>
+        <else>
+            <add-error><fail-property resource="WebPosUiLabels" property="WebPosNotLoggedIn"/></add-error>
+            <check-errors/>
+        </else>
         </if-not-empty>
     </simple-method>
 </simple-methods>
\ No newline at end of file

Modified: ofbiz/branches/jackrabbit20100709/specialpurpose/webpos/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/specialpurpose/webpos/servicedef/services.xml?rev=1128865&r1=1128864&r2=1128865&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/specialpurpose/webpos/servicedef/services.xml (original)
+++ ofbiz/branches/jackrabbit20100709/specialpurpose/webpos/servicedef/services.xml Sun May 29 11:02:09 2011
@@ -22,23 +22,6 @@ under the License.
     <vendor>OFBiz</vendor>
     <version>1.0</version>
 
-    <service name="FindProducts" engine="simple"
-             location="component://webpos/script/org/ofbiz/webpos/WebPosServices.xml" invoke="FindProducts">
-        <description>Find products by name/description</description>
-        <attribute type="String" mode="IN" name="searchBy" optional="false"/>
-        <attribute type="String" mode="IN" name="productToSearch" optional="true"/>
-        <attribute type="java.util.List" mode="OUT" name="productsList" optional="true"/>
-        <attribute type="java.util.List" mode="OUT" name="productsId" optional="true"/>
-    </service>
-
-    <service name="FindProductsByIdentification" engine="simple"
-             location="component://webpos/script/org/ofbiz/webpos/WebPosServices.xml" invoke="FindProductsByIdentification">
-        <description>Find products by good identification</description>
-        <attribute type="String" mode="IN" name="productGoodIdentification" optional="true"/>
-        <attribute type="java.util.List" mode="OUT" name="productsList" optional="true"/>
-        <attribute type="java.util.List" mode="OUT" name="productsId" optional="true"/>
-    </service>
-
     <service name="posLogin" engine="java"
              location="org.ofbiz.webpos.WebPosEvents" invoke="posLogin">
         <description>Login for Web Pos</description>

Modified: ofbiz/branches/jackrabbit20100709/specialpurpose/webpos/servicedef/services_manager.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/specialpurpose/webpos/servicedef/services_manager.xml?rev=1128865&r1=1128864&r2=1128865&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/specialpurpose/webpos/servicedef/services_manager.xml (original)
+++ ofbiz/branches/jackrabbit20100709/specialpurpose/webpos/servicedef/services_manager.xml Sun May 29 11:02:09 2011
@@ -21,47 +21,48 @@ under the License.
     <description>Web Pos Manager Services</description>
     <vendor>OFBiz</vendor>
     <version>1.0</version>
-
+    
     <service name="openTerminal" engine="simple" auth="false"
              location="component://webpos/script/org/ofbiz/webpos/event/ManagerEvents.xml" invoke="openTerminal">
         <description>Open Terminal</description>
-        <attribute name="startingDrawerAmount" type="BigDecimal" mode="IN" optional="false"/>
+        <attribute name="startingDrawerAmount" type="String" mode="IN" optional="false"/>
     </service>
-
+    
     <service name="closeTerminal" engine="simple" auth="false"
              location="component://webpos/script/org/ofbiz/webpos/event/ManagerEvents.xml" invoke="closeTerminal">
         <description>Close Terminal</description>
-        <attribute name="endingDrawerCashAmount"  type="BigDecimal" mode="IN" optional="false"/>
-        <attribute name="endingDrawerCheckAmount" type="BigDecimal" mode="IN" optional="false"/>
-        <attribute name="endingDrawerCcAmount"    type="BigDecimal" mode="IN" optional="false"/>
-        <attribute name="endingDrawerGcAmount"    type="BigDecimal" mode="IN" optional="false"/>
-        <attribute name="endingDrawerOtherAmount" type="BigDecimal" mode="IN" optional="false"/>
+        <attribute name="endingDrawerCashAmount"  type="String" mode="IN" optional="false"/>
+        <attribute name="endingDrawerCheckAmount" type="String" mode="IN" optional="false"/>
+        <attribute name="endingDrawerCcAmount"    type="String" mode="IN" optional="false"/>
+        <attribute name="endingDrawerGcAmount"    type="String" mode="IN" optional="false"/>
+        <attribute name="endingDrawerOtherAmount" type="String" mode="IN" optional="false"/>
     </service>
-
+    
     <service name="voidOrder" engine="simple" auth="false"
              location="component://webpos/script/org/ofbiz/webpos/event/ManagerEvents.xml" invoke="voidOrder">
         <description>Void Order</description>
         <attribute name="orderId" type="String" mode="IN" optional="false"/>
     </service>
-
+    
     <service name="shutdown" engine="simple" auth="false"
              location="component://webpos/script/org/ofbiz/webpos/event/ManagerEvents.xml" invoke="shutdown">
         <description>Shutdown</description>
     </service>
-
+    
     <service name="paidOutAndIn" engine="simple" auth="false"
              location="component://webpos/script/org/ofbiz/webpos/event/ManagerEvents.xml" invoke="paidOutAndIn">
         <description>Paid Out and In</description>
         <attribute name="type"         type="String" mode="IN" optional="false"/>
-        <attribute name="amountInOut"  type="BigDecimal" mode="IN" optional="false"/>
-        <attribute name="reasonInOut"  type="String" mode="IN" optional="false"/>
+        <attribute name="amountInOut"  type="String" mode="IN" optional="false"/>
+        <attribute name="reasonIn"     type="String" mode="IN" optional="false"/>
+        <attribute name="reasonOut"    type="String" mode="IN" optional="false"/>
         <attribute name="reasonCommentInOut" type="String" mode="IN" optional="false"/>
     </service>
-
+    
     <service name="modifyPrice" engine="simple" auth="false"
              location="component://webpos/script/org/ofbiz/webpos/event/ManagerEvents.xml" invoke="modifyPrice">
         <description>Modify Price</description>
-        <attribute name="sku"   type="String" mode="IN" optional="false"/>
-        <attribute name="price" type="BigDecimal" mode="IN" optional="false"/>
+        <attribute name="cartLineIdx" type="Integer" mode="IN" optional="false"/>
+        <attribute name="price" type="String" mode="IN" optional="false"/>
     </service>
 </services>

Modified: ofbiz/branches/jackrabbit20100709/specialpurpose/webpos/servicedef/services_payment.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/specialpurpose/webpos/servicedef/services_payment.xml?rev=1128865&r1=1128864&r2=1128865&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/specialpurpose/webpos/servicedef/services_payment.xml (original)
+++ ofbiz/branches/jackrabbit20100709/specialpurpose/webpos/servicedef/services_payment.xml Sun May 29 11:02:09 2011
@@ -21,55 +21,50 @@ under the License.
     <description>Web Pos Payment Services</description>
     <vendor>OFBiz</vendor>
     <version>1.0</version>
-
+    
     <service name="payCash" engine="simple" auth="false"
              location="component://webpos/script/org/ofbiz/webpos/event/PaymentEvents.xml" invoke="payCash">
         <description>Pay Cash</description>
-        <attribute name="amount" type="String" mode="IN" optional="false"/>
+        <attribute name="amountCash" type="String" mode="IN" optional="false"/>
     </service>
-
+    
     <service name="payCheck" engine="simple" auth="false"
              location="component://webpos/script/org/ofbiz/webpos/event/PaymentEvents.xml" invoke="payCheck">
         <description>Pay Check</description>
-        <attribute name="amount" type="String" mode="IN" optional="false"/>
+        <attribute name="amountCheck" type="String" mode="IN" optional="false"/>
         <attribute name="refNum" type="String" mode="IN" optional="true"/>
     </service>
-
+    
     <service name="payGiftCard" engine="simple" auth="false"
              location="component://webpos/script/org/ofbiz/webpos/event/PaymentEvents.xml" invoke="payGiftCard">
         <description>Pay Gift Card</description>
-        <attribute name="amount" type="String" mode="IN" optional="false"/>
+        <attribute name="amountGiftCard" type="String" mode="IN" optional="false"/>
         <attribute name="refNum" type="String" mode="IN" optional="true"/>
     </service>
-
-    <service name="payCredit" engine="simple" auth="false"
-             location="component://webpos/script/org/ofbiz/webpos/event/PaymentEvents.xml" invoke="payCredit">
+    
+    <service name="payCreditCard" engine="simple" auth="false"
+             location="component://webpos/script/org/ofbiz/webpos/event/PaymentEvents.xml" invoke="payCreditCard">
         <description>Pay Credit Card</description>
-        <attribute name="amount" type="String" mode="IN" optional="false"/>
+        <attribute name="swipeCard" type="String" mode="IN" optional="false"/>
+        <attribute name="swipeData" type="String" mode="IN" optional="true"/>
+        <attribute name="cardType" type="String" mode="IN" optional="false"/>
+        <attribute name="amountCreditCard" type="String" mode="IN" optional="false"/>
         <attribute name="refNum" type="String" mode="IN" optional="true"/>
-        <attribute name="cardNum" type="String" mode="IN" optional="false"/>
-        <attribute name="expMonth" type="String" mode="IN" optional="false"/>
-        <attribute name="expYear" type="String" mode="IN" optional="false"/>
+        <attribute name="cardNum" type="String" mode="IN" optional="true"/>
+        <attribute name="expMonth" type="String" mode="IN" optional="true"/>
+        <attribute name="expYear" type="String" mode="IN" optional="true"/>
         <attribute name="securityCode" type="String" mode="IN" optional="true"/>
         <attribute name="postalCode" type="String" mode="IN" optional="true"/>
-        <attribute name="firstName" type="String" mode="IN" optional="false"/>
-        <attribute name="lastName" type="String" mode="IN" optional="false"/>
+        <attribute name="firstName" type="String" mode="IN" optional="true"/>
+        <attribute name="lastName" type="String" mode="IN" optional="true"/>
         <attribute name="track2" type="String" mode="IN" optional="true"/>
     </service>
-
-    <service name="processSale" engine="simple" auth="false"
-             location="component://webpos/script/org/ofbiz/webpos/event/PaymentEvents.xml" invoke="processSale">
-        <description>Process Sale</description>
-    </service>
-
-    <service name="setRefNum" engine="simple" auth="false"
-             location="component://webpos/script/org/ofbiz/webpos/event/PaymentEvents.xml" invoke="setRefNum">
-        <description>Set Payment Refernce Number</description>
-        <attribute name="refNumCheck"  type="String" mode="IN" optional="true"/>
-        <attribute name="refNumGift"   type="String" mode="IN" optional="true"/>
-        <attribute name="refNumCredit" type="String" mode="IN" optional="true"/>
+    
+    <service name="payFinish" engine="simple" auth="false"
+             location="component://webpos/script/org/ofbiz/webpos/event/PaymentEvents.xml" invoke="payFinish">
+        <description>Pay Finish</description>
     </service>
-
+    
     <service name="clearPayment" engine="simple" auth="false"
              location="component://webpos/script/org/ofbiz/webpos/event/PaymentEvents.xml" invoke="clearPayment">
         <description>Clear Payment</description>
@@ -78,7 +73,7 @@ under the License.
         <attribute name="clearGift"   type="String" mode="IN" optional="true"/>
         <attribute name="clearCredit" type="String" mode="IN" optional="true"/>
     </service>
-
+    
     <service name="clearAllPayments" engine="simple" auth="false"
              location="component://webpos/script/org/ofbiz/webpos/event/PaymentEvents.xml" invoke="clearAllPayments">
         <description>Clear All Payments</description>

Modified: ofbiz/branches/jackrabbit20100709/specialpurpose/webpos/servicedef/services_promo.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/specialpurpose/webpos/servicedef/services_promo.xml?rev=1128865&r1=1128864&r2=1128865&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/specialpurpose/webpos/servicedef/services_promo.xml (original)
+++ ofbiz/branches/jackrabbit20100709/specialpurpose/webpos/servicedef/services_promo.xml Sun May 29 11:02:09 2011
@@ -21,7 +21,7 @@ under the License.
     <description>Web Pos Promotions Services</description>
     <vendor>OFBiz</vendor>
     <version>1.0</version>
-
+    
     <service name="addPromoCode" engine="simple" auth="false"
              location="component://webpos/script/org/ofbiz/webpos/event/PromoEvents.xml" invoke="addPromoCode">
         <description>Add Promotion Code</description>