chore: prepare for release

This commit is contained in:
Olivier Lance
2021-02-04 00:57:45 +01:00
parent 83432947f1
commit 411cbde733
3 changed files with 99 additions and 291 deletions

126
README.md
View File

@@ -1,112 +1,54 @@
<p align="center">
<a href="https://sylius.com" target="_blank">
<img src="https://demo.sylius.com/assets/shop/img/logo.png" />
</a>
<img src="https://getalma.eu/static/website/new/img/logo.png" alt="logo alma" />
<img src="https://demo.sylius.com/assets/shop/img/logo.png" height="75" />
</p>
<h1 align="center">Plugin Skeleton</h1>
<h1 align="center">Sylius Alma Payment Plugin</h1>
<p align="center">Skeleton for starting Sylius plugins.</p>
<p align="center">Integrate Alma installments and pay later payments with your Sylius shop</p>
## Documentation
For a comprehensive guide on Sylius Plugins development please go to Sylius documentation,
there you will find the <a href="https://docs.sylius.com/en/latest/plugin-development-guide/index.html">Plugin Development Guide</a>, that is full of examples.
### Installation
Use Composer to install the plugin:
## Quickstart Installation
```
$ composer require alma/sylius-payment-plugin
```
1. Run `composer create-project sylius/plugin-skeleton ProjectName`.
Update your shop's translation catalogs:
2. From the plugin skeleton root directory, run the following commands:
```
$ php bin/console translation:update --dump-messages fr AlmaSyliusPaymentPlugin
$ php bin/console translation:update --dump-messages en AlmaSyliusPaymentPlugin
```
```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)
```
Finally, clear your cache:
To be able to setup a plugin's database, remember to configure you database credentials in `tests/Application/.env` and `tests/Application/.env.test`.
```
$ php bin/console cache:clear
```
## Usage
### 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.
### Running plugin tests
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).
- PHPUnit
### Usage
1. Go to the Payment Methods admin page and choose to create a new "Alma Payments" method
```bash
vendor/bin/phpunit
```
2. Grab your API keys [from your dashboard](https://dashboard.getalma.eu/api) and paste them into the appropriate fields
- PHPSpec
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.
```bash
vendor/bin/phpspec run
```
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.
- Behat (non-JS scenarios)
5. Choose a name for your method in the languages relevant to your shop.
```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)
```
6. You're done! Save the payment method to start accepting instalments payments on your shop!

View File

@@ -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 `<tag name="fob.context_service" />` tags from your Behat services
* Make your Behat services public by default with `<defaults public="true" />`
* Change `contexts_services ` in your suite definitions to `contexts`
* Take a look at [SymfonyExtension UPGRADE guide](https://github.com/FriendsOfBehat/SymfonyExtension/blob/master/UPGRADE-2.0.md) if you have any more problems
### Phpstan
* Fix the container XML path parameter in the `phpstan.neon` file as done [here](https://github.com/Sylius/PluginSkeleton/commit/37fa614dbbcf8eb31b89eaf202b4bd4d89a5c7b3)
# UPGRADE FROM `v1.2.X` TO `v1.4.0`
Firstly, check out the [PluginSkeleton 1.3 upgrade guide](https://github.com/Sylius/PluginSkeleton/blob/1.4/UPGRADE-1.3.md) to update Sylius version step by step.
To upgrade to Sylius 1.4 follow instructions from [the previous section](https://github.com/Sylius/PluginSkeleton/blob/1.4/UPGRADE-1.4.md#upgrade-from-v13x-to-v140) with following changes:
### Doctrine migrations
* Change namespaces of copied migrations to `Sylius\Migrations`
### Dotenv
* These changes are not required, but can be done as well, if you've changed application directory structure in `1.2.x` to `1.3` update
### Behat
* Add `\FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle()` to your bundles lists in `tests/Application/AppKernel.php` (preferably only in `test` environment)
* Import Sylius Behat services in `tests/Application/config/config_test.yml` and your own Behat services as well:
```yaml
imports:
- { resource: "../../../../vendor/sylius/sylius/src/Sylius/Behat/Resources/config/services.xml" }
```
* Specify test application's kernel path in `behat.yml`:
```yaml
FriendsOfBehat\SymfonyExtension:
kernel:
class: AppKernel
path: tests/Application/app/AppKernel.php
```
# UPGRADE FROM `v1.2.X` TO `v1.3.0`
## Application
* Run `composer require sylius/sylius:~1.3.0 --no-update`
* Add the following code in your `behat.yml(.dist)` file:
```yaml
default:
extensions:
FriendsOfBehat\SymfonyExtension:
env_file: ~
```
* Incorporate changes from the following files into plugin's test application:
* [`tests/Application/package.json`](https://github.com/Sylius/PluginSkeleton/blob/1.3/tests/Application/package.json) ([see diff](https://github.com/Sylius/PluginSkeleton/pull/134/files#diff-726e1353c14df7d91379c0dea6b30eef))
* [`tests/Application/.babelrc`](https://github.com/Sylius/PluginSkeleton/blob/1.3/tests/Application/.babelrc) ([see diff](https://github.com/Sylius/PluginSkeleton/pull/134/files#diff-a2527d9d8ad55460b2272274762c9386))
* [`tests/Application/.eslintrc.js`](https://github.com/Sylius/PluginSkeleton/blob/1.3/tests/Application/.eslintrc.js) ([see diff](https://github.com/Sylius/PluginSkeleton/pull/134/files#diff-396c8c412b119deaa7dd84ae28ae04ca))
* Update PHP and JS dependencies by running `composer update` and `(cd tests/Application && yarn upgrade)`
* Clear cache by running `(cd tests/Application && bin/console cache:clear)`
* Install assets by `(cd tests/Application && bin/console assets:install web)` and `(cd tests/Application && yarn build)`
* optionally, remove the build for PHP 7.1. in `.travis.yml`

View File

@@ -1,80 +1,68 @@
{
"name": "alma/sylius-installment-plugin",
"type": "sylius-plugin",
"keywords": [
"sylius",
"sylius-plugin"
],
"description": "Plugin allowing to pay with Alma",
"license": "MIT",
"require": {
"php": "^7.1",
"alma/alma-php-client": "^1.0",
"sylius/sylius": "1.6.9",
"ext-json": "*"
},
"conflict": {
"api-platform/core": ">=2.6.0"
},
"require-dev": {
"behat/behat": "^3.6.1",
"behat/mink-selenium2-driver": "^1.4",
"dmore/behat-chrome-extension": "^1.3",
"dmore/chrome-mink-driver": "^2.7",
"friends-of-behat/mink": "^1.8",
"friends-of-behat/mink-browserkit-driver": "^1.4",
"friends-of-behat/mink-extension": "^2.4",
"friends-of-behat/page-object-extension": "^0.3",
"friends-of-behat/suite-settings-extension": "^1.0",
"friends-of-behat/symfony-extension": "^2.1",
"friends-of-behat/variadic-extension": "^1.3",
"lakion/mink-debug-extension": "^1.2.3",
"phpspec/phpspec": "^6.1",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "0.12.25",
"phpstan/phpstan-doctrine": "0.12.13",
"phpstan/phpstan-strict-rules": "^0.12.0",
"phpstan/phpstan-webmozart-assert": "0.12.4",
"phpunit/phpunit": "^8.5",
"sensiolabs/security-checker": "^6.0",
"sylius-labs/coding-standard": "^3.1",
"symfony/browser-kit": "^4.4",
"symfony/debug-bundle": "^4.4|^5.0",
"symfony/dotenv": "^4.4|^5.0",
"symfony/intl": "^4.4|^5.0",
"symfony/web-profiler-bundle": "^4.4|^5.0",
"symfony/web-server-bundle": "^4.4|^5.0",
"vimeo/psalm": "3.11.4"
},
"autoload": {
"psr-4": {
"Alma\\SyliusPaymentPlugin\\": "src/",
"Tests\\Alma\\SyliusPaymentPlugin\\App\\": "tests/Application/src/",
"Tests\\Alma\\SyliusPaymentPlugin\\": "tests/"
}
},
"autoload-dev": {
"classmap": [
"tests/Application/Kernel.php"
]
},
"extra": {
"branch-alias": {
"dev-master": "1.8-dev"
}
},
"config": {
"sort-packages": true
},
"scripts": {
"post-install-cmd": [
"php bin/create_node_symlink.php"
],
"post-update-cmd": [
"php bin/create_node_symlink.php"
],
"post-create-project-cmd": [
"php bin/create_node_symlink.php"
]
"name": "alma/sylius-payment-plugin",
"type": "sylius-plugin",
"keywords": [
"alma",
"buy now pay later",
"bnpl",
"installments",
"payment",
"sylius",
"sylius-plugin"
],
"description": "Payment plugin to integrate Alma installments and pay later payments with your Sylius shop",
"license": "MIT",
"require": {
"php": "^7.1",
"alma/alma-php-client": "^1.0",
"sylius/sylius": "^1.6.9",
"ext-json": "*"
},
"require-dev": {
"behat/behat": "^3.6.1",
"behat/mink-selenium2-driver": "^1.4",
"dmore/behat-chrome-extension": "^1.3",
"dmore/chrome-mink-driver": "^2.7",
"friends-of-behat/mink": "^1.8",
"friends-of-behat/mink-browserkit-driver": "^1.4",
"friends-of-behat/mink-extension": "^2.4",
"friends-of-behat/page-object-extension": "^0.3",
"friends-of-behat/suite-settings-extension": "^1.0",
"friends-of-behat/symfony-extension": "^2.1",
"friends-of-behat/variadic-extension": "^1.3",
"lakion/mink-debug-extension": "^1.2.3",
"phpspec/phpspec": "^6.1",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "0.12.25",
"phpstan/phpstan-doctrine": "0.12.13",
"phpstan/phpstan-strict-rules": "^0.12.0",
"phpstan/phpstan-webmozart-assert": "0.12.4",
"phpunit/phpunit": "^8.5",
"sensiolabs/security-checker": "^6.0",
"sylius-labs/coding-standard": "^3.1",
"symfony/browser-kit": "^4.4",
"symfony/debug-bundle": "^4.4|^5.0",
"symfony/dotenv": "^4.4|^5.0",
"symfony/intl": "^4.4|^5.0",
"symfony/web-profiler-bundle": "^4.4|^5.0",
"symfony/web-server-bundle": "^4.4|^5.0",
"vimeo/psalm": "3.11.4"
},
"autoload": {
"psr-4": {
"Alma\\SyliusPaymentPlugin\\": "src/"
}
},
"autoload-dev": {
"classmap": [
"tests/Application/Kernel.php"
],
"psr-4": {
"Tests\\Alma\\SyliusPaymentPlugin\\App\\": "tests/Application/src/",
"Tests\\Alma\\SyliusPaymentPlugin\\": "tests/"
}
},
"config": {
"sort-packages": true
}
}