deruwe/atos-sips
Composer 安装命令:
composer require deruwe/atos-sips
包简介
README 文档
README
This library allows you to easily implement a [Sips] integration into your project. It provides the necessary components to complete a correct payment flow with the [Sips] platform.
Requirements:
- PHP 5.3
- network connection between your webserver and the Sips platform
The SIPS platform can be reached through the following URL's:
- SIMU: https://payment-webinit.simu.sips-atos.com/paymentInit
- TEST: https://payment-webinit.test.sips-atos.com/paymentInit
- PRODUCTION: https://payment-webinit.sips-atos.com/paymentInit
Overview
The library complies to the PSR-0 standard, so it can be autoloaded using PSR-0 classloaders like the one in Symfony2. See autoload.php for an example.
The library supports the use of Composer.
- Create a PaymentRequest, containing all the info needed by Sips.
- Submit it to Sips (client side)
- Receive a PaymentResponse back from Sips (as a HTTP Request)
Both PaymentRequest and PaymentResponse are authenticated by comparing the SHA sign, which is a hash of the parameters and a secret passphrase. You can create the hash using a ShaComposer.
SHA Composer
Sips method to generate a SHA sign:
-
"Each parameter followed by the passphrase" This method requires you to use the following encryption method: SHA-256.
Implementation using this library is trivial:
<?php use Sips\ShaComposer\AllParametersShaComposer; $shaComposer = new AllParametersShaComposer($passphrase);
PaymentRequest
<?php use Sips\Passphrase; use Sips\PaymentRequest; $passphrase = new Passphrase('passphrase-defined-in-sips-interface'); $shaComposer = new AllParametersShaComposer($passphrase); $paymentRequest = new PaymentRequest($shaComposer); // Optionally set Sips uri, defaults to TEST account //$paymentRequest->setSipsUri(PaymentRequest::PRODUCTION); // Set various params: $paymentRequest->setMerchantId('123456'); $paymentRequest->setKeyVersion('1'); $paymentRequest->setTransactionReference($sipsTransactionReference); $paymentRequest->setAmount(1000); $paymentRequest->setCurrency('EUR'); $paymentRequest->setLanguage('nl'); $paymentRequest->setPaymentBrand('VISA'); // ... $paymentRequest->validate(); // Create Http client to send the paymentRequest // We use Zend_Http_Client here, feel free to use your favourite HTTP client library $client = new Zend_Http_Client($paymentRequest->getSipsUri()); $client->setParameterPost('Data', $paymentRequest->toParameterString()); $client->setParameterPost('InterfaceVersion', '<Sips interfaceVersion>'); $client->setParameterPost('Seal', $paymentRequest->getShaSign()); $response = $client->request(Zend_Http_Client::POST); echo $response->getRawBody(); exit();
PaymentResponse
The PaymentResponse is typically used in a separate endpoint that is available to SIPS. This URL will be used by the SIPS platform to inform the Merchant whether the payment was successful.
Checking whether the payment is successful relies on checking if the RESPONSECODE parameter is 00 or 60.
<?php use Sips\PaymentResponse; use Sips\ShaComposer\AllParametersShaComposer; // ... $paymentResponse = new PaymentResponse($_REQUEST); $passphrase = new Passphrase('passphrase-defined-in-sips-interface'); $shaComposer = new AllParametersShaComposer($passphrase); if($paymentResponse->isValid($shaComposer) && $paymentResponse->isSuccessful()) { // handle payment confirmation } else { // perform logic when the validation fails }
Running the tests
The test suite requires PHPUnit to run. Simply run phpunit from the root of the project.
phpunit
deruwe/atos-sips 适用场景与选型建议
deruwe/atos-sips 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 14.26k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2016 年 02 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 deruwe/atos-sips 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 deruwe/atos-sips 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 14.26k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2016-02-29