Skip to content
No description, website, or topics provided.
PHP HTML JavaScript Gherkin CSS
Branch: master
Clone or download
patrick477 Merge pull request #7 from gndk/gndk-readme-install-theme-assets
Add to docs: Install theme assets if using a theme
Latest commit 87dd590 Jul 8, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc Initial commit Apr 19, 2019
etc/build
features/admin Initial commit Apr 19, 2019
spec Initial commit Apr 19, 2019
src Initial commit Apr 19, 2019
tests Initial commit Apr 19, 2019
.gitignore Initial commit Apr 19, 2019
.travis.yml
LICENSE Create LICENSE May 7, 2019
README.md Merge pull request #7 from gndk/gndk-readme-install-theme-assets Jul 8, 2019
UPGRADE-1.3.md Initial commit Apr 19, 2019
UPGRADE-1.4.md Initial commit Apr 19, 2019
behat.yml.dist Initial commit Apr 19, 2019
composer.json Update composer.json Jun 7, 2019
easy-coding-standard.yml Initial commit Apr 19, 2019
node_modules Initial commit Apr 19, 2019
package-lock.json Initial commit Apr 19, 2019
phpspec.yml.dist Initial commit Apr 19, 2019
phpstan.neon Initial commit Apr 19, 2019
phpunit.xml.dist Initial commit Apr 19, 2019
yarn-error.log Initial commit Apr 19, 2019

README.md


Support

You can order our support on this page.

We work on amazing eCommerce projects on top of Sylius and Pimcore. Need some help or additional resources for a project? Write us an email on mikolaj.krol@bitbag.pl or visit our website! 🚀

BitBag SyliusAmazonPayPlugin

This plugin allows you to integrate AmazonPay payment with Sylius platform app.

Installation

  1. Require plugin with composer:

     $ composer require bitbag/amazon-pay-plugin
  2. Add plugin class to your bundles.php file:

       $bundles = [
           BitBag\SyliusAmazonPayPlugin\BitBagSyliusAmazonPayPlugin::class => ['all' => true],
       ];
    
  3. Import routing on top of your config/routes.yaml file:

    bitbag_sylius_amazon_pay_plugin:
        resource: "@BitBagSyliusAmazonPayPlugin/Resources/config/routing.yml"
        prefix: /
  4. Add routing to sylius_shop.yml:

    sylius_shop_checkout_start:
       path: /{_locale}/checkout-start
       methods: [GET]
       defaults:
           _controller: bitbag_sylius_amazon_pay_plugin.controller.action.checkout_start
       requirements:
           _locale: ^[a-z]{2}(?:_[A-Z]{2})?$  
  5. Install assets:

     bin/console assets:install --symlink
  6. Install theme assets (only if using a theme):

     bin/console sylius:theme:assets:install
  7. Clear cache:

     bin/console cache:clear

Change the order of steps in the checkout

Add checkout resolver to _sylius.yml:

sylius_shop:
    checkout_resolver:
       pattern: /checkout/.+
       route_map:
           empty_order:
               route: sylius_shop_cart_summary
           cart:
               route: sylius_shop_checkout_address
           addressed:
               route: sylius_shop_checkout_select_payment
           payment_selected:
               route: sylius_shop_checkout_select_shipping
           payment_skipped:
               route: sylius_shop_checkout_select_shipping
           shipping_selected:
               route: sylius_shop_checkout_complete
           shipping_skipped:
               route: sylius_shop_checkout_complete

Add state machine in _sylius.yml:

winzou_state_machine:
    sylius_order_checkout:
       transitions:
           select_payment:
               from: [payment_selected, shipping_skipped, shipping_selected, addressed]
               to: payment_selected
           complete:
               from: [payment_selected, payment_skipped, shipping_selected, shipping_skipped]
               to: completed

Cron job

Cron refreshes the status of AmazonPay

for example:

*/5 * * * * bin/console bitbag:amazon-pay:update-payment-state

Fixtures

Example fixture configuration:

sylius_fixtures:
    suites:
        default:
            fixtures:
                payment_method:
                    options:
                        custom:
                            amazon_pay:
                                code: "amazon_pay"
                                name: "Amazon pay"
                                channels:
                                    - "US_WEB"
                                enabled: true
                                gatewayFactory: amazonpay
                                gatewayName: Amazon pay
                                gatewayConfig:
                                    payum.http_client: '@bitbag.sylius_amazon_pay_plugin.amazon_pay_api_client'
                                    buttonColor: Gold
                                    buttonSize: Large
                                    buttonType: PwA
                                    buttonLanguage: de-DE
                                    environment: sandbox
                                    merchantId: "test" 
                                    accessKey: "test"
                                    secretKey: "test"
                                    clientId: "test"
                                    region: de

Testing

$ composer install
$ cd tests/Application
$ yarn install
$ yarn run gulp
$ bin/console assets:install web -e test
$ bin/console doctrine:database:create -e test
$ bin/console doctrine:schema:create -e test
$ bin/console server:run 127.0.0.1:8080 -d web -e test
$ open http://localhost:8080
$ bin/behat
$ bin/phpspec run
You can’t perform that action at this time.