bulentgokdas wrote:Hi everybody, I want to consume a web service (by sending an order number as a parameter) when the order is placed. what can I do this. if possible Could you send me a complete sample ?
Thanks
When the order submitted a event fired and you can catch the event from your plugin.
public class OrderEventConsumer : IConsumer<OrderPlacedEvent>
{
private readonly IPluginFinder _pluginFinder;
private readonly IOrderService _orderService;
private readonly IStoreContext _storeContext;
public OrderEventConsumer(
IPluginFinder pluginFinder,
IOrderService orderService,
IStoreContext storeContext)
{
this._pluginFinder = pluginFinder;
this._orderService = orderService;
this._storeContext = storeContext;
}
/// <summary>
/// Handles the event.
/// </summary>
/// <param name="eventMessage">The event message.</param>
/// [HubMethodName("liveNotification")]
///
public void HandleEvent(OrderPlacedEvent eventMessage)
{
var order = eventMessage.Order;
var products = order.OrderItems;
}
}