diff --git a/README.md b/README.md index d23faeb..67a4858 100644 --- a/README.md +++ b/README.md @@ -1,112 +1,54 @@
- - - + +
-Skeleton for starting Sylius plugins.
+Integrate Alma installments and pay later payments with your Sylius shop
## Documentation -For a comprehensive guide on Sylius Plugins development please go to Sylius documentation, -there you will find the Plugin Development Guide, that is full of examples. - -## Quickstart Installation - -1. Run `composer create-project sylius/plugin-skeleton ProjectName`. - -2. From the plugin skeleton root directory, run the following commands: - - ```bash - $ (cd tests/Application && yarn install) - $ (cd tests/Application && yarn build) - $ (cd tests/Application && APP_ENV=test bin/console assets:install public) - - $ (cd tests/Application && APP_ENV=test bin/console doctrine:database:create) - $ (cd tests/Application && APP_ENV=test bin/console doctrine:schema:create) - ``` - -To be able to setup a plugin's database, remember to configure you database credentials in `tests/Application/.env` and `tests/Application/.env.test`. - -## Usage - -### Running plugin tests - - - PHPUnit - - ```bash - vendor/bin/phpunit - ``` - - - PHPSpec - - ```bash - vendor/bin/phpspec run - ``` - - - Behat (non-JS scenarios) - - ```bash - vendor/bin/behat --strict --tags="~@javascript" - ``` - - - Behat (JS scenarios) - - 1. [Install Symfony CLI command](https://symfony.com/download). - - 2. Start Headless Chrome: - - ```bash - google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1 - ``` - - 3. Install SSL certificates (only once needed) and run test application's webserver on `127.0.0.1:8080`: - - ```bash - symfony server:ca:install - APP_ENV=test symfony server:start --port=8080 --dir=tests/Application/public --daemon - ``` - - 4. Run Behat: - - ```bash - vendor/bin/behat --strict --tags="@javascript" - ``` - - - Static Analysis - - - Psalm - - ```bash - vendor/bin/psalm - ``` - - - PHPStan - - ```bash - vendor/bin/phpstan analyse -c phpstan.neon -l max src/ - ``` - - - Coding Standard - - ```bash - vendor/bin/ecs check src - ``` - -### Opening Sylius with your plugin - -- Using `test` environment: - - ```bash - (cd tests/Application && APP_ENV=test bin/console sylius:fixtures:load) - (cd tests/Application && APP_ENV=test bin/console server:run -d public) - ``` - -- Using `dev` environment: - - ```bash - (cd tests/Application && APP_ENV=dev bin/console sylius:fixtures:load) - (cd tests/Application && APP_ENV=dev bin/console server:run -d public) - ``` +### Installation +Use Composer to install the plugin: + +``` +$ composer require alma/sylius-payment-plugin +``` + +Update your shop's translation catalogs: + +``` +$ php bin/console translation:update --dump-messages fr AlmaSyliusPaymentPlugin +$ php bin/console translation:update --dump-messages en AlmaSyliusPaymentPlugin +``` + +Finally, clear your cache: + +``` +$ php bin/console cache:clear +``` + +### Requirements +Alma currently accepts Euros only; make sure you activate your payment method on channels that use that currency, else +you won't see it at checkout. + +Your Alma payment methods will only show for eligible carts. Eligibility is mainly based on the purchased amount, which +by default should be between 100€ and 2000€; if you want those limits changed, you can talk to your sales representative +at Alma, or contact [support@getalma.eu](mailto:support@getalma.eu). + +### Usage +1. Go to the Payment Methods admin page and choose to create a new "Alma Payments" method + +2. Grab your API keys [from your dashboard](https://dashboard.getalma.eu/api) and paste them into the appropriate fields + +3. Choose the installments count to apply for this payment method. If you want to offer multiple installments counts to + your customers, you can create one Alma payment method per installments count. + +4. Set the API mode to Test if you want to first test the integration with a fake credit card, on your preproduction + servers for instance. + When you're ready for production, set the API mode to Live. + +5. Choose a name for your method in the languages relevant to your shop. + +6. You're done! Save the payment method to start accepting instalments payments on your shop! diff --git a/UPGRADE.md b/UPGRADE.md deleted file mode 100644 index 8c28fba..0000000 --- a/UPGRADE.md +++ /dev/null @@ -1,122 +0,0 @@ -# UPGRADE FROM `v1.3.X` TO `v1.4.0` - -First step is upgrading Sylius with composer - -- `composer require sylius/sylius:~1.4.0` - -### Test application database - -#### Migrations - -If you provide migrations with your plugin, take a look at following changes: - -* Change base `AbstractMigration` namespace to `Doctrine\Migrations\AbstractMigration` -* Add `: void` return types to both `up` and `down` functions - -#### Schema update - -If you don't use migrations, just run `(cd tests/Application && bin/console doctrine:schema:update --force)` to update the test application's database schema. - -### Dotenv - -* `composer require symfony/dotenv:^4.2 --dev` -* Follow [Symfony dotenv update guide](https://symfony.com/doc/current/configuration/dot-env-changes.html) to incorporate required changes in `.env` files structure. Remember - they should be done on `tests/Application/` level! Optionally, you can take a look at [corresponding PR](https://github.com/Sylius/PluginSkeleton/pull/156/) introducing these changes in **PluginSkeleton** (this PR also includes changes with Behat - see below) - -Don't forget to clear the cache (`tests/Application/bin/console cache:clear`) to be 100% everything is loaded properly. - -### Test application kernel - -The kernel of the test application needs to be replaced with this [file](https://github.com/Sylius/PluginSkeleton/blob/1.4/tests/Application/Kernel.php). -The location of the kernel is: `tests/Application/Kernel.php` (replace the content with the content of the file above). -The container cleanup method is removed in the new version and keeping it will cause problems with for example the `TagAwareAdapter` which will call `commit()` on its pool from its destructor. If its pool is `TraceableAdapter` with pool `ArrayAdapter`, then the pool property of `TraceableAdapter` will be nullified before the destructor is executed and cause an error. - ---- - -### Behat - -If you're using Behat and want to be up-to-date with our configuration - -* Update required extensions with `composer require friends-of-behat/symfony-extension:^2.0 friends-of-behat/page-object-extension:^0.3 --dev` -* Remove extensions that are not needed yet with `composer remove friends-of-behat/context-service-extension friends-of-behat/cross-container-extension friends-of-behat/service-container-extension --dev` -* Update your `behat.yml` - look at the diff [here](https://github.com/Sylius/Sylius-Standard/pull/322/files#diff-7bde54db60a6e933518d8b61b929edce) -* Add `SymfonyExtensionBundle` to your `tests/Application/config/bundles.php`: - ```php - return [ - //... - FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true, 'test_cached' => true], - ]; - ``` -* If you use our Travis CI configuration, follow [these changes](https://github.com/Sylius/PluginSkeleton/pull/156/files#diff-354f30a63fb0907d4ad57269548329e3) introduced in `.travis.yml` file -* Create `tests/Application/config/services_test.yaml` file with the following code and add these your own Behat services as well: - ```yaml - imports: - - { resource: "../../../vendor/sylius/sylius/src/Sylius/Behat/Resources/config/services.xml" } - ``` -* Remove all `__symfony__` prefixes in your Behat services -* Remove all `