timotheus / ebaysdk-python

eBay API SDK for Python
https://developer.ebay.com/tools/sdks
Other
808 stars 326 forks source link

utils.dict2xml for GetOrdersRquest.OrderIDArray is producing multiple array elements instead of an array of multiple elements. #349

Open StevenDavisTechNotes opened 3 years ago

StevenDavisTechNotes commented 3 years ago

utils.dict2xml for GetOrdersRquest.OrderIDArray is producing multiple array elements instead of an array of multiple elements. Reference: [https://developer.ebay.com/devzone/xml/docs/reference/ebay/getorders.html#Request.OrderIDArray](api docs)

Sample code:

converted = [
    {'OrderID': '08-07135-41205'},
    {'OrderID': '17-07134-21309'},
    {'OrderID': '14-07133-36430'}]
raw_response = api.execute('GetOrders', {
    "OrderIDArray": converted,
    'DetailLevel': 'ReturnAll'
})

Request from debug output

<?xml version='1.0' encoding='utf-8'?>
<GetOrdersRequest xmlns="urn:ebay:apis:eBLBaseComponents">
    <RequesterCredentials>
        <eBayAuthToken>...</eBayAuthToken>
    </RequesterCredentials>
    <DetailLevel>ReturnAll</DetailLevel>
    <OrderIDArray>
        <OrderID>08-07135-41205</OrderID>
    </OrderIDArray>
    <OrderIDArray>
        <OrderID>17-07134-21309</OrderID>
    </OrderIDArray>
    <OrderIDArray>
        <OrderID>14-07133-36430</OrderID>
    </OrderIDArray>
</GetOrdersRequest>

Expected

<?xml version='1.0' encoding='utf-8'?>
<GetOrdersRequest xmlns="urn:ebay:apis:eBLBaseComponents">
    <RequesterCredentials>
        <eBayAuthToken>...</eBayAuthToken>
    </RequesterCredentials>
    <DetailLevel>ReturnAll</DetailLevel>
    <OrderIDArray>
        <OrderID>08-07135-41205</OrderID>
        <OrderID>17-07134-21309</OrderID>
        <OrderID>14-07133-36430</OrderID>
    </OrderIDArray>
</GetOrdersRequest>