Handling SEPA Direct Payment
This commit is contained in:
@@ -8,6 +8,12 @@ use App\Scopes\SiteScope;
|
||||
|
||||
class UpdateTenantPaymentAction
|
||||
{
|
||||
/** Zahlungsarten, deren Konto das Konto des Stammes ist (Überweisung: Ziel, Lastschrift: Gläubiger). */
|
||||
private const array BANK_ACCOUNT_SLUGS = [
|
||||
PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION,
|
||||
PaymentMethod::PAYMENT_SEPA_DIRECT_DEBIT,
|
||||
];
|
||||
|
||||
public function __construct(private UpdateTenantPaymentRequest $request)
|
||||
{
|
||||
}
|
||||
@@ -22,7 +28,9 @@ class UpdateTenantPaymentAction
|
||||
'account_name' => $this->request->accountName,
|
||||
]);
|
||||
|
||||
$this->syncTransferPaymentConfiguration();
|
||||
foreach (self::BANK_ACCOUNT_SLUGS as $slug) {
|
||||
$this->syncPaymentConfiguration($slug);
|
||||
}
|
||||
|
||||
$response->success = true;
|
||||
$response->message = 'IBAN-Informationen wurden gespeichert.';
|
||||
@@ -31,15 +39,13 @@ class UpdateTenantPaymentAction
|
||||
}
|
||||
|
||||
/**
|
||||
* Übernimmt die eingegebenen IBAN-Daten direkt in die Tenant-Config der Überweisungs-Zahlungsart
|
||||
* Übernimmt die eingegebenen IBAN-Daten direkt in die Tenant-Config der Zahlungsart
|
||||
* (Kontoinhaber/IBAN/BIC), damit sie nicht doppelt gepflegt werden müssen. Bestehende weitere
|
||||
* Config-Werte (z.B. Symbol) bleiben erhalten. Der Ziel-Tenant kann ein verwalteter sein, daher
|
||||
* ohne SiteScope explizit auf den Tenant-Slug gefiltert.
|
||||
* Config-Werte (z.B. Symbol, Gläubiger-ID) bleiben erhalten. Der Ziel-Tenant kann ein verwalteter
|
||||
* sein, daher ohne SiteScope explizit auf den Tenant-Slug gefiltert.
|
||||
*/
|
||||
private function syncTransferPaymentConfiguration(): void
|
||||
private function syncPaymentConfiguration(string $slug): void
|
||||
{
|
||||
$slug = PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION;
|
||||
|
||||
$method = AvailablePaymentMethod::withoutGlobalScope(SiteScope::class)
|
||||
->where('tenant', $this->request->tenant->slug)
|
||||
->where('slug', $slug)
|
||||
|
||||
Reference in New Issue
Block a user