diff --git a/README.md b/README.md index f9db0f38..0e6fabca 100644 --- a/README.md +++ b/README.md @@ -86,19 +86,19 @@ This **open-source plugin was developed to help the Sylius community** and make We work on stable, supported and up-to-date versions of packages. We recommend you to do the same. -| Package | Version | -| --- |--------------------| -| PHP | ^8.0 | -| ext-json: | * | -| sylius/refund-plugin | ^1.0.0 | +| Package | Version | +|------------------------|--------------------| +| PHP | ^8.0 | +| ext-json: | * | +| sylius/refund-plugin | ^1.0.0 | | sylius/resource-bundle | ^1.8 | -| sylius/sylius | ~1.12.0 or ~1.13.0 | -| symfony/messenger | ^5.4 or ^6.0 | -| adyen/php-api-library | ^11.0 | +| sylius/sylius | ~1.12.0 or ~1.13.0 | +| symfony/messenger | ^5.4 or ^6.0 | +| adyen/php-api-library | ^11.0 | ---- -For the full installation guide please go to [installation](doc/installation.md) +For the full installation guide please go to [Installation guide](doc/installation.md). ## Customization ---- diff --git a/doc/installation.md b/doc/installation.md index 3c9cf506..c696b1cd 100644 --- a/doc/installation.md +++ b/doc/installation.md @@ -1,22 +1,53 @@ -## Installation - -1. Complete [refund plug-in](https://github.com/Sylius/RefundPlugin) installation steps - -2. Require with composer - +# Installation + +## Overview: +GENERAL +- [Requirements](#requirements) +- [Composer](#composer) +- [Basic configuration](#basic-configuration) +--- +FRONTEND +- [Templates](#templates) +- [Webpack](#webpack) +--- +ADDITIONAL +- [Additional configuration](#additional-configuration) +- [Known Issues](#known-issues) +--- + +## Requirements: +### Installed BitBagRefundPlugin +Complete installation instructions for the BitBagRefundPlugin can be found here: + +- [BitBagRefundPlugin installation](https://github.com/Sylius/RefundPlugin) + +We work on stable, supported and up-to-date versions of packages. We recommend you to do the same. + +| Package | Version | +|---------------|-----------------| +| PHP | \>8.0 | +| sylius/sylius | 1.12.x - 1.13.x | +| MySQL | \>= 5.7 | +| NodeJS | \>= 18.x | + +## Composer: ```bash composer require bitbag/sylius-adyen-plugin --no-scripts ``` -3. When using Symfony flex the proper bundle class will be automatically registered in your bundles.php file. Otherwise, add it to your `config/bundles.php` file: + +## Basic configuration: +Add plugin dependencies to your `config/bundles.php` file: ```php +# config/bundles.php + return [ - // ... + ... BitBag\SyliusAdyenPlugin\BitBagSyliusAdyenPlugin::class => ['all' => true], ]; ``` -4. Import required config in your `config/packages/_sylius.yaml` file: +Import required config in your `config/packages/_sylius.yaml` file: ```yaml # config/packages/_sylius.yaml @@ -26,8 +57,17 @@ imports: - { resource: "@BitBagSyliusAdyenPlugin/Resources/config/config.yaml" } ``` -5. Import the routing in your `config/routes.yaml` file: +Add Adyen payment method as a supported refund gateway in `config/packages/_sylius.yaml`: +```yaml +# config/packages/_sylius.yaml + +parameters: + sylius_refund.supported_gateways: + - offline + - adyen +``` +Import routing in your `config/routes.yaml` file: ```yaml # config/routes.yaml @@ -35,9 +75,10 @@ bitbag_sylius_adyen_plugin: resource: "@BitBagSyliusAdyenPlugin/Resources/config/routing.yaml" ``` -6. Add logging to your environment in config/packages/{dev, prod, staging}/monolog.yaml - +Add logging to your environment in config/packages/{dev, prod, staging}/monolog.yaml ```yaml +# config/packages/{dev, prod, staging}/monolog.yaml + monolog: channels: [adyen] handlers: # Add alongside other handlers you might have @@ -47,56 +88,58 @@ monolog: id: bitbag.sylius_adyen_plugin.logging.monolog.doctrine_handler ``` -7. Add Adyen payment method as a supported refund gateway in `config/packages/_sylius.yaml` - -```yaml -# config/packages/_sylius.yaml - - parameters: - sylius_refund.supported_gateways: - - offline - - adyen +### Update your database +First, please run legacy-versioned migrations by using command: +```bash +bin/console doctrine:migrations:migrate ``` -8. Configure config/packages/webpack_encore.yaml -```yaml - builds: - *: * - shop: '%kernel.project_dir%/public/build/shop' - admin: '%kernel.project_dir%/public/build/admin' +After migration, please create a new diff migration and update database: +```bash +bin/console doctrine:migrations:diff +bin/console doctrine:migrations:migrate ``` +### Clear application cache by using command: +```bash +bin/console cache:clear +``` +**Note:** If you are running it on production, add the `-e prod` flag to this command. -9. Copy Sylius templates overridden by plug-in to your templates directory (`templates/bundles/`): +## Templates +Copy required templates into correct directories in your project. +**AdminBundle** (`templates/bundles/SyliusAdminBundle`): ``` -mkdir -p templates/bundles/SyliusAdminBundle/ -mkdir -p templates/bundles/SyliusShopBundle/ - -cp -R vendor/bitbag/sylius-adyen-plugin/tests/Application/templates/bundles/SyliusAdminBundle/* templates/bundles/SyliusAdminBundle/ -cp -R vendor/bitbag/sylius-adyen-plugin/tests/Application/templates/bundles/SyliusShopBundle/* templates/bundles/SyliusShopBundle/ +vendor/bitbag/sylius-adyen-plugin/tests/Application/templates/bundles/SyliusAdminBundle/Order/Show/_payment.html.twig +vendor/bitbag/sylius-adyen-plugin/tests/Application/templates/bundles/SyliusAdminBundle/Order/Show/_payments.html.twig ``` -10. Execute migrations - +**ShopBundle** (`templates/bundles/SyliusShopBundle`): ``` -bin/console doctrine:migrations:migrate +vendor/bitbag/sylius-adyen-plugin/tests/Application/templates/bundles/SyliusShopBundle/Checkout/Complete/_navigation.html.twig +vendor/bitbag/sylius-adyen-plugin/tests/Application/templates/bundles/SyliusShopBundle/Checkout/SelectPayment/_payment.html.twig ``` -11. Install assets - -``` +Install assets: +```bash bin/console assets:install ``` -12. Clear cache - -``` -bin/console cache:clear +## Webpack +### Run commands +```bash +yarn install +yarn encore dev # or prod, depends on your environment ``` -**Note:** If you are running it on production, add the `-e prod` flag to this command. - -13. [Obtain Adyen credentials and configure the payment method](configuration.md) +## Additional configuration +- [Obtain Adyen credentials and configure the payment method](https://github.com/BitBagCommerce/SyliusAdyenPlugin/blob/master/doc/configuration.md) +If you want to access the log page, visit /adyen/log. -14. If you want to access the log page, visit /adyen/log. +## Known issues +### Translations not displaying correctly +For incorrectly displayed translations, execute the command: +```bash +bin/console cache:clear +```