diff options
| author | daniel <noreply@maennchen1.de> | 2026-09-30 13:12:16 +0200 |
|---|---|---|
| committer | daniel <noreply@maennchen1.de> | 2026-09-30 13:12:37 +0200 |
| commit | ea77830018e15ab662fb0cfb2958857e3b3de532 (patch) | |
| tree | 9634013e7a45c0f9da6891dd6bf0541801f6e3a2 /views/mods/mod_amazon/settings_edit.phtml | |
| parent | ee163b01c6bdf3da7c2a8f3ee1be25b02cb760b4 (diff) | |
- Amazon Modul vereinheitlicht und moderniesiert
Diffstat (limited to 'views/mods/mod_amazon/settings_edit.phtml')
| -rw-r--r-- | views/mods/mod_amazon/settings_edit.phtml | 155 |
1 files changed, 136 insertions, 19 deletions
diff --git a/views/mods/mod_amazon/settings_edit.phtml b/views/mods/mod_amazon/settings_edit.phtml index 827c68f..35020eb 100644 --- a/views/mods/mod_amazon/settings_edit.phtml +++ b/views/mods/mod_amazon/settings_edit.phtml @@ -1,32 +1,149 @@ <?php
/**
- * Einstellungen des Moduls "AmazonPay"
+ * Templatedatei für die Einstellungen des Moduls AmazonPay (Amazon Pay Checkout v2)
+ *
+ * Live-System und Sandbox haben je eigene Zugangsdaten, der Umschalter "Aktive Umgebung" legt fest, welche der
+ * Shop für neue Zahlungen verwendet.
*/
+ if (!defined('ABSPATH')) exit;
+
+ $arView = $this->view['wpsg_mod_amazon'];
+ $bSandbox = (bool)$arView['bSandbox'];
+
+ $arStornoStatus = (array)$this->get_option('wpsg_mod_amazon_stornostate');
+
+ // Anmeldung für Amazon-Pay-Händler, führt direkt in den Amazon-Pay-Bereich der Seller Central
+ $strSellerCentralURL = 'https://pay.amazon.de/signin';
+
+ $strBadge = '<span class="label label-%s" style="font-size:12px;">%s</span>';
+
+ $arEnvLabel = [
+ wpsg_mod_amazon::ENV_LIVE => __('Zugangsdaten Live-System', 'wpsg'),
+ wpsg_mod_amazon::ENV_SANDBOX => __('Zugangsdaten Sandbox (Testbetrieb)', 'wpsg')
+ ];
+
+ if ($bSandbox) {
+
+ $strMode = sprintf($strBadge, 'warning', esc_html__('Sandbox (Testbetrieb)', 'wpsg'));
+
+ } else {
+
+ $strMode = sprintf($strBadge, 'success', esc_html__('Live', 'wpsg'));
+
+ }
+
?>
-<?php echo wpsg_drawForm_Input('wpsg_mod_amazon_seller_id', __('Seller ID / Verkäufer-ID', 'wpsg'), $this->get_option('wpsg_mod_amazon_seller_id'), array('help' => 'wpsg_mod_amazon_seller_id')); ?>
-<?php echo wpsg_drawForm_Input('wpsg_mod_amazon_mws_access_key_id', __('Access Key ID', 'wpsg'), $this->get_option('wpsg_mod_amazon_mws_access_key_id'), array('help' => 'wpsg_mod_amazon_mws_access_key_id')); ?>
-<?php echo wpsg_drawForm_Input('wpsg_mod_amazon_mws_access_key', __('Secret Access Key', 'wpsg'), $this->get_option('wpsg_mod_amazon_mws_access_key'), array('help' => 'wpsg_mod_amazon_mws_access_key')); ?>
-<?php echo wpsg_drawForm_Input('wpsg_mod_amazon_lwa_client_id', __('Login with Amazon Client ID', 'wpsg'), $this->get_option('wpsg_mod_amazon_lwa_client_id'), array('help' => 'wpsg_mod_amazon_lwa_client_id')); ?>
-<?php echo wpsg_drawForm_Input('wpsg_mod_amazon_lwa_client_secret', __('Login with Amazon Client Secret', 'wpsg'), $this->get_option('wpsg_mod_amazon_lwa_client_secret'), array('help' => 'wpsg_mod_amazon_lwa_client_secret')); ?>
-<?php echo wpsg_drawForm_Checkbox('wpsg_mod_amazon_sandbox', __('Sandbox Modus', 'wpsg'), $this->get_option('wpsg_mod_amazon_sandbox'), array('help' => 'wpsg_mod_amazon_sandbox')); ?>
+<?php if ($arView['bLegacyCredentials']) { ?>
+
+ <div class="wpsg_hinweis">
+ <?php echo esc_html__('AmazonPay arbeitet jetzt mit Amazon Pay Checkout v2. Die Zugangsdaten der früheren Anbindung (MWS Access Key, Login with Amazon) werden nicht mehr verwendet. Erzeugen Sie in der Seller Central unter "Integration → Integration Central" einen API-Schlüssel und tragen Sie Client-ID/Store-ID, Public Key ID und den privaten Schlüssel unten ein. Bis dahin wird AmazonPay im Shop nicht angeboten.', 'wpsg'); ?>
+ </div>
+
+<?php } ?>
+
+<?php wpsg_drawForm_AdminboxStart(__('Umgebung', 'wpsg'), 'wpsg_mod_amazon_environment'); ?>
+
+ <?php echo wpsg_drawForm_Select('wpsg_mod_amazon_sandbox', __('Aktive Umgebung', 'wpsg'), ['0' => __('Live-System', 'wpsg'), '1' => __('Sandbox (Testbetrieb)', 'wpsg')], (($bSandbox)?'1':'0'), ['help' => 'wpsg_mod_amazon_sandbox', 'hint' => esc_html__('Neue Zahlungen laufen über die Zugangsdaten der aktiven Umgebung. In der Sandbox werden keine echten Zahlungen ausgeführt. Bestehende Zahlungen fragt der Shop weiterhin in der Umgebung ab, in der sie angelegt wurden.', 'wpsg')]); ?>
+ <?php echo wpsg_drawForm_Text(__('Neue Zahlungen über', 'wpsg'), $strMode); ?>
+
+<?php wpsg_drawForm_AdminboxEnd(); ?>
+
+<?php foreach ($arView['arEnv'] as $env => $arEnv) { ?>
+
+ <?php
+
+ $arStatus = (array)$arEnv['arStatus'];
+ $arFields = $arEnv['arFields'];
+ $bActive = ($env === (($bSandbox)?wpsg_mod_amazon::ENV_SANDBOX:wpsg_mod_amazon::ENV_LIVE));
+
+ if (!$arEnv['bConfigured']) {
+
+ $strConnection = sprintf($strBadge, 'default', esc_html__('Keine vollständigen Zugangsdaten hinterlegt', 'wpsg'));
+
+ } else if (!isset($arStatus['time'])) {
+
+ $strConnection = sprintf($strBadge, 'default', esc_html__('Noch nicht geprüft, bitte speichern', 'wpsg'));
+
+ } else if (($arStatus['connected']??false) === true) {
+
+ $strConnection = sprintf($strBadge, 'success', esc_html__('Verbindung erfolgreich', 'wpsg'));
+
+ } else {
+
+ $strConnection = sprintf($strBadge, 'danger', esc_html__('Anmeldung fehlgeschlagen', 'wpsg'));
+
+ if ((string)($arStatus['message']??'') !== '') $strConnection .= '<br /><small class="text-danger">'.esc_html($arStatus['message']).'</small>';
+
+ }
+
+ if ($bActive) $strConnection .= ' '.sprintf($strBadge, 'info', esc_html__('aktiv', 'wpsg'));
+
+ $strKey = sprintf($strBadge, (($arEnv['bKey'])?'success':'danger'), (($arEnv['bKey'])?esc_html__('Hinterlegt', 'wpsg'):esc_html__('Fehlt', 'wpsg')));
+
+ ?>
+
+ <?php wpsg_drawForm_AdminboxStart($arEnvLabel[$env], 'wpsg_mod_amazon_credentials_'.$env); ?>
+
+ <?php echo wpsg_drawForm_Text(__('Verbindung', 'wpsg'), $strConnection); ?>
+ <?php echo wpsg_drawForm_Text(__('Privater Schlüssel', 'wpsg'), $strKey); ?>
+
+ <?php if (isset($arStatus['time'])) { ?>
+
+ <?php echo wpsg_drawForm_Text(__('Zuletzt geprüft', 'wpsg'), esc_html(wpsg_formatTimestamp($arStatus['time']))); ?>
+
+ <?php } ?>
+
+ <?php if ($arEnv['bKeyMismatch']) { ?>
+
+ <div class="wpsg_hinweis"><?php echo esc_html((($env === wpsg_mod_amazon::ENV_SANDBOX)?__('Die Public Key ID beginnt mit "LIVE-" und gehört zum Live-System. Amazon nimmt sie in der Sandbox nicht an.', 'wpsg'):__('Die Public Key ID beginnt mit "SANDBOX-" und gehört zur Sandbox. Amazon nimmt sie im Live-System nicht an.', 'wpsg'))); ?></div>
+
+ <?php } ?>
+
+ <?php echo wpsg_drawForm_Input($arFields['seller_id']['name'], __('Händler-ID (Merchant ID)', 'wpsg'), $arFields['seller_id']['value'], ['help' => 'wpsg_mod_amazon_seller_id']); ?>
+ <?php echo wpsg_drawForm_Input($arFields['store_id']['name'], __('Client-ID/Store-ID', 'wpsg'), $arFields['store_id']['value'], ['help' => 'wpsg_mod_amazon_store_id', 'hint' => esc_html__('Beginnt mit "amzn1.application-oa2-client.". Das "Client Secret" daneben wird nicht benötigt.', 'wpsg')]); ?>
+ <?php echo wpsg_drawForm_Input($arFields['public_key_id']['name'], __('Public Key ID', 'wpsg'), $arFields['public_key_id']['value'], ['help' => 'wpsg_mod_amazon_public_key_id', 'hint' => wpsg_translate(__('Händler-ID, Client-ID/Store-ID und API-Schlüssel finden bzw. erzeugen Sie in der <a target="_blank" href="#1#">Seller Central</a> unter "Integration → Integration Central".', 'wpsg'), esc_url($strSellerCentralURL))]); ?>
+ <?php echo wpsg_drawForm_Upload($arFields['private_key']['name'], __('Privater Schlüssel (.pem Datei)', 'wpsg'), false, '50', '100000', ['accept' => '.pem', 'help' => 'wpsg_mod_amazon_private_key']); ?>
+
+ <?php wpsg_drawForm_AdminboxEnd(); ?>
+
+<?php } ?>
+
+<?php wpsg_drawForm_AdminboxStart(__('Zahlungsart im Shop', 'wpsg'), 'wpsg_mod_amazon_payment'); ?>
+
+ <?php echo wpsg_drawForm_Checkbox('wpsg_mod_amazon_aktiv', __('Zahlungsart für neue Bestellungen aktiv', 'wpsg'), $this->get_option('wpsg_mod_amazon_aktiv'), ['help' => 'wpsg_shippay_activ']); ?>
+ <?php echo wpsg_drawForm_Input('wpsg_mod_amazon_name', __('Name der Zahlungsart', 'wpsg'), $this->get_option('wpsg_mod_amazon_name'), ['help' => 'wpsg_mod_amazon_name']); ?>
+ <?php echo wpsg_drawForm_Textarea('wpsg_mod_amazon_hint', __('Hinweistext', 'wpsg'), $this->get_option('wpsg_mod_amazon_hint'), ['help' => 'wpsg_shippay_hint']); ?>
+ <?php echo wpsg_drawForm_Input('wpsg_mod_amazon_gebuehr', __('Gebühr/Rabatt', 'wpsg'), wpsg_ff($this->get_option('wpsg_mod_amazon_gebuehr'), true), ['help' => 'wpsg_shippay_gebuehr', 'unit' => $this->get_option('wpsg_currency').' / %']); ?>
+ <?php echo wpsg_drawForm_Select('wpsg_mod_amazon_mwst', __('Mehrwertsteuersatz', 'wpsg'), wpsg_tax_groups(), $this->get_option('wpsg_mod_amazon_mwst'), ['help' => 'wpsg_mod_amazon_mwst']); ?>
+
+<?php wpsg_drawForm_AdminboxEnd(); ?>
+
+<?php wpsg_drawForm_AdminboxStart(__('Zahlungsablauf', 'wpsg'), 'wpsg_mod_amazon_process'); ?>
+
+ <?php echo wpsg_drawForm_Checkbox('wpsg_mod_amazon_basket', __('Button im Warenkorb anzeigen', 'wpsg'), $this->get_option('wpsg_mod_amazon_basket'), ['help' => 'wpsg_mod_amazon_basket']); ?>
+ <?php echo wpsg_drawForm_Checkbox('wpsg_mod_amazon_autostart', __('Zahlung nach dem Bestellabschluss direkt starten', 'wpsg'), $this->get_option('wpsg_mod_amazon_autostart'), ['help' => 'wpsg_mod_amazon_autostart']); ?>
+ <?php echo wpsg_drawForm_Select('wpsg_mod_amazon_buttoncolor', __('Farbe des Buttons', 'wpsg'), $arView['arButtonColors'], $this->get_option('wpsg_mod_amazon_buttoncolor'), ['help' => 'wpsg_mod_amazon_buttoncolor']); ?>
+ <?php echo wpsg_drawForm_Input('wpsg_mod_amazon_subject', __('Betreff (Auf Abrechnungen für Verkäufer sichtbar)', 'wpsg'), $this->get_option('wpsg_mod_amazon_subject'), ['help' => 'wpsg_mod_amazon_subject']); ?>
+
+<?php wpsg_drawForm_AdminboxEnd(); ?>
+
+<?php wpsg_drawForm_AdminboxStart(__('Zahlungsbenachrichtigungen (IPN)', 'wpsg'), 'wpsg_mod_amazon_ipn'); ?>
+
+ <?php echo wpsg_drawForm_Input('', __('IPN URL', 'wpsg'), $arView['ipnURL'], ['readonly' => true, 'help' => 'wpsg_mod_amazon_ipn_url', 'hint' => esc_html__('Tragen Sie diese URL in der Seller Central unter "Integration → Integration Central → IPN-Einstellungen" ein. Amazon meldet darüber Zahlungen, die erst später eingezogen werden, und den Stand von Erstattungen. Die URL muss per HTTPS von außen erreichbar sein.', 'wpsg')]); ?>
+
+<?php wpsg_drawForm_AdminboxEnd(); ?>
-<br />
+<?php wpsg_drawForm_AdminboxStart(__('Erstattung bei Statuswechsel', 'wpsg'), 'wpsg_mod_amazon_storno'); ?>
-<?php echo wpsg_drawForm_Checkbox('wpsg_mod_amazon_aktiv', __('Zahlungsart für neue Bestellungen aktiv', 'wpsg'), $this->get_option('wpsg_mod_amazon_aktiv')); ?>
-<?php echo wpsg_drawForm_Input('wpsg_mod_amazon_name', __('Name der Zahlungsart', 'wpsg'), $this->get_option('wpsg_mod_amazon_name'), array('help' => 'wpsg_mod_amazon_name')); ?>
-<?php echo wpsg_drawForm_Textarea('wpsg_mod_amazon_hint', __('Hinweistext', 'wpsg'), $this->get_option('wpsg_mod_amazon_hint'), array('help' => 'wpsg_shippay_hint')); ?>
-<?php echo wpsg_drawForm_Input('wpsg_mod_amazon_subject', __('Betreff (Auf Abrechnungen für Verkäufer sichtbar)', 'wpsg'), $this->get_option('wpsg_mod_amazon_subject'), array('help' => 'wpsg_mod_amazon_subject')); ?>
-<?php echo wpsg_drawForm_Checkbox('wpsg_mod_amazon_basket', __('Button in Warenkorb integrieren', 'wpsg'), $this->get_option('wpsg_mod_amazon_basket'), array('help' => 'wpsg_mod_amazon_basket')); ?>
+ <p class="text-muted"><?php echo esc_html__('Wechselt eine mit AmazonPay bezahlte Bestellung in einen der markierten Status, wird der Betrag automatisch über Amazon Pay erstattet.', 'wpsg'); ?></p>
-<br />
+ <?php foreach ($this->arStatus as $status_id => $status_label) { ?>
-<?php echo wpsg_drawForm_Input('wpsg_mod_amazon_gebuehr', __('Gebühr/Rabatt', 'wpsg'), wpsg_ff($this->get_option('wpsg_mod_amazon_gebuehr'), true), array('unit' => $this->get_option('wpsg_currency').' / %', 'help' => 'wpsg_shippay_gebuehr')); ?>
-<?php echo wpsg_drawForm_Select('wpsg_mod_amazon_mwst', __('Mehrwertsteuersatz', 'wpsg'), wpsg_tax_groups(), $this->get_option('wpsg_mod_amazon_mwst'), array('help' => 'wpsg_mod_amazon_mwst')); ?>
+ <?php echo wpsg_drawForm_Checkbox('wpsg_mod_amazon_stornostate['.$status_id.']', esc_html($status_label), ($arStornoStatus[$status_id]??'0')); ?>
-<br />
+ <?php } ?>
-<?php echo wpsg_drawForm_Input('', __('Händler URL', 'wpsg'), $this->view['ipnURL'], array('readonly' => true)); ?>
-<?php echo wpsg_drawForm_Input('', __('JavaScript Origin', 'wpsg'), $this->view['jsOrigin'], array('readonly' => true)); ?>
\ No newline at end of file +<?php wpsg_drawForm_AdminboxEnd(); ?>
|
