-
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.
- Loading branch information
0 parents
commit a472721
Showing
142 changed files
with
3,865 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,9 @@ | ||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
charset = utf-8 | ||
indent_style = tab | ||
indent_size = 4 | ||
|
||
[**.{yml,yaml,yml.dist}] | ||
indent_style = space |
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,16 @@ | ||
|
||
/vendor/ | ||
/node_modules/ | ||
/composer.lock | ||
|
||
/etc/build/* | ||
!/etc/build/.gitkeep | ||
|
||
/tests/Application/yarn.lock | ||
|
||
docker-compose.override.yaml | ||
docker-compose.override.dist.yaml | ||
docker-compose.yaml | ||
/bin-docker/ | ||
/deploy/ | ||
/docker/ |
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,54 @@ | ||
language: php | ||
os: linux | ||
dist: trusty | ||
|
||
cache: | ||
yarn: true | ||
directories: | ||
- ~/.composer/cache/files | ||
- $SYLIUS_CACHE_DIR | ||
|
||
env: | ||
global: | ||
- APP_ENV=test | ||
- APP_SECRET=f686gsd5v1321 | ||
- SYLIUS_CACHE_DIR=$HOME/.sylius-cache | ||
- SYLIUS_BUILD_DIR=etc/build | ||
|
||
jobs: | ||
include: | ||
- | ||
php: 7.3 | ||
env: | ||
- SYLIUS_VERSION="1.7.*" | ||
|
||
before_install: | ||
- phpenv config-rm xdebug.ini | ||
- echo "memory_limit=4096M" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini | ||
- mkdir -p "${SYLIUS_CACHE_DIR}" | ||
|
||
install: | ||
- composer require "sylius/sylius:${SYLIUS_VERSION}" --no-interaction --no-update | ||
- composer update --no-interaction --prefer-dist | ||
- (cd tests/Application && yarn install) | ||
|
||
before_script: | ||
- (cd tests/Application && bin/console doctrine:database:create --env=test -vvv) | ||
- (cd tests/Application && bin/console doctrine:schema:create --env=test -vvv) | ||
- (cd tests/Application && bin/console assets:install public --env=test -vvv) | ||
- (cd tests/Application && bin/console cache:clear --env=test -vvv) | ||
- (cd tests/Application && yarn build) | ||
|
||
# Run webserver | ||
- (cd tests/Application && bin/console server:run 127.0.0.1:8080 -d web --env=test --quiet > /dev/null 2>&1 &) | ||
src/Model/CeskaPostaBalikomatyShipmentExporter: | ||
php: | ||
script: | ||
- composer validate --strict | ||
- ls -la tests/Application/var/cache/test | ||
- bin/phpstan.sh | ||
- bin/behat | ||
- bin/ecs.sh | ||
|
||
after_failure: | ||
- vendor/lakion/mink-debug-extension/travis/tools/upload-textfiles "${SYLIUS_BUILD_DIR}/*.log" |
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,13 @@ | ||
# CHANGELOG | ||
|
||
## v1.2 (2020-02-11) | ||
|
||
#### Details | ||
|
||
- Fixup export CSV | ||
|
||
## v1.1 (2020-02-11) | ||
|
||
#### Details | ||
|
||
- Fixup export CSV |
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,186 @@ | ||
<p align="center"> | ||
<a href="https://www.mangoweb.cz/en/" target="_blank"> | ||
<img src="https://avatars0.githubusercontent.com/u/38423357?s=200&v=4"/> | ||
</a> | ||
</p> | ||
<h1 align="center"> | ||
Česká Pošta Balíkomaty Plugin | ||
<br /> | ||
<a href="https://packagist.org/packages/mangoweb-sylius/sylius-ceska-posta-balikomaty-plugin" title="License" target="_blank"> | ||
<img src="https://img.shields.io/packagist/l/mangoweb-sylius/sylius-ceska-posta-balikomaty-plugin.svg" /> | ||
</a> | ||
<a href="https://packagist.org/packages/mangoweb-sylius/sylius-ceska-posta-balikomaty-plugin" title="Version" target="_blank"> | ||
<img src="https://img.shields.io/packagist/v/mangoweb-sylius/sylius-ceska-posta-balikomaty-plugin.svg" /> | ||
</a> | ||
<a href="https://travis-ci.org/mangoweb-sylius/SyliusCeskaPostaBalikomatyPlugin" title="Build status" target="_blank"> | ||
<img src="https://img.shields.io/travis/mangoweb-sylius/SyliusCeskaPostaBalikomatyPlugin/master.svg" /> | ||
</a> | ||
</h1> | ||
|
||
## Features | ||
|
||
- Adds shipment type *Česká Pošta Balíkomat* branch which allows sending ordered products to selected Česká Pošta Balíkomat branch. | ||
- The user can choose the Česká Pošta Balíkomat branch during checkout in the Shipment step. | ||
- See Česká Pošta Balíkomat branch in final checkout step and also in the admin panel. | ||
- Export CSV with the Česká Pošta Balíkomat shipments and import it easily into Česká Pošta Balíkomaty's system. | ||
|
||
## Installation | ||
|
||
1. Run `$ composer require mangoweb-sylius/sylius-ceska-posta-balikomaty-plugin`. | ||
1. Add plugin classes to your `config/bundles.php`: | ||
|
||
```php | ||
return [ | ||
... | ||
MangoSylius\ShipmentExportPlugin\MangoSyliusShipmentExportPlugin::class => ['all' => true], | ||
MangoSylius\SyliusCeskaPostaBalikomatyPlugin\MangoSyliusCeskaPostaBalikomatyPlugin::class => ['all' => true], | ||
]; | ||
``` | ||
|
||
1. Add resource to `config/packeges/_sylius.yaml` | ||
|
||
```yaml | ||
imports: | ||
... | ||
- { resource: "@MangoSyliusCeskaPostaBalikomatyPlugin/Resources/config/resources.yml" } | ||
``` | ||
1. Add routing to `config/_routes.yaml` | ||
|
||
```yaml | ||
mango_sylius_ceska_posta_balikomaty_plugin: | ||
resource: '@MangoSyliusCeskaPostaBalikomatyPlugin/Resources/config/routing.yml' | ||
prefix: /admin | ||
mango_sylius_shipment_export_plugin: | ||
resource: '@MangoSyliusShipmentExportPlugin/Resources/config/routing.yml' | ||
prefix: /admin | ||
``` | ||
|
||
1. Your Entity `Shipment` has to implement `\MangoSylius\SyliusCeskaPostaBalikomatyPlugin\Model\CeskaPostaBalikomatyShipmentInterface`. | ||
You can use the trait `\MangoSylius\SyliusCeskaPostaBalikomatyPlugin\Model\CeskaPostaBalikomatyShipmentTrait`. | ||
|
||
```php | ||
<?php | ||
declare(strict_types=1); | ||
namespace App\Entity\Shipping; | ||
use Doctrine\ORM\Mapping as ORM; | ||
use MangoSylius\SyliusCeskaPostaBalikomatyPlugin\Model\CeskaPostaBalikomatyShipmentInterface; | ||
use MangoSylius\SyliusCeskaPostaBalikomatyPlugin\Model\CeskaPostaBalikomatyShipmentTrait; | ||
use Sylius\Component\Core\Model\Shipment as BaseShipment; | ||
/** | ||
* @ORM\Entity | ||
* @ORM\Table(name="sylius_shipment") | ||
*/ | ||
class Shipment extends BaseShipment implements CeskaPostaBalikomatyShipmentInterface | ||
{ | ||
use CeskaPostaBalikomatyShipmentTrait; | ||
} | ||
``` | ||
|
||
1. Your Entity `ShippingMethod` has to implement `\MangoSylius\SyliusCeskaPostaBalikomatyPlugin\Model\CeskaPostaBalikomatyShipmentInterface`. | ||
You can use the trait `\MangoSylius\SyliusCeskaPostaBalikomatyPlugin\Model\CeskaPostaBalikomatyShipmentTrait`. | ||
|
||
```php | ||
<?php | ||
declare(strict_types=1); | ||
namespace App\Entity\Shipping; | ||
use Doctrine\ORM\Mapping as ORM; | ||
use MangoSylius\SyliusCeskaPostaBalikomatyPlugin\Model\CeskaPostaBalikomatyShippingMethodInterface; | ||
use MangoSylius\SyliusCeskaPostaBalikomatyPlugin\Model\CeskaPostaBalikomatyShippingMethodTrait; | ||
use Sylius\Component\Core\Model\ShippingMethod as BaseShippingMethod; | ||
/** | ||
* @ORM\Entity | ||
* @ORM\Table(name="sylius_shipping_method") | ||
*/ | ||
class ShippingMethod extends BaseShippingMethod implements CeskaPostaBalikomatyShippingMethodInterface | ||
{ | ||
use CeskaPostaBalikomatyShippingMethodTrait; | ||
} | ||
``` | ||
|
||
1. Include `@MangoSyliusCeskaPostaBalikomatyPlugin/Admin/ShippingMethod/_ceskaPostaBalikomatyForm.html.twig` into `@SyliusAdmin/ShippingMethod/_form.html.twig`. | ||
|
||
```twig | ||
... | ||
{{ include('@MangoSyliusCeskaPostaBalikomatyPlugin/Admin/ShippingMethod/_ceskaPostaBalikomatyForm.html.twig') }} | ||
... | ||
``` | ||
|
||
1. Include `@MangoSyliusCeskaPostaBalikomatyPlugin/Shop/Checkout/SelectShipping/_ceskaPostaBalikomatyChoice.html.twig` into `@SyliusShop/Checkout/SelectShipping/_choice.html.twig`. | ||
|
||
```twig | ||
... | ||
{{ include('@MangoSyliusCeskaPostaBalikomatyPlugin/Shop/Checkout/SelectShipping/_ceskaPostaBalikomatyChoice.html.twig') }} | ||
``` | ||
|
||
1. Replace `{% include '@SyliusShop/Common/_address.html.twig' with {'address': order.shippingAddress} %}` with `{{ include('@MangoSyliusCeskaPostaBalikomatyPlugin/Shop/Common/Order/_addresses.html.twig') }}` in `@SyliusShop/Common/Order/_addresses.html.twig` | ||
|
||
1. Replace `{% include '@SyliusAdmin/Common/_address.html.twig' with {'address': order.shippingAddress} %}` with `{{ include('@MangoSyliusCeskaPostaBalikomatyPlugin/Admin/Common/Order/_addresses.html.twig') }}` in `@SyliusAdmin/Order/Show/_addresses.html.twig` | ||
|
||
1. Override the template in `@MangoSyliusShipmentExportPlugin/_row.html.twig` | ||
```twig | ||
{% extends '@!MangoSyliusShipmentExportPlugin/_row.html.twig' %} | ||
{% block address %} | ||
{% if row.ceskaPostaBalikomat %} | ||
{{ include('@MangoSyliusCeskaPostaBalikomatyPlugin/_exporterRow.html.twig') }} | ||
{% else %} | ||
{{ parent() }} | ||
{% endif %} | ||
{% endblock %} | ||
``` | ||
|
||
1. Create and run doctrine database migrations. | ||
|
||
For the guide how to use your own entity see [Sylius docs - Customizing Models](https://docs.sylius.com/en/1.6/customization/model.html) | ||
|
||
## Usage | ||
|
||
* Create new shipping method in the admin panel and enable Česká Pošta Balíkomat, save it and click `Sync Česká Pošta Balíkomaty branches` button to load the list of branches into the current database. | ||
* Česká Pošta Balíkomaty CSV export will be generated for shipping method which has the code 'ceska_posta_balikomat', you can change this in parameters, it is an array. | ||
```yaml | ||
parameters: | ||
shippingMethodsCodes: ['ceska_posta_balikomat'] | ||
``` | ||
* Česká Pošta Balíkomaty branches are updated on their servers. Just call this command (via `cron`) once a day, ideally during the night. | ||
|
||
```bash | ||
mango:ceska-posta-balikomaty:sync | ||
``` | ||
|
||
## Development | ||
|
||
### Usage | ||
|
||
- Develop your plugin in `/src` | ||
- See `bin/` for useful commands | ||
|
||
### Testing | ||
|
||
|
||
After your changes you must ensure that the tests are still passing. | ||
|
||
```bash | ||
$ composer install | ||
$ bin/console doctrine:schema:create -e test | ||
$ bin/behat | ||
$ bin/phpstan.sh | ||
$ bin/ecs.sh | ||
``` | ||
|
||
License | ||
------- | ||
This library is under the MIT license. | ||
|
||
Credits | ||
------- | ||
Developed by [manGoweb](https://www.mangoweb.eu/). |
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,28 @@ | ||
imports: | ||
- vendor/sylius/sylius/src/Sylius/Behat/Resources/config/suites.yml | ||
- tests/Behat/Resources/suites.yml | ||
|
||
default: | ||
extensions: | ||
Lakion\Behat\MinkDebugExtension: | ||
directory: etc/build | ||
clean_start: false | ||
screenshot: true | ||
|
||
Behat\MinkExtension: | ||
base_url: "http://localhost:8080/" | ||
default_session: symfony | ||
sessions: | ||
symfony: | ||
symfony: ~ | ||
|
||
FriendsOfBehat\SymfonyExtension: | ||
bootstrap: tests/Application/config/bootstrap.php | ||
kernel: | ||
class: Tests\MangoSylius\SyliusCeskaPostaBalikomatyPlugin\Application\Kernel | ||
|
||
FriendsOfBehat\VariadicExtension: ~ | ||
|
||
FriendsOfBehat\SuiteSettingsExtension: | ||
paths: | ||
- "features" |
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 @@ | ||
../vendor/bin/behat |
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 @@ | ||
../tests/Application/bin/console |
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,12 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
IFS=$'\n\t' | ||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
# project root | ||
cd "$(dirname "$DIR")" | ||
|
||
set -x | ||
|
||
rm -rf tests/Application/var/cache/ | ||
vendor/bin/ecs check src tests "$@" |
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 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
IFS=$'\n\t' | ||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
# project root | ||
cd "$(dirname "$DIR")" | ||
|
||
set -x | ||
tests/Application/bin/console --env=test cache:warmup | ||
vendor/bin/phpstan analyse \ | ||
--level max \ | ||
--memory-limit 1G \ | ||
--configuration phpstan.neon \ | ||
src tests |
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 @@ | ||
../vendor/bin/phpunit |
Oops, something went wrong.