Skip to content
This repository was archived by the owner on Oct 24, 2023. It is now read-only.

Commit 4f8f850

Browse files
author
Jens Schulze
committed
Merge branch 'release/v1.3.0'
2 parents 122bdbd + fb1fbc7 commit 4f8f850

File tree

89 files changed

+2318
-61
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+2318
-61
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ before_script:
2727
- if [ $PHP == '5.4' ] ; then ./set_guzzle5.sh; fi
2828
- composer global require hirak/prestissimo
2929
- composer self-update
30-
- composer install -o --prefer-dist
30+
- if [ $PHP == '5.4' ] ; then composer update -o --prefer-dist --prefer-lowest; fi
31+
- if [ $PHP != '5.4' ] ; then composer install -o --prefer-dist; fi
3132

3233
script:
3334
- ant phpcs-ci

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
<a name="1.3.0"></a>
2+
# [1.3.0](https://github.com/sphereio/commercetools-php-sdk/compare/v1.2.3...v1.3.0) (2016-08-10)
3+
4+
### Features
5+
6+
* **Address:** add fax field to address ([cb1dda2](https://github.com/sphereio/commercetools-php-sdk/commit/cb1dda2)), closes [#236](https://github.com/sphereio/commercetools-php-sdk/issues/236)
7+
* **Channel:** add Address field to Channel ([66a40a9](https://github.com/sphereio/commercetools-php-sdk/commit/66a40a9)), closes [#237](https://github.com/sphereio/commercetools-php-sdk/issues/237)
8+
* **Localization:** add setLocale action to cart, order and customer ([17c5672](https://github.com/sphereio/commercetools-php-sdk/commit/17c5672)), closes [#235](https://github.com/sphereio/commercetools-php-sdk/issues/235)
9+
* **Order:** add actions to update customer email, shipping and billing address for orders ([23e0193](https://github.com/sphereio/commercetools-php-sdk/commit/23e0193)), closes [#238](https://github.com/sphereio/commercetools-php-sdk/issues/238)
10+
* **Order:** import order with stock update ([a824dae](https://github.com/sphereio/commercetools-php-sdk/commit/a824dae)), closes [#234](https://github.com/sphereio/commercetools-php-sdk/issues/234)
11+
* **Product:** support assets ([43f8dd6](https://github.com/sphereio/commercetools-php-sdk/commit/43f8dd6)), closes [#241](https://github.com/sphereio/commercetools-php-sdk/issues/241)
12+
* **Project:** add messages field to project ([4deb11f](https://github.com/sphereio/commercetools-php-sdk/commit/4deb11f)), closes [#239](https://github.com/sphereio/commercetools-php-sdk/issues/239)
13+
* **Search:** add subtree filter model ([9fa6527](https://github.com/sphereio/commercetools-php-sdk/commit/9fa6527)), closes [#244](https://github.com/sphereio/commercetools-php-sdk/issues/244)
14+
15+
16+
117
<a name="1.2.3"></a>
218
## [1.2.3](https://github.com/sphereio/commercetools-php-sdk/compare/v1.2.2...v1.2.3) (2016-07-14)
319

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
},
3636
"require-dev": {
3737
"guzzlehttp/guzzle": "^6.0",
38-
"phpunit/phpunit": "^5.0 || ^4.0",
38+
"phpunit/phpunit": "^5.0 || ^4.8",
3939
"phpmd/phpmd": "@stable",
40-
"squizlabs/php_codesniffer": "@stable",
40+
"squizlabs/php_codesniffer": "^2.6",
4141
"sebastian/phpcpd": "@stable",
4242
"pdepend/pdepend": "@stable",
4343
"phploc/phploc": "^2.0",
@@ -50,7 +50,7 @@
5050
"symfony/yaml": "*",
5151
"cache/array-adapter": "^0.4.0",
5252
"cache/filesystem-adapter": "^0.3.0",
53-
"incenteev/composer-parameter-handler": "^2.0"
53+
"incenteev/composer-parameter-handler": "^2.1"
5454
},
5555
"scripts": {
5656
"updateConfig": [

docroot/annotations.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
use Commercetools\Core\Helper\Annotate\AnnotationGenerator;
99

10-
require '../vendor/autoload.php';
10+
require __DIR__ . '/../vendor/autoload.php';
1111

1212
$path = __DIR__ . '/../src/';
1313

docroot/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Commercetools\Core\Request\Products\ProductProjectionSearchRequest;
1717
use Symfony\Component\Yaml\Yaml;
1818

19-
require '../vendor/autoload.php';
19+
require __DIR__ . '../vendor/autoload.php';
2020

2121
$appConfig = Yaml::parse(file_get_contents('myapp.yml'));
2222
$context = Context::of()->setLanguages(['en'])->setGraceful(true);

features/bootstrap/FeatureContext.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ public static function setup()
2222
{
2323
if (isset($_SERVER['BEHAT_COVERAGE']) && $_SERVER['BEHAT_COVERAGE'] == true) {
2424
$filter = new \PHP_CodeCoverage_Filter();
25-
$filter->addDirectoryToBlacklist(__DIR__ . "/../vendor");
26-
$filter->addDirectoryToBlacklist(__DIR__ . "/../tests");
27-
$filter->addDirectoryToBlacklist(__DIR__ . "/../features");
28-
$filter->addDirectoryToWhitelist(__DIR__ . "/../src");
25+
$filter->addDirectoryToBlacklist(__DIR__ . '/../vendor');
26+
$filter->addDirectoryToBlacklist(__DIR__ . '/../tests');
27+
$filter->addDirectoryToBlacklist(__DIR__ . '/../features');
28+
$filter->addDirectoryToWhitelist(__DIR__ . '/../src');
2929

3030
static::$coverage = new \PHP_CodeCoverage(null, $filter);
3131
static::$coverage->start('Behat Test');
@@ -44,7 +44,7 @@ public static function teardown()
4444

4545
echo 'Generating code coverage report in Clover XML format ... ';
4646
$writer = new \PHP_CodeCoverage_Report_Clover();
47-
$writer->process(static::$coverage, __DIR__ . "/../../build/logs/behat-clover.cov");
47+
$writer->process(static::$coverage, __DIR__ . '/../../build/logs/behat-clover.cov');
4848
echo 'done' . PHP_EOL;
4949

5050
// echo 'Generating code coverage report in HTML format ... ';

src/AbstractHttpClient.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515
abstract class AbstractHttpClient
1616
{
17-
const VERSION = '1.2.3';
17+
const VERSION = '1.3.0';
1818

1919
/**
2020
* @var AdapterInterface
@@ -87,9 +87,7 @@ public function getHttpClient($options = [])
8787
],
8888
$options
8989
);
90-
$class = $this->getAdapterFactory()->getClass($this->getConfig()->getAdapter());
91-
92-
$this->httpClient = new $class($options);
90+
$this->httpClient = $this->getAdapterFactory()->getAdapter($this->getConfig()->getAdapter(), $options);
9391
}
9492

9593
return $this->httpClient;

src/Client.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Commercetools\Core\Response\ErrorResponse;
1010
use Psr\Http\Message\RequestInterface;
1111
use Psr\Http\Message\ResponseInterface;
12+
use Psr\Log\LoggerAwareInterface;
1213
use Psr\Log\LoggerInterface;
1314
use Commercetools\Core\Client\Adapter\AdapterInterface;
1415
use Commercetools\Core\Error\InvalidTokenException;
@@ -124,7 +125,7 @@
124125
*
125126
* @package Commercetools\Core
126127
*/
127-
class Client extends AbstractHttpClient
128+
class Client extends AbstractHttpClient implements LoggerAwareInterface
128129
{
129130
const DEPRECATION_HEADER = 'X-DEPRECATION-NOTICE';
130131

@@ -182,7 +183,7 @@ protected function setOauthManager(Manager $oauthManager)
182183
* @param LoggerInterface $logger
183184
* @return $this
184185
*/
185-
protected function setLogger(LoggerInterface $logger = null)
186+
public function setLogger(LoggerInterface $logger = null)
186187
{
187188
if ($logger instanceof LoggerInterface) {
188189
$this->logger = $logger;

src/Client/Adapter/AdapterFactory.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public function register($name, $adapterClass)
3131
}
3232

3333
/**
34+
* @internal
3435
* @param string $name
3536
* @return string
3637
*/
@@ -49,4 +50,17 @@ public function getClass($name = null)
4950

5051
throw new InvalidArgumentException();
5152
}
53+
54+
/**
55+
* @param $name
56+
* @param $options
57+
* @return AdapterInterface
58+
*/
59+
public function getAdapter($name, $options)
60+
{
61+
$adapterClass = $this->getClass($name);
62+
$adapter = new $adapterClass($options);
63+
64+
return $adapter;
65+
}
5266
}

src/Client/Adapter/AdapterInterface.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@
77

88
use Psr\Http\Message\RequestInterface;
99
use Psr\Http\Message\ResponseInterface;
10+
use Psr\Log\LoggerAwareInterface;
1011
use Psr\Log\LoggerInterface;
1112

12-
interface AdapterInterface
13+
interface AdapterInterface extends LoggerAwareInterface
1314
{
1415
public function setLogger(LoggerInterface $logger);
1516

17+
public function addHandler($handler);
18+
1619
/**
1720
* @param RequestInterface $request
1821
* @return ResponseInterface

src/Client/Adapter/Guzzle5Adapter.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class Guzzle5Adapter implements AdapterInterface
2727
* @var LoggerInterface
2828
*/
2929
protected $logger;
30+
3031
/**
3132
* @param array $options
3233
*/
@@ -61,6 +62,10 @@ public function setLogger(LoggerInterface $logger)
6162
}
6263
}
6364

65+
public function addHandler($handler)
66+
{
67+
$this->getEmitter()->attach($handler);
68+
}
6469

6570
/**
6671
* @internal

src/Client/Adapter/Guzzle6Adapter.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@ public function __construct(array $options = [])
4444
public function setLogger(LoggerInterface $logger)
4545
{
4646
$this->logger = $logger;
47-
$this->client->getConfig('handler')->push(Middleware::log($logger, new MessageFormatter()));
47+
$this->addHandler(Middleware::log($logger, new MessageFormatter()));
48+
}
49+
50+
public function addHandler($handler)
51+
{
52+
$this->client->getConfig('handler')->push($handler);
4853
}
4954

5055
/**

src/Error/OutOfStockError.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* @method OutOfStockError setMessage(string $message = null)
1515
* @method array getLineItems()
1616
* @method OutOfStockError setLineItems(array $lineItems = null)
17+
* @method array getSkus()
18+
* @method OutOfStockError setSkus(array $skus = null)
1719
*/
1820
class OutOfStockError extends ApiError
1921
{
@@ -23,6 +25,7 @@ public function fieldDefinitions()
2325
{
2426
$definitions = parent::fieldDefinitions();
2527
$definitions['lineItems'] = [static::TYPE => 'array'];
28+
$definitions['skus'] = [static::TYPE => 'array'];
2629

2730
return $definitions;
2831
}

src/Model/Cart/Cart.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Commercetools\Core\Model\Cart;
77

88
use Commercetools\Core\Model\Common\Address;
9+
use Commercetools\Core\Model\Common\LocaleTrait;
910
use Commercetools\Core\Model\Common\Resource;
1011
use Commercetools\Core\Model\Common\Money;
1112
use Commercetools\Core\Model\Common\TaxedPrice;
@@ -61,10 +62,13 @@
6162
* @method Cart setTaxMode(string $taxMode = null)
6263
* @method string getAnonymousId()
6364
* @method Cart setAnonymousId(string $anonymousId = null)
65+
* @method string getLocale()
6466
* @method CartReference getReference()
6567
*/
6668
class Cart extends Resource
6769
{
70+
use LocaleTrait;
71+
6872
const TAX_MODE_PLATFORM = 'Platform';
6973
const TAX_MODE_EXTERNAL = 'External';
7074
const TAX_MODE_DISABLED = 'Disabled';
@@ -99,7 +103,8 @@ public function fieldDefinitions()
99103
'custom' => [static::TYPE => '\Commercetools\Core\Model\CustomField\CustomFieldObject'],
100104
'paymentInfo' => [static::TYPE => '\Commercetools\Core\Model\Payment\PaymentInfo'],
101105
'taxMode' => [static::TYPE => 'string'],
102-
'anonymousId' => [static::TYPE => 'string']
106+
'anonymousId' => [static::TYPE => 'string'],
107+
'locale' => [static::TYPE => 'string'],
103108
];
104109
}
105110

src/Model/Cart/CartDraft.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
use Commercetools\Core\Model\Common\Context;
99
use Commercetools\Core\Model\Common\JsonObject;
10+
use Commercetools\Core\Model\Common\LocaleTrait;
1011
use Commercetools\Core\Model\CustomField\CustomFieldObjectDraft;
1112
use Commercetools\Core\Model\Common\Address;
1213
use Commercetools\Core\Model\ShippingMethod\ShippingMethodReference;
@@ -40,9 +41,12 @@
4041
* @method CartDraft setTaxMode(string $taxMode = null)
4142
* @method string getAnonymousId()
4243
* @method CartDraft setAnonymousId(string $anonymousId = null)
44+
* @method string getLocale()
4345
*/
4446
class CartDraft extends JsonObject
4547
{
48+
use LocaleTrait;
49+
4650
public function fieldDefinitions()
4751
{
4852
return [
@@ -59,6 +63,7 @@ public function fieldDefinitions()
5963
'custom' => [static::TYPE => '\Commercetools\Core\Model\CustomField\CustomFieldObjectDraft'],
6064
'taxMode' => [static::TYPE => 'string'],
6165
'anonymousId' => [static::TYPE => 'string'],
66+
'locale' => [static::TYPE => 'string'],
6267
];
6368
}
6469

src/Model/Cart/MyCartDraft.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77

88
use Commercetools\Core\Model\Common\Context;
99
use Commercetools\Core\Model\Common\JsonObject;
10+
use Commercetools\Core\Model\Common\LocaleTrait;
1011
use Commercetools\Core\Model\CustomField\CustomFieldObjectDraft;
1112
use Commercetools\Core\Model\Common\Address;
1213
use Commercetools\Core\Model\ShippingMethod\ShippingMethodReference;
1314

1415
/**
1516
* @package Commercetools\Core\Model\Cart
16-
* @link http://dev.commercetools.com/http-api-projects-me-carts.html#mycartdraft
17+
* @link https://dev.commercetools.com/http-api-projects-me-carts.html#mycartdraft
1718
* @method string getCurrency()
1819
* @method MyCartDraft setCurrency(string $currency = null)
1920
* @method string getCustomerEmail()
@@ -32,9 +33,12 @@
3233
* @method MyCartDraft setShippingMethod(ShippingMethodReference $shippingMethod = null)
3334
* @method CustomFieldObjectDraft getCustom()
3435
* @method MyCartDraft setCustom(CustomFieldObjectDraft $custom = null)
36+
* @method string getLocale()
3537
*/
3638
class MyCartDraft extends JsonObject
3739
{
40+
use LocaleTrait;
41+
3842
public function fieldDefinitions()
3943
{
4044
return [
@@ -47,6 +51,7 @@ public function fieldDefinitions()
4751
'billingAddress' => [static::TYPE => '\Commercetools\Core\Model\Common\Address'],
4852
'shippingMethod' => [static::TYPE => '\Commercetools\Core\Model\ShippingMethod\ShippingMethodReference'],
4953
'custom' => [static::TYPE => '\Commercetools\Core\Model\CustomField\CustomFieldObjectDraft'],
54+
'locale' => [static::TYPE => 'string'],
5055
];
5156
}
5257

src/Model/Cart/MyLineItemDraft.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
/**
2121
* @package Commercetools\Core\Model\Cart
22-
* @link http://dev.commercetools.com/http-api-projects-me-carts.html#mylineitemdraft
22+
* @link https://dev.commercetools.com/http-api-projects-me-carts.html#mylineitemdraft
2323
* @method string getProductId()
2424
* @method MyLineItemDraft setProductId(string $productId = null)
2525
* @method int getVariantId()

src/Model/Cart/MyLineItemDraftCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
/**
1111
* @package Commercetools\Core\Model\Cart
12-
* @link http://dev.commercetools.com/http-api-projects-me-carts.html#mylineitemdraft
12+
* @link https://dev.commercetools.com/http-api-projects-me-carts.html#mylineitemdraft
1313
* @method MyLineItemDraft current()
1414
* @method MyLineItemDraftCollection add(MyLineItemDraft $element)
1515
* @method MyLineItemDraft getAt($offset)

src/Model/Channel/Channel.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Commercetools\Core\Model\Common\DateTimeDecorator;
1111
use Commercetools\Core\Model\CustomField\CustomFieldObject;
1212
use Commercetools\Core\Model\Review\ReviewRatingStatistics;
13+
use Commercetools\Core\Model\Common\Address;
1314

1415
/**
1516
* @package Commercetools\Core\Model\Channel
@@ -34,6 +35,8 @@
3435
* @method Channel setCustom(CustomFieldObject $custom = null)
3536
* @method ReviewRatingStatistics getReviewRatingStatistics()
3637
* @method Channel setReviewRatingStatistics(ReviewRatingStatistics $reviewRatingStatistics = null)
38+
* @method Address getAddress()
39+
* @method Channel setAddress(Address $address = null)
3740
* @method ChannelReference getReference()
3841
*/
3942
class Channel extends Resource
@@ -57,6 +60,7 @@ public function fieldDefinitions()
5760
'description' => [static::TYPE => '\Commercetools\Core\Model\Common\LocalizedString'],
5861
'reviewRatingStatistics' => [static::TYPE => '\Commercetools\Core\Model\Review\ReviewRatingStatistics'],
5962
'custom' => [static::TYPE => '\Commercetools\Core\Model\CustomField\CustomFieldObject'],
63+
'address' => [static::TYPE => '\Commercetools\Core\Model\Common\Address'],
6064
];
6165
}
6266
}

src/Model/Channel/ChannelDraft.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Commercetools\Core\Model\Common\JsonObject;
1010
use Commercetools\Core\Model\Common\LocalizedString;
1111
use Commercetools\Core\Model\CustomField\CustomFieldObjectDraft;
12+
use Commercetools\Core\Model\Common\Address;
1213

1314
/**
1415
* @package Commercetools\Core\Model\Channel
@@ -23,6 +24,8 @@
2324
* @method ChannelDraft setDescription(LocalizedString $description = null)
2425
* @method CustomFieldObjectDraft getCustom()
2526
* @method ChannelDraft setCustom(CustomFieldObjectDraft $custom = null)
27+
* @method Address getAddress()
28+
* @method ChannelDraft setAddress(Address $address = null)
2629
*/
2730
class ChannelDraft extends JsonObject
2831
{
@@ -34,6 +37,7 @@ public function fieldDefinitions()
3437
'name' => [static::TYPE => '\Commercetools\Core\Model\Common\LocalizedString'],
3538
'description' => [static::TYPE => '\Commercetools\Core\Model\Common\LocalizedString'],
3639
'custom' => [static::TYPE => '\Commercetools\Core\Model\CustomField\CustomFieldObjectDraft'],
40+
'address' => [static::TYPE => '\Commercetools\Core\Model\Common\Address'],
3741
];
3842
}
3943

0 commit comments

Comments
 (0)