PHP code example of hopeofiran / parsianrefund

1. Go to this page and download the library: Download hopeofiran/parsianrefund 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/ */

    

hopeofiran / parsianrefund example snippets

 php
HopeOfIran\ParsianRefund\Providers\ParsianRefundProvider::class

php artisan vendor:publish --provider=HopeOfIran\ParsianRefund\Providers\ParsianRefundProvider
 php
Route::any('/approve', function () {
    return \HopeOfIran\ParsianRefund\Facades\ParsianRefundFacade::amount(1000)
        ->RRN(730157156588)
        ->refundId(187173594849597)
        ->refund(function (HopeOfIran\ParsianRefund\ParsianRefund $parsianRefund) {
            try {
                return $parsianRefund->approve();
            } catch (\Exception $exception) {
                return $exception->getMessage();
            }
        });
})->name('approve');
 php
Route::any('/cancel', function () {
    return \HopeOfIran\ParsianRefund\Facades\ParsianRefundFacade::amount(1000)
        ->RRN(730157156588)
        ->refundId(187173594849597)
        ->refund(function (HopeOfIran\ParsianRefund\ParsianRefund $parsianRefund) {
            try {
                $response = $parsianRefund->cancel();
                return $response->body();
            } catch (\Exception $exception) {
                return $exception->getMessage();
            }
        });
})->name('cancel');
 php
Route::any('/inquiry', function () {
    return \HopeOfIran\ParsianRefund\Facades\ParsianRefundFacade::amount(1000)
        ->RRN(730157156588)
        ->refundId(187173594849597)
        ->refund(function (HopeOfIran\ParsianRefund\ParsianRefund $parsianRefund) {
            try {
                $response = $parsianRefund->inquiry();
                return $response->body();
            } catch (\Exception $exception) {
                return $exception->getMessage();
            }
        });
})->name('inquiry');
 php
Route::any('/inquiry', function () {
    try {
        $token = \HopeOfIran\ParsianRefund\Facades\ParsianRefundFacade::amount(1000)
            ->refundId('196959050035088')
            ->RRN('731858787109')
            ->getToken();
    } catch (Exception $exception) {
        return $exception->getMessage();
    }
    $response = \HopeOfIran\ParsianRefund\Facades\ParsianRefundFacade::inquiry($token);
    return $response->body();
})->name('inquiry');