fmtl-studio / laravel-transcard
Laravel 接口适配器,支持通过 Transcard 服务接收付款。
Requires
- illuminate/support: ^5.8|^6.0
Requires (Dev)
- orchestra/testbench: ^4.0
This package is auto-updated.
Last update: 2024-09-16 16:56:11 UTC
README
为方便与 Transcard VPOS 集成而设计的 Laravel 封装。
由 Fundamental Studio Ltd. 以爱和代码创造。Fundamental Studio Ltd.
安装
该包与 Laravel 7+ 版本兼容。
通过 composer
$ composer require fmtl-studio/laravel-transcard
安装后,Laravel 应自动发现该包。为了配置该包,您需要使用以下命令发布配置文件:
$ php artisan vendor:publish --provider="Fundamental\Transcard\TranscardServiceProvider"
发布配置文件后,您应将所需的密钥添加到全局 .env Laravel 文件中
TRANSCARD_MERCHANT_ID=XXXXXXXXXX # Official Merchant ID number, obtained from Transcard
TRANSCARD_PRODUCTION=FALSE # Should the platform use the production or the test Transcard endpoint
TRANSCARD_PRIVATE_KEY="" # Location of your private key file, make sure it is not available to public
TRANSCARD_PRIVATE_KEY_PASS="" # Location of your private key password, make sure it this file is not available to public
TRANSCARD_PUBLIC_KEY="" # Location of your public key file, make sure it is not available to public
TRANSCARD_RETURN_URL=""
TRANSCARD_GENERATE_INVOICE=TRUE # Should the package generate random invoice number if one isn't presented
您已准备就绪,可以开始使用了。
文档和使用说明
我们包的使用非常流畅且简单。首先,您需要使用我们包的正确命名空间
use Fundamental\Transcard\Transcard;
创建我们包的实例
$epay = new Transcard('paylogin', array $data, 'BG'); // The second parameter is documented in the next section and the third parameter is the request language page will be shown in: BG or EN, default: BG. $epay->setData( 1000000000, // Could be either number or false(will be auto-generated if EPAY_GENERATE_INVOICE=TRUE) 40.00, // Amount of the payment, double formatted either as double or string 'Description of the payment in less than 100 symbols.', // Could be empty );
setData 函数可以省略。数据可以作为数组设置为主类构造函数的第二个参数。
$epay = new Transcard('paylogin', [ 'invoice' => 1000000000, // Could be either number or false(will be auto-generated if EPAY_GENERATE_INVOICE=TRUE) 'amount' => 40.00, // Amount of the payment, double formatted either as double or string 'description' => 'Description of the payment in less than 100 symbols.' // Could be empty ]);
所有可用方法在下一节中展示,包括设置器和获取器方法。
检索包含所有所需参数的正确和格式化的隐藏字段、表单或数组。
// Would return all hidden fields as formatted html $epay->generatePaymentFields(); // Would return html form with the first parameter as id $epay->generatePaymentForm('#form-id'); // Would return array with all needed parameters for the platform request you need to do on your own $epay->getPaymentParameters();
所有可用方法在下一节中展示。
变更日志
所有更改均可在我们的变更日志文件中找到。
支持
对于任何进一步的问题、功能请求、问题、想法等,您可以创建问题跟踪器或给我们发送邮件至 support@fundamental.bg
贡献
阅读贡献文件以获取更多信息。
鸣谢
- Konstantin Rachev
- Vanya Ananieva
该包由 Fundamental Studio Ltd. 团队打包并贡献给社区。
问题
如果您发现任何问题,请使用问题跟踪器。
安全
如果您发现任何安全相关的问题,请通过电子邮件发送至 konstantin@fundamental.bg 或 support@fundamental.bg 而不是使用问题跟踪器。
许可证
MIT 许可证(MIT)。有关更多信息,请参阅许可证文件。