ovac/hubtel-payment

一个全面的PHP包,用于消费Hubtel支付API

v2.0.4 2019-03-27 21:47 UTC

README


OVAC Hubtel Payment

用于消费Hubtel支付API和从PHP应用程序发送和接收移动货币支付的最好、最全面的PHP客户端,具有优雅的像发音一样写语法。

Build Status Coverage Status Latest Stable Version Total Downloads License Dependency Status

 Follow me anywhere @ovac4u                         | GitHub
 _________                          _________       | Twitter
|   ___   |.-----.--.--.---.-.----.|  |  |.--.--.   | Facboook
|  |  _   ||  _  |  |  |  _  |  __||__    |  |  |   | Instagram
|  |______||_____|\___/|___._|____|   |__||_____|   | Github + @ovac
|_________|                        www.ovac4u.com   | Facebook + @ovacposts

这是什么?

OVAC/Hubtel-Payment是一个全面的PHP客户端,用于消费Hubtel移动货币支付服务器API。它是一个完全的PHP工具包,由优雅的语法包装,该语法直接受到Laravel框架的启发。

它提供了一套良好方法和测试,使用“像发音一样写”的语法访问Hubtel移动货币支付。哦,它还在不断增长。

最大的亮点是什么?它很好地封装了Guzzlehttp客户端,并使用了PHP关于可用性和安全性的最佳实践。这意味着什么?这意味着Pay::receiveMoney()->from(0553577261)->run();实际上使用电话号码作为客户ID(如Hubtel移动货币接收金钱API所需),并以电话号码所有者作为代理的方式在后台以非常安全的方式放置了一个动态调用。

安装OVAC\Hubtel-Payment

要安装OVAC\HubtelPayment库,只需运行

$ composer require ovac/hubtel-payment

OVAC\Hubtel-Payment基本用法

首先从https://unity.hubtel.com/account/api-accounts-add获取Hubtel开发者账号号码、ClientID和ClientSecret

可以使用ReceiveMoney类向客户手机发送提示,以接收金钱,如下所示

<?php
require_once __DIR__ . '/vendor/autoload.php';

use OVAC\HubtelPayment\Config;
use OVAC\HubtelPayment\Api\Transaction\ReceiveMoney;

// First Create configuration with your Hubtel Developer Credentials
// The Account Number, ClientID and ClientSecret accordingly.
$config = new Config(Account_Nnumber, ClientId, ClientSecret);

$payment =  ReceiveMoney::from('0553577261')          //- The phone number to send the prompt to.
                ->amount(100.00)                    //- The exact amount value of the transaction
                ->description('Online Purchase')    //- Description of the transaction.
                ->customerName('Ariama Victor')     //- Name of the person making the payment.
                ->callback('http://ovac4u.com/pay') //- The URL to send callback after payment.	
                ->channel('mtn-gh')                 //- The mobile network Channel.
                ->injectConfig($config)             //- Inject the configuration
                ->run();                            //- Run the transaction after required data.

可以使用SendMoney类将金钱发送给任何移动货币客户,如下所示

<?php
require_once __DIR__ . '/vendor/autoload.php';

use OVAC\HubtelPayment\Config;
use OVAC\HubtelPayment\Api\Transaction\SendMoney;

// First Create configuration with your Hubtel Developer Credentials
// The Account Number, ClientID and ClientSecret accordingly.
$config = new Config(Account_Nnumber, ClientId, ClientSecret);

$payment = SendMoney::to('0553577261')                //- The phone number to send the prompt to.
                ->amount(100.00)                    //- The exact amount value of the transaction
                ->description('Online Purchase')    //- Description of the transaction.
                ->customerEmail('admin@ovac4u.com') //- Name of the person making the payment.
                ->callback('http://ovac4u.com/pay') //- The URL to send callback after payment.	
                ->channel('mtn-gh')                 //- The mobile network Channel.
                ->injectConfig($config)             //- Inject the configuration
                ->run();                            //- Run the transaction after required data.

可以使用Refund类退款给之前交易中支付的客户

<?php
require_once __DIR__ . '/vendor/autoload.php';

use OVAC\HubtelPayment\Config;
use OVAC\HubtelPayment\Api\Transaction\Refund;

// First Create configuration with your Hubtel Developer Credentials
// The Account Number, ClientID and ClientSecret accordingly.
$config = new Config(Account_Nnumber, ClientId, ClientSecret);

$payment = Refund::transactionId(1234)              //- The ID of the transaction to refund.
                ->amount(100.00)                    //- The exact amount value of the transaction
                ->clientReference('#11212')         //- A refeerence on your end.
                ->description('Useless Purchase')   //- Description of the transaction.
                ->reason('No longer needs a pen')   //- Name of the person making the payment.
                ->full()                            //- Full or partial refund.
                ->injectConfig($config)             //- Inject the configuration
                ->run();                            //- Run the transaction after required data.

文档

您可以在官方页面上找到所有类和方法的高级概述。更改日志可在CHANGELOG文件中找到。

您可以在存储库的wiki或官方页面上找到所有类和方法的高级概述。更改日志可在CHANGELOG文件中找到。

测试

如果您已全局安装phpunit

$ vendor/bin/phpunit

或使用composer脚本来运行

$ composer phpunit

代码分析工具

lint/checkstyle使用phpcs

$ composer phpcs

mess detector使用phpmd

$ composer phpmd

copy & paste detector使用phpcpd

$ composer phpcpd

phpunit, lint, mess detector在一个命令中

$ composer test

CI

在bin文件夹下存在一个简单的ci bash脚本

$ bin/ci.sh

贡献

感谢您考虑为Laravel Hackathon Starter做出贡献。贡献指南可在贡献文件中找到。

安全

如果您发现任何与安全相关的问题,请通过电子邮件联系,而不是使用问题跟踪器。

致谢

许可证

参考

我如何感谢你?

为什么不给github存储库加星标?我会很高兴得到关注!为什么不在Twitter或HackerNews上分享这个存储库的链接?传播消息!

别忘了在 InstagramTwitter 上关注我。

谢谢!Ariama Victor (ovac4u)。