承接 slm/ideal-payment 相关项目开发

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

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

slm/ideal-payment

Composer 安装命令:

composer require slm/ideal-payment

包简介

Payment module for the Dutch iDEAL payment system

关键字:

README 文档

README

Build Status Latest Stable Version

Created by Jurian Sluiman

Introduction

SlmIdealPayment is a Zend Framework 2 module to provide payments via the iDEAL system. iDEAL is a payment service for the Dutch market and allows integration of payments for almost all Dutch banks.

The module provides integration for the so-called iDEAL professional / iDEAL advanced method. Integration via iDEAL basic / iDEAL lite is not included.

Standalone usage: This module is developed for Zend Framework 2, but can be used without the framework in your own application. There is no need to understand Zend Framework 2 to use this module.

Supported acquirers

SlmIdealPayment works with the following banks (or acquirers in iDEAL terms):

  1. Rabobank
  2. ING Bank
  3. ABN Amro

Installation

The module can be loaded via composer. Require slm/ideal-payment in your composer.json file. If you do not have a composer.json file in the root of your project, copy the contents below and put that into a file called composer.json and save it in the root of your project:

{
    "require": {
        "slm/ideal-payment": "@beta"
    }
}

Then execute the following commands in a CLI:

curl -s http://getcomposer.org/installer | php
php composer.phar install

Now you should have a vendor directory, including a slm/ideal-payment. In your bootstrap code, make sure you include the vendor/autoload.php file to properly load the SlmIdealPayment module.

Configuration

The file slmidealpayment.local.php.dist eases the iDEAL configuration. Copy the file from vendor/slm/ideal-payment/config/slmidealpayment.local.php.dist to your autoload folder and remove the .dist extension.

Open the file and update the values to your needs. If you do not have a SSL certificate, you can use a self-signed certificate and upload that one to the iDEAL dashboard of your acquirer. Generate a key with 2048 bits encryption with the following command:

openssl genrsa –aes128 –out priv.pem –passout pass:[privateKeyPass] 2048

Then create a certificate valid for 5 years:

openssl req –x509 –sha256 –new –key priv.pem –passin pass:[privateKeyPass]
-days 1825 –out cert.cer

Then use the priv.pem and cert.cer files for the iDEAL signatures.

Usage

SlmIdealPayments will setup the client with the correct properties. Use the following names to request an instance from the service manager:

  1. Rabobank: SlmIdealPayment\Client\Standard\Rabobank
  2. ING Bank: SlmIdealPayment\Client\Standard\Ing
  3. ABN Amro: SlmIdealPayment\Client\Standard\AbnAmro

Directory request

Then use the client to perform the request. A directory request gives a list of supported issuers. The result is a SlmIdealPayment\Response\DirectoryResponse:

$client = $sl->get('SlmIdealPayment\Client\Standard\Rabobank');

$request  = new DirectoryRequest;
$response = $client->send($request);

foreach ($response->getCountries() as $country) {
    echo sprintf("Country: %s\n", $country->getName());

    foreach ($country->getIssuers() as $issuer) {
        echo sprintf("%s: %s\n", $issuer->getId(), $issuer->getName());
    }
}

Transaction request

A transaction request needs a Transaction object. The result is a SlmIdealPayment\Response\TransactionResponse object:

use SlmIdealPayment\Model;

$client = $sl->get('SlmIdealPayment\Client\Standard\Rabobank');

// Set up the issuer
$issuer = new Model\Issuer;
$issuer->setId($issuerId); // set selected issuer here

// Set up the transaction
$transaction = new Model\Transaction;
$transaction->setPurchaseId($purchaseId);
$transaction->setAmount($amount);
$transaction->setDescription($description);
$transaction->setEntranceCode($ec);

$request  = new TransactionRequest;
$request->setIssuer($issuer);
$request->setTransaction($transaction);

$response = $client->send($request);

echo $response->getTransaction()->getTransactionId();

// Then perform redirect:
// Redirect to $response->getAuthenticationUrl();

Status request

A status request also needs a transaction object, but then for its transaction id. The result is a SlmIdealPayment\Response\StatusRequest:

use SlmIdealPayment\Model;

$client = $sl->get('SlmIdealPayment\Client\Standard\Rabobank');

$transaction = new Model\Transaction;
$transaction->setTransactionId($transactionId);

$request  = new StatusRequest;
$request->setTransaction($transaction);

$response = $client->send($request);

echo $response->getTransaction()->getStatus();

Using SlmIdealPayment outside ZF2

You can use the client without Zend Framework 2. Only the HTTP client is used inside the client and it's a small dependency you can load in any project you have. However, you need to configure all variables yourself.

use SlmIdealPayment\Client\StandardClient;
use SlmIdealPayment\Options\StandardClientOptions;

$options = new StandardClientOptions;
$options->setRequestUrl('https://ideal.rabobank.nl/ideal/iDEALv3');
$options->setMerchantId('00X0XXXXX');
$options->setSubId('0');

$options->setPublicCertificate('data/ssl/rabobank.cer');
$options->setPrivateCertificate('data/ssl/cert.cer');

$options->setKeyFile('data/ssl/priv.pem');
$options->setKeyPassword('h4x0r');

$client = new StandardClient($options);

Now $client is configured, use above methods to perform the various requests.

slm/ideal-payment 适用场景与选型建议

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

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 9
  • Watchers: 3
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2012-12-06