*
MerchantItemId: IdType
* SKU: string
* MerchantId: IdType
* Title: string
* Description: string
* UnitPrice: Creativestyle_CheckoutByAmazon_Model_Api_Model_Checkout_Price
* Quantity: PositiveInteger
* URL: string
* Category: string
* FulfillmentNetwork: FulfillmentNetwork
* ItemCustomData: string
* ProductType: ProductType
* PhysicalProductAttributes: Creativestyle_CheckoutByAmazon_Model_Api_Model_Checkout_PhysicalProductAttributes
* DigitalProductAttributes: Creativestyle_CheckoutByAmazon_Model_Api_Model_Checkout_DigitalProductAttributes
*
*
* This file is part of The Official Amazon Payments Magento Extension
* (c) creativestyle GmbH
* All rights reserved
*
* Reuse or modification of this source code is not allowed
* without written permission from creativestyle GmbH
*
* @category Creativestyle
* @package Creativestyle_CheckoutByAmazon
* @copyright Copyright (c) 2012 creativestyle GmbH (http://www.creativestyle.de)
* @author Marek Zabrowarny / creativestyle GmbH
*/
class Creativestyle_CheckoutByAmazon_Model_Api_Model_Checkout_PurchaseItem extends Creativestyle_CheckoutByAmazon_Model_Api_Model_Checkout_Abstract {
protected function _prepareInput($data = null) {
if (is_array($data) || is_null($data)) {
if (!isset($data['MerchantId'])) $data['MerchantId'] = self::getConfigData('merchant_id');
}
return $data;
}
public function __construct($data = null) {
$this->_fields = array(
'MerchantItemId' => array('FieldValue' => null, 'FieldType' => 'IdType'),
'SKU' => array('FieldValue' => null, 'FieldType' => 'string'),
'MerchantId' => array('FieldValue' => null, 'FieldType' => 'IdType'),
'Title' => array('FieldValue' => null, 'FieldType' => 'string'),
'Description' => array('FieldValue' => null, 'FieldType' => 'string'),
'UnitPrice' => array('FieldValue' => null, 'FieldType' => 'Creativestyle_CheckoutByAmazon_Model_Api_Model_Checkout_Price'),
'Quantity' => array('FieldValue' => null, 'FieldType' => 'PositiveInteger'),
'URL' => array('FieldValue' => null, 'FieldType' => 'string'),
'Category' => array('FieldValue' => null, 'FieldType' => 'string'),
'FulfillmentNetwork' => array('FieldValue' => null, 'FieldType' => 'FulfillmentNetwork'),
'ItemCustomData' => array('FieldValue' => null, 'FieldType' => 'string'),
'ProductType' => array('FieldValue' => null, 'FieldType' => 'ProductType'),
'PhysicalProductAttributes' => array('FieldValue' => null, 'FieldType' => 'Creativestyle_CheckoutByAmazon_Model_Api_Model_Checkout_PhysicalProductAttributes'),
'DigitalProductAttributes' => array('FieldValue' => null, 'FieldType' => 'Creativestyle_CheckoutByAmazon_Model_Api_Model_Checkout_DigitalProductAttributes')
);
parent::__construct($this->_prepareInput($data));
}
public function setItemTax($tax) {
if ($this->issetPhysicalProductAttributes()) {
if ($this->getPhysicalProductAttributes()->issetItemCharges()) {
$this->getPhysicalProductAttributes()->getItemCharges()->setTax($tax);
} else {
$chargesObject = $this->_getApiModel('charges');
$chargesObject->setTax($tax);
$this->getPhysicalProductAttributes()->setItemCharges($chargesObject);
}
} else {
$physicalAttribsObj = $this->_getApiModel('physicalProductAttributes');
$this->setPhysicalProductAttributes($physicalAttribsObj);
$chargesObject = $this->_getApiModel('charges');
$chargesObject->setTax($tax);
$this->getPhysicalProductAttributes()->setItemCharges($chargesObject);
}
return $this;
}
}