jakubzapletal/payment-webpay-bundle
Composer 安装命令:
composer require jakubzapletal/payment-webpay-bundle
包简介
Payment Bundle for Symfony2 providing an access to the GP webpay API
README 文档
README
This is an extension to the JMSPaymentCoreBundle providing an access to the GP Webpay API (https://www.globalpaymentsinc.com).
Available Transaction Types:
- approveAndDeposit
Instalation
Composer
If you don't have Composer install it:
$ curl -s https://getcomposer.org/installer | php
Add jakubzapletal/payment-webpay-bundle to composer.json:
$ composer require "jakubzapletal/payment-webpay-bundle:1.0.*@dev"
Register a bundle
<?php // in AppKernel::registerBundles() $bundles = array( // ... new JakubZapletal\Payment\WebpayBundle\JakubZapletalPaymentWebpayBundle(), // ... );
Dependencies
This plugin depends on the JMSPaymentCoreBundle, so you'll need to add this to your kernel as well even if you don't want to use its persistence capabilities.
Configuration
jakub_zapletal_payment_webpay: bank_name: short name of your bank # example 'rb' merchant_number: your merchant number obtained from GP webpay or your bank private_key_path: absolute path to your private key *.pem file # example '%kernel.root_dir%/Resources/private_key.pem' private_key_password: password to your private key muzo_key_path: absolute path to muzo key *.pem file # example '%kernel.root_dir%/Resource/muzo_prod.pem' debug: true/false # when true, connect to Webpay test; uses kernel debug value when not specified
Usage
With the Payment Plugin Controller (Recommended)
Example is inspired by official JMSPaymentCorebundle usage. There is shown only a different part than the official one.
// class PaymentController // ... /** * @Route("/{orderNumber}/details", name = "payment_details") * @Template */ public function detailsAction(Order $order) { $form = $this->getFormFactory()->create('jms_choose_payment_method', null, array( 'amount' => $order->getAmount(), 'currency' => 'EUR', 'default_method' => 'payment_webpay', // Optional 'predefined_data' => array( 'webpay' => array( 'return_url' => $this->router->generate('payment_complete', array( 'orderNumber' => $order->getOrderNumber(), ), true), 'merchantOrderNumber' => $order->getId(), // Optional 'description' => (string)$order->getProduct() // Optional ) ), )); if ('POST' === $this->request->getMethod()) { $form->bindRequest($this->request); if ($form->isValid()) { $this->ppc->createPaymentInstruction($instruction = $form->getData()); $order->setPaymentInstruction($instruction); $this->em->persist($order); $this->em->flush($order); return new RedirectResponse($this->router->generate('payment_complete', array( 'orderNumber' => $order->getOrderNumber(), ))); } } return array( 'form' => $form->createView() ); } // ...
Without the Payment Plugin Controller
The Payment Plugin Controller is made available by the CoreBundle and basically is the interface to a persistence backend like the Doctrine ORM. It also performs additional integrity checks to validate transactions. If you don’t need these checks, and only want an easy way to communicate with the Webpay API, then you can use the plugin directly:
$plugin = $container->get('jakub_zapletal.payment.webpay.plugin.webpay');
Contributing
Contributions are welcome! Please see the Contribution Guidelines.
jakubzapletal/payment-webpay-bundle 适用场景与选型建议
jakubzapletal/payment-webpay-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 245 次下载、GitHub Stars 达 0, 最近一次更新时间为 2014 年 06 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 jakubzapletal/payment-webpay-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jakubzapletal/payment-webpay-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 245
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-06-17