1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
<?php
/**
* 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 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(); ?>
<?php wpsg_drawForm_AdminboxStart(__('Erstattung bei Statuswechsel', 'wpsg'), 'wpsg_mod_amazon_storno'); ?>
<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>
<?php foreach ($this->arStatus as $status_id => $status_label) { ?>
<?php echo wpsg_drawForm_Checkbox('wpsg_mod_amazon_stornostate['.$status_id.']', esc_html($status_label), ($arStornoStatus[$status_id]??'0')); ?>
<?php } ?>
<?php wpsg_drawForm_AdminboxEnd(); ?>
|