Jump to content

Duplicated order payment


Recommended Posts

Ok, effectively, when i use the Invoices function, i don't have the duplicate entry for the payments.

 

But now :  delivery PDF and Invoice PDF are available as "documents" but not the icons, i don't have Delivery Icon, but i have the delivery document... Strange...

Link to comment
Share on other sites

Thanks, but i can't disable Non Ps modules, i need them !

 

I read in another post that there is a problem when we disable the "Invoices".

 

I started to use invoices, to see, i will say you the result.

well you can to perform a test and see if one of those things are causing your issue.  It's called troubleshooting and ruling things out

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

I have the same issue with duplicate payment records. I have applied this fix: http://forge.prestashop.com/browse/PSCSX-6831 but it does not make any difference.

The issue comes on CashOnDelivery in my tests, immediately after the order confirmation. Actually, one payment record is with the confirmation moment, the other is with the moment the system finish the confirmation: the difference is about 40s. PS. version: 1.6.1.1

Any clue?

 

Thanks!

Link to comment
Share on other sites

  • 1 month later...

In my case after upgrade from 1.6.0.9 to 1.6.1.1 it only duplicated when the payment method used caused default order status “1-payment accepted” to resolve edit the offending order status in question and remove the tick from “Set the order as paid.”  for me it resolved the issue

 

Link to comment
Share on other sites

  • 3 months later...

In my case after upgrade from 1.6.0.9 to 1.6.1.1 it only duplicated when the payment method used caused default order status “1-payment accepted” to resolve edit the offending order status in question and remove the tick from “Set the order as paid.”  for me it resolved the issue

 

I had same problem and found out same solution as climia also suggested, so to solve the duplicated payment issue (for me it was with paypal module), but then another issue arised: in delivery slip now there is no total paid and empty selected payment, so i have to cut off half of the delivery slip when i print it for the carrier.

 

PS 1.6.1.4 - default theme only graphics mod.

 

@climia ... did you also got this problem? if so did you find any solution?

 

tks to all for suggestions

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

A work arround for this is to uncheck the "set the order as paid" option in all the order statuses.

If you wanna fix this in the code, you need to remove the last part of the changeIdORderState funcion in the OrderHistory class.

 

// set orders as paid
   if ($new_os->paid == 1) {
          ...
   }
Link to comment
Share on other sites

  • 3 weeks later...

 

A work arround for this is to uncheck the "set the order as paid" option in all the order statuses.

If you wanna fix this in the code, you need to remove the last part of the changeIdORderState funcion in the OrderHistory class.

 

// set orders as paid
   if ($new_os->paid == 1) {
          ...
   }

 

 

Changing the class file did not work, makes all orders throw a server 500 error when validating order from customer end.

Link to comment
Share on other sites

My solution. I had got duplicate payment for Paypall, Alipay and Weixin. Problem is that you have to generate Delivery Note at least one status before you set order as Paid.

Sample of statuses sequence:

PAYMENT RECEIVED - order cannot be set as paid (no delivery note no invoice). So you delivery note to be gererated in the next status.

ORDER ACCEPTED - order still cannot be set as paid - generate Delivery Note.

ORDER PROCESSING - because pdf i generated in previous order you can set order as paid.

 

This works for me in 1613

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

This issue happens in 1.6.1.5 too and to me the code fix seems a poor one as it shouldn't disable setting an order paid, it should check if payment was received and only insert in to the DB if payment wasn't received yet.

 

The option to set paid is a way to not have to select paid manually first before setting another status. Or am I mistaken here?

 

 

 

A work arround for this is to uncheck the "set the order as paid" option in all the order statuses.

If you wanna fix this in the code, you need to remove the last part of the changeIdORderState funcion in the OrderHistory class.

 

// set orders as paid
   if ($new_os->paid == 1) {
          ...
   }

 

Link to comment
Share on other sites

 

A work arround for this is to uncheck the "set the order as paid" option in all the order statuses.

If you wanna fix this in the code, you need to remove the last part of the changeIdORderState funcion in the OrderHistory class.

 

// set orders as paid
   if ($new_os->paid == 1) {
          ...
   }

 

 

Shouldn't it be something like....

 

       // set orders as paid

        if ($new_os->paid == 1) {
            $invoices = $order->getInvoicesCollection();
            if ($order->total_paid != 0) {
                $payment_method = Module::getInstanceByName($order->module);
            }
 
            foreach ($invoices as $invoice) {
                /** @var OrderInvoice $invoice */
                $rest_paid = $invoice->getRestPaid();
                if ($rest_paid > 0 && $order->total_paid == 0) { 
// added && $order->total_paid == 0 so an allready paid order doesn't get 'paid' double or more in the stats and db entries
                    $payment = new OrderPayment();
                    $payment->order_reference = Tools::substr($order->reference, 0, 9);
                    $payment->id_currency = $order->id_currency;
                    $payment->amount = $rest_paid;
 
                    if ($order->total_paid != 0) {
                        $payment->payment_method = $payment_method->displayName;
                    } else {
                        $payment->payment_method = null;
                    }
 
                    // Update total_paid_real value for backward compatibility reasons
                    if ($payment->id_currency == $order->id_currency) {
                        $order->total_paid_real += $payment->amount;
                    } else {
                        $order->total_paid_real += Tools::ps_round(Tools::convertPrice($payment->amount, $payment->id_currency, false), 2);
                    }
                    $order->save();
 
                    $payment->conversion_rate = 1;
                    $payment->save();
                    Db::getInstance()->execute('
INSERT INTO `'._DB_PREFIX_.'order_invoice_payment` (`id_order_invoice`, `id_order_payment`, `id_order`)
VALUES('.(int)$invoice->id.', '.(int)$payment->id.', '.(int)$order->id.')');
                }
            }
        }
  • Like 1
Link to comment
Share on other sites

I hope you don't feel I was criticizing you or worse.

 

It was my question and following a suggestion for a fix.

 

You're completely right. I just pointed where the problem was and the place to fix it, the code that I posted don't pretend to be a solution.

Link to comment
Share on other sites

The issue was with the order status change settings. When in there, in the status, an order is set paid, a new payment entry is made.

 

The way to fix this is to disable payment set in the order change line.

Yp4zrv.png

 

RjkNnx.png

 

 

 

It's the 'zet bestelling op betaling ontvangen' line which needs to be unchecked.

 

Hi, you have solved this problem?, I also have the same problem with PayPal

 

thanks

Edited by PatBK (see edit history)
Link to comment
Share on other sites

  • 3 months later...

My solution. I had got duplicate payment for Paypall, Alipay and Weixin. Problem is that you have to generate Delivery Note at least one status before you set order as Paid.

Sample of statuses sequence:

PAYMENT RECEIVED - order cannot be set as paid (no delivery note no invoice). So you delivery note to be gererated in the next status.

ORDER ACCEPTED - order still cannot be set as paid - generate Delivery Note.

ORDER PROCESSING - because pdf i generated in previous order you can set order as paid.

 

This works for me in 1613

I still have the problem with PayPal. I removed "set as paid" from all the statuses, I generate the Delivery Slip in both the "Payment accepted" ones (normal and paypal), then in "Shipped" i set it as paid but it still duplicates the payment. Everything else works fine, it's just PayPal. PS 1.6.1.6

Link to comment
Share on other sites

  • 2 months later...
  • 3 years later...
On 2/27/2016 at 1:22 AM, ariom said:

 

I had same problem and found out same solution as climia also suggested, so to solve the duplicated payment issue (for me it was with paypal module), but then another issue arised: in delivery slip now there is no total paid and empty selected payment, so i have to cut off half of the delivery slip when i print it for the carrier.

 

PS 1.6.1.4 - default theme only graphics mod.

 

@climia ... did you also got this problem? if so did you find any solution?

 

tks to all for suggestions


The solution for 1.7, although it should work on 1.6 as well:

Edit:
 

/classes/pdf/HTMLTemplateDeliverySlip.php

Assign this variable to smarty (aprox line 130):

'order_payments' => $this->order->getOrderPayments(),

 

Then edit this file:

pdf/delivery-slip.payment-tab.tpl

Change:

{foreach from=$order_invoice->getOrderPaymentCollection() item=payment}


To:

{foreach from=$order_payments item=payment}


Notice that we are getting payments directly from order and not from invoice. This is the solution specially if you have invoices disabled in prestashop.

And to prevent payment duplication,  Just keep "set as paid" only on the statuses that require it.

Edited by Mercader Virtual (see edit history)
Link to comment
Share on other sites

  • 1 month later...

I'm having the same problems on 1.7.6

To me it's with prestashop checkout module with paypal

Seems that is related to if you have one more than one carrier for the order, it will split your orders.

The weird thing is, that I use the same carrier name for all carriers, this is in order to bypass prestashop limitations of shipping price per category.

Anyhow, what happens is that the user receives an invoice only for part of the order, while he paid in full and gets a paypal invoice for paying in full.

After you manually accept the second order as payment approved then he will get the second invoice with the total minus the first order.

some VERRRRYYY WEIRD and BAD stuff here..

And i do get the same warning. it takes the total of the whole order, and then adds the total of the splitted item (the one that prestashop split because of different carriers).

"Warning $92.50 paid instead of $69.65" (which is totally incorrect)

 

I see the github issues of this run even before 2016 and still not fixed. basic functionality for ecommerce.

This is dangerous, i have no idea who developed it like that, to me this is a very strong bright warning sign that i might need to switch to a different e-commerce solution

Although i really wish i wouldn't need as recreating everything takes time.

  • Confused 1
Link to comment
Share on other sites

  • 2 months later...

Just signed up to share my solution to the community. Perhaps it saves someone time.

I had the same problem and i tried different combinations. It turned out that i needed to have invoice activated on "payment accepted" otherwise it would duplicate because it was missing.
I have set as payed on 2,3 and 4. Not sure if its correct but it seem to work 😎
statusescorrect.jpg.35c07bbc43a4716c53025db680b89c87.jpg

Link to comment
Share on other sites

  • 4 months later...

Hi
Same problem on PS 1.7.6.

Unfortunatelly above solutions/workarounds won`t work for me. I have a problem though with just unticking "set order as paid" for all statuses before delivery slip is created, because I sell some virtual products. If the status of the the order (i.e. Payment accepted) is not set as paid, the customer will not receive the automated email with the download link for their purchase.  I need that to happen automatically as soon as order is accepted.

On some payment methods the module (Saferpay) will go through 3 order statuses within a couple seconds. From "awaiting payment", to "payment authorized", to "payment accepted". For all three of them it creates a "payment" and therefore obviously shows" Warning CHFxxx paid instead of CHFxxx".
Eventhough for "awaiting payment" the status is not set as "set the order as paid" is still creates a payment. 

 Oh and to make things more interesting 🙂 -> I use the delivery slip as a picking list, so this needs to be created right from the start. My first order status in hierarchy creates a delivery slip and also is regarded as paid.
And one more thing to top it off: my main payment module will always go to "awaiting payment" and then "payment authorized" automatically (if the payment is successfull of course), but only goes to "payment accepted" automatically if the customer used a creditcard (3D-Secure checked). If the customer used a debit card or our other main swiss payment method (Twint), I will need to capture the payment manually first. Only after that the status changes to "payment accepted".  So at the very minimum I will have those 2 statuses set to "set as paid".

Is there any other solution to this problem?

Help much appreciated 🙂

Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...