Giter Club home page Giter Club logo

truelayer's Introduction

Truelayer Helper

requesting Truelayer API made simple

Usage

use Niceperson\Truelayer\Authorization;
use Niceperson\Truelayer\Credentials;
use Niceperson\Truelayer\Request;
use Niceperson\Truelayer\Data;

// best if taken from .env below's example is to make life easier
defined('TRUELAYER_CLIENT_ID') or define('TRUELAYER_CLIENT_ID', 'xxxx');
defined('TRUELAYER_CLIENT_SECRET') or define('TRUELAYER_CLIENT_SECRET', 'yyyyy');
defined('TRUELAYER_REDIRECT_URI') or define('TRUELAYER_REDIRECT_URI', 'https://localhost:3000/callback');
defined('TRUELAYER_USE_SANDBOX') or define('TRUELAYER_USE_SANDBOX', 'true');


$credentials = new Credentials(
    TRUELAYER_CLIENT_ID,
    TRUELAYER_CLIENT_SECRET,
    TRUELAYER_REDIRECT_URI,
    TRUELAYER_USE_SANDBOX,  // this will add mock provider when generatingn auth link
);

$truelayer_request = new Request(['timeout' => 60]); // options as per Guzzle client
$auth = new Authorization($truelayer_request, $credentials, TRUELAYER_USE_SANDBOX);


// to generate auth link
$auth_link = $auth->getAuthLink();

// to exchange code
$token = $auth->getAccessToken($code); // $code given by truelayer

// to perform data request using token.
$data = new Data($truelayer_request, $token, TRUELAYER_USE_SANDBOX);

//------------------------------------------------------------| data requests

$result = $data->fetch('META_ME');
$result = $data->fetch('ACCT_LIST');
$result = $data->fetch('CARD_LIST');
$result = $data->fetch('ACCT_LIST');
$result = $data->fetch('CARD_LIST');
$result = $data->fetch('ACCT_VIEW', $account_id);
$result = $data->fetch('CARD_VIEW', $account_id);
$result = $data->fetch('ACCT_BALANCE', $account_id);
$result = $data->fetch('CARD_BALANCE', $account_id);
$result = $data->fetch('ACCT_TRANSACTIONS', $account_id);
$result = $data->fetch('CARD_TRANSACTIONS', $account_id);
$result = $data->fetch('ACCT_TRANSACTIONS_PENDING', $account_id);
$result = $data->fetch('CARD_TRANSACTIONS_PENDING', $account_id);
$result = $data->fetch('ACCT_DIRECT_DEBITS', $account_id);
$result = $data->fetch('ACCT_STANDING_ORDER', $account_id);

//------------------------------------------------------------| Payment requests


/*          PAYMENT is NOT Completed yet. will be done in next release        */

Payment is in progress

truelayer's People

Contributors

niceperson avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.