Hier die Zeilen zum Einlesen des Strings:
PHP-Code:
$data = NULL;
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
$data = $_GET;
} else if ($tmp = file_get_contents('php://input')) {
$data = json_decode($tmp);
}
Und hier ist der Konstruktor des zu erstellenden Objektes Amazon_FWSOutbound_Model_CreateFulfillmentOrder:
PHP-Code:
public function __construct($data = null)
{
$this->_fields = array (
'MerchantFulfillmentOrderId' => array('FieldValue' => null, 'FieldType' => 'string'),
'DisplayableOrderId' => array('FieldValue' => null, 'FieldType' => 'string'),
'DisplayableOrderDateTime' => array('FieldValue' => null, 'FieldType' => 'string'),
'DisplayableOrderComment' => array('FieldValue' => null, 'FieldType' => 'string'),
'ShippingSpeedCategory' => array('FieldValue' => null, 'FieldType' => 'string'),
'DestinationAddress' => array('FieldValue' => null, 'FieldType' => 'Amazon_FWSOutbound_Model_Address'),
'Item' => array('FieldValue' => array(), 'FieldType' => array('Amazon_FWSOutbound_Model_CreateFulfillmentOrderItem')),
);
parent::__construct($data);
}
Das array_keys($data) mach ich, da ich herausfinden muss, wieviele Daten übergeben werden, denn ich weiß bspw. nicht ob nur ein Item.1.MerchantSKU ... oder noch ein zweites Item.2.MerchantSKU übergeben wird.