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

Commit 18bfc72

Browse files
author
Jens Schulze
committed
Merge branch 'release/v1.6.0'
2 parents d31d97e + bc67e53 commit 18bfc72

34 files changed

+841
-43
lines changed

.travis.yml

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,48 @@
11
language: php
22
php:
3-
- 5.6
4-
- 5.5
5-
- 5.4
6-
- 7.0
7-
- hhvm
8-
3+
- 7.0
4+
- 5.6
5+
- 5.5
6+
- 5.4
7+
- 7.1
8+
- hhvm
9+
- nightly
910
matrix:
1011
allow_failures:
11-
- php: hhvm
12-
12+
- php: 7.1
13+
- php: hhvm
14+
- php: nightly
1315
services:
14-
- redis-server
15-
16+
- redis-server
1617
cache:
1718
directories:
1819
- vendor
19-
2020
before_script:
21-
- PHP=$TRAVIS_PHP_VERSION
22-
- composer config -g github-oauth.github.com $GITHUB_OAUTH_TOKEN
23-
- sh -c "if [ $PHP != 'hhvm' ] && [ `php-config --vernum` -lt 70000 ] ; then echo 'extension = redis.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini ; fi"
24-
- sh -c "if [ $PHP != 'hhvm' ] && [ `php-config --vernum` -ge 50400 ] && [ `php-config --vernum` -lt 70000 ]; then printf "yes\n" | pecl install -f apcu-4.0.10 ; fi"
25-
- sh -c "if [ $PHP != 'hhvm' ] && [ `php-config --vernum` -ge 70000 ] ; then printf "yes\n" | pecl install -f apcu-5.1.3 ; fi"
26-
- sh -c "if [ $PHP != 'hhvm' ] ; then phpenv config-add ./tests/apc.ini; fi"
27-
- if [ $PHP == '5.4' ] ; then ./set_guzzle5.sh; fi
28-
- composer global require hirak/prestissimo
29-
- composer self-update
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
32-
21+
- PHP=$TRAVIS_PHP_VERSION
22+
- composer config -g github-oauth.github.com $GITHUB_OAUTH_TOKEN
23+
- sh -c "if [ $PHP != 'hhvm' ] && [ `php-config --vernum` -lt 70000 ] ; then echo
24+
'extension = redis.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
25+
; fi"
26+
- sh -c "if [ $PHP != 'hhvm' ] && [ `php-config --vernum` -ge 50400 ] && [ `php-config
27+
--vernum` -lt 70000 ]; then printf "yes\n" | pecl install -f apcu-4.0.10 ; fi"
28+
- sh -c "if [ $PHP != 'hhvm' ] && [ `php-config --vernum` -ge 70000 ] ; then printf
29+
"yes\n" | pecl install -f apcu-5.1.7 ; fi"
30+
- sh -c "if [ $PHP != 'hhvm' ] ; then phpenv config-add ./tests/apc.ini; fi"
31+
- if [ $PHP == '5.4' ] ; then ./set_guzzle5.sh; fi
32+
- if [ $PHP != 'nightly' ] && [ $PHP != '7.1' ]; then composer global require hirak/prestissimo;
33+
fi
34+
- if [ $PHP == '5.4' ] ; then composer update -o --prefer-dist --prefer-lowest; fi
35+
- if [ $PHP != '5.4' ] ; then composer install -o --prefer-dist; fi
3336
script:
34-
- ant phpcs-ci
35-
- phpunit --testsuite=unit
36-
- if [ $PHP == '7.0' ] ; then phpunit --testsuite=integration; fi
37-
- ant behat
38-
37+
- ant phpcs-ci
38+
- phpunit --testsuite=unit
39+
- if [ $PHP == '7.0' ] ; then phpunit --testsuite=integration; fi
40+
- ant behat
3941
after_success:
40-
- ./push-docs-to-gh-pages.sh
41-
42+
- ./push-docs-to-gh-pages.sh
4243
notifications:
4344
hipchat:
4445
rooms:
4546
secure: VD5RvUZYVg1aokw8OeMhNfDPc39o2r4Jjq8s6U2QvMXzoiopHpj6+VYX1AHbhxMpBGmsgKfzbYQ6XfubJUeHq+FMzW3YEekwcyqXKCfWi5tLCE7Epb0dCySatztVTkqlXzXaAM6NhzdFxG6kQPiA9OcSvRPZmSwjuX4eYXRokRw=
47+
slack:
48+
secure: ZZ4PVXEv9FXuk81pRBCYAPZYeKnqvYYPd5DKB3E9WWKZQAZExMtSvqa7cDcbvQRk7jsD6E1RvTIn42p2jjypXN8ZKbmjsshrVd02fhmmwP7cQk9s3WE1fZhYt7CnCu0EJHOK3/fC3ddOXFJ/xlFvM3DXDd1RRZfBzVz5XWeQDr8=

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
<a name="1.6.0"></a>
2+
# [1.6.0](https://github.com/commercetools/commercetools-php-sdk/compare/v1.5.1...v1.6.0) (2017-01-09)
3+
4+
5+
### Bug Fixes
6+
7+
* **Cart:** rewind line items in helper method ([cbd2426](https://github.com/commercetools/commercetools-php-sdk/commit/cbd2426)), closes [#281](https://github.com/commercetools/commercetools-php-sdk/issues/281)
8+
* **Client:** typo in call to getOauthManager ([e9cc4a7](https://github.com/commercetools/commercetools-php-sdk/commit/e9cc4a7)), closes [#277](https://github.com/commercetools/commercetools-php-sdk/issues/277)
9+
10+
### Features
11+
12+
* **Cart:** add product type reference to line item ([e795540](https://github.com/commercetools/commercetools-php-sdk/commit/e795540)), closes [#280](https://github.com/commercetools/commercetools-php-sdk/issues/280)
13+
* **Channel:** add geo location information to channels ([b4d6024](https://github.com/commercetools/commercetools-php-sdk/commit/b4d6024)), closes [#272](https://github.com/commercetools/commercetools-php-sdk/issues/272)
14+
* **Channel:** add setGeolocation update action ([db4b46e](https://github.com/commercetools/commercetools-php-sdk/commit/db4b46e))
15+
* **Customer:** add shipping and billing address ids ([6e48320](https://github.com/commercetools/commercetools-php-sdk/commit/6e48320)), closes [#278](https://github.com/commercetools/commercetools-php-sdk/issues/278)
16+
* **GraphQL:** support GraphQL variables ([61eca3e](https://github.com/commercetools/commercetools-php-sdk/commit/61eca3e)), closes [#271](https://github.com/commercetools/commercetools-php-sdk/issues/271)
17+
* **ProductSearch:** add productCount to FacetResult ([8e0c946](https://github.com/commercetools/commercetools-php-sdk/commit/8e0c946)), closes [#279](https://github.com/commercetools/commercetools-php-sdk/issues/279)
18+
* **Subscriptions:** Support AwsSNS for subscriptions ([f4e2c0e](https://github.com/commercetools/commercetools-php-sdk/commit/f4e2c0e)), closes [#282](https://github.com/commercetools/commercetools-php-sdk/issues/282)
19+
20+
21+
122
<a name="1.5.1"></a>
223
## [1.5.1](https://github.com/commercetools/commercetools-php-sdk/compare/v1.5.0...v1.5.1) (2016-11-21)
324

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
},
6262
"extra": {
6363
"branch-alias": {
64-
"dev-develop": "1.5-dev"
64+
"dev-develop": "1.7-dev"
6565
},
6666
"incenteev-parameters": [
6767
{

index.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
/**
3+
* This is a bootstrap file for a phar distribution of the SDK in order to be able to use
4+
* `require 'commercetools-php-sdk.phar';`
5+
*/
6+
require __DIR__ . '/vendor/autoload.php';

src/AbstractHttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515
abstract class AbstractHttpClient
1616
{
17-
const VERSION = '1.5.1';
17+
const VERSION = '1.6.0';
1818

1919
/**
2020
* @var AdapterInterface

src/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ function ($httpResponse) use ($httpRequest) {
283283
*/
284284
protected function createHttpRequest(ClientRequestInterface $request)
285285
{
286-
$token = $this->getOAuthManager()->getToken();
286+
$token = $this->getOauthManager()->getToken();
287287

288288
$httpRequest = $request->httpRequest();
289289
$httpRequest = $httpRequest

src/Model/Cart/Cart.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ public function getLineItemCount()
115115
foreach ($this->getLineItems() as $lineItem) {
116116
$count+= $lineItem->getQuantity();
117117
}
118+
$this->getLineItems()->rewind();
118119
}
119120
return $count;
120121
}

src/Model/Cart/LineItem.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Commercetools\Core\Model\TaxCategory\TaxRate;
1616
use Commercetools\Core\Model\CustomField\CustomFieldObject;
1717
use Commercetools\Core\Model\Common\TaxedItemPrice;
18+
use Commercetools\Core\Model\ProductType\ProductTypeReference;
1819

1920
/**
2021
* @package Commercetools\Core\Model\Cart
@@ -50,6 +51,8 @@
5051
* @method LineItem setTaxedPrice(TaxedItemPrice $taxedPrice = null)
5152
* @method string getPriceMode()
5253
* @method LineItem setPriceMode(string $priceMode = null)
54+
* @method ProductTypeReference getProductType()
55+
* @method LineItem setProductType(ProductTypeReference $productType = null)
5356
*/
5457
class LineItem extends JsonObject
5558
{
@@ -76,7 +79,8 @@ public function fieldDefinitions()
7679
'discountedPricePerQuantity' => [
7780
static::TYPE => '\Commercetools\Core\Model\Cart\DiscountedPricePerQuantityCollection'
7881
],
79-
'priceMode' => [static::TYPE => 'string']
82+
'priceMode' => [static::TYPE => 'string'],
83+
'productType' => [static::TYPE => '\Commercetools\Core\Model\ProductType\ProductTypeReference']
8084
];
8185
}
8286

@@ -100,6 +104,7 @@ public function getDiscountedPrice()
100104
foreach ($this->getDiscountedPricePerQuantity() as $discountedPricePerQuantity) {
101105
$centAmount += $discountedPricePerQuantity->getDiscountedTotal()->getCentAmount();
102106
}
107+
$this->getDiscountedPricePerQuantity()->rewind();
103108
return Money::ofCurrencyAndAmount($currencyCode, $centAmount);
104109
}
105110
}

src/Model/Channel/Channel.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Commercetools\Core\Model\CustomField\CustomFieldObject;
1212
use Commercetools\Core\Model\Review\ReviewRatingStatistics;
1313
use Commercetools\Core\Model\Common\Address;
14+
use Commercetools\Core\Model\Common\GeoLocation;
1415

1516
/**
1617
* @package Commercetools\Core\Model\Channel
@@ -37,6 +38,8 @@
3738
* @method Channel setReviewRatingStatistics(ReviewRatingStatistics $reviewRatingStatistics = null)
3839
* @method Address getAddress()
3940
* @method Channel setAddress(Address $address = null)
41+
* @method GeoLocation getGeoLocation()
42+
* @method Channel setGeoLocation(GeoLocation $geoLocation = null)
4043
* @method ChannelReference getReference()
4144
*/
4245
class Channel extends Resource
@@ -61,6 +64,7 @@ public function fieldDefinitions()
6164
'reviewRatingStatistics' => [static::TYPE => '\Commercetools\Core\Model\Review\ReviewRatingStatistics'],
6265
'custom' => [static::TYPE => '\Commercetools\Core\Model\CustomField\CustomFieldObject'],
6366
'address' => [static::TYPE => '\Commercetools\Core\Model\Common\Address'],
67+
'geoLocation' => [static::TYPE => '\Commercetools\Core\Model\Common\GeoLocation'],
6468
];
6569
}
6670
}

src/Model/Channel/ChannelDraft.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\LocalizedString;
1111
use Commercetools\Core\Model\CustomField\CustomFieldObjectDraft;
1212
use Commercetools\Core\Model\Common\Address;
13+
use Commercetools\Core\Model\Common\GeoLocation;
1314

1415
/**
1516
* @package Commercetools\Core\Model\Channel
@@ -26,6 +27,8 @@
2627
* @method ChannelDraft setCustom(CustomFieldObjectDraft $custom = null)
2728
* @method Address getAddress()
2829
* @method ChannelDraft setAddress(Address $address = null)
30+
* @method GeoLocation getGeoLocation()
31+
* @method ChannelDraft setGeoLocation(GeoLocation $geoLocation = null)
2932
*/
3033
class ChannelDraft extends JsonObject
3134
{
@@ -38,6 +41,7 @@ public function fieldDefinitions()
3841
'description' => [static::TYPE => '\Commercetools\Core\Model\Common\LocalizedString'],
3942
'custom' => [static::TYPE => '\Commercetools\Core\Model\CustomField\CustomFieldObjectDraft'],
4043
'address' => [static::TYPE => '\Commercetools\Core\Model\Common\Address'],
44+
'geoLocation' => [static::TYPE => '\Commercetools\Core\Model\Common\GeoLocation'],
4145
];
4246
}
4347

src/Model/Common/GeoLocation.php

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?php
2+
/**
3+
* @author @jayS-de <jens.schulze@commercetools.de>
4+
*/
5+
6+
namespace Commercetools\Core\Model\Common;
7+
8+
/**
9+
* @package Commercetools\Core\Model\Common
10+
*
11+
* @method string getType()
12+
* @method GeoLocation setType(string $type = null)
13+
* @method array getCoordinates()
14+
* @method GeoLocation setCoordinates(array $coordinates = null)
15+
*/
16+
class GeoLocation extends JsonObject
17+
{
18+
const TYPE_NAME = 'Point';
19+
20+
/**
21+
* @param array $data
22+
* @param Context|callable $context
23+
*/
24+
public function __construct(array $data = [], $context = null)
25+
{
26+
parent::__construct($data, $context);
27+
$name = static::TYPE_NAME;
28+
if (!empty($name)) {
29+
$this->setType(static::TYPE_NAME);
30+
}
31+
}
32+
33+
/**
34+
* @return array
35+
*/
36+
public function fieldDefinitions()
37+
{
38+
return [
39+
'type' => [static::TYPE => 'string'],
40+
'coordinates' => [static::TYPE => 'array']
41+
];
42+
}
43+
44+
/**
45+
* @param array $data
46+
* @param Context|callable $context
47+
* @return static
48+
*/
49+
public static function fromArray(array $data, $context = null)
50+
{
51+
if (isset($data['type'])) {
52+
$className = static::getGeoTypeByTypeName($data['type']);
53+
if (class_exists($className)) {
54+
return new $className($data, $context);
55+
}
56+
}
57+
return new static($data, $context);
58+
}
59+
60+
protected static function getGeoTypeByTypeName($apiType)
61+
{
62+
$className = '\Commercetools\Core\Model\Common\\Geo' . ucfirst($apiType);
63+
return $className;
64+
}
65+
}

src/Model/Common/GeoPoint.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
/**
3+
* @author @jayS-de <jens.schulze@commercetools.de>
4+
*/
5+
6+
namespace Commercetools\Core\Model\Common;
7+
8+
/**
9+
* @package Commercetools\Core\Model\Common
10+
*
11+
* @method string getType()
12+
* @method GeoPoint setType(string $type = null)
13+
* @method array getCoordinates()
14+
* @method GeoPoint setCoordinates(array $coordinates = null)
15+
*/
16+
class GeoPoint extends GeoLocation
17+
{
18+
const TYPE_NAME = 'Point';
19+
}

src/Model/Customer/Customer.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@
6060
* @method CustomFieldObject getCustom()
6161
* @method Customer setCustom(CustomFieldObject $custom = null)
6262
* @method string getLocale()
63+
* @method array getShippingAddressIds()
64+
* @method Customer setShippingAddressIds(array $shippingAddressIds = null)
65+
* @method array getBillingAddressIds()
66+
* @method Customer setBillingAddressIds(array $billingAddressIds = null)
6367
* @method CustomerReference getReference()
6468
*/
6569
class Customer extends Resource
@@ -100,6 +104,8 @@ public function fieldDefinitions()
100104
'customerGroup' => [static::TYPE => '\Commercetools\Core\Model\CustomerGroup\CustomerGroupReference'],
101105
'custom' => [static::TYPE => '\Commercetools\Core\Model\CustomField\CustomFieldObject'],
102106
'locale' => [static::TYPE => 'string'],
107+
'shippingAddressIds' => [static::TYPE => 'array'],
108+
'billingAddressIds' => [static::TYPE => 'array'],
103109
];
104110
}
105111

src/Model/Customer/CustomerDraft.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@
5454
* @method CustomFieldObjectDraft getCustom()
5555
* @method CustomerDraft setCustom(CustomFieldObjectDraft $custom = null)
5656
* @method string getLocale()
57+
* @method array getBillingAddresses()
58+
* @method CustomerDraft setBillingAddresses(array $billingAddresses = null)
59+
* @method array getShippingAddresses()
60+
* @method CustomerDraft setShippingAddresses(array $shippingAddresses = null)
5761
*/
5862
class CustomerDraft extends JsonObject
5963
{
@@ -84,6 +88,8 @@ public function fieldDefinitions()
8488
'defaultBillingAddress' => [static::TYPE => 'int'],
8589
'custom' => [static::TYPE => '\Commercetools\Core\Model\CustomField\CustomFieldObjectDraft'],
8690
'locale' => [static::TYPE => 'string'],
91+
'billingAddresses' => [static::TYPE => 'array'],
92+
'shippingAddresses' => [static::TYPE => 'array'],
8793
];
8894
}
8995

src/Model/Product/FacetTerm.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,17 @@
1313
* @method FacetTerm setTerm(string $term = null)
1414
* @method int getCount()
1515
* @method FacetTerm setCount(int $count = null)
16+
* @method int getProductCount()
17+
* @method FacetTerm setProductCount(int $productCount = null)
1618
*/
1719
class FacetTerm extends JsonObject
1820
{
1921
public function fieldDefinitions()
2022
{
2123
return [
2224
'term' => [static::TYPE => 'string'],
23-
'count' => [static::TYPE => 'int']
25+
'count' => [static::TYPE => 'int'],
26+
'productCount' => [static::TYPE => 'int'],
2427
];
2528
}
2629
}

0 commit comments

Comments
 (0)