Feat: Creating PaymentMethods, Setting Fees, Availabilities

This commit is contained in:
2026-08-31 13:54:20 +03:00
parent d873cb4931
commit 2db1e1331f
12 changed files with 359 additions and 1 deletions
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace Modules\Core\Payment\Models;
use Illuminate\Database\Eloquent\Casts\AsArrayObject;
use Illuminate\Database\Eloquent\Model;
/**
* Admin-editable settings for one payment type key (matching a key in
* config('lunar.payments.types')) — enabled/disabled, and whatever type-
* specific data it needs (starts with 'fee' for cash-on-delivery's flat
* surcharge). Mirrors Lunar's own Discount model: a single jsonb 'data'
* column holding keyed settings, rather than a fixed column per setting or
* a separate conditions table — new settings are a code change (a new key
* read from data), not a migration.
*
* Seeded once per type by InstallLunarCommand (skip-if-exists, same
* idempotent convention as seedStorefrontLabels()) — never auto-created on
* read, so a read path stays a pure read.
*/
class PaymentMethod extends Model
{
protected $guarded = [];
protected $casts = [
'enabled' => 'boolean',
'data' => AsArrayObject::class,
];
}