agrekom/imoje-libs-module
Composer 安装命令:
composer require agrekom/imoje-libs-module
包简介
Payment core library, contains basic functions to implement Payment Method (ING BANK)
README 文档
README
It is a simple PHP library that allow implement payment gateway methods out of the box.
Requirements
Installation
git clonecomposer install
How to use:
Library provides few already created methods like generate form order or just generate form fields.
If you want to generate full form:
- First you need to initialize Payment instance and provide environment, service key and service id. The last parameter
languageis optional, if if won't be provided the default value will be used (which is 'en') - Then simply run
$payment->buildOrderForm($orderData)to build full form or$payment->buildFormFields($orderData)to build form fields.
Examples:
Build full form:
Order data must have fields:
amount, currency, orderId, customerFirstName, customerLastName
Optional data:
customerEmail, urlSuccess, urlFailure, urlReturn, urlNotification, twistoData, version
Example $orderData:
$orderData = [
'amount' => (int) (1.33 * 100), //INT, price should be multipled by 100 so for example 1.33 will be 133
'currency' => 'PLN', // see suported currences in 'Supported variables' sectiom
'orderId' => '123456790',
'customerFirstName' => 'John',
'customerLastName' => 'Doe',
'customerEmail' => 'john@doe.com',
'urlSuccess' => 'https://example.com/success.php',
'urlFailure' => 'https://example.com/failure.php',
'urlReturn' => 'https://example.com/return.php',
];
use Payment\Payment;
public function yourFunction()
{
// ...
$payment = new Payment(\Payment\Util::ENVIRONMENT_PRODUCTION, 'b1c8bd6c7411455aab3295c48fcf26a7', 'e692d208484b4d5887755362d0587a00', 'pl');
$form = $payment->buildOrderForm($orderData); // You can also pass second parameter `language` to generate form that will redirect to this language
}
The $form must contain $orderData and additional keys (signature must have which one hash method was use (for example sha256)), like:
serviceId, merchantId, signature
<input type="hidden" value="133" name="serviceId">
<input type="hidden" value="133" name="merchantId">
<input type="hidden" value="133" name="amount">
<input type="hidden" value="PLN" name="currency">
<input type="hidden" value="123456790" name="orderId">
<input type="hidden" value="John" name="customerFirstName">
<input type="hidden" value="Doe" name="customerLastName">
<input type="hidden" value="john@doe.com" name="customerEmail">
<input type="hidden" value="https://example.com/success.php" name="urlSuccess">
<input type="hidden" value="https://example.com/failure.php" name="urlFailure">
<input type="hidden" value="https://example.com/return.php" name="urlReturn">
<input type="hidden" value="7c46b5c9836520a9a0552d31136a705d3f7a7ea3db13de87f41fb3ee31f6dbff;sha256" name="signature">
and then you can wrap it to your own form HTML tag
<form method="POST" action="http://example.com/pl/payment">
<input type="hidden" value="133" name="serviceId">
<input type="hidden" value="133" name="merchantId">
<input type="hidden" value="133" name="amount">
<input type="hidden" value="PLN" name="currency">
<input type="hidden" value="123456790" name="orderId">
<input type="hidden" value="John" name="customerFirstName">
<input type="hidden" value="Doe" name="customerLastName">
<input type="hidden" value="john@doe.com" name="customerEmail">
<input type="hidden" value="https://example.com/success.php" name="urlSuccess">
<input type="hidden" value="https://example.com/failure.php" name="urlFailure">
<input type="hidden" value="https://example.com/return.php" name="urlReturn">
<input type="hidden" value="7c46b5c9836520a9a0552d31136a705d3f7a7ea3db13de87f41fb3ee31f6dbff;sha256" name="signature">
<input class="button" type="submit" value="Continue" id="submit-payment-form">
</form>
Additional features:
Library provides few additional methods that you can use.
First you need to add use Payment\Util; then you can:
Util::getSupportedCurrencies()- it will return an array with available currencies.Util::getSupportedLanguages()- it will return an array with available languages.Util::canUseForCurrency($currencyCode)-$currencyCodeshould be in format ISO4217. The method will return bool.
Supported variables:
The supported currencies are:
PLN
The supported languages are:
Polish, English
The format you should use for it is ISO 639-1 (Alpha-2 code)
agrekom/imoje-libs-module 适用场景与选型建议
agrekom/imoje-libs-module 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 290 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 09 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 agrekom/imoje-libs-module 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 agrekom/imoje-libs-module 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 290
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-09-15