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
|
<?php
/**
* Template für die Integration der Zahlungsart AmazonPay in die Bestellverwaltung
* @version 4.6.1
*/
if (!defined('ABSPATH')) exit;
$arView = $this->view['wpsg_mod_amazon'];
$oOrder = $arView['oOrder'];
$strState = (string)$oOrder->getMeta(wpsg_mod_amazon::META_STATE);
$strChargeId = (string)$oOrder->getMeta(wpsg_mod_amazon::META_CHARGE);
$strRefundId = (string)$oOrder->getMeta(wpsg_mod_amazon::META_REFUND);
$strRefundState = (string)$oOrder->getMeta(wpsg_mod_amazon::META_REFUND_STATE);
// Farbe des Status: eingezogen bzw. erstattet grün, offen gelb, abgelehnt rot
$arStateClass = [
'Captured' => 'success',
'Completed' => 'success',
'Refunded' => 'success',
'AuthorizationInitiated' => 'warning',
'Authorized' => 'warning',
'CaptureInitiated' => 'warning',
'RefundInitiated' => 'warning',
'Open' => 'warning',
'Declined' => 'danger',
'Canceled' => 'danger'
];
$strBadge = '<span class="label label-%s" style="font-size:12px;">%s</span>';
$strRefreshURL = wpsg_admin_url('Order', 'view', ['action' => 'ajax', 'edit_id' => $oOrder->getId(), 'do' => 'refresh', 'mod' => 'wpsg_mod_amazon'], ['noheader' => '1']);
$strRefundURL = wpsg_admin_url('Order', 'view', ['action' => 'ajax', 'edit_id' => $oOrder->getId(), 'do' => 'refund', 'mod' => 'wpsg_mod_amazon'], ['noheader' => '1']);
?>
<?php if ($arView['bLegacy']) { ?>
<?php echo wpsg_drawForm_Text(__('Schnittstelle', 'wpsg'), esc_html__('Frühere Anbindung (Login and Pay / MWS), Erstattungen bitte in der Seller Central', 'wpsg')); ?>
<?php foreach (['amazon_order_reference_id' => __('Amazon-Referenznummer', 'wpsg'), 'amazon_capture_id' => __('Capture ID', 'wpsg'), 'amazon_refund_id' => __('Refund ID', 'wpsg')] as $meta_key => $meta_label) { ?>
<?php if ((string)$oOrder->getMeta($meta_key) !== '') { ?>
<?php echo wpsg_drawForm_Text($meta_label, '<code>'.esc_html($oOrder->getMeta($meta_key)).'</code>'); ?>
<?php } ?>
<?php } ?>
<?php } else if ($strChargeId !== '' || (string)$oOrder->getMeta(wpsg_mod_amazon::META_SESSION) !== '') { ?>
<?php
$strStateHTML = sprintf($strBadge, esc_attr($arStateClass[$strState]??'default'), (($strState !== '')?esc_html($strState):esc_html__('Unbekannt', 'wpsg')));
$strStateHTML .= ' <a class="btn btn-default btn-xs" href="'.esc_url($strRefreshURL).'"><span class="glyphicon glyphicon-refresh" aria-hidden="true"></span> '.esc_html__('Status Aktualisieren', 'wpsg').'</a>';
if ($arView['bRefundable']) {
$strStateHTML .= ' <a class="btn btn-default btn-xs" href="'.esc_url($strRefundURL).'" onclick="return confirm('.esc_attr(wp_json_encode(__('Soll der Betrag wirklich über Amazon Pay erstattet werden?', 'wpsg'))).');"><span class="glyphicon glyphicon-share-alt" aria-hidden="true"></span> '.esc_html__('Erstatten', 'wpsg').'</a>';
}
?>
<?php echo wpsg_drawForm_Text(__('AmazonPay Status', 'wpsg'), $strStateHTML); ?>
<?php if ((string)$oOrder->getMeta(wpsg_mod_amazon::META_ENV) === wpsg_mod_amazon::ENV_SANDBOX) { ?>
<?php echo wpsg_drawForm_Text(__('Umgebung', 'wpsg'), sprintf($strBadge, 'warning', esc_html__('Sandbox (Testbetrieb)', 'wpsg'))); ?>
<?php } ?>
<?php foreach ([wpsg_mod_amazon::META_CHARGE_PERMISSION => __('Amazon-Referenznummer', 'wpsg'), wpsg_mod_amazon::META_CHARGE => __('Charge ID', 'wpsg'), wpsg_mod_amazon::META_SESSION => __('Checkout Session ID', 'wpsg')] as $meta_key => $meta_label) { ?>
<?php if ((string)$oOrder->getMeta($meta_key) !== '') { ?>
<?php echo wpsg_drawForm_Text($meta_label, '<code>'.esc_html($oOrder->getMeta($meta_key)).'</code>'); ?>
<?php } ?>
<?php } ?>
<?php if ($strRefundId !== '') { ?>
<?php echo wpsg_drawForm_Text(__('Refund ID', 'wpsg'), '<code>'.esc_html($strRefundId).'</code>'); ?>
<?php echo wpsg_drawForm_Text(__('Erstattungsstatus', 'wpsg'), sprintf($strBadge, esc_attr($arStateClass[$strRefundState]??'default'), (($strRefundState !== '')?esc_html($strRefundState):esc_html__('Unbekannt', 'wpsg')))); ?>
<?php } ?>
<?php } ?>
|