svn commit: r451076 - in /incubator/ofbiz/trunk/applications/order: config/ script/org/ofbiz/order/order/ servicedef/ webapp/ordermgr/WEB-INF/ webapp/ordermgr/WEB-INF/actions/order/

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

svn commit: r451076 - in /incubator/ofbiz/trunk/applications/order: config/ script/org/ofbiz/order/order/ servicedef/ webapp/ordermgr/WEB-INF/ webapp/ordermgr/WEB-INF/actions/order/

sichen
Author: sichen
Date: Thu Sep 28 17:46:24 2006
New Revision: 451076

URL: http://svn.apache.org/viewvc?view=rev&rev=451076
Log:
Some services to support adding a payment method to an existing order and automatically authorizing it.  Screen modifications to follow

Modified:
    incubator/ofbiz/trunk/applications/order/config/OrderErrorUiLabels.properties
    incubator/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml
    incubator/ofbiz/trunk/applications/order/servicedef/services.xml
    incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh
    incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml

Modified: incubator/ofbiz/trunk/applications/order/config/OrderErrorUiLabels.properties
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/config/OrderErrorUiLabels.properties?view=diff&rev=451076&r1=451075&r2=451076
==============================================================================
--- incubator/ofbiz/trunk/applications/order/config/OrderErrorUiLabels.properties (original)
+++ incubator/ofbiz/trunk/applications/order/config/OrderErrorUiLabels.properties Thu Sep 28 17:46:24 2006
@@ -279,3 +279,4 @@
 OrderYouDoNotHavePermissionToChangeThisOrdersStatus=You do not have permission to change this order's status.
 OrderYouDoNotHavePermissionToLoadTaxTables=You do not have permission to load tax tables
 OrderYouDoNotHavePermissionToTakeOrdersForThisStore=You do not have permission to take orders for this store.
+OrderSecurityErrorToRunAddPaymentMethodToOrder = Security Error: to run addPaymentMethodToOrder you must have the ORDERMGR_CREATE or ORDERMGR_ADMIN permission

Modified: incubator/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml?view=diff&rev=451076&r1=451075&r2=451076
==============================================================================
--- incubator/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml (original)
+++ incubator/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml Thu Sep 28 17:46:24 2006
@@ -631,5 +631,25 @@
         <entity-one entity-name="OrderTerm" value-name="lookedUpValue"/>
         <remove-value value-name="lookedUpValue"/>
     </simple-method>
+    
+    <simple-method method-name="addPaymentMethodToOrder" short-description="Create an PaymentMethodToOrder">
+        <check-permission permission="ORDERMGR" action="_CREATE">
+            <fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunAddPaymentMethodToOrder"/>
+        </check-permission>
+        <check-errors/>
+        <set field="inputMap.paymentMethodId" from-field="parameters.paymentMethodId"/>
+        <set field="inputMap.maxAmount" from-field="parameters.maxAmount"/>
+        <set field="inputMap.orderId" from-field="parameters.orderId"/>
+        <entity-one entity-name="PaymentMethod" value-name="paymentMethod">
+            <field-map field-name="paymentMethodId" env-name="parameters.paymentMethodId"/>
+        </entity-one>
+        <set field="inputMap.paymentMethodTypeId" from-field="paymentMethod.paymentMethodTypeId"/>
+        <!--In this method we calls createOrderPaymentPreference and returns orderPaymentPreferenceId field to authOrderPaymentPreference -->      
+        <call-service service-name="createOrderPaymentPreference" in-map-name="inputMap" include-user-login="true">
+           <result-to-field field-name="parameters.orderPaymentPreferenceId" result-name="orderPaymentPreferenceId"/>
+        </call-service>  
+        <field-to-result field-name="parameters.orderPaymentPreferenceId" result-name="orderPaymentPreferenceId"/>
+    </simple-method>
+    
 </simple-methods>
 

Modified: incubator/ofbiz/trunk/applications/order/servicedef/services.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/servicedef/services.xml?view=diff&rev=451076&r1=451075&r2=451076
==============================================================================
--- incubator/ofbiz/trunk/applications/order/servicedef/services.xml (original)
+++ incubator/ofbiz/trunk/applications/order/servicedef/services.xml Thu Sep 28 17:46:24 2006
@@ -563,4 +563,14 @@
         <description>If the order is a sales order, create purchase orders (drop shipments) for each ship group associated to a supplier</description>
         <attribute name="orderId" type="String" mode="IN" optional="false"/>
     </service>
+    
+    <service name="addPaymentMethodToOrder" engine="simple"
+            location="org/ofbiz/order/order/OrderServices.xml" invoke="addPaymentMethodToOrder" auth="true">
+        <description>Add Payment Method to Order.From this servicewe will call the createOrderPaymentPreference service to create OrderPaymentPreference</description>
+        <attribute type="String" mode="IN" name="orderId" optional="false"/>
+        <attribute type="String" mode="IN" name="paymentMethodId" optional="false"/>
+        <attribute type="Double" mode="IN" name="maxAmount"/>
+        <attribute type="String" mode="OUT" name="orderPaymentPreferenceId"/>
+    </service>
+    
 </services>

Modified: incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh?view=diff&rev=451076&r1=451075&r2=451076
==============================================================================
--- incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh (original)
+++ incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh Thu Sep 28 17:46:24 2006
@@ -25,6 +25,7 @@
 import org.ofbiz.order.order.*;
 import org.ofbiz.party.contact.*;
 import org.ofbiz.product.inventory.InventoryWorker;
+import org.ofbiz.accounting.payment.*;
 
 orderId = parameters.get("orderId");
 context.put("orderId", orderId);
@@ -348,3 +349,6 @@
     productStoreShipmentMethList = delegator.findByAndCache("ProductStoreShipmentMethView", UtilMisc.toMap("productStoreId", productStoreId), UtilMisc.toList("sequenceNumber"));
     context.put("productStoreShipmentMethList",productStoreShipmentMethList);
 }
+
+List paymentMethodValueMaps = PaymentWorker.getPartyPaymentMethodValueMaps(delegator, partyId, false);
+context.put("paymentMethodValueMaps", paymentMethodValueMaps);

Modified: incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml?view=diff&rev=451076&r1=451075&r2=451076
==============================================================================
--- incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml (original)
+++ incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml Thu Sep 28 17:46:24 2006
@@ -1339,6 +1339,17 @@
         <response name="error" type="view" value="orderview"/>
     </request-map>
 
+    <request-map uri="addPaymentMethodToOrder">
+        <security https="true" auth="true"/>
+        <event type="service" path="" invoke="addPaymentMethodToOrder"/>
+        <response name="success" type="request" value="authOrderPayment"/>
+    </request-map>
+    
+    <request-map uri="authOrderPayment">
+        <security https="true" auth="true"/>
+        <event type="service" path="" invoke="authOrderPaymentPreference"/>
+        <response name="success" type="view" value="orderview"/>
+    </request-map>
     
     <!-- Lookup request mappings -->
     <request-map uri="LookupPerson"><security https="true" auth="true"/><response name="success" type="view" value="LookupPerson"/></request-map>