Skip to content

Question: AmazonOrderItemList::setOrderId fails, though I'm giving it a string #175

@mehgcap

Description

@mehgcap

I'm pretty new to working with Amazon, so I hope this isn't a very stupid question. I have an order ID, and I'm trying to get a list of items so I can then get a list of available services. Some of my code is below, slightly modified as the actual code is spread across multiple files and classes:

$amazonOrderNumber = "123-8765432-1234567";
try {
	//first, we need the list of items and quantities
	$logger->debug("Setting up the object to get item details for order {$amazonOrderNumber}.");
	$itemsListObj = new \AmazonOrderItemList();
	if(!$itemsListObj->setOrderId($amazonOrderNumber))
		throw new \Exception("Invalid order number used when getting the list of items. Order number: {$amazonOrderNumber}. Order number variable type: " . gettype($amazonOrderNumber) . ".");
	$logger->debug("Fetching the items/quantities for order $amazonOrderNumber.");

Every time I run this, the exception is thrown. My order number is a string, as the debug log statement shows in my log, but setOrderId won't accept it for some reason. The function seems only to care that the order ID be a string or a number, so I can't imagine why I am getting stuck at this stage. What is the very obvious, simple thing I'm doing wrong? :) Thanks in advance for any ideas!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions