109 lines
7.8 KiB
SQL
109 lines
7.8 KiB
SQL
-- ============================================================================
|
|
-- core/payments -- Mollie (MySQL, Shop-DB). Additiv, mehrfach ausfuehrbar.
|
|
-- Voraussetzung: install.sql (payment_transactions, payment_provider_secrets) ist drin.
|
|
--
|
|
-- Getrennte Gateways je Zahlungsart (Tom, 27.09.2026): je Mollie-Methode EINE Zeile in
|
|
-- payment_methods mit module='mollie' und argument=<Methode>. Mollie zeigt dann nur
|
|
-- diese Methode, keine Auswahl bei Mollie, kein abweichendes Warenkorb-Verhalten.
|
|
--
|
|
-- Reihenfolge: 1) Versandgebiet-Spalten 2) Einstellungen 3) Zahlarten 4) Freischaltung (manuell)
|
|
-- ============================================================================
|
|
|
|
-- 1) Die Kasse haengt jede Zahlart ueber helperjoinkey an vier Spalten in shipping_area
|
|
-- (active_/add_/account_type_/free_payment_<key>). Neue Keys = neue Spalten.
|
|
-- Aufschlaege sind bei Karten/Klarna/Wallets ohnehin nicht zulaessig -> add=0, aktiv=1.
|
|
ALTER TABLE `shipping_area`
|
|
ADD COLUMN IF NOT EXISTS `active_mollie_klarna` TINYINT(2) NOT NULL DEFAULT 2,
|
|
ADD COLUMN IF NOT EXISTS `add_mollie_klarna` DECIMAL(9,2) NOT NULL DEFAULT 0,
|
|
ADD COLUMN IF NOT EXISTS `account_type_mollie_klarna` TINYINT(4) NOT NULL DEFAULT 0,
|
|
ADD COLUMN IF NOT EXISTS `free_payment_mollie_klarna` DECIMAL(6,2) NOT NULL DEFAULT 0,
|
|
ADD COLUMN IF NOT EXISTS `active_mollie_creditcard` TINYINT(2) NOT NULL DEFAULT 2,
|
|
ADD COLUMN IF NOT EXISTS `add_mollie_creditcard` DECIMAL(9,2) NOT NULL DEFAULT 0,
|
|
ADD COLUMN IF NOT EXISTS `account_type_mollie_creditcard` TINYINT(4) NOT NULL DEFAULT 0,
|
|
ADD COLUMN IF NOT EXISTS `free_payment_mollie_creditcard` DECIMAL(6,2) NOT NULL DEFAULT 0,
|
|
ADD COLUMN IF NOT EXISTS `active_mollie_applepay` TINYINT(2) NOT NULL DEFAULT 2,
|
|
ADD COLUMN IF NOT EXISTS `add_mollie_applepay` DECIMAL(9,2) NOT NULL DEFAULT 0,
|
|
ADD COLUMN IF NOT EXISTS `account_type_mollie_applepay` TINYINT(4) NOT NULL DEFAULT 0,
|
|
ADD COLUMN IF NOT EXISTS `free_payment_mollie_applepay` DECIMAL(6,2) NOT NULL DEFAULT 0,
|
|
ADD COLUMN IF NOT EXISTS `active_mollie_googlepay` TINYINT(2) NOT NULL DEFAULT 2,
|
|
ADD COLUMN IF NOT EXISTS `add_mollie_googlepay` DECIMAL(9,2) NOT NULL DEFAULT 0,
|
|
ADD COLUMN IF NOT EXISTS `account_type_mollie_googlepay` TINYINT(4) NOT NULL DEFAULT 0,
|
|
ADD COLUMN IF NOT EXISTS `free_payment_mollie_googlepay` DECIMAL(6,2) NOT NULL DEFAULT 0,
|
|
ADD COLUMN IF NOT EXISTS `active_mollie_paybybank` TINYINT(2) NOT NULL DEFAULT 2,
|
|
ADD COLUMN IF NOT EXISTS `add_mollie_paybybank` DECIMAL(9,2) NOT NULL DEFAULT 0,
|
|
ADD COLUMN IF NOT EXISTS `account_type_mollie_paybybank` TINYINT(4) NOT NULL DEFAULT 0,
|
|
ADD COLUMN IF NOT EXISTS `free_payment_mollie_paybybank` DECIMAL(6,2) NOT NULL DEFAULT 0;
|
|
|
|
-- 2) Einstellungen (Zahlart-Editor, Reiter "Einstellungen", Gruppe mollie). API-Keys sind
|
|
-- Secrets (verschluesselt), nicht hier: test_api_key, live_api_key.
|
|
INSERT IGNORE INTO `configuration` (`name`, `text`, `group_id`, `setting`, `type`, `description`) VALUES
|
|
('mollie_mode', '', 'mollie', 'test', 1, 'test oder live (waehlt den API-Key)'),
|
|
('mollie_locale', '', 'mollie', 'de_DE', 1, 'Sprache der Mollie-Seite (xx_XX)'),
|
|
('mollie_currency', '', 'mollie', 'EUR', 1, 'Waehrung (ISO 4217)'),
|
|
('mollie_description', '', 'mollie', 'Bestellung [#order_number]', 1, 'Verwendungszweck auf dem Kontoauszug des Kunden');
|
|
|
|
-- 3) Zahlarten: eine Zeile je Methode. active=1, aber noch KEINER Kundengruppe zugeordnet
|
|
-- => im Shop unsichtbar, bis Schritt 4 laeuft. argument = Mollie-Methode (Pflicht).
|
|
INSERT INTO `payment_methods`
|
|
(`name`, `module`, `argument`, `active`, `rang`, `invoice_text`, `order_text`, `order_email_text`, `helperjoinkey`, `configuration_group_id`)
|
|
SELECT 'Klarna', 'mollie', 'klarna', 1, 3,
|
|
'Bezahlung erfolgte per Klarna',
|
|
'Sie werden zur Bezahlung Ihrer Bestellung zu Klarna weitergeleitet (Rechnung, Ratenkauf oder Sofort bezahlen).',
|
|
'Der zu zahlende Betrag wird ueber Klarna abgewickelt.',
|
|
'mollie_klarna', 'mollie'
|
|
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `payment_methods` WHERE `module`='mollie' AND `argument`='klarna');
|
|
|
|
INSERT INTO `payment_methods`
|
|
(`name`, `module`, `argument`, `active`, `rang`, `invoice_text`, `order_text`, `order_email_text`, `helperjoinkey`, `configuration_group_id`)
|
|
SELECT 'Kreditkarte', 'mollie', 'creditcard', 1, 4,
|
|
'Bezahlung erfolgte per Kreditkarte',
|
|
'Sie werden zur sicheren Eingabe Ihrer Kartendaten weitergeleitet (Visa, Mastercard, American Express).',
|
|
'Der zu zahlende Betrag wurde per Kreditkarte beglichen.',
|
|
'mollie_creditcard', 'mollie'
|
|
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `payment_methods` WHERE `module`='mollie' AND `argument`='creditcard');
|
|
|
|
INSERT INTO `payment_methods`
|
|
(`name`, `module`, `argument`, `active`, `rang`, `invoice_text`, `order_text`, `order_email_text`, `helperjoinkey`, `configuration_group_id`)
|
|
SELECT 'Apple Pay', 'mollie', 'applepay', 1, 5,
|
|
'Bezahlung erfolgte per Apple Pay',
|
|
'Sie werden zur Bezahlung mit Apple Pay weitergeleitet.',
|
|
'Der zu zahlende Betrag wurde per Apple Pay beglichen.',
|
|
'mollie_applepay', 'mollie'
|
|
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `payment_methods` WHERE `module`='mollie' AND `argument`='applepay');
|
|
|
|
INSERT INTO `payment_methods`
|
|
(`name`, `module`, `argument`, `active`, `rang`, `invoice_text`, `order_text`, `order_email_text`, `helperjoinkey`, `configuration_group_id`)
|
|
SELECT 'Google Pay', 'mollie', 'googlepay', 1, 6,
|
|
'Bezahlung erfolgte per Google Pay',
|
|
'Sie werden zur Bezahlung mit Google Pay weitergeleitet.',
|
|
'Der zu zahlende Betrag wurde per Google Pay beglichen.',
|
|
'mollie_googlepay', 'mollie'
|
|
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `payment_methods` WHERE `module`='mollie' AND `argument`='googlepay');
|
|
|
|
-- Google Pay: Mollie lehnt method=googlepay im Redirect-Verfahren ab (HTTP 500, 27.09.2026) --
|
|
-- gibt es nur als Direkt-Integration mit Token. Zeile bleibt angelegt, aber inaktiv.
|
|
UPDATE `payment_methods` SET active=0 WHERE module='mollie' AND argument='googlepay';
|
|
|
|
-- "Online-Banking" = Mollie Pay by Bank (Open Banking, Nachfolger von Sofortueberweisung).
|
|
-- NICHT "Sofortueberweisung" nennen: eingetragene Marke der Sofort GmbH (Klarna).
|
|
-- Status nach Freigabe erst pending, paid kommt per Webhook (Echtzeit: Minuten, sonst 2-3 Werktage).
|
|
INSERT INTO `payment_methods`
|
|
(`name`, `module`, `argument`, `active`, `rang`, `invoice_text`, `order_text`, `order_email_text`, `helperjoinkey`, `configuration_group_id`)
|
|
SELECT 'Online-Banking', 'mollie', 'paybybank', 1, 7,
|
|
'Bezahlung erfolgte per Online-Banking (Pay by Bank)',
|
|
'Sie zahlen direkt von Ihrem Bankkonto: Bank waehlen, im Online-Banking freigeben, fertig.',
|
|
'Der zu zahlende Betrag wurde per Online-Banking ueberwiesen.',
|
|
'mollie_paybybank', 'mollie'
|
|
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `payment_methods` WHERE `module`='mollie' AND `argument`='paybybank');
|
|
|
|
-- 4) FREISCHALTUNG (manuell, nach Test): Kundengruppen 1 Endverbraucher, 103 Gast
|
|
-- (Haendler 101 bewusst nicht -- die zahlen kundenspezifisch), Versandgebiet 1.
|
|
-- INSERT INTO `customer_group_payment_method_configuration` (`group_id`, `payment_method_id`, `shipping_area_id`, `active`)
|
|
-- SELECT g.id, pm.id, 1, 1 FROM payment_methods pm JOIN customer_groups g ON g.id IN (1,103)
|
|
-- WHERE pm.module='mollie'
|
|
-- AND NOT EXISTS (SELECT 1 FROM customer_group_payment_method_configuration c WHERE c.group_id=g.id AND c.payment_method_id=pm.id AND c.shipping_area_id=1);
|
|
|
|
-- 5) LEICHEN (nach Go-Live): alte Klarna-/paymorrow-/BILLPAY-/computop-Zahlarten verstecken.
|
|
-- Nicht loeschen -- Bestellungen von frueher zeigen noch auf die ids.
|
|
-- UPDATE `payment_methods` SET active=0 WHERE id IN (8,9,10,11,12,13);
|