2017 © Pedro Peláez
 

library hack-bpay-reader

Hack BPAY Reader - Biller Information File Reader

image

b-b3rn4rd/hack-bpay-reader

Hack BPAY Reader - Biller Information File Reader

  • Friday, May 2, 2014
  • by b-b3rn4rd
  • Repository
  • 1 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

# ABOUT

Build Status, (*1)

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

#REQUIREMENTS

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

#INSTALLATION

Install Hack BPAY Reader using Composer:, (*4)

{
    "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, (*5)

The Versions

02/05 2014

dev-master

9999999-dev

Hack BPAY Reader - Biller Information File Reader

  Sources   Download

The Requires

  • hhvm >=3.0

 

The Development Requires

by Bernard Baltrusaitis

hhvm reader hacklang bpay

24/04 2014

1.0.0

1.0.0.0

Hack BPAY Reader - Biller Information File Reader

  Sources   Download

The Requires

  • hhvm >=3.0

 

The Development Requires

by Bernard Baltrusaitis

hhvm reader hacklang bpay