Order is placed before payment

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 anos atrás
Hello...

I am implementing a site in nopCommerce 1.50 and I found that the order is actually placed before the payment.

Debugging, I found that OrderManager.PlaceOrder is called before PaymentManager.PostProcessPayment. PlaceOrder method, besides storing the order in database, sends e-mail notifications and clears the shopping cart.

When the payment processor calls a gateway (for example, PayPal), it is called from PostProcessPayment, so the notifications and the shopping cart clear should be carried out after it, when the payment was successful.

Any comment about this?

Thanks
Jaime
13 anos atrás
I face the same problem too. I mean... shouldn't payment be made before the order is confirm? Anyone to advise?
13 anos atrás
Hello... I simply commented the lines that clears the shopping cart.

So the process is: before payment, the order is saved in Pending status, then the gateway is called, the payment is carried out, the return page is called if successful. Finally, the shopping cart is cleared, the order changes status to Processing and Paid, and the notifications are sent.

Cheers
Jaime
13 anos atrás
Can you tell us in wich file did you comment this.

Thank you very much
13 anos atrás
Any chance you could share the information, which lines did you comment out to enabel this
13 anos atrás
In OrderManager.cs file... the original lines 2827 - 2830 are:


ShoppingCartManager.DeleteShoppingCartItem(sc.ShoppingCartItemID, false);

//inventory
ProductManager.AdjustInventory(sc.ProductVariantID, true, sc.Quantity, sc.AttributesXML);


I changed them by:


// Si el pago está pendiente, no se debe eliminar el carro ni tampoco se debe
// descontar inventario.
// Ese hecho sólo debe ocurrir cuando la orden esté PAGADA
if (processPaymentResult.PaymentStatus == PaymentStatusEnum.Paid)
{
      ShoppingCartManager.DeleteShoppingCartItem(sc.ShoppingCartItemID, false);

      //inventory
      ProductManager.AdjustInventory(sc.ProductVariantID, true, sc.Quantity, sc.AttributesXML);
}


Cheers
Jaime
13 anos atrás
Removed...
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.