-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ migrate from fond-of-spryker (#193)
* ♻️ migrate fond-of-spryker/cart-validation * ♻️ migrate fond-of-spryker/company-user-carts-rest-api * ♻️ migrate fond-of-spryker/company-user-reference * ♻️ migrate from fond-of-spryker (#195) * ♻️ migrate fond-of-spryker/company-user-quote * ♻️ migrate fond-of-spryker/collaborative-cart * ♻️ migrate fond-of-spryker/company-business-unit-quote-connector * ♻️ migrate fond-of-spryker/company-user-reference-quote-connector
- Loading branch information
0 parents
commit 6fdb1a2
Showing
44 changed files
with
1,835 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
jobs: | ||
continous-integration: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php-versions: [ "8.0", "8.1", "8.2" ] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup PHP, with composer and extensions | ||
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
extensions: mbstring, dom, fileinfo, pgsql, json | ||
coverage: xdebug #optional | ||
- name: Get composer cache directory | ||
id: composercache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- name: Cache composer dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.composercache.outputs.dir }} | ||
# Use composer.json for key, if composer.lock is not committed. | ||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
- name: Install dependencies and run ci tasks | ||
run: make install ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.idea | ||
|
||
.DS_Store | ||
|
||
vendor | ||
composer.lock | ||
src/Generated | ||
src/Orm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2024-present FOND OF GmbH | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
.PHONY: install | ||
install: | ||
composer install | ||
|
||
.PHONY: phpcs | ||
phpcs: | ||
./vendor/bin/phpcs --standard=./vendor/spryker/code-sniffer/Spryker/ruleset.xml ./src/FondOfImpala/* ./tests/* | ||
|
||
.PHONY: phpcbf | ||
phpcbf: | ||
./vendor/bin/phpcbf --standard=./vendor/spryker/code-sniffer/Spryker/ruleset.xml ./src/FondOfImpala/* ./tests/* | ||
|
||
.PHONY: phpstan | ||
phpstan: | ||
./vendor/bin/phpstan --memory-limit=-1 analyse ./src/FondOfImpala | ||
|
||
.PHONY: codeception | ||
codeception: | ||
./vendor/bin/codecept run --env standalone | ||
|
||
.PHONY: ci | ||
ci: phpcs codeception phpstan | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -Rf composer.lock | ||
rm -Rf ./vendor | ||
find ./tests/_output/ -not -name .gitignore -delete | ||
rm -Rf src/Generated/* | ||
rm -Rf src/Orm/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# cart-validation | ||
[![CI](https://github.com/fond-of-impala/cart-validation/actions/workflows/main.yml/badge.svg)](https://github.com/fond-of-impala/cart-validation/actions/workflows/main.yml) | ||
[![license](https://img.shields.io/github/license/fond-of-impala/cart-validation.svg)](https://packagist.org/packages/fond-of-impala/cart-validation) | ||
|
||
Module was migrated from `fond-of-spryker/cart-validation`. | ||
|
||
## Installation | ||
|
||
``` | ||
composer require fond-of-impala/cart-validation | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
namespace: fond-of-impala/cart-validation | ||
|
||
suites: | ||
unit: | ||
path: . | ||
|
||
settings: | ||
shuffle: true | ||
lint: true | ||
|
||
bootstrap: _bootstrap.php | ||
|
||
paths: | ||
tests: tests | ||
output: tests/_output | ||
support: tests/_support | ||
data: tests/_data | ||
|
||
coverage: | ||
enabled: true | ||
include: | ||
- src/*.php | ||
|
||
modules: | ||
enabled: | ||
- \FondOfCodeception\Module\Spryker | ||
config: | ||
\FondOfCodeception\Module\Spryker: | ||
generate_transfer: false | ||
generate_map_classes: false | ||
generate_propel_classes: false | ||
generate_ide_auto_completion: false | ||
|
||
env: | ||
standalone: | ||
modules: | ||
config: | ||
\FondOfCodeception\Module\Spryker: | ||
generate_transfer: true | ||
generate_map_classes: true | ||
generate_propel_classes: true | ||
generate_ide_auto_completion: true | ||
monorepo: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"name": "fond-of-impala/cart-validation", | ||
"description": "Extend cart module.", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Markus Nörenberg", | ||
"email": "noerenberg.markus@gmail.com" | ||
} | ||
], | ||
"scripts": { | ||
"test": "make codeception", | ||
"phpcs": "make phpcs", | ||
"phpstan": "make phpstan" | ||
}, | ||
"require": { | ||
"php": ">=8.0", | ||
"fond-of-impala/allowed-product-quantity-cart-connector": "^1.0.0", | ||
"fond-of-impala/company-user-carts-rest-api": "^1.0.0", | ||
"spryker/carts-rest-api": "^5.0.0", | ||
"spryker/glossary-storage": "^1.0.0", | ||
"spryker/glue-application": "^1.0.0" | ||
}, | ||
"require-dev": { | ||
"fond-of-codeception/spryker": "*", | ||
"spryker/code-sniffer": "*", | ||
"spryker-sdk/phpstan-spryker": "*" | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true, | ||
"autoload": { | ||
"psr-4": { | ||
"FondOfImpala\\": "src/FondOfImpala/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"FondOfImpala\\": "tests/FondOfImpala/", | ||
"Generated\\": "src/Generated/", | ||
"Orm\\": "src/Orm/" | ||
} | ||
}, | ||
"config": { | ||
"allow-plugins": { | ||
"dealerdirect/phpcodesniffer-composer-installer": true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
parameters: | ||
level: 4 | ||
reportUnmatchedIgnoredErrors: false | ||
scanDirectories: | ||
- src/Orm/Zed | ||
- src/Generated | ||
ignoreErrors: | ||
- '#.* on an unknown class Generated\\(Client|Glue|Service|Yves|Zed)\\Ide\\AutoCompletion.*#' |
69 changes: 69 additions & 0 deletions
69
src/FondOfImpala/Glue/CartValidation/CartValidationDependencyProvider.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace FondOfImpala\Glue\CartValidation; | ||
|
||
use FondOfImpala\Glue\CartValidation\Dependency\Client\CartValidationToGlossaryStorageClientBridge; | ||
use FondOfImpala\Glue\CartValidation\Dependency\Client\CartValidationToLocaleClientBridge; | ||
use Spryker\Glue\Kernel\AbstractBundleDependencyProvider; | ||
use Spryker\Glue\Kernel\Container; | ||
|
||
class CartValidationDependencyProvider extends AbstractBundleDependencyProvider | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
public const CLIENT_GLOSSARY_STORAGE = 'CLIENT_GLOSSARY_STORAGE'; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
public const CLIENT_LOCALE = 'CLIENT_LOCALE'; | ||
|
||
/** | ||
* @param \Spryker\Glue\Kernel\Container $container | ||
* | ||
* @return \Spryker\Glue\Kernel\Container | ||
*/ | ||
public function provideDependencies(Container $container): Container | ||
{ | ||
$container = parent::provideDependencies($container); | ||
|
||
$container = $this->addGlossaryStorageClient($container); | ||
|
||
return $this->addLocaleClient($container); | ||
} | ||
|
||
/** | ||
* @param \Spryker\Glue\Kernel\Container $container | ||
* | ||
* @return \Spryker\Glue\Kernel\Container | ||
*/ | ||
protected function addGlossaryStorageClient(Container $container): Container | ||
{ | ||
$container[static::CLIENT_GLOSSARY_STORAGE] = static function (Container $container) { | ||
return new CartValidationToGlossaryStorageClientBridge( | ||
$container->getLocator()->glossaryStorage()->client(), | ||
); | ||
}; | ||
|
||
return $container; | ||
} | ||
|
||
/** | ||
* @param \Spryker\Glue\Kernel\Container $container | ||
* | ||
* @return \Spryker\Glue\Kernel\Container | ||
*/ | ||
protected function addLocaleClient(Container $container): Container | ||
{ | ||
$container[static::CLIENT_LOCALE] = static function (Container $container) { | ||
return new CartValidationToLocaleClientBridge( | ||
$container->getLocator()->locale()->client(), | ||
); | ||
}; | ||
|
||
return $container; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/FondOfImpala/Glue/CartValidation/CartValidationFactory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace FondOfImpala\Glue\CartValidation; | ||
|
||
use FondOfImpala\Glue\CartValidation\Dependency\Client\CartValidationToGlossaryStorageClientInterface; | ||
use FondOfImpala\Glue\CartValidation\Dependency\Client\CartValidationToLocaleClientInterface; | ||
use FondOfImpala\Glue\CartValidation\Processor\Translator\ValidationMessageTranslator; | ||
use FondOfImpala\Glue\CartValidation\Processor\Translator\ValidationMessageTranslatorInterface; | ||
use Spryker\Glue\Kernel\AbstractFactory; | ||
|
||
class CartValidationFactory extends AbstractFactory | ||
{ | ||
/** | ||
* @return \FondOfImpala\Glue\CartValidation\Processor\Translator\ValidationMessageTranslatorInterface | ||
*/ | ||
public function createValidationMessageTranslator(): ValidationMessageTranslatorInterface | ||
{ | ||
return new ValidationMessageTranslator( | ||
$this->getGlossaryStorageClient(), | ||
$this->getLocaleClient(), | ||
); | ||
} | ||
|
||
/** | ||
* @return \FondOfImpala\Glue\CartValidation\Dependency\Client\CartValidationToGlossaryStorageClientInterface | ||
*/ | ||
public function getGlossaryStorageClient(): CartValidationToGlossaryStorageClientInterface | ||
{ | ||
return $this->getProvidedDependency(CartValidationDependencyProvider::CLIENT_GLOSSARY_STORAGE); | ||
} | ||
|
||
/** | ||
* @return \FondOfImpala\Glue\CartValidation\Dependency\Client\CartValidationToLocaleClientInterface | ||
*/ | ||
public function getLocaleClient(): CartValidationToLocaleClientInterface | ||
{ | ||
return $this->getProvidedDependency(CartValidationDependencyProvider::CLIENT_LOCALE); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...ala/Glue/CartValidation/Dependency/Client/CartValidationToGlossaryStorageClientBridge.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace FondOfImpala\Glue\CartValidation\Dependency\Client; | ||
|
||
use Spryker\Client\GlossaryStorage\GlossaryStorageClientInterface; | ||
|
||
class CartValidationToGlossaryStorageClientBridge implements CartValidationToGlossaryStorageClientInterface | ||
{ | ||
/** | ||
* @var \Spryker\Client\GlossaryStorage\GlossaryStorageClientInterface | ||
*/ | ||
protected $glossaryStorageClient; | ||
|
||
/** | ||
* @param \Spryker\Client\GlossaryStorage\GlossaryStorageClientInterface $glossaryStorageClient | ||
*/ | ||
public function __construct(GlossaryStorageClientInterface $glossaryStorageClient) | ||
{ | ||
$this->glossaryStorageClient = $glossaryStorageClient; | ||
} | ||
|
||
/** | ||
* @param string $id | ||
* @param string $localeName | ||
* @param array $parameters | ||
* | ||
* @return string | ||
*/ | ||
public function translate(string $id, string $localeName, array $parameters = []): string | ||
{ | ||
return $this->glossaryStorageClient->translate($id, $localeName, $parameters); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
.../Glue/CartValidation/Dependency/Client/CartValidationToGlossaryStorageClientInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace FondOfImpala\Glue\CartValidation\Dependency\Client; | ||
|
||
interface CartValidationToGlossaryStorageClientInterface | ||
{ | ||
/** | ||
* @param string $id | ||
* @param string $localeName | ||
* @param array $parameters | ||
* | ||
* @return string | ||
*/ | ||
public function translate(string $id, string $localeName, array $parameters = []): string; | ||
} |
29 changes: 29 additions & 0 deletions
29
...FondOfImpala/Glue/CartValidation/Dependency/Client/CartValidationToLocaleClientBridge.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace FondOfImpala\Glue\CartValidation\Dependency\Client; | ||
|
||
use Spryker\Client\Locale\LocaleClientInterface; | ||
|
||
class CartValidationToLocaleClientBridge implements CartValidationToLocaleClientInterface | ||
{ | ||
/** | ||
* @var \Spryker\Client\Locale\LocaleClientInterface | ||
*/ | ||
protected $localeClient; | ||
|
||
/** | ||
* @param \Spryker\Client\Locale\LocaleClientInterface $localeClient | ||
*/ | ||
public function __construct(LocaleClientInterface $localeClient) | ||
{ | ||
$this->localeClient = $localeClient; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getCurrentLocale(): string | ||
{ | ||
return $this->localeClient->getCurrentLocale(); | ||
} | ||
} |
Oops, something went wrong.