Author: jaz
Date: Wed Mar 28 13:01:35 2007
New Revision: 523446
URL: http://svn.apache.org/viewvc?view=rev&rev=523446
Log:
updated non-product service
Modified:
ofbiz/trunk/applications/order/servicedef/services.xml
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
Modified: ofbiz/trunk/applications/order/servicedef/services.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services.xml?view=diff&rev=523446&r1=523445&r2=523446
==============================================================================
--- ofbiz/trunk/applications/order/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/order/servicedef/services.xml Wed Mar 28 13:01:35
2007
@@ -157,7 +157,8 @@
<attribute name="productStoreId" type="String" mode="IN"
optional="false"/>
<attribute name="currency" type="String" mode="IN" optional="false"/>
<attribute name="partyId" type="String" mode="IN" optional="false"/>
- <attribute name="itemMap" type="Map" mode="IN" optional="false"/>
+ <attribute name="itemMap" type="Map" mode="IN" optional="false"/>
+ <attribute name="orderId" type="String" mode="OUT" optional="false"/>
</service>
<service name="createOrderItemBilling" engine="simple"
Modified:
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?view=diff&rev=523446&r1=523445&r2=523446
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
(original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
Wed Mar 28 13:01:35 2007
@@ -2069,6 +2069,10 @@
return ServiceUtil.returnFailure("Could not find OrderHeader with
ID [" + orderId + "]");
}
+ if (orderHeader.get("webSiteId") == null) {
+ return ServiceUtil.returnFailure("No website attached to order;
cannot generate notification [" + orderId + "]");
+ }
+
GenericValue productStoreEmail = null;
try {
productStoreEmail =
delegator.findByPrimaryKey("ProductStoreEmailSetting",
UtilMisc.toMap("productStoreId", orderHeader.get("productStoreId"),
"emailType", emailType));
@@ -4040,30 +4044,32 @@
// set the payment method
cart.addPayment(paymentMethodId);
- // store the order
- CheckOutHelper coh = new CheckOutHelper(dispatcher, delegator, cart);
- Map createResp = coh.createOrder(userLogin);
+ // save the order (new tx)
+ Map createResp;
+ try {
+ createResp = dispatcher.runSync("createOrderFromShoppingCart",
UtilMisc.toMap("shoppingCart", cart), 90, true);
+ } catch (GenericServiceException e) {
+ Debug.logError(e, module);
+ return ServiceUtil.returnError(e.getMessage());
+ }
if (ServiceUtil.isError(createResp)) {
- return
ServiceUtil.returnError(ServiceUtil.getErrorMessage(createResp));
+ return createResp;
}
- // process the payment
- Map procCtx = FastMap.newInstance();
- procCtx.put("shoppingCart", cart);
- procCtx.put("userLogin", userLogin);
- Map procResp;
+ // auth the order (new tx)
+ Map authResp;
try {
- procResp = dispatcher.runSync("callProcessOrderPayments", procCtx);
+ authResp = dispatcher.runSync("callProcessOrderPayments",
UtilMisc.toMap("shoppingCart", cart), 180, true);
} catch (GenericServiceException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(e.getMessage());
}
- if (ServiceUtil.isError(procResp)) {
- return procResp;
+ if (ServiceUtil.isError(authResp)) {
+ return authResp;
}
-
+
Map result = ServiceUtil.returnSuccess();
- //result.put("shoppingCart", cart);
+ result.put("orderId", createResp.get("orderId"));
return result;
}