定制 webgriffe/sylius-nexi-plugin 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

webgriffe/sylius-nexi-plugin

Composer 安装命令:

composer require webgriffe/sylius-nexi-plugin

包简介

Nexi payment plugin for Sylius.

README 文档

README

Sylius Logo.

Sylius Nexi Plugin

The SyliusNexiPlugin provides an integration between Sylius and Nexi XPay payment gateway. This plugin implements the Hosted Payment Page integration method.

Note! This plugin is only compatible with the Nexi configuration which allows only one payment per request. It is therefore not possible to retry the payment several times on the Nexi checkout, so make sure that your Nexi gateway is configured to not allow payment retry (you'll have to ask to Nexi customer care for this)!

Installation

  1. Run:

    composer require webgriffe/sylius-nexi-plugin
  2. Add Webgriffe\SyliusNexiPlugin\WebgriffeSyliusNexiPlugin::class => ['all' => true] to your config/bundles.php.

    Normally, the plugin is automatically added to the config/bundles.php file by the composer require command. If it is not, you have to add it manually.

  3. Create a new file config/packages/webgriffe_sylius_nexi_plugin.yaml:

    imports:
        - { resource: "@WebgriffeSyliusNexiPlugin/config/config.php" }
  4. Import the routes needed. Add the following to your config/routes.yaml file:

    webgriffe_sylius_nexi_plugin_shop:
        resource: "@WebgriffeSyliusNexiPlugin/config/routes/shop.php"
        prefix: /{_locale}
        requirements:
            _locale: ^[A-Za-z]{2,4}(_([A-Za-z]{4}|[0-9]{3}))?(_([A-Za-z]{2}|[0-9]{3}))?$
    
    webgriffe_sylius_nexi_plugin_ajax:
        resource: "@WebgriffeSyliusNexiPlugin/config/routes/shop_ajax.php"
    
    sylius_shop_payum_cancel:
        resource: "@PayumBundle/Resources/config/routing/cancel.xml"
    

    NB: The file shop_routing needs to be after the prefix _locale, so that messages can be displayed in the right language. You should also include the cancel routes from the Payum bundle if you do not have it already!

  5. Run:

    php bin/console sylius:install:assets

Usage

Go in your Sylius admin panel and create a new payment method. Choose Nexi Gateway as the payment gateway and fill the required fields. You can also enable the Sandbox mode if you want to test the integration with the Nexi test environment.

Contributing

For a comprehensive guide on Sylius Plugins development please go to Sylius documentation, there you will find the Plugin Development Guide - it's a great place to start.

For more information about the Test Application included in the skeleton, please refer to the Sylius documentation.

Traditional

  1. From the plugin skeleton root directory, run the following commands:

    (cd vendor/sylius/test-application && yarn install)
    (cd vendor/sylius/test-application && yarn build)
    vendor/bin/console assets:install
    
    vendor/bin/console doctrine:database:create
    vendor/bin/console doctrine:migrations:migrate -n
    # Optionally load data fixtures
    vendor/bin/console sylius:fixtures:load -n

To be able to set up a plugin's database, remember to configure your database credentials in tests/TestApplication/.env and tests/TestApplication/.env.test.

  1. Run your local server:

    symfony server:ca:install
    symfony server:start -d
  2. Open your browser and navigate to https://localhost:8000.

Docker

  1. Execute make init to initialize the container and install the dependencies.

  2. Execute make database-init to create the database and run migrations.

  3. (Optional) Execute make load-fixtures to load the fixtures.

  4. Your app is available at http://localhost.

Usage

Running plugin tests

  • PHPUnit

    vendor/bin/phpunit
  • Behat (non-JS scenarios)

    vendor/bin/behat --strict --tags="~@javascript&&~@mink:chromedriver"
  • Behat (JS scenarios)

    1. Install Symfony CLI command.

    2. Start Headless Chrome:

    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
    1. Install SSL certificates (only once needed) and run test application's webserver on 127.0.0.1:8080:
    symfony server:ca:install
    APP_ENV=test symfony server:start --port=8080 --daemon
    1. Run Behat:
    vendor/bin/behat --strict --tags="@javascript,@mink:chromedriver"
  • Static Analysis

    • PHPStan

      vendor/bin/phpstan analyse -c phpstan.neon -l max src/  
    • Psalm

      vendor/bin/psalm
  • Coding Standard

    vendor/bin/ecs check

Opening Sylius with your plugin

  • Using test environment:

    APP_ENV=test vendor/bin/console vendor/bin/console sylius:fixtures:load -n
    APP_ENV=test symfony server:start -d
  • Using dev environment:

    vendor/bin/console vendor/bin/console sylius:fixtures:load -n
    symfony server:start -d

webgriffe/sylius-nexi-plugin 适用场景与选型建议

webgriffe/sylius-nexi-plugin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 36.96k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2021 年 04 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「sylius」 「sylius-plugin」 「nexi」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 webgriffe/sylius-nexi-plugin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 webgriffe/sylius-nexi-plugin 我们能提供哪些服务?
定制开发 / 二次开发

基于 webgriffe/sylius-nexi-plugin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 36.96k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 23
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-04-28