PHP code example of refatbd / bd-courier-fraud-checker

1. Go to this page and download the library: Download refatbd/bd-courier-fraud-checker 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/ */

    

refatbd / bd-courier-fraud-checker example snippets


use Refatbd\BdCourierFraudChecker\Facade\BdCourierFraudChecker;

$result = BdCourierFraudChecker::check('01XXXXXXXXX');

[
    'steadfast' => [
        'status' => true,
        'message' => 'Successful.',
        'data' => [
            'success'             => 45,
            'cancel'              => 5,
            'total'               => 50,
            'deliveredPercentage' => 90.0,
            'returnPercentage'    => 10.0,
            'fraudReportCount'    => 1,
            'frauds'              => [
                [
                    'name'             => 'Saiyan Ahammd Santo',
                    'phone'            => '01893048178',
                    'details'          => 'পার্সেল রিসিভ করেনা।',
                    'image'            => null,
                    'consignment_id'   => 124581452,
                    'created_at'       => '2025-02-11T14:43:02.000000Z',
                    'created_at_human' => '1 year ago',
                ],
            ],
        ],
    ],
    'pathao' => [
        'status'  => true,
        'message' => 'Successful.',
        'data'    => [
            // Pathao has moved to a rating-based model — most accounts no longer
            // receive numeric counts (showCount: false). See the note below.
            'success'             => null,
            'cancel'              => null,
            'total'               => null,
            'deliveredPercentage' => null,
            'returnPercentage'    => null,
            'customerRating'      => 'excellent_customer', // Pathao's own label
            'riskLevel'           => 'low',                // derived: low | medium | high
            'showCount'           => false,                // did Pathao expose counts?
            'countsAvailable'     => false,                // numeric data usable?
        ],
    ],
    'redx' => [
        'status'  => true,
        'message' => 'Successful.',
        'data'    => [
            'success'             => 30,
            'cancel'              => 5,
            'total'               => 35,
            'deliveredPercentage' => 85.71,
            'returnPercentage'    => 14.29,
            'customerSegment'     => 'Normal Customer', // RedX's own rating label
        ],
    ],
    'carrybee' => [
        'status'  => true,
        'message' => 'Successful.',
        'data'    => [
            'success'             => 18,
            'cancel'              => 2,
            'total'               => 20,
            'deliveredPercentage' => 90.0,
            'returnPercentage'    => 10.0,
            'fraudCount'          => 0, // Carrybee's own complaint counter
        ],
    ],
]



namespace Refatbd\BdCourierFraudChecker\Courier;

use Refatbd\BdCourierFraudChecker\Traits\Helpers;

class YourCourier
{
    use Helpers;

    public function __construct()
    {
        $this->checkRequiredConfig(['your_courier_user', 'your_courier_password']);
    }

    public function check($phoneNumber)
    {
        $phoneNumber = $this->validateBDPhoneNumber($phoneNumber);
        // Add your API logic here
        return [
            'status'  => true,
            'message' => 'Successful.',
            'data'    => [],
        ];
    }
}

"your_courier_user"     => env("YOUR_COURIER_USER", ""),
"your_courier_password" => env("YOUR_COURIER_PASSWORD", ""),
bash
php artisan vendor:publish --tag=bdcourierfraudchecker-config