Place 3rd party order

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 years ago
Much of what I sell needs to be sent to a 3rd part fulfillment company.  So - once the user commits the purchase, I'll need to make API calls.  What is the best way to structure that and where should I hook it in?  Should I create an IMiscPlugin?  Should I create a task in the scheduler?  Finding problems real-time would be nice but I'm not sure how responsive the 3rd party will be.  I'd like to keep this as non-invasive as possible (to make future upgrades easier).  Thoughts?
7 years ago
I would suggest an IMisc plugin, that will basically be an EventHandler for the OrderPaid event. I have implemented such an event handler in the past - quite easily.

You class just has to implement IConsumer<OrderPaidEvent>, and that's it - you can do whatever you want, from there on.

You can also create your own SQL Tables, using the same Misc plugin, and log the failed API calls (you mentioned it may not be responsive at all times), and then you can add a Scheduled task (in the same Misc plugin), where you can implement the retry functionality.


Regards
7 years ago
Very awesome.  Just what I needed.  Thanks!!
7 years ago
I'd recommend that you use that OrderPaidEvent just to queue up the message and then handle it asynchronously in a scheduled task.  There's no point blocking waiting for an API call (that might timeout), and also not having to replicate the sending code.  See the QueuedEmailService.cs for ideas.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.