Compare commits
2 Commits
f93ce0ba88
...
bf33e14e43
| Author | SHA1 | Date | |
|---|---|---|---|
| bf33e14e43 | |||
| 09df813425 |
10
app/Http/Controllers/ApiTesterController.php
Normal file
10
app/Http/Controllers/ApiTesterController.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ApiTesterController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -10,6 +10,7 @@ use App\Modules\VisaMasterSettings\Models\VisaMasterSettings;
|
||||
use App\Repos\Payment\OnlinePaymentRepo;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
@@ -283,40 +284,36 @@ class MakeSberPaymentAction extends Action
|
||||
*
|
||||
* @param \Illuminate\Support\Carbon $today
|
||||
*/
|
||||
public function canAcceptPayment($today): bool
|
||||
public function canAcceptPayment(Carbon $today): bool
|
||||
{
|
||||
$year = $today->format('Y');
|
||||
$month = $today->format('m');
|
||||
$lastDay = lastDayOfMonth(year: $year, month: $month);
|
||||
$lastDay = $today->copy()->endOfMonth();
|
||||
$lastDayOfWeek = $lastDay->format('l');
|
||||
|
||||
// Condition 1: Check if today is the last day of the month
|
||||
if ($today->format('Y-m-d') === $lastDay->format('Y-m-d')) {
|
||||
$oneDayBefore = $lastDay->copy()->subDay(); // Saturday
|
||||
$twoDaysBefore = $lastDay->copy()->subDays(2); // Friday
|
||||
|
||||
// Condition 1: Today is the last day
|
||||
if ($today->isSameDay($lastDay)) {
|
||||
info('check 1');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Determine the day of the week for the last day of the month
|
||||
$lastDayOfWeek = $lastDay->format('l'); // e.g., 'Sunday', 'Saturday'
|
||||
// Condition 2: Last day is Sunday → forbid Friday & Saturday
|
||||
if ($lastDayOfWeek === 'Sunday' && ($today->isSameDay($oneDayBefore) || $today->isSameDay($twoDaysBefore))) {
|
||||
info('check 2');
|
||||
|
||||
// Condition 2: If the last day is Sunday, disallow Friday, Saturday, Sunday
|
||||
if ($lastDayOfWeek === 'Sunday') {
|
||||
$forbiddenDays = ['Friday', 'Saturday', 'Sunday'];
|
||||
if (in_array($today->format('l'), $forbiddenDays)) {
|
||||
info('check 2');
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Condition 3: If the last day is Saturday, disallow Friday
|
||||
if ($lastDayOfWeek === 'Saturday' && $today->format('l') === 'Friday') {
|
||||
// Condition 3: Last day is Saturday → forbid Friday
|
||||
if ($lastDayOfWeek === 'Saturday' && $today->isSameDay($oneDayBefore)) {
|
||||
info('check 3');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// If none of the conditions match, allow payment
|
||||
// Default: allow payment
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\ApiTesterController;
|
||||
use App\Http\Controllers\Auth\LoginController;
|
||||
use App\Http\Controllers\Auth\RegisterController;
|
||||
use App\Http\Controllers\Auth\ResetPasswordController;
|
||||
@@ -31,6 +32,8 @@ Route::middleware(['auth'])->group(function () {
|
||||
Route::post('password-change', [PasswordChangeController::class, 'update'])->name('password-change.update');
|
||||
});
|
||||
|
||||
Route::get('tester', [ApiTesterController::class, 'index']);
|
||||
|
||||
Route::get('online-payment-store', [OnlinePaymentController::class, 'store'])
|
||||
->name('online-payment-store');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user