ardani/fio-payment-wrapper

1.0.1 2019-11-04 06:21 UTC

This package is auto-updated.

Last update: 2024-04-04 15:58:24 UTC


README

Latest Stable Version Total Downloads License Coverage Status

Fio bank REST API implementation in PHP. It allows you to download and iterate through account balance changes.

Usage

  1. Install the latest version with composer require ardani/fio-payment-wrapper
  2. Create a token in the ebanking (Nastavení / API)
  3. Use it according to the example bellow and check the docblocks

Downloading

<?php
require_once 'vendor/autoload.php';

$downloader = new FioApi\Downloader('TOKEN@todo');
$transactionList = $downloader->downloadSince(new \DateTimeImmutable('-1 week'));

foreach ($transactionList->getTransactions() as $transaction) {
    var_dump($transaction); //object with getters
}

Uploading

Domestic payment (in Czechia)

<?php
require_once 'vendor/autoload.php';

$token = get_your_fio_token();
$uploader = new FioApi\Uploader($token);
// currency, iban, bic is not needed
$account = new FioApi\Account('XXXXXXXXXX', 'ZZZZ', NULL, NULL, NULL);
$tx = Transaction::create((object) [
    'accountNumber' => 'YYYYYYYYYY',
    'bankCode' => 'WWWW',
    'date' => new \DateTime('2016-07-20'),
    'amount' => 6.66,
    'currency' => 'CZK',
    'userMessage' => 'money wasting',
    'comment' => 'fioapi.test'
]);

$builder = new FioApi\DomesticPaymentBuilder();
$request = $builder->build($account, [$tx]);
$response = $uploader->sendRequest($request);

echo $response->getStatus();

Requirements

Fio API PHP works with PHP 7.1 or higher.

Submitting bugs and feature requests

Bugs and feature request are tracked on GitHub