vaszev/barion-bundle
Composer 安装命令:
composer require vaszev/barion-bundle
包简介
Symfony bundle for Barion
README 文档
README
Download the Bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
$ composer require vaszev/barion-bundle
Contains
Barion library (1.3.1 March 20. 2019.) wrapper for Symfony 4
Please note that this bundle is for simple B2C Immediate payment type only. Project still in development stage, use only at your own risk!
Install
Configure your credentials:
/config/vaszev.yaml
vaszev_barion: posKey: 'YOUR_POS_KEY_FROM_BARION' apiVersion: 2 sandbox: true payee: 'YOUR.SHOP.EMAIL@EXAMPLE.COM' pixelId: 'YOUR_BARION_PIXEL_ID' webshopName: 'YOUR_WEBSHOP_PREFIX_YOU_WANT_TO_USE' webshopDefaultRoute: 'YOUR_WEBSHOP_ROUTE_FOR_BACK_BUTTON_IF_NOT_AVAILABLE' waitingRoomBg: '#fff' waitingRoomColor: '#333' waitingRoomAmountColor: 'tomato' waitingRoomPositiveFeedbackColor: 'green' waitingRoomNegativeFeedbackColor: 'red' waitingRoomNeturalFeedbackColor: 'orange' waitingRoomGoogleFont: 'Lato'
Add the following to your routing:
/config/routes.yaml
_barion: resource: "@VaszevBarionBundle/Controller" type: annotation prefix: /barion
Update doctrine's schema:
$ php bin/console doctrine:schema:update --force
Install assets:
$ php bin/console assets:install --symlink
Include Barion's pixel into your webshop pages:
{{ render(controller('Vaszev\\BarionBundle\\Controller\\BarionController::pixel')) }}
Adding translations :
'barion.cart': '' 'barion.transaction': '' 'barion.done': '' 'barion.Your.payment.of': '' 'barion.transaction.failed': '' 'barion.transaction.success': '' 'barion.transaction.neutral': '' 'barion.back.to.the.webshop': ''
Best practicles
- save your webshop
orderIDin your database's table - get your
orderIDand items - init Barion online payment with the data you know about your visitor
- create a transaction with your
orderIDand add items - prepare your payment and get your URL for Barion's payment page
- pay, and get back to our waiting room where customer got progress info
- Barion will knock on callback URL where we'll set payment state
- let you customer know about it
- get back to your webshop and keep buying
Example
You have to gather your items into transaction(s) that could have one or more items:
$myWebsopTransactionId = 8211; $redirectURL = $this->generateUrl('webshop', [], UrlGeneratorInterface::ABSOLUTE_URL); try { $barion->initShopping($redirectURL)->createTransaction($myWebsopTransactionId, 'Please post it ASAP!'); $barion->addItem('Product name','Description',2,2900,'ProdId#5312','Piece'); $barion->addItem('Product name 2','Description so far',1,1000,'ProdId#4362','Meter'); $barion->addItem('Product name 3','Description will fit',1,5900,'ProdId#7309','L'); $payURL = $barion->preparePaymentRequest('buyer@example.com', '1234 Hungary, Budapest...')->closeAndGetPaymentURL(); ... } catch (\Exception $e) { // yikes! something went wrong... }
Check if your order's payment received:
$barion->checkMyOrderBeingPaid($myWebsopTransactionId);
Call getters on your order:
$barion->getMyOrderPaymentId($myWebsopTransactionId); $barion->getMyOrderResponse($myWebsopTransactionId); $barion->getMyOrderItems($myWebsopTransactionId); $barion->getMyOrderRequest($myWebsopTransactionId); $barion->getMyOrderTransaction($myWebsopTransactionId); $barion->getMyOrderStateResponses($myWebsopTransactionId);
vaszev/barion-bundle 适用场景与选型建议
vaszev/barion-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 27 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 05 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「symfony」 「barion」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 vaszev/barion-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 vaszev/barion-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 vaszev/barion-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The bundle for easy using json-rpc api on your project
Barion PHP library
Barion web API
Bundle Symfony DaplosBundle
Barion PHP library
PHP libary for Barion Smart Gateway API integration for composer usage
统计信息
- 总下载量: 27
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-05-14