UnknownSec Bypass
403
:
/
mnt
/
lmsestudio-instance-vol002
/
lms_9e37ed18ed18
/
app
/
Console
/
Commands
/ [
drwxr-xr-x
]
Menu
Upload
Mass depes
Mass delete
Terminal
Info server
About
name :
RecurringBoleto.php
<?php namespace EstudioLMS\Console\Commands; use Carbon\Carbon; use EstudioLMS\Cart\Cart; use EstudioLMS\Events\RecurringNotification; use EstudioLMS\Repositories\Financial\RecurringInterface; use EstudioLMS\Repositories\Subscription\PeriodicityInterface; use EstudioLMS\Services\PagarMeService; use Illuminate\Console\Command; use Illuminate\Support\Facades\Log; /** * Class RecurringBoleto * @package EstudioLMS\Console\Commands */ class RecurringBoleto extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'recurring:boleto'; /** * The console command description. * * @var string */ protected $description = 'Processa as recorrências das assinaturas com forma de pagamento boleto'; /** * @var RecurringInterface */ private $recurring; /** * @var PeriodicityInterface */ private $periodicity; /** * @var PagarMeService */ private $pagarMeService; /** * Create a new command instance. * * @param RecurringInterface $recurring * @param PeriodicityInterface $periodicity * @param PagarMeService $pagarMeService */ public function __construct( RecurringInterface $recurring, PeriodicityInterface $periodicity, PagarMeService $pagarMeService ) { parent::__construct(); $this->recurring = $recurring; $this->periodicity = $periodicity; $this->pagarMeService = $pagarMeService; } /** * Execute the console command. * * Os seguintes status serão considerados, para o processamento das recorrências. * 0 - Registro sem processamento, deve ser feita a cobrança; * 1 - Registro processado; * 2 - Houve falha na cobrança - Cartão de Crédito - Será cobrado novamente em X dias; * 3 - Boleto emitido e ainda não pago; * 4 - Cancelamento solicitado. Ao invés de cobrar, deve marcar a assinatura como cancelada; * 5 - Registro de cancelamento processado; * 6 - Cancelado por falta de pagamento; * * @return mixed */ public function handle() { $paymentType = 'boleto'; $addDays = 5; $today = Carbon::now()->format('Y-m-d'); $recurrings = $this->recurring->getDueRecurrences($paymentType, $addDays); foreach ($recurrings as $key => $recurring) { $attempt = $recurring->attempts + 1; $periodicity = $this->periodicity->find($recurring->hire_subscription->periodicity_id); $cart = new Cart(); $cart->addItem( $recurring->hire_subscription->subscription_id, $recurring->hire_subscription->subscription->title, $recurring->hire_subscription->subscription->subscription_id, $periodicity, $recurring->gross_amount, null, 0.00, 0.00, 0, 0.00, true ); $boleto = $this->pagarMeService->boletoTransaction($cart, $recurring->subscription_hash, $recurring->user_id); $recurring->status = 3; $recurring->attempts = $attempt; $recurring->payment_code = $boleto->getId(); $recurring->save(); \Event::fire(new RecurringNotification('boleto-issued', $boleto)); Log::info('Boleto criado e enviado! Link' . $boleto->getBoletoUrl()); } \Log::useDailyFiles(storage_path() . '/logs/command.log'); \Log::alert('recurring:boleto - Executado - ' . date('Y-m-d H:i:s')); } }
Copyright © 2026 - UnknownSec