sergiotropea/nexi-bundle

Nexi支付系统

安装: 46

依赖: 0

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 0

开放问题: 0

类型:symfony-bundle

dev-master 2020-04-29 15:12 UTC

This package is not auto-updated.

Last update: 2024-10-02 21:27:07 UTC


README

包含Nexi支付系统的Bundle,你可以找到服务和路由设置,可用于按钮 - 响应 - 取消 - 提交。
你可以覆盖DefaultController来提高和扩展新的功能。

以下Bundle结构

  • 控制器
    • DefaltController.php
  • 实体
    • Nexi.php
  • 资源
    • 视图
      • 默认
        • abort.html.twig
        • index.html.twig
        • response.html.twig

安装

步骤 1: 下载Bundle

打开命令行,进入你的项目目录,并执行以下命令以下载此Bundle的最新稳定版本

$ composer require sergiotropea/nexi-bundle dev-master

此命令需要你全局安装Composer,请参阅Composer文档的安装章节

步骤 2: 启用Bundle

然后,通过将其添加到项目中的app/AppKernel.php文件中注册的Bundle列表来启用Bundle

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new SergioTropea\NexiBundle\SergioTropeaNexiBundle(),
        );

        // ...
    }

    // ...
}

步骤 3: 路由

将任何路由的前缀插入到路由文件中

// app/config/routing.yml

// ...
nexi:
    resource: "@SergioTropeaNexiBundle/Resources/config/routing.yml"

步骤 4: 配置

将任何路由的前缀插入到路由文件中

// app/config/config.yml

// ...
sergio_tropea_nexi:
    environment: test #test or production
    url: <url_base>
    alias: <alias>
    key: <key>

步骤 4: 如何生成URL

将任何路由的前缀插入到路由文件中

// src/AppBundle/Controller/DefaultController.php
// ... 

    $nexiService = $this->get('sergio_tropea_nexi.nexi');

    //Mandatory
    $nexi = new Nexi();
    $nexi->setCodTrans("TEST_".time());
    $nexi->setDivisa("EUR");
    $nexi->setImporto(1200);
    
    //Optional
    

    dump($nexiService->generateUrl($nexi));