40 lines
1.6 KiB
PHP
40 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace Modules\Core\Payment\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Casts\AsArrayObject;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* A merchant-configured payment method — the DB-instance layer, admin
|
|
* creatable/deletable, same split Modules\Core\Shipping's own
|
|
* shipping_methods table already has (see docs/payments.md):
|
|
* - type: unique, machine-facing slug (Cart::meta['payment_method'],
|
|
* ApplyPaymentMethodFee's lookup key, every Payment event's $type).
|
|
* - name: admin-facing label.
|
|
* - driver: the Modules\Core\Payment\Services\PaymentDriverRegistry key
|
|
* — NOT the same as `type`, and not unique (two rows can share one
|
|
* driver, e.g. two differently-named offline-style methods).
|
|
* - capture_mode: 'pay' or 'authorize' — which SupportsPay/
|
|
* SupportsAuthorization method CheckoutService::initiatePayment()
|
|
* calls for this row.
|
|
* - position: admin-controlled display/checkout order.
|
|
* - driver_missing_at: set by `payment:sync-drivers` when `driver` no
|
|
* longer resolves via the registry — separate from `enabled`, so a
|
|
* driver vanishing (a deploy removed it) is never confused with an
|
|
* admin's own manual toggle.
|
|
* - data: jsonb, driver-specific settings that don't warrant their own
|
|
* column (starts with 'fee', the offline flat surcharge).
|
|
*/
|
|
class PaymentMethod extends Model
|
|
{
|
|
protected $guarded = [];
|
|
|
|
protected $casts = [
|
|
'enabled' => 'boolean',
|
|
'position' => 'integer',
|
|
'driver_missing_at' => 'datetime',
|
|
'data' => AsArrayObject::class,
|
|
];
|
|
}
|