rober-song/laravel-line-pay
最新稳定版本:v0.0.13
Composer 安装命令:
composer require rober-song/laravel-line-pay
包简介
LINE Pay for Laravel
关键字:
README 文档
README
申請sandbox帳號
套件安裝
引入 package 到 composer.json
composer require rober-song/laravel-line-pay
Laravel
發布設定檔案
php artisan vendor:publish --provider="Rober\LinePay\LinePayProvider"
設定檔案
設定檔案在 config/line_pay.php
簡介
- 透過 facade
LinePay來使用
use Rober\LinePay\LinePay; $response = LinePay::request([ 'amount' => 100, 'currency' => 'TWD', 'orderId' => 'order-123' ]); return $response->getInfo();
Testing
<?php /** * fake預設回傳 * @see \Rober\LinePay\Fakes\PaymentFake::DEFAULT_RETURN */ use Rober\LinePay\LinePay; test('[api] 測試確認', function () { LinePay::fake()->setReturn(info: ['orderId' => 'B',]); // 請求自己的對應api $response = $this->json('POST', '/line/pay/confirm/1'); // 驗證 $response->assertJson(['orderId' => 'B']); }); test('[api] 多個請求', function () { LinePay::fake() ->setReturn(info: ['orderId' => 'A',]) ->setReturn(code: '1141', message: 'Payment account error'); // 請求自己的對應api $response = $this->json('POST', '/line/pay/A/and/B'); // 驗證 $response->assertStatus(400); });
todo
- 製作type (幣別, 付款方式, 語系, 確認網址)等等
- 製作spy的assert (確認是否皆有用到設定的期望、指定對應接口)
统计信息
- 总下载量: 16
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-01-22