Skip to content

henryejemuta/laravel-clubkonnect

Repository files navigation

Laravel ClubKonnect

Latest Version on Packagist Latest Stable Version Total Downloads License Quality Score

What is ClubKonnect

The ClubKonnect API is an HTTPs GET API that allows you to integrate all ClubKonnect virtual top-up and bills payment services available on our platform with your application (websites, desktop apps & mobile apps). You can also start your own VTU business by integrating our VTU API and resell our services in Nigeria.

What is Laravel ClubKonnect

Laravel ClubKonnect is a laravel package to seamlessly integrate ClubKonnect api within your laravel application.

Create a ClubKonnect Account Sign Up.

Look up ClubKonnect API Documentation API Documentation.

Installation

You can install the package via composer:

composer require henryejemuta/laravel-clubkonnect

Publish ClubKonnect configuration file, migrations as well as set default details in .env file:

php artisan clubkonnect:init

Usage

Important: Kindly use the $response->successful() to check the response state before proceeding with working with the response and gracefully throw and handle the ClubKonnectErrorException on failed request

Before initiating any transaction kindly check your balance to confirm you have enough ClubKonnect balance to handle the transaction

The Laravel ClubKonnect Package is quite easy to use via the ClubKonnect facade

use HenryEjemuta\LaravelClubKonnect\Facades\ClubKonnect;
use HenryEjemuta\LaravelClubKonnect\Classes\ClubKonnectResponse;

...
//Check ClubKonnect Balance
    $response = ClubKonnect::getWalletBalance();
    if ($response->successful()) {
        $body = $response->getBody();
        echo "Your {$body->phoneno} ClubKonnect Balance is {$body->balance}";
    } else {
        $exception = $response->getErrorException();
        Log::error("Error while checking balance\n\r" . $exception->getCode() . ": " . $exception->getMessage());
    }

//To buy Airtime
    $response = ClubKonnect::purchaseAirtime(NetworkEnum::getNetwork('mtn'), '1500', '08134567890', 'MY_UNIQUE_TXN_ID', 'https://example.com/afterorderurl');
    if (!$response->successful()) {
            $exception = $response->getErrorException();
        Log::error("Error while purchasing airtime\n\r" . $exception->getCode() . ": " . $exception->getMessage());
    }

...

Find an overview of all method with comment on what they do and expected arguments

        /**
         * Check your Server IP
         * @return ClubKonnectResponse
         */
        public function checkYourServerIP(): ClubKonnectResponse
    
        /**
         * Get Your wallet available balance, Wallet is identified by username set in clubkonnect config or environmental variable
         * @return ClubKonnectResponse
         */
        public function getWalletBalance(): ClubKonnectResponse
    
        /**
         * @param NetworkEnum $mobileNetwork
         * @param int $amount
         * @param $phoneNumber
         * @param $requestID
         * @param $callbackUrl
         * @return ClubKonnectResponse
         */
        public function purchaseAirtime(NetworkEnum $mobileNetwork, int $amount, $phoneNumber, $requestID, $callbackUrl): ClubKonnectResponse
    
        /**
         * ClubKonnect API Transaction handler to access:
         * CableTv()->queryByOrderID(string $orderID);
         * CableTv()->queryByRequestID(string $requestID);
         * CableTv()->cancelTransaction(string $orderID);
         *
         * @return Transaction
         */
        public function Transaction(): Transaction
    
        /**
         * Smile Bill handler to access:
         * CableTv()->getDataBundles();
         * CableTv()->verifySmileAccountID($phoneNumber);
         * CableTv()->purchaseBundle(string $plan, string $phoneNumber, $requestID, $callbackUrl = null);
         *
         * @return Smile
         */
        public function Smile(): Smile
    
        /**
         * Cable TV Bill handler to access:
         * CableTv()->getTvPackages();
         * CableTv()->verifyCustomerID(CableTvEnum $cableTv, $smartCardNo);
         * CableTv()->purchasePackage(CableTvEnum $cableTv, string $package, $smartCardNo, $requestID, $callbackUrl = null);
         *
         * @return CableTv
         */
        public function CableTv(): CableTv
    
        /**
         * Recharge Card Printing handler to access:
         * RechargeCardPrinting()->getEPinNetworks();
         * RechargeCardPrinting()->buyEPins(NetworkEnum $network, $amount, int $quantity, $requestID, $callbackUrl = null);
         *
         * @return RechargeCardPrinting
         */
        public function RechargeCardPrinting(): RechargeCardPrinting
    
    
        /**
         * Get all Data Bundles
         * @return ClubKonnectResponse
         */
        public function getDataBundles(): ClubKonnectResponse
    
    
        /**
         * @param NetworkEnum $network
         * @param string $plan
         * @param string $phoneNumber
         * @param $requestID
         * @param $callbackUrl
         * @return ClubKonnectResponse
         */
        public function purchaseDataBundle(NetworkEnum $network, string $plan, string $phoneNumber, $requestID, $callbackUrl): ClubKonnectResponse

        
    /**
     * Electricity Bills payment handler to access:
     * Electricity()->getDiscosAndMinMax();
     * Electricity()->verifyMeterNumber(DiscoEnum $disco, $meterNumber): ClubKonnectResponse
     * Electricity()->buyElectricity(DiscoEnum $disco, $meterNumber, $amount, MeterTypeEnum $meterType, $requestID, $callbackUrl = null): ClubKonnectResponse
     *
     * @return Electricity
     */
    public function Electricity(): Electricity

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

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

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages