Jump to content
Daniel Patilea

Duplicated order payment

Recommended Posts

What payment module are you using?

Hi bellini13,

 

The website is this.

For that duplicate order payment, Cash on Delivery payment method was selected.

 

Thanks

  • Like 1

Share this post


Link to post
Share on other sites

I noticed in your screen shot that the payment entries occurred at 14:33 and 14:51, that is 18 minutes apart. 

 

I assume the order was created at 14:33, but what exactly occurred at 14:51?  Did you make a change, like updating the order status?

Share this post


Link to post
Share on other sites

Yes, when order status has changed, they duplicate payment. I have the same problem after i upgrade to 1.6.1.1. It's the same with Paypal and Paymill module.

Edited by powercom (see edit history)

Share this post


Link to post
Share on other sites

Well then you likely have some override or custom module installed that is causing problems. 

 

Try disabling overrides and non-ps modules in back office advanced parameters > performance page and try again

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

I have the same problem on presta 1.6.1.4 for both cashondelivery (presta's default) and cashondeliverywithfee (custom). I remember fixing it on presta 1.5 but can't find where. Anybody found fix for that?

Share this post


Link to post
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) {
          ...
   }

Share this post


Link to post
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) {
          ...
   }

 

 

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

Share this post


Link to post
Share on other sites

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

 

Can you post your OrderHistory.php?

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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) {
          ...
   }

 

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Or am I mistaken here?

 

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.

Share this post


Link to post
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.

Share this post


Link to post
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.

 

Dont worry ;)

You did well your job, i cant feel bad about this.

Share this post


Link to post
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)

Share this post


Link to post
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

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

Share this post


Link to post
Share on other sites

Use PatBK solution, it will do the job for all payment forms

 

        // added && $order->total_paid == 0 so an allready paid order doesn't get 'paid' double or more in the stats and db entries
        if ($rest_paid > 0 && $order->total_paid == 0) {           

 

Share this post


Link to post
Share on other sites
Warning $10.25 paid instead of $10

 

Im using prestashop 1.5.6,

 

How to resolve this error.. anyone can help me..

 

In which reason this error are occured

 

Share this post


Link to post
Share on other sites

How to resolve Warning paid instead of error in my module... Im using prestashop 1.5.6 and authorize.net payment 

Share this post


Link to post
Share on other sites
Posted (edited)
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)

Share this post


Link to post
Share on other sites

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

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More