masif088/flexcodesdk

dev-main 2021-03-15 16:09 UTC

This package is not auto-updated.

Last update: 2024-04-21 15:42:48 UTC


README

Latest Version on Packagist Total Downloads Build Status StyleCI

This is where your description should go. Take a look at contributing.md to see a to do list.

Installation

Via Composer

$ composer require masif088/flexcodesdk:dev-master

Usage

Publish Vendor

$ php artisan vendor:publish

Choose 'flexcodesdk-config' and 'flexcodesdk-models'

Migrate Database

$ php artisan:migrate

Blade

{{ flexcodesdk::getRegistrationLink($user_id) }}

Edit app/Providers/EventServiceProvider.php

Event::listen('fingerprints.register', function($data)
{
    // Do some stuff before informing URL to user

    // inform SDK to open this URL
    echo url('test?message=' . $data['message']);
});


Event::listen('fingerprints.verify', function($data){
    $action = $data['extras']['action'];
    switch ($action) {
        case 'login':
            // Log user to database here, i.e: Adding new session etc.
            // Example: 
            // Session::add($data['user']->id);

            // Then tell SDK to open this page
            echo action('testController@index', array('message' => $data['message']));
            break;
        
        case 'transactions.confirm':
            // mark transaction as verified, example usage:

            // $transaction = Transaction::find($data['extras']['transaction_id']);
            // $transaction->verified = true;
            // $transaction->save();

            // Then tell SDK to open this page
            echo route('transactions', 
                array(
                    'message' => $data['message'], 
                    'id' => $data['extras']['transaction_id'])
                );
            break;
    }
});

Change log

Please see the changelog for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email feriharjulianto@gmail.com instead of using the issue tracker.

Credits

License

MIT. Please see the license file for more information.