ernestre / sms-payment-bundle
SMS支付包,包含Paysera支付网关集成。
v1.0
2017-01-14 12:14 UTC
Requires
- php: >=5.3.2
- symfony/symfony: >=2.8
- webtopay/libwebtopay: ^1.6
This package is not auto-updated.
Last update: 2024-09-28 20:20:07 UTC
README
此包使用webtopay/libwebtopay
库通过Paysera支付网关接受短信支付。
安装
composer require ernestre/sms-payment-bundle
配置
- 将包添加到
app/AppKernel
class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new Ernestre\PaymentBundle\ErnestrePaymentBundle(), // ... ); } // ... }
- 添加路由
ernestre_payment: resource: "@ErnestrePaymentBundle/Controller/" type: annotation
- 添加配置
ernestre_payment: project: id: 123 # Your project id sign_password: 123 # Your project's sign password
- 在Paysera项目设置中将短信回调路由配置为
/sms-callback
。
使用方法
每次收到付款后,都会创建并保存到数据库的SmsPayment
实体。
然后发送包含SmsPayment
实体(包含所有付款信息)的SmsPaymentReceivedEvent
事件。
然后操作发送NOSMS
响应。(有关响应消息的详细信息,请参阅此处。)
您的任务是创建一个监听器,该监听器监听smsPayment.received
事件,并处理付款信息。
然而,使用NOSMS
响应消息需要您向Paysera服务发送付款确认消息。您可以使用ernestre_payment.sms_payment.answer_sender
服务生成此响应消息。服务的发送方法需要SmsPayment
实体和响应文本
(将发送给客户端)。响应文本
可以用来向客户端发送某种代码(例如折扣券)。