diff --git a/src/app/Console/Commands/Wallet/GetDiscountCommand.php b/src/app/Console/Commands/Wallet/GetDiscountCommand.php index 2a4d69a4..4034a501 100644 --- a/src/app/Console/Commands/Wallet/GetDiscountCommand.php +++ b/src/app/Console/Commands/Wallet/GetDiscountCommand.php @@ -1,44 +1,59 @@ getWallet($this->argument('wallet')); if (!$wallet) { $this->error("Wallet not found."); return 1; } + if ($this->option('int')) { + $this->info($wallet->discount?->discount ?? 0); + return 0; + } + if (!$wallet->discount) { $this->info("No discount on this wallet."); return 0; } - $this->info((string) $wallet->discount->discount); + $result = $wallet->discount->discount . '%'; + + if ($code = $wallet->discount->code) { + $result .= " [{$code}]"; + } + + if ($description = $wallet->discount->description) { + $result .= " {$description}"; + } + + $this->info($result); } }