Add Ladill POS v1 — register, Pay checkout, and commerce links.
Deploy Ladill Mini / deploy (push) Successful in 23s
Deploy Ladill Mini / deploy (push) Successful in 23s
Staff-facing counter register at pos.ladill.com with catalog cart, cash and MoMo/card checkout via Ladill Pay, CRM timeline/import, invoice prefill, and Merchant catalog import. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\Mini;
|
||||
|
||||
use App\Models\MiniPayment;
|
||||
use App\Models\QrCode;
|
||||
|
||||
/**
|
||||
* Shared JSON shape for Mini payments and payment QRs so the Android app and
|
||||
* the web views stay describing the same records.
|
||||
*/
|
||||
class PaymentPresenter
|
||||
{
|
||||
/** @return array<string, mixed> */
|
||||
public static function present(MiniPayment $payment): array
|
||||
{
|
||||
return [
|
||||
'id' => $payment->id,
|
||||
'reference' => $payment->reference,
|
||||
'amount_minor' => $payment->amount_minor,
|
||||
'merchant_amount_minor' => $payment->merchant_amount_minor,
|
||||
'platform_fee_minor' => $payment->platform_fee_minor,
|
||||
'currency' => $payment->currency,
|
||||
'status' => $payment->status,
|
||||
'payer_name' => $payment->payer_name,
|
||||
'payer_email' => $payment->payer_email,
|
||||
'payer_phone' => $payment->payer_phone,
|
||||
'payer_note' => $payment->payer_note,
|
||||
'qr_code_id' => $payment->qr_code_id,
|
||||
'qr_label' => $payment->qrCode?->label,
|
||||
'paid_at' => $payment->paid_at?->toIso8601String(),
|
||||
'created_at' => $payment->created_at?->toIso8601String(),
|
||||
];
|
||||
}
|
||||
|
||||
/** @return array<string, mixed> */
|
||||
public static function presentQr(QrCode $qr, ?string $previewUrl = null): array
|
||||
{
|
||||
$content = $qr->content();
|
||||
|
||||
return [
|
||||
'id' => $qr->id,
|
||||
'label' => $qr->label,
|
||||
'business_name' => $content['business_name'] ?? null,
|
||||
'branch_label' => $content['branch_label'] ?? null,
|
||||
'currency' => $content['currency'] ?? 'GHS',
|
||||
'short_code' => $qr->short_code,
|
||||
'public_url' => $qr->publicUrl(),
|
||||
'is_active' => $qr->is_active,
|
||||
'scans_total' => $qr->scans_total,
|
||||
'preview_url' => $previewUrl,
|
||||
'created_at' => $qr->created_at?->toIso8601String(),
|
||||
'updated_at' => $qr->updated_at?->toIso8601String(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user