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 |
[ 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 |
In reply to this post by Nicolas Malin (Jira)
[ 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 |
In reply to this post by Nicolas Malin (Jira)
[ 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 |
In reply to this post by Nicolas Malin (Jira)
[ 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 |
In reply to this post by Nicolas Malin (Jira)
[ 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 |
In reply to this post by Nicolas Malin (Jira)
[ 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 |
In reply to this post by Nicolas Malin (Jira)
[ 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 |
In reply to this post by Nicolas Malin (Jira)
[ 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 |
In reply to this post by Nicolas Malin (Jira)
[ 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 |
In reply to this post by Nicolas Malin (Jira)
[ 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 |
In reply to this post by Nicolas Malin (Jira)
[ 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 |
In reply to this post by Nicolas Malin (Jira)
[ 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 |
In reply to this post by Nicolas Malin (Jira)
[ 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 |
In reply to this post by Nicolas Malin (Jira)
[ 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 |
In reply to this post by Nicolas Malin (Jira)
[ 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 |
In reply to this post by Nicolas Malin (Jira)
[ 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 |
In reply to this post by Nicolas Malin (Jira)
[ 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 |
In reply to this post by Nicolas Malin (Jira)
[ 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 |
In reply to this post by Nicolas Malin (Jira)
[ 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 |
Free forum by Nabble | Edit this page |