starnerz /
laravel-daraja
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Starnerz\LaravelDaraja\Commands; |
||
| 4 | |||
| 5 | use Illuminate\Console\Command; |
||
| 6 | use Starnerz\LaravelDaraja\Facades\MpesaApi; |
||
| 7 | |||
| 8 | class RegisterC2BUrls extends Command |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * The name and signature of the console command. |
||
| 12 | * |
||
| 13 | * @var string |
||
| 14 | */ |
||
| 15 | protected $signature = 'daraja:register-urls'; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * The console command description. |
||
| 19 | * |
||
| 20 | * @var string |
||
| 21 | */ |
||
| 22 | protected $description = 'Registers C2B URLs to the Safaricom C2B API'; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Create a new command instance. |
||
| 26 | */ |
||
| 27 | public function __construct() |
||
| 28 | { |
||
| 29 | parent::__construct(); |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Execute the console command. |
||
| 34 | * |
||
| 35 | * @return mixed |
||
| 36 | */ |
||
| 37 | public function handle() |
||
| 38 | { |
||
| 39 | $confirmation = config('mpesaapi.c2b_url.confirmation'); |
||
| 40 | $validation = config('mpesaapi.c2b_url.validation'); |
||
| 41 | |||
| 42 | MpesaAPI::c2b()->registerUrls($confirmation, $validation); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 43 | $this->info('URLs registered successfully'); |
||
| 44 | } |
||
| 45 | } |
||
| 46 |