From the UI is absolutely fine, no issues there.
From the API not quite as good.
Say there are 500 orders, 1 call to the endpoint get/orders gets all the information needed except refunds. It then requires 500 more API calls to see if there are any refunds associated with any particular order.
What I am suggesting is that a flag is set in the order when a refund is made against that order.
So, (bad pseudocode follows!):
Refund is made on order 453.
Flag 'has_refund' set to true on order 453.
Sometime later.....
List all orders (get/orders)
foreach order
Any refunds been made?
If true: make an API call to retrieve the refund.
As I assume most orders will not have refunds (in our case it would probably be around 0.5 - 1 per cent), the number of additional API calls is dramatically reduced.
As an afterthought I guess the other way of streamlining this would be to have a get/refunds endpoint (I can't see one in the docs) which could possibly be even better. 1 call to get the orders, 1 call to get the refunds and your own code to do the heavy lifting.
Or both. :)
Dennis
WordPress ...
ما را در سایت WordPress دنبال می کنید
برچسب : نویسنده : استخدام کار wpss بازدید : 200 تاريخ : چهارشنبه 29 ارديبهشت 1395 ساعت: 20:26