[jira] Created: (OFBIZ-93) Support BillingAcct + PaymentMethod for Payment

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
30 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-93) Support BillingAcct + PaymentMethod for Payment

Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-93?page=comments#action_12457932 ]
           
Jacopo Cappellato commented on OFBIZ-93:
----------------------------------------

Si,

I think that moving the billingAccountId from OrderHeader to OrderPaymentPreference would be a major refactoring, and all in all I don't see so many advantages in associating one order to more than one billing account (but I could be wrong).
I think that the best thing we should do now is to fix the existing code (that seems broken to me) and postpone the decisions about migrating to FinAccount later (I'm sorry I don't know anything about them).
Right now the billingAccountId is in the OrderHeader, Invoice (header) and PaymentApplication.
If a payment application is applied to an invoice associated to the billing account, this means that the payment application itself is associated to the billing account.
If we want to associate a payment (in advance) to a billing account, I don't think that it is correct to create a payment application associated to the billing account, because it is still not really applied to anything: it should be the payment itself that is associated with the billing account.
For example:

Billing Account: 10000
Payment: 20000 with amount $100
If we want to associate the payment to the billing account, right now we have to create (if I'm not wrong) a PaymentApplication of $100 and associate it to the billing account.
After this we get an invoice of $40 and we associate it to the same billing account.
How should we apply the payment to the invoice? By creating a new PaymentApplication?
In my opinion it would much more easier to assign the Payment 20000 to the billing account 10000.
When the invoice is created and associated to the billing account, we just have to create a payment application as usual.




> Support BillingAcct + PaymentMethod for Payment
> -----------------------------------------------
>
>                 Key: OFBIZ-93
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-93
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Improvement
>          Components: accounting
>            Reporter: Si Chen
>         Assigned To: Si Chen
>         Attachments: ofbiz-93.patch
>
>
> The requirement is that a customer be able to use a billing account plus another form of payment, such as a credit card, for payment on an order.  The billing account is to be used first.
> This would require the following changes:
> 1.  In PaymentGatewayServices.java captureOrderPayments method, if the billing account has a positive balance, then first create a Payment of the EXT_BILL_ACT type, then a PaymentApplication of amountApplied = min(billing account balance, amount to capture.)  This PaymentApplication MUST have an invoiceId which is already supplied as a parameter of the service.  (Otherwise, the billing account balance will go down by the PaymentApplication.amountApplied)  If there is an amount left over to capture, then amountToCapture = amountToCapture - billingAccountBalance.  We can then loop through the OrderPaymentPreference to try to capture the remaining amount.
> 2.   In BillingAccountWorker.getBillingAccountBalance, we need to replace current code which just loops through all invoices which are not PAID or CANCELLED and adds up their unpaid balances with new code which would find all PaymentApplication for which there is a billingAccountId and add up the amountApplied.  This must be done because otherwise, once an invoice has been marked PAID, there would be no way to record that a portion of the billing account has been used to pay that invoice and hence permanently decrease its amount.
> On the mailing list we had discussed making the order of payment capture configurable.  I can't think of an easy way to do this, however, with the current data model.  I propose that for now we have PaymentGatewayServices basically capture billing account first, then other payment methods, which is a standard B2C process.  If you have a B2B customer who wants to pay with a credit card, then use the accounting module to record a Credit Card payment and apply it to the Billing Account to bring down its balance.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-93) Support BillingAcct + PaymentMethod for Payment

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-93?page=comments#action_12457936 ]
           
Si Chen commented on OFBIZ-93:
------------------------------

Jacopo,

Your use case is probably not supported right now with the current billing account scheme, namely--"capturing" to a billing account in advance of invoicing.  This problem actually did not exist in older implementations of billing accounts, however, because as soon as an order is created against the billing account, the balance was deducted.  We split out the balance of the billing account between available and net balances, so that new orders are removed against available balances not net ones, to enforce a separation between an "authorization" and a "capture".  Still, if an order were placed to use the billing account, then it should prevent other orders from using because the available balance should have gone down.

Incidentally, migrating to FinAccount would solve several problems:

1.  You can capture from a FinAccount before invoicing

2.  You can use multiple FinAccounts on the same order/invoice

3.  A FinAccount is like a store credit and a gift card, which might be nice for the POS folks.

What exact process are you trying to follow?  I'm guessing it can be supported using the current code without moving the billingAccountId to Payment, and the effort of such a re-factoring is better reserved for moving us to FinAccounts.  It's probably not harder by the way but will yield much more results.



> Support BillingAcct + PaymentMethod for Payment
> -----------------------------------------------
>
>                 Key: OFBIZ-93
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-93
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Improvement
>          Components: accounting
>            Reporter: Si Chen
>         Assigned To: Si Chen
>         Attachments: ofbiz-93.patch
>
>
> The requirement is that a customer be able to use a billing account plus another form of payment, such as a credit card, for payment on an order.  The billing account is to be used first.
> This would require the following changes:
> 1.  In PaymentGatewayServices.java captureOrderPayments method, if the billing account has a positive balance, then first create a Payment of the EXT_BILL_ACT type, then a PaymentApplication of amountApplied = min(billing account balance, amount to capture.)  This PaymentApplication MUST have an invoiceId which is already supplied as a parameter of the service.  (Otherwise, the billing account balance will go down by the PaymentApplication.amountApplied)  If there is an amount left over to capture, then amountToCapture = amountToCapture - billingAccountBalance.  We can then loop through the OrderPaymentPreference to try to capture the remaining amount.
> 2.   In BillingAccountWorker.getBillingAccountBalance, we need to replace current code which just loops through all invoices which are not PAID or CANCELLED and adds up their unpaid balances with new code which would find all PaymentApplication for which there is a billingAccountId and add up the amountApplied.  This must be done because otherwise, once an invoice has been marked PAID, there would be no way to record that a portion of the billing account has been used to pay that invoice and hence permanently decrease its amount.
> On the mailing list we had discussed making the order of payment capture configurable.  I can't think of an easy way to do this, however, with the current data model.  I propose that for now we have PaymentGatewayServices basically capture billing account first, then other payment methods, which is a standard B2C process.  If you have a B2B customer who wants to pay with a credit card, then use the accounting module to record a Credit Card payment and apply it to the Billing Account to bring down its balance.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-93) Support BillingAcct + PaymentMethod for Payment

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-93?page=comments#action_12457946 ]
           
Jacopo Cappellato commented on OFBIZ-93:
----------------------------------------

Si,

thanks for the useful information.
What I'm really trying to do is this:
a) fix the returns of type "store credit": a billing account is created and credit applied to it, but I see odd things happening when I try to consume the credit in a new order
b) fix the standard billing account process where you select a billing account, the order is associated to it and also the invoices (when they are created): right now there are odd things in the way balances are computed

As a side note I've noticed that the billingAccountId is not stored in the OrderHeader when you select in the checkout screen and I'm trying to fix this too.

Jacopo


> Support BillingAcct + PaymentMethod for Payment
> -----------------------------------------------
>
>                 Key: OFBIZ-93
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-93
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Improvement
>          Components: accounting
>            Reporter: Si Chen
>         Assigned To: Si Chen
>         Attachments: ofbiz-93.patch
>
>
> The requirement is that a customer be able to use a billing account plus another form of payment, such as a credit card, for payment on an order.  The billing account is to be used first.
> This would require the following changes:
> 1.  In PaymentGatewayServices.java captureOrderPayments method, if the billing account has a positive balance, then first create a Payment of the EXT_BILL_ACT type, then a PaymentApplication of amountApplied = min(billing account balance, amount to capture.)  This PaymentApplication MUST have an invoiceId which is already supplied as a parameter of the service.  (Otherwise, the billing account balance will go down by the PaymentApplication.amountApplied)  If there is an amount left over to capture, then amountToCapture = amountToCapture - billingAccountBalance.  We can then loop through the OrderPaymentPreference to try to capture the remaining amount.
> 2.   In BillingAccountWorker.getBillingAccountBalance, we need to replace current code which just loops through all invoices which are not PAID or CANCELLED and adds up their unpaid balances with new code which would find all PaymentApplication for which there is a billingAccountId and add up the amountApplied.  This must be done because otherwise, once an invoice has been marked PAID, there would be no way to record that a portion of the billing account has been used to pay that invoice and hence permanently decrease its amount.
> On the mailing list we had discussed making the order of payment capture configurable.  I can't think of an easy way to do this, however, with the current data model.  I propose that for now we have PaymentGatewayServices basically capture billing account first, then other payment methods, which is a standard B2C process.  If you have a B2B customer who wants to pay with a credit card, then use the accounting module to record a Credit Card payment and apply it to the Billing Account to bring down its balance.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-93) Support BillingAcct + PaymentMethod for Payment

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-93?page=comments#action_12457955 ]
           
Si Chen commented on OFBIZ-93:
------------------------------

Jacopo -

Those sound like just odd bugs rather than the need of a re-design.  We recently did quite a bit of work with billing accounts but unfortunately the check out sequence was quite customized so not all of it could be moved back to the project.  

Still, I probably remember some of the solutions we came up, so I'll try to help out as I can.  :)

> Support BillingAcct + PaymentMethod for Payment
> -----------------------------------------------
>
>                 Key: OFBIZ-93
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-93
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Improvement
>          Components: accounting
>            Reporter: Si Chen
>         Assigned To: Si Chen
>         Attachments: ofbiz-93.patch
>
>
> The requirement is that a customer be able to use a billing account plus another form of payment, such as a credit card, for payment on an order.  The billing account is to be used first.
> This would require the following changes:
> 1.  In PaymentGatewayServices.java captureOrderPayments method, if the billing account has a positive balance, then first create a Payment of the EXT_BILL_ACT type, then a PaymentApplication of amountApplied = min(billing account balance, amount to capture.)  This PaymentApplication MUST have an invoiceId which is already supplied as a parameter of the service.  (Otherwise, the billing account balance will go down by the PaymentApplication.amountApplied)  If there is an amount left over to capture, then amountToCapture = amountToCapture - billingAccountBalance.  We can then loop through the OrderPaymentPreference to try to capture the remaining amount.
> 2.   In BillingAccountWorker.getBillingAccountBalance, we need to replace current code which just loops through all invoices which are not PAID or CANCELLED and adds up their unpaid balances with new code which would find all PaymentApplication for which there is a billingAccountId and add up the amountApplied.  This must be done because otherwise, once an invoice has been marked PAID, there would be no way to record that a portion of the billing account has been used to pay that invoice and hence permanently decrease its amount.
> On the mailing list we had discussed making the order of payment capture configurable.  I can't think of an easy way to do this, however, with the current data model.  I propose that for now we have PaymentGatewayServices basically capture billing account first, then other payment methods, which is a standard B2C process.  If you have a B2B customer who wants to pay with a credit card, then use the accounting module to record a Credit Card payment and apply it to the Billing Account to bring down its balance.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (OFBIZ-93) Support BillingAcct + PaymentMethod for Payment

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
     [ http://issues.apache.org/jira/browse/OFBIZ-93?page=all ]

Jacopo Cappellato updated OFBIZ-93:
-----------------------------------

    Attachment: order_billingAccount_co.patch

The attached patch fixes a bug that happens in the order entry checkout process when you select a billing account: the billing account was not saved in the cart (and then in the order/invoice etc...)

However I'd like your review because I'm not completely sure about the existing code and I'd like some advices.

Thanks

> Support BillingAcct + PaymentMethod for Payment
> -----------------------------------------------
>
>                 Key: OFBIZ-93
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-93
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Improvement
>          Components: accounting
>            Reporter: Si Chen
>         Assigned To: Si Chen
>         Attachments: ofbiz-93.patch, order_billingAccount_co.patch
>
>
> The requirement is that a customer be able to use a billing account plus another form of payment, such as a credit card, for payment on an order.  The billing account is to be used first.
> This would require the following changes:
> 1.  In PaymentGatewayServices.java captureOrderPayments method, if the billing account has a positive balance, then first create a Payment of the EXT_BILL_ACT type, then a PaymentApplication of amountApplied = min(billing account balance, amount to capture.)  This PaymentApplication MUST have an invoiceId which is already supplied as a parameter of the service.  (Otherwise, the billing account balance will go down by the PaymentApplication.amountApplied)  If there is an amount left over to capture, then amountToCapture = amountToCapture - billingAccountBalance.  We can then loop through the OrderPaymentPreference to try to capture the remaining amount.
> 2.   In BillingAccountWorker.getBillingAccountBalance, we need to replace current code which just loops through all invoices which are not PAID or CANCELLED and adds up their unpaid balances with new code which would find all PaymentApplication for which there is a billingAccountId and add up the amountApplied.  This must be done because otherwise, once an invoice has been marked PAID, there would be no way to record that a portion of the billing account has been used to pay that invoice and hence permanently decrease its amount.
> On the mailing list we had discussed making the order of payment capture configurable.  I can't think of an easy way to do this, however, with the current data model.  I propose that for now we have PaymentGatewayServices basically capture billing account first, then other payment methods, which is a standard B2C process.  If you have a B2B customer who wants to pay with a credit card, then use the accounting module to record a Credit Card payment and apply it to the Billing Account to bring down its balance.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (OFBIZ-93) Support BillingAcct + PaymentMethod for Payment

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
     [ http://issues.apache.org/jira/browse/OFBIZ-93?page=all ]

Jacopo Cappellato updated OFBIZ-93:
-----------------------------------

    Attachment: ss-ba.jpg

Si,

could you please have a look at the attached screenshot?
It shows what happens when I approve a return of type "store credit": a new billing account is created and an (credit) invoice is created and also a payment to refund the amount to the client.
Then two payment applications are also created and associated to the billing account (see screenshot):
one is applied to the (credit) invoice and the other is not applied to any invoice.
I guess that the payment application with the null invoiceId represents the amount available (refunded) to the client in the billing account.
My questions are: how should I use it? What do I have to do if I just need to apply a part of that amount to a new invoice?

Thanks




> Support BillingAcct + PaymentMethod for Payment
> -----------------------------------------------
>
>                 Key: OFBIZ-93
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-93
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Improvement
>          Components: accounting
>            Reporter: Si Chen
>         Assigned To: Si Chen
>         Attachments: ofbiz-93.patch, order_billingAccount_co.patch, ss-ba.jpg
>
>
> The requirement is that a customer be able to use a billing account plus another form of payment, such as a credit card, for payment on an order.  The billing account is to be used first.
> This would require the following changes:
> 1.  In PaymentGatewayServices.java captureOrderPayments method, if the billing account has a positive balance, then first create a Payment of the EXT_BILL_ACT type, then a PaymentApplication of amountApplied = min(billing account balance, amount to capture.)  This PaymentApplication MUST have an invoiceId which is already supplied as a parameter of the service.  (Otherwise, the billing account balance will go down by the PaymentApplication.amountApplied)  If there is an amount left over to capture, then amountToCapture = amountToCapture - billingAccountBalance.  We can then loop through the OrderPaymentPreference to try to capture the remaining amount.
> 2.   In BillingAccountWorker.getBillingAccountBalance, we need to replace current code which just loops through all invoices which are not PAID or CANCELLED and adds up their unpaid balances with new code which would find all PaymentApplication for which there is a billingAccountId and add up the amountApplied.  This must be done because otherwise, once an invoice has been marked PAID, there would be no way to record that a portion of the billing account has been used to pay that invoice and hence permanently decrease its amount.
> On the mailing list we had discussed making the order of payment capture configurable.  I can't think of an easy way to do this, however, with the current data model.  I propose that for now we have PaymentGatewayServices basically capture billing account first, then other payment methods, which is a standard B2C process.  If you have a B2B customer who wants to pay with a credit card, then use the accounting module to record a Credit Card payment and apply it to the Billing Account to bring down its balance.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-93) Support BillingAcct + PaymentMethod for Payment

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-93?page=comments#action_12458933 ]
           
Si Chen commented on OFBIZ-93:
------------------------------

Jacopo,

The screenshot looks right.

To apply it to an invoice, you just create another Payment of type "CUSTOMER_PAYMENT" and then set the paymentapplication's billingAccountId to your billing account and invoiceId to your new invoice.

You can also try the service captureBillingAccountPayment which does both for you :)

Si

> Support BillingAcct + PaymentMethod for Payment
> -----------------------------------------------
>
>                 Key: OFBIZ-93
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-93
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Improvement
>          Components: accounting
>            Reporter: Si Chen
>         Assigned To: Si Chen
>         Attachments: ofbiz-93.patch, order_billingAccount_co.patch, ss-ba.jpg
>
>
> The requirement is that a customer be able to use a billing account plus another form of payment, such as a credit card, for payment on an order.  The billing account is to be used first.
> This would require the following changes:
> 1.  In PaymentGatewayServices.java captureOrderPayments method, if the billing account has a positive balance, then first create a Payment of the EXT_BILL_ACT type, then a PaymentApplication of amountApplied = min(billing account balance, amount to capture.)  This PaymentApplication MUST have an invoiceId which is already supplied as a parameter of the service.  (Otherwise, the billing account balance will go down by the PaymentApplication.amountApplied)  If there is an amount left over to capture, then amountToCapture = amountToCapture - billingAccountBalance.  We can then loop through the OrderPaymentPreference to try to capture the remaining amount.
> 2.   In BillingAccountWorker.getBillingAccountBalance, we need to replace current code which just loops through all invoices which are not PAID or CANCELLED and adds up their unpaid balances with new code which would find all PaymentApplication for which there is a billingAccountId and add up the amountApplied.  This must be done because otherwise, once an invoice has been marked PAID, there would be no way to record that a portion of the billing account has been used to pay that invoice and hence permanently decrease its amount.
> On the mailing list we had discussed making the order of payment capture configurable.  I can't think of an easy way to do this, however, with the current data model.  I propose that for now we have PaymentGatewayServices basically capture billing account first, then other payment methods, which is a standard B2C process.  If you have a B2B customer who wants to pay with a credit card, then use the accounting module to record a Credit Card payment and apply it to the Billing Account to bring down its balance.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-93) Support BillingAcct + PaymentMethod for Payment

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-93?page=comments#action_12458996 ]
           
Jacques Le Roux commented on OFBIZ-93:
--------------------------------------

SI,

I'm interested with the FinAccount possibilities for storing credit and a selling gift card in POS. How may we coordinate on this (for the moment I know nothing about that) ?


> Support BillingAcct + PaymentMethod for Payment
> -----------------------------------------------
>
>                 Key: OFBIZ-93
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-93
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Improvement
>          Components: accounting
>            Reporter: Si Chen
>         Assigned To: Si Chen
>         Attachments: ofbiz-93.patch, order_billingAccount_co.patch, ss-ba.jpg
>
>
> The requirement is that a customer be able to use a billing account plus another form of payment, such as a credit card, for payment on an order.  The billing account is to be used first.
> This would require the following changes:
> 1.  In PaymentGatewayServices.java captureOrderPayments method, if the billing account has a positive balance, then first create a Payment of the EXT_BILL_ACT type, then a PaymentApplication of amountApplied = min(billing account balance, amount to capture.)  This PaymentApplication MUST have an invoiceId which is already supplied as a parameter of the service.  (Otherwise, the billing account balance will go down by the PaymentApplication.amountApplied)  If there is an amount left over to capture, then amountToCapture = amountToCapture - billingAccountBalance.  We can then loop through the OrderPaymentPreference to try to capture the remaining amount.
> 2.   In BillingAccountWorker.getBillingAccountBalance, we need to replace current code which just loops through all invoices which are not PAID or CANCELLED and adds up their unpaid balances with new code which would find all PaymentApplication for which there is a billingAccountId and add up the amountApplied.  This must be done because otherwise, once an invoice has been marked PAID, there would be no way to record that a portion of the billing account has been used to pay that invoice and hence permanently decrease its amount.
> On the mailing list we had discussed making the order of payment capture configurable.  I can't think of an easy way to do this, however, with the current data model.  I propose that for now we have PaymentGatewayServices basically capture billing account first, then other payment methods, which is a standard B2C process.  If you have a B2B customer who wants to pay with a credit card, then use the accounting module to record a Credit Card payment and apply it to the Billing Account to bring down its balance.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-93) Support BillingAcct + PaymentMethod for Payment

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-93?page=comments#action_12459023 ]
           
Iain Fogg commented on OFBIZ-93:
--------------------------------

Jacopo/Si,

Sorry to side track this issue, but I've upgraded to include these patches and I'm still struggling to use the billing account for payment.

When I raise a sales order, I'm selecting "Pay with billing account alone" and selecting a billing account previously setup for the customer. Once I've approved the order, I do a quick ship which creates the invoice.

Can you walk me through how to use the BillingAcct to pay the invoice. I read the comments above but I'm afraid I can't work it out.

> Support BillingAcct + PaymentMethod for Payment
> -----------------------------------------------
>
>                 Key: OFBIZ-93
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-93
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Improvement
>          Components: accounting
>            Reporter: Si Chen
>         Assigned To: Si Chen
>         Attachments: ofbiz-93.patch, order_billingAccount_co.patch, ss-ba.jpg
>
>
> The requirement is that a customer be able to use a billing account plus another form of payment, such as a credit card, for payment on an order.  The billing account is to be used first.
> This would require the following changes:
> 1.  In PaymentGatewayServices.java captureOrderPayments method, if the billing account has a positive balance, then first create a Payment of the EXT_BILL_ACT type, then a PaymentApplication of amountApplied = min(billing account balance, amount to capture.)  This PaymentApplication MUST have an invoiceId which is already supplied as a parameter of the service.  (Otherwise, the billing account balance will go down by the PaymentApplication.amountApplied)  If there is an amount left over to capture, then amountToCapture = amountToCapture - billingAccountBalance.  We can then loop through the OrderPaymentPreference to try to capture the remaining amount.
> 2.   In BillingAccountWorker.getBillingAccountBalance, we need to replace current code which just loops through all invoices which are not PAID or CANCELLED and adds up their unpaid balances with new code which would find all PaymentApplication for which there is a billingAccountId and add up the amountApplied.  This must be done because otherwise, once an invoice has been marked PAID, there would be no way to record that a portion of the billing account has been used to pay that invoice and hence permanently decrease its amount.
> On the mailing list we had discussed making the order of payment capture configurable.  I can't think of an easy way to do this, however, with the current data model.  I propose that for now we have PaymentGatewayServices basically capture billing account first, then other payment methods, which is a standard B2C process.  If you have a B2B customer who wants to pay with a credit card, then use the accounting module to record a Credit Card payment and apply it to the Billing Account to bring down its balance.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-93) Support BillingAcct + PaymentMethod for Payment

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-93?page=comments#action_12460440 ]
           
Jacopo Cappellato commented on OFBIZ-93:
----------------------------------------

I know this issue is becoming a mess with all these comments, but I'd like to focus the attention to a couple of points from a previous comment from Si ([19/Jul/06 12:16 PM]), namely:

"[...]
3. In captureOrderPayments, I've changed the code to check the amount of capture against the billing account net balance and run the minimum of billing account net balance and capture amount to the billing account first. The remaining is run on the credit card. Re-authorization is also changed to consider how much was charged to billing account, to avoid reauthorizing that amount.
[...]
4. In createPaymentApplication, I removed code which automatically put Invoice.billingAccountId to PaymentApplication.billingAccountId because that would have messed up billing account balance calculation per (2)."
[...]"

About #3, I think it's correct, however we should do the same also during authorization (not only during the capture process): right now if I select a CC and a BA, the whole order total amount is authorized in the CC, but only the right portion is then captured, leaving an open authorized amount (equal to the amount assigned to the BA).

About #4: a few days ago I reinserted that code (sorry Si, I did not understand that you had removed it intentionally): however I still believe that the code should stay there: in fact, as things are now the whole order is associated to the BA, and then the whole invoice is associated to the same BA and for these reasons all the payment applications associated to the invoice (order) must be associated to the BA as well.

Am I correct?


> Support BillingAcct + PaymentMethod for Payment
> -----------------------------------------------
>
>                 Key: OFBIZ-93
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-93
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Improvement
>          Components: accounting
>            Reporter: Si Chen
>         Assigned To: Si Chen
>         Attachments: ofbiz-93.patch, order_billingAccount_co.patch, ss-ba.jpg
>
>
> The requirement is that a customer be able to use a billing account plus another form of payment, such as a credit card, for payment on an order.  The billing account is to be used first.
> This would require the following changes:
> 1.  In PaymentGatewayServices.java captureOrderPayments method, if the billing account has a positive balance, then first create a Payment of the EXT_BILL_ACT type, then a PaymentApplication of amountApplied = min(billing account balance, amount to capture.)  This PaymentApplication MUST have an invoiceId which is already supplied as a parameter of the service.  (Otherwise, the billing account balance will go down by the PaymentApplication.amountApplied)  If there is an amount left over to capture, then amountToCapture = amountToCapture - billingAccountBalance.  We can then loop through the OrderPaymentPreference to try to capture the remaining amount.
> 2.   In BillingAccountWorker.getBillingAccountBalance, we need to replace current code which just loops through all invoices which are not PAID or CANCELLED and adds up their unpaid balances with new code which would find all PaymentApplication for which there is a billingAccountId and add up the amountApplied.  This must be done because otherwise, once an invoice has been marked PAID, there would be no way to record that a portion of the billing account has been used to pay that invoice and hence permanently decrease its amount.
> On the mailing list we had discussed making the order of payment capture configurable.  I can't think of an easy way to do this, however, with the current data model.  I propose that for now we have PaymentGatewayServices basically capture billing account first, then other payment methods, which is a standard B2C process.  If you have a B2B customer who wants to pay with a credit card, then use the accounting module to record a Credit Card payment and apply it to the Billing Account to bring down its balance.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
12