bmatovu/laravel-mtn-momo 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bmatovu/laravel-mtn-momo

Composer 安装命令:

composer require bmatovu/laravel-mtn-momo

包简介

Laravel MTN MOMO integration.

README 文档

README

Total Downloads Latest Stable Version License Code Quality Code Coverage Tests Documentation

Introduction

This package helps you integrate the MTN MOMO API into your Laravel application. It provides a wrapper around the core MTN MOMO API services, leaving you to worry about other parts of your application.

Installation

To get started, install the package via the Composer package manager:

Laravel Package Installation
^6.0 2.0 composer require bmatovu/laravel-mtn-momo ^2.0
^7.0 3.0 composer require bmatovu/laravel-mtn-momo ^3.0
^8.0 ... ^10.0 master composer require bmatovu/laravel-mtn-momo

Configuration customization

If you wish to customize the default configurations, you may export the default configuration using

php artisan vendor:publish --provider="Bmatovu\MtnMomo\MtnMomoServiceProvider" --tag="config"

Database Migration

The package service provider registers it's own database migrations with the framework, so you should migrate your database after installation. The migration will create a tokens tables your application needs to store access tokens from MTN MOMO API.

php artisan migrate

Prerequisites

You will need the following to get started with you integration...

  1. Create a developer account with MTN MOMO.
  2. Subscribe to a product/service that you wish to consume.

If you already subscribed to a product, the subscription key can be found in your profile.

Getting started (Sandbox)

Register your client details.

php artisan mtn-momo:init

Next you need to register your client app ID.

php artisan mtn-momo:register-id

You may want to verify your client ID at this stage

php artisan mtn-momo:validate-id

Then request for a client secret (key).

php artisan mtn-momo:request-secret

Usage

use Bmatovu\MtnMomo\Products\Collection;

$collection = new Collection();

$referenceId = $collection->requestToPay('yourTransactionId', '46733123454', 100);

See test numbers

Exception handling

use Bmatovu\MtnMomo\Products\Collection;
use Bmatovu\MtnMomo\Exceptions\CollectionRequestException;

try {
    $collection = new Collection();
    
    $referenceId = $collection->requestToPay('yourTransactionId', '46733123453', 100);
} catch(CollectionRequestException $e) {
    do {
        printf("\n\r%s:%d %s (%d) [%s]\n\r", 
            $e->getFile(), $e->getLine(), $e->getMessage(), $e->getCode(), get_class($e));
    } while($e = $e->getPrevious());
}

Available methods

Collection

  1. Collect money

    $collection->requestToPay($yourTransactionId, $partyId, $amount)
  2. Check transaction status

    $collection->getTransactionStatus($referenceId)
  3. Check account balance

    $collection->getAccountBalance()
  4. Check account status

    $collection->isActive($partyId)
  5. Get OAuth token

    $collection->getToken()
  6. Get Account Holder Info

    $collection->getAccountHolderBasicInfo($partyId)

Disbursement

  1. Disburse money

    $disbursement->transfer($yourTransactionId, $partyId, $amount)
  2. Check transaction status

    $disbursement->getTransactionStatus($referenceId)
  3. Check account balance

    $disbursement->getAccountBalance()
  4. Check account status

    $disbursement->isActive($partyId)
  5. Get OAuth token

    $disbursement->getToken()
  6. Get Account Holder Info

    $disbursement->getAccountHolderBasicInfo($partyId)

Remittance

  1. Remit money

    $remittance->transfer($yourTransactionId, $partyId, $amount)
  2. Check transaction status

    $remittance->getTransactionStatus($referenceId)
  3. Check account balance

    $remittance->getAccountBalance()
  4. Check account status

    $remittance->isActive($partyId)
  5. Get OAuth token

    $remittance->getToken()
  6. Get Account Holder Info

    $remittance->getAccountHolderBasicInfo($partyId)

Go live

You will need to make some changes to your setup before going live. Read more.

Support Groups

Join MTN's Skype & WhatsApp support groups. Here

Reporting bugs

If you've stumbled across a bug, please help us by leaving as much information about the bug as possible, e.g.

  • Steps to reproduce
  • Expected result
  • Actual result

This will help us to fix the bug as quickly as possible, and if you wish to fix it yourself feel free to fork the package and submit a pull request!

bmatovu/laravel-mtn-momo 适用场景与选型建议

bmatovu/laravel-mtn-momo 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12.24k 次下载、GitHub Stars 达 143, 最近一次更新时间为 2019 年 03 月 19 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「package」 「api」 「laravel」 「mtn」 「momo」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 bmatovu/laravel-mtn-momo 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 bmatovu/laravel-mtn-momo 我们能提供哪些服务?
定制开发 / 二次开发

基于 bmatovu/laravel-mtn-momo 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 12.24k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 143
  • 点击次数: 12
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 143
  • Watchers: 18
  • Forks: 51
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-03-19