setono / sylius-miinto-plugin
Sylius integration with Miinto
Installs: 3 692
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 2
Type:sylius-plugin
Requires
- php: ^7.2
- ext-json: *
- nyholm/psr7: ^1.1
- psr/event-dispatcher: ^1.0
- psr/http-client: ^1.0
- sylius/sylius: ^1.3
- symfony/event-dispatcher: ^4.3 || ^5.0
- symfony/http-client: ^4.3 || ^5.0
- symfony/lock: ^4.3 || ^5.0
- symfony/messenger: ^4.3 || ^5.0
- symfony/workflow: ^4.3 || ^5.0
- thecodingmachine/safe: ^1.0
Requires (Dev)
- behat/behat: ^3.4
- behat/mink: ^1.7@dev
- behat/mink-browserkit-driver: ^1.3
- behat/mink-extension: ^2.2
- behat/mink-selenium2-driver: ^1.3
- ergebnis/composer-normalize: ^2.0
- friends-of-behat/page-object-extension: ^0.3
- friends-of-behat/suite-settings-extension: ^1.0
- friends-of-behat/symfony-extension: ^2.0
- friends-of-behat/variadic-extension: ^1.1
- lakion/mink-debug-extension: ^1.2.3
- phpspec/phpspec: ^5.0 || ^6.0
- phpstan/phpstan: ^0.11
- phpstan/phpstan-doctrine: ^0.11
- phpstan/phpstan-strict-rules: ^0.11
- phpstan/phpstan-webmozart-assert: ^0.11
- phpunit/phpunit: ^8.0
- roave/security-advisories: dev-master
- sensiolabs/security-checker: ^5.0
- sylius-labs/coding-standard: ^3.0
- symfony/browser-kit: ^3.4 || ^4.1
- symfony/debug-bundle: ^3.4 || ^4.1
- symfony/dotenv: ^4.2
- symfony/intl: ^3.4 || ^4.1
- symfony/web-profiler-bundle: ^3.4 || ^4.1
- symfony/web-server-bundle: ^3.4 || ^4.1
- thecodingmachine/phpstan-safe-rule: ^1.0@beta
This package is auto-updated.
Last update: 2024-11-15 22:36:35 UTC
README
Implements Miintos Order API into your Sylius store.
Installation
Step 1: Download the plugin
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
$ composer require setono/sylius-miinto-plugin
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Step 2: Enable the plugin
Then, enable the plugin by adding it to the list of registered plugins/bundles
in config/bundles.php
file of your project before (!) SyliusGridBundle
and FrameworkBundle
:
<?php # config/bundles.php return [ Setono\SyliusMiintoPlugin\SetonoSyliusMiintoPlugin::class => ['all' => true], // ... Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], Sylius\Bundle\GridBundle\SyliusGridBundle::class => ['all' => true], // ... ];
Step 3: Configure the plugin
# config/packages/_sylius.yaml imports: # ... - { resource: "@SetonoSyliusMiintoPlugin/Resources/config/app/config.yaml" } # ...
# config/routes/setono_sylius_miinto.yaml setono_sylius_miinto: resource: "@SetonoSyliusMiintoPlugin/Resources/config/routing.yaml"
Step 4: Update your database schema
$ php bin/console doctrine:migrations:diff $ php bin/console doctrine:migrations:migrate
Step 5: Input required configuration options
# config/packages/setono_sylius_miinto.yaml setono_sylius_miinto: product_variant_gtin_field: gtin miinto: username: '%env(MIINTO_USERNAME)%' password: '%env(MIINTO_PASSWORD)%'
The product_variant_gtin_field
configuration option is important, since this is the default way to match products
from Miinto with products in your store. It is used by the ProductVariantMapper.
If you haven't added a GTIN field to your variants, you can use the Barcode plugin.
If you don't use GTIN's you should override the ProductVariantMapper
service (setono_sylius_miinto.mapper.product_variant
) with your own implementation.
Sandbox configuration
When you want to use sandbox credentials, you should specify special endpoint URLs as well:
# config/packages/dev/setono_sylius_miinto.yaml setono_sylius_miinto: miinto: auth_endpoint: https://api-auth-sandbox.miinto.net resource_endpoint: https://api-order-sandbox.miinto.net
Step 6: Using asynchronous transport (optional, but recommended)
All commands in this plugin will extend the CommandInterface. Therefore you can route all commands easily by adding this to your Messenger config:
# config/packages/messenger.yaml framework: messenger: routing: # Route all command messages to the async transport # This presumes that you have already set up an 'async' transport 'Setono\SyliusMiintoPlugin\Message\Command\CommandInterface': async
Usage
The plugin works in a two phase manner: First it handles pending transfers telling Miinto which transfers to accept and which to decline. The next phase takes the accepted positions (orders) and converts these orders into Sylius orders.
The first command (phase one), which you should run every minute, is this one:
$ php bin/console setono:sylius-miinto:pending-transfers
The next one (phase two) will handle the orders. This command doesn't have to run as often. Every 5 or 10 minutes should be sufficient:
$ php bin/console setono:sylius-miinto:process-orders
Troubleshooting
-
You have requested a non-existent parameter "setono_sylius_miinto.model.order.class".
You defined plugin after
SyliusGridBundle
orFrameworkBundle
.