thirtybees / thirtybees

thirty bees - e-commerce that works for you
https://thirtybees.com/download
733 stars 240 forks source link

Unpaid orders are automatically paid in full when an invoice is generated #460

Open sean-mullen opened 6 years ago

sean-mullen commented 6 years ago

When an invoice is generated, the default payment amount should be 0.

Currently when an invoice is generated for an order where there are no payments, a corresponding payment is silently added to the order - making it paid in full.

A major consequence of this issue is that Bank Transfer orders are unintentionally made paid and could ship for free and would never be discovered.

There are many scenarios where real world Invoices need to be generated before orders are paid in full, so I believe the current auto-payment is unintentional and causes other problems. e.g.:

Proposed fix. Change default payment to 0:

` classes/order/Order.php (at #1651)

eschiendorfer commented 6 years ago

@sean-mullen Man you made my day! I was discussing this with Lesley some days ago. I completly agree, that it's a not a clever behaviour.

kintaro1981 commented 6 years ago

How about have a pro-forma instead?

https://www.investopedia.com/terms/p/pro-forma-invoice.asp

If for 1.0.x this can be a compatibility problem, how about just be able to store/send as a pro-forma the printable version of the order?

sean-mullen commented 6 years ago

There are simple and complex ways of fixing this behaviour. I suggested changing the default to 0 to prevent introducing compatibility issues.

I'm not sure if a proper pro-forma should reserve stock or not. If so, it might be a case of conditionally modifying the Invoice template and sending it. If not, then it is probably an entirely new feature.

The main issue in this ticket isn't one single activity. BO users i.e. employees should be able to generate a TB Invoice PDF without being forced to pay a customer's order as well

This example hopefully highlights just how much trouble this default can cause:

During a week, multiple customers place orders and promise to pay by a bank transfer. Most payments happen in the days after the order is placed. Many of the orders come to the same total and are paid on the same day. Some customers call and pay by over the phone instead. Many ignore instructions to use the order reference on the transfer. Some customers decide they cant afford their order. They don't bother to cancel

It make far more sense to assume invoices are not paid.

RaptorX commented 6 years ago

Completely agree.

My current workaround is to track payments with order tags... I ignore payment status on TB and just trust my tags.

But this could easily be avoided if as you say invoices aren't assumed to be paid in full as soon as they are generated.

firstred commented 6 years ago

Interesting. I never realized it was this big of an issue. What payment gateways do you all use? I always thought that problems like this were caused by the way payment modules validate orders and might even influence others. I guess seeing the source code will give the answers.

Thanks for all the info so far. Really helpful! We are going to get to the bottom of this.

eschiendorfer commented 6 years ago

I guess the intention of system is not too bad, but somehow it's not consequent. We have order status. They can have different "values". Like "shipped", "paid", "cancelled". I like this flexible system. Why don't we rely completly on them?

What is the sense of debatting, if an invoice is paid or not, when its genereated? It differs in country. In germany, switzerland or austria "invoice" has a different meaning... Let just the order status tell, if an order has been paid.

Edit: As with @RaptorX we do manually track the payments. They come in by classical bank transfer...

RaptorX commented 6 years ago

I live in Dominican Republic, so I am limited by the payment gateways I can use, so I end up doing a lot of manual work.

In my case I manually track payments to local banks none of them supported by us payment gateways.

sean-mullen commented 6 years ago

Default install

  1. Bank wire payment. Status: Awaiting Pay wire payment ✓ Payments: none ✓ screen shot 2018-02-03 at 5 19 59 am

  2. Generate Invoice. PDF created ✓ as expected screen shot 2018-02-03 at 5 20 19 am

  3. Result: Order Status ✓. Payments incorrect ✘ Invoice incorrect ✘ screen shot 2018-02-03 at 5 20 33 am

firstred commented 6 years ago

I think I've finally come across this issue today. Have you tested the behavior with previous versions of the bankwire module as well? It seems to be caused by newer versions, but I am not sure.

sean-mullen commented 6 years ago

@firstred I think you are right. I didn't notice this issue because I was using an older version of the bank wire module, which I had cloned and customised to Australian bank transfers.

I'm working on setting up trade/credit accounts so I'm not keen on the assumption all invoices are paid...