/cm-telecom

iDIN and IBAN PHP Package

Primary LanguagePHPMIT LicenseMIT

IDIN logo

Build Status Latest Stable Version License Total Downloads codecov Scrutinizer Code Quality

Introduction

iDIN is used for personal identification by bank and is supported by Dutch banks. With iDIN you can be sure who is registering on your application. This PHP package contains a client for CM Telecom.

See for more information: https://www.idin.nl

Installation

Download the package using composer

Install package by running the command:

$ composer require nimbles-nl/cm-telecom

Usage

This package is easy to use and can be used in any php project with php 7.0 or later.

Initializing iDIN Client

use GuzzleHttp\Client as GuzzleClient;
use Http\Adapter\Guzzle6\Client as GuzzleAdapter;

$adapter = new GuzzleAdapter(new GuzzleClient());

$apiToken        = 'secret-token';
$apiUrl          = 'https://idin.cmtelecom.com/idin/v1.0/test';
$applicationName = 'MyApp';

$client = new IDINClient($adapter, $apiToken, $apiUrl, $applicationName);

Get a list of issuers

$issuers = $client->getIssuers();

Start an iDIN Transaction

$issuers = $client->getIssuers();

$issuer = $issuers[0];
$transaction = $client->getIDINTransaction($issuer);

// Remember this data / store it in your database
$transactionId     = $transaction->getTransactionId();
$entranceCode      = $transaction->getEntranceCode();
$merchantReference = $transaction->getMerchantReference();

// Redirect the user to the bank page
return new RedirectResponse($transaction->getAuthenticationUrl());

Receive an array of user details with the iDIN Transaction object

$transaction = new IDINTransaction($transactionId, $merchantReference, $entranceCode);

$userData = $client->getUserInfo($transaction);

You can also receive bank account details with the IBANClient. It works almost the same as with IDIN. The client is already included in this package, but remember you use a different url for the api requests.

Initializing IBAN Client

use GuzzleHttp\Client as GuzzleClient;
use Http\Adapter\Guzzle6\Client as GuzzleAdapter;

$adapter = new GuzzleAdapter(new GuzzleClient());

$apiToken        = 'secret-token';
$apiUrl          = 'https://ibancheck.cmdisp.com/ibancheck/v1.0/test';
$applicationName = 'MyApp';

$client = new IBANClient($adapter, $apiToken, $apiUrl, $applicationName);

Get a list of issuers

$issuers = $client->getIssuers();

Start an IBAN Transaction

$issuers = $client->getIssuers();

$issuer = $issuers[0];
$transaction = $client->getIBANTransaction($issuer);

// Remember this data / store it in your database
$transactionId     = $transaction->getTransactionId();
$entranceCode      = $transaction->getEntranceCode();
$merchantReference = $transaction->getMerchantReference();

// Redirect the user to the bank page
return new RedirectResponse($transaction->getAuthenticationUrl());

Receive an array of bank details with the IBAN Transaction object

$transaction = new IBANTransaction($transactionId, $merchantReference, $entranceCode);

$userData = $client->getTransactionInfo($transaction);