承接 idci/payment-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

idci/payment-bundle

最新稳定版本:v6.4.13

Composer 安装命令:

composer require idci/payment-bundle

包简介

Symfony payment bundle

README 文档

README

This Symfony bundle provide help for integrating payments solutions by the normalization of payment process thanks to gateways. Each used gateway must have a configuration to set its parameters.

Example controller :

<?php

$paymentContext = $this->paymentManager->createPaymentContextByAlias('stripe_test'); // raw alias

$payment = $paymentContext->createPayment([
    'item_id' => 5,
    'amount' => 500,
    'currency_code' => 'EUR',
]);

return $this->render('@IDCIPayment/payment.html.twig', [
    'view' => $paymentContext->buildHTMLView(),
]);

A list of commands is provided by this bundle to manage gateway configurations & transactions.

Installation

Add dependency in your composer.json file:

"require": {
    ...,
    "idci/payment-bundle": "^4.0",
}

Install this new dependency in your application using composer:

$ composer update

Enable bundle in your application kernel :

<?php
// config/bundles.php
return [
    // ...
    new IDCI\Bundle\PaymentBundle\IDCIPaymentBundle(),
];

Add this to your config.yml file

# config/packages/idci_payment.yaml
imports:
    - {resource: '@IDCIPaymentBundle/Resources/config/config.yml'}

# Enable monolog logging using event subscriber plugged on transaction state changes
idci_payment:
    enabled_logger_subscriber: true

(Optional) If you want to customize the payment logger, by defaults, it will output into main handler

# config/packages/monolog.yaml
monolog:
    handlers:
        # ...
        payment_log:
            type: stream
            path: "%kernel.logs_dir%/%kernel.environment%.log"
            channels: ['payment']

Install routes in your config/routes/idci_payment.yaml file:

# config/routes/idci_payment.yaml
idci_payment:
    resource: '@IDCIPaymentBundle/Resources/config/routing.yml'
    prefix:   /

idci_payment_api:
    resource: '@IDCIPaymentBundle/Resources/config/routing_api.yml'
    prefix:   /api

These tutorials may help you to personalize yourself this bundle:

Supported Gateways

For testing purpose:

Command

PaymentGatewayConfiguration
# To create a PaymentGatewayConfiguration
$ php bin/console app:payment-gateway-configuration:create

# To show the list of PaymentGatewayConfiguration
$ php bin/console app:payment-gateway-configuration:list

# To update a PaymentGatewayConfiguration
$ php bin/console app:payment-gateway-configuration:update

# To delete a PaymentGatewayConfiguration
$ php bin/console app:payment-gateway-configuration:delete
Transaction
# Remove all the aborted transaction created 1 day ago
$ php bin/console app:transaction:clean

Tests

Add test routing :

# config/routes/dev/idci_payment.yaml

_test_payment:
    resource: '@IDCIPaymentBundle/Resources/config/routing_test.yml'
    prefix:   /_test/

You can now test gateways on /_test/payment-gateway/select (be sure to have created one or more gateway configuration)

Resources

UML Diagram

UML Diagram

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 3
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-06-05