shengamo/tumeny-pay
Composer 安装命令:
composer require shengamo/tumeny-pay
包简介
This package would help integrate Laravel with Tumeny pay.
关键字:
README 文档
README
A Laravel Package for integrating with Tumeny Pay.
This Laravel package integrates Tumeny Pay as a payment gateway into your Laravel application.
Version Compatibility
| Laravel Version | Package Version |
|---|---|
| Laravel 11.x + | 2.x |
| Laravel 10.x | 1.x |
| Laravel 9.x | 1.x |
Important: For Laravel 11 applications, you must use version 2.0 or above of this package due to changes in Laravel's caching implementation. For Laravel 10 and below, use version 1.x.
To install a specific version:
# For Laravel 11+ composer require shengamo/tumeny-pay:^2.0 # For Laravel 10 and below composer require shengamo/tumeny-pay:^1.0
Installation
-
Install the package via Composer:
composer require shengamo/tumeny-pay
-
Publish the package migrations:
php artisan vendor:publish --tag=Shengamo\TumenyPay\TumenyPayServiceProvider
The package creates migrations for the shengamo_orders, shengamo_order_statuses and also the team_subscriptions (if it does not already exist). The statuses that are create are:
- Pending - status 1
- Success - status 2
- Failed - status 3
-
Add the following environment variables to your
.envfile:TUMENY_KEY=your_tumeny_key TUMENY_SECRET=your_tumeny_secret TUMENY_BASE_URL=https://tumeny.herokuapp.com/api/
You can find your key and secret from your tumeny account. You need an active account an access to the API Key in order to use this package.
Usage
Payment Request
You can initiate a payment request using the processPayment method provided by the TumenyPay class.
use Shengamo\TumenyPay\TumenyPay; $tumeny = new TumenyPay(); $tumeny->processPayment('amount', 'plan name or default', 'Zambian mobile number', 'quantity of items', 'description'); // e.g. request a payment of K100 from the mobile number 0961234567. $tumeny->processPayment(100, 'default', '0961234567', 1, 'custom description');
Setup the verification of payments
To automatically verify pending order payments, add the following line to the schedule function in your App\Console\Kernel.php file:
use Shengamo\TumenyPay\Jobs\VerifyPendingOrderPayments; $schedule->job(new VerifyPendingOrderPayments())->everyMinute();
The schedule will check the shengamo_orders table for all orders with a status of pending (1) and send a request to
the Tumeny API every minute. If there are no pending transactions, no request will be sent to the Tumeny API.
Events & Listeners
Events are fired when ShengamoOrder is generated and also when the ShengamoOrder has been updated. You could register these events in the EventServiceProvider. If you would like to handle an action, for example, if you would like to add a subscription if the order is successful, you could create an event listener that listens to the ShengamoOrderCreated Event.
For example, after creating a AddSubscriptionListener Listener class, the code below would handle subscription if order is successful.
class AddSubscriptionListener { public function __construct() { // } public function handle(ShengamoOrderUpdated $event): void {; //If the order status is successful or 2 if($event->shengamoOrder->status === 2) { // Add the subscription here } } }
Add the events and listener in your App\Providers\EventServiceProvider like the example below.
protected $listen = [ ShengamoOrderUpdated::class => [ AddSubscriptionListener::class ], ];
Manually firing the verification
In order to manually verify all the pending transactions in your shengamo_orders table, you can ran the artisan command.
php artisan tumeny:verify
Testing
./vendor/bin/phpunit
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email mo@shengamo.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
shengamo/tumeny-pay 适用场景与选型建议
shengamo/tumeny-pay 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 79 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 12 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「shengamo」 「tumeny-pay」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 shengamo/tumeny-pay 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 shengamo/tumeny-pay 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 shengamo/tumeny-pay 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
统计信息
- 总下载量: 79
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-12-29