OptionsValidatorInterface
OptionsValidatorInterface.php
:
44
Validates payment method type options.
Example implementation:
final class CreditCardOptionsValidator implements OptionsValidatorInterface
{
public function validateOptions(OptionsBag $options): array
{
$errors = [];
if (!$options->has('provider')) {
$errors[] = new OptionsValidatorError('provider', 'Provider must be configured explicitly.');
}
return $errors;
}
}
The \Ibexa\Contracts\Payment\PaymentMethod\Type\OptionsValidatorInterface
implementations must be registered as a service
with ibexa.payment.payment_method.options.validator
tag and type
attribute.
services:
App\PaymentMethod\CreditCardOptionsValidator:
tags:
- name: ibexa.payment.payment_method.options.validator
type: credit_card
Methods¶
validateOptions() ¶
OptionsValidatorInterface.php
:
49
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$options | OptionsBag | - | - |
Return values
array<string|int, OptionsValidatorError>