Orders - Payment status

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 years ago
Hi friends!

I'm working in a store based on nopCommerce 3.70 and I need to send a copy of an order to a Company's server but ONLY when the order payment status is PAID

Well... I'm trying with some test payment methods like sandbox paypal but always the order's status is PENDING and payment status is also PENDING

In wich class and method the order change status to PAID?

Thank u so much
7 years ago
I found that UpdateOrder method is called many times... At some point this method recive the Order parameter with PAID status?
7 years ago
Andres420 wrote:
I found that UpdateOrder method is called many times... At some point this method recive the Order parameter with PAID status?


The order status is changed in the payment plugin, in the method:

ProcessPayment() or PostProcessPayment() - it depends how the plugin is coded. Tipically if the plugin redirects the user to the payment gateway site, then the PostProcessPayment() is used. If the payment is done on the shop's website, the ProcessPayment() is used.

The difference between these two methods is that in PostProcessPayment(), the order is already inserted in the database, in the ProcessPayment(), the order is not yet inserted in the database. So you do not have the OrderId, for example, only the OrderGuid. Also in the ProcessPayment() you do not have access to all the order details, so probably for your case, it's best to use PostProcessPayment().

Check this link for more details on the payment plugin's methods: http://docs.nopcommerce.com/display/nc/How+to+code+my+own+payment+method
7 years ago
In your ProcessPayment() and / or PostProcessPayment() method, you need to set NewPaymentStatus = PaymentStatus.Paid
7 years ago
wooncherk wrote:
In your ProcessPayment() and / or PostProcessPayment() method, you need to set NewPaymentStatus = PaymentStatus.Paid


Thank u guys!

I code my payment method plugin based on PayPalStandard plugin... In ProcessPayment() newPaymentStatus is set to Pending and in PostProcessPayment() just get order info and build the url to redirect user to payment page but newPaymentStatus is not set to any value.

In any case I agree payment status PAID must be set in paymentPlugin but if I've to send any PAID order to a company's server I don't thing I need to code order sending in any payment plugin... That's why I'm asking if updateOrder() -> Order parameter at some point it´s payment status is set to PAID so I can send the order if this condition is true... I'm thinking something like this:

public override void UpdateOrder(Order order)
{

    if (order.PaymentStatus == PaymentStatus.Paid;)
    {
        SendOrderToMyServer(order);        
    }

          
    base.UpdateOrder(order);

}
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.