Author: sichen
Date: Fri Jul 21 15:39:30 2006 New Revision: 424484 URL: http://svn.apache.org/viewvc?rev=424484&view=rev Log: Refactoring of the way billing accounts work, using PaymentApplication to track the amount of a billing account used up in each invoice. Also changed captureOrderPayments to use up billing accounts first before other payment methods. Finally, new methods to get net vs. available balances of a billing account Modified: incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml incubator/ofbiz/trunk/applications/accounting/servicedef/services_billing.xml incubator/ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml Modified: incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml?rev=424484&r1=424483&r2=424484&view=diff ============================================================================== --- incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml (original) +++ incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml Fri Jul 21 15:39:30 2006 @@ -107,15 +107,12 @@ <!-- get the invoice and do some further validation against it --> <if-not-empty field-name="parameters.invoiceId"> <entity-one entity-name="Invoice" value-name="invoice"/> - <if-not-empty field-name="invoice.billingAccountId"> - <set from-field="invoice.billingAccountId" field="paymentAppl.billingAccountId"/> - </if-not-empty> <!-- get the amount that has not been applied yet for the invoice (outstanding amount) --> <set field="notApplied" value="${bsh:org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceNotApplied(invoice).doubleValue()}" type="Double"/> <!-- if the amount to apply goes over the outstanding amount, then use the notApplied amount and log a warning --> - <if-compare-field field-name="paymentAppl.amountApplied" operator="greater" to-field-name="notApplied"> + <if-compare-field field-name="paymentAppl.amountApplied" operator="greater" to-field-name="notApplied" type="Double"> <log level="warning" message="Create Payment Application: Amount to apply [${paymentAppl.amountApplied}] is greater than the outstanding amount [${notApplied}] of the invoice [${invoice.invoiceId}]. Creating Payment Application for outstanding amount [${notApplied}] instead."/> <set field="paymentAppl.amountApplied" from-field="notApplied"/> </if-compare-field> Modified: incubator/ofbiz/trunk/applications/accounting/servicedef/services_billing.xml URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/accounting/servicedef/services_billing.xml?rev=424484&r1=424483&r2=424484&view=diff ============================================================================== --- incubator/ofbiz/trunk/applications/accounting/servicedef/services_billing.xml (original) +++ incubator/ofbiz/trunk/applications/accounting/servicedef/services_billing.xml Fri Jul 21 15:39:30 2006 @@ -97,6 +97,7 @@ <description>Calculate the balance of a Billing Account</description> <attribute name="billingAccountId" type="String" mode="IN" optional="false"/> <attribute name="accountBalance" type="Double" mode="OUT" optional="false"/> + <attribute name="netAccountBalance" type="Double" mode="OUT" optional="false"/> <attribute name="billingAccount" type="GenericValue" mode="OUT" optional="false"/> </service> </services> Modified: incubator/ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml?rev=424484&r1=424483&r2=424484&view=diff ============================================================================== --- incubator/ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml (original) +++ incubator/ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml Fri Jul 21 15:39:30 2006 @@ -253,13 +253,24 @@ <service name="captureOrderPayments" engine="java" location="org.ofbiz.accounting.payment.PaymentGatewayServices" invoke="captureOrderPayments" auth="true"> - <description>Captures (settles) pre-authorized order payments</description> + <description>Captures (settles) pre-authorized order payments, re-authorizing any remaining balance. If the order involves billing accounts, + capture to it in full before proceeding to other payment preferences.</description> <attribute name="orderId" type="String" mode="IN" optional="false"/> <attribute name="invoiceId" type="String" mode="IN" optional="true"/> <attribute name="billingAccountId" type="String" mode="IN" optional="true"/> <attribute name="captureAmount" type="Double" mode="IN" optional="false"/> <attribute name="processResult" type="String" mode="OUT" optional="false"/> </service> + + <service name="captureBillingAccountPayment" engine="java" + location="org.ofbiz.accounting.payment.PaymentGatewayServices" invoke="captureBillingAccountPayment" auth="true"> + <description>Records a settlement or payment of an invoice by a billing account for the given captureAmount</description> + <attribute name="invoiceId" type="String" mode="IN" optional="false"/> + <attribute name="billingAccountId" type="String" mode="IN" optional="false"/> + <attribute name="captureAmount" type="Double" mode="IN" optional="false"/> + <attribute name="paymentId" type="String" mode="OUT" optional="false"/> + </service> + <service name="refundPayment" engine="java" location="org.ofbiz.accounting.payment.PaymentGatewayServices" invoke="refundPayment" auth="true"> |
Free forum by Nabble | Edit this page |