thejano/fib-payouts-laravel 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

thejano/fib-payouts-laravel

Composer 安装命令:

composer require thejano/fib-payouts-laravel

包简介

A Laravel package for FIB payouts using OAuth2 authentication.

README 文档

README

Introduction

thejano/fib-payouts-laravel is a Laravel package that provides an easy way to interact with the FIB Payout API using OAuth2 authentication. It supports:

  • Retrieving an OAuth2 access token
  • Creating payouts
  • Authorizing payouts
  • Fetching payout details

This package supports Laravel 9 and above and simplifies integration with the FIB API.

Requests

All requests need to be authenticated with an Access Token acquired via the OAuth2 Client Credentials Grant Flow using the client_id and client_secret provided by FIB.

API Flow

  • Authentication: Authenticates the user and provided credentials, returning a token for future requests.
  • Payout Creation: Creates a payout transaction.
  • Payout Authorization: Authorizes a payout after its creation, ensuring validation before processing. This step secures the transaction before transferring funds to the recipient's account.
  • Getting Payout Details: Retrieves all relevant details of a payout transaction.

Installation

1. Install the Package

Run the following command:

composer require thejano/fib-payouts-laravel

2. Publish the Configuration File

php artisan vendor:publish --provider="TheJano\FibPayouts\Providers\FibPayoutsServiceProvider"

This will create the config file config/fib-payout.php.

3. Configure Environment Variables

Add the following to your .env file:

FIB_PAYOUT_ENV=staging # Change to 'production' for live API
FIB_PAYOUT_CLIENT_ID=your_client_id
FIB_PAYOUT_CLIENT_SECRET=your_client_secret

4. Clear Config Cache

Run:

php artisan config:clear

Usage

This package provides a Facade for easy usage:

use TheJano\FibPayouts\Facades\FibPayout;

1. Get OAuth2 Token

This function retrieves an OAuth2 access token, which is required for making API requests.

$token = FibPayout::getToken();

Response:

"your_access_token"

2. Create a Payout

This function initiates a payout transaction by providing the necessary details.

$payout = FibPayout::createPayout(
    amount: 1000,
    targetAccountIban: 'IQ23FIQB004085190510001', 
    description: 'Payment for services'
);

Response:

{
    "payoutId": "12345-abcde-67890"
}

3. Authorize a Payout

After creating a payout, it must be authorized to complete the transaction.

$response = FibPayout::authorizePayout('12345-abcde-67890');

Response:

If the payout is successfully authorized, the response will be empty. If there is an error, it will return an error.

4. Get Payout Details

This function retrieves details of a specific payout transaction.

$details = FibPayout::getPayoutDetails('12345-abcde-67890');

Expected Response:

{
    "payoutId": "12345-abcde-67890",
    "status": "AUTHORIZED",
    "targetAccountIban": "IQ23FIQB004085190510001",
    "description": "Payment for services",
    "amount": {
        "amount": 1000,
        "currency": "IQD"
    },
    "authorizedAt": "2025-03-09T08:45:52.516174Z",
    "failedAt": null
}

Response Fields:

  • payoutId: The unique identifier of the payout.
  • status: The current status of the payout, which can be one of the following: CREATED, AUTHORIZED, FAILED.
  • targetAccountIban: The IBAN of the recipient's account.
  • description: A string describing the transaction.
  • amount: The payout amount to be transferred.
  • authorizedAt: An integer representing the time of the transaction authorization (e.g., 1720599438). This field can be null if the transaction wasn't authorized.
  • failedAt: An integer representing the time of the transaction failure (e.g., 1720599438). This field can be null if the transaction was successful.

Running Tests

Run Pest Tests

./vendor/bin/pest

If using Laravel:

php artisan test

License

This package is released under the MIT License.

Support

If you encounter any issues, feel free to open an issue on GitHub or contact TheJano.

thejano/fib-payouts-laravel 适用场景与选型建议

thejano/fib-payouts-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 22 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 03 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 thejano/fib-payouts-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 thejano/fib-payouts-laravel 我们能提供哪些服务?
定制开发 / 二次开发

基于 thejano/fib-payouts-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 22
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 28
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-03-09