PHP code example of mblsolutions / inspireddeck-php

1. Go to this page and download the library: Download mblsolutions/inspireddeck-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mblsolutions / inspireddeck-php example snippets


$deckAuthentication = new \MBLSolutions\InspiredDeck\Authentication();

$authentication = $deckAuthentication->password(1, 'auth-secret', '[email protected]', 'password');

[
    'token_type' => 'Bearer',
    'expires_in' => 31622400,
    'access_token' => 'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjBmOGMwNDAxZDAy',
    'refresh_token' => 'def5020002eca9ac7875d5d800c195024d7fb702535c0d30a0',
    'user' => [
        'name' => 'John Doe',
        'email' => '[email protected]',
        'role' => 'programme_manager'
    ]
];

\MBLSolutions\InspiredDeck\InspiredDeck::setToken('eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjBmOGMwNDAxZDAy');

\MBLSolutions\InspiredDeck\InspiredDeck::setToken('eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjBmOGMwNDAxZDAy');

$search = new \MBLSolutions\InspiredDeck\Search();

$result = $search->code([
    'serial' => 123456789,
    'pan' => null,
    'customer' => null,
    'transaction' => null,
]);

[   
    'data' => [
        'activation_date' => null,
        'asset' => "Example Gift Card",
        'balance' => 0,
        'created' => "2016-08-31T12:36:34+00:00",
        'currency_code' => "GBP",
        'currency_decimals' => 2,
        'display' => "12345*******6799",
        'expiration_date' => "2021-12-16T00:00:00+00:00",
        'profile' => "Example Codes",
        'serial' => 123456789,
        'sku' => "GIFT_CARD",
        'status' => "active",
        'type' => "physical",
        'updated' => "2019-10-30T11:35:49+00:00",
        'valid_from' => null,
        'valid_to' => null,
    ]
];

\MBLSolutions\InspiredDeck\InspiredDeck::setToken('eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjBmOGMwNDAxZDAy');

$search = new \MBLSolutions\InspiredDeck\Credit();

$result = $search->credit([
    'serial' => 12345678,
    'amount' => 1000,
    'reference' => 'TEST-REF-1'
]);

[   
    'data' => [
        'activation_date' => null,
        'asset' => "Example Gift Card",
        'balance' => 1000,
        'created' => "2016-08-31T12:36:34+00:00",
        'currency_code' => "GBP",
        'currency_decimals' => 2,
        'display' => "12345*******6799",
        'expiration_date' => "2021-12-16T00:00:00+00:00",
        'profile' => "Example Codes",
        'serial' => 123456789,
        'sku' => "GIFT_CARD",
        'status' => "active",
        'type' => "physical",
        'updated' => "2019-10-30T11:35:49+00:00",
        'valid_from' => null,
        'valid_to' => null,
    ]
];

\MBLSolutions\InspiredDeck\InspiredDeck::setToken('eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjBmOGMwNDAxZDAy');

$search = new \MBLSolutions\InspiredDeck\TransactionHistory();

$page = 1;
$limit = 5;

$result = $search->all(12345678, $page, $limit);

[
    'data' => [
        [
            'action' => "search",
            'action_name' => "Find Code",
            'amount' => 1000,
            'comment' => null,
            'currency_code' => "GBP",
            'currency_decimals' => 2,
            'date' => "2020-10-01T10:40:40+00:00",
            'external_ref' => null,
            'origin_ref' => null,
            'reference' => "TEST-REF-1",
            'reversed' => false,
            'serial' => 123456789,
            'user' => "John Doe"
        ],
        [
            'action' => "search",
            'action_name' => "Find Code",
            'amount' => 0,
            'comment' => null,
            'currency_code' => "GBP",
            'currency_decimals' => 2,
            'date' => "2020-10-01T10:40:33+00:00",
            'external_ref' => null,
            'origin_ref' => null,
            'reference' => "ID-1601548826005",
            'reversed' => false,
            'serial' => 123456789,
            'user' => "John Doe"
        ]
    ]
];
bash
composer