Payment methode now selectable
This commit is contained in:
@@ -50,6 +50,49 @@ class EventPaymentModuleRegistryTest extends TestCase
|
||||
$this->assertTrue($module->isConfigurationComplete(['iban' => 'DE123', 'account_owner' => 'Kasse']));
|
||||
}
|
||||
|
||||
public function test_existing_modules_have_no_participant_options(): void
|
||||
{
|
||||
$this->assertSame([], (new AccountTransferPaymentModule())->getParticipantOptions());
|
||||
$this->assertSame([], (new UndefinedPaymentModule())->getParticipantOptions());
|
||||
}
|
||||
|
||||
public function test_participant_option_helpers(): void
|
||||
{
|
||||
// Anonymes Modul mit einer Pflicht-Teilnehmereingabe.
|
||||
$module = new class extends \App\EventPaymentModules\AbstractEventPaymentModule {
|
||||
public static function slug(): string
|
||||
{
|
||||
return 'TEST';
|
||||
}
|
||||
|
||||
public function defaultName(): string
|
||||
{
|
||||
return 'Test';
|
||||
}
|
||||
|
||||
public function getOptions(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getParticipantOptions(): array
|
||||
{
|
||||
return [['name' => 'iban', 'label' => 'IBAN', 'type' => 'string', 'required' => true]];
|
||||
}
|
||||
|
||||
protected function invoiceClosingStatement(\App\EventPaymentModules\DTO\CreateInvoiceRequest $request): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
};
|
||||
|
||||
// sanitize verwirft unbekannte Keys, complete verlangt Pflichtfeld non-empty.
|
||||
$this->assertSame(['iban' => 'DE1'], $module->sanitizeParticipantOptions(['iban' => 'DE1', 'evil' => 'x']));
|
||||
$this->assertFalse($module->participantOptionsComplete([]));
|
||||
$this->assertFalse($module->participantOptionsComplete(['iban' => '']));
|
||||
$this->assertTrue($module->participantOptionsComplete(['iban' => 'DE1']));
|
||||
}
|
||||
|
||||
public function test_only_account_transfer_provides_giro_code(): void
|
||||
{
|
||||
$this->assertInstanceOf(ProvidesGiroCode::class, new AccountTransferPaymentModule());
|
||||
|
||||
Reference in New Issue
Block a user