pkj/sbanken-bundle

There is no license information available for the latest version (1.0.0) of this package.

1.0.0 2018-01-25 21:51 UTC

This package is auto-updated.

Last update: 2024-04-29 03:53:41 UTC


README

Create symfony based php apps with integration to Sbanken.

Uses https://github.com/peec/sbanken library. See that for docs of usage.

Install

Add to parameters.yml.dist:

parameters:
    #.......
    sbanken_client_id: ~
    sbanken_client_secret: ~
    sbanken_customer_id: ~

Add to config.yml:

pkj_sbanken:
    client_id: '%sbanken_client_id%'
    client_secret: '%sbanken_client_secret%'
    customer_id: '%sbanken_customer_id%'

Add to AppKernel.php:

    new Pkj\Bundle\SbankenBundle\PkjSbankenBundle()

Run composer require

composer require pkj/sbanken-bundle:^1.0

You will be asked to fill in client_id, client_secret and customer_id. Get these from sbanken website. (customer_id is your person number).

Usage

This bundle exposes a new service pkj_sbanken.client which you have access to getApi().

// Example, this can be run from controllers:

$bankAccountNumber = 11111111111;
$transactionRequest = new TransactionListRequest($bankAccountNumber);

$api = $transactions = $this->get('pkj_sbanken.client')->getApi();
$api->authorize();
$transactions = $api->Transactions()->getList($transactionRequest);
var_dump($transactions);
exit;