├── .gitattributes
├── .gitignore
├── .travis.yml.old
├── LICENSE
├── README.md
├── composer.json
├── composer.lock
├── docs
├── README.md
├── catalog
│ ├── README.md
│ └── product.md
└── customer
│ └── customer.md
└── src
└── Smalot
└── Magento
├── Action.php
├── ActionInterface.php
├── Cart
├── Cart.php
├── CartCoupon.php
├── CartCustomer.php
├── CartPayment.php
├── CartProduct.php
└── CartShipping.php
├── Catalog
├── Category.php
├── CategoryAttributes.php
├── Product.php
├── ProductAttribute.php
├── ProductAttributeSet.php
├── ProductCustomOption.php
├── ProductCustomOptionValue.php
├── ProductDownloadableLink.php
├── ProductLink.php
├── ProductMedia.php
├── ProductTag.php
├── ProductTierPrice.php
└── ProductType.php
├── CatalogInventory
└── StockItem.php
├── Core
└── Magento.php
├── Customer
├── Customer.php
├── CustomerAddress.php
└── CustomerGroup.php
├── CustomerBalance
├── StoreCredit.php
└── StoreCreditQuote.php
├── Directory
└── Directory.php
├── GiftMessage
└── GiftMessage.php
├── MagentoModuleAbstract.php
├── MultiCallQueue.php
├── MultiCallQueueInterface.php
├── Order
├── Order.php
├── OrderCreditMemo.php
├── OrderInvoice.php
└── OrderShipment.php
├── RemoteAdapter.php
├── RemoteAdapterException.php
├── RemoteAdapterInterface.php
└── Store
└── Store.php
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /.idea/*
2 | /coverage/*
3 | /samples/*
4 | /vendor/*
5 | /test*
6 | /xdebug/*
7 | /composer.phar
8 | /composer
9 | debug*
10 |
--------------------------------------------------------------------------------
/.travis.yml.old:
--------------------------------------------------------------------------------
1 | # .travis.yml
2 | language: php
3 |
4 | env:
5 | - DB=mysql
6 |
7 | mysql:
8 | database: magento_travis
9 | username: travis
10 | encoding: utf8
11 |
12 | php:
13 | - 5.3
14 | # - 5.4
15 | # - 5.5
16 |
17 | before_script:
18 | # install apache
19 | - sudo apt-get update > /dev/null
20 | - sudo apt-get install -y --force-yes apache2 libapache2-mod-php5 php5-curl php5-mysql php5-intl > /dev/null
21 | - sudo a2enmod actions > /dev/null
22 | - sudo a2enmod rewrite > /dev/null
23 | - echo "export PATH=/home/vagrant/.phpenv/bin:$PATH" | sudo tee -a /etc/apache2/envvars > /dev/null
24 | - echo "$(curl -fsSL https://gist.github.com/roderik/16d751c979fdeb5a14e3/raw/gistfile1.txt)" | sudo tee /etc/apache2/conf.d/phpconfig > /dev/null
25 | - echo "$(curl -fsSL https://gist.github.com/roderik/2eb301570ed4a1f4c33d/raw/gistfile1.txt)" | sed -e "s,PATH,`pwd`/web,g" | sudo tee /etc/apache2/sites-available/default > /dev/null
26 | - echo "127.0.0.1 magento.local" | sudo tee --append /etc/hosts
27 | - sudo service apache2 restart
28 |
29 | # setup mysql database
30 | - "mysql -e 'create database magento_travis;'"
31 |
32 | # clone magento and install data set test
33 | - wget -O modgit https://raw.github.com/jreinke/modgit/master/modgit
34 | - chmod +x modgit
35 | - sudo mv modgit /usr/local/bin
36 | - modgit init
37 | - modgit clone -t 1.7.0.2 magento https://github.com/jreinke/magento-mirror.git > /dev/null
38 | - wget -O magento-sample-data-1.6.1.0.zip http://www.magentocommerce.com/downloads/assets/1.6.1.0/magento-sample-data-1.6.1.0.zip
39 | - unzip -q magento-sample-data-1.6.1.0.zip > /dev/null
40 | - mysql -uroot magento_travis < magento-sample-data-1.6.1.0/magento_sample_data_for_1.6.1.0.sql
41 | - php -f install.php -- --license_agreement_accepted yes --locale en_GB --timezone Europe/Paris --default_currency EUR --db_host localhost --db_name magento_travis --db_user travis --db_pass "" --url http://magento.local/ --skip_url_validation yes --use_rewrites no --use_secure no --secure_base_url --use_secure_admin no --admin_firstname Sebastien --admin_lastname Malot --admin_email admin@example.com --admin_username admin --admin_password magento123
42 |
43 | # clone current project and download dependencies
44 | - curl -sS https://getcomposer.org/installer | php
45 | - chmod +x composer.phar
46 | - ./composer.phar update --prefer-source
47 |
48 | #script: curl "http://localhost/index.php"
49 | script: curl -s http://magento.local/ && sudo cat /var/log/apache2/error.log && curl -s http://localhost/index.php && sudo cat /var/log/apache2/error.log
50 |
51 | notifications:
52 | email:
53 | recipients:
54 | - sebastien@malot.fr
55 | - smalot@actualys.com
56 | on_success: always # [always|never|change] # default: change
57 | on_failure: always # [always|never|change] # default: always
58 |
59 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2013-2014 - Sebastien MALOT
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Magento API Client
2 |
3 | This library implements the [Magento](http://www.magentocommerce.com/) SOAP v1 (standard) API.
4 |
5 | [](https://scrutinizer-ci.com/g/smalot/magento-client/)
6 | [](https://packagist.org/packages/smalot/magento-client)
7 | [](https://packagist.org/packages/smalot/magento-client)
8 | [](https://packagist.org/packages/smalot/magento-client)
9 |
10 | Features:
11 |
12 | - allows wrappers
13 | - allows dependencies injections
14 | - allows code completion
15 | - auto-updated via [composer](http://www.getcomposer.org) packaging ([packagist.org](http://www.packagist.org))
16 |
17 | **Note:** This library is not related to [Magento Company](http://magento.com/).
18 |
19 | # Documentation
20 |
21 | This API is designed on top of [Magento SOAP API V1](http://www.magentocommerce.com/api/soap/introduction.html).
22 |
23 | Supported modules are :
24 | - Mage_Catalog
25 | - Mage_CatalogInventory
26 | - Mage_Checkout
27 | - Mage_Customer
28 | - Mage_Directory
29 | - Mage_Sales
30 | - Enterprise_CustomerBalance
31 | - Enterprise_CustomerGiftCard
32 | - Mage_GiftMessage
33 | - Mage_Core
34 | - Store View
35 |
36 | Module's names has been standardized to be more clean :
37 | - Catalog
38 | - CatalogInventory
39 | - Cart
40 | - Customer
41 | - Directory
42 | - Order
43 | - CustomerBalance
44 | - GiftCard
45 | - GiftMessage
46 | - Core
47 | - Store
48 |
49 | **Note :** `login` and `logout` calls are made only if needed.
50 |
51 | # Installation
52 |
53 | Download using [composer](http://getcomposer.org/):
54 |
55 | ```js
56 | {
57 | "require": {
58 | "smalot/magento-client": "*"
59 | }
60 | }
61 | ```
62 |
63 | Now tell composer to download the bundle by running the command:
64 |
65 | ``` bash
66 | $ php composer.phar update smalot/magento-client
67 | ```
68 |
69 | Composer will install the bundle to your project's `vendor/smalot` directory and `create`/`update` an autoload file.
70 |
71 | # License
72 |
73 | This library is provided under MIT license (since v0.5.0 release). See the complete license :
74 |
75 | LICENSE
76 |
77 | # Implementation
78 |
79 | Each `module manager`, which heritate from `MagentoModuleAbstract`, will generate an `action`.
80 |
81 | Actions can be either directly executed or added to a `queue`.
82 |
83 | If it is directly executed, it will generate a `single call`, if not, that's a `multi call`.
84 |
85 | ## Single Call
86 |
87 | Here is a sample code to load tree of categories of the `default` website in a single call.
88 |
89 | ```php
90 | getTree()->execute();
106 |
107 | var_dump($tree);
108 |
109 | ```
110 |
111 | ## Multi Call
112 |
113 | Multi call is only available on `Magento Soap v1`.
114 |
115 | That's why this library is built on top of `Magento Soap v1`.
116 |
117 | This function allows to group multiple soap calls into only one http request, which can be a very great optimization practice.
118 |
119 | It removes `network latency` and reduce magento bootstrap processes.
120 |
121 | Tipically, it can be used to synchronize a whole product catalog into very few number of calls.
122 |
123 | ```php
124 | getInfo(10)->addToQueue($queue);
143 | $productManager->getInfo(11)->addToQueue($queue);
144 | $productManager->getInfo(12)->addToQueue($queue);
145 |
146 | // Request in one multicall information of 3 products (#10, #11, #12)
147 | $products = $queue->execute();
148 |
149 | var_dump($products);
150 |
151 | ```
152 |
153 | ### Callback support for multicall
154 |
155 | ```php
156 | getTree()->addToQueue($queue, array($localAdapter, 'updateCategories'));
178 |
179 | // Store products into local catalog
180 | $productManager = new \Smalot\Magento\Catalog\Product($adapter);
181 | $productManager->getInfo(10)->addToQueue($queue, array($localAdapter, 'updateProduct'));
182 | $productManager->getInfo(11)->addToQueue($queue, array($localAdapter, 'updateProduct'));
183 | $productManager->getInfo(12)->addToQueue($queue, array($localAdapter, 'updateProduct'));
184 |
185 | // Update local catalog
186 | $products = $queue->execute();
187 |
188 | ```
189 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "smalot/magento-client",
3 | "description": "Magento API Client (SOAP v1). Allows wrappers for each call, dependency injections and code completion.",
4 | "license": "MIT",
5 | "authors": [
6 | {
7 | "name": "Sebastien MALOT",
8 | "email": "sebastien@malot.fr",
9 | "role": "Developer",
10 | "homepage": "http://www.malot.fr"
11 | }
12 | ],
13 | "support": {
14 | "issues": "https://github.com/smalot/magento-client/issues"
15 | },
16 | "require": {
17 | "php": ">=5.3.0"
18 | },
19 | "require-dev": {
20 | "atoum/atoum": "dev-master"
21 | },
22 | "autoload": {
23 | "psr-0": {
24 | "Smalot\\Magento\\": "src/"
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/composer.lock:
--------------------------------------------------------------------------------
1 | {
2 | "_readme": [
3 | "This file locks the dependencies of your project to a known state",
4 | "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
5 | ],
6 | "hash": "31347848a20072fbe4887ba991511609",
7 | "packages": [
8 |
9 | ],
10 | "packages-dev": [
11 | {
12 | "name": "atoum/atoum",
13 | "version": "dev-master",
14 | "source": {
15 | "type": "git",
16 | "url": "https://github.com/atoum/atoum.git",
17 | "reference": "ab221f3dfbca93ff5a88f45070d8743db419d546"
18 | },
19 | "dist": {
20 | "type": "zip",
21 | "url": "https://api.github.com/repos/atoum/atoum/zipball/ab221f3dfbca93ff5a88f45070d8743db419d546",
22 | "reference": "ab221f3dfbca93ff5a88f45070d8743db419d546",
23 | "shasum": ""
24 | },
25 | "require": {
26 | "ext-hash": "*",
27 | "ext-json": "*",
28 | "ext-session": "*",
29 | "ext-tokenizer": "*",
30 | "ext-xml": "*",
31 | "php": ">=5.3.3"
32 | },
33 | "replace": {
34 | "mageekguy/atoum": "*"
35 | },
36 | "suggest": {
37 | "ext-mbstring": "Provides support for UTF-8 strings"
38 | },
39 | "bin": [
40 | "bin/atoum"
41 | ],
42 | "type": "library",
43 | "autoload": {
44 | "classmap": [
45 | "classes/"
46 | ]
47 | },
48 | "notification-url": "https://packagist.org/downloads/",
49 | "license": [
50 | "BSD"
51 | ],
52 | "authors": [
53 | {
54 | "name": "Frédéric Hardy",
55 | "email": "frederic.hardy@atoum.org",
56 | "homepage": "http://blog.mageekbox.net"
57 | },
58 | {
59 | "name": "François Dussert",
60 | "email": "francois.dussert@atoum.org"
61 | },
62 | {
63 | "name": "Gérald Croes",
64 | "email": "gerald.croes@atoum.org"
65 | },
66 | {
67 | "name": "Julien Bianchi",
68 | "email": "julien.bianchi@atoum.org"
69 | },
70 | {
71 | "name": "Ludovic Fleury",
72 | "email": "ludovic.fleury@atoum.org"
73 | }
74 | ],
75 | "description": "Simple modern and intuitive unit testing framework for PHP 5.3+",
76 | "homepage": "http://www.atoum.org",
77 | "keywords": [
78 | "TDD",
79 | "atoum",
80 | "test",
81 | "unit testing"
82 | ],
83 | "time": "2013-10-24 11:42:42"
84 | }
85 | ],
86 | "aliases": [
87 |
88 | ],
89 | "minimum-stability": "stable",
90 | "stability-flags": {
91 | "atoum/atoum": 20
92 | },
93 | "platform": {
94 | "php": ">=5.3.0"
95 | },
96 | "platform-dev": [
97 |
98 | ]
99 | }
100 |
--------------------------------------------------------------------------------
/docs/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smalot/magento-client/4630ae0502df8a7fd1e4aca41b92b050af62d113/docs/README.md
--------------------------------------------------------------------------------
/docs/catalog/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smalot/magento-client/4630ae0502df8a7fd1e4aca41b92b050af62d113/docs/catalog/README.md
--------------------------------------------------------------------------------
/docs/catalog/product.md:
--------------------------------------------------------------------------------
1 | # Product
2 |
3 | This documentation file refers to `Catalog/Product` module.
4 |
5 | ## Methods
6 |
7 | ### create
8 | ### setCurrentStore
9 | ### delete
10 | ### getSpecialPrice
11 | ### getInfo
12 | ### getList
13 | ### getListOfAdditionalAttributes
14 | ### setSpecialPrice
15 | ### update
16 |
17 | ## Complex filters structure
18 |
19 | The following filter will select all products updated after '2013-11-19 10:00:00'.
20 |
21 | ````
22 | $filters = array(
23 | 'complex_filter' => array(
24 | (object) array(
25 | 'key' => 'updated_at',
26 | 'value' => (object) array(
27 | 'key' => 'gt',
28 | 'value' => '2013-11-19 10:00:00',
29 | ),
30 | ),
31 | ),
32 | );
33 | ````
34 |
35 | ### List of available conditions
36 |
37 | | Key to use | Equivalent | Meaning |
38 | | ----------- |:----------:| ------- |
39 | | eq | = | equals |
40 | | neq | <> | not equals |
41 | | like | LIKE | |
42 | | nlike | NOT LIKE | |
43 | | in | IN () | in |
44 | | nin | NOT IN () | not in |
45 | | notnull | NOT NULL | |
46 | | null | NULL | |
47 | | gt | > | greater than |
48 | | lt | < | lower than |
49 | | gteq | >= | greater or equal to |
50 | | lteq | <= | lower or equal to |
51 | | finset | FIND_IN_SET() | |
52 | | regexp | REGEXP | |
53 | | from | >= | |
54 | | to | <= | |
55 | | seq | | |
56 | | sneq | | |
57 |
--------------------------------------------------------------------------------
/docs/customer/customer.md:
--------------------------------------------------------------------------------
1 | # Customer
2 |
3 | This documentation file refers to `Customer/Customer` module.
4 |
5 | ## Methods
6 |
7 | ### create
8 | ### delete
9 | ### getInfo
10 | ### getList
11 |
12 | Search for customers by `email`:
13 |
14 | ``` php
15 | 'test@domain.local',
19 | );
20 |
21 | $manager = new \Smalot\Magento\Customer\Customer($connexion);
22 | $customers = $manager->getList($filters)->execute();
23 |
24 | ```
25 |
26 | Check a customer `password`:
27 |
28 | ``` php
29 | $email,
37 | );
38 |
39 | $manager = new \Smalot\Magento\Customer\Customer($connexion);
40 | $customers = $manager->getList($filters)->execute();
41 |
42 | if (!empty($customers)) {
43 | $password_hash = $customer[0]['password_hash'];
44 | list($hash, $salt) = explode(':', $password_hash);
45 |
46 | if (md5($salt . $password) === $hash) {
47 | echo 'Matching password';
48 | } else {
49 | echo 'Invalid password';
50 | }
51 | } else {
52 | echo 'Customer not found';
53 | }
54 |
55 | ```
56 |
57 | ### update
58 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/Action.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento;
18 |
19 | /**
20 | * Class Action
21 | *
22 | * @package Smalot\Magento
23 | */
24 | class Action implements ActionInterface
25 | {
26 | /**
27 | * @var string
28 | */
29 | protected $method = null;
30 |
31 | /**
32 | * @var array
33 | */
34 | protected $arguments = null;
35 |
36 | /**
37 | * @var RemoteAdapterInterface
38 | */
39 | protected $remoteAdapter = null;
40 |
41 | /**
42 | * @param string $method
43 | * @param array $arguments
44 | * @param RemoteAdapterInterface $remoteAdapter
45 | */
46 | public function __construct($method, array $arguments = array(), RemoteAdapterInterface $remoteAdapter = null)
47 | {
48 | $this->method = $method;
49 | $this->arguments = $arguments;
50 | $this->remoteAdapter = $remoteAdapter;
51 | }
52 |
53 | /**
54 | * @return string
55 | */
56 | public function getMethod()
57 | {
58 | return $this->method;
59 | }
60 |
61 | /**
62 | * @return array
63 | */
64 | public function getArguments()
65 | {
66 | return $this->arguments;
67 | }
68 |
69 | /**
70 | * @return array
71 | */
72 | public function execute()
73 | {
74 | return $this->remoteAdapter->call($this);
75 | }
76 |
77 | /**
78 | * @param MultiCallQueueInterface $queue
79 | * @param callable $callback
80 | *
81 | * @return mixed|void
82 | */
83 | public function addToQueue(MultiCallQueueInterface $queue, $callback = null)
84 | {
85 | $queue->addAction($this, $callback);
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/ActionInterface.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento;
18 |
19 | /**
20 | * Class ActionInterface
21 | *
22 | * @package Smalot\Magento
23 | */
24 | interface ActionInterface
25 | {
26 | /**
27 | * @return string
28 | */
29 | public function getMethod();
30 |
31 | /**
32 | * @return array
33 | */
34 | public function getArguments();
35 |
36 | /**
37 | * @return array
38 | */
39 | public function execute();
40 |
41 | /**
42 | * @param MultiCallQueueInterface $queue
43 | * @param callable $callback
44 | *
45 | * @return mixed
46 | */
47 | public function addToQueue(MultiCallQueueInterface $queue, $callback = null);
48 | }
49 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/Cart/Cart.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\Cart;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class Cart
24 | *
25 | * @package Smalot\Magento\Cart
26 | */
27 | class Cart extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Allows you to create an empty shopping cart.
31 | *
32 | * @param string $storeId
33 | *
34 | * @return ActionInterface
35 | */
36 | public function create($storeId = null)
37 | {
38 | return $this->__createAction('cart.create', func_get_args());
39 | }
40 |
41 | /**
42 | * Allows you to retrieve full information about the shopping cart (quote).
43 | *
44 | * @param int $quoteId
45 | * @param string $store
46 | *
47 | * @return ActionInterface
48 | */
49 | public function getInfo($quoteId, $store = null)
50 | {
51 | return $this->__createAction('cart.info', func_get_args());
52 | }
53 |
54 | /**
55 | * Allows you to retrieve the website license agreement for the quote according to the website (store).
56 | *
57 | * @param int $quoteId
58 | * @param string $store
59 | *
60 | * @return ActionInterface
61 | */
62 | public function getLicense($quoteId, $store = null)
63 | {
64 | return $this->__createAction('cart.license', func_get_args());
65 | }
66 |
67 | /**
68 | * Allows you to create an order from a shopping cart (quote).
69 | * Before placing the order, you need to add the customer, customer address, shipping and payment methods.
70 | *
71 | * @param int $quoteId
72 | * @param string $store
73 | * @param array $agreements
74 | *
75 | * @return ActionInterface
76 | */
77 | public function order($quoteId, $store = null, $agreements = null)
78 | {
79 | return $this->__createAction('cart.order', func_get_args());
80 | }
81 |
82 | /**
83 | * Allows you to retrieve total prices for a shopping cart (quote).
84 | *
85 | * @param int $quoteId
86 | * @param string $store
87 | *
88 | * @return ActionInterface
89 | */
90 | public function getTotals($quoteId, $store = null)
91 | {
92 | return $this->__createAction('cart.totals', func_get_args());
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/Cart/CartCoupon.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\Cart;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class CartCoupon
24 | *
25 | * @package Smalot\Magento\Cart
26 | */
27 | class CartCoupon extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Allows you to add a coupon code for a shopping cart (quote).
31 | * The shopping cart must not be empty.
32 | *
33 | * @param int $quoteId
34 | * @param string $couponCode
35 | * @param string $store
36 | *
37 | * @return ActionInterface
38 | */
39 | public function add($quoteId, $couponCode, $store = null)
40 | {
41 | return $this->__createAction('cart_coupon.add', func_get_args());
42 | }
43 |
44 | /**
45 | * Allows you to remove a coupon code from a shopping cart (quote).
46 | *
47 | * @param int $quoteId
48 | * @param string $store
49 | *
50 | * @return ActionInterface
51 | */
52 | public function remove($quoteId, $store = null)
53 | {
54 | return $this->__createAction('cart_coupon.remove', func_get_args());
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/Cart/CartCustomer.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\Cart;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class CartCustomer
24 | *
25 | * @package Smalot\Magento\Cart
26 | */
27 | class CartCustomer extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Allows you to set the customer addresses in the shopping cart (quote).
31 | *
32 | * @param int $quoteId
33 | * @param array $customerAddressData
34 | * @param string $store
35 | *
36 | * @return ActionInterface
37 | */
38 | public function setAddresses($quoteId, $customerAddressData, $store = null)
39 | {
40 | return $this->__createAction('cart_customer.addresses', func_get_args());
41 | }
42 |
43 | /**
44 | * Allows you to add information about the customer to a shopping cart (quote).
45 | *
46 | * @param int $quoteId
47 | * @param array $customerData
48 | * @param string $store
49 | *
50 | * @return ActionInterface
51 | */
52 | public function setCustomer($quoteId, $customerData, $store = null)
53 | {
54 | return $this->__createAction('cart_customer.set', func_get_args());
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/Cart/CartPayment.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\Cart;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class CartPayment
24 | *
25 | * @package Smalot\Magento\Cart
26 | */
27 | class CartPayment extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Allows you to retrieve a list of available payment methods for a shopping cart (quote).
31 | *
32 | * @param int $quoteId
33 | * @param string $store
34 | *
35 | * @return ActionInterface
36 | */
37 | public function getList($quoteId, $store = null)
38 | {
39 | return $this->__createAction('cart_payment.list', func_get_args());
40 | }
41 |
42 | /**
43 | * Allows you to set a payment method for a shopping cart (quote).
44 | *
45 | * @param int $quoteId
46 | * @param array $paymentData
47 | * @param string $store
48 | *
49 | * @return ActionInterface
50 | */
51 | public function getMethod($quoteId, $paymentData, $store = null)
52 | {
53 | return $this->__createAction('cart_payment.method', func_get_args());
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/Cart/CartProduct.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\Cart;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class CartProduct
24 | *
25 | * @package Smalot\Magento\Cart
26 | */
27 | class CartProduct extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Allows you to add one or more products to the shopping cart (quote).
31 | *
32 | * @param int $quoteId
33 | * @param array $productsData
34 | * @param string $storeId
35 | *
36 | * @return ActionInterface
37 | */
38 | public function add($quoteId, $productsData, $storeId = null)
39 | {
40 | return $this->__createAction('cart_product.add', func_get_args());
41 | }
42 |
43 | /**
44 | * Allows you to retrieve the list of products in the shopping cart (quote).
45 | *
46 | * @param int $quoteId
47 | * @param string $store
48 | *
49 | * @return ActionInterface
50 | */
51 | public function getList($quoteId, $store = null)
52 | {
53 | return $this->__createAction('cart_product.list', func_get_args());
54 | }
55 |
56 | /**
57 | * Allows you to move products from the current quote to a customer quote.
58 | *
59 | * @param int $quoteId
60 | * @param array $productsData
61 | * @param string $store
62 | *
63 | * @return ActionInterface
64 | */
65 | public function moveToCustomerQuote($quoteId, $productsData, $store = null)
66 | {
67 | return $this->__createAction('cart_product.moveToCustomerQuote', func_get_args());
68 | }
69 |
70 | /**
71 | * Allows you to remove one or several products from a shopping cart (quote).
72 | *
73 | * @param int $quoteId
74 | * @param array $productsData
75 | * @param string $store
76 | *
77 | * @return ActionInterface
78 | */
79 | public function remove($quoteId, $productsData, $store = null)
80 | {
81 | return $this->__createAction('cart_product.remove', func_get_args());
82 | }
83 |
84 | /**
85 | * Allows you to update one or several products in the shopping cart (quote).
86 | *
87 | * @param int $quoteId
88 | * @param array $productsData
89 | * @param string $store
90 | *
91 | * @return ActionInterface
92 | */
93 | public function update($quoteId, $productsData, $store = null)
94 | {
95 | return $this->__createAction('cart_product.update', func_get_args());
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/Cart/CartShipping.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\Cart;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class CartShipping
24 | *
25 | * @package Smalot\Magento\Cart
26 | */
27 | class CartShipping extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Allows you to retrieve the list of available shipping methods for a shopping cart (quote).
31 | *
32 | * @param int $quoteId
33 | * @param string $store
34 | *
35 | * @return ActionInterface
36 | */
37 | public function getList($quoteId, $store = null)
38 | {
39 | return $this->__createAction('cart_shipping.list', func_get_args());
40 | }
41 |
42 | /**
43 | * Allows you to set a shipping method for a shopping cart (quote).
44 | *
45 | * @param int $quoteId
46 | * @param string $shippingMethod
47 | * @param string $store
48 | *
49 | * @return ActionInterface
50 | */
51 | public function getMethod($quoteId, $shippingMethod, $store = null)
52 | {
53 | return $this->__createAction('cart_shipping.method', func_get_args());
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/Catalog/Category.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\Catalog;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class Category
24 | *
25 | * @package Smalot\Magento\Catalog
26 | */
27 | class Category extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Retrieve the list of products assigned to a required category.
31 | *
32 | * @param int $categoryId
33 | *
34 | * @return ActionInterface
35 | */
36 | public function getAssignedProducts($categoryId)
37 | {
38 | return $this->__createAction('catalog_category.assignedProducts', func_get_args());
39 | }
40 |
41 | /**
42 | * Assign a product to the required category.
43 | *
44 | * @param int $categoryId
45 | * @param string $productId
46 | * @param string $position
47 | * @param string $identifierType
48 | *
49 | * @return ActionInterface
50 | */
51 | public function assignProduct($categoryId, $productId, $position = null, $identifierType = null)
52 | {
53 | return $this->__createAction('catalog_category.assignProduct', func_get_args());
54 | }
55 |
56 | /**
57 | * Create a new category and return its ID.
58 | *
59 | * @param int $parentId
60 | * @param array $categoryData
61 | * @param string $storeView
62 | *
63 | * @return ActionInterface
64 | */
65 | public function create($parentId, $categoryData, $storeView = null)
66 | {
67 | return $this->__createAction('catalog_category.create', func_get_args());
68 | }
69 |
70 | /**
71 | * Allows you to set/get the current store view.
72 | *
73 | * @param string $storeView
74 | *
75 | * @return ActionInterface
76 | */
77 | public function setCurrentStore($storeView)
78 | {
79 | return $this->__createAction('catalog_category.currentStore', func_get_args());
80 | }
81 |
82 | /**
83 | * Allows you to delete the required category.
84 | *
85 | * @param int $categoryId
86 | *
87 | * @return ActionInterface
88 | */
89 | public function delete($categoryId)
90 | {
91 | return $this->__createAction('catalog_category.delete', func_get_args());
92 | }
93 |
94 | /**
95 | * Allows you to retrieve information about the required category.
96 | *
97 | * @param int $categoryId
98 | * @param string $storeView
99 | * @param array $attributes
100 | *
101 | * @return ActionInterface
102 | */
103 | public function getInfo($categoryId, $storeView = null, $attributes = null)
104 | {
105 | return $this->__createAction('catalog_category.info', func_get_args());
106 | }
107 |
108 | /**
109 | * Allows you to retrieve one level of categories by a website, a store view, or a parent category.
110 | *
111 | * @param string $website
112 | * @param string $storeView
113 | * @param string $parentCategory
114 | *
115 | * @return ActionInterface
116 | */
117 | public function getLevel($website, $storeView = null, $parentCategory = null)
118 | {
119 | return $this->__createAction('catalog_category.level', func_get_args());
120 | }
121 |
122 | /**
123 | * Allows you to move the required category in the category tree.
124 | *
125 | * @param int $categoryId
126 | * @param int $parentId
127 | * @param string $afterId
128 | *
129 | * @return ActionInterface
130 | */
131 | public function move($categoryId, $parentId, $afterId = null)
132 | {
133 | return $this->__createAction('catalog_category.move', func_get_args());
134 | }
135 |
136 | /**
137 | * Allows you to remove the product assignment from the category.
138 | *
139 | * @param int $categoryId
140 | * @param string $productId
141 | * @param string $identifierType
142 | *
143 | * @return ActionInterface
144 | */
145 | public function removeProduct($categoryId, $productId, $identifierType = null)
146 | {
147 | return $this->__createAction('catalog_category.removeProduct', func_get_args());
148 | }
149 |
150 | /**
151 | * Allows you to retrieve the hierarchical tree of categories.
152 | *
153 | * @param string $parentId
154 | * @param string $storeView
155 | *
156 | * @return ActionInterface
157 | */
158 | public function getTree($parentId = null, $storeView = null)
159 | {
160 | return $this->__createAction('catalog_category.tree', func_get_args());
161 | }
162 |
163 | /**
164 | * Update the required category. Note that you should specify only those parameters which you want to be updated.
165 | *
166 | * @param int $categoryId
167 | * @param array $categoryData
168 | * @param string $storeView
169 | *
170 | * @return ActionInterface
171 | */
172 | public function update($categoryId, $categoryData, $storeView = null)
173 | {
174 | return $this->__createAction('catalog_category.update', func_get_args());
175 | }
176 |
177 | /**
178 | * Allows you to update the product assigned to a category. The product position is updated.
179 | *
180 | * @param int $categoryId
181 | * @param string $productId
182 | * @param string $position
183 | * @param string $identifierType
184 | *
185 | * @return ActionInterface
186 | */
187 | public function updateProduct($categoryId, $productId, $position = null, $identifierType = null)
188 | {
189 | return $this->__createAction('catalog_category.updateProduct', func_get_args());
190 | }
191 | }
192 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/Catalog/CategoryAttributes.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\Catalog;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class CategoryAttributes
24 | *
25 | * @package Smalot\Magento\Catalog
26 | */
27 | class CategoryAttributes extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Allows you to set/get the current store view.
31 | *
32 | * @param string $storeView
33 | *
34 | * @return ActionInterface
35 | */
36 | public function setCurrentStore($storeView)
37 | {
38 | return $this->__createAction('catalog_category_attribute.currentStore', func_get_args());
39 | }
40 |
41 | /**
42 | * Allows you to retrieve the list of category attributes.
43 | *
44 | * @return ActionInterface
45 | */
46 | public function getList()
47 | {
48 | return $this->__createAction('catalog_category_attribute.list', func_get_args());
49 | }
50 |
51 | /**
52 | * Allows you to retrieve the attribute options.
53 | *
54 | * @param string $attributeId
55 | * @param string $storeView
56 | *
57 | * @return ActionInterface
58 | */
59 | public function getOptions($attributeId, $storeView = null)
60 | {
61 | return $this->__createAction('catalog_category_attribute.options', func_get_args());
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/Catalog/Product.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\Catalog;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class Product
24 | *
25 | * @package Smalot\Magento\Catalog
26 | */
27 | class Product extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Allows you to create a new product and return ID of the created product.
31 | *
32 | * @param string $type
33 | * @param string $set
34 | * @param string $sku
35 | * @param array $productData
36 | * @param string $storeView
37 | *
38 | * @return ActionInterface
39 | */
40 | public function create($type, $set, $sku, $productData, $storeView = null)
41 | {
42 | return $this->__createAction('catalog_product.create', func_get_args());
43 | }
44 |
45 | /**
46 | * Allows you to set/get the current store view.
47 | *
48 | * @param string $storeView
49 | *
50 | * @return ActionInterface
51 | */
52 | public function setCurrentStore($storeView)
53 | {
54 | return $this->__createAction('catalog_product.currentStore', func_get_args());
55 | }
56 |
57 |
58 | /**
59 | * Allows you to delete the required product.
60 | *
61 | * @param string $productId
62 | * @param string $identifierType
63 | *
64 | * @return ActionInterface
65 | */
66 | public function delete($productId, $identifierType = null)
67 | {
68 | return $this->__createAction('catalog_product.delete', func_get_args());
69 | }
70 |
71 | /**
72 | * Allows you to get the product special price data.
73 | *
74 | * @param string $productId
75 | * @param string $storeView
76 | * @param string $identifierType
77 | *
78 | * @return ActionInterface
79 | */
80 | public function getSpecialPrice($productId, $storeView = null, $identifierType = null)
81 | {
82 | return $this->__createAction('catalog_product.getSpecialPrice', func_get_args());
83 | }
84 |
85 | /**
86 | * Allows you to retrieve information about the required product.
87 | *
88 | * @param string $productId
89 | * @param string $storeView
90 | * @param string $attributes
91 | * @param string $identifierType
92 | *
93 | * @return ActionInterface
94 | */
95 | public function getInfo($productId, $storeView = null, $attributes = null, $identifierType = null)
96 | {
97 | return $this->__createAction('catalog_product.info', func_get_args());
98 | }
99 |
100 | /**
101 | * Allows you to retrieve the list of products.
102 | *
103 | * @param array $filters
104 | * @param string $storeView
105 | *
106 | * @return ActionInterface
107 | */
108 | public function getList($filters, $storeView = null)
109 | {
110 | return $this->__createAction('catalog_product.list', func_get_args());
111 | }
112 |
113 | /**
114 | * Get the list of additional attributes.
115 | * Additional attributes are attributes that are not in the default set of attributes.
116 | *
117 | * @param string $productType
118 | * @param string $attributeSetId
119 | *
120 | * @return ActionInterface
121 | */
122 | public function getListOfAdditionalAttributes($productType, $attributeSetId)
123 | {
124 | return $this->__createAction('catalog_product.listOfAdditionalAttributes', func_get_args());
125 | }
126 |
127 | /**
128 | * Allows you to set the product special price.
129 | *
130 | * @param string $productId
131 | * @param string $specialPrice
132 | * @param string $fromDate
133 | * @param string $toDate
134 | * @param string $storeView
135 | * @param string $productIdentifierType
136 | *
137 | * @return ActionInterface
138 | */
139 | public function setSpecialPrice(
140 | $productId,
141 | $specialPrice,
142 | $fromDate,
143 | $toDate,
144 | $storeView = null,
145 | $productIdentifierType = null
146 | ) {
147 | return $this->__createAction('catalog_product.setSpecialPrice', func_get_args());
148 | }
149 |
150 | /**
151 | * Allows you to update the required product.
152 | * Note that you should specify only those parameters which you want to be updated.
153 | *
154 | * @param string $productId
155 | * @param array $productData
156 | * @param string $storeView
157 | * @param string $identifierType
158 | *
159 | * @return ActionInterface
160 | */
161 | public function update($productId, $productData, $storeView = null, $identifierType = null)
162 | {
163 | return $this->__createAction('catalog_product.update', func_get_args());
164 | }
165 | }
166 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/Catalog/ProductAttribute.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\Catalog;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class ProductAttribute
24 | *
25 | * @package Smalot\Magento\Catalog
26 | */
27 | class ProductAttribute extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Allows you to add a new option for attributes with selectable fields.
31 | *
32 | * @param string $attribute
33 | * @param array $data
34 | *
35 | * @return ActionInterface
36 | */
37 | public function addOption($attribute, $data)
38 | {
39 | return $this->__createAction('product_attribute.addOption', func_get_args());
40 | }
41 |
42 | /**
43 | * Allows you to create a new product attribute.
44 | *
45 | * @param array $data
46 | *
47 | * @return ActionInterface
48 | */
49 | public function create($data)
50 | {
51 | return $this->__createAction('product_attribute.create', func_get_args());
52 | }
53 |
54 | /**
55 | * Allows you to set/get the current store view.
56 | *
57 | * @param string $storeView
58 | *
59 | * @return ActionInterface
60 | */
61 | public function setCurrentStore($storeView)
62 | {
63 | return $this->__createAction('product_attribute.currentStore', func_get_args());
64 | }
65 |
66 | /**
67 | * Allows you to get full information about a required attribute with the list of options.
68 | *
69 | * @param string $attribute
70 | *
71 | * @return ActionInterface
72 | */
73 | public function getInfo($attribute)
74 | {
75 | return $this->__createAction('product_attribute.info', func_get_args());
76 | }
77 |
78 | /**
79 | * Allows you to retrieve the list of product attributes.
80 | *
81 | * @param string $setId
82 | *
83 | * @return ActionInterface
84 | */
85 | public function getList($setId)
86 | {
87 | return $this->__createAction('product_attribute.list', func_get_args());
88 | }
89 |
90 | /**
91 | * Allows you to retrieve the product attribute options.
92 | *
93 | * @param string $attributeId
94 | * @param string $storeView
95 | *
96 | * @return ActionInterface
97 | */
98 | public function getOptions($attributeId, $storeView = null)
99 | {
100 | return $this->__createAction('product_attribute.options', func_get_args());
101 | }
102 |
103 | /**
104 | * Allows you to remove the required attribute from a product.
105 | *
106 | * @param string $attribute
107 | *
108 | * @return ActionInterface
109 | */
110 | public function remove($attribute)
111 | {
112 | return $this->__createAction('product_attribute.remove', func_get_args());
113 | }
114 |
115 | /**
116 | * Allows you to remove the option for an attribute.
117 | *
118 | * @param string $attribute
119 | * @param string $optionId
120 | *
121 | * @return ActionInterface
122 | */
123 | public function removeOption($attribute, $optionId)
124 | {
125 | return $this->__createAction('product_attribute.removeOption', func_get_args());
126 | }
127 |
128 | /**
129 | * Allows you to retrieve the list of possible attribute types.
130 | *
131 | * @return ActionInterface
132 | */
133 | public function getTypes()
134 | {
135 | return $this->__createAction('product_attribute.types', func_get_args());
136 | }
137 |
138 | /**
139 | * Allows you to update the required attribute.
140 | *
141 | * @param string $attribute
142 | * @param array $data
143 | *
144 | * @return ActionInterface
145 | */
146 | public function update($attribute, $data)
147 | {
148 | return $this->__createAction('product_attribute.update', func_get_args());
149 | }
150 | }
151 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/Catalog/ProductAttributeSet.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\Catalog;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class ProductAttributeSet
24 | *
25 | * @package Smalot\Magento\Catalog
26 | */
27 | class ProductAttributeSet extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Allows you to add an existing attribute to an attribute set.
31 | *
32 | * @param string $attributeId
33 | * @param string $attributeSetId
34 | * @param string $attributeGroupId
35 | * @param string $sortOrder
36 | *
37 | * @return ActionInterface
38 | */
39 | public function attributeAdd($attributeId, $attributeSetId, $attributeGroupId = null, $sortOrder = null)
40 | {
41 | return $this->__createAction('product_attribute_set.attributeAdd', func_get_args());
42 | }
43 |
44 | /**
45 | * Allows you to remove an existing attribute from an attribute set.
46 | *
47 | * @param string $attributeId
48 | * @param string $attributeSetId
49 | *
50 | * @return ActionInterface
51 | */
52 | public function attributeRemove($attributeId, $attributeSetId)
53 | {
54 | return $this->__createAction('product_attribute_set.attributeRemove', func_get_args());
55 | }
56 |
57 | /**
58 | * Allows you to create a new attribute set based on another attribute set.
59 | *
60 | * @param string $attributeSetName
61 | * @param string $skeletonSetId
62 | *
63 | * @return ActionInterface
64 | */
65 | public function create($attributeSetName, $skeletonSetId)
66 | {
67 | return $this->__createAction('product_attribute_set.create', func_get_args());
68 | }
69 |
70 | /**
71 | * Allows you to add a new group for attributes to the attribute set.
72 | *
73 | * @param string $attributeSetId
74 | * @param string $groupName
75 | *
76 | * @return ActionInterface
77 | */
78 | public function groupAdd($attributeSetId, $groupName)
79 | {
80 | return $this->__createAction('product_attribute_set.groupAdd', func_get_args());
81 | }
82 |
83 | /**
84 | * Allows you to remove a group from an attribute set.
85 | *
86 | * @param string $attributeGroupId
87 | *
88 | * @return ActionInterface
89 | */
90 | public function groupRemove($attributeGroupId)
91 | {
92 | return $this->__createAction('product_attribute_set.groupRemove', func_get_args());
93 | }
94 |
95 | /**
96 | * Allows you to rename a group in the attribute set.
97 | *
98 | * @param string $groupId
99 | * @param string $groupName
100 | *
101 | * @return ActionInterface
102 | */
103 | public function groupRename($groupId, $groupName)
104 | {
105 | return $this->__createAction('product_attribute_set.groupRename', func_get_args());
106 | }
107 |
108 | /**
109 | * Allows you to retrieve the list of product attribute sets.
110 | *
111 | * @return ActionInterface
112 | */
113 | public function getList()
114 | {
115 | return $this->__createAction('product_attribute_set.list', func_get_args());
116 | }
117 |
118 | /**
119 | * Allows you to remove an existing attribute set.
120 | *
121 | * @param string $attributeSetId
122 | * @param string $forceProductsRemove
123 | *
124 | * @return ActionInterface
125 | */
126 | public function remove($attributeSetId, $forceProductsRemove)
127 | {
128 | return $this->__createAction('product_attribute_set.remove', func_get_args());
129 | }
130 | }
131 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/Catalog/ProductCustomOption.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\Catalog;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class ProductCustomOption
24 | *
25 | * @package Smalot\Magento\Catalog
26 | */
27 | class ProductCustomOption extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Allows you to add a new custom option for a product.
31 | *
32 | * @param string $productId
33 | * @param array $data
34 | * @param string $store
35 | *
36 | * @return ActionInterface
37 | */
38 | public function add($productId, $data, $store = null)
39 | {
40 | return $this->__createAction('product_custom_option.add', func_get_args());
41 | }
42 |
43 | /**
44 | * Allows you to retrieve full information about the custom option in a product.
45 | *
46 | * @param string $optionId
47 | * @param string $store
48 | *
49 | * @return ActionInterface
50 | */
51 | public function getInfo($optionId, $store = null)
52 | {
53 | return $this->__createAction('product_custom_option.info', func_get_args());
54 | }
55 |
56 | /**
57 | * Allows you to retrieve the list of custom options for a specific product.
58 | *
59 | * @param string $productId
60 | * @param string $store
61 | *
62 | * @return ActionInterface
63 | */
64 | public function getList($productId, $store = null)
65 | {
66 | return $this->__createAction('product_custom_option.list', func_get_args());
67 | }
68 |
69 | /**
70 | * Allows you to remove a custom option from the product.
71 | *
72 | * @param string $optionId
73 | *
74 | * @return ActionInterface
75 | */
76 | public function remove($optionId)
77 | {
78 | return $this->__createAction('product_custom_option.remove', func_get_args());
79 |
80 | }
81 |
82 | /**
83 | * Allows you to retrieve the list of available custom option types.
84 | *
85 | * @return ActionInterface
86 | */
87 | public function getTypes()
88 | {
89 | return $this->__createAction('product_custom_option.types', func_get_args());
90 | }
91 |
92 | /**
93 | * Allows you to update the required product custom option.
94 | *
95 | * @param string $optionId
96 | * @param array $data
97 | * @param string $store
98 | *
99 | * @return ActionInterface
100 | */
101 | public function update($optionId, $data, $store = null)
102 | {
103 | return $this->__createAction('product_custom_option.update', func_get_args());
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/Catalog/ProductCustomOptionValue.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\Catalog;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class ProductCustomOptionValue
24 | *
25 | * @package Smalot\Magento\Catalog
26 | */
27 | class ProductCustomOptionValue extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Allows you to add a new custom option value to a custom option.
31 | * Note that the custom option value can be added only to the option with the Select Input Type.
32 | *
33 | * @param string $optionId
34 | * @param array $data
35 | * @param string $store
36 | *
37 | * @return ActionInterface
38 | */
39 | public function add($optionId, $data, $store = null)
40 | {
41 | return $this->__createAction('product_custom_option_value.add', func_get_args());
42 | }
43 |
44 | /**
45 | * Allows you to retrieve full information about the specified product custom option value.
46 | *
47 | * @param string $valueId
48 | * @param string $store
49 | *
50 | * @return ActionInterface
51 | */
52 | public function getInfo($valueId, $store = null)
53 | {
54 | return $this->__createAction('product_custom_option_value.info', func_get_args());
55 | }
56 |
57 | /**
58 | * Allows you to retrieve the list of product custom option values.
59 | * Note that the method is available only for the option Select Input Type.
60 | *
61 | * @param string $optionId
62 | * @param string $store
63 | *
64 | * @return ActionInterface
65 | */
66 | public function getList($optionId, $store = null)
67 | {
68 | return $this->__createAction('product_custom_option_value.list', func_get_args());
69 | }
70 |
71 | /**
72 | * Allows you to remove the custom option value from a product.
73 | *
74 | * @param string $valueId
75 | *
76 | * @return ActionInterface
77 | */
78 | public function remove($valueId)
79 | {
80 | return $this->__createAction('product_custom_option_value.remove', func_get_args());
81 | }
82 |
83 | /**
84 | * Allows you to update the product custom option value.
85 | *
86 | * @param string $valueId
87 | * @param array $data
88 | * @param string $store
89 | *
90 | * @return ActionInterface
91 | */
92 | public function update($valueId, $data, $store = null)
93 | {
94 | return $this->__createAction('product_custom_option_value.update', func_get_args());
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/Catalog/ProductDownloadableLink.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\Catalog;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class ProductDownloadableLink
24 | *
25 | * @package Smalot\Magento\Catalog
26 | */
27 | class ProductDownloadableLink extends MagentoModuleAbstract
28 | {
29 | const TYPE_SAMPLE = 'sample';
30 |
31 | const TYPE_LINK = 'link';
32 |
33 | /**
34 | * Allows you to add a new link to a downloadable product.
35 | *
36 | * @param string $productId
37 | * @param array $resource
38 | * @param string $resourceType
39 | * @param string $store
40 | * @param string $identifierType
41 | *
42 | * @return ActionInterface
43 | */
44 | public function add($productId, $resource, $resourceType, $store = null, $identifierType = null)
45 | {
46 | return $this->__createAction('product_downloadable_link.add', func_get_args());
47 | }
48 |
49 | /**
50 | * Allows you to retrieve a list of links of a downloadable product.
51 | *
52 | * @param string $productId
53 | * @param string $store
54 | * @param string $identifierType
55 | *
56 | * @return ActionInterface
57 | */
58 | public function getList($productId, $store = null, $identifierType = null)
59 | {
60 | return $this->__createAction('product_downloadable_link.list', func_get_args());
61 | }
62 |
63 | /**
64 | * Allows you to remove a link/sample from a downloadable product.
65 | *
66 | * @param string $linkId
67 | * @param string $resourceType
68 | *
69 | * @return ActionInterface
70 | */
71 | public function remove($linkId, $resourceType)
72 | {
73 | return $this->__createAction('product_downloadable_link.remove', func_get_args());
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/Catalog/ProductLink.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\Catalog;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class ProductLink
24 | *
25 | * @package Smalot\Magento\Catalog
26 | */
27 | class ProductLink extends MagentoModuleAbstract
28 | {
29 | const TYPE_CROSS_SELL = 'cross-sell';
30 |
31 | const TYPE_UP_SELL = 'up-sell';
32 |
33 | const TYPE_GROUPED = 'grouped';
34 |
35 | /**
36 | * Allows you to assign a product link (related, cross-sell, up-sell, or grouped) to another product.
37 | *
38 | * @param string $type
39 | * @param string $productId
40 | * @param string $linkedProductId
41 | * @param array $data
42 | * @param string $identifierType
43 | *
44 | * @return ActionInterface
45 | */
46 | public function assign($type, $productId, $linkedProductId, $data, $identifierType = null)
47 | {
48 | return $this->__createAction('catalog_product_link.assign', func_get_args());
49 | }
50 |
51 | /**
52 | * Allows you to retrieve the product link type attributes.
53 | *
54 | * @param string $type
55 | *
56 | * @return ActionInterface
57 | */
58 | public function getAttributes($type)
59 | {
60 | return $this->__createAction('catalog_product_link.attributes', func_get_args());
61 | }
62 |
63 | /**
64 | * Allows you to retrieve the list of linked products for a specific product.
65 | *
66 | * @param string $type
67 | * @param string $productId
68 | * @param string $identifierType
69 | *
70 | * @return ActionInterface
71 | */
72 | public function getList($type, $productId, $identifierType = null)
73 | {
74 | return $this->__createAction('catalog_product_link.list', func_get_args());
75 | }
76 |
77 | /**
78 | * Allows you to remove the product link from a specific product.
79 | *
80 | * @param string $type
81 | * @param string $productId
82 | * @param string $linkedProductId
83 | * @param string $identifierType
84 | *
85 | * @return ActionInterface
86 | */
87 | public function remove($type, $productId, $linkedProductId, $identifierType = null)
88 | {
89 | return $this->__createAction('catalog_product_link.remove', func_get_args());
90 | }
91 |
92 | /**
93 | * Allows you to retrieve the list of product link types.
94 | *
95 | * @return ActionInterface
96 | */
97 | public function getTypes()
98 | {
99 | return $this->__createAction('catalog_product_link.types', func_get_args());
100 | }
101 |
102 | /**
103 | * Allows you to update the product link.
104 | *
105 | * @param string $type
106 | * @param string $productId
107 | * @param string $linkedProductId
108 | * @param array $data
109 | * @param string $identifierType
110 | *
111 | * @return ActionInterface
112 | */
113 | public function update($type, $productId, $linkedProductId, $data, $identifierType = null)
114 | {
115 | return $this->__createAction('catalog_product_link.update', func_get_args());
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/Catalog/ProductMedia.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\Catalog;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class ProductMedia
24 | *
25 | * @package Smalot\Magento\Catalog
26 | */
27 | class ProductMedia extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Allows you to upload a new product image.
31 | *
32 | * @param string $product
33 | * @param array $data
34 | * @param string $storeView
35 | * @param string $identifierType
36 | *
37 | * @return ActionInterface
38 | */
39 | public function create($product, $data, $storeView = null, $identifierType = null)
40 | {
41 | return $this->__createAction('catalog_product_attribute_media.create', func_get_args());
42 | }
43 |
44 | /**
45 | * Allows you to set/get the current store view.
46 | *
47 | * @param string $storeView
48 | *
49 | * @return ActionInterface
50 | */
51 | public function setCurrentStore($storeView)
52 | {
53 | return $this->__createAction('catalog_product_attribute_media.currentStore', func_get_args());
54 | }
55 |
56 | /**
57 | * Allows you to retrieve information about the specified product image.
58 | *
59 | * @param string $productId
60 | * @param string $file
61 | * @param string $storeView
62 | * @param string $identifierType
63 | *
64 | * @return ActionInterface
65 | */
66 | public function getInfo($productId, $file, $storeView = null, $identifierType = null)
67 | {
68 | return $this->__createAction('catalog_product_attribute_media.info', func_get_args());
69 | }
70 |
71 | /**
72 | * Allows you to retrieve the list of product images.
73 | *
74 | * @param string $productId
75 | * @param string $storeView
76 | * @param string $identifierType
77 | *
78 | * @return ActionInterface
79 | */
80 | public function getList($productId, $storeView = null, $identifierType = null)
81 | {
82 | return $this->__createAction('catalog_product_attribute_media.list', func_get_args());
83 | }
84 |
85 | /**
86 | * Allows you to remove the image from a product.
87 | *
88 | * @param string $productId
89 | * @param string $file
90 | * @param string $identifierType
91 | *
92 | * @return ActionInterface
93 | */
94 | public function remove($productId, $file, $identifierType = null)
95 | {
96 | return $this->__createAction('catalog_product_attribute_media.remove', func_get_args());
97 | }
98 |
99 | /**
100 | * Allows you to retrieve product image types including standard image, small_image, thumbnail, etc.
101 | * Note that if the product attribute set contains attributes of the Media Image type
102 | * (Catalog Input Type for Store Owner > Media Image), it will also be returned in the response.
103 | *
104 | * @param string $setId
105 | *
106 | * @return ActionInterface
107 | */
108 | public function getTypes($setId)
109 | {
110 | return $this->__createAction('catalog_product_attribute_media.types', func_get_args());
111 | }
112 |
113 | /**
114 | * Allows you to update the product image.
115 | *
116 | * @param string $productId
117 | * @param string $file
118 | * @param array $data
119 | * @param string $storeView
120 | * @param string $identifierType
121 | *
122 | * @return ActionInterface
123 | */
124 | public function update($productId, $file, $data, $storeView = null, $identifierType = null)
125 | {
126 | return $this->__createAction('catalog_product_attribute_media.update', func_get_args());
127 | }
128 | }
129 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/Catalog/ProductTag.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\Catalog;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class ProductTag
24 | *
25 | * @package Smalot\Magento\Catalog
26 | */
27 | class ProductTag extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Allows you to add one or more tags to a product.
31 | *
32 | * @param array $data
33 | *
34 | * @return ActionInterface
35 | */
36 | public function add($data)
37 | {
38 | return $this->__createAction('product_tag.add', func_get_args());
39 | }
40 |
41 | /**
42 | * Allows you to retrieve information about the required product tag.
43 | *
44 | * @param string $tagId
45 | * @param string $store
46 | *
47 | * @return ActionInterface
48 | */
49 | public function getInfo($tagId, $store = null)
50 | {
51 | return $this->__createAction('product_tag.info', func_get_args());
52 | }
53 |
54 | /**
55 | * Allows you to retrieve the list of tags for a specific product.
56 | *
57 | * @param string $productId
58 | * @param string $store
59 | *
60 | * @return ActionInterface
61 | */
62 | public function getList($productId, $store = null)
63 | {
64 | return $this->__createAction('product_tag.list', func_get_args());
65 | }
66 |
67 | /**
68 | * Allows you to remove an existing product tag.
69 | *
70 | * @param string $tagId
71 | *
72 | * @return ActionInterface
73 | */
74 | public function remove($tagId)
75 | {
76 | return $this->__createAction('product_tag.remove', func_get_args());
77 | }
78 |
79 | /**
80 | * Allows you to update information about an existing product tag.
81 | *
82 | * @param string $tagId
83 | * @param array $data
84 | * @param string $store
85 | *
86 | * @return ActionInterface
87 | */
88 | public function update($tagId, $data, $store = null)
89 | {
90 | return $this->__createAction('product_tag.update', func_get_args());
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/Catalog/ProductTierPrice.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\Catalog;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class ProductTierPrice
24 | *
25 | * @package Smalot\Magento\Catalog
26 | */
27 | class ProductTierPrice extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Allows you to retrieve information about product tier prices.
31 | *
32 | * @param string $productId
33 | * @param string $identifierType
34 | *
35 | * @return ActionInterface
36 | */
37 | public function getInfo($productId, $identifierType = null)
38 | {
39 | return $this->__createAction('catalog_product_attribute_tier_price.info', func_get_args());
40 | }
41 |
42 | /**
43 | * Allows you to update the product tier prices.
44 | *
45 | * @param string $productId
46 | * @param array $tierPrices
47 | * @param string $identifierType
48 | *
49 | * @return ActionInterface
50 | */
51 | public function update($productId, $tierPrices, $identifierType = null)
52 | {
53 | return $this->__createAction('catalog_product_attribute_tier_price.update', func_get_args());
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/Catalog/ProductType.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\Catalog;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class ProductType
24 | *
25 | * @package Smalot\Magento\Catalog
26 | */
27 | class ProductType extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Allows you to retrieve the list of product types.
31 | *
32 | * @return ActionInterface
33 | */
34 | public function getList()
35 | {
36 | return $this->__createAction('catalog_product_type.list', func_get_args());
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/CatalogInventory/StockItem.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\CatalogInventory;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class StockItem
24 | *
25 | * @package Smalot\Magento\Catalog
26 | */
27 | class StockItem extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Allows you to retrieve the list of stock data by product IDs.
31 | *
32 | * @param array $productIds
33 | *
34 | * @return ActionInterface
35 | */
36 | public function getList($productIds)
37 | {
38 | return $this->__createAction('cataloginventory_stock_item.list', func_get_args());
39 | }
40 |
41 | /**
42 | * Allows you to update the required product stock data.
43 | *
44 | * @param string $productId
45 | * @param array $data
46 | *
47 | * @return ActionInterface
48 | */
49 | public function update($productId, $data)
50 | {
51 | return $this->__createAction('cataloginventory_stock_item.update', func_get_args());
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/Core/Magento.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\Core;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class Magento
24 | *
25 | * @package Smalot\Magento\Core
26 | */
27 | class Magento extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Allows you to retrieve information about Magento version and edition.
31 | *
32 | * @return ActionInterface
33 | */
34 | public function getInfo()
35 | {
36 | return $this->__createAction('core_magento.info', func_get_args());
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/Customer/Customer.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\Customer;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class Customer
24 | *
25 | * @package Smalot\Magento\Customer
26 | */
27 | class Customer extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Create a new customer.
31 | *
32 | * @param array $customerData
33 | *
34 | * @return ActionInterface
35 | */
36 | public function create($customerData)
37 | {
38 | return $this->__createAction('customer.create', func_get_args());
39 | }
40 |
41 | /**
42 | * Delete the required customer.
43 | *
44 | * @param int $customerId
45 | *
46 | * @return ActionInterface
47 | */
48 | public function delete($customerId)
49 | {
50 | return $this->__createAction('customer.delete', func_get_args());
51 | }
52 |
53 | /**
54 | * Retrieve information about the specified customer.
55 | *
56 | * @param int $customerId
57 | * @param array $attributes
58 | *
59 | * @return ActionInterface
60 | */
61 | public function getInfo($customerId, $attributes)
62 | {
63 | return $this->__createAction('customer.info', func_get_args());
64 | }
65 |
66 | /**
67 | * Allows you to retrieve the list of customers.
68 | *
69 | * @param array $filters
70 | *
71 | * @return ActionInterface
72 | */
73 | public function getList($filters)
74 | {
75 | return $this->__createAction('customer.list', func_get_args());
76 | }
77 |
78 | /**
79 | * Update information about the required customer.
80 | * Note that you need to pass only those arguments which you want to be updated.
81 | *
82 | * @param int $customerId
83 | * @param array $customerData
84 | *
85 | * @return ActionInterface
86 | */
87 | public function update($customerId, $customerData)
88 | {
89 | return $this->__createAction('customer.update', func_get_args());
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/Customer/CustomerAddress.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\Customer;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class CustomerAddress
24 | *
25 | * @package Smalot\Magento\Customer
26 | */
27 | class CustomerAddress extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Create a new address for the customer.
31 | *
32 | * @param int $customerId
33 | * @param array $addressData
34 | *
35 | * @return ActionInterface
36 | */
37 | public function create($customerId, $addressData)
38 | {
39 | return $this->__createAction('customer_address.create', func_get_args());
40 | }
41 |
42 | /**
43 | * Delete the required customer address.
44 | *
45 | * @param int $addressId
46 | *
47 | * @return ActionInterface
48 | */
49 | public function delete($addressId)
50 | {
51 | return $this->__createAction('customer_address.delete', func_get_args());
52 | }
53 |
54 | /**
55 | * Retrieve information about the required customer address.
56 | *
57 | * @param int $addressId
58 | *
59 | * @return ActionInterface
60 | */
61 | public function getInfo($addressId)
62 | {
63 | return $this->__createAction('customer_address.info', func_get_args());
64 | }
65 |
66 | /**
67 | * Retrieve the list of customer addresses.
68 | *
69 | * @param int $customerId
70 | *
71 | * @return ActionInterface
72 | */
73 | public function getList($customerId)
74 | {
75 | return $this->__createAction('customer_address.list', func_get_args());
76 | }
77 |
78 | /**
79 | * Update address data of the required customer.
80 | *
81 | * @param int $addressId
82 | * @param array $addressData
83 | *
84 | * @return ActionInterface
85 | */
86 | public function update($addressId, $addressData)
87 | {
88 | return $this->__createAction('customer_address.update', func_get_args());
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/Customer/CustomerGroup.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\Customer;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class CustomerGroup
24 | *
25 | * @package Smalot\Magento\Customer
26 | */
27 | class CustomerGroup extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Retrieve the list of customer groups.
31 | *
32 | * @return ActionInterface
33 | */
34 | public function getGroupList()
35 | {
36 | return $this->__createAction('customer_group.list', func_get_args());
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/CustomerBalance/StoreCredit.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\CustomerBalance;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class StoreCredit
24 | *
25 | * @package Smalot\Magento\CustomerBalance
26 | */
27 | class StoreCredit extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Allows you to retrieve the customer store credit balance amount.
31 | *
32 | * @param string $customerId
33 | * @param string $websiteId
34 | *
35 | * @return ActionInterface
36 | */
37 | public function getBalance($customerId, $websiteId)
38 | {
39 | return $this->__createAction('storecredit.balance', func_get_args());
40 | }
41 |
42 | /**
43 | * Allows you to retrieve the customer store credit history information.
44 | *
45 | * @param string $customerId
46 | * @param string $websiteId
47 | *
48 | * @return ActionInterface
49 | */
50 | public function getHistory($customerId, $websiteId = null)
51 | {
52 | return $this->__createAction('storecredit.history', func_get_args());
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/CustomerBalance/StoreCreditQuote.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\CustomerBalance;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class StoreCreditQuote
24 | *
25 | * @package Smalot\Magento\CustomerBalance
26 | */
27 | class StoreCreditQuote extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Allows you to remove store credit amount from the shopping cart (quote) and increase the customer store credit.
31 | *
32 | * @param string $quoteId
33 | * @param string $store
34 | *
35 | * @return ActionInterface
36 | */
37 | public function removeAmount($quoteId, $store = null)
38 | {
39 | return $this->__createAction('storecredit_quote.removeAmount', func_get_args());
40 | }
41 |
42 | /**
43 | * Allows you to set amount from the customer store credit to the shopping cart.
44 | *
45 | * @param string $quoteId
46 | * @param string $store
47 | *
48 | * @return ActionInterface
49 | */
50 | public function setAmount($quoteId, $store = null)
51 | {
52 | return $this->__createAction('storecredit_quote.setAmount', func_get_args());
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/Directory/Directory.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\Directory;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class Directory
24 | *
25 | * @package Smalot\Magento\Directory
26 | */
27 | class Directory extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Retrieve the list of countries from Magento.
31 | *
32 | * @return ActionInterface
33 | */
34 | public function getCountryList()
35 | {
36 | return $this->__createAction('directory_country.list', func_get_args());
37 | }
38 |
39 | /**
40 | * Retrieve the list of regions in the specified country.
41 | *
42 | * @param string $country
43 | *
44 | * @return ActionInterface
45 | */
46 | public function getRegionList($country)
47 | {
48 | return $this->__createAction('directory_region.list', func_get_args());
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/GiftMessage/GiftMessage.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\GiftMessage;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class GiftMessage
24 | *
25 | * @package Smalot\Magento\GiftMessage
26 | */
27 | class GiftMessage extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Allows you to set a global gift message for the shopping cart (quote).
31 | *
32 | * @param string $quoteId
33 | * @param array $giftMessage
34 | * @param string $store
35 | *
36 | * @return ActionInterface
37 | */
38 | public function setForQuote($quoteId, $giftMessage, $store)
39 | {
40 | return $this->__createAction('giftmessage.setForQuote', func_get_args());
41 | }
42 |
43 | /**
44 | * Allows you to set a gift message for an item in the shopping cart (quote).
45 | *
46 | * @param string $quoteItemId
47 | * @param array $giftMessage
48 | * @param string $store
49 | *
50 | * @return ActionInterface
51 | */
52 | public function setForQuoteItem($quoteItemId, $giftMessage, $store)
53 | {
54 | return $this->__createAction('giftmessage.setForQuoteItem', func_get_args());
55 | }
56 |
57 | /**
58 | * Allows you to set a gift message for a product in the shopping cart (quote).
59 | *
60 | * @param string $quoteId
61 | * @param array $productsAndMessages
62 | * @param string $store
63 | *
64 | * @return ActionInterface
65 | */
66 | public function setForQuoteProduct($quoteId, $productsAndMessages, $store)
67 | {
68 | return $this->__createAction('giftmessage.setForQuoteProduct', func_get_args());
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/MagentoModuleAbstract.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento;
18 |
19 | use Smalot\Magento\RemoteAdapterInterface;
20 |
21 | /**
22 | * Class MagentoModuleAbstract
23 | *
24 | * @package Smalot\Magento
25 | */
26 | abstract class MagentoModuleAbstract
27 | {
28 | /**
29 | * @var RemoteAdapterInterface
30 | */
31 | protected $remoteAdapter;
32 |
33 | /**
34 | * @param RemoteAdapterInterface $remoteAdapter
35 | */
36 | public function __construct(RemoteAdapterInterface $remoteAdapter)
37 | {
38 | $this->remoteAdapter = $remoteAdapter;
39 | }
40 |
41 | /**
42 | * @param string $method
43 | * @param array $arguments
44 | *
45 | * @return ActionInterface
46 | */
47 | protected function __createAction($method, $arguments = array())
48 | {
49 | return new Action($method, $arguments, $this->remoteAdapter);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/MultiCallQueue.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento;
18 |
19 | /**
20 | * Class MultiCallQueue
21 | *
22 | * @package Smalot\Magento
23 | */
24 | class MultiCallQueue implements MultiCallQueueInterface
25 | {
26 | /**
27 | * @var RemoteAdapterInterface
28 | */
29 | protected $remoteAdapter = null;
30 |
31 | /**
32 | * @var array
33 | */
34 | protected $queue = null;
35 |
36 | /**
37 | * @var int
38 | */
39 | protected $position = 0;
40 |
41 | /**
42 | * @param RemoteAdapterInterface $remoteAdapter
43 | */
44 | public function __construct(RemoteAdapterInterface $remoteAdapter)
45 | {
46 | $this->remoteAdapter = $remoteAdapter;
47 |
48 | $this->queue = array();
49 | }
50 |
51 | /**
52 | * @param ActionInterface $action
53 | * @param callable $callback
54 | *
55 | * @return $this
56 | */
57 | public function addAction(ActionInterface $action, $callback = null)
58 | {
59 | $this->queue[] = array(
60 | 'action' => $action,
61 | 'callback' => $callback,
62 | );
63 |
64 | return $this;
65 | }
66 |
67 | /**
68 | * @return $this
69 | */
70 | public function flush()
71 | {
72 | $this->queue = array();
73 |
74 | return $this;
75 | }
76 |
77 | /**
78 | * @return array
79 | */
80 | public function execute()
81 | {
82 | $results = $this->remoteAdapter->multiCall($this);
83 |
84 | $this->flush();
85 |
86 | return $results;
87 | }
88 |
89 | /**
90 | * (PHP 5 >= 5.0.0)
91 | * Return the current element
92 | *
93 | * @link http://php.net/manual/en/iterator.current.php
94 | * @return mixed Can return any type.
95 | */
96 | public function current()
97 | {
98 | return $this->queue[$this->position];
99 | }
100 |
101 | /**
102 | * (PHP 5 >= 5.0.0)
103 | * Move forward to next element
104 | *
105 | * @link http://php.net/manual/en/iterator.next.php
106 | * @return void Any returned value is ignored.
107 | */
108 | public function next()
109 | {
110 | $this->position++;
111 | }
112 |
113 | /**
114 | * (PHP 5 >= 5.0.0)
115 | * Return the key of the current element
116 | *
117 | * @link http://php.net/manual/en/iterator.key.php
118 | * @return integer scalar on success, or null on failure.
119 | */
120 | public function key()
121 | {
122 | return $this->position;
123 | }
124 |
125 | /**
126 | * (PHP 5 >= 5.0.0)
127 | * Checks if current position is valid
128 | *
129 | * @link http://php.net/manual/en/iterator.valid.php
130 | * @return boolean The return value will be casted to boolean and then evaluated.
131 | * Returns true on success or false on failure.
132 | */
133 | public function valid()
134 | {
135 | return array_key_exists($this->position, $this->queue);
136 | }
137 |
138 | /**
139 | * (PHP 5 >= 5.0.0)
140 | * Rewind the Iterator to the first element
141 | *
142 | * @link http://php.net/manual/en/iterator.rewind.php
143 | * @return void Any returned value is ignored.
144 | */
145 | public function rewind()
146 | {
147 | $this->position = 0;
148 | }
149 |
150 | /**
151 | * (PHP 5 >= 5.0.0)
152 | * Whether a offset exists
153 | *
154 | * @link http://php.net/manual/en/arrayaccess.offsetexists.php
155 | *
156 | * @param mixed $offset
157 | * An offset to check for.
158 | *
159 | *
160 | * @return boolean true on success or false on failure.
161 | *
162 | *
163 | * The return value will be casted to boolean if non-boolean was returned.
164 | */
165 | public function offsetExists($offset)
166 | {
167 | return array_key_exists($offset, $this->queue);
168 | }
169 |
170 | /**
171 | * (PHP 5 >= 5.0.0)
172 | * Offset to retrieve
173 | *
174 | * @link http://php.net/manual/en/arrayaccess.offsetget.php
175 | *
176 | * @param mixed $offset
177 | * The offset to retrieve.
178 | *
179 | *
180 | * @return mixed Can return all value types.
181 | */
182 | public function offsetGet($offset)
183 | {
184 | return $this->queue[$offset];
185 | }
186 |
187 | /**
188 | * (PHP 5 >= 5.0.0)
189 | * Offset to set
190 | *
191 | * @link http://php.net/manual/en/arrayaccess.offsetset.php
192 | *
193 | * @param mixed $offset
194 | * The offset to assign the value to.
195 | *
196 | * @param mixed $value
197 | * The value to set.
198 | *
199 | *
200 | * @return void
201 | */
202 | public function offsetSet($offset, $value)
203 | {
204 | $this->queue[$offset] = $value;
205 | }
206 |
207 | /**
208 | * (PHP 5 >= 5.0.0)
209 | * Offset to unset
210 | *
211 | * @link http://php.net/manual/en/arrayaccess.offsetunset.php
212 | *
213 | * @param mixed $offset
214 | * The offset to unset.
215 | *
216 | *
217 | * @return void
218 | */
219 | public function offsetUnset($offset)
220 | {
221 | unset($this->queue[$offset]);
222 | }
223 |
224 | /**
225 | * (PHP 5 >= 5.1.0)
226 | * Count elements of an object
227 | *
228 | * @link http://php.net/manual/en/countable.count.php
229 | * @return int The custom count as an integer.
230 | *
231 | *
232 | * The return value is cast to an integer.
233 | */
234 | public function count()
235 | {
236 | return count($this->queue);
237 | }
238 | }
239 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/MultiCallQueueInterface.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento;
18 |
19 | /**
20 | * Interface MultiCallQueueInterface
21 | *
22 | * @package Smalot\Magento
23 | */
24 | interface MultiCallQueueInterface extends \ArrayAccess, \Iterator, \Countable
25 | {
26 | /**
27 | * @param ActionInterface $action
28 | * @param callable $callback
29 | *
30 | * @return MultiCallQueueInterface
31 | */
32 | public function addAction(ActionInterface $action, $callback = null);
33 |
34 | /**
35 | * @return $this
36 | */
37 | public function flush();
38 |
39 | /**
40 | * @return array
41 | */
42 | public function execute();
43 | }
44 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/Order/Order.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\Order;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class Order
24 | *
25 | * @package Smalot\Magento\Order
26 | */
27 | class Order extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Allows you to add a new comment to the order.
31 | *
32 | * @param string $orderIncrementId
33 | * @param string $status
34 | * @param string $comment
35 | * @param string $notify
36 | *
37 | * @return ActionInterface
38 | */
39 | public function addComment($orderIncrementId, $status, $comment = null, $notify = null)
40 | {
41 | return $this->__createAction('order.addComment', func_get_args());
42 | }
43 |
44 | /**
45 | * Allows you to cancel the required order.
46 | *
47 | * @param string $orderIncrementId
48 | *
49 | * @return ActionInterface
50 | */
51 | public function cancel($orderIncrementId)
52 | {
53 | return $this->__createAction('order.cancel', func_get_args());
54 | }
55 |
56 | /**
57 | * Allows you to place the required order on hold.
58 | *
59 | * @param string $orderIncrementId
60 | *
61 | * @return ActionInterface
62 | */
63 | public function hold($orderIncrementId)
64 | {
65 | return $this->__createAction('order.hold', func_get_args());
66 | }
67 |
68 | /**
69 | * Allows you to retrieve the required order information.
70 | *
71 | * @param string $orderIncrementId
72 | *
73 | * @return ActionInterface
74 | */
75 | public function getInfo($orderIncrementId)
76 | {
77 | return $this->__createAction('order.info', func_get_args());
78 | }
79 |
80 | /**
81 | * Allows you to retrieve the list of orders. Additional filters can be applied.
82 | *
83 | * @param array $filters
84 | *
85 | * @return ActionInterface
86 | */
87 | public function getList($filters)
88 | {
89 | return $this->__createAction('order.list', func_get_args());
90 | }
91 |
92 | /**
93 | * Allows you to unhold the required order.
94 | *
95 | * @param string $orderIncrementId
96 | *
97 | * @return ActionInterface
98 | */
99 | public function unhold($orderIncrementId)
100 | {
101 | return $this->__createAction('order.unhold', func_get_args());
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/Order/OrderCreditMemo.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\Order;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class OrderCreditMemo
24 | *
25 | * @package Smalot\Magento\Order
26 | */
27 | class OrderCreditMemo extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Allows you to add a new comment to an existing credit memo.
31 | * Email notification can be sent to the user email.
32 | *
33 | * @param string $creditmemoIncrementId
34 | * @param string $comment
35 | * @param string $notifyCustomer
36 | * @param string $includeComment
37 | *
38 | * @return ActionInterface
39 | */
40 | public function addComment($creditmemoIncrementId, $comment = null, $notifyCustomer = null, $includeComment = null)
41 | {
42 | return $this->__createAction('order_creditmemo.addComment', func_get_args());
43 | }
44 |
45 | /**
46 | * Allows you to cancel an existing credit memo.
47 | *
48 | * @param string $creditmemoIncrementId
49 | *
50 | * @return ActionInterface
51 | */
52 | public function cancel($creditmemoIncrementId)
53 | {
54 | return $this->__createAction('order_creditmemo.cancel', func_get_args());
55 | }
56 |
57 | /**
58 | * Allows you to create a new credit memo for the invoiced order.
59 | * Comments can be added and an email notification can be sent to the user email.
60 | *
61 | * @param string $orderIncrementId
62 | * @param array $creditmemoData
63 | * @param string $comment
64 | * @param int $notifyCustomer
65 | * @param int $includeComment
66 | * @param string $refundToStoreCreditAmount
67 | *
68 | * @return ActionInterface
69 | */
70 | public function create(
71 | $orderIncrementId,
72 | $creditmemoData = null,
73 | $comment = null,
74 | $notifyCustomer = null,
75 | $includeComment = null,
76 | $refundToStoreCreditAmount = null
77 | ) {
78 | return $this->__createAction('order_creditmemo.create', func_get_args());
79 | }
80 |
81 | /**
82 | * Allows you to retrieve full information about the specified credit memo.
83 | *
84 | * @param string $creditmemoIncrementId
85 | *
86 | * @return ActionInterface
87 | */
88 | public function getInfo($creditmemoIncrementId)
89 | {
90 | return $this->__createAction('order_creditmemo.info', func_get_args());
91 | }
92 |
93 | /**
94 | * Allows you to retrieve the list of credit memos by filters.
95 | *
96 | * @param array $filters
97 | *
98 | * @return ActionInterface
99 | */
100 | public function getList($filters)
101 | {
102 | return $this->__createAction('order_creditmemo.list', func_get_args());
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/Order/OrderInvoice.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\Order;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class OrderInvoice
24 | *
25 | * @package Smalot\Magento\Order
26 | */
27 | class OrderInvoice extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Allows you to add a new comment to the order invoice.
31 | *
32 | * @param string $invoiceIncrementId
33 | * @param string $comment
34 | * @param int $email
35 | * @param int $includeComment
36 | *
37 | * @return ActionInterface
38 | */
39 | public function addComment($invoiceIncrementId, $comment = null, $email = null, $includeComment = null)
40 | {
41 | return $this->__createAction('order_invoice.addComment', func_get_args());
42 | }
43 |
44 | /**
45 | * Allows you to cancel the required invoice.
46 | * Note that not all order invoices can be canceled.
47 | * Only some payment methods support canceling the order invoice
48 | * (e.g., Google Checkout, PayPal Pro, PayPal Express Checkout).
49 | *
50 | * @param string $invoiceIncrementId
51 | *
52 | * @return ActionInterface
53 | */
54 | public function cancel($invoiceIncrementId)
55 | {
56 | return $this->__createAction('order_invoice.cancel', func_get_args());
57 | }
58 |
59 | /**
60 | * Allows you to capture the required invoice.
61 | * Note that not all order invoices can be captured.
62 | * Only some payment methods support capturing the order invoice (e.g., PayPal Pro).
63 | *
64 | * @param string $invoiceIncrementId
65 | *
66 | * @return ActionInterface
67 | */
68 | public function capture($invoiceIncrementId)
69 | {
70 | return $this->__createAction('order_invoice.capture', func_get_args());
71 | }
72 |
73 | /**
74 | * Allows you to create a new invoice for an order.
75 | *
76 | * @param string $orderIncrementId
77 | * @param array $itemsQty
78 | * @param string $comment
79 | * @param string $email
80 | * @param string $includeComment
81 | *
82 | * @return ActionInterface
83 | */
84 | public function create($orderIncrementId, $itemsQty, $comment, $email, $includeComment)
85 | {
86 | return $this->__createAction('order_invoice.create', func_get_args());
87 | }
88 |
89 | /**
90 | * @param string $invoiceIncrementId
91 | *
92 | * @return ActionInterface
93 | */
94 | public function getInfo($invoiceIncrementId)
95 | {
96 | return $this->__createAction('order_invoice.info', func_get_args());
97 | }
98 |
99 | /**
100 | * @param array $filters
101 | *
102 | * @return ActionInterface
103 | */
104 | public function getList($filters = null)
105 | {
106 | return $this->__createAction('order_invoice.list', func_get_args());
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/Order/OrderShipment.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\Order;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class OrderShipment
24 | *
25 | * @package Smalot\Magento\Order
26 | */
27 | class OrderShipment extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Allows you to add a new comment to the order shipment.
31 | *
32 | * @param string $shipmentIncrementId
33 | * @param string $comment
34 | * @param string $email
35 | * @param string $includeInEmail
36 | *
37 | * @return ActionInterface
38 | */
39 | public function addComment($shipmentIncrementId, $comment = null, $email = null, $includeInEmail = null)
40 | {
41 | return $this->__createAction('order_shipment.addComment', func_get_args());
42 | }
43 |
44 | /**
45 | * Allows you to add a new tracking number to the order shipment.
46 | *
47 | * @param string $shipmentIncrementId
48 | * @param string $carrier
49 | * @param string $title
50 | * @param string $trackNumber
51 | *
52 | * @return ActionInterface
53 | */
54 | public function addTrack($shipmentIncrementId, $carrier, $title, $trackNumber)
55 | {
56 | return $this->__createAction('order_shipment.addTrack', func_get_args());
57 | }
58 |
59 | /**
60 | * Allows you to create a new shipment for an order.
61 | *
62 | * @param string $orderIncrementId
63 | * @param string $itemsQty
64 | * @param string $comment
65 | * @param int $email
66 | * @param int $includeComment
67 | *
68 | * @return ActionInterface
69 | */
70 | public function create($orderIncrementId, $itemsQty = null, $comment = null, $email = null, $includeComment = null)
71 | {
72 | return $this->__createAction('order_shipment.create', func_get_args());
73 | }
74 |
75 | /**
76 | * Allows you to retrieve the list of allowed carriers for an order.
77 | *
78 | * @param string $orderIncrementId
79 | *
80 | * @return ActionInterface
81 | */
82 | public function getCarriers($orderIncrementId)
83 | {
84 | return $this->__createAction('order_shipment.getCarriers', func_get_args());
85 | }
86 |
87 | /**
88 | * Allows you to retrieve the shipment information.
89 | *
90 | * @param $shipmentIncrementId
91 | *
92 | * @return ActionInterface
93 | */
94 | public function getInfo($shipmentIncrementId)
95 | {
96 | return $this->__createAction('order_shipment.info', func_get_args());
97 | }
98 |
99 | /**
100 | * Allows you to retrieve the list of order shipments.
101 | * Additional filters can be applied.
102 | *
103 | * @param array $filters
104 | *
105 | * @return ActionInterface
106 | */
107 | public function getList($filters)
108 | {
109 | return $this->__createAction('order_shipment.list', func_get_args());
110 | }
111 |
112 | /**
113 | * Allows you to remove a tracking number from the order shipment.
114 | *
115 | * @param string $shipmentIncrementId
116 | * @param string $trackId
117 | *
118 | * @return ActionInterface
119 | */
120 | public function removeTrack($shipmentIncrementId, $trackId)
121 | {
122 | return $this->__createAction('order_shipment.removeTrack', func_get_args());
123 | }
124 | }
125 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/RemoteAdapter.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento;
18 |
19 | /**
20 | * Class RemoteAdapter
21 | *
22 | * @package Smalot\Magento
23 | */
24 | class RemoteAdapter implements RemoteAdapterInterface
25 | {
26 | /**
27 | * @var array
28 | */
29 | protected static $defaultOptions = array(
30 | 'exceptions' => true,
31 | 'connection_timeout' => 15,
32 | 'keep_alive' => true,
33 | 'compression' => true,
34 | 'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
35 | );
36 |
37 | /**
38 | * @var string
39 | */
40 | protected $wsdl = null;
41 |
42 | /**
43 | * @var string
44 | */
45 | protected $apiUser = null;
46 |
47 | /**
48 | * @var string
49 | */
50 | protected $apiKey = null;
51 |
52 | /**
53 | * @var array
54 | */
55 | protected $options = null;
56 |
57 | /**
58 | * @var boolean
59 | */
60 | protected $autoLogin = null;
61 |
62 | /**
63 | * @var string
64 | */
65 | protected $sessionId = null;
66 |
67 | /**
68 | * @var \SoapClient
69 | */
70 | protected $soapClient = null;
71 |
72 | /**
73 | * @param string $path
74 | * @param string $apiUser
75 | * @param string $apiKey
76 | * @param array $options
77 | * @param bool $autoLogin
78 | */
79 | public function __construct($path, $apiUser, $apiKey, $options = array(), $autoLogin = true)
80 | {
81 | $this->wsdl = rtrim($path, '/') . '/index.php/api/soap/?wsdl';
82 | $this->apiUser = $apiUser;
83 | $this->apiKey = $apiKey;
84 | $this->autoLogin = $autoLogin;
85 |
86 | $this->setOptions($options);
87 | @$this->soapClient = new \SoapClient($this->wsdl, $this->getOptions());
88 | }
89 |
90 | /**
91 | *
92 | */
93 | public function __destruct()
94 | {
95 | $this->logout();
96 |
97 | unset($this->options);
98 | unset($this->sessionId);
99 | unset($this->soapClient);
100 | }
101 |
102 | /**
103 | * @return array
104 | */
105 | public function getOptions()
106 | {
107 | return $this->options;
108 | }
109 |
110 | /**
111 | * @param $options
112 | *
113 | * @return $this
114 | */
115 | public function setOptions($options)
116 | {
117 | $this->options = array_merge(self::$defaultOptions, $options);
118 |
119 | return $this;
120 | }
121 |
122 | /**
123 | * @return array
124 | */
125 | public static function getDefaultOptions()
126 | {
127 | return self::$defaultOptions;
128 | }
129 |
130 | /**
131 | * @param array $options
132 | */
133 | public static function setDefaultOptions($options = array())
134 | {
135 | self::$defaultOptions = $options;
136 | }
137 |
138 | /**
139 | * @param string $apiUser
140 | * @param string $apiKey
141 | *
142 | * @return bool
143 | * @throws \Exception
144 | */
145 | public function login($apiUser = null, $apiKey = null)
146 | {
147 | if (null === $apiUser) {
148 | $apiUser = $this->apiUser;
149 | }
150 |
151 | if (null === $apiKey) {
152 | $apiKey = $this->apiKey;
153 | }
154 |
155 | if ($this->sessionId = $this->soapClient->login($apiUser, $apiKey)) {
156 | return true;
157 | }
158 |
159 | return false;
160 | }
161 |
162 | /**
163 | * @return bool
164 | */
165 | public function ping()
166 | {
167 | $info = $this->call(new Action('core_magento.info'), false);
168 |
169 | return (is_object($info) || is_array($info));
170 | }
171 |
172 | /**
173 | * @return bool
174 | */
175 | public function logout()
176 | {
177 | if (null !== $this->sessionId) {
178 | $this->soapClient->endSession($this->sessionId);
179 | $this->sessionId = null;
180 |
181 | return true;
182 | }
183 |
184 | return false;
185 | }
186 |
187 | /**
188 | * @throws RemoteAdapterException
189 | */
190 | protected function checkSecurity()
191 | {
192 | if (null === $this->sessionId && $this->autoLogin) {
193 | $this->login();
194 | }
195 |
196 | if (null === $this->sessionId) {
197 | throw new RemoteAdapterException('Not connected.');
198 | }
199 | }
200 |
201 | /**
202 | * @param ActionInterface $action
203 | * @param bool $throwsException
204 | *
205 | * @return array|false
206 | * @throws \Exception
207 | */
208 | public function call(ActionInterface $action, $throwsException = true)
209 | {
210 | try {
211 | $this->checkSecurity();
212 |
213 | $result = $this->soapClient->call($this->sessionId, $action->getMethod(), $action->getArguments());
214 |
215 | return $result;
216 |
217 | } catch (\Exception $e) {
218 | if ($throwsException) {
219 | throw $e;
220 | }
221 |
222 | return false;
223 | }
224 | }
225 |
226 | /**
227 | * @param MultiCallQueueInterface $queue
228 | * @param bool $throwsException
229 | *
230 | * @return array|false
231 | * @throws \Exception
232 | */
233 | public function multiCall(MultiCallQueueInterface $queue, $throwsException = true)
234 | {
235 | try {
236 | $this->checkSecurity();
237 |
238 | $actions = $this->getActions($queue);
239 | $results = $this->soapClient->multiCall($this->sessionId, $actions);
240 |
241 | $this->handleCallbacks($queue, $results);
242 |
243 | return $results;
244 |
245 | } catch (\Exception $e) {
246 | if ($throwsException) {
247 | throw $e;
248 | }
249 |
250 | return false;
251 | }
252 | }
253 |
254 | /**
255 | * @param MultiCallQueueInterface $queue
256 | *
257 | * @return array
258 | */
259 | protected function getActions(MultiCallQueueInterface $queue)
260 | {
261 | $actions = array();
262 |
263 | foreach ($queue as $item) {
264 | $action = $item['action'];
265 |
266 | /** @var $action ActionInterface */
267 | $actions[] = array(
268 | $action->getMethod(),
269 | $action->getArguments(),
270 | );
271 | }
272 |
273 | return $actions;
274 | }
275 |
276 | /**
277 | * @param MultiCallQueueInterface $queue
278 | * @param array $results
279 | */
280 | protected function handleCallbacks(MultiCallQueueInterface $queue, $results)
281 | {
282 | foreach ($queue as $position => $item) {
283 | $callback = $item['callback'];
284 |
285 | if (is_callable($callback)) {
286 | call_user_func($callback, $results[$position]);
287 | }
288 | }
289 | }
290 |
291 | /**
292 | * @return string
293 | */
294 | public function getLastRequestHeaders()
295 | {
296 | return $this->soapClient->__getLastRequestHeaders();
297 | }
298 |
299 | /**
300 | * @return string
301 | */
302 | public function getLastRequest()
303 | {
304 | return $this->soapClient->__getLastRequest();
305 | }
306 |
307 | /**
308 | * @return string
309 | */
310 | public function getLastResponseHeaders()
311 | {
312 | return $this->soapClient->__getLastResponseHeaders();
313 | }
314 |
315 | /**
316 | * @return string
317 | */
318 | public function getLastResponse()
319 | {
320 | return $this->soapClient->__getLastResponse();
321 | }
322 | }
323 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/RemoteAdapterException.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento;
18 |
19 | /**
20 | * Class RemoteAdapterException
21 | *
22 | * @package Smalot\Magento
23 | */
24 | class RemoteAdapterException extends \Exception
25 | {
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/RemoteAdapterInterface.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento;
18 |
19 | /**
20 | * Interface RemoteAdapterInterface
21 | *
22 | * @package Smalot\Magento
23 | */
24 | interface RemoteAdapterInterface
25 | {
26 | /**
27 | * @param ActionInterface $action
28 | * @param bool $throwsException
29 | *
30 | * @return array
31 | * @throws \Exception
32 | */
33 | public function call(ActionInterface $action, $throwsException = true);
34 |
35 | /**
36 | * @param MultiCallQueueInterface $queue
37 | * @param bool $throwsException
38 | *
39 | * @return array
40 | * @throws \Exception
41 | */
42 | public function multiCall(MultiCallQueueInterface $queue, $throwsException = false);
43 |
44 | /**
45 | * @return bool
46 | */
47 | public function ping();
48 | }
49 |
--------------------------------------------------------------------------------
/src/Smalot/Magento/Store/Store.php:
--------------------------------------------------------------------------------
1 |
10 | * @license MIT
11 | * @url
12 | *
13 | * For the full copyright and license information, please view the LICENSE
14 | * file that was distributed with this source code.
15 | */
16 |
17 | namespace Smalot\Magento\Store;
18 |
19 | use Smalot\Magento\ActionInterface;
20 | use Smalot\Magento\MagentoModuleAbstract;
21 |
22 | /**
23 | * Class Store
24 | *
25 | * @package Smalot\Magento\StoreView
26 | */
27 | class Store extends MagentoModuleAbstract
28 | {
29 | /**
30 | * Allows you to retrieve the list of store views.
31 | *
32 | * @return ActionInterface
33 | */
34 | public function getList()
35 | {
36 | return $this->__createAction('store.list', func_get_args());
37 | }
38 |
39 | /**
40 | * Allows you to retrieve information about the required store view.
41 | *
42 | * @param string $storeId
43 | *
44 | * @return ActionInterface
45 | */
46 | public function getInfo($storeId = null)
47 | {
48 | return $this->__createAction('store.info', func_get_args());
49 | }
50 | }
51 |
--------------------------------------------------------------------------------