An article on how I can query all the orders for yesterday without using the eBay GUI Selling website. I've included the code to parse out the information as well.
Why?
Because I need this function too often either for debugging/monitoring purposes but it's easier to use an access token then getting the OAuth access codes from the client.
How?
I'm going to split this into 2 code snippets that were in practice added to the same function and that worked at time of print. Note that this uses the old Trading API as the new API is only available in Sandbox??? I won't go into how to generate an Access Token to your client's eBay store as that's covered in my article: Zoho Creator: Push to eBay Listings.
Getting the Orders in XML format:
/* Function: fn_eBay_GetOrders() Purpose: Queries eBay for all orders given a from and till date Date Created: 2023-02-28 (Joel Lipman) - Initial release Date Modified: ???? - ??? More Info: - API Explorer Test Tool: https://developer.ebay.com/DevZone/build-test/test-tool/default.aspx?index=0&env=production&api=trading - GetMyeBaySelling Documentation: https://developer.ebay.com/devzone/xml/docs/reference/ebay/getmyebayselling.html - GetOrders using Trading API: https://developer.ebay.com/Devzone/XML/docs/Reference/eBay/GetOrders.html - Get Access Token: https://www.joellipman.com/articles/crm/zoho/zoho-creator-push-to-ebay-listings.html */ // // evaluate (specify here your dates [time set to midnight]) v_timeFrom = zoho.currenttime.subDay(0).toString("yyyy-MM-dd'T'00:00:00.000'Z'"); v_timeTill = zoho.currenttime.addDay(1).toString("yyyy-MM-dd'T'00:00:00.000'Z'"); // // get access token (you will need your own function here as documented in my article v_AccessToken = standalone.fn_eBay_GetAccessToken(); // v_TradingAPIVersion = 967; v_Endpoint = "https://api.ebay.com/ws/api.dll"; // // build header m_Headers = Map(); m_Headers.put("X-EBAY-API-SITEID",3); m_Headers.put("X-EBAY-API-COMPATIBILITY-LEVEL",v_TradingAPIVersion); v_ApiCall = "GetOrders"; m_Headers.put("X-EBAY-API-CALL-NAME",v_ApiCall); m_Headers.put("X-EBAY-API-IAF-TOKEN",v_AccessToken); // // build params m_Params = Map(); m_Params.put("WarningLevel","High"); m_Params.put("ErrorLanguage","en_GB"); m_Params.put("DetailLevel","ReturnAll"); // // send order filters m_Params.put("CreateTimeFrom",v_timeFrom); m_Params.put("CreateTimeTo",v_timeTill); m_Params.put("OrderRole","Seller"); // // convert to xml and replace root nodes x_Params = m_Params.toXML(); x_Params = x_Params.toString().replaceFirst("<root>","<?xml version=\"1.0\" encoding=\"utf-8\"?><" + v_ApiCall + "Request xmlns=\"urn:ebay:apis:eBLBaseComponents\">"); x_Params = x_Params.toString().replaceFirst("</root>","</" + v_ApiCall + "Request>"); // // send the request XML as a string x_ResponseBody = invokeurl [ url :v_Endpoint type :POST parameters:x_Params headers:m_Headers ];
- /*
- Function: fn_eBay_GetOrders()
- Purpose: Queries eBay for all orders given a from and till date
- Date Created: 2023-02-28 (Joel Lipman)
- - Initial release
- Date Modified: ????
- - ???
- More Info:
- - API Explorer Test Tool: https://developer.ebay.com/DevZone/build-test/test-tool/default.aspx?index=0&env=production&api=trading
- - GetMyeBaySelling Documentation: https://developer.ebay.com/devzone/xml/docs/reference/ebay/getmyebayselling.html
- - GetOrders using Trading API: https://developer.ebay.com/Devzone/XML/docs/Reference/eBay/GetOrders.html
- - Get Access Token: https://www.joellipman.com/articles/crm/zoho/zoho-creator-push-to-ebay-listings.html
- */
- //
- // evaluate (specify here your dates [time set to midnight])
- v_timeFrom = zoho.currenttime.subDay(0).toString("yyyy-MM-dd'T'00:00:00.000'Z'");
- v_timeTill = zoho.currenttime.addDay(1).toString("yyyy-MM-dd'T'00:00:00.000'Z'");
- //
- // get access token (you will need your own function here as documented in my article
- v_AccessToken = standalone.fn_eBay_GetAccessToken();
- //
- v_TradingAPIVersion = 967;
- v_Endpoint = "https://api.ebay.com/ws/api.dll";
- //
- // build header
- m_Headers = Map();
- m_Headers.put("X-EBAY-API-SITEID",3);
- m_Headers.put("X-EBAY-API-COMPATIBILITY-LEVEL",v_TradingAPIVersion);
- v_ApiCall = "GetOrders";
- m_Headers.put("X-EBAY-API-CALL-NAME",v_ApiCall);
- m_Headers.put("X-EBAY-API-IAF-TOKEN",v_AccessToken);
- //
- // build params
- m_Params = Map();
- m_Params.put("WarningLevel","High");
- m_Params.put("ErrorLanguage","en_GB");
- m_Params.put("DetailLevel","ReturnAll");
- //
- // send order filters
- m_Params.put("CreateTimeFrom",v_timeFrom);
- m_Params.put("CreateTimeTo",v_timeTill);
- m_Params.put("OrderRole","Seller");
- //
- // convert to xml and replace root nodes
- x_Params = m_Params.toXML();
- x_Params = x_Params.toString().replaceFirst("<root>","<?xml version=\"1.0\" encoding=\"utf-8\"?><" + v_ApiCall + "Request xmlns=\"urn:ebay:apis:eBLBaseComponents\">");
- x_Params = x_Params.toString().replaceFirst("</root>","</" + v_ApiCall + "Request>");
- //
- // send the request XML as a string
- x_ResponseBody = invokeUrl
- [
- url :v_Endpoint
- type :POST
- parameters:x_Params
- headers:m_Headers
- ];
Parsing the response into JSON or a Deluge Map
This can be appended to the above within the same function to return a map. Note that this is for fixedpriceitems only. For auction ones, you would need to adjust the parsing code below to capture auction details. This includes a split for any multi-line item orders:
// // declare variables to store order details in a JSON or ZohoDeluge Map format m_Response = Map(); l_JsonOrders = List(); // // loop through orders in response v_OrderNodePart = "Order"; v_OrderNodeName = v_OrderNodePart + "Array"; x_OrderNode = x_ResponseBody.subString(x_ResponseBody.indexOf("<" + v_OrderNodeName),x_ResponseBody.lastIndexOf(v_OrderNodeName) + v_OrderNodeName.length() + 1); l_Orders = x_OrderNode.executeXPath("/" + v_OrderNodeName + "/" + v_OrderNodePart).toXmlList(); for each x_Order in l_Orders { v_OrderID = "-"; v_OrderStatus = "-"; v_OrderAmountPaid = 0.0; v_OrderSubTotal = 0.0; v_OrderTotal = 0.0; // // transforms v_CreatedTimeStr = x_Order.executeXPath("/" + v_OrderNodePart + "/CreatedTime/text()"); v_CreatedTime = if(!isnull(v_CreatedTimeStr),v_CreatedTimeStr.getPrefix(".").replaceFirst("T"," ",true).toTime(),zoho.currenttime).toString("yyyy-MM-dd HH:mm:ss"); // // build JSON row m_Order = Map(); m_Order.put("OrderID",x_Order.executeXPath("/" + v_OrderNodePart + "/OrderID/text()")); m_Order.put("OrderStatus",x_Order.executeXPath("/" + v_OrderNodePart + "/OrderStatus/text()")); m_Order.put("AmountPaid",x_Order.executeXPath("/" + v_OrderNodePart + "/AmountPaid/text()")); m_Order.put("Subtotal",x_Order.executeXPath("/" + v_OrderNodePart + "/Subtotal/text()")); m_Order.put("Total",x_Order.executeXPath("/" + v_OrderNodePart + "/Total/text()")); m_Order.put("CreatedTime",v_CreatedTime); // m_Checkout = Map(); m_Checkout.put("eBayPaymentStatus",x_Order.executeXPath("/" + v_OrderNodePart + "/CheckoutStatus/eBayPaymentStatus/text()")); m_Checkout.put("PaymentMethod",x_Order.executeXPath("/" + v_OrderNodePart + "/CheckoutStatus/PaymentMethod/text()")); m_Checkout.put("PaymentInstrument",x_Order.executeXPath("/" + v_OrderNodePart + "/CheckoutStatus/PaymentInstrument/text()")); m_Order.put("Checkout",m_Checkout); // m_Shipping = Map(); m_Shipping.put("Attn",x_Order.executeXPath("/" + v_OrderNodePart + "/ShippingAddress/Name/text()")); m_Shipping.put("Street1",x_Order.executeXPath("/" + v_OrderNodePart + "/ShippingAddress/Street1/text()")); m_Shipping.put("Street2",x_Order.executeXPath("/" + v_OrderNodePart + "/ShippingAddress/Street2/text()").getPrefix(" ebay")); m_Shipping.put("City",x_Order.executeXPath("/" + v_OrderNodePart + "/ShippingAddress/CityName/text()")); m_Shipping.put("State",x_Order.executeXPath("/" + v_OrderNodePart + "/ShippingAddress/StateOrProvince/text()")); m_Shipping.put("Zip",x_Order.executeXPath("/" + v_OrderNodePart + "/ShippingAddress/PostalCode/text()")); m_Shipping.put("Country",x_Order.executeXPath("/" + v_OrderNodePart + "/ShippingAddress/CountryName/text()")); m_Shipping.put("Phone",x_Order.executeXPath("/" + v_OrderNodePart + "/ShippingAddress/Phone/text()")); m_Shipping.put("Service",x_Order.executeXPath("/" + v_OrderNodePart + "/ShippingServiceSelected/ShippingService/text()")); m_Shipping.put("ServiceCost",x_Order.executeXPath("/" + v_OrderNodePart + "/ShippingServiceSelected/ShippingServiceCost/text()")); m_Order.put("Shipping",m_Shipping); // m_Buyer = Map(); l_JsonLineItems = List(); l_LineItems = x_Order.executeXPath("/" + v_OrderNodePart + "/TransactionArray/Transaction").toXmlList(); for each x_OrderLineItem in l_LineItems { m_LineItem = Map(); // v_CreatedTimeStr = x_OrderLineItem.executeXPath("/Transaction/CreatedDate/text()"); v_CreatedTime = if(!isnull(v_CreatedTimeStr),v_CreatedTimeStr.getPrefix(".").replaceFirst("T"," ",true).toTime(),zoho.currenttime).toString("yyyy-MM-dd HH:mm:ss"); m_LineItem.put("CreatedTime",v_CreatedTime); // m_Buyer = Map(); m_Buyer.put("Email",x_OrderLineItem.executeXPath("/Transaction/Buyer/Email/text()")); m_Buyer.put("StaticAlias",x_OrderLineItem.executeXPath("/Transaction/Buyer/StaticAlias/text()")); m_Buyer.put("UserFirstName",x_OrderLineItem.executeXPath("/Transaction/Buyer/UserFirstName/text()")); m_Buyer.put("UserLastName",x_OrderLineItem.executeXPath("/Transaction/Buyer/UserLastName/text()")); // m_ShippingDetail = Map(); m_ShippingDetail.put("SalesTaxPercent",x_OrderLineItem.executeXPath("/Transaction/ShippingDetails/SalesTax/SalesTaxPercent/text()")); m_ShippingDetail.put("SalesRecordNumber",x_OrderLineItem.executeXPath("/Transaction/ShippingDetails/SellingManagerSalesRecordNumber/text()")); m_ShippingDetail.put("ShippingCarrier",x_OrderLineItem.executeXPath("/Transaction/ShippingDetails/ShipmentTrackingDetails/ShippingCarrierUsed/text()")); m_ShippingDetail.put("ShipmentTrackingNumber",x_OrderLineItem.executeXPath("/Transaction/ShippingDetails/ShipmentTrackingDetails/ShipmentTrackingNumber/text()")); m_ShippingDetail.put("ShippedTime",x_OrderLineItem.executeXPath("/Transaction/ShippingServiceSelected/ShippingPackageInfo/EstimatedDeliveryTimeMax/text()")); m_ShippingDetail.put("DeliverBy",x_OrderLineItem.executeXPath("/Transaction/ShippingServiceSelected/ShippingPackageInfo/EstimatedDeliveryTimeMax/text()")); m_LineItem.put("ShippingDetail",m_ShippingDetail); // m_ItemDetail = Map(); m_ItemDetail.put("ItemID",x_OrderLineItem.executeXPath("/Transaction/Item/ItemID/text()")); m_ItemDetail.put("Site",x_OrderLineItem.executeXPath("/Transaction/Item/Site/text()")); m_ItemDetail.put("Title",x_OrderLineItem.executeXPath("/Transaction/Item/Title/text()")); m_ItemDetail.put("SKU",x_OrderLineItem.executeXPath("/Transaction/Item/SKU/text()")); m_ItemDetail.put("ConditionID",x_OrderLineItem.executeXPath("/Transaction/Item/ConditionID/text()")); m_ItemDetail.put("Condition",x_OrderLineItem.executeXPath("/Transaction/Item/ConditionDisplayName/text()")); m_LineItem.put("ItemDetail",m_ItemDetail); // m_LineItem.put("Quantity",x_OrderLineItem.executeXPath("/Transaction/QuantityPurchased/text()")); m_LineItem.put("PaymentHoldStatus",x_OrderLineItem.executeXPath("/Transaction/Status/PaymentHoldStatus/text()")); m_LineItem.put("ReturnStatus",x_OrderLineItem.executeXPath("/Transaction/Status/ReturnStatus/text()")); m_LineItem.put("TransactionID",x_OrderLineItem.executeXPath("/Transaction/TransactionID/text()")); m_LineItem.put("TransactionPrice",x_OrderLineItem.executeXPath("/Transaction/TransactionPrice/text()")); m_LineItem.put("OrderLineItemID",x_OrderLineItem.executeXPath("/Transaction/OrderLineItemID/text()")); m_LineItem.put("ExtendedOrderID",x_OrderLineItem.executeXPath("/Transaction/ExtendedOrderID/text()")); // l_JsonLineItems.add(m_LineItem); } m_Order.put("Line_Items",l_JsonLineItems); // m_Buyer.put("BuyerUserID",x_Order.executeXPath("/" + v_OrderNodePart + "/BuyerUserID/text()")); m_Order.put("Buyer",m_Buyer); // m_Order.put("IsMultiLegShipping",x_Order.executeXPath("/" + v_OrderNodePart + "/IsMultiLegShipping/text()")); // l_JsonPayments = List(); l_Payments = x_Order.executeXPath("/" + v_OrderNodePart + "/MonetaryDetails/Payments/Payment").toXmlList(); for each x_Payment in l_Payments { m_Payment = Map(); m_Payment.put("Status",x_Payment.executeXPath("/Payment/PaymentStatus/text()")); m_Payment.put("Payer",x_Payment.executeXPath("/Payment/Payer/text()")); m_Payment.put("Payee",x_Payment.executeXPath("/Payment/Payee/text()")); m_Payment.put("PaymentAmount",x_Payment.executeXPath("/Payment/PaymentAmount/text()")); m_Payment.put("ReferenceID",x_Payment.executeXPath("/Payment/ReferenceID/text()")); m_Payment.put("FeeOrCreditAmount",x_Payment.executeXPath("/Payment/FeeOrCreditAmount/text()")); // v_PaymentTimeStr = x_Payment.executeXPath("/Payment/PaymentTime/text()"); v_PaymentTime = if(!isnull(v_PaymentTimeStr),v_PaymentTimeStr.getPrefix(".").replaceFirst("T"," ",true).toTime(),zoho.currenttime).toString("yyyy-MM-dd HH:mm:ss"); m_Payment.put("PaymentTime",v_PaymentTime); // l_JsonPayments.add(m_Payment); } m_Order.put("Payments",l_JsonPayments); // m_Checkout.put("eBayPaymentStatus",x_Order.executeXPath("/" + v_OrderNodePart + "/CheckoutStatus/eBayPaymentStatus/text()")); m_Checkout.put("PaymentMethod",x_Order.executeXPath("/" + v_OrderNodePart + "/CheckoutStatus/PaymentMethod/text()")); m_Checkout.put("PaymentInstrument",x_Order.executeXPath("/" + v_OrderNodePart + "/CheckoutStatus/PaymentInstrument/text()")); m_Order.put("Checkout",m_Checkout); // l_JsonOrders.add(m_Order); } m_Response.put("orders",l_JsonOrders); info m_Response;
- //
- // declare variables to store order details in a JSON or ZohoDeluge Map format
- m_Response = Map();
- l_JsonOrders = List();
- //
- // loop through orders in response
- v_OrderNodePart = "Order";
- v_OrderNodeName = v_OrderNodePart + "Array";
- x_OrderNode = x_ResponseBody.subString(x_ResponseBody.indexOf("<" + v_OrderNodeName),x_ResponseBody.lastIndexOf(v_OrderNodeName) + v_OrderNodeName.length() + 1);
- l_Orders = x_OrderNode.executeXPath("/" + v_OrderNodeName + "/" + v_OrderNodePart).toXmlList();
- for each x_Order in l_Orders
- {
- v_OrderID = "-";
- v_OrderStatus = "-";
- v_OrderAmountPaid = 0.0;
- v_OrderSubTotal = 0.0;
- v_OrderTotal = 0.0;
- //
- // transforms
- v_CreatedTimeStr = x_Order.executeXPath("/" + v_OrderNodePart + "/CreatedTime/text()");
- v_CreatedTime = if(!isnull(v_CreatedTimeStr),v_CreatedTimeStr.getPrefix(".").replaceFirst("T"," ",true).toTime(),zoho.currenttime).toString("yyyy-MM-dd HH:mm:ss");
- //
- // build JSON row
- m_Order = Map();
- m_Order.put("OrderID",x_Order.executeXPath("/" + v_OrderNodePart + "/OrderID/text()"));
- m_Order.put("OrderStatus",x_Order.executeXPath("/" + v_OrderNodePart + "/OrderStatus/text()"));
- m_Order.put("AmountPaid",x_Order.executeXPath("/" + v_OrderNodePart + "/AmountPaid/text()"));
- m_Order.put("Subtotal",x_Order.executeXPath("/" + v_OrderNodePart + "/Subtotal/text()"));
- m_Order.put("Total",x_Order.executeXPath("/" + v_OrderNodePart + "/Total/text()"));
- m_Order.put("CreatedTime",v_CreatedTime);
- //
- m_Checkout = Map();
- m_Checkout.put("eBayPaymentStatus",x_Order.executeXPath("/" + v_OrderNodePart + "/CheckoutStatus/eBayPaymentStatus/text()"));
- m_Checkout.put("PaymentMethod",x_Order.executeXPath("/" + v_OrderNodePart + "/CheckoutStatus/PaymentMethod/text()"));
- m_Checkout.put("PaymentInstrument",x_Order.executeXPath("/" + v_OrderNodePart + "/CheckoutStatus/PaymentInstrument/text()"));
- m_Order.put("Checkout",m_Checkout);
- //
- m_Shipping = Map();
- m_Shipping.put("Attn",x_Order.executeXPath("/" + v_OrderNodePart + "/ShippingAddress/Name/text()"));
- m_Shipping.put("Street1",x_Order.executeXPath("/" + v_OrderNodePart + "/ShippingAddress/Street1/text()"));
- m_Shipping.put("Street2",x_Order.executeXPath("/" + v_OrderNodePart + "/ShippingAddress/Street2/text()").getPrefix(" ebay"));
- m_Shipping.put("City",x_Order.executeXPath("/" + v_OrderNodePart + "/ShippingAddress/CityName/text()"));
- m_Shipping.put("State",x_Order.executeXPath("/" + v_OrderNodePart + "/ShippingAddress/StateOrProvince/text()"));
- m_Shipping.put("Zip",x_Order.executeXPath("/" + v_OrderNodePart + "/ShippingAddress/PostalCode/text()"));
- m_Shipping.put("Country",x_Order.executeXPath("/" + v_OrderNodePart + "/ShippingAddress/CountryName/text()"));
- m_Shipping.put("Phone",x_Order.executeXPath("/" + v_OrderNodePart + "/ShippingAddress/Phone/text()"));
- m_Shipping.put("Service",x_Order.executeXPath("/" + v_OrderNodePart + "/ShippingServiceSelected/ShippingService/text()"));
- m_Shipping.put("ServiceCost",x_Order.executeXPath("/" + v_OrderNodePart + "/ShippingServiceSelected/ShippingServiceCost/text()"));
- m_Order.put("Shipping",m_Shipping);
- //
- m_Buyer = Map();
- l_JsonLineItems = List();
- l_LineItems = x_Order.executeXPath("/" + v_OrderNodePart + "/TransactionArray/Transaction").toXmlList();
- for each x_OrderLineItem in l_LineItems
- {
- m_LineItem = Map();
- //
- v_CreatedTimeStr = x_OrderLineItem.executeXPath("/Transaction/CreatedDate/text()");
- v_CreatedTime = if(!isnull(v_CreatedTimeStr),v_CreatedTimeStr.getPrefix(".").replaceFirst("T"," ",true).toTime(),zoho.currenttime).toString("yyyy-MM-dd HH:mm:ss");
- m_LineItem.put("CreatedTime",v_CreatedTime);
- //
- m_Buyer = Map();
- m_Buyer.put("Email",x_OrderLineItem.executeXPath("/Transaction/Buyer/Email/text()"));
- m_Buyer.put("StaticAlias",x_OrderLineItem.executeXPath("/Transaction/Buyer/StaticAlias/text()"));
- m_Buyer.put("UserFirstName",x_OrderLineItem.executeXPath("/Transaction/Buyer/UserFirstName/text()"));
- m_Buyer.put("UserLastName",x_OrderLineItem.executeXPath("/Transaction/Buyer/UserLastName/text()"));
- //
- m_ShippingDetail = Map();
- m_ShippingDetail.put("SalesTaxPercent",x_OrderLineItem.executeXPath("/Transaction/ShippingDetails/SalesTax/SalesTaxPercent/text()"));
- m_ShippingDetail.put("SalesRecordNumber",x_OrderLineItem.executeXPath("/Transaction/ShippingDetails/SellingManagerSalesRecordNumber/text()"));
- m_ShippingDetail.put("ShippingCarrier",x_OrderLineItem.executeXPath("/Transaction/ShippingDetails/ShipmentTrackingDetails/ShippingCarrierUsed/text()"));
- m_ShippingDetail.put("ShipmentTrackingNumber",x_OrderLineItem.executeXPath("/Transaction/ShippingDetails/ShipmentTrackingDetails/ShipmentTrackingNumber/text()"));
- m_ShippingDetail.put("ShippedTime",x_OrderLineItem.executeXPath("/Transaction/ShippingServiceSelected/ShippingPackageInfo/EstimatedDeliveryTimeMax/text()"));
- m_ShippingDetail.put("DeliverBy",x_OrderLineItem.executeXPath("/Transaction/ShippingServiceSelected/ShippingPackageInfo/EstimatedDeliveryTimeMax/text()"));
- m_LineItem.put("ShippingDetail",m_ShippingDetail);
- //
- m_ItemDetail = Map();
- m_ItemDetail.put("ItemID",x_OrderLineItem.executeXPath("/Transaction/Item/ItemID/text()"));
- m_ItemDetail.put("Site",x_OrderLineItem.executeXPath("/Transaction/Item/Site/text()"));
- m_ItemDetail.put("Title",x_OrderLineItem.executeXPath("/Transaction/Item/Title/text()"));
- m_ItemDetail.put("SKU",x_OrderLineItem.executeXPath("/Transaction/Item/SKU/text()"));
- m_ItemDetail.put("ConditionID",x_OrderLineItem.executeXPath("/Transaction/Item/ConditionID/text()"));
- m_ItemDetail.put("Condition",x_OrderLineItem.executeXPath("/Transaction/Item/ConditionDisplayName/text()"));
- m_LineItem.put("ItemDetail",m_ItemDetail);
- //
- m_LineItem.put("Quantity",x_OrderLineItem.executeXPath("/Transaction/QuantityPurchased/text()"));
- m_LineItem.put("PaymentHoldStatus",x_OrderLineItem.executeXPath("/Transaction/Status/PaymentHoldStatus/text()"));
- m_LineItem.put("ReturnStatus",x_OrderLineItem.executeXPath("/Transaction/Status/ReturnStatus/text()"));
- m_LineItem.put("TransactionID",x_OrderLineItem.executeXPath("/Transaction/TransactionID/text()"));
- m_LineItem.put("TransactionPrice",x_OrderLineItem.executeXPath("/Transaction/TransactionPrice/text()"));
- m_LineItem.put("OrderLineItemID",x_OrderLineItem.executeXPath("/Transaction/OrderLineItemID/text()"));
- m_LineItem.put("ExtendedOrderID",x_OrderLineItem.executeXPath("/Transaction/ExtendedOrderID/text()"));
- //
- l_JsonLineItems.add(m_LineItem);
- }
- m_Order.put("Line_Items",l_JsonLineItems);
- //
- m_Buyer.put("BuyerUserID",x_Order.executeXPath("/" + v_OrderNodePart + "/BuyerUserID/text()"));
- m_Order.put("Buyer",m_Buyer);
- //
- m_Order.put("IsMultiLegShipping",x_Order.executeXPath("/" + v_OrderNodePart + "/IsMultiLegShipping/text()"));
- //
- l_JsonPayments = List();
- l_Payments = x_Order.executeXPath("/" + v_OrderNodePart + "/MonetaryDetails/Payments/Payment").toXmlList();
- for each x_Payment in l_Payments
- {
- m_Payment = Map();
- m_Payment.put("Status",x_Payment.executeXPath("/Payment/PaymentStatus/text()"));
- m_Payment.put("Payer",x_Payment.executeXPath("/Payment/Payer/text()"));
- m_Payment.put("Payee",x_Payment.executeXPath("/Payment/Payee/text()"));
- m_Payment.put("PaymentAmount",x_Payment.executeXPath("/Payment/PaymentAmount/text()"));
- m_Payment.put("ReferenceID",x_Payment.executeXPath("/Payment/ReferenceID/text()"));
- m_Payment.put("FeeOrCreditAmount",x_Payment.executeXPath("/Payment/FeeOrCreditAmount/text()"));
- //
- v_PaymentTimeStr = x_Payment.executeXPath("/Payment/PaymentTime/text()");
- v_PaymentTime = if(!isnull(v_PaymentTimeStr),v_PaymentTimeStr.getPrefix(".").replaceFirst("T"," ",true).toTime(),zoho.currenttime).toString("yyyy-MM-dd HH:mm:ss");
- m_Payment.put("PaymentTime",v_PaymentTime);
- //
- l_JsonPayments.add(m_Payment);
- }
- m_Order.put("Payments",l_JsonPayments);
- //
- m_Checkout.put("eBayPaymentStatus",x_Order.executeXPath("/" + v_OrderNodePart + "/CheckoutStatus/eBayPaymentStatus/text()"));
- m_Checkout.put("PaymentMethod",x_Order.executeXPath("/" + v_OrderNodePart + "/CheckoutStatus/PaymentMethod/text()"));
- m_Checkout.put("PaymentInstrument",x_Order.executeXPath("/" + v_OrderNodePart + "/CheckoutStatus/PaymentInstrument/text()"));
- m_Order.put("Checkout",m_Checkout);
- //
- l_JsonOrders.add(m_Order);
- }
- m_Response.put("orders",l_JsonOrders);
- info m_Response;
Source(s):
- eBay Developers Program - API Explorer Test Tool
- eBay Developers Program - GetMyeBaySelling Documentation
- eBay Developers Program - GetOrders using Trading API
- JoelLipman.com - Zoho Creator: Push to eBay Listings