Fix systemic extraction breakage in authenticated UI.
Deploy Ladill Merchant / deploy (push) Successful in 28s
Deploy Ladill Merchant / deploy (push) Successful in 28s
The give→merchant transform left several independent breakages that 500'd
once a logged-in user hit the pages:
- /storefronts/{create,show,update,...} were wired to Qr\QrCodeController,
which renders events-lineage qr-codes.* views referencing 14 undefined
events.* routes. Rewire to StorefrontController (clean storefronts.* views).
- storefronts/show.blade.php @include('give.storefronts.partials.*') — the
view dir was renamed give→merchant but the include namespace wasn't.
- /payouts + /search queried qr_sale_orders.*_minor; migration created *_ghs.
- Remove dead GiveDonation model (nonexistent give_donations table).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
62b3fcd479
commit
de5bd16219
@@ -22,10 +22,10 @@ class PayoutsController extends Controller
|
||||
->where('type', QrCode::TYPE_SHOP)
|
||||
->pluck('id');
|
||||
|
||||
$revenueMinor = (int) QrSaleOrder::query()
|
||||
$revenueMinor = (int) round(QrSaleOrder::query()
|
||||
->whereIn('qr_code_id', $qrIds)
|
||||
->where('status', QrSaleOrder::STATUS_PAID)
|
||||
->sum('merchant_amount_minor');
|
||||
->sum('merchant_amount_ghs') * 100);
|
||||
|
||||
$balanceMinor = 0;
|
||||
try {
|
||||
|
||||
@@ -55,7 +55,7 @@ class SearchController extends Controller
|
||||
->get()
|
||||
->map(function (QrSaleOrder $order): array {
|
||||
$amount = number_format(
|
||||
($order->status === QrSaleOrder::STATUS_PAID ? $order->merchant_amount_minor : $order->amount_minor) / 100,
|
||||
(float) ($order->status === QrSaleOrder::STATUS_PAID ? $order->merchant_amount_ghs : $order->amount_ghs),
|
||||
2,
|
||||
);
|
||||
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class QrSaleOrder extends Model
|
||||
{
|
||||
public const STATUS_PENDING = 'pending';
|
||||
public const STATUS_PAID = 'paid';
|
||||
public const STATUS_FAILED = 'failed';
|
||||
|
||||
/** Platform fee on orders (Ladill Merchant tier). */
|
||||
public const PLATFORM_FEE_RATE = 0.09;
|
||||
|
||||
protected $fillable = [
|
||||
'pay_order_id',
|
||||
'qr_code_id',
|
||||
'user_id',
|
||||
'reference',
|
||||
'collection_type',
|
||||
'amount_minor',
|
||||
'currency',
|
||||
'platform_fee_minor',
|
||||
'merchant_amount_minor',
|
||||
'payer_name',
|
||||
'payer_email',
|
||||
'payer_phone',
|
||||
'payer_note',
|
||||
'status',
|
||||
'payment_reference',
|
||||
'paid_at',
|
||||
'metadata',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'amount_minor' => 'integer',
|
||||
'platform_fee_minor' => 'integer',
|
||||
'merchant_amount_minor' => 'integer',
|
||||
'metadata' => 'array',
|
||||
'paid_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function qrCode(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(QrCode::class);
|
||||
}
|
||||
|
||||
public function merchant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
|
||||
public function amountMajor(): float
|
||||
{
|
||||
return $this->amount_minor / 100;
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
<h1 class="mt-2 text-xl font-semibold text-slate-900">{{ $qrCode->label }}</h1>
|
||||
<p class="mt-1 text-sm text-slate-500">{{ $c['name'] ?? '' }}@if(!empty($c['denomination'])) · {{ $c['denomination'] }}@endif</p>
|
||||
</div>
|
||||
@include('give.storefronts.partials.header-actions', ['qrCode' => $qrCode])
|
||||
@include('merchant.storefronts.partials.header-actions', ['qrCode' => $qrCode])
|
||||
</div>
|
||||
|
||||
@if(session('success'))
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
<div class="grid gap-6 lg:grid-cols-[380px_1fr]">
|
||||
<div class="lg:sticky lg:top-6 lg:self-start">
|
||||
@include('give.storefronts.partials.preview-card', [
|
||||
@include('merchant.storefronts.partials.preview-card', [
|
||||
'qrCode' => $qrCode,
|
||||
'previewDataUri' => $previewDataUri,
|
||||
'showDownloads' => false,
|
||||
@@ -75,7 +75,7 @@
|
||||
Delete storefront
|
||||
</button>
|
||||
</div>
|
||||
@include('give.storefronts.partials.delete-modal', ['qrCode' => $qrCode])
|
||||
@include('merchant.storefronts.partials.delete-modal', ['qrCode' => $qrCode])
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+5
-6
@@ -11,7 +11,6 @@ use App\Http\Controllers\Public\QrScanController;
|
||||
use App\Http\Controllers\Public\SaleOrderController;
|
||||
use App\Http\Controllers\Qr\AccountController;
|
||||
use App\Http\Controllers\Qr\AfiaController;
|
||||
use App\Http\Controllers\Qr\QrCodeController;
|
||||
use App\Http\Controllers\Qr\TeamController;
|
||||
use App\Http\Controllers\SearchController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
@@ -53,11 +52,11 @@ Route::middleware(['auth'])->group(function () {
|
||||
Route::post('/afia/chat', [AfiaController::class, 'chat'])->name('merchant.afia.chat');
|
||||
|
||||
Route::get('/storefronts', [StorefrontController::class, 'index'])->name('merchant.storefronts.index');
|
||||
Route::get('/storefronts/create', [QrCodeController::class, 'create'])->name('merchant.storefronts.create');
|
||||
Route::post('/storefronts', [QrCodeController::class, 'store'])->name('merchant.storefronts.store');
|
||||
Route::get('/storefronts/{storefront}', [QrCodeController::class, 'show'])->name('merchant.storefronts.show');
|
||||
Route::patch('/storefronts/{storefront}', [QrCodeController::class, 'update'])->name('merchant.storefronts.update');
|
||||
Route::delete('/storefronts/{storefront}', [QrCodeController::class, 'destroy'])->name('merchant.storefronts.destroy');
|
||||
Route::get('/storefronts/create', [StorefrontController::class, 'create'])->name('merchant.storefronts.create');
|
||||
Route::post('/storefronts', [StorefrontController::class, 'store'])->name('merchant.storefronts.store');
|
||||
Route::get('/storefronts/{storefront}', [StorefrontController::class, 'show'])->name('merchant.storefronts.show');
|
||||
Route::patch('/storefronts/{storefront}', [StorefrontController::class, 'update'])->name('merchant.storefronts.update');
|
||||
Route::delete('/storefronts/{storefront}', [StorefrontController::class, 'destroy'])->name('merchant.storefronts.destroy');
|
||||
Route::get('/storefronts/{storefront}/preview.png', [StorefrontController::class, 'preview'])->name('merchant.storefronts.preview');
|
||||
Route::get('/storefronts/{storefront}/download/{format}', [StorefrontController::class, 'download'])->name('merchant.storefronts.download')->whereIn('format', ['png', 'svg', 'pdf']);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user