Configurations for payment modules
This commit is contained in:
@@ -13,6 +13,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
* @property string $name
|
||||
* @property ?string $description
|
||||
* @property bool $active
|
||||
* @property ?array $configuration
|
||||
*/
|
||||
class AvailablePaymentMethod extends InstancedModel
|
||||
{
|
||||
@@ -24,10 +25,12 @@ class AvailablePaymentMethod extends InstancedModel
|
||||
'name',
|
||||
'description',
|
||||
'active',
|
||||
'configuration',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'active' => 'boolean',
|
||||
'configuration' => 'array',
|
||||
];
|
||||
|
||||
public function paymentMethod(): BelongsTo
|
||||
@@ -35,6 +38,14 @@ class AvailablePaymentMethod extends InstancedModel
|
||||
return $this->belongsTo(PaymentMethod::class, 'slug', 'slug');
|
||||
}
|
||||
|
||||
/**
|
||||
* Sind alle Pflicht-Optionen dieses Moduls (siehe PaymentMethod::OPTIONS) befüllt?
|
||||
*/
|
||||
public function isComplete(): bool
|
||||
{
|
||||
return PaymentMethod::isConfigurationComplete($this->slug, $this->configuration ?? []);
|
||||
}
|
||||
|
||||
public function events(): BelongsToMany
|
||||
{
|
||||
// Pivot verknüpft über den Slug -- Event::paymentMethods() greift daher automatisch nur
|
||||
|
||||
Reference in New Issue
Block a user