bennito254/co-opconnect
Composer 安装命令:
composer require bennito254/co-opconnect
包简介
Wrapper for the Co-op Bank API
关键字:
README 文档
README
PHP wrapper for the Co-op Bank API at https://developer.co-opbank.co.ke:9443/store for the sandbox only.
Support for Production API will be coming soon!
Installation
composer require bennito254/co-opconnect
Setup
Initialize the Bank class with Consumer Key, Consumer Secret and Production environment as arguments
$bank = \Bennito254\CoopBank\Bank($consumerKey, $consumerSecret, $env = 'sandbox'); //or live
Usage
Account Information
Account Balance
$accountNumber = "36001873000";
$messageReference = "Randomstr1ng";
$balance = $bank->account()->balance($accountNumber, $messageReference);
Exchange Rates
$messageReference = "Randomstr1ng";
$fromCurrency = "KES";
$toCurrency = "USD";
$rate = $bank->account()->exchangeRate($messageReference, $fromCurrency, $toCurrency);
Account Number Validation
$messageReference = "Randomstr1ng";
$accountNumberToCheck = "36001873000";
$rate = $bank->account()->validation($messageReference, $accountNumberToCheck);
Send Money
Send To M-Pesa
$mpesa_destination = [
'ReferenceNumber' => 'Rand0mStrseing',
'MobileNumber' => "0716483805",
'Amount' => 10,
'Narration' => 'Awesome sendoff'
];
$response = $bank->sendMoney()->sendToMpesa('36001873000', 'newRandomString', 'https://dev.bennito254.com/cb.php', 'KES', 10, $mpesa_destination, 'Send to Bennito');
Send via PesaLink
$pesalink_destination = [
'ReferenceNumber' => 'Rand0mStringss',
'AccountNumber' => "54321987654321",
'BankCode' => "11",
'Amount' => 10,
'TransactionCurrency' => 'KES',
'Narration' => 'Awesome sendoff'
];
$response = $bank->sendMoney()->pesalinkSendToAccount('36001873000', 'newRandomString', 'https://dev.bennito254.com/cb.php', 'KES', 10, $pesalink_destination, 'Send to Bennito');
Send to Another Account
$account_destination = [
'ReferenceNumber' => 'Rand0mStringasss',
'AccountNumber' => "54321987654321",
'Amount' => 10,
'TransactionCurrency' => 'KES',
'Narration' => 'Awesome sendoff'
];
$response = $bank->sendMoney()->accountToAccount('36001873000', 'benniastweo23', 'https://dev.bennito254.com/cb.php', 'KES', 10, $account_destination, 'Send to Bennito');
Simulate Transaction
$simulation = [
'MessageReference' => 'jkgasjkfgsaf',
'MessageDateTime' => '2020-04-06T10:19:07.100Z',
'ServiceName' => '',
'NotificationCode' => '',
'PaymentRef' => 'REF000012323',
'AccountNumber' => '823547857835434',
'Amount' => "12000.00",
'TransactionDate' => '20190301165420',
'EventType' => 'DEBIT',
'Currency' => 'KES',
'ExchangeRate' => '1',
'Narration' => 'Supplier payments',
'CustMemo' => [
'CustMemoLine1' => '785347855 75',
'CustMemoLine2' => '',
'CustMemoLine3' => ''
],
'ValueDate' => '20190301',
'EntryDate' => '20190301',
'TransactionId' => '8963478382745'
];
$response = $bank->sendMoney()->INSSimulation($simulation);
Account Statements
Mini Statement
$accountNumber = '36001873000';
$messageReference = 'randomString';
$bank->statements()->miniStatement($accountNumber, $messageReference);
Full Statement
$accountNumber = '36001873000';
$messageReference = 'randomString';
$startDate = "2020-03-01";
$endDate = "2020-04-01";
$bank->statements()->miniStatement($accountNumber, $messageReference, $startDate, $endDate);
Transactions
Latest Transactions
$accountNumber = '36001873000';
$messageReference = 'randomString';
$numberOfTransactions = "10";
$bank->transactions()->accountTransactions($accountNumber, $messageReference, $numberOfTransactions);
Transaction Status
$messageReference = 'ExistingRandomString';
$bank->transactions()->transactionStatus($messageReference);
Licence
MIT Licence
bennito254/co-opconnect 适用场景与选型建议
bennito254/co-opconnect 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 264 次下载、GitHub Stars 达 2, 最近一次更新时间为 2020 年 04 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「co-op bank」 「co-op api」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 bennito254/co-opconnect 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bennito254/co-opconnect 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 bennito254/co-opconnect 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Symfony integration for Czech bank account library
Check for holidays - localeaware
A PSR-7 compatible library for making CRUD API endpoints
A basic wrapper for citco/carbon which returns business days between two given dates.
Iranian payment gateways handler for laravel applicationss
PHP library to handle FinanzOnline web services.
统计信息
- 总下载量: 264
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-04-06