xlabs / vservicesbundle
VServices 包装捆绑包
Requires
- php: >=5.6
- knplabs/knp-paginator-bundle: ^2.6
- symfony/symfony: >=3.4
- xlabs/mmadminbundle: ^2.0
This package is auto-updated.
Last update: 2021-07-07 08:23:07 UTC
README
一个 VSERVICES 反馈包装器。
文档
https://docs.vendoservices.com/docs/vservices-postbacks
支持
clientservices@vendoservices.com(主题中提及 2241,它是 Manica 账户)
测试
开始测试会话,在表单中填写任何信息,并使用 CC
4111 1111 1111 1111
CVV 123
安装
通过 composer 安装
php -d memory_limit=-1 composer.phar require xlabs/vservicesbundle
在你的 AppKernel 中
public function registerbundles()
{
return [
...
...
new XLabs\VServicesBundle\XLabsVServicesBundle(),
];
}
为了使此捆绑包正常工作,EpochTransStats 和 MemberCancelStats 需要设置为 HTTPS 方法,而不是 MYSQL 方法。你可能需要联系 Epoch 支持以启用此设置。
路由
追加到主路由文件
# app/config/routing.yml
x_labs_epoch:
resource: .
type: xlabs_epoch_routing
配置示例
以下显示默认值
# app/config/config.yml
x_labs_epoch:
# postbacks will go to <url><postback_url>
url: https://www.yourdomain.com
postback_url: /your/epoch/postback/url (default '/epoch/postback')
return_url: /your/epoch/response/url (default '/epoch/response')
stats_url: /your/epoch/stats/url (default '/epoch/stats')
logging:
enabled: true
location: '%kernel.logs_dir%/'
allowed_ips: ['127.0.0.1', '192.168.1.10', '60.58.43.125', ...]
api:
url: 'https://wnu.com/secure/services/'
reseller: 'a'
epoch_digest_key: '<your_epoch_hmac_key>'
mail_notifications:
enabled: true|false
subject: '' # descriptive prefix for the notifications subject
from: '' # useful to apply a gmail label for the notifications
destinataries: []
重要
请确保创建一个每日 cronjob 来拉取 Epoch IPs
(0 8 * * *) php bin/console xlabs:epoch:update_ips
你仍然可以使用配置参数 "allowed_ips" 来配置其他允许的 IPs。
注意:$_SERVER['SERVER_ADDR'] 默认允许,因此无需将其包含在 'allowed_ips' 数组中。
此外,请确保向支持人员询问 "S" 交易类型,以避免数据回传在 CamCharge 交易之后出现问题时。为了使 CamCharge 工作正常,我们还需要请求摘要代码。
事件监听器
以下事件基于 epoch 反馈触发
SYNCHRONOUS (fired by flexpost):
epoch.sync.join.event
SYNCHRONOUS (fired by memberplus):
epoch.sync.join_channel.event
ASYNCHRONOUS (fired by dataplus):
epoch.async.join.event
epoch.async.join_channel.event
epoch.async.rebill.event
epoch.async.rebill_channel.event
epoch.async.chargeback.event
epoch.async.chargeback_channel.event
epoch.async.refund.event
epoch.async.refund_channel.event
epoch.async.cancel.event
epoch.async.purchase.event
SYNCHRONOUS (fired by camcharge):
epoch.sync.purchase.event
SYNCHRONOUS (fired by unkown):
epoch.async.reactivation.event
在同步/异步事件中,如果交易被拒绝,将触发以下事件
epoch.error.event
在 epoch 响应时,将根据响应触发 2 个事件
epoch.response_success.event
epoch.response_failed.event
例如,您可以使用 "epoch.response_success.event" 来重新加载用户会话,以添加他的新购买。
如果您想为任何事件注册事件监听器
# YourBundle/Resources/config/services.yml
...
custom_listener_for_epoch_onPostback.event_listener:
class: YourBundle\EventListener\MyListener
tags:
- { name: kernel.event_listener, event: epoch.join.event, method: yourCustomMethod }
namespace YourBundle\EventListener;
use Symfony\Component\EventDispatcher\Event;
class MyListener extends Event
{
public function yourCustomMethod(Event $event)
{
$params = $event->getParams(); // all params sent by epoch
...
$event->setResponse('OK');
/*
OR
*/
$event->setResponse('KO - <ERR MSG>');
}
}
如果监听器中未设置响应,则默认输出为 'OK'。
返回 URL 参数
如果您想覆盖 "感谢 / 交易拒绝" 模板,可以通过覆盖以下模板来实现
XLabsEpochBundle::response.html.twig
XLabsEpochBundle::success.html.twig
XLabsEpochBundle::error.html.twig
以下变量被发送到模板
- 在成功的交易中
status = "SUCCESS" message -> (empty string)
- 在失败的交易中
status = "ERROR" message -> (string containing a descriptive error)
待办事项
- 在 twig 扩展 xlabs_epoch.twig_extension 中使用所需的依赖项(而不是容器)。
- 除非自定义查询字符串参数被设置,否则只允许交易一次,在这种情况下交易将通过。
测试
请使用以下测试卡号来测试批准和拒绝
4121371122223333 / 任何有效到期日 5123456789012346 / 任何有效到期日
为了模拟批准,您将需要使用 '111' 作为 CVV2。为了模拟拒绝,您可以使用 '567' 作为 CVV2。
您必须使用办公室代理 IP,因为它是受保护的 IP,他们是唯一完全白名单的。