shipping rate

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
3 года назад
I also use external service "aramex" I am tring webhook but not working.

Thank you.
3 года назад
I don't know how Aramex works, but getting shipping methods/rates is different from setting up a shipment.  If they have an API to create a shipment, you would call that API after you create the shipment nopCommerce, so you could still do it in the Order Paid handler.
3 года назад
Ok, what is the different between webhook and orderpaid ?
Thank you.
3 года назад
Webhooks are "HTTP callbacks".  The allow external systems to call a method in your system/code.
The OrderPaidEvent is one of many events that are 'published' by nopCommerce code so that developers can 'handle' them.
3 года назад
Thank you, You are very helpful.

    public class EventConsumer : IConsumer<OrderPaidEvent>
    {
        public void HandleEvent(OrderPaidEvent eventMessage)
        {
            if (eventMessage.Order.PaymentStatus == PaymentStatus.Paid)
            {
                Debug.Write("Payment Status= Paid");
            }
            else
            {
                Debug.Write("Payment Status= Pending");
            }

        }
    }

I develop this code in shipment plugin, I assume it will run after payment provider page  redirect to my website in the last step "Complete Order", I update order Payment Status to paid if it is success in payment plugin and it is success but "EventConsumer " never invoke.
Thank you.
3 года назад
Test your handling of OrderPaidEvent by using a payment provider like CheckMoneyOrder, and then after order is confirmed, as an admin, mark the order as paid.
3 года назад
Thank you,

       //This not invoke the HandleEvent(OrderPaidEvent eventMessage)
        private readonly IOrderService _orderService;
        order.PaymentStatus = PaymentStatus.Paid;
       _orderService.UpdateOrder(order);

      //This invoke the HandleEvent(OrderPaidEvent eventMessage)
        private readonly IOrderProcessingService _orderProcessingService;
       _orderProcessingService.MarkOrderAsPaid(order);

Can I know why and what different ?
3 года назад
Because MarkOrderAsPaid calls ProcessOrderPaid which raises the event:
...
            //raise event
            _eventPublisher.Publish(new OrderPaidEvent(order));
3 года назад
Thank you very much your replies are very helpful.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.