├── phpstan.neon ├── plugin.png ├── Connector ├── CleanupService │ ├── CleanupServiceInterface.php │ └── CallbackLogHandler │ │ └── CallbackLogHandler.php ├── TransferObject │ ├── Payment │ │ └── PaymentData │ │ │ └── PaymentDataInterface.php │ ├── TranslatableInterface.php │ ├── AttributableInterface.php │ ├── TransferObjectInterface.php │ ├── AbstractTransferObject.php │ ├── Product │ │ └── Badge │ │ │ └── Badge.php │ ├── Shop │ │ └── Shop.php │ ├── Unit │ │ └── Unit.php │ ├── Country │ │ └── Country.php │ ├── VatRate │ │ └── VatRate.php │ ├── Currency │ │ └── Currency.php │ ├── Language │ │ └── Language.php │ ├── OrderStatus │ │ └── OrderStatus.php │ ├── CustomerGroup │ │ └── CustomerGroup.php │ ├── MediaCategory │ │ └── MediaCategory.php │ ├── PaymentMethod │ │ └── PaymentMethod.php │ ├── PaymentStatus │ │ └── PaymentStatus.php │ └── ShippingProfile │ │ └── ShippingProfile.php ├── IdentityService │ ├── Exception │ │ └── NotFoundException.php │ └── Storage │ │ └── IdentityServiceStorageInterface.php ├── ServiceBus │ ├── ServiceBus.php │ ├── Query │ │ └── QueryInterface.php │ ├── ServiceBusInterface.php │ ├── ServiceBusFactory.php │ ├── CommandType.php │ ├── QueryType.php │ ├── QueryFactory │ │ ├── QueryFactoryInterface.php │ │ └── Exception │ │ │ └── MissingQueryException.php │ ├── CommandHandler │ │ └── CommandHandlerInterface.php │ ├── CommandFactory │ │ ├── CommandFactoryInterface.php │ │ └── Exception │ │ │ └── MissingCommandException.php │ ├── QueryHandler │ │ └── QueryHandlerInterface.php │ ├── QueryHandlerMiddleware │ │ └── Exception │ │ │ └── NotFoundException.php │ ├── CommandHandlerMiddleware │ │ └── Exception │ │ │ └── NotFoundException.php │ ├── Command │ │ └── CommandInterface.php │ └── ValidatorMiddleware │ │ └── ValidatorMiddleware.php ├── ValidatorService │ └── ValidatorServiceInterface.php ├── ValueObject │ ├── ValueObjectInterface.php │ └── AbstractValueObject.php ├── ConnectorInterface.php ├── Validator │ ├── ValidatorInterface.php │ ├── Product │ │ ├── Badge │ │ │ └── BadgeValidator.php │ │ ├── Barcode │ │ │ └── BarcodeValidator.php │ │ ├── Stock │ │ │ └── StockValidator.php │ │ ├── Image │ │ │ └── ImageValidator.php │ │ ├── Property │ │ │ ├── Value │ │ │ │ └── ValueValidator.php │ │ │ └── PropertyValidator.php │ │ ├── LinkedProduct │ │ │ └── LinkedProductValidator.php │ │ └── Price │ │ │ └── PriceValidator.php │ ├── Shop │ │ └── ShopValidator.php │ ├── Unit │ │ └── UnitValidator.php │ ├── Country │ │ └── CountryValidator.php │ ├── VatRate │ │ └── VatRateValidator.php │ ├── Currency │ │ └── CurrencyValidator.php │ ├── Language │ │ └── LanguageValidator.php │ ├── MediaCategory │ │ └── MediaCategoryValidator.php │ ├── OrderStatus │ │ └── OrderStatusValidator.php │ ├── CustomerGroup │ │ └── CustomerGroupValidator.php │ ├── PaymentMethod │ │ └── PaymentMethodValidator.php │ ├── PaymentStatus │ │ └── PaymentStatusValidator.php │ ├── Translation │ │ └── TranslationValidator.php │ ├── ShippingProfile │ │ └── ShippingProfileValidator.php │ ├── Order │ │ ├── Package │ │ │ └── PackageValidator.php │ │ └── Comment │ │ │ └── CommentValidator.php │ ├── Attribute │ │ └── AttributeValidator.php │ ├── Manufacturer │ │ └── ManufacturerValidator.php │ ├── Identity │ │ └── IdentityValidator.php │ ├── Media │ │ └── MediaValidator.php │ ├── Mapping │ │ └── MappingValidator.php │ └── Definition │ │ └── DefinitionValidator.php ├── MappingService │ └── MappingServiceInterface.php ├── DefinitionFactory │ ├── DefinitionFactoryInterface.php │ └── DefinitionFactory.php ├── Logger │ ├── ClassNameFormatterInterface.php │ └── LoggerMiddleware.php ├── Translation │ └── TranslationHelperInterface.php ├── DefinitionProvider │ └── DefinitionProviderInterface.php ├── ConfigService │ ├── Storage │ │ └── ConfigServiceStorageInterface.php │ ├── ConfigServiceInterface.php │ └── ConfigService.php ├── BacklogService │ ├── Storage │ │ └── BacklogServiceStorageInterface.php │ ├── BacklogServiceInterface.php │ ├── Command │ │ └── HandleBacklogElementCommand.php │ └── BacklogService.php └── Console │ └── OutputHandler │ └── OutputHandlerInterface.php ├── Adapter ├── PlentymarketsAdapter │ ├── Client │ │ ├── Exception │ │ │ ├── InvalidCredentialsException.php │ │ │ ├── LoginExpiredException.php │ │ │ ├── LimitReachedException.php │ │ │ └── InvalidResponseException.php │ │ └── ClientInterface.php │ ├── Helper │ │ ├── MediaCategoryHelperInterface.php │ │ ├── ReferenceAmountCalculatorInterface.php │ │ ├── LanguageHelperInterface.php │ │ ├── PropertyHelperInterface.php │ │ ├── VariationHelperInterface.php │ │ ├── MediaCategoryHelper.php │ │ └── PropertyHelper.php │ ├── ReadApi │ │ ├── Availability.php │ │ ├── Item │ │ │ ├── Unit.php │ │ │ ├── Barcode.php │ │ │ ├── SalesPrice.php │ │ │ ├── Property │ │ │ │ ├── Group.php │ │ │ │ └── Name.php │ │ │ ├── Attribute.php │ │ │ └── Variation.php │ │ ├── Account │ │ │ └── ContactClass.php │ │ ├── Webstore.php │ │ ├── ApiAbstract.php │ │ ├── Customer │ │ │ └── Customer.php │ │ └── Payment │ │ │ └── Payment.php │ ├── ResponseParser │ │ ├── Shop │ │ │ ├── ShopResponseParserInterface.php │ │ │ └── ShopResponseParser.php │ │ ├── Unit │ │ │ ├── UnitResponseParserInterface.php │ │ │ └── UnitResponseParser.php │ │ ├── Media │ │ │ └── MediaResponseParserInterface.php │ │ ├── Country │ │ │ ├── CountryResponseParserInterface.php │ │ │ └── CountryResponseParser.php │ │ ├── VatRate │ │ │ ├── VatRateResponseParserInterface.php │ │ │ └── VatRateResponseParser.php │ │ ├── Currency │ │ │ ├── CurrencyResponseParserInterface.php │ │ │ └── CurrencyResponseParser.php │ │ ├── Language │ │ │ ├── LanguageResponseParserInterface.php │ │ │ └── LanguageResponseParser.php │ │ ├── Order │ │ │ └── OrderResponseParserInterface.php │ │ ├── Product │ │ │ ├── Stock │ │ │ │ └── StockResponseParserInterface.php │ │ │ ├── Price │ │ │ │ └── PriceResponseParserInterface.php │ │ │ ├── ProductResponseParserInterface.php │ │ │ ├── Image │ │ │ │ └── ImageResponseParserInterface.php │ │ │ └── Variation │ │ │ │ └── VariationResponseParserInterface.php │ │ ├── OrderStatus │ │ │ └── OrderStatusResponseParserInterface.php │ │ ├── Category │ │ │ └── CategoryResponseParserInterface.php │ │ ├── CustomerGroup │ │ │ ├── CustomerGroupResponseParserInterface.php │ │ │ └── CustomerGroupResponseParser.php │ │ ├── MediaCategory │ │ │ ├── MediaCategoryResponseParserInterface.php │ │ │ └── MediaCategoryResponseParser.php │ │ ├── PaymentMethod │ │ │ ├── PaymentMethodResponseParserInterface.php │ │ │ └── PaymentMethodResponseParser.php │ │ ├── PaymentStatus │ │ │ └── PaymentStatusResponseParserInterface.php │ │ ├── Manufacturer │ │ │ └── ManufacturerResponseParserInterface.php │ │ └── ShippingProfile │ │ │ ├── ShippingProfileResponseParserInterface.php │ │ │ └── ShippingProfileResponseParser.php │ ├── RequestGenerator │ │ ├── Order │ │ │ ├── OrderRequestGeneratorInterface.php │ │ │ ├── Customer │ │ │ │ └── CustomerRequestGeneratorInterface.php │ │ │ ├── OrderItem │ │ │ │ └── OrderItemRequestGeneratorInterface.php │ │ │ └── Address │ │ │ │ └── AddressRequestGeneratorInterface.php │ │ └── Payment │ │ │ └── PaymentRequestGeneratorInterface.php │ ├── PlentymarketsAdapter.php │ └── ServiceBus │ │ └── QueryHandler │ │ └── Stock │ │ └── FetchStockQueryHandler.php ├── AdapterInterface.php └── ShopwareAdapter │ ├── DataProvider │ ├── Shop │ │ ├── ShopDataProviderInterface.php │ │ └── ShopDataProvider.php │ ├── Currency │ │ ├── CurrencyDataProviderInterface.php │ │ └── CurrencyDataProvider.php │ ├── Tax │ │ └── TaxDataProviderInterface.php │ ├── Order │ │ └── OrderDataProviderInterface.php │ ├── Media │ │ └── MediaDataProviderInterface.php │ └── CustomerGroup │ │ ├── CustomerGroupDataProviderInterface.php │ │ └── CustomerGroupDataProvider.php │ ├── ResponseParser │ ├── Shop │ │ ├── ShopResponseParserInterface.php │ │ └── ShopResponseParser.php │ ├── Unit │ │ ├── UnitResponseParserInterface.php │ │ └── UnitResponseParser.php │ ├── Country │ │ ├── CountryResponseParserInterface.php │ │ └── CountryResponseParser.php │ ├── VatRate │ │ ├── VatRateResponseParserInterface.php │ │ └── VatRateResponseParser.php │ ├── Address │ │ └── AddressResponseParserInterface.php │ ├── Currency │ │ ├── CurrencyResponseParserInterface.php │ │ └── CurrencyResponseParser.php │ ├── Language │ │ ├── LanguageResponseParserInterface.php │ │ └── LanguageResponseParser.php │ ├── Customer │ │ └── CustomerResponseParserInterface.php │ ├── Order │ │ └── OrderResponseParserInterface.php │ ├── OrderStatus │ │ ├── OrderStatusResponseParserInterface.php │ │ └── OrderStatusResponseParser.php │ ├── Payment │ │ └── PaymentResponseParserInterface.php │ ├── CustomerGroup │ │ ├── CustomerGroupResponseParserInterface.php │ │ └── CustomerGroupResponseParser.php │ ├── PaymentMethod │ │ ├── PaymentMethodResponseParserInterface.php │ │ └── PaymentMethodResponseParser.php │ ├── PaymentStatus │ │ ├── PaymentStatusResponseParserInterface.php │ │ └── PaymentStatusResponseParser.php │ ├── ShippingProfile │ │ ├── ShippingProfileResponseParserInterface.php │ │ └── ShippingProfileResponseParser.php │ ├── OrderItem │ │ └── OrderItemResponseParserInterface.php │ └── GetAttributeTrait.php │ ├── ShopwareAdapter.php │ ├── RequestGenerator │ ├── Media │ │ ├── MediaRequestGeneratorInterface.php │ │ └── MediaRequestGenerator.php │ └── Product │ │ ├── ProductRequestGeneratorInterface.php │ │ ├── Variation │ │ └── VariationRequestGeneratorInterface.php │ │ └── ConfiguratorSet │ │ └── ConfiguratorSetRequestGeneratorInterface.php │ ├── Helper │ └── AttributeHelperInterface.php │ └── DataPersister │ ├── Translation │ └── TranslationDataPersisterInterface.php │ └── Attribute │ └── AttributeDataPersisterInterface.php ├── autoload.php ├── .gitignore ├── Components ├── Bundle │ ├── PlentymarketsAdapter │ │ └── ResponseParser │ │ │ └── BundleResponseParserInterface.php │ ├── Helper │ │ └── BundleHelper.php │ ├── ShopwareAdapter │ │ └── ResponseParser │ │ │ └── Order │ │ │ └── OrderResponseParser.php │ └── Validator │ │ └── BundleProduct │ │ └── BundleProductValidator.php ├── AmazonPay │ ├── Validator │ │ └── AmazonPayPaymentDataValidator.php │ └── PaymentData │ │ └── AmazonPayPaymentData.php ├── CustomProducts │ └── DependencyInjection │ │ └── services.xml ├── Klarna │ ├── Validator │ │ └── KlarnaPaymentDataValidator.php │ ├── Plentymarkets │ │ └── KlarnaRequestGenerator.php │ └── DependencyInjection │ │ └── services.xml ├── Sepa │ └── Validator │ │ └── SepaPaymentDataValidator.php └── PayPal │ └── Validator │ ├── PayPalInstallmentPaymentDataValidator.php │ └── PayPalUnifiedInstallmentPaymentDataValidator.php ├── .editorconfig ├── .styleci.yml ├── Resources ├── Views │ └── backend │ │ └── plenty_connector │ │ ├── store │ │ ├── mapping │ │ │ ├── row.js │ │ │ ├── information.js │ │ │ └── transfer_object.js │ │ ├── additional │ │ │ ├── order_origin.js │ │ │ └── item_warehouse.js │ │ └── settings.js │ │ ├── model │ │ ├── additional │ │ │ ├── order_origin.js │ │ │ └── item_warehouse.js │ │ └── mapping │ │ │ ├── transfer_object.js │ │ │ ├── information.js │ │ │ └── row.js │ │ ├── controller │ │ └── main.js │ │ ├── view │ │ ├── mapping │ │ │ └── main.js │ │ └── main.js │ │ └── app.js └── menu.xml ├── .github ├── PULL_REQUEST_TEMPLATE.md └── ISSUE_TEMPLATE.md ├── plugin.xml ├── Installer └── InstallerInterface.php ├── tests ├── phpunit_unit.xml ├── phpunit.xml.dist └── Unit │ └── Adapter │ └── ShopwareAdapter │ └── ResponseParser │ └── Payment │ └── PaymentResponseParserTest.php ├── Documentation └── ErrorHandling.md ├── LICENCE ├── .travis.yml ├── README.md └── Subscriber └── ControllerPathSubscriber.php /phpstan.neon: -------------------------------------------------------------------------------- 1 | includes: 2 | - vendor/phpstan/phpstan-doctrine/extension.neon -------------------------------------------------------------------------------- /plugin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/plentymarkets/plentymarkets-shopware-connector/HEAD/plugin.png -------------------------------------------------------------------------------- /Connector/CleanupService/CleanupServiceInterface.php: -------------------------------------------------------------------------------- 1 | client->request('GET', 'availabilities'); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Adapter/ShopwareAdapter/DataProvider/Shop/ShopDataProviderInterface.php: -------------------------------------------------------------------------------- 1 | client->getIterator('items/units')); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Adapter/PlentymarketsAdapter/ResponseParser/Media/MediaResponseParserInterface.php: -------------------------------------------------------------------------------- 1 | client->getIterator('items/barcodes')); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Adapter/ShopwareAdapter/ResponseParser/Address/AddressResponseParserInterface.php: -------------------------------------------------------------------------------- 1 | client->request('GET', 'accounts/contacts/classes'); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Adapter/PlentymarketsAdapter/ResponseParser/Currency/CurrencyResponseParserInterface.php: -------------------------------------------------------------------------------- 1 | getConstants(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Adapter/PlentymarketsAdapter/ResponseParser/Product/Variation/VariationResponseParserInterface.php: -------------------------------------------------------------------------------- 1 | getConstants(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Adapter/PlentymarketsAdapter/ReadApi/Webstore.php: -------------------------------------------------------------------------------- 1 | client->request('GET', 'webstores'); 13 | 14 | $result = []; 15 | foreach ($webstores as $webstore) { 16 | $result[$webstore['id']] = $webstore; 17 | } 18 | 19 | return $result; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Adapter/PlentymarketsAdapter/Helper/LanguageHelperInterface.php: -------------------------------------------------------------------------------- 1 | retryAfter = $retryAfter; 17 | 18 | parent::__construct(); 19 | } 20 | 21 | /** 22 | * @return int 23 | */ 24 | public function getRetryAfter(): int 25 | { 26 | return $this->retryAfter; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Adapter/PlentymarketsAdapter/Helper/PropertyHelperInterface.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 5.3.3 6 | (c) plentymarkets GmbH 7 | https://www.plentymarkets.eu/ 8 | arvatis media GmbH 9 | 10 | MIT 11 | 12 | -------------------------------------------------------------------------------- /Connector/ServiceBus/QueryHandler/QueryHandlerInterface.php: -------------------------------------------------------------------------------- 1 | client->getIterator('items/sales_prices')); 15 | } 16 | 17 | /** 18 | * @param int $priceId 19 | * 20 | * @return array 21 | */ 22 | public function findOne($priceId): array 23 | { 24 | return $this->client->request('GET', 'items/sales_prices/' . $priceId); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Connector/ServiceBus/QueryHandlerMiddleware/Exception/NotFoundException.php: -------------------------------------------------------------------------------- 1 | getType(), $object->getTypes(), null, 'product.badge.type'); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Connector/DefinitionProvider/DefinitionProviderInterface.php: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | PlentyConnector 7 | 8 | 9 | PlentyConnector 10 | index 11 | sprite-metronome 12 | ConfigurationMenu 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Adapter/PlentymarketsAdapter/Client/Exception/InvalidResponseException.php: -------------------------------------------------------------------------------- 1 | getIdentifier(), null, 'shop.identifier'); 25 | Assertion::string($object->getName(), null, 'shop.name'); 26 | Assertion::notBlank($object->getName(), null, 'shop.name'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Connector/Validator/Unit/UnitValidator.php: -------------------------------------------------------------------------------- 1 | getIdentifier(), null, 'unit.identifier'); 25 | Assertion::string($object->getName(), null, 'unit.name'); 26 | Assertion::notBlank($object->getName(), null, 'unit.name'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Adapter/ShopwareAdapter/DataProvider/Shop/ShopDataProvider.php: -------------------------------------------------------------------------------- 1 | shopRepository = $entityManager->getRepository(ShopModel::class); 19 | } 20 | 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function getDefaultShop(): ShopModel 25 | { 26 | return $this->shopRepository->findOneBy(['default' => 1]); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tests/phpunit_unit.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | ./Unit 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Connector/TransferObject/TransferObjectInterface.php: -------------------------------------------------------------------------------- 1 | client = $client; 17 | } 18 | 19 | /** 20 | * Getter for Client 21 | * 22 | * @return ClientInterface 23 | */ 24 | public function getClient(): ClientInterface 25 | { 26 | return $this->client; 27 | } 28 | 29 | /** 30 | * @param ClientInterface $client 31 | */ 32 | public function setClient(ClientInterface $client) 33 | { 34 | $this->client = $client; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Connector/ConfigService/ConfigServiceInterface.php: -------------------------------------------------------------------------------- 1 | getIdentifier(), null, 'country.identifier'); 25 | Assertion::string($object->getName(), null, 'country.name'); 26 | Assertion::notBlank($object->getName(), null, 'country.name'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Connector/Validator/VatRate/VatRateValidator.php: -------------------------------------------------------------------------------- 1 | getIdentifier(), null, 'vatRate.identifier'); 25 | Assertion::string($object->getName(), null, 'vatRate.name'); 26 | Assertion::notBlank($object->getName(), null, 'vatRate.name'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Connector/Validator/Currency/CurrencyValidator.php: -------------------------------------------------------------------------------- 1 | getIdentifier(), null, 'currency.identifier'); 25 | Assertion::string($object->getName(), null, 'currency.name'); 26 | Assertion::notBlank($object->getName(), null, 'currency.name'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Connector/Validator/Language/LanguageValidator.php: -------------------------------------------------------------------------------- 1 | getIdentifier(), null, 'language.identifier'); 25 | Assertion::string($object->getName(), null, 'language.name'); 26 | Assertion::notBlank($object->getName(), null, 'language.name'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Connector/Validator/MediaCategory/MediaCategoryValidator.php: -------------------------------------------------------------------------------- 1 | getIdentifier(), null, 'mediaCategory.identifier'); 22 | Assertion::string($object->getName(), null, 'mediaCategory.name'); 23 | Assertion::notBlank($object->getName(), null, 'mediaCategory.name'); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Connector/BacklogService/Storage/BacklogServiceStorageInterface.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | ./Unit 17 | ./Integration 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Adapter/PlentymarketsAdapter/Helper/MediaCategoryHelper.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'id' => $this::MANUFACTURER, 19 | 'name' => 'Manufacturer', 20 | ], 21 | $this::PRODUCT => [ 22 | 'id' => $this::PRODUCT, 23 | 'name' => 'Products', 24 | ], 25 | $this::CATEGORY => [ 26 | 'id' => $this::CATEGORY, 27 | 'name' => 'Categories', 28 | ], 29 | ]; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Components/AmazonPay/Validator/AmazonPayPaymentDataValidator.php: -------------------------------------------------------------------------------- 1 | getTransactionId(), null, 'components.amazon_pay.transaction'); 25 | Assertion::string($object->getKey(), null, 'components.amazon_pay.key'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Connector/Validator/OrderStatus/OrderStatusValidator.php: -------------------------------------------------------------------------------- 1 | getIdentifier(), null, 'orderStatus.identifier'); 25 | Assertion::string($object->getName(), null, 'orderStatus.name'); 26 | Assertion::notBlank($object->getName(), null, 'orderStatus.name'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Components/CustomProducts/DependencyInjection/services.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Connector/Validator/Product/Barcode/BarcodeValidator.php: -------------------------------------------------------------------------------- 1 | getType(), $object->getTypes(), null, 'product.barcode.type'); 25 | Assertion::string($object->getCode(), null, 'product.barcode.code'); 26 | Assertion::notBlank($object->getCode(), null, 'product.barcode.code'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Connector/Validator/CustomerGroup/CustomerGroupValidator.php: -------------------------------------------------------------------------------- 1 | getIdentifier(), null, 'customerGroup.identifier'); 25 | Assertion::string($object->getName(), null, 'customerGroup.name'); 26 | Assertion::notBlank($object->getName(), null, 'customerGroup.name'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Connector/Validator/PaymentMethod/PaymentMethodValidator.php: -------------------------------------------------------------------------------- 1 | getIdentifier(), null, 'paymentMethod.identifier'); 25 | Assertion::string($object->getName(), null, 'paymentMethod.name'); 26 | Assertion::notBlank($object->getName(), null, 'paymentMethod.name'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Connector/Validator/PaymentStatus/PaymentStatusValidator.php: -------------------------------------------------------------------------------- 1 | getIdentifier(), null, 'paymentStatus.identifier'); 25 | Assertion::string($object->getName(), null, 'paymentStatus.name'); 26 | Assertion::notBlank($object->getName(), null, 'paymentStatus.name'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Connector/BacklogService/BacklogServiceInterface.php: -------------------------------------------------------------------------------- 1 | getLanguageIdentifier(), null, 'translation.languageIdentifier'); 25 | 26 | Assertion::string($object->getProperty(), null, 'translation.property'); 27 | Assertion::notBlank($object->getProperty(), null, 'translation.property'); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Connector/Validator/Product/Stock/StockValidator.php: -------------------------------------------------------------------------------- 1 | getIdentifier(), null, 'product.variation.stock.identifier'); 25 | Assertion::uuid($object->getVariationIdentifier(), null, 'product.variation.stock.variationIdentifier'); 26 | Assertion::float($object->getStock(), null, 'product.variation.stock.stock'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Connector/Validator/ShippingProfile/ShippingProfileValidator.php: -------------------------------------------------------------------------------- 1 | getIdentifier(), null, 'shippingProfile.identifier'); 25 | Assertion::string($object->getName(), null, 'shippingProfile.name'); 26 | Assertion::notBlank($object->getName(), null, 'shippingProfile.name'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Adapter/PlentymarketsAdapter/ReadApi/Item/Property/Group.php: -------------------------------------------------------------------------------- 1 | client->request('GET', 'items/property_groups/' . $propertyGroupId . '/names'); 24 | } 25 | 26 | public function findAll() 27 | { 28 | return iterator_to_array($this->client->getIterator('items/property_groups', [ 29 | 'with' => implode(',', $this->includes), 30 | ], function (array $elements) { 31 | return $elements; 32 | })); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Components/Klarna/Validator/KlarnaPaymentDataValidator.php: -------------------------------------------------------------------------------- 1 | getShopId(), null, 'components.klarna.shopid'); 25 | Assertion::string($object->getTransactionId(), null, 'components.klarna.transactionid'); 26 | Assertion::string($object->getPclassId(), null, 'components.klarna.pclassid'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Adapter/PlentymarketsAdapter/ReadApi/Item/Property/Name.php: -------------------------------------------------------------------------------- 1 | client->request('GET', 'items/properties/' . $propertyId . '/names'); 24 | } 25 | 26 | /** 27 | * @return array 28 | */ 29 | public function findAll() 30 | { 31 | return iterator_to_array($this->client->getIterator('items/properties', [ 32 | 'with' => implode(',', $this->includes), 33 | ], function (array $elements) { 34 | return $elements; 35 | })); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Connector/BacklogService/Command/HandleBacklogElementCommand.php: -------------------------------------------------------------------------------- 1 | command = $command; 17 | } 18 | 19 | /** 20 | * {@inheritdoc} 21 | */ 22 | public function toArray(): array 23 | { 24 | return [ 25 | 'command' => $this->command, 26 | ]; 27 | } 28 | 29 | /** 30 | * {@inheritdoc} 31 | */ 32 | public function getPriority(): int 33 | { 34 | return 0; 35 | } 36 | 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function getPayload() 41 | { 42 | return $this->command; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Adapter/PlentymarketsAdapter/ReadApi/Item/Attribute.php: -------------------------------------------------------------------------------- 1 | client->request('GET', 'items/attributes/' . $attributeId, [ 25 | 'with' => implode(',', $this->includes), 26 | ]); 27 | } 28 | 29 | /** 30 | * @return array 31 | */ 32 | public function findAll(): array 33 | { 34 | return iterator_to_array($this->client->getIterator('items/attributes/', [ 35 | 'with' => implode(',', $this->includes), 36 | ])); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Connector/Validator/Order/Package/PackageValidator.php: -------------------------------------------------------------------------------- 1 | getShippingTime(), DateTimeImmutable::class, null, 'order.package.shippingTime'); 26 | Assertion::string($object->getShippingCode(), null, 'order.package.shippingCode'); 27 | Assertion::nullOrNotBlank($object->getShippingProvider(), null, 'order.package.shippingProvider'); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Connector/Validator/Product/Image/ImageValidator.php: -------------------------------------------------------------------------------- 1 | getMediaIdentifier(), null, 'product.image.mediaIdentifier'); 25 | Assertion::isArray($object->getShopIdentifiers(), null, 'product.image.shopIdentifiers'); 26 | Assertion::integer($object->getPosition(), null, 'product.image.position'); 27 | Assertion::greaterOrEqualThan($object->getPosition(), 0, null, 'product.image.position'); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Connector/Validator/Product/Property/Value/ValueValidator.php: -------------------------------------------------------------------------------- 1 | getValue(), null, 'product.property.value.value'); 26 | Assertion::notBlank($object->getValue(), null, 'product.property.value.value'); 27 | Assertion::allIsInstanceOf($object->getTranslations(), Translation::class, null, 'product.property.value.translations'); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Connector/IdentityService/Storage/IdentityServiceStorageInterface.php: -------------------------------------------------------------------------------- 1 | implode(',', self::$includes), 35 | ]); 36 | 37 | return iterator_to_array($this->client->getIterator('items/variations', $params)); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Connector/ValueObject/AbstractValueObject.php: -------------------------------------------------------------------------------- 1 | $value) { 19 | $method = 'set' . ucfirst($key); 20 | 21 | if (method_exists($object, $method)) { 22 | $object->$method($value); 23 | } 24 | } 25 | 26 | return $object; 27 | } 28 | 29 | abstract public function getClassProperties(); 30 | 31 | /** 32 | * {@inheritdoc} 33 | */ 34 | public function jsonSerialize() 35 | { 36 | return [ 37 | 'class' => static::class, 38 | 'properties' => $this->getClassProperties(), 39 | ]; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Connector/Validator/Order/Comment/CommentValidator.php: -------------------------------------------------------------------------------- 1 | getType(), $object->getTypes(), null, 'order.comment.type'); 26 | Assertion::string($object->getComment(), null, 'order.comment.comment'); 27 | Assertion::notBlank($object->getComment(), null, 'order.comment.comment'); 28 | Assertion::allIsInstanceOf($object->getAttributes(), Attribute::class, null, 'order.comment.attributes'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Adapter/PlentymarketsAdapter/Client/ClientInterface.php: -------------------------------------------------------------------------------- 1 | $value) { 19 | $method = 'set' . ucfirst($key); 20 | 21 | if (method_exists($object, $method)) { 22 | $object->$method($value); 23 | } 24 | } 25 | 26 | return $object; 27 | } 28 | 29 | abstract public function getClassProperties(); 30 | 31 | /** 32 | * {@inheritdoc} 33 | */ 34 | public function jsonSerialize() 35 | { 36 | return [ 37 | 'class' => static::class, 38 | 'properties' => $this->getClassProperties(), 39 | ]; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Resources/Views/backend/plenty_connector/controller/main.js: -------------------------------------------------------------------------------- 1 | // {namespace name=backend/plentyconnector/main} 2 | // {block name=backend/plentyconnector/controller/main} 3 | 4 | Ext.define('Shopware.apps.PlentyConnector.controller.Main', { 5 | extend: 'Ext.app.Controller', 6 | 7 | mainWindow: null, 8 | 9 | init: function () { 10 | var me = this; 11 | 12 | var store = me.subApplication.getStore('Settings'); 13 | 14 | me.mainWindow = me.subApplication.getView('Main').create().show(); 15 | me.mainWindow.setLoading(true); 16 | 17 | store.load({ 18 | callback: function (records) { 19 | var settings = records[0]; 20 | me.mainWindow.settingsStore = store; 21 | me.mainWindow.settings = settings; 22 | me.mainWindow.createTabPanel(); 23 | me.mainWindow.setLoading(false); 24 | me.subApplication.setAppWindow(me.mainWindow); 25 | } 26 | }); 27 | 28 | me.callParent(arguments); 29 | } 30 | }); 31 | 32 | // {/block} 33 | -------------------------------------------------------------------------------- /Adapter/ShopwareAdapter/ResponseParser/GetAttributeTrait.php: -------------------------------------------------------------------------------- 1 | $value) { 20 | if (empty($value)) { 21 | continue; 22 | } 23 | 24 | if ($value instanceof DateTimeInterface) { 25 | $strValue = $value->format('Y-m-d H:i:s'); 26 | } else { 27 | $strValue = (string) $value; 28 | } 29 | 30 | $attribute = new Attribute(); 31 | $attribute->setKey((string) $key); 32 | $attribute->setValue($strValue); 33 | 34 | $attributes[] = $attribute; 35 | } 36 | 37 | return $attributes; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Connector/ServiceBus/ValidatorMiddleware/ValidatorMiddleware.php: -------------------------------------------------------------------------------- 1 | validator = $validator; 19 | } 20 | 21 | /** 22 | * @param mixed $command 23 | * @param callable $next 24 | * 25 | * @return mixed 26 | */ 27 | public function execute($command, callable $next) 28 | { 29 | if (!($command instanceof TransferObjectCommand)) { 30 | return $next($command); 31 | } 32 | 33 | $object = $command->getPayload(); 34 | 35 | $this->validator->validate($object); 36 | 37 | return $next($command); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Components/Sepa/Validator/SepaPaymentDataValidator.php: -------------------------------------------------------------------------------- 1 | getAccountOwner(), null, 'components.sepa.accountOwner'); 25 | Assertion::notBlank($object->getAccountOwner(), null, 'components.sepa.accountOwner'); 26 | Assertion::string($object->getIban(), null, 'components.sepa.iban'); 27 | Assertion::notBlank($object->getIban(), null, 'components.sepa.iban'); 28 | Assertion::nullOrString($object->getBic(), null, 'components.sepa.bic'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Connector/Validator/Attribute/AttributeValidator.php: -------------------------------------------------------------------------------- 1 | getKey(), null, 'attribute.key'); 26 | Assertion::notBlank($object->getKey(), null, 'attribute.key'); 27 | Assertion::string($object->getType(), null, 'attribute.type'); 28 | Assertion::string($object->getValue(), null, 'attribute.value'); 29 | Assertion::allIsInstanceOf($object->getTranslations(), Translation::class, null, 'attribute.translations'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Adapter/ShopwareAdapter/ResponseParser/Shop/ShopResponseParser.php: -------------------------------------------------------------------------------- 1 | identityService = $identityService; 19 | } 20 | 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function parse(array $entry) 25 | { 26 | $identity = $this->identityService->findOneOrCreate( 27 | (string) $entry['id'], 28 | ShopwareAdapter::NAME, 29 | Shop::TYPE 30 | ); 31 | 32 | return Shop::fromArray([ 33 | 'identifier' => $identity->getObjectIdentifier(), 34 | 'name' => $entry['name'], 35 | ]); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Adapter/ShopwareAdapter/ResponseParser/Unit/UnitResponseParser.php: -------------------------------------------------------------------------------- 1 | identityService = $identityService; 19 | } 20 | 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function parse(array $entry) 25 | { 26 | $identity = $this->identityService->findOneOrCreate( 27 | (string) $entry['id'], 28 | ShopwareAdapter::NAME, 29 | Unit::TYPE 30 | ); 31 | 32 | return Unit::fromArray([ 33 | 'identifier' => $identity->getObjectIdentifier(), 34 | 'name' => $entry['name'], 35 | ]); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Connector/Validator/Product/LinkedProduct/LinkedProductValidator.php: -------------------------------------------------------------------------------- 1 | getType(), $object->getTypes(), null, 'product.linkedProduct.type'); 25 | Assertion::integer($object->getPosition(), null, 'product.linkedProduct.position'); 26 | Assertion::greaterOrEqualThan($object->getPosition(), 0, null, 'product.linkedProduct.position'); 27 | Assertion::uuid($object->getProductIdentifier(), null, 'product.linkedProduct.productIdentifier'); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Connector/Logger/LoggerMiddleware.php: -------------------------------------------------------------------------------- 1 | formatter = $formatter; 21 | } 22 | 23 | /** 24 | * {@inheritdoc} 25 | */ 26 | public function execute($command, callable $next) 27 | { 28 | $this->formatter->logCommandReceived($command); 29 | 30 | $returnValue = false; 31 | 32 | try { 33 | $returnValue = $next($command); 34 | 35 | $this->formatter->logCommandProcessed($command, $returnValue); 36 | 37 | return $returnValue; 38 | } catch (Exception $exception) { 39 | $this->formatter->logCommandFailed($command, $exception); 40 | } 41 | 42 | return $returnValue; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Adapter/ShopwareAdapter/ResponseParser/Country/CountryResponseParser.php: -------------------------------------------------------------------------------- 1 | identityService = $identityService; 19 | } 20 | 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function parse(array $entry) 25 | { 26 | $identity = $this->identityService->findOneOrCreate( 27 | (string) $entry['id'], 28 | ShopwareAdapter::NAME, 29 | Country::TYPE 30 | ); 31 | 32 | return Country::fromArray([ 33 | 'identifier' => $identity->getObjectIdentifier(), 34 | 'name' => $entry['name'], 35 | ]); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Adapter/ShopwareAdapter/ResponseParser/VatRate/VatRateResponseParser.php: -------------------------------------------------------------------------------- 1 | identityService = $identityService; 19 | } 20 | 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function parse(array $entry) 25 | { 26 | $identity = $this->identityService->findOneOrCreate( 27 | (string) $entry['id'], 28 | ShopwareAdapter::NAME, 29 | VatRate::TYPE 30 | ); 31 | 32 | return VatRate::fromArray([ 33 | 'identifier' => $identity->getObjectIdentifier(), 34 | 'name' => $entry['name'], 35 | ]); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Adapter/ShopwareAdapter/ResponseParser/Currency/CurrencyResponseParser.php: -------------------------------------------------------------------------------- 1 | identityService = $identityService; 19 | } 20 | 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function parse(array $entry) 25 | { 26 | $identity = $this->identityService->findOneOrCreate( 27 | (string) $entry['id'], 28 | ShopwareAdapter::NAME, 29 | Currency::TYPE 30 | ); 31 | 32 | return Currency::fromArray([ 33 | 'identifier' => $identity->getObjectIdentifier(), 34 | 'name' => $entry['name'], 35 | ]); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Connector/DefinitionFactory/DefinitionFactory.php: -------------------------------------------------------------------------------- 1 | validator = $validator; 18 | } 19 | 20 | /** 21 | * {@inheritdoc} 22 | */ 23 | public function factory($originAdapterName, $destinationAdapterName, $objectType, $priority = null): Definition 24 | { 25 | $definition = new Definition(); 26 | $definition->setOriginAdapterName($originAdapterName); 27 | $definition->setDestinationAdapterName($destinationAdapterName); 28 | $definition->setObjectType($objectType); 29 | $definition->setPriority($priority); 30 | 31 | $this->validator->validate($definition); 32 | 33 | return $definition; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Connector/CleanupService/CallbackLogHandler/CallbackLogHandler.php: -------------------------------------------------------------------------------- 1 | handler = $handler; 28 | 29 | parent::__construct($level); 30 | } 31 | 32 | /** 33 | * {@inheritdoc} 34 | */ 35 | protected function write(array $record) 36 | { 37 | if ($this->isProcessing) { 38 | return; 39 | } 40 | 41 | $this->isProcessing = true; 42 | call_user_func($this->handler, $record); 43 | $this->isProcessing = false; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Connector/TransferObject/Product/Badge/Badge.php: -------------------------------------------------------------------------------- 1 | type; 23 | } 24 | 25 | /** 26 | * @param string $type 27 | */ 28 | public function setType($type) 29 | { 30 | $this->type = $type; 31 | } 32 | 33 | /** 34 | * @return array 35 | */ 36 | public function getTypes(): array 37 | { 38 | $reflection = new ReflectionClass(__CLASS__); 39 | 40 | return $reflection->getConstants(); 41 | } 42 | 43 | /** 44 | * {@inheritdoc} 45 | */ 46 | public function getClassProperties() 47 | { 48 | return [ 49 | 'type' => $this->getType(), 50 | ]; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Adapter/PlentymarketsAdapter/ResponseParser/Country/CountryResponseParser.php: -------------------------------------------------------------------------------- 1 | identityService = $identityService; 19 | } 20 | 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function parse(array $entry) 25 | { 26 | $identity = $this->identityService->findOneOrCreate( 27 | (string) $entry['id'], 28 | PlentymarketsAdapter::NAME, 29 | Country::TYPE 30 | ); 31 | 32 | return Country::fromArray([ 33 | 'identifier' => $identity->getObjectIdentifier(), 34 | 'name' => $entry['name'], 35 | ]); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Adapter/PlentymarketsAdapter/ResponseParser/Language/LanguageResponseParser.php: -------------------------------------------------------------------------------- 1 | identityService = $identityService; 19 | } 20 | 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function parse(array $entry) 25 | { 26 | $identity = $this->identityService->findOneOrCreate( 27 | (string) $entry['id'], 28 | PlentymarketsAdapter::NAME, 29 | Language::TYPE 30 | ); 31 | 32 | return Language::fromArray([ 33 | 'identifier' => $identity->getObjectIdentifier(), 34 | 'name' => $entry['name'], 35 | ]); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Adapter/ShopwareAdapter/ResponseParser/Language/LanguageResponseParser.php: -------------------------------------------------------------------------------- 1 | identityService = $identityService; 19 | } 20 | 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function parse(array $entry) 25 | { 26 | $identity = $this->identityService->findOneOrCreate( 27 | (string) $entry['id'], 28 | ShopwareAdapter::NAME, 29 | Language::TYPE 30 | ); 31 | 32 | return Language::fromArray([ 33 | 'identifier' => $identity->getObjectIdentifier(), 34 | 'name' => $entry['name'] . ' (' . $entry['locale'] . ')', 35 | ]); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Connector/Validator/Product/Property/PropertyValidator.php: -------------------------------------------------------------------------------- 1 | getName(), null, 'product.property.name'); 27 | Assertion::notBlank($object->getName(), null, 'product.property.name'); 28 | Assertion::allIsInstanceOf($object->getValues(), Value::class, null, 'product.property.values'); 29 | Assertion::allIsInstanceOf($object->getTranslations(), Translation::class, null, 'product.property.translations'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Adapter/PlentymarketsAdapter/ResponseParser/Currency/CurrencyResponseParser.php: -------------------------------------------------------------------------------- 1 | identityService = $identityService; 19 | } 20 | 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function parse(array $entry) 25 | { 26 | $identity = $this->identityService->findOneOrCreate( 27 | (string) $entry['currency'], 28 | PlentymarketsAdapter::NAME, 29 | Currency::TYPE 30 | ); 31 | 32 | return Currency::fromArray([ 33 | 'identifier' => $identity->getObjectIdentifier(), 34 | 'name' => $entry['currency'], 35 | ]); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Resources/Views/backend/plenty_connector/view/mapping/main.js: -------------------------------------------------------------------------------- 1 | // {namespace name=backend/plentyconnector/main} 2 | // {block name=backend/plentyconnector/view/mapping/main} 3 | 4 | Ext.define('Shopware.apps.PlentyConnector.view.mapping.Main', { 5 | extend: 'Ext.tab.Panel', 6 | 7 | alias: 'widget.plentymarkets-view-mapping-main', 8 | 9 | title: '{s name=plentyconnector/view/mapping/main/title}{/s}', 10 | autoScroll: true, 11 | cls: 'shopware-form', 12 | layout: 'anchor', 13 | 14 | border: false, 15 | 16 | isBuilt: false, 17 | 18 | /** 19 | * Init the main detail component, add components 20 | * 21 | * @return void 22 | */ 23 | initComponent: function () { 24 | var me = this; 25 | 26 | me.registerEvents(); 27 | me.listeners = { 28 | activate: function () { 29 | me.fireEvent('load', me); 30 | } 31 | }; 32 | 33 | me.callParent(arguments); 34 | }, 35 | 36 | registerEvents: function () { 37 | this.addEvents('load'); 38 | this.addEvents('reload'); 39 | this.addEvents('save'); 40 | } 41 | }); 42 | 43 | // {/block} 44 | -------------------------------------------------------------------------------- /Adapter/ShopwareAdapter/ResponseParser/CustomerGroup/CustomerGroupResponseParser.php: -------------------------------------------------------------------------------- 1 | identityService = $identityService; 19 | } 20 | 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function parse(array $entry) 25 | { 26 | $identity = $this->identityService->findOneOrCreate( 27 | (string) $entry['id'], 28 | ShopwareAdapter::NAME, 29 | CustomerGroup::TYPE 30 | ); 31 | 32 | return CustomerGroup::fromArray([ 33 | 'identifier' => $identity->getObjectIdentifier(), 34 | 'name' => $entry['name'], 35 | ]); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Adapter/ShopwareAdapter/ResponseParser/PaymentMethod/PaymentMethodResponseParser.php: -------------------------------------------------------------------------------- 1 | identityService = $identityService; 19 | } 20 | 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function parse(array $entry) 25 | { 26 | $identity = $this->identityService->findOneOrCreate( 27 | (string) $entry['id'], 28 | ShopwareAdapter::NAME, 29 | PaymentMethod::TYPE 30 | ); 31 | 32 | return PaymentMethod::fromArray([ 33 | 'identifier' => $identity->getObjectIdentifier(), 34 | 'name' => $entry['name'], 35 | ]); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Adapter/ShopwareAdapter/ResponseParser/ShippingProfile/ShippingProfileResponseParser.php: -------------------------------------------------------------------------------- 1 | identityService = $identityService; 19 | } 20 | 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function parse(array $entry) 25 | { 26 | $identity = $this->identityService->findOneOrCreate( 27 | (string) $entry['id'], 28 | ShopwareAdapter::NAME, 29 | ShippingProfile::TYPE 30 | ); 31 | 32 | return ShippingProfile::fromArray([ 33 | 'identifier' => $identity->getObjectIdentifier(), 34 | 'name' => $entry['name'], 35 | ]); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Components/PayPal/Validator/PayPalInstallmentPaymentDataValidator.php: -------------------------------------------------------------------------------- 1 | getCurrency(), null, 'components.paypal.installment.currency'); 25 | Assertion::notBlank($object->getCurrency(), null, 'components.paypal.installment.currency'); 26 | 27 | Assertion::float($object->getFinancingCosts(), null, 'components.paypal.installment.financingCosts'); 28 | 29 | Assertion::float($object->getTotalCostsIncludeFinancing(), null, 'components.paypal.installment.totalCostsIncludeFinancing'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Adapter/PlentymarketsAdapter/ResponseParser/VatRate/VatRateResponseParser.php: -------------------------------------------------------------------------------- 1 | identityService = $identityService; 19 | } 20 | 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function parse(array $entry) 25 | { 26 | $identity = $this->identityService->findOneOrCreate( 27 | (string) $entry['id'], 28 | PlentymarketsAdapter::NAME, 29 | VatRate::TYPE 30 | ); 31 | 32 | return VatRate::fromArray([ 33 | 'identifier' => $identity->getObjectIdentifier(), 34 | 'name' => !empty($entry['name']) ? $entry['name'] : $entry['vatRate'] . ' %', 35 | ]); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Adapter/PlentymarketsAdapter/ResponseParser/CustomerGroup/CustomerGroupResponseParser.php: -------------------------------------------------------------------------------- 1 | identityService = $identityService; 19 | } 20 | 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function parse(array $entry) 25 | { 26 | $identity = $this->identityService->findOneOrCreate( 27 | (string) $entry['id'], 28 | PlentymarketsAdapter::NAME, 29 | CustomerGroup::TYPE 30 | ); 31 | 32 | return CustomerGroup::fromArray([ 33 | 'identifier' => $identity->getObjectIdentifier(), 34 | 'name' => $entry['name'], 35 | ]); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | php: 4 | - 7.2 5 | - 7.3 6 | 7 | sudo: false 8 | 9 | dist: trusty 10 | 11 | services: 12 | - mysql 13 | 14 | env: 15 | matrix: 16 | - SHOPWARE_VERSION="5.6" 17 | 18 | global: 19 | - PLUGIN_NAME=PlentyConnector 20 | - SHOPWARE_DIRECTORY="${HOME}/shopware" 21 | - PLUGIN_DIRECTORY="${SHOPWARE_DIRECTORY}/custom/plugins" 22 | 23 | cache: 24 | directories: 25 | - ${HOME}/.composer 26 | 27 | install: 28 | - composer install 29 | 30 | before_script: 31 | - if [[ "$(php --version | grep -cim1 xdebug)" -ge 1 ]]; then phpenv config-rm xdebug.ini; fi 32 | - git clone https://github.com/shopware/shopware.git ${SHOPWARE_DIRECTORY} --branch ${SHOPWARE_VERSION} 33 | - ant -f ${SHOPWARE_DIRECTORY}/build/build.xml -Dapp.host=localhost -Ddb.user=root -Ddb.host=127.0.0.1 -Ddb.name=shopware build-unit 34 | - mv ${TRAVIS_BUILD_DIR} ${PLUGIN_DIRECTORY}/${PLUGIN_NAME} 35 | - php ${HOME}/shopware/bin/console sw:plugin:refresh 36 | - php ${HOME}/shopware/bin/console sw:plugin:install ${PLUGIN_NAME} 37 | - php ${HOME}/shopware/bin/console sw:plugin:activate ${PLUGIN_NAME} 38 | - cd ${PLUGIN_DIRECTORY}/${PLUGIN_NAME} 39 | 40 | script: 41 | - composer cs-travis 42 | -------------------------------------------------------------------------------- /Adapter/PlentymarketsAdapter/ResponseParser/MediaCategory/MediaCategoryResponseParser.php: -------------------------------------------------------------------------------- 1 | identityService = $identityService; 19 | } 20 | 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function parse(array $entry) 25 | { 26 | $identity = $this->identityService->findOneOrCreate( 27 | (string) $entry['id'], 28 | PlentymarketsAdapter::NAME, 29 | MediaCategory::TYPE 30 | ); 31 | 32 | return MediaCategory::fromArray([ 33 | 'identifier' => $identity->getObjectIdentifier(), 34 | 'name' => (string) $entry['name'], 35 | ]); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Adapter/PlentymarketsAdapter/ServiceBus/QueryHandler/Stock/FetchStockQueryHandler.php: -------------------------------------------------------------------------------- 1 | getAdapterName() === PlentymarketsAdapter::NAME && 22 | $query->getObjectType() === Stock::TYPE && 23 | $query->getQueryType() === QueryType::ONE; 24 | } 25 | 26 | /** 27 | * {@inheritdoc} 28 | */ 29 | public function handle(QueryInterface $query) 30 | { 31 | throw new InvalidArgumentException('unsupported operation'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Adapter/ShopwareAdapter/RequestGenerator/Media/MediaRequestGenerator.php: -------------------------------------------------------------------------------- 1 | dataProvider = $dataProvider; 19 | } 20 | 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function generate(Media $media): array 25 | { 26 | $params = [ 27 | 'album' => Album::ALBUM_ARTICLE, 28 | 'file' => $media->getLink(), 29 | 'description' => $media->getAlternateName() ?: $media->getName() ?: $media->getFilename(), 30 | ]; 31 | 32 | if (null !== $media->getMediaCategoryIdentifier()) { 33 | $params['album'] = $this->dataProvider->getAlbumIdentifierFromMediaObject($media); 34 | } 35 | 36 | return $params; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Components/PayPal/Validator/PayPalUnifiedInstallmentPaymentDataValidator.php: -------------------------------------------------------------------------------- 1 | getFeeAmount(), null, 'components.paypal.unified.installment.feeAmount'); 25 | 26 | Assertion::float($object->getTotalCost(), null, 'components.paypal.unified.installment.totalCost'); 27 | 28 | Assertion::integer($object->getTerm(), null, 'components.paypal.unified.installment.term'); 29 | 30 | Assertion::float($object->getMonthlyPayment(), null, 'components.paypal.unified.installment.monthlyPayment'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Adapter/PlentymarketsAdapter/ResponseParser/ShippingProfile/ShippingProfileResponseParser.php: -------------------------------------------------------------------------------- 1 | identityService = $identityService; 19 | } 20 | 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function parse(array $entry) 25 | { 26 | $identity = $this->identityService->findOneOrCreate( 27 | (string) $entry['id'], 28 | PlentymarketsAdapter::NAME, 29 | ShippingProfile::TYPE 30 | ); 31 | 32 | return ShippingProfile::fromArray([ 33 | 'identifier' => $identity->getObjectIdentifier(), 34 | 'name' => $entry['backendName'], 35 | ]); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Adapter/PlentymarketsAdapter/ResponseParser/Unit/UnitResponseParser.php: -------------------------------------------------------------------------------- 1 | identityService = $identityService; 19 | } 20 | 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function parse(array $entry) 25 | { 26 | $identity = $this->identityService->findOneOrCreate( 27 | (string) $entry['id'], 28 | PlentymarketsAdapter::NAME, 29 | Unit::TYPE 30 | ); 31 | 32 | // use first unit name as name 33 | $name = implode(' / ', array_column($entry['names'], 'name')); 34 | 35 | return Unit::fromArray([ 36 | 'identifier' => $identity->getObjectIdentifier(), 37 | 'name' => $name, 38 | ]); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Components/Bundle/ShopwareAdapter/ResponseParser/Order/OrderResponseParser.php: -------------------------------------------------------------------------------- 1 | parentOrderResponseParser = $parentOrderResponseParser; 17 | } 18 | 19 | /** 20 | * {@inheritdoc} 21 | */ 22 | public function parse(array $entry): array 23 | { 24 | foreach ($entry['details'] as $key => $item) { 25 | if (!isset($item['attribute']['bundlePackageId'])) { 26 | continue; 27 | } 28 | 29 | if ($item['mode'] !== 10) { 30 | unset($entry['details'][$key]); 31 | 32 | continue; 33 | } 34 | 35 | $entry['details'][$key]['bundle'] = 1; 36 | } 37 | 38 | return $this->parentOrderResponseParser->parse($entry); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![plentymarkets Logo](http://www.plentymarkets.eu/layout/pm/images/logo/plentymarkets-logo.jpg) 2 | 3 | # PlentyConnector 4 | 5 | * **License:** MIT 6 | * **Repository:** [Github](https://github.com/plentymarkets/plentymarkets-shopware-connector) 7 | * **Documentation:** [Google Docs](https://docs.google.com/document/d/10mPeV3xqx4We71dYQdPmJK2qvb21Rpym6FG_tKwHKfc/edit?usp=sharing) 8 | 9 | ## Requirements 10 | 11 | * plentymarkets version >= 7 12 | * shopware version >= 5.5 13 | * php >= 7.1 14 | * shell access 15 | * cronjobs 16 | * active plentymarkets webshop 17 | * plentymarkets user with all rest permissions 18 | 19 | ## Installation Guide 20 | 21 | ### Git 22 | 23 | **Prepare Plugin** 24 | * cd Shopware/custom/plugins 25 | * git clone https://github.com/plentymarkets/plentymarkets-shopware-connector.git PlentyConnector 26 | * cd PlentyConnector 27 | * composer install --no-dev 28 | 29 | **Install Plugin** 30 | * cd Shopware 31 | * ./bin/console sw:plugin:refresh 32 | * ./bin/console sw:plugin:install --activate PlentyConnector 33 | * ./bin/console sw:cache:clear 34 | 35 | **Configure Plugin** 36 | * visit yourshopwaredomain/backend 37 | * open Settings > PlentyConnector 38 | * add and test api creddentials 39 | * complete all necessary mappings 40 | 41 | -------------------------------------------------------------------------------- /Connector/Validator/Manufacturer/ManufacturerValidator.php: -------------------------------------------------------------------------------- 1 | getIdentifier(), null, 'manufacturer.identifier'); 26 | 27 | Assertion::string($object->getName(), null, 'manufacturer.name'); 28 | Assertion::notBlank($object->getName(), null, 'manufacturer.name'); 29 | 30 | Assertion::nullOrUuid($object->getLogoIdentifier(), null, 'manufacturer.logoIdentifier'); 31 | 32 | Assertion::nullOrNotBlank($object->getLink(), null, 'manufacturer.link'); 33 | 34 | Assertion::allIsInstanceOf($object->getAttributes(), Attribute::class, null, 'manufacturer.attributes'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Connector/Console/OutputHandler/OutputHandlerInterface.php: -------------------------------------------------------------------------------- 1 | getObjectIdentifier(), null, 'identity.objectIdentifier'); 25 | 26 | Assertion::string($object->getObjectType(), null, 'identity.objectType'); 27 | Assertion::notBlank($object->getObjectType(), null, 'identity.objectType'); 28 | 29 | Assertion::string($object->getAdapterIdentifier(), null, 'identity.adapterIdentifier'); 30 | Assertion::notBlank($object->getAdapterIdentifier(), null, 'identity.adapterIdentifier'); 31 | 32 | Assertion::string($object->getAdapterName(), null, 'identity.adapterName'); 33 | Assertion::notBlank($object->getAdapterName(), null, 'identity.adapterName'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Adapter/PlentymarketsAdapter/ResponseParser/Shop/ShopResponseParser.php: -------------------------------------------------------------------------------- 1 | identityService = $identityService; 19 | } 20 | 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function parse(array $entry) 25 | { 26 | if (null === $entry['storeIdentifier']) { 27 | return null; 28 | } 29 | 30 | $identity = $this->identityService->findOneOrCreate( 31 | (string) $entry['storeIdentifier'], 32 | PlentymarketsAdapter::NAME, 33 | Shop::TYPE 34 | ); 35 | 36 | return Shop::fromArray([ 37 | 'identifier' => $identity->getObjectIdentifier(), 38 | 'name' => empty($entry['name']) ? $entry['type'] : $entry['name'], 39 | ]); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Connector/ConfigService/ConfigService.php: -------------------------------------------------------------------------------- 1 | storages = iterator_to_array($storage); 18 | } 19 | 20 | /** 21 | * {@inheritdoc} 22 | */ 23 | public function getAll(): array 24 | { 25 | $storage = reset($this->storages); 26 | 27 | return $storage->getAll(); 28 | } 29 | 30 | /** 31 | * {@inheritdoc} 32 | */ 33 | public function get($key, $default = null) 34 | { 35 | $storage = reset($this->storages); 36 | 37 | $result = $storage->get($key); 38 | 39 | if ($result !== null) { 40 | return $result; 41 | } 42 | 43 | return $default; 44 | } 45 | 46 | /** 47 | * {@inheritdoc} 48 | */ 49 | public function set($key, $value) 50 | { 51 | $storage = reset($this->storages); 52 | 53 | $storage->set($key, $value); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Adapter/ShopwareAdapter/DataProvider/Currency/CurrencyDataProvider.php: -------------------------------------------------------------------------------- 1 | entityManager = $entityManager; 20 | } 21 | 22 | /** 23 | * {@inheritdoc} 24 | */ 25 | public function getCurrencyIdentifierByCode($code): int 26 | { 27 | /** 28 | * @var EntityRepository $currencyRepository 29 | */ 30 | $currencyRepository = $this->entityManager->getRepository(Currency::class); 31 | 32 | /** 33 | * @var null|Currency $currencyModel 34 | */ 35 | $currencyModel = $currencyRepository->findOneBy(['currency' => $code]); 36 | 37 | if (null === $currencyModel) { 38 | throw new InvalidArgumentException('invalid currency code'); 39 | } 40 | 41 | return $currencyModel->getId(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Resources/Views/backend/plenty_connector/model/mapping/information.js: -------------------------------------------------------------------------------- 1 | // {namespace name=backend/plentyconnector/main} 2 | // {block name=backend/plentyconnector/model/mapping/information} 3 | 4 | Ext.define('Shopware.apps.PlentyConnector.model.mapping.Information', { 5 | extend: 'Ext.data.Model', 6 | 7 | fields: [ 8 | // {block name="backend/plentyconnector/model/mapping/information/fields"}{/block} 9 | { 10 | name: 'originAdapterName', 11 | type: 'string' 12 | }, 13 | { 14 | name: 'originTransferObjects', 15 | type: 'auto' 16 | }, 17 | { 18 | name: 'destinationAdapterName', 19 | type: 'string' 20 | }, 21 | { 22 | name: 'destinationTransferObjects', 23 | type: 'auto' 24 | }, 25 | { 26 | name: 'objectType', 27 | type: 'string' 28 | } 29 | ], 30 | 31 | proxy: { 32 | type: 'ajax', 33 | api: { 34 | read: '{url action=getMappingInformation}' 35 | }, 36 | timeout: 300000, 37 | reader: { 38 | type: 'json', 39 | root: 'data', 40 | messageProperty: 'message' 41 | } 42 | } 43 | }); 44 | 45 | // {/block} 46 | -------------------------------------------------------------------------------- /Adapter/ShopwareAdapter/ResponseParser/OrderStatus/OrderStatusResponseParser.php: -------------------------------------------------------------------------------- 1 | identityService = $identityService; 19 | } 20 | 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function parse(array $entry) 25 | { 26 | $identity = $this->identityService->findOneOrCreate( 27 | (string) $entry['id'], 28 | ShopwareAdapter::NAME, 29 | OrderStatus::TYPE 30 | ); 31 | 32 | if (!empty($entry['name'])) { 33 | $name = $entry['name']; 34 | } else { 35 | $name = $entry['id']; 36 | } 37 | 38 | return OrderStatus::fromArray([ 39 | 'identifier' => $identity->getObjectIdentifier(), 40 | 'name' => (string) $name, 41 | ]); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Connector/BacklogService/BacklogService.php: -------------------------------------------------------------------------------- 1 | storages = iterator_to_array($storage); 22 | } 23 | 24 | /** 25 | * {@inheritdoc} 26 | */ 27 | public function enqueue(CommandInterface $command) 28 | { 29 | $storage = reset($this->storages); 30 | 31 | $storage->enqueue($command); 32 | } 33 | 34 | /** 35 | * {@inheritdoc} 36 | */ 37 | public function dequeue() 38 | { 39 | $storage = reset($this->storages); 40 | 41 | return $storage->dequeue(); 42 | } 43 | 44 | /** 45 | * {@inheritdoc} 46 | */ 47 | public function getInfo(): array 48 | { 49 | $storage = reset($this->storages); 50 | 51 | return $storage->getInfo(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Resources/Views/backend/plenty_connector/view/main.js: -------------------------------------------------------------------------------- 1 | // {namespace name=backend/plentyconnector/main} 2 | // {block name=backend/plentyconnector/view/main} 3 | 4 | Ext.define('Shopware.apps.PlentyConnector.view.Main', { 5 | extend: 'Enlight.app.Window', 6 | 7 | alias: 'widget.plentymarkets-view-main', 8 | 9 | layout: 'fit', 10 | width: 860, 11 | height: '90%', 12 | autoShow: true, 13 | 14 | stateful: true, 15 | stateId: 'plentymarkets-view-main', 16 | 17 | title: 'plentymarkets Shopware Connector', 18 | 19 | initComponent: function () { 20 | var me = this; 21 | me.callParent(arguments); 22 | }, 23 | 24 | createTabPanel: function () { 25 | var me = this; 26 | 27 | me.sf = Ext.widget('plentymarkets-view-settings', { 28 | settings: me.settings, 29 | main: me 30 | }); 31 | me.sf.on('activate', me.sf.build); 32 | 33 | me.ac = Ext.widget('plentymarkets-view-actions', { 34 | main: me 35 | }); 36 | me.ac.on('activate', me.ac.build); 37 | 38 | me.tabpanel = Ext.create('Ext.tab.Panel', { 39 | items: [me.sf, { 40 | xtype: 'plentymarkets-view-mapping-main' 41 | }, 42 | me.ac] 43 | }); 44 | 45 | me.add(me.tabpanel); 46 | } 47 | }); 48 | 49 | // {/block} 50 | -------------------------------------------------------------------------------- /Adapter/ShopwareAdapter/ResponseParser/PaymentStatus/PaymentStatusResponseParser.php: -------------------------------------------------------------------------------- 1 | identityService = $identityService; 19 | } 20 | 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function parse(array $entry) 25 | { 26 | $identity = $this->identityService->findOneOrCreate( 27 | (string) $entry['id'], 28 | ShopwareAdapter::NAME, 29 | PaymentStatus::TYPE 30 | ); 31 | 32 | if (!empty($entry['name'])) { 33 | $name = $entry['name']; 34 | } else { 35 | $name = $entry['id']; 36 | } 37 | 38 | return PaymentStatus::fromArray([ 39 | 'identifier' => $identity->getObjectIdentifier(), 40 | 'name' => (string) $name, 41 | ]); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Resources/Views/backend/plenty_connector/app.js: -------------------------------------------------------------------------------- 1 | // {namespace name=backend/plentyconnector/main} 2 | // {block name=backend/plentyconnector/application} 3 | 4 | Ext.define('Shopware.apps.PlentyConnector', { 5 | name: 'Shopware.apps.PlentyConnector', 6 | extend: 'Enlight.app.SubApplication', 7 | loadPath: '{url action=load}', 8 | bulkLoad: true, 9 | 10 | controllers: [ 11 | 'Main', 12 | 'Settings', 13 | 'Mapping', 14 | 'Actions' 15 | ], 16 | 17 | views: [ 18 | 'Main', 19 | 'mapping.Tab', 20 | 'mapping.Main', 21 | 'Settings', 22 | 'Actions' 23 | ], 24 | 25 | stores: [ 26 | 'mapping.Row', 27 | 'mapping.Information', 28 | 'mapping.TransferObject', 29 | 'Settings', 30 | 'additional.OrderOrigin', 31 | 'additional.ItemWarehouse' 32 | ], 33 | 34 | models: [ 35 | 'mapping.Row', 36 | 'mapping.Information', 37 | 'mapping.TransferObject', 38 | 'Settings', 39 | 'additional.OrderOrigin', 40 | 'additional.ItemWarehouse' 41 | ], 42 | 43 | /** 44 | * 45 | */ 46 | launch: function () { 47 | var me = this, mainController = me.getController('Main'); 48 | 49 | return mainController.mainWindow; 50 | } 51 | }); 52 | 53 | // {/block} 54 | -------------------------------------------------------------------------------- /Adapter/PlentymarketsAdapter/ReadApi/Customer/Customer.php: -------------------------------------------------------------------------------- 1 | client->request('GET', 'accounts/contacts/' . $id); 17 | } 18 | 19 | /** 20 | * @param array $criteria 21 | * 22 | * @return array 23 | */ 24 | public function findAll(array $criteria = []): array 25 | { 26 | return $this->client->request('GET', 'accounts/contacts', $criteria); 27 | } 28 | 29 | /** 30 | * @param array $criteria 31 | * 32 | * @return array 33 | */ 34 | public function findBy(array $criteria = []): array 35 | { 36 | return $this->client->request('GET', 'accounts/contacts', $criteria); 37 | } 38 | 39 | /** 40 | * @param array $criteria 41 | * 42 | * @return array 43 | */ 44 | public function findOneBy(array $criteria = []): array 45 | { 46 | $result = $this->findBy($criteria); 47 | 48 | if (!empty($result)) { 49 | $result = array_shift($result); 50 | } 51 | 52 | return $result; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Components/Klarna/Plentymarkets/KlarnaRequestGenerator.php: -------------------------------------------------------------------------------- 1 | parentRequestGenerator = $parentRequestGenerator; 19 | } 20 | 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function generate(Payment $payment): array 25 | { 26 | $paymentParams = $this->parentRequestGenerator->generate($payment); 27 | $data = $payment->getPaymentData(); 28 | 29 | if (!($data instanceof KlarnaPaymentData)) { 30 | return $paymentParams; 31 | } 32 | 33 | $paymentParams['properties'][] = [ 34 | 'typeId' => 2, 35 | 'value' => $data->getTransactionId() . '_' . $data->getPclassId() . '_' . $data->getShopId(), 36 | ]; 37 | 38 | return $paymentParams; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Connector/Validator/Media/MediaValidator.php: -------------------------------------------------------------------------------- 1 | getIdentifier(), null, 'media.identifier'); 27 | 28 | Assertion::uuid($object->getMediaCategoryIdentifier(), null, 'media.mediaCategoryIdentifier'); 29 | 30 | Assertion::url($object->getLink(), null, 'media.content'); 31 | 32 | Assertion::nullOrNotBlank($object->getName(), null, 'media.name'); 33 | Assertion::nullOrNotBlank($object->getAlternateName(), null, 'media.name'); 34 | 35 | Assertion::allIsInstanceOf($object->getTranslations(), Translation::class, null, 'media.translations'); 36 | 37 | Assertion::allIsInstanceOf($object->getAttributes(), Attribute::class, null, 'media.attributes'); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Components/Bundle/Validator/BundleProduct/BundleProductValidator.php: -------------------------------------------------------------------------------- 1 | getNumber(), null, 'components.bundle.product.number'); 26 | Assertion::notEmpty($object->getNumber(), null, 'components.bundle.product.number'); 27 | 28 | Assertion::float($object->getAmount(), null, 'components.bundle.product.amount'); 29 | Assertion::greaterOrEqualThan($object->getAmount(), 0, null, 'components.bundle.product.amount'); 30 | 31 | Assertion::integer($object->getPosition(), null, 'components.bundle.product.position'); 32 | 33 | Assertion::allIsInstanceOf($object->getAttributes(), Attribute::class, null, 'components.bundle.product.attributes'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Connector/Validator/Product/Price/PriceValidator.php: -------------------------------------------------------------------------------- 1 | getPrice(), null, 'product.price.price'); 25 | Assertion::greaterOrEqualThan($object->getPrice(), 0.0, null, 'product.price.price'); 26 | Assertion::float($object->getPseudoPrice(), null, 'product.price.pseudoPrice'); 27 | Assertion::greaterOrEqualThan($object->getPseudoPrice(), 0.0, null, 'product.price.pseudoPrice'); 28 | Assertion::nullOrUuid($object->getCustomerGroupIdentifier(), null, 'product.price.customerGroupIdentifier'); 29 | Assertion::float($object->getFromAmount(), null, 'product.price.fromAmount'); 30 | Assertion::greaterThan($object->getFromAmount(), 0.0, null, 'product.price.fromAmount'); 31 | Assertion::nullOrFloat($object->getToAmount(), null, 'product.price.toAmount'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Connector/Validator/Mapping/MappingValidator.php: -------------------------------------------------------------------------------- 1 | getOriginAdapterName(), null, 'mapping.originAdapterName'); 26 | Assertion::notBlank($object->getOriginAdapterName(), null, 'mapping.originAdapterName'); 27 | Assertion::allIsInstanceOf($object->getOriginTransferObjects(), TransferObjectInterface::class, null, 'mapping.originTransferObjects'); 28 | 29 | Assertion::string($object->getDestinationAdapterName(), null, 'mapping.destinationAdapterName'); 30 | Assertion::notBlank($object->getDestinationAdapterName(), null, 'mapping.destinationAdapterName'); 31 | Assertion::allIsInstanceOf($object->getDestinationTransferObjects(), TransferObjectInterface::class, null, 'mapping.destinationTransferObjects'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Adapter/PlentymarketsAdapter/ReadApi/Payment/Payment.php: -------------------------------------------------------------------------------- 1 | client->request('GET', 'payments/' . $id); 18 | } 19 | 20 | /** 21 | * @param array $criteria 22 | * 23 | * @return Iterator 24 | */ 25 | public function findAll(array $criteria = []): Iterator 26 | { 27 | return $this->client->getIterator('payments', $criteria); 28 | } 29 | 30 | /** 31 | * @param array $criteria 32 | * 33 | * @return Iterator 34 | */ 35 | public function findBy(array $criteria = []): Iterator 36 | { 37 | return $this->client->getIterator('payments', $criteria); 38 | } 39 | 40 | /** 41 | * @param array $criteria 42 | * 43 | * @return array 44 | */ 45 | public function findOneBy(array $criteria = []): array 46 | { 47 | $result = iterator_to_array($this->findBy($criteria)); 48 | 49 | if (null !== $result) { 50 | $result = array_shift($result); 51 | } 52 | 53 | return $result; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Adapter/PlentymarketsAdapter/ResponseParser/PaymentMethod/PaymentMethodResponseParser.php: -------------------------------------------------------------------------------- 1 | identityService = $identityService; 19 | } 20 | 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function parse(array $entry) 25 | { 26 | // https://forum.plentymarkets.com/t/paymentmethods-fehlen-im-payment-methods-response/69372/8 27 | if ($entry['id'] === 6000) { 28 | $entry['id'] = 0; 29 | } 30 | 31 | $identity = $this->identityService->findOneOrCreate( 32 | (string) $entry['id'], 33 | PlentymarketsAdapter::NAME, 34 | PaymentMethod::TYPE 35 | ); 36 | 37 | return PaymentMethod::fromArray([ 38 | 'identifier' => $identity->getObjectIdentifier(), 39 | 'name' => $entry['name'], 40 | ]); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Adapter/ShopwareAdapter/DataProvider/CustomerGroup/CustomerGroupDataProvider.php: -------------------------------------------------------------------------------- 1 | repository = $entityManager->getRepository(Group::class); 19 | } 20 | 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function getCustomerGroupKeyByShopwareIdentifier($identifier) 25 | { 26 | /** 27 | * @var null|Group $group 28 | */ 29 | $group = $this->repository->find($identifier); 30 | 31 | if (null === $group) { 32 | return null; 33 | } 34 | 35 | return $group->getKey(); 36 | } 37 | 38 | /** 39 | * {@inheritdoc} 40 | */ 41 | public function getCustomerGroupByShopwareIdentifier($identifier) 42 | { 43 | /** 44 | * @var null|Group $group 45 | */ 46 | $group = $this->repository->find($identifier); 47 | 48 | if (null === $group) { 49 | return null; 50 | } 51 | 52 | return $group; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Adapter/ShopwareAdapter/DataPersister/Attribute/AttributeDataPersisterInterface.php: -------------------------------------------------------------------------------- 1 | transactionId; 26 | } 27 | 28 | /** 29 | * @param string $transactionId 30 | */ 31 | public function setTransactionId($transactionId) 32 | { 33 | $this->transactionId = $transactionId; 34 | } 35 | 36 | /** 37 | * @return string 38 | */ 39 | public function getKey(): string 40 | { 41 | return $this->key; 42 | } 43 | 44 | /** 45 | * @param string $key 46 | */ 47 | public function setKey($key) 48 | { 49 | $this->key = $key; 50 | } 51 | 52 | /** 53 | * {@inheritdoc} 54 | */ 55 | public function getClassProperties() 56 | { 57 | return [ 58 | 'transactionId' => $this->getTransactionId(), 59 | 'key' => $this->getKey(), 60 | ]; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Connector/TransferObject/Shop/Shop.php: -------------------------------------------------------------------------------- 1 | identifier; 35 | } 36 | 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function setIdentifier($identifier) 41 | { 42 | $this->identifier = $identifier; 43 | } 44 | 45 | /** 46 | * @return string 47 | */ 48 | public function getName(): string 49 | { 50 | return $this->name; 51 | } 52 | 53 | /** 54 | * @param string $name 55 | */ 56 | public function setName($name) 57 | { 58 | $this->name = $name; 59 | } 60 | 61 | /** 62 | * {@inheritdoc} 63 | */ 64 | public function getClassProperties() 65 | { 66 | return [ 67 | 'identifier' => $this->getIdentifier(), 68 | 'name' => $this->getName(), 69 | ]; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Connector/TransferObject/Unit/Unit.php: -------------------------------------------------------------------------------- 1 | identifier; 35 | } 36 | 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function setIdentifier($identifier) 41 | { 42 | $this->identifier = $identifier; 43 | } 44 | 45 | /** 46 | * @return string 47 | */ 48 | public function getName(): string 49 | { 50 | return $this->name; 51 | } 52 | 53 | /** 54 | * @param string $name 55 | */ 56 | public function setName($name) 57 | { 58 | $this->name = $name; 59 | } 60 | 61 | /** 62 | * {@inheritdoc} 63 | */ 64 | public function getClassProperties() 65 | { 66 | return [ 67 | 'identifier' => $this->getIdentifier(), 68 | 'name' => $this->getName(), 69 | ]; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Connector/TransferObject/Country/Country.php: -------------------------------------------------------------------------------- 1 | identifier; 35 | } 36 | 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function setIdentifier($identifier) 41 | { 42 | $this->identifier = $identifier; 43 | } 44 | 45 | /** 46 | * @return string 47 | */ 48 | public function getName(): string 49 | { 50 | return $this->name; 51 | } 52 | 53 | /** 54 | * @param string $name 55 | */ 56 | public function setName($name) 57 | { 58 | $this->name = $name; 59 | } 60 | 61 | /** 62 | * {@inheritdoc} 63 | */ 64 | public function getClassProperties() 65 | { 66 | return [ 67 | 'identifier' => $this->getIdentifier(), 68 | 'name' => $this->getName(), 69 | ]; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Connector/TransferObject/VatRate/VatRate.php: -------------------------------------------------------------------------------- 1 | identifier; 35 | } 36 | 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function setIdentifier($identifier) 41 | { 42 | $this->identifier = $identifier; 43 | } 44 | 45 | /** 46 | * @return string 47 | */ 48 | public function getName(): string 49 | { 50 | return $this->name; 51 | } 52 | 53 | /** 54 | * @param string $name 55 | */ 56 | public function setName($name) 57 | { 58 | $this->name = $name; 59 | } 60 | 61 | /** 62 | * {@inheritdoc} 63 | */ 64 | public function getClassProperties() 65 | { 66 | return [ 67 | 'identifier' => $this->getIdentifier(), 68 | 'name' => $this->getName(), 69 | ]; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Resources/Views/backend/plenty_connector/model/mapping/row.js: -------------------------------------------------------------------------------- 1 | // {namespace name=backend/plentyconnector/main} 2 | // {block name=backend/plentyconnector/model/mapping/row} 3 | 4 | Ext.define('Shopware.apps.PlentyConnector.model.mapping.Row', { 5 | extend: 'Ext.data.Model', 6 | 7 | fields: [ 8 | // {block name="backend/plentyconnector/model/mapping/row/fields"}{/block} 9 | { 10 | name: 'identifier', 11 | type: 'string' 12 | }, 13 | { 14 | name: 'name', 15 | type: 'string' 16 | }, 17 | { 18 | name: 'adapterName', 19 | type: 'string' 20 | }, 21 | { 22 | name: 'originIdentifier', 23 | type: 'string' 24 | }, 25 | { 26 | name: 'originName', 27 | type: 'string' 28 | }, 29 | { 30 | name: 'originAdapterName', 31 | type: 'string' 32 | }, 33 | { 34 | name: 'objectType', 35 | type: 'string' 36 | }, 37 | { 38 | name: 'remove', 39 | type: 'boolean' 40 | } 41 | ], 42 | 43 | idProperty: 'name', 44 | 45 | proxy: { 46 | type: 'ajax', 47 | 48 | api: { 49 | update: '{url action=updateIdentities}' 50 | }, 51 | 52 | reader: { 53 | type: 'json', 54 | root: 'data' 55 | } 56 | } 57 | }); 58 | 59 | // {/block} 60 | -------------------------------------------------------------------------------- /Connector/TransferObject/Currency/Currency.php: -------------------------------------------------------------------------------- 1 | identifier; 35 | } 36 | 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function setIdentifier($identifier) 41 | { 42 | $this->identifier = $identifier; 43 | } 44 | 45 | /** 46 | * @return string 47 | */ 48 | public function getName(): string 49 | { 50 | return $this->name; 51 | } 52 | 53 | /** 54 | * @param string $name 55 | */ 56 | public function setName($name) 57 | { 58 | $this->name = $name; 59 | } 60 | 61 | /** 62 | * {@inheritdoc} 63 | */ 64 | public function getClassProperties() 65 | { 66 | return [ 67 | 'identifier' => $this->getIdentifier(), 68 | 'name' => $this->getName(), 69 | ]; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Connector/TransferObject/Language/Language.php: -------------------------------------------------------------------------------- 1 | identifier; 35 | } 36 | 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function setIdentifier($identifier) 41 | { 42 | $this->identifier = $identifier; 43 | } 44 | 45 | /** 46 | * @return string 47 | */ 48 | public function getName(): string 49 | { 50 | return $this->name; 51 | } 52 | 53 | /** 54 | * @param string $name 55 | */ 56 | public function setName($name) 57 | { 58 | $this->name = $name; 59 | } 60 | 61 | /** 62 | * {@inheritdoc} 63 | */ 64 | public function getClassProperties() 65 | { 66 | return [ 67 | 'identifier' => $this->getIdentifier(), 68 | 'name' => $this->getName(), 69 | ]; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Connector/TransferObject/OrderStatus/OrderStatus.php: -------------------------------------------------------------------------------- 1 | identifier; 35 | } 36 | 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function setIdentifier($identifier) 41 | { 42 | $this->identifier = $identifier; 43 | } 44 | 45 | /** 46 | * @return string 47 | */ 48 | public function getName(): string 49 | { 50 | return $this->name; 51 | } 52 | 53 | /** 54 | * @param string $name 55 | */ 56 | public function setName($name) 57 | { 58 | $this->name = $name; 59 | } 60 | 61 | /** 62 | * {@inheritdoc} 63 | */ 64 | public function getClassProperties() 65 | { 66 | return [ 67 | 'identifier' => $this->getIdentifier(), 68 | 'name' => $this->getName(), 69 | ]; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Connector/Validator/Definition/DefinitionValidator.php: -------------------------------------------------------------------------------- 1 | getOriginAdapterName(), null, 'definition.originAdapterName'); 25 | Assertion::notBlank($object->getOriginAdapterName(), null, 'definition.originAdapterName'); 26 | 27 | Assertion::string($object->getDestinationAdapterName(), null, 'definition.destinationAdapterName'); 28 | Assertion::notBlank($object->getDestinationAdapterName(), null, 'definition.destinationAdapterName'); 29 | 30 | Assertion::string($object->getObjectType(), null, 'definition.objectType'); 31 | Assertion::notBlank($object->getObjectType(), null, 'definition.objectType'); 32 | 33 | Assertion::integer($object->getPriority(), null, 'definition.priority'); 34 | Assertion::greaterOrEqualThan($object->getPriority(), 0, null, 'definition.priority'); 35 | 36 | Assertion::boolean($object->isActive(), null, 'definition.active'); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /tests/Unit/Adapter/ShopwareAdapter/ResponseParser/Payment/PaymentResponseParserTest.php: -------------------------------------------------------------------------------- 1 | createMock(CurrencyDataProviderInterface::class); 28 | 29 | $logger = $this->createMock(LoggerInterface::class); 30 | 31 | $this->responseParser = new PaymentResponseParser( 32 | $this->identityService, 33 | $currencyDataProvider, 34 | $logger 35 | ); 36 | 37 | $this->validator = new PaymentValidator(); 38 | } 39 | 40 | public function testPayedOrderGeneratesPaymentTransferObject() 41 | { 42 | $payments = $this->responseParser->parse(self::$orderData); 43 | 44 | $this->assertCount(0, $payments); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Adapter/PlentymarketsAdapter/Helper/PropertyHelper.php: -------------------------------------------------------------------------------- 1 | identifier; 35 | } 36 | 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function setIdentifier($identifier) 41 | { 42 | $this->identifier = $identifier; 43 | } 44 | 45 | /** 46 | * @return string 47 | */ 48 | public function getName(): string 49 | { 50 | return $this->name; 51 | } 52 | 53 | /** 54 | * @param string $name 55 | */ 56 | public function setName($name) 57 | { 58 | $this->name = $name; 59 | } 60 | 61 | /** 62 | * {@inheritdoc} 63 | */ 64 | public function getClassProperties() 65 | { 66 | return [ 67 | 'identifier' => $this->getIdentifier(), 68 | 'name' => $this->getName(), 69 | ]; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Connector/TransferObject/MediaCategory/MediaCategory.php: -------------------------------------------------------------------------------- 1 | identifier; 35 | } 36 | 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function setIdentifier($identifier) 41 | { 42 | $this->identifier = $identifier; 43 | } 44 | 45 | /** 46 | * @return string 47 | */ 48 | public function getName(): string 49 | { 50 | return $this->name; 51 | } 52 | 53 | /** 54 | * @param string $name 55 | */ 56 | public function setName($name) 57 | { 58 | $this->name = $name; 59 | } 60 | 61 | /** 62 | * {@inheritdoc} 63 | */ 64 | public function getClassProperties() 65 | { 66 | return [ 67 | 'identifier' => $this->getIdentifier(), 68 | 'name' => $this->getName(), 69 | ]; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Connector/TransferObject/PaymentMethod/PaymentMethod.php: -------------------------------------------------------------------------------- 1 | identifier; 35 | } 36 | 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function setIdentifier($identifier) 41 | { 42 | $this->identifier = $identifier; 43 | } 44 | 45 | /** 46 | * @return string 47 | */ 48 | public function getName(): string 49 | { 50 | return $this->name; 51 | } 52 | 53 | /** 54 | * @param string $name 55 | */ 56 | public function setName($name) 57 | { 58 | $this->name = $name; 59 | } 60 | 61 | /** 62 | * {@inheritdoc} 63 | */ 64 | public function getClassProperties() 65 | { 66 | return [ 67 | 'identifier' => $this->getIdentifier(), 68 | 'name' => $this->getName(), 69 | ]; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Connector/TransferObject/PaymentStatus/PaymentStatus.php: -------------------------------------------------------------------------------- 1 | identifier; 35 | } 36 | 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function setIdentifier($identifier) 41 | { 42 | $this->identifier = $identifier; 43 | } 44 | 45 | /** 46 | * @return string 47 | */ 48 | public function getName(): string 49 | { 50 | return $this->name; 51 | } 52 | 53 | /** 54 | * @param string $name 55 | */ 56 | public function setName($name) 57 | { 58 | $this->name = $name; 59 | } 60 | 61 | /** 62 | * {@inheritdoc} 63 | */ 64 | public function getClassProperties() 65 | { 66 | return [ 67 | 'identifier' => $this->getIdentifier(), 68 | 'name' => $this->getName(), 69 | ]; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Connector/TransferObject/ShippingProfile/ShippingProfile.php: -------------------------------------------------------------------------------- 1 | identifier; 35 | } 36 | 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function setIdentifier($identifier) 41 | { 42 | $this->identifier = $identifier; 43 | } 44 | 45 | /** 46 | * @return string 47 | */ 48 | public function getName(): string 49 | { 50 | return $this->name; 51 | } 52 | 53 | /** 54 | * @param string $name 55 | */ 56 | public function setName($name) 57 | { 58 | $this->name = $name; 59 | } 60 | 61 | /** 62 | * {@inheritdoc} 63 | */ 64 | public function getClassProperties() 65 | { 66 | return [ 67 | 'identifier' => $this->getIdentifier(), 68 | 'name' => $this->getName(), 69 | ]; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Components/Klarna/DependencyInjection/services.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Subscriber/ControllerPathSubscriber.php: -------------------------------------------------------------------------------- 1 | template = $template; 28 | $this->pluginDirectory = $pluginDirectory; 29 | } 30 | 31 | /** 32 | * {@inheritdoc9 33 | */ 34 | public static function getSubscribedEvents(): array 35 | { 36 | return [ 37 | 'Enlight_Controller_Dispatcher_ControllerPath_Backend_PlentyConnector' => 'onControllerBackendPlentyConnector', 38 | ]; 39 | } 40 | 41 | /** 42 | * @param Enlight_Event_EventArgs $args 43 | * 44 | * @return string 45 | */ 46 | public function onControllerBackendPlentyConnector(Enlight_Event_EventArgs $args): string 47 | { 48 | $this->template->addTemplateDir( 49 | $this->pluginDirectory . '/Resources/Views/' 50 | ); 51 | 52 | return $this->pluginDirectory . '/Controller/Backend/PlentyConnector.php'; 53 | } 54 | } 55 | --------------------------------------------------------------------------------