zeevx/laravel-ovalfi

A Laravel Package for OvalFi - https://dev.ovalfi-app.com/

0.1.2 2022-08-25 15:41 UTC

This package is auto-updated.

Last update: 2024-10-25 20:35:48 UTC


README

OvalFi Laravel Package

Laravel-OvalFi helps you Set up, test, and manage your OvalFi integration directly in your Laravel App.

Latest Version on Packagist Total Downloads GitHub Actions

Installation

You can install the package via composer:

composer require zeevx/laravel-ovalfi

After installation, run (to create the ovalfi.php config file):

php artisan ovalfi:publish

Add the following to your .env, you can get these values from your ovalfi dashboard:

NB: OVALFI_MODE should be set to sandbox for testing and live for production.

OVALFI_MODE=
OVALFI_PUBLIC_KEY=
OVALFI_BEARER_TOKEN=

Usage:

Use the helper function

ovalfi() //It works automatically 😍

Create customer

ovalfi()->createCustomer(
        string $name,
        string $mobile_number,
        string $email,
        string $reference,
        string $yield_offering_id
        );

Update customer

ovalfi()->updateCustomer(
        string $customer_id,
        string $name = null,
        string $mobile_number = null,
        string $email = null,
        string $reference = null,
        string $yield_offering_id = null
    );

Get customers

ovalfi()->getCustomers();

Get customer

ovalfi()->getCustomer(
        string $customer_id
    );

Get exchange rate

ovalfi()->getExchangeRate(
        float $amount,
        string $currency,
        string $destination_currency
    );

Initiate transfer

NB: Please check this doc to understand the parameters better: https://docs.ovalfi.com/docs/initiate-transfer

ovalfi()->initiateTransfer(
        string $customer_id,
        float $amount,
        string $currency,
        array $destination,
        string $reason,
        string $reference,
        string $note = null
    );

Cancel transfer by batch ID

ovalfi()->cancelTransferByBatchId(
        string $batch_id,
        string $reason
    );

Get business portfolios

ovalfi()->getBusinessPortfolios();

Create yield offering profile

ovalfi()->createYieldOfferingProfile(
        string $name,
        string $reference,
        string $description,
        string $portfolio_id = null,
        float $apy_rate = null,
        string $currency = null,
        int $deposit_lock_day = null,
        float $minimum_deposit_allowed = null,
        float $maximum_deposit_allowed = null,
        int $yieldable_after_day = null,
        float $withdrawal_limit_rate = null
    );

Get yield profiles

ovalfi()->getYieldProfiles();

Get yield profile

ovalfi()->getYieldProfile(
        string $yield_offering_id
    );

Update yield offering profile

ovalfi()->updateYieldOfferingProfile(
        string $yield_offering_id,
        string $name = null,
        string $reference = null,
        string $description = null,
        string $portfolio_id = null,
        float $apy_rate = null,
        string $currency = null,
        int $deposit_lock_day = null,
        float $minimum_deposit_allowed = null,
        float $maximum_deposit_allowed = null,
        int $yieldable_after_day = null,
        float $withdrawal_limit_rate = null
    );

Get customer balance

ovalfi()->getCustomerBalance(
        string $customer_id
    );

Initiate savings deposit

ovalfi()->initiateSavingsDeposit(
        string $customer_id,
        string $reference,
        float $amount
    );

Get deposits

ovalfi()->getDeposits();

Get deposit by batch ID

ovalfi()->getDepositByBatchId(
        string $batch_id
    );

Initiate savings withdrawal

ovalfi()->initiateSavingsWithdrawal(
        string $customer_id,
        string $reference,
        float $amount
    );

Security

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

Credits

License

The MIT License (MIT). Please see License File for more information.