Author: jaz
Date: Tue Apr 3 09:42:24 2007 New Revision: 525205 URL: http://svn.apache.org/viewvc?view=rev&rev=525205 Log: added orderId, orderItemSeqId to post with finaccount transactions when available (more times orderId is available than orderItemSeqId); changed the partyId field to use the partyId of the finaccount instead of the userlogin processing (this is in the peformedBy field -- which maybe should be changed to userLogin) Modified: ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountProductServices.java Modified: ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml?view=diff&rev=525205&r1=525204&r2=525205 ============================================================================== --- ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml (original) +++ ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml Tue Apr 3 09:42:24 2007 @@ -127,6 +127,8 @@ <attribute name="isRefund" type="Boolean" mode="IN" optional="true"/> <attribute name="currency" type="String" mode="IN" optional="true"/> <attribute name="partyId" type="String" mode="IN" optional="true"/> + <attribute name="orderId" type="String" mode="IN" optional="true"/> + <attribute name="orderItemSeqId" type="String" mode="IN" optional="true"/> <attribute name="amount" type="Double" mode="INOUT" optional="false"/> <attribute name="balance" type="Double" mode="OUT" optional="false"/> <attribute name="previousBalance" type="Double" mode="OUT" optional="true"/> @@ -141,6 +143,8 @@ <attribute name="requireBalance" type="Boolean" mode="IN" optional="true"/> <attribute name="currency" type="String" mode="IN" optional="true"/> <attribute name="partyId" type="String" mode="IN" optional="true"/> + <attribute name="orderId" type="String" mode="IN" optional="true"/> + <attribute name="orderItemSeqId" type="String" mode="IN" optional="true"/> <attribute name="amount" type="Double" mode="INOUT" optional="false"/> <attribute name="balance" type="Double" mode="OUT" optional="false"/> <attribute name="previousBalance" type="Double" mode="OUT" optional="true"/> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java?view=diff&rev=525205&r1=525204&r2=525205 ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java Tue Apr 3 09:42:24 2007 @@ -340,6 +340,7 @@ withdrawCtx.put("productStoreId", productStoreId); withdrawCtx.put("currency", currency); withdrawCtx.put("partyId", partyId); + withdrawCtx.put("orderId", orderId); withdrawCtx.put("amount", amount); withdrawCtx.put("requireBalance", Boolean.FALSE); // for captures; if auth passed, allow withdrawCtx.put("userLogin", userLogin); @@ -395,8 +396,9 @@ String productStoreId = null; String partyId = null; + String orderId = null; if (orderPaymentPreference != null) { - String orderId = orderPaymentPreference.getString("orderId"); + orderId = orderPaymentPreference.getString("orderId"); if (orderId != null) { OrderReadHelper orh = new OrderReadHelper(delegator, orderId); productStoreId = orh.getProductStoreId(); @@ -415,6 +417,7 @@ depositCtx.put("isRefund", Boolean.TRUE); depositCtx.put("currency", currency); depositCtx.put("partyId", partyId); + depositCtx.put("orderId", orderId); depositCtx.put("amount", amount); depositCtx.put("userLogin", userLogin); @@ -451,6 +454,8 @@ GenericValue userLogin = (GenericValue) context.get("userLogin"); String productStoreId = (String) context.get("productStoreId"); String finAccountId = (String) context.get("finAccountId"); + String orderItemSeqId = (String) context.get("orderItemSeqId"); + String orderId = (String) context.get("orderId"); Boolean requireBalance = (Boolean) context.get("requireBalance"); Double amount = (Double) context.get("amount"); if (requireBalance == null) requireBalance = Boolean.TRUE; @@ -505,7 +510,7 @@ } else { try { refNum = FinAccountPaymentServices.createFinAcctPaymentTransaction(delegator, dispatcher, userLogin, amount, - productStoreId, partyId, currencyUom, WITHDRAWAL, finAccountId); + productStoreId, partyId, orderId, orderItemSeqId, currencyUom, WITHDRAWAL, finAccountId); finAccount.refresh(); balance = finAccount.getBigDecimal("actualBalance"); procResult = Boolean.TRUE; @@ -536,7 +541,9 @@ GenericValue userLogin = (GenericValue) context.get("userLogin"); String productStoreId = (String) context.get("productStoreId"); - String finAccountId = (String) context.get("finAccountId"); + String finAccountId = (String) context.get("finAccountId"); + String orderItemSeqId = (String) context.get("orderItemSeqId"); + String orderId = (String) context.get("orderId"); Boolean isRefund = (Boolean) context.get("isRefund"); Double amount = (Double) context.get("amount"); @@ -581,7 +588,7 @@ String refNum; try { refNum = FinAccountPaymentServices.createFinAcctPaymentTransaction(delegator, dispatcher, userLogin, amount, - productStoreId, partyId, currencyUom, DEPOSIT, finAccountId); + productStoreId, partyId, orderId, orderItemSeqId, currencyUom, DEPOSIT, finAccountId); finAccount.refresh(); balance = finAccount.getBigDecimal("actualBalance"); } catch (GeneralException e) { @@ -730,6 +737,7 @@ if (ServiceUtil.isError(replResp)) { return replResp; } + String orderId = (String) replResp.get("orderId"); // create the deposit Map depositCtx = FastMap.newInstance(); @@ -737,6 +745,8 @@ depositCtx.put("finAccountId", finAccountId); depositCtx.put("currency", currency); depositCtx.put("partyId", ownerPartyId); + depositCtx.put("orderId", orderId); + depositCtx.put("orderItemSeqId", "00001"); // always one item on a replish order depositCtx.put("amount", new Double(depositAmount.doubleValue())); depositCtx.put("userLogin", userLogin); Map depositResp; @@ -754,7 +764,7 @@ } private static String createFinAcctPaymentTransaction(GenericDelegator delegator, LocalDispatcher dispatcher, GenericValue userLogin, Double amount, - String productStoreId, String partyId, String currencyUom, String txType, String finAccountId) throws GeneralException { + String productStoreId, String partyId, String orderId, String orderItemSeqId, String currencyUom, String txType, String finAccountId) throws GeneralException { final String coParty = ProductStoreWorker.getProductStorePayToPartyId(productStoreId, delegator); final String paymentMethodType = "FIN_ACCOUNT"; @@ -826,7 +836,9 @@ // create the initial transaction Map transCtx = UtilMisc.toMap("finAccountTransTypeId", txType); transCtx.put("finAccountId", finAccountId); - transCtx.put("partyId", userLogin.getString("partyId")); + transCtx.put("partyId", partyId); + transCtx.put("orderId", orderId); + transCtx.put("orderItemSeqId", orderItemSeqId); transCtx.put("amount", amount); transCtx.put("userLogin", userLogin); transCtx.put("paymentId", paymentId); Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountProductServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountProductServices.java?view=diff&rev=525205&r1=525204&r2=525205 ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountProductServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountProductServices.java Tue Apr 3 09:42:24 2007 @@ -54,6 +54,7 @@ // order ID for tracking String orderId = orderItem.getString("orderId"); + String orderItemSeqId = orderItem.getString("orderItemSeqId"); // the order header for store info GenericValue orderHeader; @@ -217,6 +218,8 @@ depositCtx.put("productStoreId", productStoreId); depositCtx.put("currency", currency); depositCtx.put("partyId", partyId); + depositCtx.put("orderId", orderId); + depositCtx.put("orderItemSeqId", orderItemSeqId); depositCtx.put("amount", new Double(deposit.doubleValue())); depositCtx.put("userLogin", userLogin); |
Free forum by Nabble | Edit this page |