e2consult/dnb-client

This package is abandoned and no longer maintained. No replacement package was suggested.

An API Tool that allows you to easily communicate with DNBs new API using Laravel.

1.0.1 2019-04-17 13:42 UTC

This package is auto-updated.

Last update: 2022-09-09 07:25:40 UTC


README

Latest Version on Packagist Quality Score License Total Downloads StyleCI

E2Consult is a webdevelopment team based in Oslo, Norway. You'll find more information about us on our website.

This package is made to easily communicate with DNBs API using PHP and Laravel, read more about the API.

Installation

You can install the package via composer:

composer require e2consult/dnb-client

Then you need to set your credentials in the .env file, and add the following array to your config/services.php file.

    'dnb' => [
        'client_id'     => env('DNB_CLIENT_ID'),
        'client_secret' => env('DNB_CLIENT_SECRET'),
        'api_key'       => env('DNB_API_KEY'),
        'region'       => env('DNB_REGION', 'eu-west-1'),
        'service'       => env('DNB_SERVICE', 'execute-api'),
        'endpoint'       => env('DNB_ENDPOINT', 'https://developer-api-sandbox.dnb.no'),
    ],

Usage

To get going you only need to pass the relevant customer ID when creating the client.

    use E2Consult\DNBApiClient\Client;

    $client = new Client($customerId);

    // Customer
    $client->getCustomerDetails();

    // Accounts
    $client->getAccounts();
    $client->getAccountDetails($accountNumber);
    $client->getAccountBalance($accountNumber);
    $client->getAccountTransactions($accountNumber, $from, $to);

    // Payments
    $client->initiatePayment($debitAccountNumber, $creditAccountNumber, $amount, $requestedExecutionDate);
    $client->updatePayment($accountNumber, $paymentId, $debitAccountNumber, $amount, $status, $requestedExecutionDate);
    $client->deletePayment($accountNumber, $paymentId);
    $client->getDuePayments($accountNumber);
    $client->getDuePayment($accountNumber, $paymentId);

    // Currencies
    $client->getCurrencyRates();
    $client->convertCurrency($targetCurrency);

    // Location
    $client->getBranches();
    $client->getBranch($branchId);
    $client->getATMs();

    $client->getNearestBranch($address);
    // or
    $client->getNearestBranch([$latitude, $longitude]);
    $client->getNearestATM($latitude = 0, $longitude = 0);

License

The MIT License (MIT).