Hi Skip,

[EMAIL PROTECTED] wrote:
Hi Jacopo

I have two questions concerning billing accounts.  Account balances are
computed in BillingAccountWorker.getBillingAccountBalance().  This routine
uses an algorithm that subtracts the sum of OrderPaymentPreference.maxAmount
where the statusId is "PAYMENT_NOT_RECEIVED" (and a few others).

What I am wondering is why this entity was chosen over the sum of Invoices
outstanding which to me makes more sense.  Maybe this way is faster?


Actually, that was the initial plan. Unfortunately, when you create an order, and the customer asks to 'pay' it with a billing account we have to consider this and adjust the billing account balance immediately (if not, the customer could enter a lot of orders exceeding the billing account credit/limit) ... but there is still no invoice for the order (that is created when the order is shipped).


Second, in the same file is getBillingAccountNetBalance() which returns the
sum of PaymentApplication.  The comment sez this "Calculates the net balance
of a billing account, which is sum of all amounts applied to invoices minus
sum of all amounts applied from payments".  If you write an order against a
BillingAccount, PaymentApplication is empty after an invoice is created, so
I don't see the value of this function.  Maybe I am misinterpreting the name
"getBillingAccountNetBalance".  However, getBillingAccountAvailableBalance
returns the billing account limit - getBillingAccountNetBalance, so I would
have thought that getBillingAccountBalance() would =
getBillingAccountAvailableBalance if there are no uninvoiced Orders.

Many of the methods in that class were created before the last refactoring of the billing accounts and they will be removed soon: sorry for the confusion. If I well remember there is only one balance method that is still valid, all the other ones are deprecated.

Jacopo


Note that I see that  getBillingAccountAvailableBalance is commented out in
the one place it is used in favor of getBillingAccountBalance().

I am thinking of re-writing the  getBillingAccountNetBalance()  to use
Invoice because that, along with Payment is the basis for statements sent to
customers and it makes sense to me from a data consistancy standpoint.

Am I barking up the wrong tree?

Skip



Reply via email to