You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Si Chen (JIRA)" <ji...@apache.org> on 2006/07/17 23:49:14 UTC

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

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


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

        

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

Posted by "Si Chen (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/OFBIZ-93?page=all ]

Si Chen reassigned OFBIZ-93:
----------------------------

    Assignee: Si Chen

> 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

        

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

Posted by "Si Chen (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/OFBIZ-93?page=comments#action_12457902 ] 
            
Si Chen commented on OFBIZ-93:
------------------------------

Jacopo,

I think it might be nice to move billingAccountId to OrderPaymentPreference so multiple billing accounts can be used on an order.  This is not that necessary for b2b billing accounts but might be good for store credit billing accounts.  I believe David had some issues/concerns about this, so let's wait to hear from him.

Regarding moving billingAccountId from PaymentApplication to Payment, it's a big re-factoring and I'm not so sure it is necessarily worth the amount of work.  It might be nice to add billingAccountId to Payment so that it is consistent with orders, etc., but then we lose the flexibility of having multiple billing accounts on the same order.

We might want to think also about whether billing account can be factored into FinAccount, so that it becomes a special type of FinAccount along with Gift Cards.  One of the advantages here is that we could really unify the code, and the concept of "authorization" could be much more explicit, instead of being implicitly done by having orders in a certain state associated with a billingAccountId.

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
>
>
> 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

        

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

Posted by "Jacopo Cappellato (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/OFBIZ-93?page=comments#action_12457366 ] 
            
Jacopo Cappellato commented on OFBIZ-93:
----------------------------------------

Si, Leon,

I'm doing some tests but I'm a bit confused about how this stuff is supposed to work.
For example, I've created a return of type "store credit" and a billing account has been automatically created, an invoice of type "Customer Return" has been created (from the customer to the Company) and a payment has been created to refund the credit (from the Company to the client); however two PaymentApplications entries has been created and associated to the billing account: one with a null invoiceId and one with the invoiceId set.
Is this correct?
The problem I see is that the net balance of the billing account is 0 and so and this makes me think that there is no credit in the billing account that the customer can use for future sales orders.
Am I missing something?


> 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

        

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

Posted by "Si Chen (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/OFBIZ-93?page=comments#action_12421896 ] 
            
Si Chen commented on OFBIZ-93:
------------------------------

Scott,

That already is supported in the checkout in the order manager.  Just click on a billing account plus a credit card.

The question of how the system should handle the actual splitting of payments between two such payment methods is what this issue is about.

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
>
> 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

        

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

Posted by "Jacopo Cappellato (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/OFBIZ-93?page=comments#action_12457609 ] 
            
Jacopo Cappellato commented on OFBIZ-93:
----------------------------------------

Si, all,

in rev 486051 I've committed a change that should fix the BillingAccountWorker.getBillingAccountNetBalance method.
I've not refactored the code using the PaymentApplicationWithDetails entity (as you had suggested) in order to minimize the modifications I did make as clearer as possible the change I did; another reason is that I think there are other things we should fix in this area that I would like to discuss with you all (in my next comment) and so there will be soon other chances to optimize the code.



> 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

        

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

Posted by "Si Chen (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/OFBIZ-93?page=comments#action_12457497 ] 
            
Si Chen commented on OFBIZ-93:
------------------------------

That should be the invoiceId which is an IN parameter of captureOrderPayments.  When captureBillingAccountPayment is run, invoiceId is passed in.

> 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

        

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

Posted by "Si Chen (JIRA)" <ji...@apache.org>.
    [ 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

        

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

Posted by "Jacques Le Roux (JIRA)" <ji...@apache.org>.
    [ 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

        

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

Posted by "Jacopo Cappellato (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/OFBIZ-93?page=comments#action_12455604 ] 
            
Jacopo Cappellato commented on OFBIZ-93:
----------------------------------------

Si,

what is the current status of this issue? I will need soon the ability of selecting a billing account together with another payment option and I'm wondering if this is already correctly handled by the system or if I have to apply the patch attached to this issue.

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
>
>
> 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

        

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

Posted by "Leon Torres (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/OFBIZ-93?page=comments#action_12455725 ] 
            
Leon Torres commented on OFBIZ-93:
----------------------------------

Sorry, I meant the re-authorization step of #3.  Was the line 

totalAmountCaptured = totalAmountCaptured.add(billingAccountCaptureAmount).setScale(decimals, rounding); 

left out for a reason?

> 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

        

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

Posted by "Si Chen (JIRA)" <ji...@apache.org>.
    [ 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

        

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

Posted by "Si Chen (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/OFBIZ-93?page=all ]

Si Chen updated OFBIZ-93:
-------------------------

    Attachment: ofbiz-93.patch

Ok.  I've worked through this and fixed BillingAccount so that it could be split with another payment method on orders and invoices.  I'm posting a patch of what I did so everybody could look through it, as some of these are pretty fundamental changes.  While I feel that they are justified, it'd be nice to get your opinion on this.

Here's a brief rundown of what has been done:

1.  There are now two calculations of billing account balance.  I've created a new "net balance" method which just includes the amounts of settled invoices and payments.  The old "getBillingAccountBalance" method returns net balance minus the amount of outstanding orders.  The reason I did this is so that we can track what has actually been charged ("net balance") versus what can be used for future orders (the old balance method.)  This is analogous to a different balance for the "capture" and the "authorize" services for a credit card.

2.  The balance of a billing account is now calculated as exclusively based on the amountApplied field of PaymentApplication.  I am no longer going back to Invoice to get the total unapplied amount of invoices, because there is no way to record explicitly how much was applied to a BillingAccount vs another payment method that way.  The net balance of a billing account is the sum of all PaymentApplications with an invoiceId (which increase the billing account balance) minus the sum of all PaymentApplications without an invoiceId (which decrease the billing account balance.)  This is similar to how it was done before.

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).  Also there was a minilang compare which had to be typecast to Double.

Please take a look and let me know if you have any feedback.  This seems to work for me after some reasonable amount of testing.

> 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
>         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

        

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

Posted by "Jacopo Cappellato (JIRA)" <ji...@apache.org>.
     [ 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

        

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

Posted by "Si Chen (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/OFBIZ-93?page=comments#action_12421734 ] 
            
Si Chen commented on OFBIZ-93:
------------------------------

One other thought: we need to split BillingAccountworker.getBillingAccountBalance to distinguish between net versus available balance.  Net balance is the actual amount charged, which should be sum of invoices' amountApplied minus sum of payments' amountApplied.  This is the amount which should be used when capturing payments.  Available balance should then be net balance plus sum of order amounts and can be used to decide whether more orders can be placed with this billing account.

> 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
>
> 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

        

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

Posted by "Jacopo Cappellato (JIRA)" <ji...@apache.org>.
    [ 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

        

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

Posted by "Jacopo Cappellato (JIRA)" <ji...@apache.org>.
    [ 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

        

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

Posted by "Scott Gray (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/OFBIZ-93?page=comments#action_12421804 ] 
            
Scott Gray commented on OFBIZ-93:
---------------------------------

Hi Si

Without knowing too much about how this works at the moment, couldn't we add a 'split payment methods' screen to the checkout process?  That way the customer could go to the screen, select a payment method and amount, click add payment and it then gets added to a list of payments.  They can then just keep going until balance left to pay is zero.

This could cover a much larger number of possible scenarios, and gives the customer full control.  Perhaps once the basics are in svn it could then be customized to fit your situation?

Just a thought
Scott

> 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
>
> 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

        

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

Posted by "Leon Torres (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/OFBIZ-93?page=comments#action_12421735 ] 
            
Leon Torres commented on OFBIZ-93:
----------------------------------

Can't we distinguish between B2B and B2C using a BillingAccountType?  These are clearly two different kinds of accounts, so we should be able to modify the business logic by the type of account.

> 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
>
> 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

        

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

Posted by "Jacopo Cappellato (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/OFBIZ-93?page=comments#action_12457611 ] 
            
Jacopo Cappellato commented on OFBIZ-93:
----------------------------------------

I've noticed that there are still some problems when you select a billing account as a payment option during order checkout, I'll try to fix them or at least report them in another issue soon.
However, I think that there is something we should really try to improve: I think we should move the billingAccountId field from the OrderHeader to the OrderPaymentApplication entity. In fact, if you select two different payment options for an order, in my opinion having the billing account set in the OrderHeader doesn't make sense.
What do you think about this?



> 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

        

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

Posted by "Leon Torres (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/OFBIZ-93?page=comments#action_12455724 ] 
            
Leon Torres commented on OFBIZ-93:
----------------------------------

It looks like everything's been committed except for one line in PaymentGatewayServices.java:

@@ -951,10 +994,13 @@
                 }
 
                 // create any splits which are needed
-                if (authAmount.doubleValue() > amountThisCapture) {
+                // we need to add up the amount that has been captured from both credit card and the billing account
+                BigDecimal totalAmountCaptured = new BigDecimal(amountThisCapture);
+                totalAmountCaptured = totalAmountCaptured.add(billingAccountCaptureAmount).setScale(decimals, rounding);
+                if (authAmount.doubleValue() > totalAmountCaptured.doubleValue()) {

The line where billingAccountCaptureAmount is added to totalAmountCaptured  is missing in SVN Ofbiz (the other lines are there).  Hence, I don't know if #4 on Si's most recent list is working correctly from initial inspection.

- Leon

> 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

        

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

Posted by "Jacopo Cappellato (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/OFBIZ-93?page=comments#action_12457698 ] 
            
Jacopo Cappellato commented on OFBIZ-93:
----------------------------------------

Please ignore my previous comment.
I think that the bast way to go is this (from a message I sent today to the dev list):

Right now the billingAccountId is stored in the OrderHeader, then propagated to the Invoice header and finally (with my last patch) to the PaymentApplications applied to the invoice.
However, in my opinion we can remove the billingAccountId field from the PaymentApplication entity because it is superfluous. We should instead add it to the Payment entity, in order to implement the ability to accept payments and associate them to a  billing account (before the invoices are created, for example).
Right now, if we need to store a payment before the invoice is created and we want to associate it to a billing account we do the following:
1) we create a Payment
2) we create a PaymentApplication (for the same amount) and associate it to the billing account
In my opinion this is not completely correct, because we are not really applying a payment to something real like an invoice (we just need to associate it to the billing account); in fact, for example, the same payment could be used later to pay two different invoives associated to the billing account and so the original PaymentApplication entry would be wrong.

To summarize, here is what I propose:

a) remove the field PaymentApplication.billingAccountId
b) add the field Payment.billingAccountId
c) add the following constraint: a payment and an invoice associated to two different billing accounts cannot be matched; the application of a payment with null billingAccountId to an invoice associated to a billing account is ok
d) in the balance of a billing account we should simply consider:
d1) all the open amount of the invoices associated to the billing account (-)
d2) the unapplied amount of all the payments associated to the billing account



> 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

        

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

Posted by "Jacopo Cappellato (JIRA)" <ji...@apache.org>.
     [ 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

        

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

Posted by "Si Chen (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/OFBIZ-93?page=all ]

Si Chen resolved OFBIZ-93.
--------------------------

    Resolution: Fixed

> 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

        

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

Posted by "Jacopo Cappellato (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/OFBIZ-93?page=comments#action_12457496 ] 
            
Jacopo Cappellato commented on OFBIZ-93:
----------------------------------------

Si,

thanks, this makes sense.
Another thing I don't understand is when you say, in the item #1 of this issue: 

"This PaymentApplication MUST have an invoiceId which is already supplied as a parameter of the service."

How can we provide an invoiceId when we are still creating the order? Are you referring to another invoice?

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

        

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

Posted by "Si Chen (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/OFBIZ-93?page=comments#action_12457474 ] 
            
Si Chen commented on OFBIZ-93:
------------------------------

Jacopo,

I think you may have found a bug!

The idea of billing accounts is that PaymentApplications with paymentId and no invoiceId increase the value of the billing account, where as paymentapplications with invoiceId and paymentId decrease its value.

However, I think that now that we have the "Customer return invoice", this model may need to be a bit more sophisticated, so that we need to say "PaymentApplication with paymentId and invoiceId where the invoice is a SALES_INVOICE" decreases its value, so the PaymentApplication to the customer return invoice would not cause its value to be consumed incorrectly.

Fortunately, this should be pretty easy to fix.  In the BillingAccountWorker.getBillingAccountNetBalance method, instead of just searching on PaymentApplication, we should use a PaymentApplicationWithDetails view-entity which would join PaymentApplication with Invoice, Payment, PaymentType, InvoiceType.

> 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

        

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

Posted by "Si Chen (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/OFBIZ-93?page=comments#action_12455732 ] 
            
Si Chen commented on OFBIZ-93:
------------------------------

Looks like it should be committed.  I'm not sure why.  Try it and let me know if there are any problems.

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
>
>
> 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

        

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

Posted by "Si Chen (JIRA)" <ji...@apache.org>.
    [ 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

        

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

Posted by "Iain Fogg (JIRA)" <ji...@apache.org>.
    [ 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

        

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

Posted by "Jacopo Cappellato (JIRA)" <ji...@apache.org>.
    [ 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