Payment: Add setting to prevent reminder mails (Z#23123914) (#3573)

Adds a checkbox in each payment provider's settings controlling whether sending out expiry reminders should be prevented
This commit is contained in:
Phin Wolkwitz
2023-09-07 14:27:09 +02:00
committed by GitHub
parent f97e6d0a71
commit 3f07050d42
3 changed files with 76 additions and 2 deletions

View File

@@ -441,6 +441,13 @@ class BasePaymentProvider:
'Share this link with customers who should use this payment method.'
),
)),
('_prevent_reminder_mail',
forms.BooleanField(
label=_('Do not send a payment reminder mail'),
help_text=_('Users will not receive a reminder mail to pay for their order before it expires if '
'they have chosen this payment method.'),
required=False,
)),
])
d['_restricted_countries']._as_type = list
d['_restrict_to_sales_channels']._as_type = list
@@ -497,6 +504,14 @@ class BasePaymentProvider:
if order.status == Order.STATUS_PAID:
return _('paid')
def prevent_reminder_mail(self, order: Order, payment: OrderPayment) -> bool:
"""
This is called when a periodic task runs and sends out reminder mails to orders that have not been paid yet
and are soon expiring.
The default implementation returns the content of the _prevent_reminder_mail configuration variable (a boolean value).
"""
return self.settings.get('_prevent_reminder_mail', as_type=bool, default=False)
@property
def payment_form_fields(self) -> dict:
"""