azaharizaman/nexus-payment-bank 问题修复 & 功能扩展

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

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

azaharizaman/nexus-payment-bank

最新稳定版本:v0.1.0-alpha1

Composer 安装命令:

composer require azaharizaman/nexus-payment-bank

包简介

Payment bank extension providing direct bank integrations for real-time payments, open banking (PSD2), and bank account verification

README 文档

README

Version: 0.1.0 Status: In Progress (see IMPLEMENTATION_SUMMARY.md for details) PHP: ^8.3 Extends: azaharizaman/nexus-payment

Overview

Nexus\PaymentBank is an extension package for Nexus\Payment providing direct bank integrations for open banking (PSD2/Open Banking UK), real-time payments (RTP, FAST, SEPA Instant), and bank account verification services (Plaid, Yodlee, MX).

It provides a unified abstraction layer over various banking providers, handling connection lifecycles, account data retrieval, ownership verification, and payment initiation.

Installation

composer require azaharizaman/nexus-payment-bank

Features

  • Bank Connection Management: Securely link and manage bank connections (OAuth2, Credentials).
  • Account Information: Retrieve account details, balances, and transaction history.
  • Account Verification: Verify account ownership via instant verification or micro-deposits.
  • Payment Initiation: Initiate and track payments directly from bank accounts (PIS).
  • Security: Built-in encryption for sensitive credentials using Nexus\Crypto.

Architecture

This package follows the Nexus Monorepo architecture:

  • Contracts: Define the behavior (src/Contracts).
  • Services: Implement the business logic (src/Services).
  • Entities: Rich domain models (src/Entities).
  • Providers: Adapter pattern for external banking APIs (src/Contracts/ProviderInterface).

Usage

1. Managing Bank Connections

Use BankConnectionManagerInterface to handle the lifecycle of a bank connection.

use Nexus\PaymentBank\Contracts\BankConnectionManagerInterface;

public function connect(BankConnectionManagerInterface $manager)
{
    // 1. Initiate connection flow
    $result = $manager->initiateConnection(
        providerName: 'plaid',
        tenantId: 'tenant-1',
        parameters: [
            'redirect_url' => 'https://app.example.com/callback',
            'scopes' => ['transactions', 'auth']
        ]
    );

    // Redirect user to the authorization URL from $result
    
    // 2. Complete connection after callback
    $connection = $manager->completeConnection(
        providerName: 'plaid',
        tenantId: 'tenant-1',
        callbackData: [
            'public_token' => 'public-token-from-callback',
            'institution_id' => 'ins_123'
        ]
    );
}

2. Retrieving Account Data

Use AccountServiceInterface to fetch account information.

use Nexus\PaymentBank\Contracts\AccountServiceInterface;

public function showAccounts(AccountServiceInterface $service, string $connectionId)
{
    // Get all accounts for a connection
    $accounts = $service->getAccounts($connectionId);

    foreach ($accounts as $account) {
        echo $account->getName() . ': ' . $account->getBalance()->getAmount();
    }
    
    // Get transactions
    $transactions = $service->getTransactions(
        connectionId: $connectionId,
        accountId: $accounts[0]->getId(),
        startDate: new \DateTimeImmutable('-30 days'),
        endDate: new \DateTimeImmutable('now')
    );
}

3. Verifying Accounts

Use VerificationServiceInterface for KYC and ownership checks.

use Nexus\PaymentBank\Contracts\VerificationServiceInterface;

public function verify(VerificationServiceInterface $service, string $connectionId, string $accountId)
{
    // Instant verification (e.g., Plaid Identity)
    $verificationResult = $service->verifyOwnership($connectionId, $accountId, [
        'name' => 'John Doe',
        'email' => 'john@example.com'
    ]);
    
    // Micro-deposit verification
    $verificationId = $service->initiateMicroDeposits($connectionId, $accountId);
    
    // ... later ...
    $verified = $service->verifyMicroDeposits($connectionId, $verificationId, [0.12, 0.45]);
}

4. Initiating Payments

Use PaymentInitiationServiceInterface for PIS (Payment Initiation Services).

use Nexus\PaymentBank\Contracts\PaymentInitiationServiceInterface;
use Nexus\PaymentBank\ValueObjects\Beneficiary;
use Nexus\Common\ValueObjects\Money;

public function pay(PaymentInitiationServiceInterface $service, string $connectionId, string $sourceAccountId)
{
    $beneficiary = new Beneficiary(
        name: 'Acme Corp',
        iban: 'GB82WEST12345698765432',
        bic: 'WESTGB21XXX',
        address: '123 Business St, London'
    );

    $result = $service->initiatePayment(
        connectionId: $connectionId,
        sourceAccountId: $sourceAccountId,
        beneficiary: $beneficiary,
        amount: Money::of(100, 'USD'),
        reference: 'INV-001'
    );
    
    // Check status
    $status = $service->getPaymentStatus($connectionId, $result->paymentId);
}

Testing

composer test

License

MIT License. See LICENSE for details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固