承接 dlds/yii2-payment 相关项目开发

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

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

dlds/yii2-payment

Composer 安装命令:

composer require dlds/yii2-payment

包简介

Library to handle payments with Estonian banks

README 文档

README

Library to handle payments with Estonian banks. Main features includes:

  • Payment service implemented with the following handlers: IPizza (Swedbank, SEB, LHV, Danske, Krediidipank), Estcard, Nordea
  • Object oriented and extensible code, you can easily add custom adapters
  • Generates payment forms from transaction objects
  • Handles bank post-back requests

This is a very basic "low-level" component for implementing payments. If you also need functionality for shopping baskets and orders, you might want to look at opus-online/yii2-ecom extension.

Installation

Just define the required package in your composer.json.

{
	"require": {
		"opus-online/yii2-payment": "*",
	}
}

Usage

Overwrite PaymentHandlerBase class and at least the method getConfiguration. Complement the two configuration files with your account details and locations of key and certificate files. You can just copy the files from under examples/config.

class MyPaymentHandler extends \dlds\payment\PaymentHandlerBase
{

    /**
     * Returns the configuration array
     */
    public function getConfiguration()
    {
        return [
            // common parameters for all adapters
            'common' => array(
                'returnRoute' => 'bankController/return',
            ),
            // adapter-specific parameters
            'adapters' => \yii\helpers\ArrayHelper::merge(require 'banks-default.php', require 'banks-local.php')
        ];
    }
}

Render all payment forms

// create the payment service
$service = MyPaymentHandler::createPaymentService();

// create a transaction object
$transaction = $service->createTransaction(1234, 234, ['comment' => 'Comment']);

// render the widget
echo \dlds\payment\widgets\PaymentWidget::widget([
    'forms' => $service->generateForms($transaction),
]);

Customize the payment form

The default implementation uses the widget dlds\payment\widgets\PaymentWidget. You can override and use this to use custom forms or elements.

class MyPaymentWidget extends PaymentWidget
{
    protected function generateSubmit(Form $form) {
        return Html::submitButton('MyCustomLabel');
    }
}

And then just render your customized widget instead of the default one (see the widget example above).

Receive return requests from the bank

$service = PaymentHandler::createPaymentService();
$response = $service->handleResponse($_REQUEST);

// re-generate the transaction object from the response
$transaction = $response->getTransaction();

if ($response->isSuccessful()) {
	// see the Transaction object for more details
	echo $transaction->getTransactionId();
}

Added cancelRoute and getCancelUrl() to AdapterAbstract to allow different redirecting after cancelling a payment

dlds/yii2-payment 适用场景与选型建议

dlds/yii2-payment 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.99k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2015 年 04 月 06 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 dlds/yii2-payment 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: proprietary
  • 更新时间: 2015-04-06