定制 b-b3rn4rd/hack-bpay-reader 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

b-b3rn4rd/hack-bpay-reader

Composer 安装命令:

composer require b-b3rn4rd/hack-bpay-reader

包简介

Hack BPAY Reader - Biller Information File Reader

README 文档

README

Build Status

Hack BPAY Reader is an experimental library written in hack. It decrypts and parses BPAY biller information file(s).

#REQUIREMENTS

Hack BPAY Reader requires hhvm version 3 or greater, valid passphrase and installed gnupg.

#INSTALLATION

Install Hack BPAY Reader using Composer:

{
    "require": {
        "b-b3rn4rd/hack-bpay-reader": "1.0.*"
    }
}

#USAGE

###Basic usage

<?hh 

require 'vendor/autoload.php';

use BPAY\Transaction;
use BPAY\Reader;
use BPAY\Filters;

function main():void {
    // passphrase used to decrypt the BPAY files. It's important that it match the passphrase provided to the bank.
    $passphrase = 'testing';
    
    // absolute path to GnuPG binary
    $gpgbinary = '/usr/bin/gpg';
    
    // path where BPAY biller information file(s) are stored
    $filespath = '/home/bernard/gpg/*.gpg';

    $reader = new Reader($gpgbinary, $passphrase, $filespath);
    $transactions = $reader->read();


    foreach ($transactions as $transaction) {
        /* ... */
    }
}
main();

Using optional callback

// move processed files to another folder
$processedDir = '/home/bernard/gpg/processed';
$transactions = $reader->read($filename ==> {
    rename($filename, sprintf('%s/%s', $processedDir, $filename->getFilename()));
});

Using predefined filters

$filteredTransactions = (new Filters())->filterIsPayment($transactions);

Available filters

class Filters
{    
    /**
     * Filter transactions by customer reference number
     *
     * @param Vector<Transaction> $collection transactions collection
     * @param string $crn customer reference number 
     * @return Vector<Transaction> transactions filtered by customer reference number 
     */
    public function filterByCrn(Vector<Transaction> $collection, string $crn): Vector<Transaction>;
    
    /**
     * Filter transactions by filename
     *
     * @param Vector<Transaction> $collection transactions collection
     * @param string $filename source filename 
     * @return Vector<Transaction> transactions filtered by source filename 
     */
    public function filterByFilename(Vector<Transaction> $collection, string $filename): Vector<Transaction>;
    
    /**
     * Filter transactions by VISA card
     *
     * @param Vector<Transaction> $collection transactions collection
     * @return Vector<Transaction> transactions filtered by VISA card 
     */
    public function filterPaidByVISA(Vector<Transaction> $collection): Vector<Transaction>;

    /**
     * Filter transactions by Master Card card
     *
     * @param Vector<Transaction> $collection transactions collection
     * @return Vector<Transaction> transactions filtered by Master Card card 
     */
    public function filterPaidByMasterCard(Vector<Transaction> $collection): Vector<Transaction>;

    /**
     * Filter transactions by debit account 
     *
     * @param Vector<Transaction> $collection transactions collection
     * @return Vector<Transaction> transactions filtered by debit account 
     */
    public function filterPaidByDebitAccount(Vector<Transaction> $collection): Vector<Transaction>;

    /**
     * Filter transactions by debit account 
     *
     * @param Vector<Transaction> $collection transactions collection
     * @return Vector<Transaction> transactions filtered by debit account 
     */
    public function filterPaidByOtherCard(Vector<Transaction> $collection): Vector<Transaction>;

   /**
    * Filter transactions by payment type is payment 
    *
    * @param Vector<Transaction> $collection transactions collection
    * @return Vector<Transaction> transactions filtered by payment type is payment 
    */
    public function filterIsPayment(Vector<Transaction> $collection): Vector<Transaction>;

   /**
    * Filter transactions by payment type is reversal 
    *
    * @param Vector<Transaction> $collection transactions collection
    * @return Vector<Transaction> transactions filtered by payment type is reversal 
    */
    public function filterIsReversal(Vector<Transaction> $collection): Vector<Transaction>;

   /**
    * Filter transactions by payment type is error correction
    *
    * @param Vector<Transaction> $collection transactions collection
    * @return Vector<Transaction> transactions filtered by payment type is error correction 
    */
    public function filterIsErrorCorrection(Vector<Transaction> $collection): Vector<Transaction>;
}    

#LICENSE

Unlicened

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2014-04-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固