For Zoho Services only:


I'm actually part of something bigger at Ascent Business Solutions recognized as the top Zoho Premium Solutions Partner in the United Kingdom.

Ascent Business Solutions offer support for smaller technical fixes and projects for larger developments, such as migrating to a ZohoCRM.  A team rather than a one-man-band is always available to ensure seamless progress and address any concerns. You'll find our competitive support rates with flexible, no-expiration bundles at https://ascentbusiness.co.uk/zoho-services/uk-zoho-support.  For larger projects, talk to our experts and receive dedicated support from our hands-on project consultants at https://ascentbusiness.co.uk/zoho-services/zoho-crm-implementation.

The team I manage specializes in coding API integrations between Zoho and third-party finance/commerce suites such as Xero, Shopify, WooCommerce, and eBay; to name but a few.  Our passion lies in creating innovative solutions where others have fallen short as well as working with new businesses, new sectors, and new ideas.  Our success is measured by the growth and ROI we deliver for clients, such as transforming a garden shed hobby into a 250k monthly turnover operation or generating a +60% return in just three days after launch through online payments and a streamlined e-commerce solution, replacing a paper-based system.

If you're looking for a partner who can help you drive growth and success, we'd love to work with you.  You can reach out to us on 0121 392 8140 (UK) or info@ascentbusiness.co.uk.  You can also visit our website at https://ascentbusiness.co.uk.

ZohoDeluge: Get All eBay Orders Given a From and Till Date

What?
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:
copyraw
/*
    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
];
  1.  /* 
  2.      Function:         fn_eBay_GetOrders() 
  3.      Purpose:         Queries eBay for all orders given a from and till date 
  4.      Date Created:   2023-02-28 (Joel Lipman) 
  5.                      - Initial release 
  6.      Date Modified:     ???? 
  7.                      - ??? 
  8.   
  9.      More Info: 
  10.      - API Explorer Test Tool:             https://developer.ebay.com/DevZone/build-test/test-tool/default.aspx?index=0&env=production&api=trading 
  11.      - GetMyeBaySelling Documentation:     https://developer.ebay.com/devzone/xml/docs/reference/ebay/getmyebayselling.html 
  12.      - GetOrders using Trading API:         https://developer.ebay.com/Devzone/XML/docs/Reference/eBay/GetOrders.html 
  13.      - Get Access Token:     https://www.joellipman.com/articles/crm/zoho/zoho-creator-push-to-ebay-listings.html 
  14.   
  15.  */ 
  16.  // 
  17.  // evaluate (specify here your dates [time set to midnight]) 
  18.  v_timeFrom = zoho.currenttime.subDay(0).toString("yyyy-MM-dd'T'00:00:00.000'Z'")
  19.  v_timeTill = zoho.currenttime.addDay(1).toString("yyyy-MM-dd'T'00:00:00.000'Z'")
  20.  // 
  21.  // get access token (you will need your own function here as documented in my article 
  22.  v_AccessToken = standalone.fn_eBay_GetAccessToken()
  23.  // 
  24.  v_TradingAPIVersion = 967
  25.  v_Endpoint = "https://api.ebay.com/ws/api.dll"
  26.  // 
  27.  // build header 
  28.  m_Headers = Map()
  29.  m_Headers.put("X-EBAY-API-SITEID",3)
  30.  m_Headers.put("X-EBAY-API-COMPATIBILITY-LEVEL",v_TradingAPIVersion)
  31.  v_ApiCall = "GetOrders"
  32.  m_Headers.put("X-EBAY-API-CALL-NAME",v_ApiCall)
  33.  m_Headers.put("X-EBAY-API-IAF-TOKEN",v_AccessToken)
  34.  // 
  35.  // build params 
  36.  m_Params = Map()
  37.  m_Params.put("WarningLevel","High")
  38.  m_Params.put("ErrorLanguage","en_GB")
  39.  m_Params.put("DetailLevel","ReturnAll")
  40.  // 
  41.  // send order filters 
  42.  m_Params.put("CreateTimeFrom",v_timeFrom)
  43.  m_Params.put("CreateTimeTo",v_timeTill)
  44.  m_Params.put("OrderRole","Seller")
  45.  // 
  46.  // convert to xml and replace root nodes 
  47.  x_Params = m_Params.toXML()
  48.  x_Params = x_Params.toString().replaceFirst("<root>","<?xml version=\"1.0\" encoding=\"utf-8\"?><" + v_ApiCall + "Request xmlns=\"urn:ebay:apis:eBLBaseComponents\">")
  49.  x_Params = x_Params.toString().replaceFirst("</root>","</" + v_ApiCall + "Request>")
  50.  // 
  51.  // send the request XML as a string 
  52.  x_ResponseBody = invokeUrl 
  53.  [ 
  54.      url :v_Endpoint 
  55.      type :POST 
  56.      parameters:x_Params 
  57.      headers:m_Headers 
  58.  ]

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:
copyraw
//
// 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;
  1.  // 
  2.  // declare variables to store order details in a JSON or ZohoDeluge Map format 
  3.  m_Response = Map()
  4.  l_JsonOrders = List()
  5.  // 
  6.  // loop through orders in response 
  7.  v_OrderNodePart = "Order"
  8.  v_OrderNodeName = v_OrderNodePart + "Array"
  9.  x_OrderNode = x_ResponseBody.subString(x_ResponseBody.indexOf("<" + v_OrderNodeName),x_ResponseBody.lastIndexOf(v_OrderNodeName) + v_OrderNodeName.length() + 1)
  10.  l_Orders = x_OrderNode.executeXPath("/" + v_OrderNodeName + "/" + v_OrderNodePart).toXmlList()
  11.  for each  x_Order in l_Orders 
  12.  { 
  13.      v_OrderID = "-"
  14.      v_OrderStatus = "-"
  15.      v_OrderAmountPaid = 0.0
  16.      v_OrderSubTotal = 0.0
  17.      v_OrderTotal = 0.0
  18.      // 
  19.      // transforms 
  20.      v_CreatedTimeStr = x_Order.executeXPath("/" + v_OrderNodePart + "/CreatedTime/text()")
  21.      v_CreatedTime = if(!isnull(v_CreatedTimeStr),v_CreatedTimeStr.getPrefix(".").replaceFirst("T"," ",true).toTime(),zoho.currenttime).toString("yyyy-MM-dd HH:mm:ss")
  22.      // 
  23.      // build JSON row 
  24.      m_Order = Map()
  25.      m_Order.put("OrderID",x_Order.executeXPath("/" + v_OrderNodePart + "/OrderID/text()"))
  26.      m_Order.put("OrderStatus",x_Order.executeXPath("/" + v_OrderNodePart + "/OrderStatus/text()"))
  27.      m_Order.put("AmountPaid",x_Order.executeXPath("/" + v_OrderNodePart + "/AmountPaid/text()"))
  28.      m_Order.put("Subtotal",x_Order.executeXPath("/" + v_OrderNodePart + "/Subtotal/text()"))
  29.      m_Order.put("Total",x_Order.executeXPath("/" + v_OrderNodePart + "/Total/text()"))
  30.      m_Order.put("CreatedTime",v_CreatedTime)
  31.      // 
  32.      m_Checkout = Map()
  33.      m_Checkout.put("eBayPaymentStatus",x_Order.executeXPath("/" + v_OrderNodePart + "/CheckoutStatus/eBayPaymentStatus/text()"))
  34.      m_Checkout.put("PaymentMethod",x_Order.executeXPath("/" + v_OrderNodePart + "/CheckoutStatus/PaymentMethod/text()"))
  35.      m_Checkout.put("PaymentInstrument",x_Order.executeXPath("/" + v_OrderNodePart + "/CheckoutStatus/PaymentInstrument/text()"))
  36.      m_Order.put("Checkout",m_Checkout)
  37.      // 
  38.      m_Shipping = Map()
  39.      m_Shipping.put("Attn",x_Order.executeXPath("/" + v_OrderNodePart + "/ShippingAddress/Name/text()"))
  40.      m_Shipping.put("Street1",x_Order.executeXPath("/" + v_OrderNodePart + "/ShippingAddress/Street1/text()"))
  41.      m_Shipping.put("Street2",x_Order.executeXPath("/" + v_OrderNodePart + "/ShippingAddress/Street2/text()").getPrefix(" ebay"))
  42.      m_Shipping.put("City",x_Order.executeXPath("/" + v_OrderNodePart + "/ShippingAddress/CityName/text()"))
  43.      m_Shipping.put("State",x_Order.executeXPath("/" + v_OrderNodePart + "/ShippingAddress/StateOrProvince/text()"))
  44.      m_Shipping.put("Zip",x_Order.executeXPath("/" + v_OrderNodePart + "/ShippingAddress/PostalCode/text()"))
  45.      m_Shipping.put("Country",x_Order.executeXPath("/" + v_OrderNodePart + "/ShippingAddress/CountryName/text()"))
  46.      m_Shipping.put("Phone",x_Order.executeXPath("/" + v_OrderNodePart + "/ShippingAddress/Phone/text()"))
  47.      m_Shipping.put("Service",x_Order.executeXPath("/" + v_OrderNodePart + "/ShippingServiceSelected/ShippingService/text()"))
  48.      m_Shipping.put("ServiceCost",x_Order.executeXPath("/" + v_OrderNodePart + "/ShippingServiceSelected/ShippingServiceCost/text()"))
  49.      m_Order.put("Shipping",m_Shipping)
  50.      // 
  51.      m_Buyer = Map()
  52.      l_JsonLineItems = List()
  53.      l_LineItems = x_Order.executeXPath("/" + v_OrderNodePart + "/TransactionArray/Transaction").toXmlList()
  54.      for each  x_OrderLineItem in l_LineItems 
  55.      { 
  56.          m_LineItem = Map()
  57.          // 
  58.          v_CreatedTimeStr = x_OrderLineItem.executeXPath("/Transaction/CreatedDate/text()")
  59.          v_CreatedTime = if(!isnull(v_CreatedTimeStr),v_CreatedTimeStr.getPrefix(".").replaceFirst("T"," ",true).toTime(),zoho.currenttime).toString("yyyy-MM-dd HH:mm:ss")
  60.          m_LineItem.put("CreatedTime",v_CreatedTime)
  61.          // 
  62.          m_Buyer = Map()
  63.          m_Buyer.put("Email",x_OrderLineItem.executeXPath("/Transaction/Buyer/Email/text()"))
  64.          m_Buyer.put("StaticAlias",x_OrderLineItem.executeXPath("/Transaction/Buyer/StaticAlias/text()"))
  65.          m_Buyer.put("UserFirstName",x_OrderLineItem.executeXPath("/Transaction/Buyer/UserFirstName/text()"))
  66.          m_Buyer.put("UserLastName",x_OrderLineItem.executeXPath("/Transaction/Buyer/UserLastName/text()"))
  67.          // 
  68.          m_ShippingDetail = Map()
  69.          m_ShippingDetail.put("SalesTaxPercent",x_OrderLineItem.executeXPath("/Transaction/ShippingDetails/SalesTax/SalesTaxPercent/text()"))
  70.          m_ShippingDetail.put("SalesRecordNumber",x_OrderLineItem.executeXPath("/Transaction/ShippingDetails/SellingManagerSalesRecordNumber/text()"))
  71.          m_ShippingDetail.put("ShippingCarrier",x_OrderLineItem.executeXPath("/Transaction/ShippingDetails/ShipmentTrackingDetails/ShippingCarrierUsed/text()"))
  72.          m_ShippingDetail.put("ShipmentTrackingNumber",x_OrderLineItem.executeXPath("/Transaction/ShippingDetails/ShipmentTrackingDetails/ShipmentTrackingNumber/text()"))
  73.          m_ShippingDetail.put("ShippedTime",x_OrderLineItem.executeXPath("/Transaction/ShippingServiceSelected/ShippingPackageInfo/EstimatedDeliveryTimeMax/text()"))
  74.          m_ShippingDetail.put("DeliverBy",x_OrderLineItem.executeXPath("/Transaction/ShippingServiceSelected/ShippingPackageInfo/EstimatedDeliveryTimeMax/text()"))
  75.          m_LineItem.put("ShippingDetail",m_ShippingDetail)
  76.          // 
  77.          m_ItemDetail = Map()
  78.          m_ItemDetail.put("ItemID",x_OrderLineItem.executeXPath("/Transaction/Item/ItemID/text()"))
  79.          m_ItemDetail.put("Site",x_OrderLineItem.executeXPath("/Transaction/Item/Site/text()"))
  80.          m_ItemDetail.put("Title",x_OrderLineItem.executeXPath("/Transaction/Item/Title/text()"))
  81.          m_ItemDetail.put("SKU",x_OrderLineItem.executeXPath("/Transaction/Item/SKU/text()"))
  82.          m_ItemDetail.put("ConditionID",x_OrderLineItem.executeXPath("/Transaction/Item/ConditionID/text()"))
  83.          m_ItemDetail.put("Condition",x_OrderLineItem.executeXPath("/Transaction/Item/ConditionDisplayName/text()"))
  84.          m_LineItem.put("ItemDetail",m_ItemDetail)
  85.          // 
  86.          m_LineItem.put("Quantity",x_OrderLineItem.executeXPath("/Transaction/QuantityPurchased/text()"))
  87.          m_LineItem.put("PaymentHoldStatus",x_OrderLineItem.executeXPath("/Transaction/Status/PaymentHoldStatus/text()"))
  88.          m_LineItem.put("ReturnStatus",x_OrderLineItem.executeXPath("/Transaction/Status/ReturnStatus/text()"))
  89.          m_LineItem.put("TransactionID",x_OrderLineItem.executeXPath("/Transaction/TransactionID/text()"))
  90.          m_LineItem.put("TransactionPrice",x_OrderLineItem.executeXPath("/Transaction/TransactionPrice/text()"))
  91.          m_LineItem.put("OrderLineItemID",x_OrderLineItem.executeXPath("/Transaction/OrderLineItemID/text()"))
  92.          m_LineItem.put("ExtendedOrderID",x_OrderLineItem.executeXPath("/Transaction/ExtendedOrderID/text()"))
  93.          // 
  94.          l_JsonLineItems.add(m_LineItem)
  95.      } 
  96.      m_Order.put("Line_Items",l_JsonLineItems)
  97.      // 
  98.      m_Buyer.put("BuyerUserID",x_Order.executeXPath("/" + v_OrderNodePart + "/BuyerUserID/text()"))
  99.      m_Order.put("Buyer",m_Buyer)
  100.      // 
  101.      m_Order.put("IsMultiLegShipping",x_Order.executeXPath("/" + v_OrderNodePart + "/IsMultiLegShipping/text()"))
  102.      // 
  103.      l_JsonPayments = List()
  104.      l_Payments = x_Order.executeXPath("/" + v_OrderNodePart + "/MonetaryDetails/Payments/Payment").toXmlList()
  105.      for each  x_Payment in l_Payments 
  106.      { 
  107.          m_Payment = Map()
  108.          m_Payment.put("Status",x_Payment.executeXPath("/Payment/PaymentStatus/text()"))
  109.          m_Payment.put("Payer",x_Payment.executeXPath("/Payment/Payer/text()"))
  110.          m_Payment.put("Payee",x_Payment.executeXPath("/Payment/Payee/text()"))
  111.          m_Payment.put("PaymentAmount",x_Payment.executeXPath("/Payment/PaymentAmount/text()"))
  112.          m_Payment.put("ReferenceID",x_Payment.executeXPath("/Payment/ReferenceID/text()"))
  113.          m_Payment.put("FeeOrCreditAmount",x_Payment.executeXPath("/Payment/FeeOrCreditAmount/text()"))
  114.          // 
  115.          v_PaymentTimeStr = x_Payment.executeXPath("/Payment/PaymentTime/text()")
  116.          v_PaymentTime = if(!isnull(v_PaymentTimeStr),v_PaymentTimeStr.getPrefix(".").replaceFirst("T"," ",true).toTime(),zoho.currenttime).toString("yyyy-MM-dd HH:mm:ss")
  117.          m_Payment.put("PaymentTime",v_PaymentTime)
  118.          // 
  119.          l_JsonPayments.add(m_Payment)
  120.      } 
  121.      m_Order.put("Payments",l_JsonPayments)
  122.      // 
  123.      m_Checkout.put("eBayPaymentStatus",x_Order.executeXPath("/" + v_OrderNodePart + "/CheckoutStatus/eBayPaymentStatus/text()"))
  124.      m_Checkout.put("PaymentMethod",x_Order.executeXPath("/" + v_OrderNodePart + "/CheckoutStatus/PaymentMethod/text()"))
  125.      m_Checkout.put("PaymentInstrument",x_Order.executeXPath("/" + v_OrderNodePart + "/CheckoutStatus/PaymentInstrument/text()"))
  126.      m_Order.put("Checkout",m_Checkout)
  127.      // 
  128.      l_JsonOrders.add(m_Order)
  129.  } 
  130.  m_Response.put("orders",l_JsonOrders)
  131.  info m_Response; 

Source(s):
Category: Zoho :: Article: 836

Credit where Credit is Due:


Feel free to copy, redistribute and share this information. All that we ask is that you attribute credit and possibly even a link back to this website as it really helps in our search engine rankings.

Disclaimer: Please note that the information provided on this website is intended for informational purposes only and does not represent a warranty. The opinions expressed are those of the author only. We recommend testing any solutions in a development environment before implementing them in production. The articles are based on our good faith efforts and were current at the time of writing, reflecting our practical experience in a commercial setting.

Thank you for visiting and, as always, we hope this website was of some use to you!

Kind Regards,

Joel Lipman
www.joellipman.com

Related Articles

Joes Revolver Map

Accreditation

Badge - Certified Zoho Creator Associate
Badge - Certified Zoho Creator Associate

Donate & Support

If you like my content, and would like to support this sharing site, feel free to donate using a method below:

Paypal:
Donate to Joel Lipman via PayPal

Bitcoin:
Donate to Joel Lipman with Bitcoin bc1qf6elrdxc968h0k673l2djc9wrpazhqtxw8qqp4

Ethereum:
Donate to Joel Lipman with Ethereum 0xb038962F3809b425D661EF5D22294Cf45E02FebF
© 2024 Joel Lipman .com. All Rights Reserved.