Feat: Creating PaymentMethods, Setting Fees, Availabilities
This commit is contained in:
@@ -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,
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user