cloudgento-extension - Version 1.0.0

Version Notes

CloudGento Magento Extension

Download this release

Release Info

Developer CloudConversion
Extension cloudgento-extension
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/local/CloudConversion/CloudGento/Helper/Data.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class CloudConversion_CloudGento_Helper_Data extends Mage_Core_Helper_Abstract {
4
+
5
+ /**
6
+ * @param string $attrSetName
7
+ * @return string
8
+ */
9
+ public function getAttributeSetIdByName($attrSetName, $entityType = 'catalog_product')
10
+ {
11
+ return Mage::getSingleton('catalog/config')
12
+ ->getAttributeSetId($entityType, $attrSetName);
13
+ }
14
+ }
app/code/local/CloudConversion/CloudGento/Model/Catalog/Product/Api.php ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Extension of Magento Soap API V1
5
+ *
6
+ * @package CloudConversion
7
+ * @author Andrea De Pirro <andrea.depirro@yameveo.com>
8
+ * @author Johann Reinke @johannreinke
9
+ * @see Mage_Catalog_Model_Product_Api
10
+ */
11
+ class CloudConversion_CloudGento_Model_Catalog_Product_Api extends Mage_Catalog_Model_Product_Api
12
+ {
13
+
14
+ public function create($type, $set, $sku, $productData, $store = null)
15
+ {
16
+ // Allow attribute set name instead of id
17
+ if (is_string($set) && !is_numeric($set)) {
18
+ $set = Mage::helper('cloudconversion_cloudgento')->getAttributeSetIdByName($set);
19
+ }
20
+
21
+ return parent::create($type, $set, $sku, $productData, $store);
22
+ }
23
+
24
+ protected function _prepareDataForSave($product, $productData)
25
+ {
26
+ /* @var $product Mage_Catalog_Model_Product */
27
+
28
+ if (isset($productData['categories'])) {
29
+ $categoryIds = Mage::helper('cloudconversion_cloudgento/catalog_product')
30
+ ->getCategoryIdsByNames((array) $productData['categories']);
31
+ if (!empty($categoryIds)) {
32
+ $productData['categories'] = array_unique($categoryIds);
33
+ }
34
+ }
35
+
36
+ if (isset($productData['website_ids'])) {
37
+ $websiteIds = $productData['website_ids'];
38
+ foreach ($websiteIds as $i => $websiteId) {
39
+ if (!is_numeric($websiteId)) {
40
+ $website = Mage::app()->getWebsite($websiteId);
41
+ if ($website->getId()) {
42
+ $websiteIds[$i] = $website->getId();
43
+ }
44
+ }
45
+ }
46
+ $product->setWebsiteIds($websiteIds);
47
+ unset($productData['website_ids']);
48
+ }
49
+
50
+ foreach ($productData as $code => $value) {
51
+ $productData[$code] = Mage::helper('cloudconversion_cloudgento/catalog_product')
52
+ ->getOptionKeyByLabel($code, $value);
53
+ }
54
+
55
+ parent::_prepareDataForSave($product, $productData);
56
+
57
+ if (isset($productData['associated_skus'])) {
58
+ $simpleSkus = $productData['associated_skus'];
59
+ $priceChanges = isset($productData['price_changes']) ? $productData['price_changes'] : array();
60
+ Mage::helper('cloudconversion_cloudgento/catalog_product')->associateProducts($product, $simpleSkus, $priceChanges);
61
+ }
62
+ }
63
+
64
+ /**
65
+ * Retrieve product info.
66
+ * Optional attributes configurable_attributes_data and configurable_products_data
67
+ * show info on children products and confiurable options
68
+ *
69
+ * @param int|string $productId
70
+ * @param string|int $store
71
+ * @param stdClass $attributes
72
+ * @param string $identifierType (sku or null)
73
+ * @return array
74
+ */
75
+ public function info($productId, $store = null, $attributes = null, $identifierType = null)
76
+ {
77
+ $product = $this->_getProduct($productId, $store, $identifierType);
78
+ $all_attributes = in_array('*', $attributes);
79
+
80
+ $result = array(// Basic product data
81
+ 'product_id' => $product->getId(),
82
+ 'sku' => $product->getSku(),
83
+ 'set' => $product->getAttributeSetId(),
84
+ 'type' => $product->getTypeId(),
85
+ 'categories' => $product->getCategoryIds(),
86
+ 'websites' => $product->getWebsiteIds()
87
+ );
88
+
89
+ foreach ($product->getTypeInstance(true)->getEditableAttributes($product) as $attribute) {
90
+ if ($this->_isAllowedAttribute($attribute, $attributes) || $all_attributes) {
91
+ $result[$attribute->getAttributeCode()] = $product->getData(
92
+ $attribute->getAttributeCode());
93
+ }
94
+ }
95
+ return $this->infoResult($result, $product, $attributes, $store, $all_attributes);
96
+ }
97
+
98
+ public function infoResult($result, $product, $attributes, $store, $all_attributes)
99
+ {
100
+ $productId = $product->getId();
101
+ if (in_array('url_complete', $attributes) || $all_attributes) {
102
+ $result['url_complete'] = $product->setStoreId($store)->getProductUrl();
103
+ }
104
+ if (in_array('stock_data', $attributes) || $all_attributes) {
105
+ $result['stock_data'] = Mage::getSingleton('Mage_CatalogInventory_Model_Stock_Item_Api')->items($productId);
106
+ }
107
+ if (in_array('images', $attributes) || $all_attributes) {
108
+ $result['images'] = Mage::getSingleton('Mage_Catalog_Model_Product_Attribute_Media_Api')->items($productId, $store);
109
+ }
110
+ if (!$product->isSuper() && (in_array('parent_sku', $attributes) || $all_attributes)) {
111
+ $parentIds = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId());
112
+ if (!$parentIds)
113
+ $parentIds = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($product->getId());
114
+ if (isset($parentIds[0])) {
115
+ $parent = Mage::getModel('catalog/product')->load($parentIds[0]);
116
+ $result['parent_sku'] = $parent->getSku();
117
+ }
118
+ } elseif ($product->isConfigurable()) {
119
+ $attributesData = $product->getTypeInstance()->getConfigurableAttributesAsArray();
120
+ // configurable_options
121
+ if (in_array('configurable_attributes_data', $attributes) || $all_attributes) {
122
+ $options = array();
123
+ $k = 0;
124
+ foreach ($attributesData as $attribute) {
125
+ $options[$k]['code'] = $attribute['attribute_code'];
126
+ foreach ($attribute['values'] as $value) {
127
+ $value['attribute_code'] = $attribute['attribute_code'];
128
+ $options[$k]['options'][] = $value;
129
+ }
130
+ $k++;
131
+ }
132
+ $result['configurable_attributes_data'] = $options;
133
+ }
134
+ // children
135
+ if (in_array('configurable_products_data', $attributes) || $all_attributes) {
136
+ // @todo use $childProducts = $product->getTypeInstance()->getUsedProducts();
137
+ $childProducts = Mage::getModel('catalog/product_type_configurable')
138
+ ->getUsedProducts(null, $product);
139
+ $skus = array();
140
+ $i = 0;
141
+ foreach ($childProducts as $childProduct) {
142
+ $skus[$i]['sku'] = $childProduct->getSku();
143
+ $j = 0;
144
+ foreach ($attributesData as $attribute) {
145
+ $skus[$i]['options'][$j]['label'] = $attribute['label'];
146
+ $skus[$i]['options'][$j]['attribute_code'] = $attribute['attribute_code'];
147
+ $skus[$i]['options'][$j]['value_index'] = $childProduct[$attribute['attribute_code']];
148
+ $j++;
149
+ }
150
+ $i++;
151
+ }
152
+ $result['configurable_products_data'] = $skus;
153
+ }
154
+ }
155
+ return $result;
156
+ }
157
+
158
+ /**
159
+
160
+ * Retrieve list of products with basic info (id, sku, type, set, name)
161
+
162
+ *
163
+
164
+ * @param null|object|array $filters
165
+ * @param string|int $store
166
+ * @param string productUpdatedAt timestamp to list only products with updated qty
167
+
168
+ * @return array
169
+
170
+ */
171
+ public function items($filters = null, $store = null)
172
+ {
173
+
174
+ $collection = Mage::getModel('catalog/product')->getCollection()
175
+ ->addStoreFilter($this->_getStoreId($store))
176
+ ->addAttributeToSelect('name')
177
+ ->addAttributeToSelect('price');
178
+
179
+ /** @var $apiHelper Mage_Api_Helper_Data */
180
+ $apiHelper = Mage::helper('api');
181
+ $filters = $apiHelper->parseFilters($filters, $this->_filtersMap);
182
+ if (isset($filters['updated_at'])) {
183
+ $methods = array(
184
+ 'lt' => '<',
185
+ 'gt' => '>',
186
+ 'eq' => '=',
187
+ 'lteq' => '<=',
188
+ 'gteq' => '>=',
189
+ 'neq' => '<>'
190
+ );
191
+ // Find all the products with qty modified after productUpdatedAt OR changed
192
+ $updatedAt = $filters['updated_at'];
193
+ $condition = array_keys($updatedAt);
194
+ $value = array_values($updatedAt);
195
+ $order_item_table = Mage::getSingleton('core/resource')->getTableName('sales/order_item');
196
+ $collection
197
+ ->getSelect()
198
+ ->joinLeft(
199
+ array('order_item' => $order_item_table), 'order_item.product_id = entity_id', array('item_updated_at' => 'order_item.updated_at')
200
+ )
201
+ ->where("order_item.updated_at {$methods[$condition[0]]} '{$value[0]}' OR e.updated_at {$methods[$condition[0]]} '{$value[0]}'")
202
+ ->group('sku')
203
+ ;
204
+ unset($filters['updated_at']);
205
+ }
206
+ try {
207
+ foreach ($filters as $field => $value) {
208
+ $collection->addFieldToFilter($field, $value);
209
+ }
210
+ } catch (Mage_Core_Exception $e) {
211
+
212
+ $this->_fault('filters_invalid', $e->getMessage());
213
+ }
214
+
215
+ $result = array();
216
+
217
+ foreach ($collection as $product) {
218
+ $stock_item = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
219
+ $qty = $stock_item->getQty();
220
+ $details = array(
221
+ 'product_id' => $product->getId(),
222
+ 'sku' => $product->getSku(),
223
+ 'name' => $product->getName(),
224
+ 'set' => $product->getAttributeSetId(),
225
+ 'type' => $product->getTypeId(),
226
+ 'category_ids' => $product->getCategoryIds(),
227
+ 'website_ids' => $product->getWebsiteIds(),
228
+ 'available_quantity' => $qty,
229
+ 'price' => $product->getPrice()
230
+ );
231
+
232
+ $result[] = $details;
233
+ }
234
+
235
+ return $result;
236
+ }
237
+
238
+ }
app/code/local/CloudConversion/CloudGento/Model/Catalog/Product/Api/V2.php ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Extension of Magento Soap API V2
5
+ *
6
+ * @package CloudConversion
7
+ * @author Andrea De Pirro <andrea.depirro@yameveo.com>
8
+ * @author Johann Reinke @johannreinke
9
+ * @see Mage_Catalog_Model_Product_Api_V2
10
+ */
11
+ class CloudConversion_CloudGento_Model_Catalog_Product_Api_V2 extends Mage_Catalog_Model_Product_Api_V2
12
+ {
13
+
14
+ public function create($type, $set, $sku, $productData, $store = null)
15
+ {
16
+ // Allow attribute set name instead of id
17
+ if (is_string($set) && !is_numeric($set)) {
18
+ $set = Mage::helper('cloudconversion_cloudgento')->getAttributeSetIdByName($set);
19
+ }
20
+
21
+ return parent::create($type, $set, $sku, $productData, $store);
22
+ }
23
+
24
+ protected function _prepareDataForSave($product, $productData)
25
+ {
26
+ /* @var $product Mage_Catalog_Model_Product */
27
+
28
+ if (property_exists($productData, 'categories')) {
29
+ $categoryIds = Mage::helper('cloudconversion_cloudgento/catalog_product')
30
+ ->getCategoryIdsByNames((array) $productData->categories);
31
+ if (!empty($categoryIds)) {
32
+ $productData->categories = array_unique($categoryIds);
33
+ }
34
+ }
35
+
36
+ if (property_exists($productData, 'additional_attributes')) {
37
+ $singleDataExists = property_exists((object) $productData->additional_attributes, 'single_data');
38
+ $multiDataExists = property_exists((object) $productData->additional_attributes, 'multi_data');
39
+ if ($singleDataExists || $multiDataExists) {
40
+ if ($singleDataExists) {
41
+ foreach ($productData->additional_attributes->single_data as $_attribute) {
42
+ $_attrCode = $_attribute->key;
43
+ $productData->$_attrCode = Mage::helper('cloudconversion_cloudgento/catalog_product')
44
+ ->getOptionKeyByLabel($_attrCode, $_attribute->value);
45
+ }
46
+ }
47
+ if ($multiDataExists) {
48
+ foreach ($productData->additional_attributes->multi_data as $_attribute) {
49
+ $_attrCode = $_attribute->key;
50
+ $productData->$_attrCode = Mage::helper('cloudconversion_cloudgento/catalog_product')
51
+ ->getOptionKeyByLabel($_attrCode, $_attribute->value);
52
+ }
53
+ }
54
+ } else {
55
+ foreach ($productData->additional_attributes as $_attrCode => $_value) {
56
+ $productData->$_attrCode = Mage::helper('cloudconversion_cloudgento/catalog_product')
57
+ ->getOptionKeyByLabel($_attrCode, $_value);
58
+ }
59
+ }
60
+ unset($productData->additional_attributes);
61
+ }
62
+
63
+ if (property_exists($productData, 'website_ids')) {
64
+ $websiteIds = (array) $productData->website_ids;
65
+ foreach ($websiteIds as $i => $websiteId) {
66
+ if (!is_numeric($websiteId)) {
67
+ $website = Mage::app()->getWebsite($websiteId);
68
+ if ($website->getId()) {
69
+ $websiteIds[$i] = $website->getId();
70
+ }
71
+ }
72
+ }
73
+ $product->setWebsiteIds($websiteIds);
74
+ unset($productData->website_ids);
75
+ }
76
+
77
+ parent::_prepareDataForSave($product, $productData);
78
+
79
+ if (property_exists($productData, 'associated_skus')) {
80
+ $simpleSkus = (array) $productData->associated_skus;
81
+ $priceChanges = array();
82
+ if (property_exists($productData, 'price_changes')) {
83
+ if (key($productData->price_changes) === 0) {
84
+ $priceChanges = $productData->price_changes[0];
85
+ } else {
86
+ $priceChanges = $productData->price_changes;
87
+ }
88
+ }
89
+ Mage::helper('cloudconversion_cloudgento/catalog_product')->associateProducts($product, $simpleSkus, $priceChanges);
90
+ }
91
+ }
92
+
93
+ /**
94
+ * Retrieve product info.
95
+ * Optional attributes configurable_attributes_data and configurable_products_data
96
+ * show info on children products and confiurable options
97
+ *
98
+ * @param int|string $productId
99
+ * @param string|int $store
100
+ * @param stdClass $attributes
101
+ * @param string $identifierType (sku or null)
102
+ * @return array
103
+ */
104
+ public function info($productId, $store = null, $attributes = null, $identifierType = null)
105
+ {
106
+
107
+ $product = $this->_getProduct($productId, $store, $identifierType);
108
+ $all_attributes = in_array('*', $attributes->attributes);
109
+ $result = array(// Basic product data
110
+ 'product_id' => $product->getId(),
111
+ 'sku' => $product->getSku(),
112
+ 'set' => $product->getAttributeSetId(),
113
+ 'type' => $product->getTypeId(),
114
+ 'categories' => $product->getCategoryIds(),
115
+ 'websites' => $product->getWebsiteIds()
116
+ );
117
+
118
+ $allAttributes = array();
119
+ if (!empty($attributes->attributes)) {
120
+ $allAttributes = array_merge($allAttributes, $attributes->attributes);
121
+ } else {
122
+ foreach ($product->getTypeInstance(true)->getEditableAttributes($product) as $attribute) {
123
+ if ($this->_isAllowedAttribute($attribute, $attributes) || $all_attributes) {
124
+ $allAttributes[] = $attribute->getAttributeCode();
125
+ }
126
+ }
127
+ }
128
+
129
+ $_additionalAttributeCodes = array();
130
+ if (!empty($attributes->additional_attributes)) {
131
+ /* @var $_attributeCode string */
132
+ foreach ($attributes->additional_attributes as $_attributeCode) {
133
+ $allAttributes[] = $_attributeCode;
134
+ $_additionalAttributeCodes[] = $_attributeCode;
135
+ }
136
+ }
137
+
138
+ $_additionalAttribute = 0;
139
+ foreach ($product->getTypeInstance(true)->getEditableAttributes($product) as $attribute) {
140
+ if ($this->_isAllowedAttribute($attribute, $allAttributes) || $all_attributes) {
141
+ if (in_array($attribute->getAttributeCode(), $_additionalAttributeCodes) || $all_attributes) {
142
+ $result['additional_attributes'][$_additionalAttribute]['key'] = $attribute->getAttributeCode();
143
+ $result['additional_attributes'][$_additionalAttribute]['value'] = $product
144
+ ->getData($attribute->getAttributeCode());
145
+ $_additionalAttribute++;
146
+ } else {
147
+ $result[$attribute->getAttributeCode()] = $product->getData($attribute->getAttributeCode());
148
+ }
149
+ }
150
+ }
151
+ $standard_attributes = $attributes->attributes;
152
+ return Mage::getSingleton('CloudConversion_CloudGento_Model_Catalog_Product_Api')->infoResult($result, $product, $standard_attributes, $store, $all_attributes);
153
+ }
154
+
155
+ public function items($filters = null, $store = null)
156
+ {
157
+ return Mage::getSingleton('CloudConversion_CloudGento_Model_Catalog_Product_Api')->items($filters, $store);
158
+ }
159
+
160
+ }
app/code/local/CloudConversion/CloudGento/Model/Order/Api.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class CloudConversion_CloudGento_Model_Order_Api extends Mage_Sales_Model_Order_Api
4
+ {
5
+
6
+ /**
7
+ * Import orders
8
+ * Available via SOAP v2 only at the moment
9
+ */
10
+ public function import($orders)
11
+ {
12
+ $this->_fault('invalid_protocol');
13
+ }
14
+
15
+ }
app/code/local/CloudConversion/CloudGento/Model/Order/Api/V2.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class CloudConversion_CloudGento_Model_Order_Api_V2 extends Mage_Sales_Model_Order_Api_V2
4
+ {
5
+
6
+ /** @var array $_ordersImported */
7
+ protected $_ordersImported = array();
8
+
9
+ /** @var array $_ordersWithChild orders that have child relations */
10
+ protected $_ordersWithChild = array();
11
+
12
+ /** @var array $_ordersWithParent orders that have parent relation */
13
+ protected $_ordersWithParent = array();
14
+
15
+ /** @var $_orderResource Mage_Sales_Model_Mysql4_Order */
16
+ protected $_orderResource;
17
+
18
+ /** @var array $_fieldsMap */
19
+ protected $_fieldsMap = array();
20
+
21
+ /**
22
+ * Import orders
23
+ *
24
+ * @param array $orders sales orders
25
+ * @param bool $decrementInventory
26
+ * @return bool
27
+ */
28
+ public function import($orders, $decrementInventory = false)
29
+ {
30
+ Mage::helper('api')->toArray($orders);
31
+ $this->_fieldsMap = array(
32
+ //'forced_shipment_with_invoice' => 'forced_do_shipment_with_invoice',
33
+ //'payment_auth_expiration' => 'payment_authorization_expiration',
34
+ //'base_shipping_hidden_tax_amnt' => 'base_shipping_hidden_tax_amount'
35
+ );
36
+
37
+ if (is_array($orders) && count($orders)) {
38
+ $response = array('status' => 'Success');
39
+ $this->_orderResource = Mage::getResourceModel('sales/order');
40
+
41
+ $fails = 0;
42
+ $warnings = 0;
43
+ foreach ($orders as $order) {
44
+ $this->_mapFieldNames($order);
45
+ try {
46
+ $origOrderId = $order['order_id'];
47
+ if (isset($order['increment_id'])) {
48
+ $origIncrementId = $order['increment_id'];
49
+ if ($this->_orderResource->checkIncrementIdExists($order['increment_id'])) {
50
+ Mage::throwException(sprintf('Order #%s already imported', $order['increment_id']));
51
+ }
52
+ } else {
53
+ $origIncrementId = '';
54
+ $order['increment_id'] = Mage::getSingleton('eav/config')
55
+ ->getEntityType('order')
56
+ ->fetchNewIncrementId($order['store_id']);
57
+ }
58
+ try {
59
+ $orderId = $this->_orderResource->importOrder($order, $decrementInventory);
60
+ } catch (Exception $e) {
61
+ Mage::logException($e);
62
+ $this->_fault($e->getMessage());
63
+ }
64
+ $this->_ordersImported[$origOrderId] = array(
65
+ 'order_id' => $orderId,
66
+ 'original_increment_id' => $origIncrementId,
67
+ 'imported_increment_id' => $order['increment_id'],
68
+ 'warnings' => $this->_orderResource->getImportWarnings($orderId)
69
+ );
70
+ $warnings += count($this->_orderResource->getImportWarnings($orderId));
71
+
72
+ if (!empty($order['relation_child_id'])) {
73
+ $this->_ordersWithChild[$orderId] = $order['relation_child_id'];
74
+ }
75
+ if (!empty($order['relation_parent_id'])) {
76
+ $this->_ordersWithParent[$orderId] = $order['relation_parent_id'];
77
+ }
78
+ Mage::dispatchEvent('cloudconversion_order_import', array('order_id' => $orderId));
79
+ } catch (Exception $e) {
80
+ $this->_ordersImported[$origOrderId] = array(
81
+ 'original_increment_id' => $origIncrementId,
82
+ 'imported_increment_id' => '',
83
+ 'error' => $e->getMessage()
84
+ );
85
+ $fails++;
86
+ }
87
+ }
88
+
89
+ if ($fails > 0) {
90
+ $response['status'] = 'Fail';
91
+ if ($fails < count($orders)) {
92
+ $response['status'] = 'Partial fail';
93
+ }
94
+ } else if ($warnings > 0) {
95
+ $response['status'] = 'Partial fail';
96
+ }
97
+
98
+ // Restore parent/child relations and populate aggregated grid table
99
+ try {
100
+ $this->_restoreRelations();
101
+
102
+ $importedOrderIds = array();
103
+ foreach ($this->_ordersImported as $orderData) {
104
+ if (isset($orderData['order_id'])) {
105
+ $importedOrderIds[] = $orderData['order_id'];
106
+ }
107
+ }
108
+ $this->_orderResource->updateGridRecords($importedOrderIds);
109
+ } catch (Exception $e) {
110
+ $response['status'] = 'Partial Fail';
111
+ }
112
+
113
+ $response['result'] = $this->_ordersImported;
114
+ return $response;
115
+ } else {
116
+ $this->_fault('data_invalid');
117
+ }
118
+ }
119
+
120
+ /**
121
+ * Map field names from newest database structure (Magento CE) to their older aliases (Magento GO)
122
+ *
123
+ * @param array $data
124
+ * @return void
125
+ */
126
+ protected function _mapFieldNames(&$data)
127
+ {
128
+ foreach ($this->_fieldsMap as $fieldToMap => $alias) {
129
+ $data[$alias] = $data[$fieldToMap];
130
+ unset($data[$fieldToMap]);
131
+ }
132
+ }
133
+
134
+ /**
135
+ * Restore relations between orders
136
+ */
137
+ protected function _restoreRelations()
138
+ {
139
+ foreach ($this->_ordersWithChild as $orderId => $oldChildOrderId) {
140
+ if (isset($this->_ordersImported[$oldChildOrderId])
141
+ && !empty($this->_ordersImported[$oldChildOrderId]['imported_increment_id'])) {
142
+ try {
143
+ $this->_orderResource->updateChildRelation($orderId, $this->_ordersImported[$oldChildOrderId]['order_id'], $this->_ordersImported[$oldChildOrderId]['imported_increment_id']);
144
+ } catch (Exception $e) {
145
+ $this->_ordersImported[$oldChildOrderId]['warnings'][] = 'Could not restore order child relation';
146
+ throw $e;
147
+ }
148
+ }
149
+ }
150
+ foreach ($this->_ordersWithParent as $orderId => $oldParentOrderId) {
151
+ if (isset($this->_ordersImported[$oldParentOrderId])
152
+ && !empty($this->_ordersImported[$oldParentOrderId]['imported_increment_id'])) {
153
+ try {
154
+ $this->_orderResource->updateParentRelation($orderId, $this->_ordersImported[$oldParentOrderId]['order_id'], $this->_ordersImported[$oldParentOrderId]['imported_increment_id']);
155
+ } catch (Exception $e) {
156
+ $this->_ordersImported[$oldParentOrderId]['warnings'][] = 'Could not restore order parent relation';
157
+ throw $e;
158
+ }
159
+ }
160
+ }
161
+ }
162
+
163
+ }
app/code/local/CloudConversion/CloudGento/Model/Order/Shipment/Api.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class CloudConversion_CloudGento_Model_Order_Shipment_Api extends Mage_Sales_Model_Order_Shipment_Api
4
+ {
5
+
6
+ public function items($filters = null)
7
+ {
8
+ $shipments = array();
9
+ $shipmentCollection = Mage::getResourceModel('sales/order_shipment_collection')
10
+ ->addAttributeToSelect('increment_id')
11
+ ->addAttributeToSelect('created_at')
12
+ ->addAttributeToSelect('total_qty')
13
+ ->addAttributeToSelect('order_id')
14
+ ->joinAttribute('shipping_firstname', 'order_address/firstname', 'shipping_address_id', null, 'left')
15
+ ->joinAttribute('shipping_lastname', 'order_address/lastname', 'shipping_address_id', null, 'left')
16
+ ->joinAttribute('order_increment_id', 'order/increment_id', 'order_id', null, 'left')
17
+ ->joinAttribute('order_created_at', 'order/created_at', 'order_id', null, 'left');
18
+ ;
19
+ /** @var $apiHelper Mage_Api_Helper_Data */
20
+ $apiHelper = Mage::helper('api');
21
+ try {
22
+ $filters = $apiHelper->parseFilters($filters, $this->_attributesMap['shipment']);
23
+ foreach ($filters as $field => $value) {
24
+ $shipmentCollection->addFieldToFilter($field, $value);
25
+ }
26
+ } catch (Mage_Core_Exception $e) {
27
+ $this->_fault('filters_invalid', $e->getMessage());
28
+ }
29
+ foreach ($shipmentCollection as $shipment) {
30
+ $attributes = $this->_getAttributes($shipment, 'shipment');
31
+ $order = $shipment->getOrder();
32
+ $attributes['order_increment_id'] = $order->getIncrementId();
33
+ $attributes['shipping_description'] = $order->getShippingDescription();
34
+ $shipments[] = $attributes;
35
+ }
36
+
37
+ return $shipments;
38
+ }
39
+
40
+ }
41
+
app/code/local/CloudConversion/CloudGento/Model/Order/Shipment/Api/V2.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class CloudConversion_CloudGento_Model_Order_Shipment_Api_V2 extends CloudConversion_CloudGento_Model_Order_Shipment_Api
4
+ {
5
+
6
+ }
app/code/local/CloudConversion/CloudGento/Model/Resource/Message.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class CloudConversion_CloudGento_Model_Resource_Message extends Mage_GiftMessage_Model_Resource_Message
4
+ {
5
+
6
+ /**
7
+ * Import gift message
8
+ *
9
+ * @param array $data columns to import
10
+ * @return inserted id
11
+ */
12
+ public function import($data)
13
+ {
14
+ $write = $this->_getWriteAdapter();
15
+ $write->insertArray($this->getMainTable(), array_keys($data), array($data));
16
+ return $write->lastInsertId();
17
+ }
18
+
19
+ }
app/code/local/CloudConversion/CloudGento/Model/Resource/Order.php ADDED
@@ -0,0 +1,432 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class CloudConversion_CloudGento_Model_Resource_Order extends Mage_Sales_Model_Resource_Order
4
+ {
5
+
6
+ /** @var array $_importedItems */
7
+ protected $_importedItems = array();
8
+
9
+ /** @var array $_itemsWithParent order items that have parent items */
10
+ protected $_itemsWithParent = array();
11
+
12
+ /** @var array $_importWarnings */
13
+ protected $_importWarnings = array();
14
+
15
+ /** @var array $_productTypes */
16
+ protected $_productTypes = array();
17
+
18
+ public function import($data)
19
+ {
20
+ $write = $this->_getWriteAdapter();
21
+ $write->insertArray($this->getMainTable(), array_keys($data), array($data));
22
+ return $write->lastInsertId();
23
+ }
24
+
25
+ /**
26
+ * Update shipping address relation
27
+ *
28
+ * @param int $orderId
29
+ * @param int $addressId
30
+ * @return void
31
+ */
32
+ public function updateShippingAddressId($orderId, $addressId)
33
+ {
34
+ $write = $this->_getWriteAdapter();
35
+ $write->update($this->getMainTable(), array('shipping_address_id' => $addressId), array('entity_id = ? ' => $orderId));
36
+ }
37
+
38
+ /**
39
+ * Update billing address relation
40
+ *
41
+ * @param int $orderId
42
+ * @param int $addressId
43
+ * @return void
44
+ */
45
+ public function updateBillingAddressId($orderId, $addressId)
46
+ {
47
+ $write = $this->_getWriteAdapter();
48
+ $write->update($this->getMainTable(), array('billing_address_id' => $addressId), array('entity_id = ? ' => $orderId));
49
+ }
50
+
51
+ /**
52
+ * @param int $orderId
53
+ * @param int $childOrderId
54
+ * @param string $childOrderIncrementId
55
+ * @return void
56
+ */
57
+ public function updateChildRelation($orderId, $childOrderId, $childOrderIncrementId)
58
+ {
59
+ $write = $this->_getWriteAdapter();
60
+ $write->update($this->getMainTable(), array('relation_child_id' => $childOrderId, 'relation_child_real_id' => $childOrderIncrementId), array('entity_id = ? ' => $orderId));
61
+ }
62
+
63
+ /**
64
+ * @param int $orderId
65
+ * @param int $parentOrderId
66
+ * @param string $parentOrderIncrementId
67
+ * @return void
68
+ */
69
+ public function updateParentRelation($orderId, $parentOrderId, $parentOrderIncrementId)
70
+ {
71
+ $write = $this->_getWriteAdapter();
72
+ $write->update($this->getMainTable(), array('relation_parent_id' => $parentOrderId, 'relation_parent_real_id' => $parentOrderIncrementId), array('entity_id = ? ' => $orderId));
73
+ }
74
+
75
+ /**
76
+ * Check if order with given increment id already exists
77
+ *
78
+ * @param int $incrementId
79
+ * @return bool
80
+ */
81
+ public function checkIncrementIdExists($incrementId)
82
+ {
83
+ $adapter = $this->getReadConnection();
84
+ $select = $adapter->select()
85
+ ->from($this->getMainTable(), array("increment_id"))
86
+ ->where('increment_id = ?', $incrementId);
87
+ if ($adapter->fetchOne($select)) {
88
+ return true;
89
+ }
90
+ return false;
91
+ }
92
+
93
+ /**
94
+ * Import order in transaction
95
+ *
96
+ * @throws Exception
97
+ * @param array $order
98
+ * @return int
99
+ */
100
+ public function importOrder($order, $decrementInventory = false)
101
+ {
102
+ $store = Mage::app()->getDefaultStoreView();
103
+ /** @var $customer Mage_Customer_Model_Customer */
104
+ $customer = Mage::getModel('customer/customer')
105
+ ->setWebsiteId($store->getWebsiteId())
106
+ ->loadByEmail($order['customer_email']);
107
+
108
+ $order['customer_id'] = $customer->getId();
109
+ $origStoreId = $order['store_id'];
110
+ $order['store_id'] = (!isset($order['store_id']) || $order['store_id'] == 0) ? $store->getId() : $order['store_id'];
111
+ $order['quote_id'] = null;
112
+
113
+ // Try to associate customer group
114
+ $groupModel = Mage::getModel('customer/group');
115
+ $groupModel->load($order['customer_group_code'], 'customer_group_code');
116
+ if ($groupModel->getId()) {
117
+ $order['customer_group_id'] = $groupModel->getId();
118
+ } else {
119
+ $order['customer_group_id'] = -1;
120
+ }
121
+ unset($order['customer_group_code']);
122
+ // Try to associate customer gender
123
+ $order['customer_gender'] = $this->_associateCustomerGender($order['customer_gender_value']);
124
+ unset($order['customer_gender_value']);
125
+
126
+ // If order has custom status - set default status of order state and give warning
127
+ $newStatus = null;
128
+ $oldStatus = null;
129
+ if (!in_array($order['status'], array_keys(Mage::getSingleton('sales/order_config')->getStatuses()))) {
130
+ $newStatus = Mage::getSingleton('sales/order_config')->getStateDefaultStatus($order['state']);
131
+ $oldStatus = $order['status'];
132
+ $order['status'] = $newStatus;
133
+ }
134
+
135
+ $addressData = $order['address'];
136
+ $itemsData = $order['items'];
137
+ $paymentData = $order['payment'];
138
+ $historyData = $order['history'];
139
+ unset($order['address']);
140
+ unset($order['items']);
141
+ unset($order['payment']);
142
+ unset($order['history']);
143
+ unset($order['order_id']);
144
+
145
+ $this->beginTransaction();
146
+ try {
147
+ $this->_importGiftMessage($order);
148
+ $orderId = $this->import($order);
149
+ // todo dispatch the event that updates stats if it exists
150
+ // $orderObject = Mage::getModel('sales/order')->load($orderId);
151
+ // $quoteObject = Mage::getModel('sales/quote')->load($order['quote_id']);
152
+ //Mage::log(var_export($orderObject, true));
153
+ // Mage::dispatchEvent(
154
+ // 'checkout_submit_all_after',
155
+ // array('order' => $orderObject, 'quote' => $quoteObject)
156
+ //);
157
+ if ($newStatus) {
158
+ $this->addImportWarning($orderId, sprintf('Custom status "%s" was not found. Default status "%s" was set instead.', $oldStatus, Mage::getSingleton('sales/order_config')->getStatusLabel($newStatus)));
159
+ }
160
+
161
+ if (!$customer->getId()) {
162
+ $this->addImportWarning($orderId, sprintf('Customer with email "%s" was not found', $order['customer_email']));
163
+ }
164
+
165
+ $this->_importAddress($orderId, $addressData, $customer->getId());
166
+ $this->_importItems($orderId, $itemsData, $order['state'], $store->getId(), $decrementInventory);
167
+ $this->_restoreItemsRelations();
168
+ $this->_importPayments($orderId, $paymentData);
169
+ $this->_importHistory($orderId, $historyData);
170
+
171
+ // Increase or create last_increment_id
172
+ $storeModel = Mage::getModel('core/store')->load($origStoreId);
173
+ if ($storeModel->getId() && is_numeric($order['increment_id'])) {
174
+ $entityType = Mage::getSingleton('eav/config')->getEntityType('order')->getId();
175
+ $entityStoreConfig = Mage::getModel('eav/entity_store')->loadByEntityStore($entityType, $origStoreId);
176
+ if (!$entityStoreConfig->getId()) {
177
+ $entityStoreConfig
178
+ ->setEntityTypeId($entityType)
179
+ ->setStoreId($origStoreId)
180
+ ->setIncrementPrefix($origStoreId)
181
+ ->setIncrementLastId($order['increment_id'])
182
+ ->save();
183
+ } else if ($entityStoreConfig->getIncrementLastId() < $order['increment_id']) {
184
+ $entityStoreConfig->setIncrementLastId($order['increment_id']);
185
+ $entityStoreConfig->save();
186
+ }
187
+ }
188
+
189
+ $this->commit();
190
+ } catch (Exception $e) {
191
+ $this->rollBack();
192
+ throw $e;
193
+ }
194
+ return $orderId;
195
+ }
196
+
197
+ /**
198
+ * Try to associate customer gender attribute from CE
199
+ *
200
+ * @param string $value text value of gender attribute
201
+ * @return null
202
+ */
203
+ protected function _associateCustomerGender($value)
204
+ {
205
+ /** @var $attribute Mage_Eav_Model_Entity_Attribute */
206
+ $attribute = Mage::getModel('eav/entity_attribute')
207
+ ->loadByCode('customer', 'gender');
208
+ $optionId = null;
209
+ if ($attribute->getId()) {
210
+ $optionId = $attribute->getSource()->getOptionId($value);
211
+ }
212
+
213
+ return $optionId;
214
+ }
215
+
216
+ /**
217
+ * Import gift message for order or order item
218
+ *
219
+ * @param array $data
220
+ */
221
+ protected function _importGiftMessage(&$data)
222
+ {
223
+ if ($data['gift_message_id']) {
224
+ $giftMessage = array(
225
+ 'customer_id' => (int) (isset($data['customer_id']) ? $data['customer_id'] : null),
226
+ 'sender' => $data['gift_sender'],
227
+ 'recipient' => $data['gift_recipient'],
228
+ 'message' => $data['gift_message']
229
+ );
230
+ try {
231
+ $giftMessageId = Mage::getResourceModel('giftmessage/message')->import($giftMessage);
232
+ $data['gift_message_id'] = $giftMessageId;
233
+ } catch (Exception $e) {
234
+ Mage::logException($e);
235
+ }
236
+ }
237
+ unset($data['gift_sender']);
238
+ unset($data['gift_recipient']);
239
+ unset($data['gift_message']);
240
+ }
241
+
242
+ /**
243
+ * Import address data to order
244
+ *
245
+ * @param $orderId
246
+ * @param $data
247
+ * @param int $customerId
248
+ */
249
+ protected function _importAddress($orderId, $data, $customerId)
250
+ {
251
+ /** @var $addressResource Mage_Sales_Model_Mysql4_Order_Address */
252
+ $addressResource = Mage::getResourceModel('sales/order_address');
253
+ foreach ($data as $address) {
254
+ $address['parent_id'] = $orderId;
255
+ $address['quote_address_id'] = null;
256
+ $address['customer_address_id'] = null;
257
+ $address['customer_id'] = $customerId;
258
+ $addressId = $addressResource->import($address);
259
+ if ($address['address_type'] == 'billing') {
260
+ $this->updateBillingAddressId($orderId, $addressId);
261
+ } else {
262
+ $this->updateShippingAddressId($orderId, $addressId);
263
+ }
264
+ }
265
+ }
266
+
267
+ /**
268
+ * Import order products
269
+ *
270
+ * @param $orderId
271
+ * @param $data
272
+ * @param string $orderState
273
+ * @param int $storeId
274
+ */
275
+ protected function _importItems($orderId, $data, $orderState, $storeId, $decrementInventory = false)
276
+ {
277
+ /** @var $itemResource Mage_Sales_Model_Mysql4_Order_Item */
278
+ $itemResource = Mage::getResourceModel('sales/order_item');
279
+ foreach ($data as $item) {
280
+ if (!in_array($item['product_type'], $this->_getProductTypes()) && $orderState != 'closed'
281
+ && $orderState != 'canceled') {
282
+ Mage::throwException('Can not import order because it contains items with unknown product type.');
283
+ }
284
+
285
+ $item['order_id'] = $orderId;
286
+ $item['store_id'] = $storeId;
287
+ $item['quote_item_id'] = null;
288
+ $product = $itemResource->getProductIdBySku($item['sku'], $item['product_type']);
289
+ $productModel = Mage::getModel('catalog/product')->load($product['entity_id']);
290
+ if ($product) {
291
+ $item['product_id'] = $product['entity_id'];
292
+ $item['weight'] = $productModel->getWeight() * $item['qty_ordered'];
293
+ } else {
294
+ $item['product_id'] = null;
295
+ // $this->addImportWarning($orderId, sprintf('Product with SKU "%s" was not found', $item['sku']));
296
+ throw new Mage_Api_Exception('SKU does not exist');
297
+ }
298
+ $origItemId = $item['item_id'];
299
+ unset($item['item_id']);
300
+ unset($item['base_weee_tax_applied_row_amnt']);
301
+
302
+ // Try to import gift message
303
+ $this->_importGiftMessage($item);
304
+ $itemId = $itemResource->import($item);
305
+ $this->_importedItems[$origItemId] = $itemId;
306
+ if ($decrementInventory)
307
+ $this->_updateInventory($item['product_id'], $item['qty_ordered'], $orderId, $item['sku']);
308
+ if (!empty($item['parent_item_id'])) {
309
+ $this->_itemsWithParent[$itemId] = $item['parent_item_id'];
310
+ }
311
+ }
312
+ }
313
+
314
+ /**
315
+ * Restore relations between order items
316
+ */
317
+ protected function _restoreItemsRelations()
318
+ {
319
+ foreach ($this->_itemsWithParent as $itemId => $oldItemId) {
320
+ if (isset($this->_importedItems[$oldItemId])) {
321
+ try {
322
+ Mage::getResourceModel('sales/order_item')->updateParentRelation($itemId, $this->_importedItems[$oldItemId]);
323
+ } catch (Exception $e) {
324
+ Mage::logException($e);
325
+ }
326
+ }
327
+ }
328
+ }
329
+
330
+ /**
331
+ * Get available product types
332
+ *
333
+ * @return array
334
+ */
335
+ protected function _getProductTypes()
336
+ {
337
+ if (!count($this->_productTypes)) {
338
+ $productTypeCollection = Mage::getModel('catalog/product_type')
339
+ ->getOptionArray();
340
+
341
+ foreach ($productTypeCollection as $id => $type) {
342
+ $this->_productTypes[] = $id;
343
+ }
344
+ }
345
+
346
+ return $this->_productTypes;
347
+ }
348
+
349
+ /**
350
+ * Import order payments
351
+ *
352
+ * @param $orderId
353
+ * @param $data
354
+ */
355
+ protected function _importPayments($orderId, $data)
356
+ {
357
+ /** @var $paymentResource Mage_Sales_Model_Mysql4_Order_Payment */
358
+ $paymentResource = Mage::getResourceModel('sales/order_payment');
359
+ foreach ($data as $payment) {
360
+ $payment['parent_id'] = $orderId;
361
+ $payment['cc_number_enc'] = null;
362
+ $paymentResource->import($payment);
363
+ }
364
+ }
365
+
366
+ /**
367
+ * Import order status history
368
+ *
369
+ * @param $orderId
370
+ * @param $data
371
+ */
372
+ protected function _importHistory($orderId, $data)
373
+ {
374
+ /** @var $historyResource Mage_Sales_Model_Mysql4_Order_Status_History */
375
+ $historyResource = Mage::getResourceModel('sales/order_status_history');
376
+ foreach ($data as $history) {
377
+ $history['parent_id'] = $orderId;
378
+ unset($history['entity_name']);
379
+ $historyResource->import($history);
380
+ }
381
+ }
382
+
383
+ /**
384
+ * Add warning message to imported order
385
+ *
386
+ * @param int $orderId
387
+ * @param string $message
388
+ * @return void
389
+ */
390
+ protected function addImportWarning($orderId, $message)
391
+ {
392
+ $this->_importWarnings[$orderId][] = $message;
393
+ }
394
+
395
+ /**
396
+ * Get warnings for imported order
397
+ *
398
+ * @param $orderId
399
+ * @return array
400
+ */
401
+ public function getImportWarnings($orderId)
402
+ {
403
+ $result = array();
404
+ if (isset($this->_importWarnings[$orderId])) {
405
+ $result = $this->_importWarnings[$orderId];
406
+ }
407
+ return $result;
408
+ }
409
+
410
+ /**
411
+ * Subtract quantity ordered for inventory
412
+ * @param type $itemId
413
+ * @param type $qtyOrdered
414
+ * @param string $orderId
415
+ */
416
+ private function _updateInventory($itemId, $qtyOrdered, $orderId, $sku)
417
+ {
418
+ $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($itemId);
419
+ if ($stockItem->verifyStock()) {
420
+ $stockItem->subtractQty($qtyOrdered);
421
+ if ($stockItem->getQty() < 0) {
422
+ $this->addImportWarning($orderId, "Product $sku is backordered");
423
+ }
424
+ $stockItem->save();
425
+ }
426
+ else {
427
+ throw new Exception("Product $sku can't be backordered");
428
+ }
429
+
430
+ }
431
+
432
+ }
app/code/local/CloudConversion/CloudGento/Model/Resource/Order/Address.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class CloudConversion_CloudGento_Model_Resource_Order_Address extends Mage_Sales_Model_Resource_Order_Address
4
+ {
5
+ public function import($data)
6
+ {
7
+ $write = $this->_getWriteAdapter();
8
+ $region = Mage::getModel('directory/region')->getCollection()->addFieldToFilter('code', $data['region'])->getFirstItem();
9
+ if($region->getRegionId()) {
10
+ $data['region'] = $region->getDefaultName();
11
+ }
12
+ $write->insertArray($this->getMainTable(), array_keys($data), array($data));
13
+ return $write->lastInsertId();
14
+ }
15
+ }
app/code/local/CloudConversion/CloudGento/Model/Resource/Order/Item.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class CloudConversion_CloudGento_Model_Resource_Order_Item extends Mage_Sales_Model_Resource_Order_Item
4
+ {
5
+ public function import($data)
6
+ {
7
+ $write = $this->_getWriteAdapter();
8
+ $write->insertArray($this->getMainTable(), array_keys($data), array($data));
9
+ return $write->lastInsertId();
10
+ }
11
+
12
+ /**
13
+ * Load product id by sku and product type
14
+ *
15
+ * @param $sku
16
+ * @param $productType
17
+ * @return array
18
+ */
19
+ public function getProductIdBySku($sku, $productType)
20
+ {
21
+ $read = $this->_getReadAdapter();
22
+ $select = $read->select()
23
+ ->from($this->getTable('catalog/product'), 'entity_id')
24
+ ->where('sku = ?', $sku)
25
+ ->where('type_id = ?', $productType);
26
+
27
+ return $read->fetchRow($select);
28
+ }
29
+
30
+ /**
31
+ * Update relations between order items
32
+ *
33
+ * @param int $itemId
34
+ * @param int $parentItemId
35
+ * @return void
36
+ */
37
+ public function updateParentRelation($itemId, $parentItemId)
38
+ {
39
+ $write = $this->_getWriteAdapter();
40
+ $write->update($this->getMainTable(), array('parent_item_id' => $parentItemId), array('item_id = ? ' => $itemId));
41
+ }
42
+
43
+ }
app/code/local/CloudConversion/CloudGento/Model/Resource/Order/Payment.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class CloudConversion_CloudGento_Model_Resource_Order_Payment extends Mage_Sales_Model_Resource_Order_Payment
4
+ {
5
+ public function import($data)
6
+ {
7
+ $write = $this->_getWriteAdapter();
8
+ $write->insertArray($this->getMainTable(), array_keys($data), array($data));
9
+ return $write->lastInsertId();
10
+ }
11
+ }
app/code/local/CloudConversion/CloudGento/Model/Resource/Order/Status/History.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class CloudConversion_CloudGento_Model_Resource_Order_Status_History extends Mage_Sales_Model_Resource_Order_Status_History
4
+ {
5
+ public function import($data)
6
+ {
7
+ $write = $this->_getWriteAdapter();
8
+ $write->insertArray($this->getMainTable(), array_keys($data), array($data));
9
+ return $write->lastInsertId();
10
+ }
11
+ }
app/code/local/CloudConversion/CloudGento/etc/api.xml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <api>
4
+ <resources>
5
+ <sales_order translate="title" module="sales">
6
+ <methods>
7
+ <import translate="title" module="sales">
8
+ <title>Import orders</title>
9
+ <acl>sales/order/import</acl>
10
+ </import>
11
+ </methods>
12
+ <faults module="sales">
13
+ <import_failed>
14
+ <code>105</code>
15
+ <message>Import failed.</message>
16
+ </import_failed>
17
+ <invalid_protocol>
18
+ <code>106</code>
19
+ <message>This operation available through SOAP v2 only.</message>
20
+ </invalid_protocol>
21
+ <unexisting_sku>
22
+ <code>107</code>
23
+ <message>Unexisting sku</message>
24
+ </unexisting_sku>
25
+ </faults>
26
+ </sales_order>
27
+ </resources>
28
+ <acl>
29
+ <resources>
30
+ <sales translate="title" module="sales">
31
+ <order translate="title" module="sales">
32
+ <import translate="title" module="sales">
33
+ <title>Import orders</title>
34
+ </import>
35
+ </order>
36
+ </sales>
37
+ </resources>
38
+ </acl>
39
+ </api>
40
+ </config>
41
+
app/code/local/CloudConversion/CloudGento/etc/config.xml ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <CloudConversion_CloudGento>
5
+ <version>0.1.0</version>
6
+ </CloudConversion_CloudGento>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <cloudconversion>
11
+ <class>CloudConversion_CloudGento_Model</class>
12
+ </cloudconversion>
13
+ <catalog>
14
+ <rewrite>
15
+ <product_api>CloudConversion_CloudGento_Model_Catalog_Product_Api</product_api>
16
+ <product_api_v2>CloudConversion_CloudGento_Model_Catalog_Product_Api_V2</product_api_v2>
17
+ </rewrite>
18
+ </catalog>
19
+ <sales>
20
+ <rewrite>
21
+ <order_api>CloudConversion_CloudGento_Model_Order_Api</order_api>
22
+ <order_api_v2>CloudConversion_CloudGento_Model_Order_Api_V2</order_api_v2>
23
+ <order_shipment_api>CloudConversion_CloudGento_Model_Order_Shipment_Api</order_shipment_api>
24
+ <order_shipment_api_v2>CloudConversion_CloudGento_Model_Order_Shipment_Api_V2</order_shipment_api_v2>
25
+ </rewrite>
26
+ </sales>
27
+ <sales_resource>
28
+ <rewrite>
29
+ <order>CloudConversion_CloudGento_Model_Resource_Order</order>
30
+ <order_item>CloudConversion_CloudGento_Model_Resource_Order_Item</order_item>
31
+ <order_address>CloudConversion_CloudGento_Model_Resource_Order_Address</order_address>
32
+ <order_payment>CloudConversion_CloudGento_Model_Resource_Order_Payment</order_payment>
33
+ <order_status_history>CloudConversion_CloudGento_Model_Resource_Order_Status_History</order_status_history>
34
+ </rewrite>
35
+ </sales_resource>
36
+ <giftmessage_resource>
37
+ <rewrite>
38
+ <message>CloudConversion_CloudGento_Model_Resource_Message</message>
39
+ </rewrite>
40
+ </giftmessage_resource>
41
+ </models>
42
+
43
+ <blocks>
44
+ <cloudconversion>
45
+ <class>CloudConversion_CloudGento_Block</class>
46
+ </cloudconversion>
47
+ </blocks>
48
+
49
+ <helpers>
50
+ <cloudconversion>
51
+ <class>CloudConversion_CloudGento_Helper</class>
52
+ </cloudconversion>
53
+ </helpers>
54
+
55
+ <resources>
56
+ <cloudconversion_write>
57
+ <connection>
58
+ <use>core_write</use>
59
+ </connection>
60
+ </cloudconversion_write>
61
+ <cloudconversion_read>
62
+ <connection>
63
+ <use>core_read</use>
64
+ </connection>
65
+ </cloudconversion_read>
66
+ </resources>
67
+ </global>
68
+ <admin>
69
+ <routers>
70
+ <cloudconversion>
71
+ <use>admin</use>
72
+ <args>
73
+ <module>CloudConversion_CloudGento</module>
74
+ <frontName>cloudconversion</frontName>
75
+ </args>
76
+ </cloudconversion>
77
+ </routers>
78
+ </admin>
79
+ <frontend>
80
+ <routers>
81
+ <cloudconversion>
82
+ <use>standard</use>
83
+ <args>
84
+ <module>CloudConversion_CloudGento</module>
85
+ <frontName>cloudconversion</frontName>
86
+ </args>
87
+ </cloudconversion>
88
+ </routers>
89
+ </frontend>
90
+ </config>
app/code/local/CloudConversion/CloudGento/etc/wsdl.xml ADDED
@@ -0,0 +1,500 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <definitions xmlns:typens="urn:{{var wsdl.name}}" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
3
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
4
+ xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
5
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
6
+ name="{{var wsdl.name}}" targetNamespace="urn:{{var wsdl.name}}">
7
+ <types>
8
+ <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Magento">
9
+ <complexType name="catalogProductCreateEntity">
10
+ <all>
11
+ <element name="associated_skus" type="typens:ArrayOfString" minOccurs="0"/>
12
+ <element name="price_changes" type="typens:associativeArray" minOccurs="0" />
13
+ </all>
14
+ </complexType>
15
+ <complexType name="catalogProductEntity">
16
+ <all>
17
+ <element name="price" type="xsd:double"/>
18
+ <element name="available_quantity" type="xsd:int"/>
19
+ </all>
20
+ </complexType>
21
+
22
+ <complexType name="catalogProductReturnEntity">
23
+ <all>
24
+ <element name="parent_sku" type="xsd:string" minOccurs="0"/>
25
+ <element name="url_complete" type="xsd:string" minOccurs="0"/>
26
+ <element name="configurable_products_data" type="typens:childrenEntityArray" minOccurs="0"/>
27
+ <element name="configurable_attributes_data" type="typens:configurableOptionsEntityArray" minOccurs="0"/>
28
+ <element name="stock_data" type="typens:catalogInventoryStockItemEntityArray" minOccurs="0"/>
29
+ <element name="images" type="typens:catalogProductImageEntityArray" minOccurs="0"/>
30
+ </all>
31
+ </complexType>
32
+ <complexType name="childrenEntityArray">
33
+ <complexContent>
34
+ <restriction base="soapenc:Array">
35
+ <attribute ref="soapenc:arrayType" wsdl:arrayType="typens:childrenEntity[]"/>
36
+ </restriction>
37
+ </complexContent>
38
+ </complexType>
39
+ <complexType name="childrenEntity">
40
+ <all>
41
+ <element name="sku" type="xsd:string" minOccurs="0"/>
42
+ <element name="options" type="typens:optionsEntityArray" minOccurs="0"/>
43
+ </all>
44
+ </complexType>
45
+ <complexType name="configurableOptionsEntityArray">
46
+ <complexContent>
47
+ <restriction base="soapenc:Array">
48
+ <attribute ref="soapenc:arrayType" wsdl:arrayType="typens:configurableOptionsEntity[]"/>
49
+ </restriction>
50
+ </complexContent>
51
+ </complexType>
52
+ <complexType name="configurableOptionsEntity">
53
+ <all>
54
+ <element name="code" type="xsd:string" minOccurs="0"/>
55
+ <element name="options" type="typens:optionsEntityArray" minOccurs="0"/>
56
+ </all>
57
+ </complexType>
58
+ <complexType name="optionsEntityArray">
59
+ <complexContent>
60
+ <restriction base="soapenc:Array">
61
+ <attribute ref="soapenc:arrayType" wsdl:arrayType="typens:optionsEntity[]"/>
62
+ </restriction>
63
+ </complexContent>
64
+ </complexType>
65
+ <complexType name="optionsEntity">
66
+ <all>
67
+ <element name="product_super_attribute_id" type="xsd:string" minOccurs="0"/>
68
+ <element name="value_index" type="xsd:string" minOccurs="0"/>
69
+ <element name="label" type="xsd:string" minOccurs="0"/>
70
+ <element name="default_label" type="xsd:string" minOccurs="0"/>
71
+ <element name="store_label" type="xsd:string" minOccurs="0"/>
72
+ <element name="is_percent" type="xsd:int" minOccurs="0"/>
73
+ <element name="pricing_value" type="xsd:double" minOccurs="0"/>
74
+ <element name="use_default_value" type="xsd:boolean" minOccurs="0"/>
75
+ <element name="attribute_code" type="xsd:string" minOccurs="0"/>
76
+ </all>
77
+ </complexType>
78
+ <complexType name="salesOrderExportArray">
79
+ <complexContent>
80
+ <restriction base="soapenc:Array">
81
+ <attribute ref="soapenc:arrayType" wsdl:arrayType="typens:salesOrderExportEntity[]"/>
82
+ </restriction>
83
+ </complexContent>
84
+ </complexType>
85
+ <complexType name="salesOrderExportEntity">
86
+ <all>
87
+ <element name="order_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
88
+ <element name="state" type="xsd:string" minOccurs="1" maxOccurs="1"/>
89
+ <element name="status" type="xsd:string" minOccurs="1" maxOccurs="1"/>
90
+ <element name="coupon_code" type="xsd:string" minOccurs="1" maxOccurs="1"/>
91
+ <element name="protect_code" type="xsd:string" minOccurs="1" maxOccurs="1"/>
92
+ <element name="shipping_description" type="xsd:string" minOccurs="1" maxOccurs="1"/>
93
+ <element name="is_virtual" type="xsd:string" minOccurs="1" maxOccurs="1"/>
94
+ <element name="store_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
95
+ <element name="customer_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
96
+ <element name="base_discount_amount" type="xsd:string" minOccurs="1" maxOccurs="1"/>
97
+ <element name="base_discount_canceled" type="xsd:string" minOccurs="1" maxOccurs="1"/>
98
+ <element name="base_discount_invoiced" type="xsd:string" minOccurs="1" maxOccurs="1"/>
99
+ <element name="base_discount_refunded" type="xsd:string" minOccurs="1" maxOccurs="1"/>
100
+ <element name="base_grand_total" type="xsd:string" minOccurs="1" maxOccurs="1"/>
101
+ <element name="base_shipping_amount" type="xsd:string" minOccurs="1" maxOccurs="1"/>
102
+ <element name="base_shipping_canceled" type="xsd:string" minOccurs="1" maxOccurs="1"/>
103
+ <element name="base_shipping_invoiced" type="xsd:string" minOccurs="1" maxOccurs="1"/>
104
+ <element name="base_shipping_refunded" type="xsd:string" minOccurs="1" maxOccurs="1"/>
105
+ <element name="base_shipping_tax_amount" type="xsd:string" minOccurs="1" maxOccurs="1"/>
106
+ <element name="base_shipping_tax_refunded" type="xsd:string" minOccurs="1" maxOccurs="1"/>
107
+ <element name="base_subtotal" type="xsd:string" minOccurs="1" maxOccurs="1"/>
108
+ <element name="base_subtotal_canceled" type="xsd:string" minOccurs="1" maxOccurs="1"/>
109
+ <element name="base_subtotal_invoiced" type="xsd:string" minOccurs="1" maxOccurs="1"/>
110
+ <element name="base_subtotal_refunded" type="xsd:string" minOccurs="1" maxOccurs="1"/>
111
+ <element name="base_tax_amount" type="xsd:string" minOccurs="1" maxOccurs="1"/>
112
+ <element name="base_tax_canceled" type="xsd:string" minOccurs="1" maxOccurs="1"/>
113
+ <element name="base_tax_invoiced" type="xsd:string" minOccurs="1" maxOccurs="1"/>
114
+ <element name="base_tax_refunded" type="xsd:string" minOccurs="1" maxOccurs="1"/>
115
+ <element name="base_to_global_rate" type="xsd:string" minOccurs="1" maxOccurs="1"/>
116
+ <element name="base_to_order_rate" type="xsd:string" minOccurs="1" maxOccurs="1"/>
117
+ <element name="base_total_canceled" type="xsd:string" minOccurs="1" maxOccurs="1"/>
118
+ <element name="base_total_invoiced" type="xsd:string" minOccurs="1" maxOccurs="1"/>
119
+ <element name="base_total_invoiced_cost" type="xsd:string" minOccurs="1" maxOccurs="1"/>
120
+ <element name="base_total_offline_refunded" type="xsd:string" minOccurs="1" maxOccurs="1"/>
121
+ <element name="base_total_online_refunded" type="xsd:string" minOccurs="1" maxOccurs="1"/>
122
+ <element name="base_total_paid" type="xsd:string" minOccurs="1" maxOccurs="1"/>
123
+ <element name="base_total_qty_ordered" type="xsd:string" minOccurs="1" maxOccurs="1"/>
124
+ <element name="base_total_refunded" type="xsd:string" minOccurs="1" maxOccurs="1"/>
125
+ <element name="discount_amount" type="xsd:string" minOccurs="1" maxOccurs="1"/>
126
+ <element name="discount_canceled" type="xsd:string" minOccurs="1" maxOccurs="1"/>
127
+ <element name="discount_invoiced" type="xsd:string" minOccurs="1" maxOccurs="1"/>
128
+ <element name="discount_refunded" type="xsd:string" minOccurs="1" maxOccurs="1"/>
129
+ <element name="grand_total" type="xsd:string" minOccurs="1" maxOccurs="1"/>
130
+ <element name="shipping_amount" type="xsd:string" minOccurs="1" maxOccurs="1"/>
131
+ <element name="shipping_canceled" type="xsd:string" minOccurs="1" maxOccurs="1"/>
132
+ <element name="shipping_invoiced" type="xsd:string" minOccurs="1" maxOccurs="1"/>
133
+ <element name="shipping_refunded" type="xsd:string" minOccurs="1" maxOccurs="1"/>
134
+ <element name="shipping_tax_amount" type="xsd:string" minOccurs="1" maxOccurs="1"/>
135
+ <element name="shipping_tax_refunded" type="xsd:string" minOccurs="1" maxOccurs="1"/>
136
+ <element name="store_to_base_rate" type="xsd:string" minOccurs="1" maxOccurs="1"/>
137
+ <element name="store_to_order_rate" type="xsd:string" minOccurs="1" maxOccurs="1"/>
138
+ <element name="subtotal" type="xsd:string" minOccurs="1" maxOccurs="1"/>
139
+ <element name="subtotal_canceled" type="xsd:string" minOccurs="1" maxOccurs="1"/>
140
+ <element name="subtotal_invoiced" type="xsd:string" minOccurs="1" maxOccurs="1"/>
141
+ <element name="subtotal_refunded" type="xsd:string" minOccurs="1" maxOccurs="1"/>
142
+ <element name="tax_amount" type="xsd:string" minOccurs="1" maxOccurs="1"/>
143
+ <element name="tax_canceled" type="xsd:string" minOccurs="1" maxOccurs="1"/>
144
+ <element name="tax_invoiced" type="xsd:string" minOccurs="1" maxOccurs="1"/>
145
+ <element name="tax_refunded" type="xsd:string" minOccurs="1" maxOccurs="1"/>
146
+ <element name="total_canceled" type="xsd:string" minOccurs="1" maxOccurs="1"/>
147
+ <element name="total_invoiced" type="xsd:string" minOccurs="1" maxOccurs="1"/>
148
+ <element name="total_offline_refunded" type="xsd:string" minOccurs="1" maxOccurs="1"/>
149
+ <element name="total_online_refunded" type="xsd:string" minOccurs="1" maxOccurs="1"/>
150
+ <element name="total_paid" type="xsd:string" minOccurs="1" maxOccurs="1"/>
151
+ <element name="total_qty_ordered" type="xsd:string" minOccurs="1" maxOccurs="1"/>
152
+ <element name="total_refunded" type="xsd:string" minOccurs="1" maxOccurs="1"/>
153
+ <element name="can_ship_partially" type="xsd:string" minOccurs="1" maxOccurs="1"/>
154
+ <element name="can_ship_partially_item" type="xsd:string" minOccurs="1" maxOccurs="1"/>
155
+ <element name="customer_is_guest" type="xsd:string" minOccurs="1" maxOccurs="1"/>
156
+ <element name="customer_note_notify" type="xsd:string" minOccurs="1" maxOccurs="1"/>
157
+ <element name="billing_address_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
158
+ <element name="customer_group_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
159
+ <element name="customer_group_code" type="xsd:string" minOccurs="1" maxOccurs="1"/>
160
+ <element name="edit_increment" type="xsd:string" minOccurs="1" maxOccurs="1"/>
161
+ <element name="email_sent" type="xsd:string" minOccurs="1" maxOccurs="1"/>
162
+ <element name="forced_shipment_with_invoice" type="xsd:string" minOccurs="1" maxOccurs="1"/>
163
+ <element name="payment_auth_expiration" type="xsd:string" minOccurs="1" maxOccurs="1"/>
164
+ <element name="quote_address_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
165
+ <element name="quote_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
166
+ <element name="shipping_address_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
167
+ <element name="adjustment_negative" type="xsd:string" minOccurs="1" maxOccurs="1"/>
168
+ <element name="adjustment_positive" type="xsd:string" minOccurs="1" maxOccurs="1"/>
169
+ <element name="base_adjustment_negative" type="xsd:string" minOccurs="1" maxOccurs="1"/>
170
+ <element name="base_adjustment_positive" type="xsd:string" minOccurs="1" maxOccurs="1"/>
171
+ <element name="base_shipping_discount_amount" type="xsd:string" minOccurs="1" maxOccurs="1"/>
172
+ <element name="base_subtotal_incl_tax" type="xsd:string" minOccurs="1" maxOccurs="1"/>
173
+ <element name="base_total_due" type="xsd:string" minOccurs="1" maxOccurs="1"/>
174
+ <element name="payment_authorization_amount" type="xsd:string" minOccurs="1" maxOccurs="1"/>
175
+ <element name="shipping_discount_amount" type="xsd:string" minOccurs="1" maxOccurs="1"/>
176
+ <element name="subtotal_incl_tax" type="xsd:string" minOccurs="1" maxOccurs="1"/>
177
+ <element name="total_due" type="xsd:string" minOccurs="1" maxOccurs="1"/>
178
+ <element name="weight" type="xsd:string" minOccurs="1" maxOccurs="1"/>
179
+ <element name="customer_dob" type="xsd:string" minOccurs="1" maxOccurs="1"/>
180
+ <element name="increment_id" type="xsd:string" minOccurs="0" maxOccurs="1"/>
181
+ <element name="applied_rule_ids" type="xsd:string" minOccurs="1" maxOccurs="1"/>
182
+ <element name="base_currency_code" type="xsd:string" minOccurs="1" maxOccurs="1"/>
183
+ <element name="customer_email" type="xsd:string" minOccurs="1" maxOccurs="1"/>
184
+ <element name="customer_firstname" type="xsd:string" minOccurs="1" maxOccurs="1"/>
185
+ <element name="customer_lastname" type="xsd:string" minOccurs="1" maxOccurs="1"/>
186
+ <element name="customer_middlename" type="xsd:string" minOccurs="1" maxOccurs="1"/>
187
+ <element name="customer_prefix" type="xsd:string" minOccurs="1" maxOccurs="1"/>
188
+ <element name="customer_suffix" type="xsd:string" minOccurs="1" maxOccurs="1"/>
189
+ <element name="customer_taxvat" type="xsd:string" minOccurs="1" maxOccurs="1"/>
190
+ <element name="discount_description" type="xsd:string" minOccurs="1" maxOccurs="1"/>
191
+ <element name="ext_customer_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
192
+ <element name="ext_order_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
193
+ <element name="global_currency_code" type="xsd:string" minOccurs="1" maxOccurs="1"/>
194
+ <element name="hold_before_state" type="xsd:string" minOccurs="1" maxOccurs="1"/>
195
+ <element name="hold_before_status" type="xsd:string" minOccurs="1" maxOccurs="1"/>
196
+ <element name="order_currency_code" type="xsd:string" minOccurs="1" maxOccurs="1"/>
197
+ <element name="original_increment_id" type="xsd:string" minOccurs="0" maxOccurs="1"/>
198
+ <element name="relation_child_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
199
+ <element name="relation_child_real_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
200
+ <element name="relation_parent_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
201
+ <element name="relation_parent_real_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
202
+ <element name="remote_ip" type="xsd:string" minOccurs="1" maxOccurs="1"/>
203
+ <element name="shipping_method" type="xsd:string" minOccurs="1" maxOccurs="1"/>
204
+ <element name="store_currency_code" type="xsd:string" minOccurs="1" maxOccurs="1"/>
205
+ <element name="store_name" type="xsd:string" minOccurs="1" maxOccurs="1"/>
206
+ <element name="x_forwarded_for" type="xsd:string" minOccurs="1" maxOccurs="1"/>
207
+ <element name="customer_note" type="xsd:string" minOccurs="1" maxOccurs="1"/>
208
+ <element name="created_at" type="xsd:string" minOccurs="1" maxOccurs="1"/>
209
+ <element name="updated_at" type="xsd:string" minOccurs="1" maxOccurs="1"/>
210
+ <element name="total_item_count" type="xsd:string" minOccurs="1" maxOccurs="1"/>
211
+ <element name="customer_gender_value" type="xsd:string" minOccurs="1" maxOccurs="1"/>
212
+ <element name="hidden_tax_amount" type="xsd:string" minOccurs="1" maxOccurs="1"/>
213
+ <element name="base_hidden_tax_amount" type="xsd:string" minOccurs="1" maxOccurs="1"/>
214
+ <element name="shipping_hidden_tax_amount" type="xsd:string" minOccurs="1" maxOccurs="1"/>
215
+ <element name="base_shipping_hidden_tax_amnt" type="xsd:string" minOccurs="1" maxOccurs="1"/>
216
+ <element name="hidden_tax_invoiced" type="xsd:string" minOccurs="1" maxOccurs="1"/>
217
+ <element name="base_hidden_tax_invoiced" type="xsd:string" minOccurs="1" maxOccurs="1"/>
218
+ <element name="hidden_tax_refunded" type="xsd:string" minOccurs="1" maxOccurs="1"/>
219
+ <element name="base_hidden_tax_refunded" type="xsd:string" minOccurs="1" maxOccurs="1"/>
220
+ <element name="shipping_incl_tax" type="xsd:string" minOccurs="1" maxOccurs="1"/>
221
+ <element name="base_shipping_incl_tax" type="xsd:string" minOccurs="1" maxOccurs="1"/>
222
+ <element name="paypal_ipn_customer_notified" type="xsd:string" minOccurs="1" maxOccurs="1"/>
223
+ <element name="gift_message_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
224
+ <element name="gift_sender" type="xsd:string" minOccurs="1" maxOccurs="1"/>
225
+ <element name="gift_recipient" type="xsd:string" minOccurs="1" maxOccurs="1"/>
226
+ <element name="gift_message" type="xsd:string" minOccurs="1" maxOccurs="1"/>
227
+
228
+ <element name="address" type="typens:salesOrderExportAddressArray" minOccurs="1" maxOccurs="1"/>
229
+ <element name="items" type="typens:salesOrderExportItemsArray" minOccurs="1" maxOccurs="1"/>
230
+ <element name="payment" type="typens:salesOrderExportPaymentsArray" minOccurs="1" maxOccurs="1"/>
231
+ <element name="history" type="typens:salesOrderExportHistoryArray" minOccurs="1" maxOccurs="1"/>
232
+ </all>
233
+ </complexType>
234
+ <complexType name="salesOrderExportAddressArray">
235
+ <complexContent>
236
+ <restriction base="soapenc:Array">
237
+ <attribute ref="soapenc:arrayType" wsdl:arrayType="typens:salesOrderExportAddressEntity[]"/>
238
+ </restriction>
239
+ </complexContent>
240
+ </complexType>
241
+ <complexType name="salesOrderExportAddressEntity">
242
+ <all>
243
+ <element name="customer_address_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
244
+ <element name="quote_address_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
245
+ <element name="region_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
246
+ <element name="customer_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
247
+ <element name="fax" type="xsd:string" minOccurs="1" maxOccurs="1"/>
248
+ <element name="region" type="xsd:string" minOccurs="1" maxOccurs="1"/>
249
+ <element name="postcode" type="xsd:string" minOccurs="1" maxOccurs="1"/>
250
+ <element name="lastname" type="xsd:string" minOccurs="1" maxOccurs="1"/>
251
+ <element name="street" type="xsd:string" minOccurs="1" maxOccurs="1"/>
252
+ <element name="city" type="xsd:string" minOccurs="1" maxOccurs="1"/>
253
+ <element name="email" type="xsd:string" minOccurs="1" maxOccurs="1"/>
254
+ <element name="telephone" type="xsd:string" minOccurs="1" maxOccurs="1"/>
255
+ <element name="country_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
256
+ <element name="firstname" type="xsd:string" minOccurs="1" maxOccurs="1"/>
257
+ <element name="address_type" type="xsd:string" minOccurs="1" maxOccurs="1"/>
258
+ <element name="prefix" type="xsd:string" minOccurs="1" maxOccurs="1"/>
259
+ <element name="middlename" type="xsd:string" minOccurs="1" maxOccurs="1"/>
260
+ <element name="suffix" type="xsd:string" minOccurs="1" maxOccurs="1"/>
261
+ <element name="company" type="xsd:string" minOccurs="1" maxOccurs="1"/>
262
+ </all>
263
+ </complexType>
264
+ <complexType name="salesOrderExportItemsArray">
265
+ <complexContent>
266
+ <restriction base="soapenc:Array">
267
+ <attribute ref="soapenc:arrayType" wsdl:arrayType="typens:salesOrderExportItemEntity[]"/>
268
+ </restriction>
269
+ </complexContent>
270
+ </complexType>
271
+ <complexType name="salesOrderExportItemEntity">
272
+ <all>
273
+ <element name="item_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
274
+ <element name="parent_item_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
275
+ <element name="quote_item_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
276
+ <element name="store_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
277
+ <element name="created_at" type="xsd:string" minOccurs="1" maxOccurs="1"/>
278
+ <element name="updated_at" type="xsd:string" minOccurs="1" maxOccurs="1"/>
279
+ <element name="product_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
280
+ <element name="product_type" type="xsd:string" minOccurs="1" maxOccurs="1"/>
281
+ <element name="product_options" type="xsd:string" minOccurs="1" maxOccurs="1"/>
282
+ <element name="weight" type="xsd:string" minOccurs="1" maxOccurs="1"/>
283
+ <element name="is_virtual" type="xsd:string" minOccurs="1" maxOccurs="1"/>
284
+ <element name="sku" type="xsd:string" minOccurs="1" maxOccurs="1"/>
285
+ <element name="name" type="xsd:string" minOccurs="1" maxOccurs="1"/>
286
+ <element name="description" type="xsd:string" minOccurs="1" maxOccurs="1"/>
287
+ <element name="applied_rule_ids" type="xsd:string" minOccurs="1" maxOccurs="1"/>
288
+ <element name="additional_data" type="xsd:string" minOccurs="1" maxOccurs="1"/>
289
+ <element name="free_shipping" type="xsd:string" minOccurs="1" maxOccurs="1"/>
290
+ <element name="is_qty_decimal" type="xsd:string" minOccurs="1" maxOccurs="1"/>
291
+ <element name="no_discount" type="xsd:string" minOccurs="1" maxOccurs="1"/>
292
+ <element name="qty_backordered" type="xsd:string" minOccurs="1" maxOccurs="1"/>
293
+ <element name="qty_canceled" type="xsd:string" minOccurs="1" maxOccurs="1"/>
294
+ <element name="qty_invoiced" type="xsd:string" minOccurs="1" maxOccurs="1"/>
295
+ <element name="qty_ordered" type="xsd:string" minOccurs="1" maxOccurs="1"/>
296
+ <element name="qty_refunded" type="xsd:string" minOccurs="1" maxOccurs="1"/>
297
+ <element name="qty_shipped" type="xsd:string" minOccurs="1" maxOccurs="1"/>
298
+ <element name="base_cost" type="xsd:string" minOccurs="1" maxOccurs="1"/>
299
+ <element name="price" type="xsd:string" minOccurs="1" maxOccurs="1"/>
300
+ <element name="base_price" type="xsd:string" minOccurs="1" maxOccurs="1"/>
301
+ <element name="original_price" type="xsd:string" minOccurs="1" maxOccurs="1"/>
302
+ <element name="base_original_price" type="xsd:string" minOccurs="1" maxOccurs="1"/>
303
+ <element name="tax_percent" type="xsd:string" minOccurs="1" maxOccurs="1"/>
304
+ <element name="tax_amount" type="xsd:string" minOccurs="1" maxOccurs="1"/>
305
+ <element name="base_tax_amount" type="xsd:string" minOccurs="1" maxOccurs="1"/>
306
+ <element name="tax_invoiced" type="xsd:string" minOccurs="1" maxOccurs="1"/>
307
+ <element name="base_tax_invoiced" type="xsd:string" minOccurs="1" maxOccurs="1"/>
308
+ <element name="discount_percent" type="xsd:string" minOccurs="1" maxOccurs="1"/>
309
+ <element name="discount_amount" type="xsd:string" minOccurs="1" maxOccurs="1"/>
310
+ <element name="base_discount_amount" type="xsd:string" minOccurs="1" maxOccurs="1"/>
311
+ <element name="discount_invoiced" type="xsd:string" minOccurs="1" maxOccurs="1"/>
312
+ <element name="base_discount_invoiced" type="xsd:string" minOccurs="1" maxOccurs="1"/>
313
+ <element name="amount_refunded" type="xsd:string" minOccurs="1" maxOccurs="1"/>
314
+ <element name="base_amount_refunded" type="xsd:string" minOccurs="1" maxOccurs="1"/>
315
+ <element name="row_total" type="xsd:string" minOccurs="1" maxOccurs="1"/>
316
+ <element name="base_row_total" type="xsd:string" minOccurs="1" maxOccurs="1"/>
317
+ <element name="row_invoiced" type="xsd:string" minOccurs="1" maxOccurs="1"/>
318
+ <element name="base_row_invoiced" type="xsd:string" minOccurs="1" maxOccurs="1"/>
319
+ <element name="row_weight" type="xsd:string" minOccurs="1" maxOccurs="1"/>
320
+ <element name="base_tax_before_discount" type="xsd:string" minOccurs="1" maxOccurs="1"/>
321
+ <element name="tax_before_discount" type="xsd:string" minOccurs="1" maxOccurs="1"/>
322
+ <element name="ext_order_item_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
323
+ <element name="locked_do_invoice" type="xsd:string" minOccurs="1" maxOccurs="1"/>
324
+ <element name="locked_do_ship" type="xsd:string" minOccurs="1" maxOccurs="1"/>
325
+ <element name="price_incl_tax" type="xsd:string" minOccurs="1" maxOccurs="1"/>
326
+ <element name="base_price_incl_tax" type="xsd:string" minOccurs="1" maxOccurs="1"/>
327
+ <element name="row_total_incl_tax" type="xsd:string" minOccurs="1" maxOccurs="1"/>
328
+ <element name="base_row_total_incl_tax" type="xsd:string" minOccurs="1" maxOccurs="1"/>
329
+ <element name="hidden_tax_amount" type="xsd:string" minOccurs="1" maxOccurs="1"/>
330
+ <element name="base_hidden_tax_amount" type="xsd:string" minOccurs="1" maxOccurs="1"/>
331
+ <element name="hidden_tax_invoiced" type="xsd:string" minOccurs="1" maxOccurs="1"/>
332
+ <element name="base_hidden_tax_invoiced" type="xsd:string" minOccurs="1" maxOccurs="1"/>
333
+ <element name="hidden_tax_refunded" type="xsd:string" minOccurs="1" maxOccurs="1"/>
334
+ <element name="base_hidden_tax_refunded" type="xsd:string" minOccurs="1" maxOccurs="1"/>
335
+ <element name="is_nominal" type="xsd:string" minOccurs="1" maxOccurs="1"/>
336
+ <element name="tax_canceled" type="xsd:string" minOccurs="1" maxOccurs="1"/>
337
+ <element name="hidden_tax_canceled" type="xsd:string" minOccurs="1" maxOccurs="1"/>
338
+ <element name="tax_refunded" type="xsd:string" minOccurs="1" maxOccurs="1"/>
339
+ <element name="gift_message_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
340
+ <element name="gift_message_available" type="xsd:string" minOccurs="1" maxOccurs="1"/>
341
+ <element name="gift_sender" type="xsd:string" minOccurs="1" maxOccurs="1"/>
342
+ <element name="gift_recipient" type="xsd:string" minOccurs="1" maxOccurs="1"/>
343
+ <element name="gift_message" type="xsd:string" minOccurs="1" maxOccurs="1"/>
344
+ <element name="base_weee_tax_applied_amount" type="xsd:string" minOccurs="1" maxOccurs="1"/>
345
+ <element name="base_weee_tax_applied_row_amnt" type="xsd:string" minOccurs="1" maxOccurs="1"/>
346
+ <element name="weee_tax_applied_amount" type="xsd:string" minOccurs="1" maxOccurs="1"/>
347
+ <element name="weee_tax_applied_row_amount" type="xsd:string" minOccurs="1" maxOccurs="1"/>
348
+ <element name="weee_tax_applied" type="xsd:string" minOccurs="1" maxOccurs="1"/>
349
+ <element name="weee_tax_disposition" type="xsd:string" minOccurs="1" maxOccurs="1"/>
350
+ <element name="weee_tax_row_disposition" type="xsd:string" minOccurs="1" maxOccurs="1"/>
351
+ <element name="base_weee_tax_disposition" type="xsd:string" minOccurs="1" maxOccurs="1"/>
352
+ <element name="base_weee_tax_row_disposition" type="xsd:string" minOccurs="1" maxOccurs="1"/>
353
+ </all>
354
+ </complexType>
355
+ <complexType name="salesOrderExportPaymentsArray">
356
+ <complexContent>
357
+ <restriction base="soapenc:Array">
358
+ <attribute ref="soapenc:arrayType" wsdl:arrayType="typens:salesOrderExportPaymentEntity[]"/>
359
+ </restriction>
360
+ </complexContent>
361
+ </complexType>
362
+ <complexType name="salesOrderExportPaymentEntity">
363
+ <all>
364
+ <element name="base_shipping_captured" type="xsd:string" minOccurs="1" maxOccurs="1"/>
365
+ <element name="shipping_captured" type="xsd:string" minOccurs="1" maxOccurs="1"/>
366
+ <element name="amount_refunded" type="xsd:string" minOccurs="1" maxOccurs="1"/>
367
+ <element name="base_amount_paid" type="xsd:string" minOccurs="1" maxOccurs="1"/>
368
+ <element name="amount_canceled" type="xsd:string" minOccurs="1" maxOccurs="1"/>
369
+ <element name="base_amount_authorized" type="xsd:string" minOccurs="1" maxOccurs="1"/>
370
+ <element name="base_amount_paid_online" type="xsd:string" minOccurs="1" maxOccurs="1"/>
371
+ <element name="base_amount_refunded_online" type="xsd:string" minOccurs="1" maxOccurs="1"/>
372
+ <element name="base_shipping_amount" type="xsd:string" minOccurs="1" maxOccurs="1"/>
373
+ <element name="shipping_amount" type="xsd:string" minOccurs="1" maxOccurs="1"/>
374
+ <element name="amount_paid" type="xsd:string" minOccurs="1" maxOccurs="1"/>
375
+ <element name="amount_authorized" type="xsd:string" minOccurs="1" maxOccurs="1"/>
376
+ <element name="base_amount_ordered" type="xsd:string" minOccurs="1" maxOccurs="1"/>
377
+ <element name="base_shipping_refunded" type="xsd:string" minOccurs="1" maxOccurs="1"/>
378
+ <element name="shipping_refunded" type="xsd:string" minOccurs="1" maxOccurs="1"/>
379
+ <element name="base_amount_refunded" type="xsd:string" minOccurs="1" maxOccurs="1"/>
380
+ <element name="amount_ordered" type="xsd:string" minOccurs="1" maxOccurs="1"/>
381
+ <element name="base_amount_canceled" type="xsd:string" minOccurs="1" maxOccurs="1"/>
382
+ <element name="quote_payment_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
383
+ <element name="additional_data" type="xsd:string" minOccurs="1" maxOccurs="1"/>
384
+ <element name="cc_exp_month" type="xsd:string" minOccurs="1" maxOccurs="1"/>
385
+ <element name="cc_ss_start_year" type="xsd:string" minOccurs="1" maxOccurs="1"/>
386
+ <element name="echeck_bank_name" type="xsd:string" minOccurs="1" maxOccurs="1"/>
387
+ <element name="method" type="xsd:string" minOccurs="1" maxOccurs="1"/>
388
+ <element name="cc_debug_request_body" type="xsd:string" minOccurs="1" maxOccurs="1"/>
389
+ <element name="cc_secure_verify" type="xsd:string" minOccurs="1" maxOccurs="1"/>
390
+ <element name="protection_eligibility" type="xsd:string" minOccurs="1" maxOccurs="1"/>
391
+ <element name="cc_approval" type="xsd:string" minOccurs="1" maxOccurs="1"/>
392
+ <element name="cc_last4" type="xsd:string" minOccurs="1" maxOccurs="1"/>
393
+ <element name="cc_status_description" type="xsd:string" minOccurs="1" maxOccurs="1"/>
394
+ <element name="echeck_type" type="xsd:string" minOccurs="1" maxOccurs="1"/>
395
+ <element name="cc_debug_response_serialized" type="xsd:string" minOccurs="1" maxOccurs="1"/>
396
+ <element name="cc_ss_start_month" type="xsd:string" minOccurs="1" maxOccurs="1"/>
397
+ <element name="echeck_account_type" type="xsd:string" minOccurs="1" maxOccurs="1"/>
398
+ <element name="last_trans_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
399
+ <element name="cc_cid_status" type="xsd:string" minOccurs="1" maxOccurs="1"/>
400
+ <element name="cc_owner" type="xsd:string" minOccurs="1" maxOccurs="1"/>
401
+ <element name="cc_type" type="xsd:string" minOccurs="1" maxOccurs="1"/>
402
+ <element name="po_number" type="xsd:string" minOccurs="1" maxOccurs="1"/>
403
+ <element name="cc_exp_year" type="xsd:string" minOccurs="1" maxOccurs="1"/>
404
+ <element name="cc_status" type="xsd:string" minOccurs="1" maxOccurs="1"/>
405
+ <element name="echeck_routing_number" type="xsd:string" minOccurs="1" maxOccurs="1"/>
406
+ <element name="account_status" type="xsd:string" minOccurs="1" maxOccurs="1"/>
407
+ <element name="anet_trans_method" type="xsd:string" minOccurs="1" maxOccurs="1"/>
408
+ <element name="cc_debug_response_body" type="xsd:string" minOccurs="1" maxOccurs="1"/>
409
+ <element name="cc_ss_issue" type="xsd:string" minOccurs="1" maxOccurs="1"/>
410
+ <element name="echeck_account_name" type="xsd:string" minOccurs="1" maxOccurs="1"/>
411
+ <element name="cc_avs_status" type="xsd:string" minOccurs="1" maxOccurs="1"/>
412
+ <element name="cc_number_enc" type="xsd:string" minOccurs="1" maxOccurs="1"/>
413
+ <element name="cc_trans_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
414
+ <element name="paybox_request_number" type="xsd:string" minOccurs="0" maxOccurs="1"/>
415
+ <element name="address_status" type="xsd:string" minOccurs="1" maxOccurs="1"/>
416
+ <element name="additional_information" type="xsd:string" minOccurs="1" maxOccurs="1"/>
417
+ <element name="cybersource_token" type="xsd:string" minOccurs="0" maxOccurs="1"/>
418
+ <element name="flo2cash_account_id" type="xsd:string" minOccurs="0" maxOccurs="1"/>
419
+ <element name="ideal_issuer_id" type="xsd:string" minOccurs="0" maxOccurs="1"/>
420
+ <element name="ideal_issuer_title" type="xsd:string" minOccurs="0" maxOccurs="1"/>
421
+ <element name="ideal_transaction_checked" type="xsd:string" minOccurs="0" maxOccurs="1"/>
422
+ <element name="paybox_question_number" type="xsd:string" minOccurs="0" maxOccurs="1"/>
423
+ </all>
424
+ </complexType>
425
+ <complexType name="salesOrderExportHistoryArray">
426
+ <complexContent>
427
+ <restriction base="soapenc:Array">
428
+ <attribute ref="soapenc:arrayType" wsdl:arrayType="typens:salesOrderExportHistoryEntity[]"/>
429
+ </restriction>
430
+ </complexContent>
431
+ </complexType>
432
+ <complexType name="salesOrderExportHistoryEntity">
433
+ <all>
434
+ <element name="is_customer_notified" type="xsd:string" minOccurs="1" maxOccurs="1"/>
435
+ <element name="is_visible_on_front" type="xsd:string" minOccurs="1" maxOccurs="1"/>
436
+ <element name="comment" type="xsd:string" minOccurs="1" maxOccurs="1"/>
437
+ <element name="status" type="xsd:string" minOccurs="1" maxOccurs="1"/>
438
+ <element name="created_at" type="xsd:string" minOccurs="1" maxOccurs="1"/>
439
+ <element name="entity_name" type="xsd:string" minOccurs="1" maxOccurs="1"/>
440
+ </all>
441
+ </complexType>
442
+ <complexType name="salesOrderImportResult">
443
+ <all>
444
+ <element name="status" type="xsd:string" minOccurs="1" maxOccurs="1" />
445
+ <element name="result" type="typens:salesOrderImportResultResultArray" minOccurs="0"
446
+ maxOccurs="1" />
447
+ </all>
448
+ </complexType>
449
+ <complexType name="salesOrderImportResultResultArray">
450
+ <complexContent>
451
+ <restriction base="soapenc:Array">
452
+ <attribute ref="soapenc:arrayType"
453
+ wsdl:arrayType="typens:salesOrderImportResultResultEntity[]"/>
454
+ </restriction>
455
+ </complexContent>
456
+ </complexType>
457
+ <complexType name="salesOrderImportResultResultEntity">
458
+ <all>
459
+ <element name="original_increment_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
460
+ <element name="imported_increment_id" type="xsd:string" minOccurs="1" maxOccurs="1"/>
461
+ <element name="error" type="xsd:string" minOccurs="0" maxOccurs="1"/>
462
+ <element name="warnings" type="typens:ArrayOfString" minOccurs="0" maxOccurs="1"/>
463
+ </all>
464
+ </complexType>
465
+ <complexType name="salesOrderShipmentEntity">
466
+ <all>
467
+ <element name="shipping_description" type="xsd:string" minOccurs="0" />
468
+ </all>
469
+ </complexType>
470
+ </schema>
471
+ </types>
472
+ <message name="salesOrderImportRequest">
473
+ <part name="sessionId" type="xsd:string"/>
474
+ <part name="orders" type="typens:salesOrderExportArray"/>
475
+ <part name="decrement_inventory" type="xsd:boolean" />
476
+ </message>
477
+ <message name="salesOrderImportResponse">
478
+ <part name="result" type="typens:salesOrderImportResult"/>
479
+ </message>
480
+ <portType name="{{var wsdl.handler}}PortType">
481
+ <operation name="salesOrderImport">
482
+ <documentation>Import orders</documentation>
483
+ <input message="typens:salesOrderImportRequest"/>
484
+ <output message="typens:salesOrderImportResponse"/>
485
+ </operation>
486
+ </portType>
487
+ <binding name="{{var wsdl.handler}}Binding" type="typens:{{var wsdl.handler}}PortType">
488
+ <operation name="salesOrderImport">
489
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action"/>
490
+ <input>
491
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded"
492
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
493
+ </input>
494
+ <output>
495
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded"
496
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
497
+ </output>
498
+ </operation>
499
+ </binding>
500
+ </definitions>
app/code/local/CloudConversion/CloudGento/etc/wsi.xml ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <wsdl:definitions xmlns:typens="urn:{{var wsdl.name}}"
3
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
4
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
5
+ xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
6
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
7
+ name="{{var wsdl.name}}"
8
+ targetNamespace="urn:{{var wsdl.name}}">
9
+ <wsdl:types>
10
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:{{var wsdl.name}}">
11
+ <xsd:complexType name="complexMultiFilter">
12
+ <xsd:sequence>
13
+ <xsd:element name="key" type="xsd:string" />
14
+ <xsd:element name="value" type="typens:associativeArray" />
15
+ </xsd:sequence>
16
+ </xsd:complexType>
17
+ <xsd:complexType name="complexMultiArray">
18
+ <xsd:sequence>
19
+ <xsd:element minOccurs="0" maxOccurs="unbounded" name="complexObjectArray" type="typens:complexMultiFilter" />
20
+ </xsd:sequence>
21
+ </xsd:complexType>
22
+ <xsd:complexType name="catalogProductCreateEntity">
23
+ <xsd:sequence>
24
+ <xsd:element name="associated_skus" type="typens:ArrayOfString" minOccurs="0" />
25
+ <xsd:element name="price_changes" type="typens:complexMultiArray" minOccurs="0" />
26
+ </xsd:sequence>
27
+ </xsd:complexType>
28
+ <xsd:complexType name="catalogProductReturnEntity">
29
+ <xsd:sequence>
30
+ <xsd:element name="parent_sku" type="xsd:string" minOccurs="0" />
31
+ <xsd:element name="configurable_products_data" type="typens:childrenEntityArray" minOccurs="0" />
32
+ <xsd:element name="configurable_attributes_data" type="typens:configurableOptionsEntityArray" minOccurs="0" />
33
+ </xsd:sequence>
34
+ </xsd:complexType>
35
+ <xsd:complexType name="childrenEntityArray">
36
+ <xsd:sequence>
37
+ <xsd:element minOccurs="0" maxOccurs="unbounded" name="complexObjectArray" type="typens:childrenEntity" />
38
+ </xsd:sequence>
39
+ </xsd:complexType>
40
+ <xsd:complexType name="childrenEntity">
41
+ <xsd:sequence>
42
+ <xsd:element name="sku" type="xsd:string" minOccurs="0"/>
43
+ <xsd:element name="options" type="typens:optionsEntityArray" minOccurs="0"/>
44
+ </xsd:sequence>
45
+ </xsd:complexType>
46
+ <xsd:complexType name="configurableOptionsEntityArray">
47
+ <xsd:sequence>
48
+ <xsd:element minOccurs="0" maxOccurs="unbounded" name="complexObjectArray" type="typens:configurableOptionsEntity" />
49
+ </xsd:sequence>
50
+ </xsd:complexType>
51
+ <xsd:complexType name="configurableOptionsEntity">
52
+ <xsd:sequence>
53
+ <xsd:element name="code" type="xsd:string" minOccurs="0"/>
54
+ <xsd:element name="options" type="typens:optionsEntityArray" minOccurs="0"/>
55
+ </xsd:sequence>
56
+ </xsd:complexType>
57
+ <xsd:complexType name="optionsEntityArray">
58
+ <xsd:sequence>
59
+ <xsd:element minOccurs="0" maxOccurs="unbounded" name="complexObjectArray" type="typens:optionsEntity" />
60
+ </xsd:sequence>
61
+ </xsd:complexType>
62
+ <xsd:complexType name="optionsEntity">
63
+ <xsd:sequence>
64
+ <xsd:element name="name" type="xsd:string" minOccurs="0"/>
65
+ <xsd:element name="value" type="xsd:string" minOccurs="0"/>
66
+ <xsd:element name="code" type="xsd:string" minOccurs="0"/>
67
+ <xsd:element name="price" type="xsd:double" minOccurs="0"/>
68
+ </xsd:sequence>
69
+ </xsd:complexType>
70
+ </xsd:schema>
71
+ </wsdl:types>
72
+ </wsdl:definitions>
app/etc/modules/CloudConversion_CloudGento.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <CloudConversion_CloudGento>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </CloudConversion_CloudGento>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>cloudgento-extension</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>CloudGento Magento Extension</summary>
10
+ <description>CloudGento Magento Extension</description>
11
+ <notes>CloudGento Magento Extension</notes>
12
+ <authors><author><name>CloudConversion</name><user>cloudconversion</user><email>peter@cloudconversion.com</email></author></authors>
13
+ <date>2013-01-29</date>
14
+ <time>23:13:51</time>
15
+ <contents><target name="magelocal"><dir name="CloudConversion"><dir name="CloudGento"><dir name="Helper"><file name="Data.php" hash="c643c6607d339118fe4acce37aa21e3b"/></dir><dir name="Model"><dir name="Catalog"><dir name="Product"><dir name="Api"><file name="V2.php" hash="c2533fa3fc1b61c616ee364ede6d4563"/></dir><file name="Api.php" hash="acd15e01ad9a250c1fdbc016389b649d"/></dir></dir><dir name="Order"><dir name="Api"><file name="V2.php" hash="e17dc8ac54508499565f6f9732bcbc03"/></dir><file name="Api.php" hash="c2767e75f9c004b49d4a41b54e0e643e"/><dir name="Shipment"><dir name="Api"><file name="V2.php" hash="6cfd0d0e1a9290ffb1a25db8aa2771e1"/></dir><file name="Api.php" hash="bc12ae1e8185253ecc8fe6111e258b5f"/></dir></dir><dir name="Resource"><file name="Message.php" hash="4b75b1086988077e86c219a3f39ef935"/><dir name="Order"><file name="Address.php" hash="738ffc04f63d9bd6f0a51b7c706075df"/><file name="Item.php" hash="5fcdfcc5737ffe2c2cc3d936c250da7f"/><file name="Payment.php" hash="4ed8fc8c74ae928852a584b4b6546b48"/><dir name="Status"><file name="History.php" hash="16d3aacea35cfcc98cbd76bb2194003f"/></dir></dir><file name="Order.php" hash="09b1a92158c2f835b7a743d5f5dc74dd"/></dir></dir><dir name="etc"><file name="api.xml" hash="016a4ceb67f92d1a64afbf9966b43578"/><file name="config.xml" hash="0e8a031b2ab7fadf778d1d218da6e7d1"/><file name="wsdl.xml" hash="54e13bfb57565dc27c94767d8578b0d1"/><file name="wsi.xml" hash="4a689a1a219c320d097ad2de61f9f275"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="CloudConversion_CloudGento.xml" hash="f63a0ccc652bd82328965940ea315fbd"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>