├── .gitattributes
├── tests
├── apc.ini
├── fixtures
│ ├── CT_cube_200px.png
│ ├── EventuallyException.php
│ ├── FixtureException.php
│ ├── ManuelActivationStrategy.php
│ ├── Profiler.php
│ ├── AnonymousId.php
│ ├── FooHandler.php
│ ├── InstanceTokenStorage.php
│ └── models.yaml
├── myapp.yml.dist
├── integration
│ └── TestUtils.php
└── unit
│ ├── Model
│ ├── Common
│ │ ├── EnumTest.php
│ │ └── LocalizedEnumTest.php
│ ├── Product
│ │ ├── RangeTestObject.php
│ │ └── ProductDraftTest.php
│ ├── ProductType
│ │ └── ProductTypeDraftTest.php
│ ├── Cart
│ │ └── CartCollectionTest.php
│ └── State
│ │ └── StateCollectionTest.php
│ ├── Request
│ ├── Project
│ │ └── ProjectGetRequestTest.php
│ └── Me
│ │ └── MeRequestTest.php
│ ├── Helper
│ ├── CurrencyFormatterTest.php
│ └── AnnotationGeneratorTest.php
│ ├── Client
│ └── JsonEndpointTest.php
│ └── Error
│ └── ApiErrorTest.php
├── .github
├── CODEOWNERS
└── ISSUE_TEMPLATE
│ ├── custom.md
│ ├── feature_request.md
│ └── bug_report.md
├── tools
├── changelog.sh
├── docker-phpunit.sh
├── commit-msg.sh
├── 60-user.ini
├── build_phar.sh
├── http-client.env.json
├── psr2.php
├── test-requests.http
└── extract_changelog.php
├── src
└── Core
│ ├── Error
│ ├── ForbiddenException.php
│ ├── DeprecatedException.php
│ ├── BadGatewayException.php
│ ├── UpdateActionLimitException.php
│ ├── InvalidArgumentException.php
│ ├── NotFoundException.php
│ ├── ApiServiceException.php
│ ├── BadRequestException.php
│ ├── ServerErrorException.php
│ ├── UnauthorizedException.php
│ ├── InternalServerErrorException.php
│ ├── InvalidTokenException.php
│ ├── ServiceUnavailableException.php
│ ├── InvalidClientCredentialsException.php
│ ├── EnumValueIsUsedError.php
│ ├── LanguageUsedInStoresError.php
│ ├── GatewayTimeoutException.php
│ ├── AccessDeniedError.php
│ ├── InvalidTokenError.php
│ ├── ClientErrorException.php
│ ├── InvalidSubjectError.php
│ ├── InvalidOperationError.php
│ ├── ResourceNotFoundError.php
│ ├── InsufficientScopeError.php
│ ├── InvalidCredentialsError.php
│ ├── NoMatchingProductDiscountFoundError.php
│ ├── InvalidCurrentPasswordError.php
│ ├── ShippingMethodDoesNotMatchCartError.php
│ └── QueryTimedOutError.php
│ ├── Request
│ ├── OrderEdits
│ │ ├── StagedOrder
│ │ │ └── Command
│ │ │ │ ├── StagedOrderUpdateAction.php
│ │ │ │ ├── StagedOrderSetLocaleAction.php
│ │ │ │ ├── StagedOrderUpdateActionCollection.php
│ │ │ │ ├── StagedOrderSetCountryAction.php
│ │ │ │ ├── StagedOrderAddDiscountCodeAction.php
│ │ │ │ ├── StagedOrderChangeTaxModeAction.php
│ │ │ │ ├── StagedOrderSetCustomerEmailAction.php
│ │ │ │ ├── StagedOrderSetCustomerIdAction.php
│ │ │ │ ├── StagedOrderRemoveDeliveryAction.php
│ │ │ │ ├── StagedOrderSetOrderNumberAction.php
│ │ │ │ ├── StagedOrderChangeOrderStateAction.php
│ │ │ │ ├── StagedOrderChangePaymentStateAction.php
│ │ │ │ ├── StagedOrderChangeShipmentStateAction.php
│ │ │ │ ├── StagedOrderAddPaymentAction.php
│ │ │ │ ├── StagedOrderRemoveCustomLineItemAction.php
│ │ │ │ ├── StagedOrderChangeTaxRoundingModeAction.php
│ │ │ │ ├── StagedOrderSetBillingAddressAction.php
│ │ │ │ ├── StagedOrderRemovePaymentAction.php
│ │ │ │ ├── StagedOrderSetShippingAddressAction.php
│ │ │ │ ├── StagedOrderRemoveParcelFromDeliveryAction.php
│ │ │ │ ├── StagedOrderRemoveItemShippingAddressAction.php
│ │ │ │ └── StagedOrderSetCustomFieldAction.php
│ │ ├── OrderEditsEndpoint.php
│ │ └── Command
│ │ │ └── OrderEditSetCustomFieldAction.php
│ ├── Query
│ │ ├── MultiParameter.php
│ │ ├── ParameterInterface.php
│ │ └── OrderedMultiParameter.php
│ ├── QueryAllRequestInterface.php
│ ├── SortRequestInterface.php
│ ├── QueryRequestInterface.php
│ ├── InStores
│ │ ├── InStoreTrait.php
│ │ └── InStoreEndpoint.php
│ ├── WithTotalRequestInterface.php
│ ├── Extensions
│ │ └── ExtensionsEndpoint.php
│ ├── Me
│ │ ├── MeEndpoint.php
│ │ ├── MeCartsEndpoint.php
│ │ ├── MeOrdersEndpoint.php
│ │ └── MeShoppingListsEndpoint.php
│ ├── ProductSelections
│ │ ├── ProductSelectionsEndpoint.php
│ │ └── ProductSelectionAssignmentsEndpoint.php
│ ├── Carts
│ │ ├── CartsEndpoint.php
│ │ └── Command
│ │ │ └── CartSetCustomFieldAction.php
│ ├── States
│ │ └── StatesEndpoint.php
│ ├── GraphQL
│ │ └── GraphQLEndpoint.php
│ ├── Payments
│ │ └── PaymentsEndpoint.php
│ ├── Stores
│ │ └── StoresEndpoint.php
│ ├── ApiClients
│ │ └── ApiClientsEndpoint.php
│ ├── Customers
│ │ ├── LoginEndpoint.php
│ │ ├── CustomersEndpoint.php
│ │ └── Command
│ │ │ └── CustomerSetCustomFieldAction.php
│ ├── Subscriptions
│ │ └── SubscriptionsEndpoint.php
│ ├── Products
│ │ ├── ProductsEndpoint.php
│ │ └── ProductProjectionEndpoint.php
│ ├── Types
│ │ └── TypesEndpoint.php
│ ├── Zones
│ │ └── ZonesEndpoint.php
│ ├── Orders
│ │ ├── OrdersEndpoint.php
│ │ └── Command
│ │ │ ├── OrderSetCustomFieldAction.php
│ │ │ ├── OrderRemoveItemShippingAddressAction.php
│ │ │ ├── OrderAddPaymentAction.php
│ │ │ ├── OrderAddItemShippingAddressAction.php
│ │ │ ├── OrderRemovePaymentAction.php
│ │ │ └── OrderUpdateItemShippingAddressAction.php
│ ├── Reviews
│ │ ├── ReviewsEndpoint.php
│ │ └── Command
│ │ │ └── ReviewSetCustomFieldAction.php
│ ├── Channels
│ │ ├── ChannelsEndpoint.php
│ │ └── Command
│ │ │ └── ChannelSetCustomFieldAction.php
│ ├── Messages
│ │ └── MessagesEndpoint.php
│ ├── Inventory
│ │ ├── InventoryEndpoint.php
│ │ └── Command
│ │ │ └── InventorySetCustomFieldAction.php
│ ├── PageRequestInterface.php
│ ├── ProductTypes
│ │ └── ProductTypesEndpoint.php
│ ├── CartDiscounts
│ │ ├── CartDiscountsEndpoint.php
│ │ └── Command
│ │ │ └── CartDiscountSetCustomFieldAction.php
│ ├── CustomObjects
│ │ └── CustomObjectsEndpoint.php
│ ├── DiscountCodes
│ │ ├── DiscountCodesEndpoint.php
│ │ └── Command
│ │ │ └── DiscountCodeSetCustomFieldAction.php
│ ├── ShoppingLists
│ │ └── ShoppingListsEndpoint.php
│ ├── TaxCategories
│ │ └── TaxCategoriesEndpoint.php
│ ├── CustomerGroups
│ │ ├── CustomerGroupsEndpoint.php
│ │ └── Command
│ │ │ └── CustomerGroupSetCustomFieldAction.php
│ ├── Categories
│ │ ├── CategoriesEndpoint.php
│ │ └── Command
│ │ │ └── CategorySetCustomFieldAction.php
│ ├── ShippingMethods
│ │ └── ShippingMethodsEndpoint.php
│ ├── ProductDiscounts
│ │ └── ProductDiscountsEndpoint.php
│ ├── AbstractAction.php
│ ├── CustomerIdTrait.php
│ └── ExpandTrait.php
│ ├── Client
│ ├── OAuth
│ │ ├── AnonymousIdProvider.php
│ │ ├── TokenProvider.php
│ │ ├── RefreshTokenProvider.php
│ │ ├── PreAuthTokenProvider.php
│ │ └── TokenStorage.php
│ ├── Adapter
│ │ ├── ConfigAware.php
│ │ ├── TokenProviderAware.php
│ │ ├── CorrelationIdAware.php
│ │ ├── PromiseGetInterface.php
│ │ └── AdapterPromiseInterface.php
│ ├── HttpMethod.php
│ ├── FileUploadRequest.php
│ ├── JsonRequest.php
│ ├── HttpRequest.php
│ ├── HttpRequestInterface.php
│ └── JsonEndpoint.php
│ ├── Model
│ ├── Product
│ │ ├── Search
│ │ │ └── FilterInterface.php
│ │ ├── FacetTermCollection.php
│ │ ├── FacetRangeCollection.php
│ │ ├── SuggestionCollection.php
│ │ ├── ProductCollection.php
│ │ ├── Suggestion.php
│ │ ├── ProductVariantDraftCollection.php
│ │ └── ProductVariantAvailabilityCollection.php
│ ├── Common
│ │ ├── TypeableInterface.php
│ │ ├── PriceTierCollection.php
│ │ ├── DateDecorator.php
│ │ ├── TimeDecorator.php
│ │ ├── ReferenceObjectInterface.php
│ │ ├── AssetDraftCollection.php
│ │ ├── GeoPoint.php
│ │ ├── MoneyCollection.php
│ │ ├── ImageCollection.php
│ │ ├── JsonDeserializeInterface.php
│ │ ├── PriceDraftCollection.php
│ │ ├── TaxPortionCollection.php
│ │ ├── ReferenceCollection.php
│ │ ├── ContainerAndKey.php
│ │ ├── AssetDimension.php
│ │ ├── LocaleTrait.php
│ │ ├── ImageDimension.php
│ │ ├── ContextAwareInterface.php
│ │ ├── TaxedItemPrice.php
│ │ ├── CreatedBy.php
│ │ ├── LastModifiedBy.php
│ │ └── ObjectTreeInterface.php
│ ├── MapperInterface.php
│ ├── OrderEdit
│ │ ├── OrderEditNotProcessed.php
│ │ └── OrderEditCollection.php
│ ├── Cart
│ │ ├── CartState.php
│ │ ├── InventoryMode.php
│ │ ├── ItemShippingTargetCollection.php
│ │ ├── CartDiscountCodeState.php
│ │ ├── CartCollection.php
│ │ ├── LineItemCollection.php
│ │ ├── LineItemDraftCollection.php
│ │ ├── MyLineItemDraftCollection.php
│ │ ├── DiscountCodeInfoCollection.php
│ │ ├── CustomLineItemDraftCollection.php
│ │ ├── CustomLineItemCollection.php
│ │ ├── DiscountedLineItemPortionCollection.php
│ │ ├── ItemShippingTarget.php
│ │ ├── DiscountedPricePerQuantityCollection.php
│ │ └── ItemShippingDetails.php
│ ├── State
│ │ ├── StateRole.php
│ │ └── StateReferenceCollection.php
│ ├── Extension
│ │ ├── TriggerCollection.php
│ │ ├── ExtensionCollection.php
│ │ └── AzureFunctionsAuthentication.php
│ ├── Order
│ │ ├── OrderState.php
│ │ ├── ReturnShipmentState.php
│ │ ├── PaymentState.php
│ │ ├── ReturnPaymentState.php
│ │ ├── ShipmentState.php
│ │ ├── SyncInfoCollection.php
│ │ ├── ItemStateCollection.php
│ │ ├── OrderCollection.php
│ │ ├── ReturnInfoCollection.php
│ │ ├── LineItemImportDraftCollection.php
│ │ └── DeliveryItem.php
│ ├── Project
│ │ ├── CartScoreType.php
│ │ ├── CartValueType.php
│ │ ├── CartsConfiguration.php
│ │ └── ShoppingListsConfiguration.php
│ ├── ApiClient
│ │ └── ApiClientCollection.php
│ ├── Payment
│ │ ├── TransactionState.php
│ │ ├── PaymentCollection.php
│ │ ├── TransactionType.php
│ │ ├── PaymentInfo.php
│ │ └── PaymentReferenceCollection.php
│ ├── Store
│ │ ├── StoreCollection.php
│ │ └── StoreReferenceCollection.php
│ ├── ShoppingList
│ │ ├── LineItemDraftCollection.php
│ │ ├── LineItemCollection.php
│ │ ├── TextLineItemDraftCollection.php
│ │ └── TextLineItemCollection.php
│ ├── Channel
│ │ ├── ChannelRole.php
│ │ └── ChannelCollection.php
│ ├── Type
│ │ ├── NumberType.php
│ │ ├── BooleanType.php
│ │ ├── MoneyType.php
│ │ ├── StringType.php
│ │ ├── DateType.php
│ │ ├── LocalizedStringType.php
│ │ ├── TimeType.php
│ │ └── DateTimeType.php
│ ├── Message
│ │ ├── StateTransitionMessage.php
│ │ ├── MessageCollection.php
│ │ └── ProductPriceDiscountsSetUpdatedPriceCollection.php
│ ├── Zone
│ │ ├── LocationCollection.php
│ │ └── ZoneCollection.php
│ ├── CartDiscount
│ │ ├── ShippingCostTarget.php
│ │ ├── CartDiscountCollection.php
│ │ ├── LineItemsTarget.php
│ │ └── CustomLineItemsTarget.php
│ ├── ProductType
│ │ ├── StringType.php
│ │ ├── NumberType.php
│ │ ├── BooleanType.php
│ │ ├── MoneyType.php
│ │ ├── LocalizedStringType.php
│ │ ├── DateType.php
│ │ ├── TimeType.php
│ │ └── DateTimeType.php
│ ├── Subscription
│ │ ├── ChangeSubscriptionCollection.php
│ │ ├── MessageSubscriptionCollection.php
│ │ ├── ChangeSubscription.php
│ │ ├── SubscriptionCollection.php
│ │ └── PayloadNotIncluded.php
│ ├── TaxCategory
│ │ ├── SubRateCollection.php
│ │ ├── TaxCategoryCollection.php
│ │ └── SubRate.php
│ ├── Review
│ │ └── ReviewCollection.php
│ ├── ShippingMethod
│ │ ├── ShippingRateCollection.php
│ │ ├── ZoneRateCollection.php
│ │ ├── ZoneRateDraftCollection.php
│ │ ├── ShippingRatePriceTierCollection.php
│ │ └── ShippingRateDraftCollection.php
│ ├── ProductSelection
│ │ ├── IndividualProductSelectionType.php
│ │ ├── ProductSelectionCollection.php
│ │ ├── AssignedProductReference.php
│ │ └── AssignedProductSelection.php
│ ├── Customer
│ │ └── CustomerCollection.php
│ ├── CustomField
│ │ ├── CustomFieldObjectCollection.php
│ │ └── CustomFieldObjectDraftCollection.php
│ ├── DiscountCode
│ │ └── DiscountCodeCollection.php
│ ├── Inventory
│ │ └── InventoryEntryCollection.php
│ ├── CustomerGroup
│ │ └── CustomerGroupCollection.php
│ ├── ProductDiscount
│ │ └── ProductDiscountCollection.php
│ └── Category
│ │ └── CategoryReferenceCollection.php
│ ├── Response
│ ├── ResourceResponse.php
│ └── ApiPromiseGetInterface.php
│ ├── Helper
│ ├── CorrelationIdProvider.php
│ ├── CurrencyFormatterInterface.php
│ └── State
│ │ └── Renderer
│ │ └── NodeRenderer.php
│ └── Builder
│ └── Request
│ └── GraphQLRequestBuilder.php
├── install-apigen.sh
├── box.json.dist
├── docroot
├── myapp.yml.dist
└── annotations.php
├── index.php
├── set_guzzle5.sh
├── PULL_REQUEST_TEMPLATE.md
├── ecs.yaml
├── phive.xml
├── install-apigen.sh.bat
├── CONTRIBUTING.md
├── ecs.php
├── renovate.json
├── .gitignore
└── package.json
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.php eol=lf
2 |
3 |
--------------------------------------------------------------------------------
/tests/apc.ini:
--------------------------------------------------------------------------------
1 | apc.enabled=1
2 | apc.enable_cli=1
3 |
--------------------------------------------------------------------------------
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | * @commercetools/clients-team
2 |
--------------------------------------------------------------------------------
/tools/changelog.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | npm run changelog
4 |
--------------------------------------------------------------------------------
/tools/docker-phpunit.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 |
4 | composer -n update --prefer-dist -o
5 | vendor/bin/phpunit "$@"
6 |
--------------------------------------------------------------------------------
/tools/commit-msg.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 | export PATH="/usr/local/bin:$PATH"
4 | node tools/validate-commit-msg.js $1
5 |
--------------------------------------------------------------------------------
/tests/fixtures/CT_cube_200px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/commercetools/commercetools-php-sdk/HEAD/tests/fixtures/CT_cube_200px.png
--------------------------------------------------------------------------------
/src/Core/Error/ForbiddenException.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Error;
7 |
8 | class DeprecatedException extends \Exception
9 | {
10 | }
11 |
--------------------------------------------------------------------------------
/src/Core/Request/OrderEdits/StagedOrder/Command/StagedOrderUpdateAction.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Error;
7 |
8 | class BadGatewayException extends ServerErrorException
9 | {
10 | }
11 |
--------------------------------------------------------------------------------
/src/Core/Error/UpdateActionLimitException.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Error;
7 |
8 | class UpdateActionLimitException extends \Exception
9 | {
10 | }
11 |
--------------------------------------------------------------------------------
/src/Core/Client/OAuth/AnonymousIdProvider.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/tools/build_phar.sh:
--------------------------------------------------------------------------------
1 | #!/usr/local/bin/bash
2 |
3 | tools/box compile
4 | gpg -u 8B4055F0ED004102F295C3BD01263CCEE8010A56 --yes --detach-sign --output commercetools-php-sdk.phar.asc commercetools-php-sdk.phar
5 | gpg --verify commercetools-php-sdk.phar.asc commercetools-php-sdk.phar
6 |
--------------------------------------------------------------------------------
/src/Core/Model/Product/Search/FilterInterface.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Product\Search;
7 |
8 | interface FilterInterface
9 | {
10 | public function __toString();
11 | }
12 |
--------------------------------------------------------------------------------
/tools/http-client.env.json:
--------------------------------------------------------------------------------
1 | {
2 | "developement": {
3 | "api_url": "https://api.europe-west1.gcp.commercetools.com",
4 | "auth_url": "https://auth.europe-west1.gcp.commercetools.com",
5 | "client_id": "",
6 | "client_secret": "",
7 | "project_key": ""
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Core/Client/OAuth/TokenProvider.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Client\OAuth;
7 |
8 | interface TokenProvider
9 | {
10 | /**
11 | * @return Token
12 | */
13 | public function getToken();
14 | }
15 |
--------------------------------------------------------------------------------
/install-apigen.sh.bat:
--------------------------------------------------------------------------------
1 | rem downloads the apigen distribution because installation via packagist turned out to be unreliable
2 | rem going via %TEMP% because bitsadmin wants and absolute path.
3 | bitsadmin /transfer apiGen /priority normal http://apigen.org/apigen.phar %TEMP%\apigen.phar
4 | move /Y %TEMP%\apigen.phar ./
5 |
--------------------------------------------------------------------------------
/src/Core/Request/Query/MultiParameter.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request\Query;
7 |
8 | class MultiParameter extends Parameter
9 | {
10 | public function getId()
11 | {
12 | return $this->__toString();
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Core/Response/ResourceResponse.php:
--------------------------------------------------------------------------------
1 |
4 | * @created: 28.01.15, 09:26
5 | */
6 |
7 | namespace Commercetools\Core\Response;
8 |
9 | /**
10 | * @package Commercetools\Core\Response
11 | */
12 | class ResourceResponse extends AbstractApiResponse
13 | {
14 | }
15 |
--------------------------------------------------------------------------------
/tests/myapp.yml.dist:
--------------------------------------------------------------------------------
1 | parameters:
2 | client_id: Your Composable Commerce client ID
3 | client_secret: Your Composable Commerce client secret
4 | project: Your Composable Commerce Project key
5 | oauth_url: https://auth.europe-west1.gcp.commercetools.com
6 | api_url: https://api.europe-west1.gcp.commercetools.com
7 | enableCorrelationId: 1
8 |
--------------------------------------------------------------------------------
/src/Core/Client/Adapter/ConfigAware.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Client\Adapter;
7 |
8 | interface ConfigAware
9 | {
10 | /**
11 | * @param string $option
12 | * @return mixed
13 | */
14 | public function getConfig($option);
15 | }
16 |
--------------------------------------------------------------------------------
/src/Core/Client/OAuth/RefreshTokenProvider.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Client\OAuth;
7 |
8 | interface RefreshTokenProvider extends TokenProvider
9 | {
10 | /**
11 | * @return Token
12 | */
13 | public function refreshToken();
14 | }
15 |
--------------------------------------------------------------------------------
/src/Core/Error/InvalidArgumentException.php:
--------------------------------------------------------------------------------
1 |
4 | * @created: 26.01.15, 15:42
5 | */
6 |
7 | namespace Commercetools\Core\Error;
8 |
9 | /**
10 | * @package Commercetools\Core\Error
11 | */
12 | class InvalidArgumentException extends \InvalidArgumentException
13 | {
14 | }
15 |
--------------------------------------------------------------------------------
/src/Core/Error/NotFoundException.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Error;
7 |
8 | /**
9 | * Exception for response with status code 404
10 | * @package Commercetools\Core\Error
11 | */
12 | class NotFoundException extends ClientErrorException
13 | {
14 | }
15 |
--------------------------------------------------------------------------------
/tests/integration/TestUtils.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\IntegrationTests;
7 |
8 | class TestUtils
9 | {
10 | public static function randomString()
11 | {
12 | return 'random-string-' . ((int)rand() * 100000) . '-'. time();
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Core/Error/ApiServiceException.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Error;
7 |
8 | /**
9 | * Base exception for all responses with status code 4xx or 5xx
10 | * @package Commercetools\Core\Error
11 | */
12 | class ApiServiceException extends ApiException
13 | {
14 | }
15 |
--------------------------------------------------------------------------------
/src/Core/Error/BadRequestException.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Error;
7 |
8 | /**
9 | * Base exception for all responses with status code 400
10 | * @package Commercetools\Core\Error
11 | */
12 | class BadRequestException extends ClientErrorException
13 | {
14 | }
15 |
--------------------------------------------------------------------------------
/src/Core/Error/ServerErrorException.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Error;
7 |
8 | /**
9 | * Base Exception for all responses with status code 5xx
10 | * @package Commercetools\Core\Error
11 | */
12 | class ServerErrorException extends ApiServiceException
13 | {
14 | }
15 |
--------------------------------------------------------------------------------
/src/Core/Error/UnauthorizedException.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Error;
7 |
8 | /**
9 | * Base class for responses with status code 401 || 403
10 | * @package Commercetools\Core\Error
11 | */
12 | class UnauthorizedException extends ClientErrorException
13 | {
14 | }
15 |
--------------------------------------------------------------------------------
/src/Core/Request/QueryAllRequestInterface.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request;
7 |
8 | interface QueryAllRequestInterface extends
9 | PageRequestInterface,
10 | QueryRequestInterface,
11 | SortRequestInterface,
12 | WithTotalRequestInterface
13 | {
14 | }
15 |
--------------------------------------------------------------------------------
/src/Core/Request/SortRequestInterface.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request;
7 |
8 | interface SortRequestInterface extends ClientRequestInterface
9 | {
10 | /**
11 | * @param $sort
12 | * @return $this
13 | */
14 | public function sort($sort);
15 | }
16 |
--------------------------------------------------------------------------------
/src/Core/Client/Adapter/TokenProviderAware.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Client\Adapter;
7 |
8 | use Commercetools\Core\Client\OAuth\TokenProvider;
9 |
10 | interface TokenProviderAware
11 | {
12 | public function setOAuthTokenProvider(TokenProvider $tokenProvider);
13 | }
14 |
--------------------------------------------------------------------------------
/src/Core/Error/InternalServerErrorException.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Error;
7 |
8 | /**
9 | * Exception for response with status code 500
10 | * @package Commercetools\Core\Error
11 | */
12 | class InternalServerErrorException extends ServerErrorException
13 | {
14 | }
15 |
--------------------------------------------------------------------------------
/src/Core/Client/Adapter/CorrelationIdAware.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Client\Adapter;
7 |
8 | use Commercetools\Core\Helper\CorrelationIdProvider;
9 |
10 | interface CorrelationIdAware
11 | {
12 | public function setCorrelationIdProvider(CorrelationIdProvider $provider);
13 | }
14 |
--------------------------------------------------------------------------------
/src/Core/Model/Common/TypeableInterface.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Common;
7 |
8 | interface TypeableInterface
9 | {
10 | public static function ofType($type, $context = null);
11 |
12 | public static function ofTypeAndData($type, array $data, $context = null);
13 | }
14 |
--------------------------------------------------------------------------------
/src/Core/Request/QueryRequestInterface.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request;
7 |
8 | interface QueryRequestInterface extends ClientRequestInterface
9 | {
10 | /**
11 | * @param string $where
12 | * @return $this
13 | */
14 | public function where($where);
15 | }
16 |
--------------------------------------------------------------------------------
/src/Core/Response/ApiPromiseGetInterface.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Helper;
7 |
8 | interface CorrelationIdProvider
9 | {
10 | /**
11 | * Returns a unique ID to be used for a CTP request
12 | * @return string
13 | */
14 | public function getCorrelationId();
15 | }
16 |
--------------------------------------------------------------------------------
/docroot/annotations.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core;
7 |
8 | use Commercetools\Core\Helper\Annotate\AnnotationGenerator;
9 |
10 | require __DIR__ . '/../vendor/autoload.php';
11 |
12 | $path = __DIR__ . '/../src/';
13 |
14 | $generator = new AnnotationGenerator();
15 | $generator->run($path);
16 |
--------------------------------------------------------------------------------
/src/Core/Request/InStores/InStoreTrait.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request;
7 |
8 | interface WithTotalRequestInterface extends ClientRequestInterface
9 | {
10 | /**
11 | * @param bool $withTotal
12 | * @return $this
13 | */
14 | public function withTotal($withTotal);
15 | }
16 |
--------------------------------------------------------------------------------
/src/Core/Helper/CurrencyFormatterInterface.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Helper;
7 |
8 | interface CurrencyFormatterInterface
9 | {
10 | /**
11 | * @param $centAmount
12 | * @param $currency
13 | * @return string
14 | */
15 | public function format($centAmount, $currency);
16 | }
17 |
--------------------------------------------------------------------------------
/src/Core/Request/Extensions/ExtensionsEndpoint.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Common;
7 |
8 | class EnumTest extends \PHPUnit\Framework\TestCase
9 | {
10 | public function testToString()
11 | {
12 | $this->assertSame('Test', (string)Enum::fromArray(['key' => 'test', 'label' => 'Test']));
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Core/Client/HttpMethod.php:
--------------------------------------------------------------------------------
1 |
4 | * @created: 23.01.15, 17:17
5 | */
6 |
7 | namespace Commercetools\Core\Client;
8 |
9 | /**
10 | * @package Commercetools\Core\Http
11 | */
12 | class HttpMethod
13 | {
14 | const GET = 'GET';
15 | const POST = 'POST';
16 | const DELETE = 'DELETE';
17 | const HEAD = 'HEAD';
18 | }
19 |
--------------------------------------------------------------------------------
/src/Core/Request/Query/ParameterInterface.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request\Query;
7 |
8 | interface ParameterInterface
9 | {
10 | /**
11 | * @return string
12 | */
13 | public function getId();
14 |
15 | /**
16 | * @return string
17 | */
18 | public function __toString();
19 | }
20 |
--------------------------------------------------------------------------------
/src/Core/Model/Common/PriceTierCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Error;
7 |
8 | /**
9 | * Exception for status code 401
10 | * @package Commercetools\Core\Error
11 | * @description
12 | * Typically happens when the oauth token is no more valid
13 | */
14 | class InvalidTokenException extends UnauthorizedException
15 | {
16 | }
17 |
--------------------------------------------------------------------------------
/src/Core/Model/Common/DateDecorator.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Common;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\Common
10 | */
11 | class DateDecorator extends DateTimeDecorator
12 | {
13 | public function jsonSerialize()
14 | {
15 | return $this->getDateTime()->format('Y-m-d');
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Core/Model/Common/TimeDecorator.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Common;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\Common
10 | */
11 | class TimeDecorator extends DateTimeDecorator
12 | {
13 | public function jsonSerialize()
14 | {
15 | return $this->getDateTime()->format('H:i:s');
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Core/Request/Me/MeEndpoint.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request\Me;
7 |
8 | use Commercetools\Core\Client\JsonEndpoint;
9 |
10 | class MeEndpoint
11 | {
12 | /**
13 | * @return JsonEndpoint
14 | */
15 | public static function endpoint()
16 | {
17 | return new JsonEndpoint('me');
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Core/Request/ProductSelections/ProductSelectionsEndpoint.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model;
7 |
8 | interface MapperInterface
9 | {
10 | /**
11 | * @param array $data
12 | * @param mixed $class class or object to map the data to
13 | * @return mixed Class instance or null
14 | */
15 | public function map(array $data, $class);
16 | }
17 |
--------------------------------------------------------------------------------
/src/Core/Error/ServiceUnavailableException.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Error;
7 |
8 | /**
9 | * Exception for response with status code 503
10 | * @package Commercetools\Core\Error
11 | * @description
12 | * Composable Commerce is currently not available
13 | */
14 | class ServiceUnavailableException extends ServerErrorException
15 | {
16 | }
17 |
--------------------------------------------------------------------------------
/src/Core/Model/OrderEdit/OrderEditNotProcessed.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request\Carts;
7 |
8 | use Commercetools\Core\Client\JsonEndpoint;
9 |
10 | class CartsEndpoint
11 | {
12 | /**
13 | * @return JsonEndpoint
14 | */
15 | public static function endpoint()
16 | {
17 | return new JsonEndpoint('carts');
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Core/Request/Me/MeCartsEndpoint.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request\Me;
7 |
8 | use Commercetools\Core\Client\JsonEndpoint;
9 |
10 | class MeCartsEndpoint
11 | {
12 | /**
13 | * @return JsonEndpoint
14 | */
15 | public static function endpoint()
16 | {
17 | return new JsonEndpoint('me/carts');
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Core/Request/Me/MeOrdersEndpoint.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request\Me;
7 |
8 | use Commercetools\Core\Client\JsonEndpoint;
9 |
10 | class MeOrdersEndpoint
11 | {
12 | /**
13 | * @return JsonEndpoint
14 | */
15 | public static function endpoint()
16 | {
17 | return new JsonEndpoint('me/orders');
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Core/Request/States/StatesEndpoint.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request\States;
7 |
8 | use Commercetools\Core\Client\JsonEndpoint;
9 |
10 | class StatesEndpoint
11 | {
12 | /**
13 | * @return JsonEndpoint
14 | */
15 | public static function endpoint()
16 | {
17 | return new JsonEndpoint('states');
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Core/Error/InvalidClientCredentialsException.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Error;
7 |
8 | /**
9 | * Exception for response with status code 401
10 | * @package Commercetools\Core\Error
11 | * @description
12 | * Typically wrong credentials or scope used
13 | */
14 | class InvalidClientCredentialsException extends UnauthorizedException
15 | {
16 | }
17 |
--------------------------------------------------------------------------------
/src/Core/Model/Cart/CartState.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Cart;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\Cart
10 | * @link https://docs.commercetools.com/http-api-projects-carts.html#cartstate
11 | */
12 | class CartState
13 | {
14 | const ACTIVE = 'Active';
15 | const MERGED = 'Merged';
16 | const ORDERED = 'Ordered';
17 | }
18 |
--------------------------------------------------------------------------------
/src/Core/Request/GraphQL/GraphQLEndpoint.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 |
7 | namespace Commercetools\Core\Request\GraphQL;
8 |
9 | use Commercetools\Core\Client\JsonEndpoint;
10 |
11 | class GraphQLEndpoint
12 | {
13 | /**
14 | * @return JsonEndpoint
15 | */
16 | public static function endpoint()
17 | {
18 | return new JsonEndpoint('graphql');
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Core/Request/Payments/PaymentsEndpoint.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request\Payments;
7 |
8 | use Commercetools\Core\Client\JsonEndpoint;
9 |
10 | class PaymentsEndpoint
11 | {
12 | /**
13 | * @return JsonEndpoint
14 | */
15 | public static function endpoint()
16 | {
17 | return new JsonEndpoint('payments');
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Core/Request/ProductSelections/ProductSelectionAssignmentsEndpoint.php:
--------------------------------------------------------------------------------
1 | import(__DIR__ . '/php_cs_fixer/php-cs-fixer-psr2.php');
11 | $containerConfigurator->import(__DIR__ . '/php_codesniffer/php-codesniffer-psr2.php');
12 | };
13 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | Feel free to open an issue for bigger effort changes and ask if you can help or get help with your idea. For typos and documentation improvements just make a pull request.
2 |
3 | Then:
4 |
5 | 1. fork the repository on GitHub
6 | 1. code and add tests that cover the created code. Your code should be warning-free.
7 | 1. stick to PSR-2 and and don't reformat existing code.
8 | 1. make a pull request. @jenschude will review it and pull or come back to you.
9 |
--------------------------------------------------------------------------------
/src/Core/Request/Me/MeShoppingListsEndpoint.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Common;
7 |
8 | interface ReferenceObjectInterface extends ContextAwareInterface
9 | {
10 | /**
11 | * @return string
12 | */
13 | public function getReferenceIdentifier();
14 |
15 | /**
16 | * @return Reference
17 | */
18 | public function getReference();
19 | }
20 |
--------------------------------------------------------------------------------
/src/Core/Model/State/StateRole.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 |
7 | namespace Commercetools\Core\Model\State;
8 |
9 | /**
10 | * @package Commercetools\Core\Model\State
11 | * @link https://docs.commercetools.com/http-api-projects-states.html#staterole
12 | */
13 | class StateRole
14 | {
15 | const REVIEW_INCLUDED_IN_STATISTICS = 'ReviewIncludedInStatistics';
16 | const ROLE_RETURN = 'Return';
17 | }
18 |
--------------------------------------------------------------------------------
/src/Core/Request/ApiClients/ApiClientsEndpoint.php:
--------------------------------------------------------------------------------
1 |
4 | * @created: 12.02.15, 15:58
5 | */
6 |
7 | namespace Commercetools\Core\Request\Customers;
8 |
9 | use Commercetools\Core\Client\JsonEndpoint;
10 |
11 | class LoginEndpoint
12 | {
13 | /**
14 | * @return JsonEndpoint
15 | */
16 | public static function endpoint()
17 | {
18 | return new JsonEndpoint('login');
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Core/Request/OrderEdits/OrderEditsEndpoint.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request\Subscriptions;
7 |
8 | use Commercetools\Core\Client\JsonEndpoint;
9 |
10 | class SubscriptionsEndpoint
11 | {
12 | /**
13 | * @return JsonEndpoint
14 | */
15 | public static function endpoint()
16 | {
17 | return new JsonEndpoint('subscriptions');
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/tools/test-requests.http:
--------------------------------------------------------------------------------
1 | ### Get auth token
2 | POST https://{{auth_url}}/oauth/token
3 | Authorization: Basic {{client_id}} {{client_secret}}
4 | Content-Type: application/x-www-form-urlencoded
5 |
6 | grant_type=client_credentials
7 |
8 | > {% client.global.set("auth_token", response.body.access_token); %}
9 |
10 | ### Authorization by token, part 2. Use token to authorize.
11 | GET https://{{api_url}}/{{project_key}}
12 | Authorization: Bearer {{auth_token}}
13 |
14 | ###
15 |
--------------------------------------------------------------------------------
/src/Core/Error/EnumValueIsUsedError.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Cart;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\Cart
10 | * @link https://docs.commercetools.com/http-api-projects-carts.html#inventorymode
11 | */
12 | class InventoryMode
13 | {
14 | const TRACK_ONLY = 'TrackOnly';
15 | const RESERVE_ON_ORDER = 'ReserveOnOrder';
16 | const NONE = 'None';
17 | }
18 |
--------------------------------------------------------------------------------
/src/Core/Error/LanguageUsedInStoresError.php:
--------------------------------------------------------------------------------
1 |
4 | * @created: 02.02.15, 17:57
5 | */
6 |
7 | namespace Commercetools\Core\Request\Products;
8 |
9 | use Commercetools\Core\Client\JsonEndpoint;
10 |
11 | class ProductsEndpoint
12 | {
13 | /**
14 | * @return JsonEndpoint
15 | */
16 | public static function endpoint()
17 | {
18 | return new JsonEndpoint('products');
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Core/Model/Extension/TriggerCollection.php:
--------------------------------------------------------------------------------
1 |
4 | * @created: 11.02.15, 14:17
5 | */
6 |
7 | namespace Commercetools\Core\Request\Customers;
8 |
9 | use Commercetools\Core\Client\JsonEndpoint;
10 |
11 | class CustomersEndpoint
12 | {
13 | /**
14 | * @return JsonEndpoint
15 | */
16 | public static function endpoint()
17 | {
18 | return new JsonEndpoint('customers');
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Core/Error/GatewayTimeoutException.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Error;
7 |
8 | /**
9 | * Exception for response for status code 504
10 | * @package Commercetools\Core\Error
11 | * @description
12 | * This error might occur on long running processes such as deletion of resources with connections to other resources.
13 | */
14 | class GatewayTimeoutException extends ServerErrorException
15 | {
16 | }
17 |
--------------------------------------------------------------------------------
/tests/fixtures/ManuelActivationStrategy.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Fixtures;
7 |
8 | use Monolog\Handler\FingersCrossed\ActivationStrategyInterface;
9 |
10 | class ManuelActivationStrategy implements ActivationStrategyInterface
11 | {
12 | /**
13 | * @inheritDoc
14 | */
15 | public function isHandlerActivated(array $record): bool
16 | {
17 | return false;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Core/Model/Common/AssetDraftCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Common;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\Common
10 | *
11 | * @method AssetDraftCollection add(AssetDraft $element)
12 | * @method AssetDraft current()
13 | * @method AssetDraft getAt($offset)
14 | */
15 | class AssetDraftCollection extends Collection
16 | {
17 | protected $type = AssetDraft::class;
18 | }
19 |
--------------------------------------------------------------------------------
/src/Core/Model/Order/OrderState.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Order;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\Order
10 | * @link https://docs.commercetools.com/http-api-projects-orders.html#orderstate
11 | */
12 | class OrderState
13 | {
14 | const OPEN = 'Open';
15 | const CONFIRMED = 'Confirmed';
16 | const COMPLETE = 'Complete';
17 | const CANCELLED = 'Cancelled';
18 | }
19 |
--------------------------------------------------------------------------------
/src/Core/Request/Types/TypesEndpoint.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request\Types;
7 |
8 | use Commercetools\Core\Client\JsonEndpoint;
9 |
10 | /**
11 | * @package Commercetools\Core\Request\Types
12 | */
13 | class TypesEndpoint
14 | {
15 | /**
16 | * @return JsonEndpoint
17 | */
18 | public static function endpoint()
19 | {
20 | return new JsonEndpoint('types');
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Core/Request/Zones/ZonesEndpoint.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request\Zones;
7 |
8 | use Commercetools\Core\Client\JsonEndpoint;
9 |
10 | /**
11 | * @package Commercetools\Core\Request\Zones
12 | */
13 | class ZonesEndpoint
14 | {
15 | /**
16 | * @return JsonEndpoint
17 | */
18 | public static function endpoint()
19 | {
20 | return new JsonEndpoint('zones');
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Core/Request/Orders/OrdersEndpoint.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request\Orders;
7 |
8 | use Commercetools\Core\Client\JsonEndpoint;
9 |
10 | /**
11 | * @package Commercetools\Core\Request\Orders
12 | */
13 | class OrdersEndpoint
14 | {
15 | /**
16 | * @return JsonEndpoint
17 | */
18 | public static function endpoint()
19 | {
20 | return new JsonEndpoint('orders');
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Core/Request/Products/ProductProjectionEndpoint.php:
--------------------------------------------------------------------------------
1 |
4 | * @created: 02.02.15, 17:20
5 | */
6 |
7 | namespace Commercetools\Core\Request\Products;
8 |
9 | use Commercetools\Core\Client\JsonEndpoint;
10 |
11 | class ProductProjectionEndpoint
12 | {
13 | /**
14 | * @return JsonEndpoint
15 | */
16 | public static function endpoint()
17 | {
18 | return new JsonEndpoint('product-projections');
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Core/Request/Reviews/ReviewsEndpoint.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request\Reviews;
7 |
8 | use Commercetools\Core\Client\JsonEndpoint;
9 |
10 | /**
11 | * @package Commercetools\Core\Request\Reviews
12 | */
13 | class ReviewsEndpoint
14 | {
15 | /**
16 | * @return JsonEndpoint
17 | */
18 | public static function endpoint()
19 | {
20 | return new JsonEndpoint('reviews');
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Core/Model/Common/GeoPoint.php:
--------------------------------------------------------------------------------
1 |
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 | }
20 |
--------------------------------------------------------------------------------
/src/Core/Model/Project/CartScoreType.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Project;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\Project
10 | * @link https://dev.commercetools.com/http-api-projects-project.html#cartscore
11 | * @method string getType()
12 | * @method CartScoreType setType(string $type = null)
13 | */
14 | class CartScoreType extends ShippingRateInputType
15 | {
16 | const INPUT_TYPE = 'CartScore';
17 | }
18 |
--------------------------------------------------------------------------------
/src/Core/Model/Project/CartValueType.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Project;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\Project
10 | * @link https://dev.commercetools.com/http-api-projects-project.html#cartvalue
11 | * @method string getType()
12 | * @method CartValueType setType(string $type = null)
13 | */
14 | class CartValueType extends ShippingRateInputType
15 | {
16 | const INPUT_TYPE = 'CartValue';
17 | }
18 |
--------------------------------------------------------------------------------
/src/Core/Request/Channels/ChannelsEndpoint.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request\Channels;
7 |
8 | use Commercetools\Core\Client\JsonEndpoint;
9 |
10 | /**
11 | * @package Commercetools\Core\Request\Channels
12 | */
13 | class ChannelsEndpoint
14 | {
15 | /**
16 | * @return JsonEndpoint
17 | */
18 | public static function endpoint()
19 | {
20 | return new JsonEndpoint('channels');
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Core/Request/Messages/MessagesEndpoint.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request\Messages;
7 |
8 | use Commercetools\Core\Client\JsonEndpoint;
9 |
10 | /**
11 | * @package Commercetools\Core\Request\Messages
12 | */
13 | class MessagesEndpoint
14 | {
15 | /**
16 | * @return JsonEndpoint
17 | */
18 | public static function endpoint()
19 | {
20 | return new JsonEndpoint('messages');
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Core/Error/AccessDeniedError.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Error;
7 |
8 | /**
9 | * @package Commercetools\Core\Error
10 | *
11 | * @method string getCode()
12 | * @method AccessDeniedError setCode(string $code = null)
13 | * @method string getMessage()
14 | * @method AccessDeniedError setMessage(string $message = null)
15 | */
16 | class AccessDeniedError extends ApiError
17 | {
18 | const CODE = 'access_denied';
19 | }
20 |
--------------------------------------------------------------------------------
/src/Core/Error/InvalidTokenError.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Error;
7 |
8 | /**
9 | * @package Commercetools\Core\Error
10 | *
11 | * @method string getCode()
12 | * @method InvalidTokenError setCode(string $code = null)
13 | * @method string getMessage()
14 | * @method InvalidTokenError setMessage(string $message = null)
15 | */
16 | class InvalidTokenError extends ApiError
17 | {
18 | const CODE = 'invalid_token';
19 | }
20 |
--------------------------------------------------------------------------------
/src/Core/Request/InStores/InStoreEndpoint.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request\Inventory;
7 |
8 | use Commercetools\Core\Client\JsonEndpoint;
9 |
10 | /**
11 | * @package Commercetools\Core\Request\Inventory
12 | */
13 | class InventoryEndpoint
14 | {
15 | /**
16 | * @return JsonEndpoint
17 | */
18 | public static function endpoint()
19 | {
20 | return new JsonEndpoint('inventory');
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Core/Model/Common/MoneyCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Common;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\Common
10 | * @link https://docs.commercetools.com/http-api-types.html#money
11 | * @method Money current()
12 | * @method MoneyCollection add(Money $element)
13 | * @method Money getAt($offset)
14 | */
15 | class MoneyCollection extends Collection
16 | {
17 | protected $type = Money::class;
18 | }
19 |
--------------------------------------------------------------------------------
/src/Core/Error/ClientErrorException.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Error;
7 |
8 | /**
9 | * Base exception for all responses with http status code 4xx
10 | * @package Commercetools\Core\Error
11 | */
12 | class ClientErrorException extends ApiServiceException
13 | {
14 | public function getErrorContainer()
15 | {
16 | $errors = parent::getErrors();
17 |
18 | return ErrorContainer::fromArray($errors);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Core/Error/InvalidSubjectError.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Error;
7 |
8 | /**
9 | * @package Commercetools\Core\Error
10 | *
11 | * @method string getCode()
12 | * @method InvalidSubjectError setCode(string $code = null)
13 | * @method string getMessage()
14 | * @method InvalidSubjectError setMessage(string $message = null)
15 | */
16 | class InvalidSubjectError extends ApiError
17 | {
18 | const CODE = 'InvalidSubject';
19 | }
20 |
--------------------------------------------------------------------------------
/src/Core/Model/Order/ReturnShipmentState.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Order;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\Order
10 | * @link https://docs.commercetools.com/http-api-projects-orders.html#returnshipmentstate
11 | */
12 | class ReturnShipmentState
13 | {
14 | const ADVISED = 'Advised';
15 | const RETURNED = 'Returned';
16 | const BACK_IN_STOCK = 'BackInStock';
17 | const UNUSABLE = 'Unusable';
18 | }
19 |
--------------------------------------------------------------------------------
/tools/extract_changelog.php:
--------------------------------------------------------------------------------
1 | 0) {
15 | $readBlocks--;
16 | continue;
17 | }
18 | break;
19 | }
20 | $changes[] = trim($line);
21 | }
22 |
23 | echo trim(implode(PHP_EOL, $changes)) . PHP_EOL;
24 |
--------------------------------------------------------------------------------
/src/Core/Model/ApiClient/ApiClientCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Common;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\Common
10 | * @link https://docs.commercetools.com/http-api-projects-products.html#images
11 | * @method Image current()
12 | * @method ImageCollection add(Image $element)
13 | * @method Image getAt($offset)
14 | */
15 | class ImageCollection extends Collection
16 | {
17 | protected $type = Image::class;
18 | }
19 |
--------------------------------------------------------------------------------
/src/Core/Model/Common/JsonDeserializeInterface.php:
--------------------------------------------------------------------------------
1 |
4 | * @created: 09.02.15, 10:45
5 | */
6 |
7 | namespace Commercetools\Core\Model\Common;
8 |
9 | interface JsonDeserializeInterface extends ContextAwareInterface
10 | {
11 | /**
12 | * @param array $data
13 | * @param Context|callable $context
14 | * @return mixed
15 | */
16 | public static function fromArray(array $data, $context = null);
17 |
18 | public function toArray();
19 | }
20 |
--------------------------------------------------------------------------------
/src/Core/Model/Order/PaymentState.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Order;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\Order
10 | * @link https://docs.commercetools.com/http-api-projects-orders.html#paymentstate
11 | */
12 | class PaymentState
13 | {
14 | const BALANCE_DUE = 'BalanceDue';
15 | const FAILED = 'Failed';
16 | const PENDING = 'Pending';
17 | const CREDIT_OWED = 'CreditOwed';
18 | const PAID = 'Paid';
19 | }
20 |
--------------------------------------------------------------------------------
/src/Core/Model/Order/ReturnPaymentState.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Order;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\Order
10 | * @link https://docs.commercetools.com/http-api-projects-orders.html#returnpaymentstate
11 | */
12 | class ReturnPaymentState
13 | {
14 | const NON_REFUNDABLE = 'NonRefundable';
15 | const INITIAL = 'Initial';
16 | const REFUNDED = 'Refunded';
17 | const NOT_REFUNDED = 'NotRefunded';
18 | }
19 |
--------------------------------------------------------------------------------
/src/Core/Request/PageRequestInterface.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request;
7 |
8 | interface PageRequestInterface extends ClientRequestInterface
9 | {
10 | const MAX_PAGE_SIZE = 500;
11 |
12 | /**
13 | * @param int $limit
14 | * @return $this
15 | */
16 | public function limit($limit);
17 |
18 | /**
19 | * @param int $offset
20 | * @return $this
21 | */
22 | public function offset($offset);
23 | }
24 |
--------------------------------------------------------------------------------
/src/Core/Error/InvalidOperationError.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Error;
7 |
8 | /**
9 | * @package Commercetools\Core\Error
10 | *
11 | * @method string getCode()
12 | * @method InvalidOperationError setCode(string $code = null)
13 | * @method string getMessage()
14 | * @method InvalidOperationError setMessage(string $message = null)
15 | */
16 | class InvalidOperationError extends ApiError
17 | {
18 | const CODE = 'InvalidOperation';
19 | }
20 |
--------------------------------------------------------------------------------
/src/Core/Error/ResourceNotFoundError.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Error;
7 |
8 | /**
9 | * @package Commercetools\Core\Error
10 | *
11 | * @method string getCode()
12 | * @method ResourceNotFoundError setCode(string $code = null)
13 | * @method string getMessage()
14 | * @method ResourceNotFoundError setMessage(string $message = null)
15 | */
16 | class ResourceNotFoundError extends ApiError
17 | {
18 | const CODE = 'ResourceNotFound';
19 | }
20 |
--------------------------------------------------------------------------------
/src/Core/Model/Extension/ExtensionCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request\ProductTypes;
7 |
8 | use Commercetools\Core\Client\JsonEndpoint;
9 |
10 | /**
11 | * @package Commercetools\Core\Request\ProductTypes
12 | */
13 | class ProductTypesEndpoint
14 | {
15 | /**
16 | * @return JsonEndpoint
17 | */
18 | public static function endpoint()
19 | {
20 | return new JsonEndpoint('product-types');
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Core/Error/InsufficientScopeError.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Error;
7 |
8 | /**
9 | * @package Commercetools\Core\Error
10 | *
11 | * @method string getCode()
12 | * @method InsufficientScopeError setCode(string $code = null)
13 | * @method string getMessage()
14 | * @method InsufficientScopeError setMessage(string $message = null)
15 | */
16 | class InsufficientScopeError extends ApiError
17 | {
18 | const CODE = 'insufficient_scope';
19 | }
20 |
--------------------------------------------------------------------------------
/src/Core/Model/Payment/TransactionState.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Payment;
7 |
8 | /**
9 | * Class TransactionState
10 | * @package Commercetools\Core\Model\Payment
11 | * @link https://docs.commercetools.com/http-api-projects-payments.html#transactionstate
12 | */
13 | class TransactionState
14 | {
15 | const INITIAL = "Initial";
16 | const PENDING = 'Pending';
17 | const SUCCESS = 'Success';
18 | const FAILURE = 'Failure';
19 | }
20 |
--------------------------------------------------------------------------------
/src/Core/Model/Product/FacetTermCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Product;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Product
12 | * @method FacetTerm current()
13 | * @method FacetTermCollection add(FacetTerm $element)
14 | * @method FacetTerm getAt($offset)
15 | */
16 | class FacetTermCollection extends Collection
17 | {
18 | protected $type = FacetTerm::class;
19 | }
20 |
--------------------------------------------------------------------------------
/src/Core/Request/CartDiscounts/CartDiscountsEndpoint.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request\CartDiscounts;
7 |
8 | use Commercetools\Core\Client\JsonEndpoint;
9 |
10 | /**
11 | * @package Commercetools\Core\Request\CartDiscounts
12 | */
13 | class CartDiscountsEndpoint
14 | {
15 | /**
16 | * @return JsonEndpoint
17 | */
18 | public static function endpoint()
19 | {
20 | return new JsonEndpoint('cart-discounts');
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Core/Request/CustomObjects/CustomObjectsEndpoint.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request\CustomObjects;
7 |
8 | use Commercetools\Core\Client\JsonEndpoint;
9 |
10 | /**
11 | * @package Commercetools\Core\Request\CustomObjects
12 | */
13 | class CustomObjectsEndpoint
14 | {
15 | /**
16 | * @return JsonEndpoint
17 | */
18 | public static function endpoint()
19 | {
20 | return new JsonEndpoint('custom-objects');
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Core/Request/DiscountCodes/DiscountCodesEndpoint.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request\DiscountCodes;
7 |
8 | use Commercetools\Core\Client\JsonEndpoint;
9 |
10 | /**
11 | * @package Commercetools\Core\Request\DiscountCodes
12 | */
13 | class DiscountCodesEndpoint
14 | {
15 | /**
16 | * @return JsonEndpoint
17 | */
18 | public static function endpoint()
19 | {
20 | return new JsonEndpoint('discount-codes');
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Core/Request/ShoppingLists/ShoppingListsEndpoint.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request\ShoppingLists;
7 |
8 | use Commercetools\Core\Client\JsonEndpoint;
9 |
10 | /**
11 | * @package Commercetools\Core\Request\ShoppingLists
12 | */
13 | class ShoppingListsEndpoint
14 | {
15 | /**
16 | * @return JsonEndpoint
17 | */
18 | public static function endpoint()
19 | {
20 | return new JsonEndpoint('shopping-lists');
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Core/Request/TaxCategories/TaxCategoriesEndpoint.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request\TaxCategories;
7 |
8 | use Commercetools\Core\Client\JsonEndpoint;
9 |
10 | /**
11 | * @package Commercetools\Core\Request\TaxCategories
12 | */
13 | class TaxCategoriesEndpoint
14 | {
15 | /**
16 | * @return JsonEndpoint
17 | */
18 | public static function endpoint()
19 | {
20 | return new JsonEndpoint('tax-categories');
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/tests/unit/Request/Project/ProjectGetRequestTest.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request\Project;
7 |
8 | use Commercetools\Core\Model\Project\Project;
9 | use Commercetools\Core\RequestTestCase;
10 |
11 | class ProjectGetRequestTest extends RequestTestCase
12 | {
13 | public function testMapResult()
14 | {
15 | $result = $this->mapResult(ProjectGetRequest::of());
16 | $this->assertInstanceOf(Project::class, $result);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Core/Error/InvalidCredentialsError.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Error;
7 |
8 | /**
9 | * @package Commercetools\Core\Error
10 | *
11 | * @method string getCode()
12 | * @method InvalidCredentialsError setCode(string $code = null)
13 | * @method string getMessage()
14 | * @method InvalidCredentialsError setMessage(string $message = null)
15 | */
16 | class InvalidCredentialsError extends ApiError
17 | {
18 | const CODE = 'InvalidCredentials';
19 | }
20 |
--------------------------------------------------------------------------------
/src/Core/Error/NoMatchingProductDiscountFoundError.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Product;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Product
12 | * @method FacetRange current()
13 | * @method FacetRangeCollection add(FacetRange $element)
14 | * @method FacetRange getAt($offset)
15 | */
16 | class FacetRangeCollection extends Collection
17 | {
18 | protected $type = FacetRange::class;
19 | }
20 |
--------------------------------------------------------------------------------
/src/Core/Request/CustomerGroups/CustomerGroupsEndpoint.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request\CustomerGroups;
7 |
8 | use Commercetools\Core\Client\JsonEndpoint;
9 |
10 | /**
11 | * @package Commercetools\Core\Request\CustomerGroups
12 | */
13 | class CustomerGroupsEndpoint
14 | {
15 | /**
16 | * @return JsonEndpoint
17 | */
18 | public static function endpoint()
19 | {
20 | return new JsonEndpoint('customer-groups');
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Core/Model/Cart/ItemShippingTargetCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Product;
7 |
8 | class RangeTestObject
9 | {
10 | protected $value;
11 | protected $quotes;
12 |
13 | public function __construct($value, $quotes = '')
14 | {
15 | $this->value = $value;
16 | $this->quotes = $quotes;
17 | }
18 |
19 | public function __toString()
20 | {
21 | return $this->quotes . $this->value . $this->quotes;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/Core/Request/Categories/CategoriesEndpoint.php:
--------------------------------------------------------------------------------
1 |
4 | * @created: 23.01.15, 16:25
5 | */
6 |
7 | namespace Commercetools\Core\Request\Categories;
8 |
9 | use Commercetools\Core\Client\JsonEndpoint;
10 |
11 | /**
12 | * @package Commercetools\Core\Request\Categories
13 | */
14 | class CategoriesEndpoint
15 | {
16 | /**
17 | * @return JsonEndpoint
18 | */
19 | public static function endpoint()
20 | {
21 | return new JsonEndpoint('categories');
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/Core/Request/ShippingMethods/ShippingMethodsEndpoint.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request\ShippingMethods;
7 |
8 | use Commercetools\Core\Client\JsonEndpoint;
9 |
10 | /**
11 | * @package Commercetools\Core\Request\ShippingMethods
12 | */
13 | class ShippingMethodsEndpoint
14 | {
15 | /**
16 | * @return JsonEndpoint
17 | */
18 | public static function endpoint()
19 | {
20 | return new JsonEndpoint('shipping-methods');
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Core/Client/OAuth/PreAuthTokenProvider.php:
--------------------------------------------------------------------------------
1 | token = $token;
18 | }
19 |
20 | /**
21 | * @return Token
22 | */
23 | public function getToken()
24 | {
25 | return new Token($this->token);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Core/Model/Store/StoreCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request\ProductDiscounts;
7 |
8 | use Commercetools\Core\Client\JsonEndpoint;
9 |
10 | /**
11 | * @package Commercetools\Core\Request\ProductDiscounts
12 | */
13 | class ProductDiscountsEndpoint
14 | {
15 | /**
16 | * @return JsonEndpoint
17 | */
18 | public static function endpoint()
19 | {
20 | return new JsonEndpoint('product-discounts');
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Core/Error/InvalidCurrentPasswordError.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Error;
7 |
8 | /**
9 | * @package Commercetools\Core\Error
10 | *
11 | * @method string getCode()
12 | * @method InvalidCurrentPasswordError setCode(string $code = null)
13 | * @method string getMessage()
14 | * @method InvalidCurrentPasswordError setMessage(string $message = null)
15 | */
16 | class InvalidCurrentPasswordError extends ApiError
17 | {
18 | const CODE = 'InvalidCurrentPassword';
19 | }
20 |
--------------------------------------------------------------------------------
/src/Core/Model/Order/ShipmentState.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Order;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\Order
10 | * @link https://docs.commercetools.com/http-api-projects-orders.html#shipmentstate
11 | */
12 | class ShipmentState
13 | {
14 | const SHIPPED = 'Shipped';
15 | const READY = 'Ready';
16 | const PENDING = 'Pending';
17 | const PARTIAL = 'Partial';
18 | const BACKORDER = 'Backorder';
19 | const DELAYED = 'Delayed';
20 | }
21 |
--------------------------------------------------------------------------------
/src/Core/Client/FileUploadRequest.php:
--------------------------------------------------------------------------------
1 |
4 | * @created: 23.01.15, 16:07
5 | */
6 |
7 | namespace Commercetools\Core\Client;
8 |
9 | use Psr\Http\Message\UploadedFileInterface;
10 |
11 | /**
12 | * @package Commercetools\Core\Http
13 | * @internal
14 | */
15 | class FileUploadRequest extends HttpRequest
16 | {
17 | public function __construct($path, UploadedFileInterface $file)
18 | {
19 | parent::__construct('POST', $path, $file->getStream(), $file->getClientMediaType());
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Core/Client/JsonRequest.php:
--------------------------------------------------------------------------------
1 |
4 | * @created: 23.01.15, 16:09
5 | */
6 |
7 | namespace Commercetools\Core\Client;
8 |
9 | /**
10 | * @package Commercetools\Core\Http
11 | * @internal
12 | */
13 | class JsonRequest extends HttpRequest
14 | {
15 | public function __construct($method, $path, $body)
16 | {
17 | if (!is_string($body)) {
18 | $body = json_encode($body);
19 | }
20 | parent::__construct($method, $path, $body, 'application/json');
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Core/Model/Common/PriceDraftCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Common;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\Common
10 | * @link https://docs.commercetools.com/http-api-projects-products.html#pricedraft
11 | * @method PriceDraftCollection add(PriceDraft $element)
12 | * @method PriceDraft current()
13 | * @method PriceDraft getAt($offset)
14 | */
15 | class PriceDraftCollection extends Collection
16 | {
17 | protected $type = PriceDraft::class;
18 | }
19 |
--------------------------------------------------------------------------------
/src/Core/Model/Common/TaxPortionCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Common;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\Common
10 | * @link https://docs.commercetools.com/http-api-projects-carts.html#taxportion
11 | * @method TaxPortion current()
12 | * @method TaxPortionCollection add(TaxPortion $element)
13 | * @method TaxPortion getAt($offset)
14 | */
15 | class TaxPortionCollection extends Collection
16 | {
17 | protected $type = TaxPortion::class;
18 | }
19 |
--------------------------------------------------------------------------------
/src/Core/Model/Cart/CartDiscountCodeState.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Cart;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\Cart
10 | * @link https://docs.commercetools.com/http-api-projects-carts.html#discountcodestate
11 | */
12 | class CartDiscountCodeState
13 | {
14 | const NOT_ACTIVE = 'NotActive';
15 | const DOES_NOT_MATCH_CART = 'DoesNotMatchCart';
16 | const MATCHES_CART = 'MatchesCart';
17 | const MAX_APPLICATION_REACHED = 'MaxApplicationReached';
18 | }
19 |
--------------------------------------------------------------------------------
/src/Core/Request/AbstractAction.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request;
7 |
8 | use Commercetools\Core\Model\Common\JsonObject;
9 |
10 | /**
11 | * @package Commercetools\Core\Request
12 | * @method string getAction()
13 | * @method $this setAction(string $action)
14 | */
15 | abstract class AbstractAction extends JsonObject
16 | {
17 | public function fieldDefinitions()
18 | {
19 | return [
20 | 'action' => [static::TYPE => 'string']
21 | ];
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/Core/Request/Query/OrderedMultiParameter.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request\Query;
7 |
8 | class OrderedMultiParameter extends Parameter
9 | {
10 | private $position;
11 |
12 | public function __construct($key, $value = null, $position = 0)
13 | {
14 | $this->position = $position;
15 | parent::__construct($key, $value);
16 | }
17 |
18 | public function getId()
19 | {
20 | return sprintf("%s-%010d", $this->key, $this->position);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/tests/unit/Helper/CurrencyFormatterTest.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Helper;
7 |
8 | use Commercetools\Core\Model\Common\Context;
9 |
10 | class CurrencyFormatterTest extends \PHPUnit\Framework\TestCase
11 | {
12 | public function testDefaultFormatter()
13 | {
14 | $context = new Context();
15 | $context->setLocale('en_US');
16 | $formatter = new CurrencyFormatter($context);
17 |
18 | $this->assertSame('$1.00', $formatter->format(100, 'USD'));
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Core/Model/ShoppingList/LineItemDraftCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\ShoppingList;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\ShoppingList
12 | *
13 | * @method LineItemDraftCollection add(LineItemDraft $element)
14 | * @method LineItemDraft current()
15 | * @method LineItemDraft getAt($offset)
16 | */
17 | class LineItemDraftCollection extends Collection
18 | {
19 | protected $type = LineItemDraft::class;
20 | }
21 |
--------------------------------------------------------------------------------
/ecs.php:
--------------------------------------------------------------------------------
1 | import(__DIR__ . '/tools/psr2.php');
10 |
11 | $parameters = $containerConfigurator->parameters();
12 | $parameters->set(Option::PATHS, [
13 | __DIR__ . '/src',
14 | ]);
15 | $parameters->set(Option::SKIP, [
16 | __DIR__ . 'src/Core/Builder'
17 | ]);
18 | };
19 |
--------------------------------------------------------------------------------
/src/Core/Model/Channel/ChannelRole.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Channel;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\Channel
10 | * @link https://docs.commercetools.com/http-api-projects-channels.html#channelroleenum
11 | */
12 | class ChannelRole
13 | {
14 | const INVENTORY_SUPPLY = 'InventorySupply';
15 | const ORDER_EXPORT = 'OrderExport';
16 | const ORDER_IMPORT = 'OrderImport';
17 | const PRIMARY = 'Primary';
18 | const PRODUCT_DISTRIBUTION = 'ProductDistribution';
19 | }
20 |
--------------------------------------------------------------------------------
/src/Core/Model/Common/ReferenceCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Common;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\Common
10 | * @link https://docs.commercetools.com/http-api-types.html#reference
11 | * @method Reference current()
12 | * @method ReferenceCollection add(Reference $element)
13 | * @method Reference getAt($offset)
14 | * @method Reference getById($offset)
15 | */
16 | class ReferenceCollection extends Collection
17 | {
18 | protected $type = Reference::class;
19 | }
20 |
--------------------------------------------------------------------------------
/src/Core/Model/ShoppingList/LineItemCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\ShoppingList;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\ShoppingList
12 | *
13 | * @method LineItemCollection add(LineItem $element)
14 | * @method LineItem current()
15 | * @method LineItem getAt($offset)
16 | * @method LineItem getById($offset)
17 | */
18 | class LineItemCollection extends Collection
19 | {
20 | protected $type = LineItem::class;
21 | }
22 |
--------------------------------------------------------------------------------
/src/Core/Model/Type/NumberType.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Type;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\Type
10 | * @link https://docs.commercetools.com/http-api-projects-types.html#numbertype
11 | * @method string getName()
12 | * @method NumberType setName(string $name = null)
13 | */
14 | class NumberType extends FieldType
15 | {
16 | const NAME = 'Number';
17 |
18 | public function fieldTypeDefinition()
19 | {
20 | return [static::TYPE => 'float'];
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/tests/unit/Helper/AnnotationGeneratorTest.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Helper;
7 |
8 | use Commercetools\Core\Helper\Annotate\AnnotationGenerator;
9 | use PHPUnit\Framework\TestCase;
10 |
11 | class AnnotationGeneratorTest extends TestCase
12 | {
13 | /**
14 | * @doesNotPerformAssertions
15 | */
16 | public function testGenerate()
17 | {
18 | $path = __DIR__ . '/../../../src/';
19 | $generator = new AnnotationGenerator();
20 | $generator->run($path);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Core/Model/Type/BooleanType.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Type;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\Type
10 | * @link https://docs.commercetools.com/http-api-projects-types.html#booleantype
11 | * @method string getName()
12 | * @method BooleanType setName(string $name = null)
13 | */
14 | class BooleanType extends FieldType
15 | {
16 | const NAME = 'Boolean';
17 |
18 | public function fieldTypeDefinition()
19 | {
20 | return [static::TYPE => 'bool'];
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/tests/fixtures/Profiler.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Error;
7 |
8 | /**
9 | * @package Commercetools\Core\Error
10 | *
11 | * @method string getCode()
12 | * @method ShippingMethodDoesNotMatchCartError setCode(string $code = null)
13 | * @method string getMessage()
14 | * @method ShippingMethodDoesNotMatchCartError setMessage(string $message = null)
15 | */
16 | class ShippingMethodDoesNotMatchCartError extends ApiError
17 | {
18 | const CODE = 'ShippingMethodDoesNotMatchCart';
19 | }
20 |
--------------------------------------------------------------------------------
/src/Core/Model/Message/StateTransitionMessage.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Message;
7 |
8 | use Commercetools\Core\Model\State\StateReference;
9 |
10 | abstract class StateTransitionMessage extends Message
11 | {
12 | public function fieldDefinitions()
13 | {
14 | $definitions = parent::fieldDefinitions();
15 | $definitions['state'] = [static::TYPE => StateReference::class];
16 | $definitions['force'] = [static::TYPE => 'bool'];
17 |
18 | return $definitions;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Core/Model/Zone/LocationCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Zone;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Zone
12 | * @link https://docs.commercetools.com/http-api-projects-zones.html#location
13 | * @method Location current()
14 | * @method LocationCollection add(Location $element)
15 | * @method Location getAt($offset)
16 | */
17 | class LocationCollection extends Collection
18 | {
19 | protected $type = Location::class;
20 | }
21 |
--------------------------------------------------------------------------------
/src/Core/Model/Cart/CartCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Cart;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Cart
12 | * @link https://docs.commercetools.com/http-api-projects-carts.html#cart
13 | * @method Cart current()
14 | * @method CartCollection add(Cart $element)
15 | * @method Cart getAt($offset)
16 | * @method Cart getById($offset)
17 | */
18 | class CartCollection extends Collection
19 | {
20 | protected $type = Cart::class;
21 | }
22 |
--------------------------------------------------------------------------------
/src/Core/Model/CartDiscount/ShippingCostTarget.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\CartDiscount;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\CartDiscount
10 | * @ramlTestIgnoreFields('predicate')
11 | * @method string getType()
12 | * @method ShippingCostTarget setType(string $type = null)
13 | * @method string getPredicate()
14 | * @method ShippingCostTarget setPredicate(string $predicate = null)
15 | */
16 | class ShippingCostTarget extends CartDiscountTarget
17 | {
18 | const TARGET_TYPE = 'shipping';
19 | }
20 |
--------------------------------------------------------------------------------
/src/Core/Model/Order/SyncInfoCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Order;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Order
12 | * @link https://docs.commercetools.com/http-api-projects-orders.html#syncinfo
13 | * @method SyncInfo current()
14 | * @method SyncInfoCollection add(SyncInfo $element)
15 | * @method SyncInfo getAt($offset)
16 | */
17 | class SyncInfoCollection extends Collection
18 | {
19 | protected $type = SyncInfo::class;
20 | }
21 |
--------------------------------------------------------------------------------
/src/Core/Model/Zone/ZoneCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Zone;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Zone
12 | * @link https://docs.commercetools.com/http-api-projects-zones.html#zone
13 | * @method Zone current()
14 | * @method ZoneCollection add(Zone $element)
15 | * @method Zone getAt($offset)
16 | * @method Zone getById($offset)
17 | */
18 | class ZoneCollection extends Collection
19 | {
20 | protected $type = Zone::class;
21 | }
22 |
--------------------------------------------------------------------------------
/renovate.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "config:base",
4 | ":pinOnlyDevDependencies",
5 | ":enableVulnerabilityAlerts",
6 | "schedule:weekly"
7 | ],
8 | "separateMajorMinor": true,
9 | "packageRules": [
10 | {
11 | "packagePatterns": [
12 | "*"
13 | ],
14 | "updateTypes": ["minor", "patch"],
15 | "groupName": "all dependencies",
16 | "groupSlug": "all"
17 | }
18 | ],
19 | "lockFileMaintenance": {
20 | "enabled": true
21 | },
22 | "labels": [
23 | "Type: Maintenance"
24 | ],
25 | "ignoreDeps": ["symplify/easy-coding-standard-prefixed"]
26 | }
27 |
--------------------------------------------------------------------------------
/src/Core/Error/QueryTimedOutError.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Order;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Order
12 | * @link https://docs.commercetools.com/http-api-projects-orders.html#itemstate
13 | * @method ItemState current()
14 | * @method ItemStateCollection add(ItemState $element)
15 | * @method ItemState getAt($offset)
16 | */
17 | class ItemStateCollection extends Collection
18 | {
19 | protected $type = ItemState::class;
20 | }
21 |
--------------------------------------------------------------------------------
/src/Core/Model/ShoppingList/TextLineItemDraftCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\ShoppingList;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\ShoppingList
12 | *
13 | * @method TextLineItemDraftCollection add(TextLineItemDraft $element)
14 | * @method TextLineItemDraft current()
15 | * @method TextLineItemDraft getAt($offset)
16 | */
17 | class TextLineItemDraftCollection extends Collection
18 | {
19 | protected $type = TextLineItemDraft::class;
20 | }
21 |
--------------------------------------------------------------------------------
/src/Core/Request/OrderEdits/StagedOrder/Command/StagedOrderSetLocaleAction.php:
--------------------------------------------------------------------------------
1 |
4 | * @created: 29.01.15, 11:57
5 | */
6 |
7 | namespace Commercetools\Core\Client;
8 |
9 | class JsonEndpointTest extends \PHPUnit\Framework\TestCase
10 | {
11 | public function testEndpoint()
12 | {
13 | $endpoint = new JsonEndpoint('test');
14 | $this->assertSame('test', $endpoint->endpoint());
15 | }
16 |
17 | public function testToString()
18 | {
19 | $endpoint = new JsonEndpoint('test');
20 | $this->assertSame('test', (string)$endpoint);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/tests/unit/Model/ProductType/ProductTypeDraftTest.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\ProductType;
7 |
8 | class ProductTypeDraftTest extends \PHPUnit\Framework\TestCase
9 | {
10 | public function testFromArray()
11 | {
12 | $this->assertInstanceOf(
13 | ProductTypeDraft::class,
14 | ProductTypeDraft::fromArray(
15 | [
16 | 'name' => 'test',
17 | 'description' => 'Test'
18 | ]
19 | )
20 | );
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Core/Client/OAuth/TokenStorage.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Order;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Order
12 | * @link https://docs.commercetools.com/http-api-projects-orders.html#order
13 | * @method Order current()
14 | * @method OrderCollection add(Order $element)
15 | * @method Order getAt($offset)
16 | * @method Order getById($offset)
17 | */
18 | class OrderCollection extends Collection
19 | {
20 | protected $type = Order::class;
21 | }
22 |
--------------------------------------------------------------------------------
/src/Core/Model/Order/ReturnInfoCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Order;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Order
12 | * @link https://docs.commercetools.com/http-api-projects-orders.html#returninfo
13 | * @method ReturnInfo current()
14 | * @method ReturnInfoCollection add(ReturnInfo $element)
15 | * @method ReturnInfo getAt($offset)
16 | */
17 | class ReturnInfoCollection extends Collection
18 | {
19 | protected $type = ReturnInfo::class;
20 | }
21 |
--------------------------------------------------------------------------------
/src/Core/Model/ProductType/StringType.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\ProductType;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\ProductType
10 | * @link https://docs.commercetools.com/http-api-projects-productTypes.html#texttype
11 | * @method string getName()
12 | * @method StringType setName(string $name = null)
13 | */
14 | class StringType extends AttributeType
15 | {
16 | const NAME = 'text';
17 |
18 | public function fieldTypeDefinition()
19 | {
20 | return [static::TYPE => 'string'];
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Core/Model/Subscription/ChangeSubscriptionCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Subscription;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Subscription
12 | *
13 | * @method ChangeSubscriptionCollection add(ChangeSubscription $element)
14 | * @method ChangeSubscription current()
15 | * @method ChangeSubscription getAt($offset)
16 | */
17 | class ChangeSubscriptionCollection extends Collection
18 | {
19 | protected $type = ChangeSubscription::class;
20 | }
21 |
--------------------------------------------------------------------------------
/src/Core/Model/TaxCategory/SubRateCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\TaxCategory;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\TaxCategory
12 | * @link https://docs.commercetools.com/http-api-projects-taxCategories.html#subrate
13 | * @method SubRateCollection add(SubRate $element)
14 | * @method SubRate current()
15 | * @method SubRate getAt($offset)
16 | */
17 | class SubRateCollection extends Collection
18 | {
19 | protected $type = SubRate::class;
20 | }
21 |
--------------------------------------------------------------------------------
/src/Core/Client/HttpRequest.php:
--------------------------------------------------------------------------------
1 |
4 | * @created: 23.01.15, 16:02
5 | */
6 |
7 | namespace Commercetools\Core\Client;
8 |
9 | use GuzzleHttp\Psr7\Request;
10 |
11 | /**
12 | * @package Commercetools\Core\Http
13 | * @internal
14 | */
15 | class HttpRequest extends Request
16 | {
17 | public function __construct($method, $path, $body = null, $contentType = 'application/json')
18 | {
19 | $headers = [
20 | "Content-Type" => $contentType
21 | ];
22 | parent::__construct($method, $path, $headers, $body);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Core/Model/Common/ContainerAndKey.php:
--------------------------------------------------------------------------------
1 | [self::TYPE => 'string'],
19 | 'key' => [self::TYPE => 'string'],
20 | ];
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Core/Model/ProductType/NumberType.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\ProductType;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\ProductType
10 | * @link https://docs.commercetools.com/http-api-projects-productTypes.html#numbertype
11 | * @method string getName()
12 | * @method NumberType setName(string $name = null)
13 | */
14 | class NumberType extends AttributeType
15 | {
16 | const NAME = 'number';
17 |
18 | public function fieldTypeDefinition()
19 | {
20 | return [static::TYPE => 'float'];
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Core/Model/ShoppingList/TextLineItemCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\ShoppingList;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\ShoppingList
12 | *
13 | * @method TextLineItemCollection add(TextLineItem $element)
14 | * @method TextLineItem current()
15 | * @method TextLineItem getAt($offset)
16 | * @method TextLineItem getById($offset)
17 | */
18 | class TextLineItemCollection extends Collection
19 | {
20 | protected $type = TextLineItem::class;
21 | }
22 |
--------------------------------------------------------------------------------
/src/Core/Model/Subscription/MessageSubscriptionCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Subscription;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Subscription
12 | *
13 | * @method MessageSubscriptionCollection add(MessageSubscription $element)
14 | * @method MessageSubscription current()
15 | * @method MessageSubscription getAt($offset)
16 | */
17 | class MessageSubscriptionCollection extends Collection
18 | {
19 | protected $type = MessageSubscription::class;
20 | }
21 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .vagrant
2 | .idea
3 | /vendor
4 | /cache
5 | /build/*
6 | !/build/theme
7 | !/build/apigen.neon
8 | cache.properties
9 | apigen.phar
10 | composer.phar
11 | composer.lock
12 | myapp.yml
13 | myapp.ini
14 | /local/
15 | /tools/node_modules
16 | requests.log
17 | env.list
18 | humbug.*
19 | cache/commercetools_io_access_token*
20 | src/cache/
21 | github_deploy_key
22 | node_modules
23 | docroot/cache/
24 | docroot/requests.log
25 | tests/integration/requests.log
26 | tests/fixtures/NotificationExtension.php
27 | tools/http-client.private.env.json
28 | yarn.lock
29 | .phpunit.result.cache
30 | tests/cache/commercetools_io_access_token*
31 |
--------------------------------------------------------------------------------
/src/Core/Client/Adapter/AdapterPromiseInterface.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Client\Adapter;
7 |
8 | use Psr\Http\Message\ResponseInterface;
9 |
10 | interface AdapterPromiseInterface extends ResponseInterface
11 | {
12 | /**
13 | * @param callable $onFulfilled
14 | * @param callable $onRejected
15 | * @return AdapterPromiseInterface
16 | */
17 | public function then(callable $onFulfilled = null, callable $onRejected = null);
18 |
19 | /**
20 | * @return mixed
21 | */
22 | public function wait();
23 | }
24 |
--------------------------------------------------------------------------------
/src/Core/Model/ProductType/BooleanType.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\ProductType;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\ProductType
10 | * @link https://docs.commercetools.com/http-api-projects-productTypes.html#booleantype
11 | * @method string getName()
12 | * @method BooleanType setName(string $name = null)
13 | */
14 | class BooleanType extends AttributeType
15 | {
16 | const NAME = 'boolean';
17 |
18 | public function fieldTypeDefinition()
19 | {
20 | return [static::TYPE => 'bool'];
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Core/Model/Review/ReviewCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Review;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Review
12 | * @link https://docs.commercetools.com/http-api-projects-reviews.html#review
13 | * @method Review current()
14 | * @method ReviewCollection add(Review $element)
15 | * @method Review getAt($offset)
16 | * @method Review getById($offset)
17 | */
18 | class ReviewCollection extends Collection
19 | {
20 | protected $type = Review::class;
21 | }
22 |
--------------------------------------------------------------------------------
/src/Core/Model/ShippingMethod/ShippingRateCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\ShippingMethod;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\ShippingMethod
10 | * @link https://docs.commercetools.com/http-api-projects-shippingMethods.html#shippingrate
11 | * @method ShippingRate current()
12 | * @method ShippingRateCollection add(ShippingRate $element)
13 | * @method ShippingRate getAt($offset)
14 | */
15 | class ShippingRateCollection extends ShippingRateDraftCollection
16 | {
17 | protected $type = ShippingRate::class;
18 | }
19 |
--------------------------------------------------------------------------------
/src/Core/Model/Common/AssetDimension.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Common;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\Common
10 | * @method int getW()
11 | * @method AssetDimension setW(int $w = null)
12 | * @method int getH()
13 | * @method AssetDimension setH(int $h = null)
14 | */
15 | class AssetDimension extends JsonObject
16 | {
17 | public function fieldDefinitions()
18 | {
19 | return [
20 | 'w' => [static::TYPE => 'int'],
21 | 'h' => [static::TYPE => 'int'],
22 | ];
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Core/Builder/Request/GraphQLRequestBuilder.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Cart;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Cart
12 | * @link https://docs.commercetools.com/http-api-projects-carts.html#lineitem
13 | * @method LineItem current()
14 | * @method LineItemCollection add(LineItem $element)
15 | * @method LineItem getAt($offset)
16 | * @method LineItem getById($offset)
17 | */
18 | class LineItemCollection extends Collection
19 | {
20 | protected $type = LineItem::class;
21 | }
22 |
--------------------------------------------------------------------------------
/src/Core/Model/Cart/LineItemDraftCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Cart;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Cart
12 | * @link https://docs.commercetools.com/http-api-projects-carts.html#lineitemdraft
13 | * @method LineItemDraft current()
14 | * @method LineItemDraftCollection add(LineItemDraft $element)
15 | * @method LineItemDraft getAt($offset)
16 | */
17 | class LineItemDraftCollection extends Collection
18 | {
19 | protected $type = LineItemDraft::class;
20 | }
21 |
--------------------------------------------------------------------------------
/src/Core/Model/Product/SuggestionCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Product;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Product
12 | * @link https://docs.commercetools.com/http-api-projects-products-search.html#representations
13 | * @method Suggestion current()
14 | * @method SuggestionCollection add(Suggestion $element)
15 | * @method Suggestion getAt($offset)
16 | */
17 | class SuggestionCollection extends Collection
18 | {
19 | protected $type = Suggestion::class;
20 | }
21 |
--------------------------------------------------------------------------------
/src/Core/Model/Channel/ChannelCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Channel;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Channel
12 | * @link https://docs.commercetools.com/http-api-projects-channels.html#channel
13 | * @method Channel current()
14 | * @method ChannelCollection add(Channel $element)
15 | * @method Channel getAt($offset)
16 | * @method Channel getById($offset)
17 | */
18 | class ChannelCollection extends Collection
19 | {
20 | protected $type = Channel::class;
21 | }
22 |
--------------------------------------------------------------------------------
/src/Core/Model/Message/MessageCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Message;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Message
12 | * @link https://docs.commercetools.com/http-api-projects-messages.html#message
13 | * @method Message current()
14 | * @method MessageCollection add(Message $element)
15 | * @method Message getAt($offset)
16 | * @method Message getById($offset)
17 | */
18 | class MessageCollection extends Collection
19 | {
20 | protected $type = Message::class;
21 | }
22 |
--------------------------------------------------------------------------------
/src/Core/Model/Payment/PaymentCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Payment;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Payment
12 | * @link https://docs.commercetools.com/http-api-projects-payments.html#payment
13 | * @method PaymentCollection add(Payment $element)
14 | * @method Payment current()
15 | * @method Payment getAt($offset)
16 | * @method Payment getById($offset)
17 | */
18 | class PaymentCollection extends Collection
19 | {
20 | protected $type = Payment::class;
21 | }
22 |
--------------------------------------------------------------------------------
/src/Core/Model/Product/ProductCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Product;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Product
12 | * @link https://docs.commercetools.com/http-api-projects-products.html#product
13 | * @method Product current()
14 | * @method ProductCollection add(Product $element)
15 | * @method Product getAt($offset)
16 | * @method Product getById($offset)
17 | */
18 | class ProductCollection extends Collection
19 | {
20 | protected $type = Product::class;
21 | }
22 |
--------------------------------------------------------------------------------
/src/Core/Model/ProductSelection/IndividualProductSelectionType.php:
--------------------------------------------------------------------------------
1 | [static::TYPE => LocalizedString::class],
19 | ];
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Core/Model/Type/MoneyType.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Type;
7 |
8 | use Commercetools\Core\Model\Common\Money;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Type
12 | * @link https://docs.commercetools.com/http-api-projects-types.html#moneytype
13 | * @method string getName()
14 | * @method MoneyType setName(string $name = null)
15 | */
16 | class MoneyType extends FieldType
17 | {
18 | const NAME = 'Money';
19 |
20 | public function fieldTypeDefinition()
21 | {
22 | return [static::TYPE => Money::class];
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Core/Model/Type/StringType.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Type;
7 |
8 | use Commercetools\Core\Model\Common\Context;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Type
12 | * @link https://docs.commercetools.com/http-api-projects-types.html#stringtype
13 | * @method string getName()
14 | * @method StringType setName(string $name = null)
15 | */
16 | class StringType extends FieldType
17 | {
18 | const NAME = 'String';
19 |
20 | public function fieldTypeDefinition()
21 | {
22 | return [static::TYPE => 'string'];
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Core/Model/ShippingMethod/ZoneRateCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\ShippingMethod;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\ShippingMethod
12 | * @link https://docs.commercetools.com/http-api-projects-shippingMethods.html#zonerate
13 | * @method ZoneRate current()
14 | * @method ZoneRateCollection add(ZoneRate $element)
15 | * @method ZoneRate getAt($offset)
16 | */
17 | class ZoneRateCollection extends ZoneRateDraftCollection
18 | {
19 | protected $type = ZoneRate::class;
20 | }
21 |
--------------------------------------------------------------------------------
/src/Core/Model/Cart/MyLineItemDraftCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Cart;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Cart
12 | * @link https://docs.commercetools.com/http-api-projects-me-carts.html#mylineitemdraft
13 | * @method MyLineItemDraft current()
14 | * @method MyLineItemDraftCollection add(MyLineItemDraft $element)
15 | * @method MyLineItemDraft getAt($offset)
16 | */
17 | class MyLineItemDraftCollection extends Collection
18 | {
19 | protected $type = MyLineItemDraft::class;
20 | }
21 |
--------------------------------------------------------------------------------
/src/Core/Model/Customer/CustomerCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Customer;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Customer
12 | * @link https://docs.commercetools.com/http-api-projects-customers.html#customer
13 | * @method Customer current()
14 | * @method CustomerCollection add(Customer $element)
15 | * @method Customer getAt($offset)
16 | * @method Customer getById($offset)
17 | */
18 | class CustomerCollection extends Collection
19 | {
20 | protected $type = Customer::class;
21 | }
22 |
--------------------------------------------------------------------------------
/src/Core/Model/Payment/TransactionType.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Payment;
7 |
8 | /**
9 | * Class TransactionType
10 | * @deprecated use Transaction:: instead
11 | * @package Commercetools\Core\Model\Payment
12 | * @link https://docs.commercetools.com/http-api-projects-payments.html#transactiontype
13 | */
14 | class TransactionType
15 | {
16 | const AUTHORIZATION = 'AUTHORIZATION';
17 | const CANCEL_AUTHORIZATION = 'CANCEL_AUTHORIZATION';
18 | const CHARGE = 'CHARGE';
19 | const REFUND = 'REFUND';
20 | const CHARGEBACK = 'CHARGEBACK';
21 | }
22 |
--------------------------------------------------------------------------------
/src/Core/Request/OrderEdits/StagedOrder/Command/StagedOrderUpdateActionCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Cart;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Cart
12 | * @link https://docs.commercetools.com/http-api-projects-carts.html#discountcodereference
13 | * @method DiscountCodeInfo current()
14 | * @method DiscountCodeInfoCollection add(DiscountCodeInfo $element)
15 | * @method DiscountCodeInfo getAt($offset)
16 | */
17 | class DiscountCodeInfoCollection extends Collection
18 | {
19 | protected $type = DiscountCodeInfo::class;
20 | }
21 |
--------------------------------------------------------------------------------
/src/Core/Model/Subscription/ChangeSubscription.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Subscription;
7 |
8 | use Commercetools\Core\Model\Common\JsonObject;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Subscription
12 | *
13 | * @method string getResourceTypeId()
14 | * @method ChangeSubscription setResourceTypeId(string $resourceTypeId = null)
15 | */
16 | class ChangeSubscription extends JsonObject
17 | {
18 | public function fieldDefinitions()
19 | {
20 | return [
21 | 'resourceTypeId' => [static::TYPE => 'string'],
22 | ];
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Core/Model/Product/Suggestion.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Product;
7 |
8 | use Commercetools\Core\Model\Common\JsonObject;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Product
12 | * @link https://docs.commercetools.com/http-api-projects-products-search.html#suggestion
13 | * @method string getText()
14 | * @method Suggestion setText(string $text = null)
15 | */
16 | class Suggestion extends JsonObject
17 | {
18 | public function fieldDefinitions()
19 | {
20 | return [
21 | 'text' => [static::TYPE => 'string']
22 | ];
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Core/Model/ShippingMethod/ZoneRateDraftCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\ShippingMethod;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\ShippingMethod
12 | * @link https://dev.commercetools.com/http-api-projects-shippingMethods.html#zoneratedraft
13 | * @method ZoneRateDraft current()
14 | * @method ZoneRateDraftCollection add(ZoneRateDraft $element)
15 | * @method ZoneRateDraft getAt($offset)
16 | */
17 | class ZoneRateDraftCollection extends Collection
18 | {
19 | protected $type = ZoneRateDraft::class;
20 | }
21 |
--------------------------------------------------------------------------------
/tests/fixtures/AnonymousId.php:
--------------------------------------------------------------------------------
1 | anonymousId = $anonymousId;
17 | }
18 |
19 | public function setAnonymousId($anonymousId)
20 | {
21 | $this->anonymousId = $anonymousId;
22 | }
23 |
24 | /**
25 | * @return string
26 | */
27 | public function getAnonymousId()
28 | {
29 | return $this->anonymousId;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Core/Model/ProductType/MoneyType.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\ProductType;
7 |
8 | use Commercetools\Core\Model\Common\Money;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\ProductType
12 | * @link https://docs.commercetools.com/http-api-projects-productTypes.html#moneytype
13 | * @method string getName()
14 | * @method MoneyType setName(string $name = null)
15 | */
16 | class MoneyType extends AttributeType
17 | {
18 | const NAME = 'money';
19 |
20 | public function fieldTypeDefinition()
21 | {
22 | return [static::TYPE => Money::class];
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Core/Model/ProductSelection/ProductSelectionCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Cart;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Cart
12 | * @link https://docs.commercetools.com/http-api-projects-carts.html#customlineitemdraft
13 | * @method CustomLineItemDraft current()
14 | * @method CustomLineItemDraftCollection add(CustomLineItemDraft $element)
15 | * @method CustomLineItemDraft getAt($offset)
16 | */
17 | class CustomLineItemDraftCollection extends Collection
18 | {
19 | protected $type = CustomLineItemDraft::class;
20 | }
21 |
--------------------------------------------------------------------------------
/src/Core/Model/CustomField/CustomFieldObjectCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\CustomField;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\CustomField
12 | * @link https://docs.commercetools.com/http-api-projects-custom-fields.html#custom
13 | * @method CustomFieldObjectCollection add(CustomFieldObject $element)
14 | * @method CustomFieldObject current()
15 | * @method CustomFieldObject getAt($offset)
16 | */
17 | class CustomFieldObjectCollection extends Collection
18 | {
19 | protected $type = CustomFieldObject::class;
20 | }
21 |
--------------------------------------------------------------------------------
/src/Core/Request/OrderEdits/StagedOrder/Command/StagedOrderSetCountryAction.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Cart;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Cart
12 | * @link https://docs.commercetools.com/http-api-projects-carts.html#customlineitem
13 | * @method CustomLineItem current()
14 | * @method CustomLineItemCollection add(CustomLineItem $element)
15 | * @method CustomLineItem getAt($offset)
16 | * @method CustomLineItem getById($offset)
17 | */
18 | class CustomLineItemCollection extends Collection
19 | {
20 | protected $type = CustomLineItem::class;
21 | }
22 |
--------------------------------------------------------------------------------
/src/Core/Request/Orders/Command/OrderSetCustomFieldAction.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Product;
7 |
8 | class ProductDraftTest extends \PHPUnit\Framework\TestCase
9 | {
10 | public function testFromArray()
11 | {
12 | $this->assertInstanceOf(
13 | ProductDraft::class,
14 | ProductDraft::fromArray(
15 | [
16 | 'productType' => ['typeId' => 'product-type', 'id' => '123456'],
17 | 'name' => ['en' => 'test'],
18 | 'slug' => ['en' => 'test'],
19 | ]
20 | )
21 | );
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/Core/Model/Order/LineItemImportDraftCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Order;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Order
12 | * @link https://docs.commercetools.com/http-api-projects-orders-import.html#lineitemimportdraft
13 | * @method LineItemImportDraft current()
14 | * @method LineItemImportDraftCollection add(LineItemImportDraft $element)
15 | * @method LineItemImportDraft getAt($offset)
16 | */
17 | class LineItemImportDraftCollection extends Collection
18 | {
19 | protected $type = LineItemImportDraft::class;
20 | }
21 |
--------------------------------------------------------------------------------
/src/Core/Model/Product/ProductVariantDraftCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Product;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Product
12 | * @link https://docs.commercetools.com/http-api-projects-products.html#productvariantdraft
13 | * @method ProductVariantDraftCollection add(ProductVariantDraft $element)
14 | * @method ProductVariantDraft current()
15 | * @method ProductVariantDraft getAt($offset)
16 | */
17 | class ProductVariantDraftCollection extends Collection
18 | {
19 | protected $type = ProductVariantDraft::class;
20 | }
21 |
--------------------------------------------------------------------------------
/src/Core/Model/ShippingMethod/ShippingRatePriceTierCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\ShippingMethod;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\ShippingMethod
10 | * @link https://dev.commercetools.com/http-api-projects-shippingMethods.html#shippingratepricetier
11 | * @method ShippingRatePriceTier current()
12 | * @method ShippingRatePriceTierCollection add(ShippingRatePriceTier $element)
13 | * @method ShippingRatePriceTier getAt($offset)
14 | */
15 | class ShippingRatePriceTierCollection extends ShippingRateDraftCollection
16 | {
17 | protected $type = ShippingRatePriceTier::class;
18 | }
19 |
--------------------------------------------------------------------------------
/src/Core/Model/Store/StoreReferenceCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\TaxCategory;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\TaxCategory
12 | * @link https://docs.commercetools.com/http-api-projects-taxCategories.html#taxcategory
13 | * @method TaxCategory current()
14 | * @method TaxCategoryCollection add(TaxCategory $element)
15 | * @method TaxCategory getAt($offset)
16 | * @method TaxCategory getById($offset)
17 | */
18 | class TaxCategoryCollection extends Collection
19 | {
20 | protected $type = TaxCategory::class;
21 | }
22 |
--------------------------------------------------------------------------------
/src/Core/Model/Common/LocaleTrait.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 |
7 | namespace Commercetools\Core\Model\Common;
8 |
9 | trait LocaleTrait
10 | {
11 | public function setLocale($locale)
12 | {
13 | $locale = \Locale::canonicalize($locale);
14 | parent::setLocale($locale);
15 |
16 | return $this;
17 | }
18 |
19 | /**
20 | * @return array
21 | */
22 | public function toJson()
23 | {
24 | $data = parent::toJson();
25 | if (isset($data['locale'])) {
26 | $data['locale'] = str_replace('_', '-', $data['locale']);
27 | }
28 |
29 | return $data;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Core/Model/Project/CartsConfiguration.php:
--------------------------------------------------------------------------------
1 | [static::TYPE => 'bool', static::OPTIONAL => true],
20 | ];
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Core/Request/Reviews/Command/ReviewSetCustomFieldAction.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\CartDiscount;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\CartDiscount
12 | * @link https://docs.commercetools.com/http-api-projects-cartDiscounts.html#cartdiscount
13 | * @method CartDiscount current()
14 | * @method CartDiscountCollection add(CartDiscount $element)
15 | * @method CartDiscount getAt($offset)
16 | * @method CartDiscount getById($offset)
17 | */
18 | class CartDiscountCollection extends Collection
19 | {
20 | protected $type = CartDiscount::class;
21 | }
22 |
--------------------------------------------------------------------------------
/src/Core/Model/DiscountCode/DiscountCodeCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\DiscountCode;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\DiscountCode
12 | * @link https://docs.commercetools.com/http-api-projects-discountCodes.html#discountcode
13 | * @method DiscountCode current()
14 | * @method DiscountCodeCollection add(DiscountCode $element)
15 | * @method DiscountCode getAt($offset)
16 | * @method DiscountCode getById($offset)
17 | */
18 | class DiscountCodeCollection extends Collection
19 | {
20 | protected $type = DiscountCode::class;
21 | }
22 |
--------------------------------------------------------------------------------
/src/Core/Model/ShippingMethod/ShippingRateDraftCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\ShippingMethod;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\ShippingMethod
12 | * @link https://dev.commercetools.com/http-api-projects-shippingMethods.html#shippingratedraft
13 | * @method ShippingRateDraft current()
14 | * @method ShippingRateDraftCollection add(ShippingRateDraft $element)
15 | * @method ShippingRateDraft getAt($offset)
16 | */
17 | class ShippingRateDraftCollection extends Collection
18 | {
19 | protected $type = ShippingRateDraft::class;
20 | }
21 |
--------------------------------------------------------------------------------
/src/Core/Model/Subscription/SubscriptionCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Subscription;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Subscription
12 | * @link https://docs.commercetools.com/http-api-projects-subscriptions.html#subscription
13 | * @method Subscription current()
14 | * @method SubscriptionCollection add(Subscription $element)
15 | * @method Subscription getAt($offset)
16 | * @method Subscription getById($offset)
17 | */
18 | class SubscriptionCollection extends Collection
19 | {
20 | protected $type = Subscription::class;
21 | }
22 |
--------------------------------------------------------------------------------
/src/Core/Request/Channels/Command/ChannelSetCustomFieldAction.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Inventory;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Inventory
12 | * @link https://docs.commercetools.com/http-api-projects-inventory.html#inventoryentry
13 | * @method InventoryEntry current()
14 | * @method InventoryEntryCollection add(InventoryEntry $element)
15 | * @method InventoryEntry getAt($offset)
16 | * @method InventoryEntry getById($offset)
17 | */
18 | class InventoryEntryCollection extends Collection
19 | {
20 | protected $type = InventoryEntry::class;
21 | }
22 |
--------------------------------------------------------------------------------
/src/Core/Model/Type/DateType.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Type;
7 |
8 | use Commercetools\Core\Model\Common\DateDecorator;
9 | use DateTime;
10 |
11 | /**
12 | * @package Commercetools\Core\Model\Type
13 | * @link https://docs.commercetools.com/http-api-projects-types.html#datetype
14 | * @method string getName()
15 | * @method DateType setName(string $name = null)
16 | */
17 | class DateType extends FieldType
18 | {
19 | const NAME = 'Date';
20 |
21 | public function fieldTypeDefinition()
22 | {
23 | return [static::TYPE => DateTime::class, static::DECORATOR => DateDecorator::class];
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Core/Model/Type/LocalizedStringType.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Type;
7 |
8 | use Commercetools\Core\Model\Common\LocalizedString;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Type
12 | * @link https://docs.commercetools.com/http-api-projects-types.html#localizedstringtype
13 | * @method string getName()
14 | * @method LocalizedStringType setName(string $name = null)
15 | */
16 | class LocalizedStringType extends FieldType
17 | {
18 | const NAME = 'LocalizedString';
19 |
20 | public function fieldTypeDefinition()
21 | {
22 | return [static::TYPE => LocalizedString::class];
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Core/Model/Type/TimeType.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Type;
7 |
8 | use Commercetools\Core\Model\Common\TimeDecorator;
9 | use DateTime;
10 |
11 | /**
12 | * @package Commercetools\Core\Model\Type
13 | * @link https://docs.commercetools.com/http-api-projects-types.html#timetype
14 | * @method string getName()
15 | * @method TimeType setName(string $name = null)
16 | */
17 | class TimeType extends FieldType
18 | {
19 | const NAME = 'Time';
20 |
21 | public function fieldTypeDefinition()
22 | {
23 | return [static::TYPE => DateTime::class, static::DECORATOR => TimeDecorator::class];
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Core/Request/OrderEdits/StagedOrder/Command/StagedOrderSetCustomerIdAction.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Common;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\Common
10 | * @link https://docs.commercetools.com/http-api-projects-products.html#images
11 | * @method int getW()
12 | * @method ImageDimension setW(int $w = null)
13 | * @method int getH()
14 | * @method ImageDimension setH(int $h = null)
15 | */
16 | class ImageDimension extends JsonObject
17 | {
18 | public function fieldDefinitions()
19 | {
20 | return [
21 | 'w' => [static::TYPE => 'int'],
22 | 'h' => [static::TYPE => 'int'],
23 | ];
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Core/Request/Categories/Command/CategorySetCustomFieldAction.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Fixtures;
7 |
8 | use GuzzleHttp\Psr7\Response;
9 | use Psr\Http\Message\RequestInterface;
10 | use GuzzleHttp\Promise;
11 |
12 | class FooHandler
13 | {
14 | private $reply;
15 |
16 | /**
17 | * FooHandler constructor.
18 | * @param $reply
19 | */
20 | public function __construct($reply)
21 | {
22 | $this->reply = $reply;
23 | }
24 |
25 |
26 | public function __invoke(RequestInterface $request, array $options)
27 | {
28 | return Promise\promise_for(new Response(200, $request->getHeaders(), $this->reply));
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Core/Model/CustomerGroup/CustomerGroupCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\CustomerGroup;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\CustomerGroup
12 | * @link https://docs.commercetools.com/http-api-projects-customerGroups.html#customergroup
13 | * @method CustomerGroup current()
14 | * @method CustomerGroupCollection add(CustomerGroup $element)
15 | * @method CustomerGroup getAt($offset)
16 | * @method CustomerGroup getById($offset)
17 | */
18 | class CustomerGroupCollection extends Collection
19 | {
20 | protected $type = CustomerGroup::class;
21 | }
22 |
--------------------------------------------------------------------------------
/src/Core/Request/Inventory/Command/InventorySetCustomFieldAction.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\CartDiscount;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\CartDiscount
10 | *
11 | * @method string getType()
12 | * @method LineItemsTarget setType(string $type = null)
13 | * @method string getPredicate()
14 | * @method LineItemsTarget setPredicate(string $predicate = null)
15 | */
16 | class LineItemsTarget extends CartDiscountTarget
17 | {
18 | const TARGET_TYPE = 'lineItems';
19 |
20 | public static function ofPredicate($predicate, $context = null)
21 | {
22 | return static::of($context)->setPredicate($predicate);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Core/Model/Common/ContextAwareInterface.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Common;
7 |
8 | interface ContextAwareInterface
9 | {
10 | /**
11 | * @return Context
12 | */
13 | public function getContext();
14 |
15 | /**
16 | * @return callable
17 | */
18 | public function getContextCallback();
19 |
20 | /**
21 | * @param Context|callable $context
22 | * @return mixed
23 | */
24 | public function setContext($context = null);
25 |
26 | /**
27 | * @param Context|callable $context
28 | * @return mixed
29 | */
30 | public function setContextIfNull($context = null);
31 | }
32 |
--------------------------------------------------------------------------------
/src/Core/Model/Common/TaxedItemPrice.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Common;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\Common
10 | *
11 | * @method Money getTotalNet()
12 | * @method TaxedItemPrice setTotalNet(Money $totalNet = null)
13 | * @method Money getTotalGross()
14 | * @method TaxedItemPrice setTotalGross(Money $totalGross = null)
15 | */
16 | class TaxedItemPrice extends JsonObject
17 | {
18 | public function fieldDefinitions()
19 | {
20 | return [
21 | 'totalNet' => [static::TYPE => Money::class],
22 | 'totalGross' => [static::TYPE => Money::class],
23 | ];
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Core/Request/OrderEdits/StagedOrder/Command/StagedOrderSetOrderNumberAction.php:
--------------------------------------------------------------------------------
1 | addAction(MyCartAddLineItemAction::ofProductIdVariantIdAndQuantity(
14 | 'bla',
15 | 1,
16 | 1
17 | ));
18 | $httpRequest = $request->httpRequest();
19 |
20 | $this->assertSame('me/carts/cartId', (string)$httpRequest->getUri());
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Core/Model/Cart/DiscountedLineItemPortionCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Cart;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Cart
12 | * @link https://docs.commercetools.com/http-api-projects-carts.html#discountedlineitemportion
13 | * @method DiscountedLineItemPortion current()
14 | * @method DiscountedLineItemPortionCollection add(DiscountedLineItemPortion $element)
15 | * @method DiscountedLineItemPortion getAt($offset)
16 | */
17 | class DiscountedLineItemPortionCollection extends Collection
18 | {
19 | protected $type = DiscountedLineItemPortion::class;
20 | }
21 |
--------------------------------------------------------------------------------
/src/Core/Model/Cart/ItemShippingTarget.php:
--------------------------------------------------------------------------------
1 | [static::TYPE => 'string'],
24 | 'quantity' => [static::TYPE => 'int'],
25 | ];
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Core/Model/CustomField/CustomFieldObjectDraftCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\CustomField;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\CustomField
12 | * @link https://docs.commercetools.com/http-api-projects-custom-fields.html#customfieldsdraft
13 | * @method CustomFieldObjectDraftCollection add(CustomFieldObjectDraft $element)
14 | * @method CustomFieldObjectDraft current()
15 | * @method CustomFieldObjectDraft getAt($offset)
16 | */
17 | class CustomFieldObjectDraftCollection extends Collection
18 | {
19 | protected $type = CustomFieldObjectDraft::class;
20 | }
21 |
--------------------------------------------------------------------------------
/src/Core/Model/Project/ShoppingListsConfiguration.php:
--------------------------------------------------------------------------------
1 | [static::TYPE => 'int', static::OPTIONAL => true],
20 | ];
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/tests/unit/Model/Common/LocalizedEnumTest.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Common;
7 |
8 | class LocalizedEnumTest extends \PHPUnit\Framework\TestCase
9 | {
10 | public function testToString()
11 | {
12 | $context = Context::of()->setLanguages(['en']);
13 |
14 | $this->assertSame(
15 | 'Test',
16 | (string)LocalizedEnum::fromArray(
17 | [
18 | 'key' => 'test',
19 | 'label' => [
20 | 'en' => 'Test'
21 | ]
22 | ],
23 | $context
24 | )
25 | );
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: bug
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior
15 |
16 | **Expected behavior**
17 | A clear and concise description of what you expected to happen.
18 |
19 | **Screenshots/Code snippet**
20 | If applicable, add screenshots or code samples to help explain your problem.
21 |
22 | **Stack information (please complete the following information):**
23 | - PHP: [e.g. 7.4]
24 | - SDK: [e.g. v2.2]
25 |
26 |
27 | **Additional context**
28 | Add any other context about the problem here.
29 |
--------------------------------------------------------------------------------
/src/Core/Model/ProductType/LocalizedStringType.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\ProductType;
7 |
8 | use Commercetools\Core\Model\Common\LocalizedString;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\ProductType
12 | * @link https://docs.commercetools.com/http-api-projects-productTypes.html#localizabletexttype
13 | * @method string getName()
14 | * @method LocalizedStringType setName(string $name = null)
15 | */
16 | class LocalizedStringType extends AttributeType
17 | {
18 | const NAME = 'ltext';
19 |
20 | public function fieldTypeDefinition()
21 | {
22 | return [static::TYPE => LocalizedString::class];
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Core/Model/Type/DateTimeType.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Type;
7 |
8 | use Commercetools\Core\Model\Common\DateTimeDecorator;
9 | use DateTime;
10 |
11 | /**
12 | * @package Commercetools\Core\Model\Type
13 | * @link https://docs.commercetools.com/http-api-projects-types.html#datetimetype
14 | * @method string getName()
15 | * @method DateTimeType setName(string $name = null)
16 | */
17 | class DateTimeType extends FieldType
18 | {
19 | const NAME = 'DateTime';
20 |
21 | public function fieldTypeDefinition()
22 | {
23 | return [static::TYPE => DateTime::class, static::DECORATOR => DateTimeDecorator::class];
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Core/Request/OrderEdits/StagedOrder/Command/StagedOrderChangeOrderStateAction.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\ProductType;
7 |
8 | use Commercetools\Core\Model\Common\DateDecorator;
9 | use DateTime;
10 |
11 | /**
12 | * @package Commercetools\Core\Model\ProductType
13 | * @link https://docs.commercetools.com/http-api-projects-productTypes.html#datetype
14 | * @method string getName()
15 | * @method DateType setName(string $name = null)
16 | */
17 | class DateType extends AttributeType
18 | {
19 | const NAME = 'date';
20 |
21 | public function fieldTypeDefinition()
22 | {
23 | return [static::TYPE => DateTime::class, static::DECORATOR => DateDecorator::class];
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Core/Model/ProductType/TimeType.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\ProductType;
7 |
8 | use Commercetools\Core\Model\Common\TimeDecorator;
9 | use DateTime;
10 |
11 | /**
12 | * @package Commercetools\Core\Model\ProductType
13 | * @link https://docs.commercetools.com/http-api-projects-productTypes.html#timetype
14 | * @method string getName()
15 | * @method TimeType setName(string $name = null)
16 | */
17 | class TimeType extends AttributeType
18 | {
19 | const NAME = 'time';
20 |
21 | public function fieldTypeDefinition()
22 | {
23 | return [static::TYPE => DateTime::class, static::DECORATOR => TimeDecorator::class];
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Core/Model/Cart/DiscountedPricePerQuantityCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Cart;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Cart
12 | * @link https://docs.commercetools.com/http-api-projects-carts.html#discountedlineitempriceforquantity
13 | * @method DiscountedPricePerQuantityCollection add(DiscountedPricePerQuantity $element)
14 | * @method DiscountedPricePerQuantity current()
15 | * @method DiscountedPricePerQuantity getAt($offset)
16 | */
17 | class DiscountedPricePerQuantityCollection extends Collection
18 | {
19 | protected $type = DiscountedPricePerQuantity::class;
20 | }
21 |
--------------------------------------------------------------------------------
/src/Core/Model/Payment/PaymentInfo.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Payment;
7 |
8 | use Commercetools\Core\Model\Common\JsonObject;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Payment
12 | * @link https://docs.commercetools.com/http-api-projects-orders.html#paymentinfo
13 | * @method PaymentReferenceCollection getPayments()
14 | * @method PaymentInfo setPayments(PaymentReferenceCollection $payments = null)
15 | */
16 | class PaymentInfo extends JsonObject
17 | {
18 | public function fieldDefinitions()
19 | {
20 | return [
21 | 'payments' => [static::TYPE => PaymentReferenceCollection::class],
22 | ];
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Core/Model/ProductDiscount/ProductDiscountCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\ProductDiscount;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\ProductDiscount
12 | * @link https://docs.commercetools.com/http-api-projects-productDiscounts.html#productdiscount
13 | * @method ProductDiscount current()
14 | * @method ProductDiscountCollection add(ProductDiscount $element)
15 | * @method ProductDiscount getAt($offset)
16 | * @method ProductDiscount getById($offset)
17 | */
18 | class ProductDiscountCollection extends Collection
19 | {
20 | protected $type = ProductDiscount::class;
21 | }
22 |
--------------------------------------------------------------------------------
/src/Core/Request/CartDiscounts/Command/CartDiscountSetCustomFieldAction.php:
--------------------------------------------------------------------------------
1 | refreshToken;
15 | }
16 |
17 | public function getAccessToken()
18 | {
19 | return $this->accessToken;
20 | }
21 |
22 | public function setRefreshToken($refreshToken)
23 | {
24 | $this->refreshToken = $refreshToken;
25 | }
26 |
27 | public function setAccessToken($accessToken)
28 | {
29 | $this->accessToken = $accessToken;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Core/Model/Product/ProductVariantAvailabilityCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Product;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Product
12 | * @link https://docs.commercetools.com/http-api-projects-products.html#productvariantavailability
13 | * @method ProductVariantAvailabilityCollection add(ProductVariantAvailability $element)
14 | * @method ProductVariantAvailability current()
15 | * @method ProductVariantAvailability getAt($offset)
16 | */
17 | class ProductVariantAvailabilityCollection extends Collection
18 | {
19 | protected $type = ProductVariantAvailability::class;
20 | }
21 |
--------------------------------------------------------------------------------
/src/Core/Model/Subscription/PayloadNotIncluded.php:
--------------------------------------------------------------------------------
1 | [static::TYPE => 'string'],
23 | 'payloadType' => [static::TYPE => 'string'],
24 | ];
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Core/Request/OrderEdits/StagedOrder/Command/StagedOrderChangePaymentStateAction.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\CartDiscount;
7 |
8 | /**
9 | * @package Commercetools\Core\Model\CartDiscount
10 | *
11 | * @method string getType()
12 | * @method CustomLineItemsTarget setType(string $type = null)
13 | * @method string getPredicate()
14 | * @method CustomLineItemsTarget setPredicate(string $predicate = null)
15 | */
16 | class CustomLineItemsTarget extends CartDiscountTarget
17 | {
18 | const TARGET_TYPE = 'customLineItems';
19 |
20 | public static function ofPredicate($predicate, $context = null)
21 | {
22 | return static::of($context)->setPredicate($predicate);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Core/Request/CustomerGroups/Command/CustomerGroupSetCustomFieldAction.php:
--------------------------------------------------------------------------------
1 | assertInstanceOf($expectedClass, $error);
19 | }
20 |
21 | public function getErrors()
22 | {
23 | return [
24 | LanguageUsedInStoresError::CODE => ['{"code": "LanguageUsedInStores"}', LanguageUsedInStoresError::class]
25 | ];
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Core/Model/Extension/AzureFunctionsAuthentication.php:
--------------------------------------------------------------------------------
1 | [static::TYPE => 'string'],
23 | 'key' => [static::TYPE => 'string']
24 | ];
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Core/Model/Message/ProductPriceDiscountsSetUpdatedPriceCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\State;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\State
12 | * @link https://docs.commercetools.com/http-api-types.html#reference-types
13 | * @link https://docs.commercetools.com/http-api-projects-states.html#state
14 | * @method StateReference current()
15 | * @method StateReferenceCollection add(StateReference $element)
16 | * @method StateReference getAt($offset)
17 | * @method StateReference getById($offset)
18 | */
19 | class StateReferenceCollection extends Collection
20 | {
21 | protected $type = StateReference::class;
22 | }
23 |
--------------------------------------------------------------------------------
/src/Core/Model/Common/LastModifiedBy.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\ProductType;
7 |
8 | use Commercetools\Core\Model\Common\DateTimeDecorator;
9 | use DateTime;
10 |
11 | /**
12 | * @package Commercetools\Core\Model\ProductType
13 | * @link https://docs.commercetools.com/http-api-projects-productTypes.html#datetimetype
14 | * @method string getName()
15 | * @method DateTimeType setName(string $name = null)
16 | */
17 | class DateTimeType extends AttributeType
18 | {
19 | const NAME = 'datetime';
20 |
21 | public function fieldTypeDefinition()
22 | {
23 | return [static::TYPE => DateTime::class, static::DECORATOR => DateTimeDecorator::class];
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Core/Request/OrderEdits/StagedOrder/Command/StagedOrderAddPaymentAction.php:
--------------------------------------------------------------------------------
1 | [static::TYPE => ProductReference::class],
20 | ];
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Core/Request/OrderEdits/StagedOrder/Command/StagedOrderChangeTaxRoundingModeAction.php:
--------------------------------------------------------------------------------
1 | [static::TYPE => ProductSelectionReference::class],
19 | ];
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Core/Request/OrderEdits/StagedOrder/Command/StagedOrderSetBillingAddressAction.php:
--------------------------------------------------------------------------------
1 | [static::TYPE => ItemShippingTargetCollection::class],
24 | 'valid' => [static::TYPE => 'bool'],
25 | ];
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Core/Request/OrderEdits/StagedOrder/Command/StagedOrderRemovePaymentAction.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request;
7 |
8 | use Commercetools\Core\Request\Query\Parameter;
9 | use Commercetools\Core\Request\Query\ParameterInterface;
10 |
11 | /**
12 | * @package Commercetools\Core\Request
13 | */
14 | trait CustomerIdTrait
15 | {
16 | /**
17 | * @param ParameterInterface $param
18 | * @return $this
19 | */
20 | abstract public function addParamObject(ParameterInterface $param);
21 |
22 | public function byCustomerId($customerId)
23 | {
24 | if (!is_null($customerId)) {
25 | $this->addParamObject(new Parameter('customerId', $customerId));
26 | }
27 |
28 | return $this;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Core/Request/Orders/Command/OrderAddPaymentAction.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request\Orders\Command;
7 |
8 | use Commercetools\Core\Request\Carts\Command\CartAddPaymentAction;
9 | use Commercetools\Core\Model\Payment\PaymentReference;
10 |
11 | /**
12 | * @package Commercetools\Core\Request\Orders\Command
13 | * @link https://docs.commercetools.com/http-api-projects-orders.html#add-payment
14 | * @method string getAction()
15 | * @method OrderAddPaymentAction setAction(string $action = null)
16 | * @method PaymentReference getPayment()
17 | * @method OrderAddPaymentAction setPayment(PaymentReference $payment = null)
18 | */
19 | class OrderAddPaymentAction extends CartAddPaymentAction
20 | {
21 | }
22 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "commercetools-php-sdk-changelog",
3 | "version": "2.22.0",
4 | "description": "Composable Commerce PHP SDK changelog generator package description",
5 | "homepage": "https://github.com/commercetools/commercetools-php-sdk",
6 | "bugs": "https://github.com/commercetools/commercetools-php-sdk/issues",
7 | "license": "MIT",
8 | "repository": {
9 | "type": "git",
10 | "url": "https://github.com/commercetools/commercetools-php-sdk.git"
11 | },
12 | "scripts": {
13 | "changelog": "conventional-changelog -p angular -i CHANGELOG.md -o CHANGELOG.md",
14 | "postinstall": "cp tools/commit-msg.sh .git/hooks/commit-msg && cp tools/pre-commit.sh .git/hooks/pre-commit"
15 | },
16 | "devDependencies": {
17 | "conventional-changelog-cli": "2.1.1"
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Core/Client/HttpRequestInterface.php:
--------------------------------------------------------------------------------
1 |
4 | * @created: 23.01.15, 15:58
5 | */
6 |
7 | namespace Commercetools\Core\Client;
8 |
9 | /**
10 | * Interface HttpRequestInterface
11 | * @package Commercetools\Core\Http
12 | */
13 | interface HttpRequestInterface
14 | {
15 | /**
16 | * @return string
17 | * @internal
18 | */
19 | public function getHttpMethod();
20 |
21 | /**
22 | * @return string
23 | * @internal
24 | */
25 | public function getPath();
26 |
27 | /**
28 | * @return string
29 | * @internal
30 | */
31 | public function getBody();
32 |
33 | /**
34 | * @return array
35 | * @internal
36 | */
37 | public function getHeaders();
38 | }
39 |
--------------------------------------------------------------------------------
/src/Core/Model/Payment/PaymentReferenceCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Payment;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Payment
12 | * @link https://docs.commercetools.com/http-api-types.html#reference-types
13 | * @link https://docs.commercetools.com/http-api-projects-payments.html#payment
14 | * @method PaymentReferenceCollection add(PaymentReference $element)
15 | * @method PaymentReference current()
16 | * @method PaymentReference getAt($offset)
17 | * @method PaymentReference getById($offset)
18 | */
19 | class PaymentReferenceCollection extends Collection
20 | {
21 | protected $type = PaymentReference::class;
22 | }
23 |
--------------------------------------------------------------------------------
/src/Core/Request/OrderEdits/StagedOrder/Command/StagedOrderRemoveParcelFromDeliveryAction.php:
--------------------------------------------------------------------------------
1 |
4 | * @created: 23.01.15, 16:25
5 | */
6 |
7 | namespace Commercetools\Core\Client;
8 |
9 | /**
10 | * @package Commercetools\Core\Http
11 | * @internal
12 | */
13 | class JsonEndpoint
14 | {
15 | /**
16 | * @var string
17 | */
18 | protected $endpoint;
19 |
20 | /**
21 | * @param string $endpoint
22 | */
23 | public function __construct($endpoint)
24 | {
25 | $this->endpoint = $endpoint;
26 | }
27 |
28 | /**
29 | * @return string
30 | */
31 | public function endpoint()
32 | {
33 | return $this->endpoint;
34 | }
35 |
36 | public function __toString()
37 | {
38 | return $this->endpoint();
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/tests/unit/Model/Cart/CartCollectionTest.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Cart;
7 |
8 | class CartCollectionTest extends \PHPUnit\Framework\TestCase
9 | {
10 | public function testIndex()
11 | {
12 | $collection = CartCollection::fromArray([
13 | [
14 | 'id' => '123456'
15 | ]
16 | ]);
17 |
18 | $this->assertInstanceOf(Cart::class, $collection->getById('123456'));
19 | }
20 |
21 | public function testAddToIndex()
22 | {
23 | $collection = CartCollection::of();
24 | $collection->add(Cart::fromArray(['id' => '123456']));
25 |
26 | $this->assertInstanceOf(Cart::class, $collection->getById('123456'));
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Core/Helper/State/Renderer/NodeRenderer.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Helper\State\Renderer;
7 |
8 | use Commercetools\Core\Model\State\State;
9 |
10 | class NodeRenderer
11 | {
12 | const COMMAND_COLOR = '#555555';
13 |
14 | /**
15 | * @param State $state
16 | * @return string
17 | */
18 | public function render(State $state)
19 | {
20 | $graph = '';
21 | $color = static::COMMAND_COLOR;
22 |
23 | $graph .= ' node [label=' . $state->getKey() . ',color="",fontcolor="' . $color . '"' .
24 | ',style="",shape="plaintext",fontname="Arial"] ' .
25 | '{ state_' . $state->getKey() . ' } ' . PHP_EOL;
26 |
27 | return $graph;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Core/Model/Category/CategoryReferenceCollection.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Category;
7 |
8 | use Commercetools\Core\Model\Common\Collection;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Category
12 | * @link https://docs.commercetools.com/http-api-types.html#reference-types
13 | * @link https://docs.commercetools.com/http-api-projects-categories.html#category
14 | * @method CategoryReference current()
15 | * @method CategoryReferenceCollection add(CategoryReference $element)
16 | * @method CategoryReference getAt($offset)
17 | * @method CategoryReference getById($offset)
18 | */
19 | class CategoryReferenceCollection extends Collection
20 | {
21 | protected $type = CategoryReference::class;
22 | }
23 |
--------------------------------------------------------------------------------
/src/Core/Model/Order/DeliveryItem.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Order;
7 |
8 | use Commercetools\Core\Model\Common\JsonObject;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\Order
12 | * @link https://docs.commercetools.com/http-api-projects-orders.html#deliveryitem
13 | * @method string getId()
14 | * @method DeliveryItem setId(string $id = null)
15 | * @method int getQuantity()
16 | * @method DeliveryItem setQuantity(int $quantity = null)
17 | */
18 | class DeliveryItem extends JsonObject
19 | {
20 | public function fieldDefinitions()
21 | {
22 | return [
23 | 'id' => [static::TYPE => 'string'],
24 | 'quantity' => [static::TYPE => 'int'],
25 | ];
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Core/Model/TaxCategory/SubRate.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\TaxCategory;
7 |
8 | use Commercetools\Core\Model\Common\JsonObject;
9 |
10 | /**
11 | * @package Commercetools\Core\Model\TaxCategory
12 | * @link https://docs.commercetools.com/http-api-projects-taxCategories.html#subrate
13 | * @method string getName()
14 | * @method SubRate setName(string $name = null)
15 | * @method float getAmount()
16 | * @method SubRate setAmount(float $amount = null)
17 | */
18 | class SubRate extends JsonObject
19 | {
20 | public function fieldDefinitions()
21 | {
22 | return [
23 | 'name' => [self::TYPE => 'string'],
24 | 'amount' => [self::TYPE => 'float'],
25 | ];
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Core/Request/OrderEdits/StagedOrder/Command/StagedOrderRemoveItemShippingAddressAction.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request\Orders\Command;
7 |
8 | use Commercetools\Core\Request\Carts\Command\CartRemovePaymentAction;
9 | use Commercetools\Core\Model\Payment\PaymentReference;
10 |
11 | /**
12 | * @package Commercetools\Core\Request\Orders\Command
13 | * @link https://docs.commercetools.com/http-api-projects-orders.html#remove-payment
14 | * @method string getAction()
15 | * @method OrderRemovePaymentAction setAction(string $action = null)
16 | * @method PaymentReference getPayment()
17 | * @method OrderRemovePaymentAction setPayment(PaymentReference $payment = null)
18 | */
19 | class OrderRemovePaymentAction extends CartRemovePaymentAction
20 | {
21 | }
22 |
--------------------------------------------------------------------------------
/tests/unit/Model/State/StateCollectionTest.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\State;
7 |
8 | class StateCollectionTest extends \PHPUnit\Framework\TestCase
9 | {
10 | public function testIndex()
11 | {
12 | $collection = StateCollection::fromArray([
13 | [
14 | 'key' => 'initial'
15 | ]
16 | ]);
17 |
18 | $this->assertInstanceOf(State::class, $collection->getByKey('initial'));
19 | }
20 |
21 | public function testAddToIndex()
22 | {
23 | $collection = StateCollection::of();
24 | $collection->add(new State(['key' => 'initial']));
25 |
26 | $this->assertInstanceOf(State::class, $collection->getByKey('initial'));
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Core/Model/Common/ObjectTreeInterface.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Model\Common;
7 |
8 | interface ObjectTreeInterface
9 | {
10 | /**
11 | * set the parent of the object, has to be set on instantiation
12 | * @param $parent
13 | * @return static
14 | */
15 | public function parentSet($parent);
16 |
17 | /**
18 | * sets the root of the object hierarchy, has to be set on instantiation
19 | * @param $parent
20 | * @return static
21 | */
22 | public function rootSet($parent);
23 |
24 | /**
25 | * returns the root of the object hierarchy
26 | * if no root is given returns the object itself
27 | * @return object
28 | */
29 | public function rootGet();
30 | }
31 |
--------------------------------------------------------------------------------
/src/Core/Request/ExpandTrait.php:
--------------------------------------------------------------------------------
1 |
4 | */
5 |
6 | namespace Commercetools\Core\Request;
7 |
8 | use Commercetools\Core\Request\Query\MultiParameter;
9 | use Commercetools\Core\Request\Query\ParameterInterface;
10 |
11 | /**
12 | * @package Commercetools\Core\Request
13 | */
14 | trait ExpandTrait
15 | {
16 | /**
17 | * @param ParameterInterface $param
18 | * @return $this
19 | */
20 | abstract public function addParamObject(ParameterInterface $param);
21 |
22 | /**
23 | * @param $fieldReference
24 | * @return $this
25 | */
26 | public function expand($fieldReference)
27 | {
28 | $this->addParamObject(new MultiParameter('expand', $fieldReference));
29 |
30 | return $this;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Core/Request/Orders/Command/OrderUpdateItemShippingAddressAction.php:
--------------------------------------------------------------------------------
1 |