feat(payments): Express-Adressen nur aus erlaubten Laendern (Setting express_countries, Standard DE)
This commit is contained in:
@@ -460,6 +460,12 @@ abstract class AbstractProvider implements ProviderInterface
|
||||
return $this->shopBaseUrl() . '/Warenkorb/?payment_express_cancel=' . $this->module();
|
||||
}
|
||||
|
||||
/** Laender, aus denen Express-Adressen angenommen werden (ISO-2, kommagetrennt). Standard: nur DE. */
|
||||
public function expressCountries(): string
|
||||
{
|
||||
return $this->setting('express_countries', 'DE');
|
||||
}
|
||||
|
||||
/** countries.id zu einem ISO-3166-Alpha-2-Code, 0 wenn das Land im Shop nicht lieferbar ist. */
|
||||
public function countryIdByIso(string $iso): int
|
||||
{
|
||||
|
||||
@@ -44,7 +44,8 @@ INSERT IGNORE INTO `configuration` (`name`, `text`, `group_id`, `setting`, `type
|
||||
('paypal_v2_brand_name', '', 'paypal_v2', 'intelectra', 1, 'Anzeigename auf der PayPal-Seite'),
|
||||
('paypal_v2_send_address', '', 'paypal_v2', '1', 1, '1 = Lieferadresse an PayPal uebergeben (Verkaeuferschutz), 0 = nicht'),
|
||||
('paypal_v2_currency', '', 'paypal_v2', 'EUR', 1, 'Waehrung (ISO 4217)'),
|
||||
('paypal_v2_express', '', 'paypal_v2', '1', 1, '1 = Button "Direkt mit PayPal bezahlen" im Warenkorb, 0 = aus');
|
||||
('paypal_v2_express', '', 'paypal_v2', '1', 1, '1 = Button "Direkt mit PayPal bezahlen" im Warenkorb, 0 = aus'),
|
||||
('paypal_v2_express_countries', '', 'paypal_v2', 'DE', 1, 'Laender (ISO-2, kommagetrennt), deren PayPal-Adresse im Express-Kauf angenommen wird');
|
||||
|
||||
-- 2b) Zahlart anlegen. active=1, aber noch KEINER Kundengruppe zugeordnet => im Shop unsichtbar.
|
||||
-- helperjoinkey 'pp' = derselbe PayPal-Aufschlag wie die alte Zahlart (shipping_area.add_pp).
|
||||
|
||||
@@ -420,7 +420,11 @@ class website_cashdesk {
|
||||
$this->layout_object->assign('message', 'Der Express-Vorgang konnte nicht übernommen werden. Ihr Warenkorb ist noch da – bitte gehen Sie normal zur Kasse.');
|
||||
return $this->layout_object->_fetch('content_cash_desk/payment_result.tpl');
|
||||
}
|
||||
$country_id = $provider->countryIdByIso((string)$data['country_iso']);
|
||||
// Erlaubte Laender fuer Express (Setting <modul>_express_countries, Standard DE):
|
||||
// PayPal-Konten gibt es weltweit, geliefert wird aber nur, wohin der Shop liefert.
|
||||
$allowed = array_filter(array_map('trim', explode(',', strtoupper($provider->expressCountries()))));
|
||||
$iso = strtoupper((string)$data['country_iso']);
|
||||
$country_id = in_array($iso, $allowed, true) ? $provider->countryIdByIso($iso) : 0;
|
||||
if ($country_id <= 0) {
|
||||
$this->layout_object->assign('call', 'payment_error');
|
||||
$this->layout_object->assign('provider_label', $provider->label());
|
||||
|
||||
Reference in New Issue
Block a user