olaoluwa-98 / laravel-payant
用于Payant的Laravel包
Requires
- php: ^5.4.0|^7.0
- guzzlehttp/guzzle: 5.*|6.*
- illuminate/support: 5.*
Requires (Dev)
- mockery/mockery: >=0.7.2
- phpunit/phpunit: 4.*
- satooshi/php-coveralls: ^0.7.0
- scrutinizer/ocular: ~1.1
This package is not auto-updated.
Last update: 2024-09-29 03:15:29 UTC
README
受unicodeveloper的 laravel-paystack 启发
主要功能来自Jonathan Itakpe的 payantNG-php
Laravel 5包,用于与Payant交互
安装
需要PHP 5.4+和Composer。
要获取Laravel Payant的最新版本,只需将以下行添加到你的composer.json
文件的require块中。
"olaoluwa-98/laravel-payant": "1.1.*"
然后你需要运行composer install
或composer update
来下载它并更新自动加载器。
一旦安装了Laravel Payant,你需要注册服务提供者。打开config/app.php
并在providers
键中添加以下内容。
Olaoluwa98\Payant\PayantServiceProvider::class
此外,还可以这样注册外观
'aliases' => [ ... 'Payant' => Olaoluwa98\Payant\Facades\Payant::class, ... ]
配置
你可以使用以下命令发布配置文件
php artisan vendor:publish --provider="Olaoluwa98\Payant\PayantServiceProvider"
一个名为payant.php
的配置文件,其中包含一些合理的默认值,将被放置在你的config
目录中
<?php return [ /** * Public Key From Payant Dashboard * */ 'public_key' => env('PAYANT_PUBLIC_KEY'), /** * Private Key From Payant Dashboard * */ 'private_key' => env('PAYANT_PRIVATE_KEY'), /** * Payant API MODE */ 'mode' => env('PAYANT_MODE'), ];
用法
打开你的.env文件,并添加你的公钥、私钥、演示状态如下:你可以从你的Payant仪表板获取它们
PAYANT_PUBLIC_KEY=xxxxxxxxxxxxx PAYANT_PRIVATE_KEY=xxxxxxxxxxxxx PAYANT_MODE= DEMO or LIVE
函数的命名基于位于API文档中的文档。阅读文档中的函数,以了解每个函数所需参数
你可以在控制器中使用包,通过添加use Payant;
$client_data = ['first_name' => 'Emmanuel', 'last_name' => 'Awotunde', 'email' => 'awotunde.emmanuel1@gmail.com', 'phone' => '+2348090579032']; Payant::addClient($client_data);
如果请求成功,上述函数将返回以下JSON数据
{
"status": "success",
"message": "Client created successfully.",
"data": {
"company_id": <company_id>,
"name": "<name>",
"first_name": "<first_name>",
"last_name": "<last_name>",
"email": "<email>",
"phone": "<phone_no>",
"website": "<website>",
"address": "<address>",
"type": "Customer",
"settlement_bank": "",
"account_name": "",
"account_number": "",
"status": "1",
"created_at": "date",
"updated_at": "date",
"id": <id_of_client>
}
}
此包中的函数
- 杂项
getBanks()
[GET]resolveAccount( array $client_data )
[POST]
- 客户端
addClient( array $client_data )
[POST]getClient( $client_id )
[GET]editClient( $client_id, array $client_data )
[PUT]deleteClient( $client_id )
[DELETE]
- 发票
addInvoice( $client_id, array $client_data, $due_date, $fee_bearer, array $items )
[POST]getInvoice( string $reference_code )
[GET]sendInvoice( string $reference_code )
[GET]getInvoiceHistory( $period, $start = null, $end = null )
[POST]deleteInvoice( string $reference_code )
[DELETE]
- 转账
addTransfer( array $client_data, string $amount )
[POST]getTransfer( string $reference_code )
[GET]getTransferHistory( $period, $start = null, $end = null )
[POST]deleteTransfer( string $reference_code )
[DELETE]
- 支付
addPayment( string $reference_code, string $due_date, string $amount, string $channel )
[POST]getPayment( string $reference_code )
[GET]getPaymentHistory( string $period, string $start, string $end )
[POST]deleteTransfer( string $reference_code )
[DELETE]
- 钱包
addWallet( string $name, string $passcode )
[POST]getWallet( string $reference_code )
[GET]changeWalletPasscode( string $reference_code, string $old_passcode, string $passcode )
[PUT]getWallets()
[GET]setWalletStatus( string $reference_code )
[GET]withdrawFromWallet( string $reference_code, array $client_data, string $amount, string $passcode )
[POST]getWalletTransactions( string $reference_code, $period, $start = null, $end = null )
[POST]
- 产品
addProduct( string $name, string $description, string $unit_cost, string $type )
[POST]getProduct( $product_id )
[GET]editProduct( $product_id, array $product_data )
[PUT]getProducts()
[GET]deleteProduct( $product_id )
[DELETE]
待办事项
- 添加综合测试
贡献
请随意fork此包,并通过提交pull request来增强功能。
如何感谢您呢?
为什么不给github仓库点个星?我很希望得到关注!为什么不把此仓库的链接分享到Twitter或HackerNews?传播一下!
别忘了在twitter上关注我!
谢谢!Emmanuel Awotunde。
许可证
MIT许可证(MIT)。更多信息请参阅许可证文件。