uocnv/baokim-payment 问题修复 & 功能扩展

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

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

uocnv/baokim-payment

最新稳定版本:1.2

Composer 安装命令:

composer require uocnv/baokim-payment

包简介

A client to connect to Bao Kim payment gateway

README 文档

README

Package is the source set to connect to Bao Kim's payment gateways, including the following forms: ATM/QR, Momo official, VA, Disbursement

Feature

[x] Log request, webhook response, error

[x] Multiple key

Installation

You can install the package via composer:

composer require uocnv/baokim-payment

Usage

ATM/QR, Momo Official, Mobile card

  • Get a list of banks:
$arrayBanks = Uocnv\BaokimPayment\Clients\ATM::getBankList();
  • Request to create payment order of ATM/QR:
$transactionId = 'abc123';
$amount        = 110000;
$bankId        = 124; // $bankId = 0 nếu là hình thức QR
$referer       = 'http://example.com';
$email         = $user->use_email;
$phone         = $user->use_phone;
$dataRequest = Uocnv\BaokimPayment\Clients\ATM::request(
    transactionId: $transactionId,
    amount       : $amount,
    bankId       : $bankId,
    referer      : $referer,
    userEmail    : $email,
    userPhone    : $phone
);
  • Request to create payment order of Mobile card:
$transactionId   = DB::table('money_mobile_cards')->insertGetID([]);
$amount          = 110000;
$pin             = '071608559897';
$serial          = '098353000029197';
$telecomOperator = Uocnv\BaokimPayment\Enums\TelecomOperator::VIETTEL;
$dataRequest     = Uocnv\BaokimPayment\Clients\MobileCard::request(
    transactionId  : $transactionId,
    amount         : $amount,
    pin            : $pin,
    serial         : $serial,
    telecomOperator: $telecomOperator
);
  • Check the integrity of data received from webhooks:
$webhookData  = $request->all();
$verifiedData = Uocnv\BaokimPayment\Clients\ATM::checkValidData($webhookData);

Collection payment & Disbursement payments

  • Create new virtual account:
try {
    $vaClient = new Uocnv\BaokimPayment\Clients\VA('production');
    $data     = $vaClient->registerVirtualAccount(
        accName   : 'CONG THANH TOAN',
        orderId   : 'trans' . rand(1, 99) . time(),
        amountMax : 5000000,
        expireDate: Carbon::now()->addDay()->format('Y-m-d H:i:s')
    );
} catch (GuzzleException|CollectionRequestException|SignFailedException) {
}
  • Update virtual account:
try {
    $vaClient = new Uocnv\BaokimPayment\Clients\VA('production');
    $data     = $vaClient->updateVirtualAccount(
        accName   : 'CONG THANH TOAN',
        orderId   : 'trans' . rand(1, 99) . time(),
        amountMax : 5000000,
        expireDate: Carbon::now()->addDay()->format('Y-m-d H:i:s')
    );
} catch (GuzzleException|CollectionRequestException|SignFailedException) {
}
  • Check the integrity of data received from webhooks:
$vaClient      = new Uocnv\BaokimPayment\Clients\VA('production');
$webhookData   = $request->getContent();
$dataValidated = $vaClient->checkValidData($webhookData);
  • Look up for Partner balance:
$disbursement = new Uocnv\BaokimPayment\Clients\Disbursement('production');
try {
    $data    = $disbursement->lookUpForBalance();
    $balance = $data['Available'];
} catch (GuzzleException|CollectionRequestException|SignFailedException) {
}
  • Look up for transfer info:
$disbursement = new Uocnv\BaokimPayment\Clients\Disbursement('production');
try {
    $referenceId = 'gd_123123';
    $data    = $disbursement->lookUpForTransferInfo($referenceId);
} catch (GuzzleException|CollectionRequestException|SignFailedException) {
}
  • Verify customer information
$disbursement = new Uocnv\BaokimPayment\Clients\Disbursement('production');
try {
    $accNo   = '21110001400973';
    $bankNo  = 970437; // Get from Uocnv\BaokimPayment\Clients\Disbursement::BANK_TRANSFER_ASSISTANCE
    $data    = $disbursement->verifyCustomerInfo($accNo, $bankNo);
} catch (GuzzleException|CollectionRequestException|SignFailedException) {
}
  • Transfer money
$disbursement = new Uocnv\BaokimPayment\Clients\Disbursement('production');
$money        = 1000000;
$referenceId  = 'gd_123123';
$memo         = 'chuyen tien';
$accNo        = '21110001400973';
$bankNo       = 970437;
try {
    $response = $disbursement->transferMoney($money, $referenceId, $memo, $accNo, $bankNo);
} catch (GuzzleException|CollectionRequestException|SignFailedException) {
}

Security

If you discover any security related issues, please email uocnv.soict.hust@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.

统计信息

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

GitHub 信息

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

其他信息

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