Changeset View
Changeset View
Standalone View
Standalone View
src/app/Console/Commands/MollieInfo.php
<?php | <?php | ||||
namespace App\Console\Commands; | namespace App\Console\Commands; | ||||
use App\User; | use App\Console\Command; | ||||
use Illuminate\Console\Command; | |||||
class MollieInfo extends Command | class MollieInfo extends Command | ||||
{ | { | ||||
/** | /** | ||||
* The name and signature of the console command. | * The name and signature of the console command. | ||||
* | * | ||||
* @var string | * @var string | ||||
*/ | */ | ||||
Show All 9 Lines | class MollieInfo extends Command | ||||
/** | /** | ||||
* Execute the console command. | * Execute the console command. | ||||
* | * | ||||
* @return mixed | * @return mixed | ||||
*/ | */ | ||||
public function handle() | public function handle() | ||||
{ | { | ||||
if ($this->argument('user')) { | if ($this->argument('user')) { | ||||
$user = User::where('email', $this->argument('user'))->first(); | $user = $this->getUser($this->argument('user')); | ||||
if (!$user) { | if (!$user) { | ||||
$this->error("Wallet not found"); | |||||
return 1; | return 1; | ||||
} | } | ||||
$this->info("Found user: {$user->id}"); | |||||
$wallet = $user->wallets->first(); | $wallet = $user->wallets->first(); | ||||
$provider = new \App\Providers\Payment\Mollie(); | $provider = new \App\Providers\Payment\Mollie(); | ||||
if ($mandate = $provider->getMandate($wallet)) { | if ($mandate = $provider->getMandate($wallet)) { | ||||
$amount = $wallet->getSetting('mandate_amount'); | $amount = $wallet->getSetting('mandate_amount'); | ||||
$balance = $wallet->getSetting('mandate_balance') ?: 0; | $balance = $wallet->getSetting('mandate_balance') ?: 0; | ||||
$this->info("Auto-payment: {$mandate['method']}"); | $this->info("Auto-payment: {$mandate['method']}"); | ||||
Show All 31 Lines |