fullpipe/payum-uniteller
Composer 安装命令:
composer require fullpipe/payum-uniteller
包简介
Uniteller payment
关键字:
README 文档
README
Instalation (with symfony2 payum bundle)
add to your composer json
{
"require": {
"payum/payum-bundle": "0.14.*",
"fullpipe/payum-uniteller": "dev-master"
}
}
Add UnitellerPaymentFactory to payum:
<?php // src/Acme/PaymentBundle/AcmePaymentBundle.php namespace Acme\PaymentBundle; use Symfony\Component\HttpKernel\Bundle\Bundle; use Symfony\Component\DependencyInjection\ContainerBuilder; use Fullpipe\Payum\Uniteller\Bridge\Symfony\UnitellerPaymentFactory; class AcmePaymentBundle extends Bundle { public function build(ContainerBuilder $container) { parent::build($container); $extension = $container->getExtension('payum'); $extension->addPaymentFactory(new UnitellerPaymentFactory()); } }
Since Uniteller does not supports callback urls.
You will require to implement notifyAction
<?php // /src/Acme/PaymentBundle/Controller/PaymentController.php namespace Acme\PaymentBundle\Controller; use Payum\Bundle\PayumBundle\Controller\PayumController; use Symfony\Component\HttpFoundation\Request; use Payum\Core\Request\Notify; use Payum\Core\Request\GetHumanStatus; class PaymentController extends PayumController { public function notifyAction(Request $request) { $gateway = $this->getPayum()->getPayment('uniteller'); $payment = $this->getPayum() ->getStorage('Acme\PaymentBundle\Entity\Payment') ->findBy(array( 'number' => $request->get('Order_ID'), )); if ($reply = $gateway->execute(new Notify($payment), true)) { if ($reply instanceof HttpResponse) { $gateway->execute($status = new GetHumanStatus($payment)); if ($status->isCaptured() || $status->isAuthorized()) { // Payment is done // Notify your app here } throw $reply; } throw new \LogicException('Unsupported reply', null, $reply); } return new Response('', 204); } }
and you in routing.yml
acme_payment_notify: path: /payment_notify defaults: { _controller: AcmePaymentBundle:Payment:notify }
add http://example.com/payment_notify to
https://lk.uniteller.ru/#/ecshop/settings/????
Configuration (using symfony2 payum bundle)
payum: security: token_storage: Acme\PaymentBundle\Entity\PaymentToken: { doctrine: orm } storages: Acme\PaymentBundle\Entity\Payment: { doctrine: orm } payments: ... uniteller_gateway: uniteller: shop_id: 1234567890-1234 password: SECRET_PASSWORD sandbox: true ...
Usage
<?php namespace Acme\PaymentBundle\Controller; use Payum\Bundle\PayumBundle\Controller\PayumController; use Symfony\Component\HttpFoundation\Request; use Payum\Core\Request\Notify; use Payum\Core\Request\GetHumanStatus; use Fullpipe\Payum\Uniteller\Api; class PaymentController extends PayumController { public function prepareAction() { $order = ...; $user = ...; $paymentName = 'uniteller_gateway'; $storage = $this->get('payum') ->getStorage('Acme\PaymentBundle\Entity\Payment'); $payment = $storage->create(); $payment->setNumber($order->getId()); $payment->setCurrencyCode(Api::CURRENCY_RUB); $payment->setTotalAmount($order->getTotalAmount()); // $payment->setTotalAmount(14025); // => 140 руб. 25 копеек //Optional $payment->setDescription('DESCRIPTION'); $payment->setClientId($user->getId()); $payment->setClientEmail($user->getEmail()); $payment->setDetails(array( 'FirstName' => $user->getFirstName(), 'LastName' => $user->getLastName(), 'MeanType' => Api::MEAN_TYPE_ANY, 'EMoneyType' => Api::EMONEY_TYPE_YANDEX, )); $storage->update($payment); $captureToken = $this->get('payum.security.token_factory') ->createCaptureToken( $paymentName, $payment, 'acme_payment_done' ); return $this->redirect($captureToken->getTargetUrl()); } public function doneAction(Request $request) { $token = $this->getHttpRequestVerifier()->verify($request); $gateway = $this->getPayum()->getPayment($token->getPaymentName()); $gateway->execute($status = new GetHumanStatus($token)); $payment = $status->getFirstModel(); //update order status here // if ($status->isCaptured()) { // $order->setPaid(true); // } $this->get('payum.security.http_request_verifier')->invalidate($token); return $this->redirect($this->generateUrl('acme_thank_you_page')); } }
fullpipe/payum-uniteller 适用场景与选型建议
fullpipe/payum-uniteller 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 115 次下载、GitHub Stars 达 1, 最近一次更新时间为 2015 年 04 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「payment」 「payum」 「uniteller」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 fullpipe/payum-uniteller 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 fullpipe/payum-uniteller 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 fullpipe/payum-uniteller 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Payum integration for Symfony e-commerce applications.
Quickpay payment plugin for Sylius
Saferpay Payum plugin providing Ecommerce and Business features
Uniteller package for Laravel 5
Rich payment solutions for zend framework2. Paypal, payex, authorize.net, be2bill, omnipay, recurring paymens, instant notifications and many more
Laravel integration internet-acquiring of the Uniteller (unofficial)
统计信息
- 总下载量: 115
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-04-08