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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
<?php
/**
* Dieses Template wird nach einer Targo Zahlung angezeigt
*/
if ($this->get_option('wpsg_mod_targo_url_use') == 0)
{
$url = $this->get_option('wpsg_mod_targo_url_live');
}
else
{
$url = $this->get_option('wpsg_mod_targo_url_test');
}
?>
<p><?php echo __('Um den Betrag mit einer Finanzierung bei der TARGOBANK zu bezahlen, klicken Sie bitte auf folgendes Logo.', 'wpsg'); ?></p>
<p>
<!--
<a title="<?php echo __('Mit Targo bezahlen', 'wpsg'); ?>" href="<?php echo $url; ?>">
<img src="<?php echo $this->getRessourceURL('gfx/targologo.png'); ?>" align="left" alt="<?php echo __('Finanzierung bei Targo beantragen.', 'wpsg'); ?>" style="margin-right:7px;">
</a>
-->
</p>
<script type="text/javascript">document.charset = 'ISO-8859-1';</script>
<form class="wpsg_productform" id="wpsg_produktform" accept-charset="ISO-8859-1" method="post" action="<?php echo $url ?>">
<input type="image" name="image" src="<?php echo $this->getRessourceURL('gfx/targologo.png'); ?>" alt="<?php echo __('Finanzierung bei Targo beantragen.', 'wpsg'); ?>" style="margin-right:7px;">
<div style="display:none;">
<?php $o_id = $this->view['o_id'];
$k_id = $this->view['k_id'];
$oOrder = wpsg_order::getInstance($o_id);
$brutto = $oOrder->getAmount(WPSG_BRUTTO);
$brutto = wpsg_round($brutto, 2);
/** @var wpsg_customer */
$oCustomer = wpsg_customer::getInstance($k_id);
/*
$geb1 = $oCustomer->getBirthdate("Y-m-d");
$geb2 = $oCustomer->getBirthdate();
$geb3 = $oCustomer->data["geb"];
$geb4 = wpsg_date("Y-m-d", strtotime($geb3));
$geb5 = strtotime($geb3);
$geb6 = strtotime("0000-00-00");
$geb6 = strtotime("1901-12-13");
$geb6 = strtotime("1901-12-14");
*/
$dl = $this->view['targoLink'];
$street = $oOrder-> getInvoiceStreetClear(true);
$nr = $oOrder-> getInvoiceStreetNr();
?>
<?php ?>
<?php
if (method_exists($oCustomer, getTitle)) {
$titel = $oCustomer->getTitle();
}
else
{
$titel = $oCustomer->title;
}
$isotitel = '';
if (($titel == "Herr") || ($titel == "Frau")) $isotitel = toIso($titel);
$dt = $oCustomer->getBirthdate("Y-m-d");
if ($oCustomer->geb == '0000-00-00' || strtotime($dt) === false)
{
$bd = '';
}
else
{
$bd = $oCustomer->getBirthdate("Y-m-d");
}
function toIso($string) {
//return mb_convert_encoding($string, "ISO-8859-1");
return utf8_decode(utf8_encode($string));
}
$hash = '';
$key = '123456';
$key = $this->get_option('wpsg_mod_targo_hashkey');
//$param = "amount=5000&koop_id=testidkk89&dealerText=https%3A%2F%2Fwww.targobank.de&documentno=&".
// "dealerShopURL=&dealerAbortURL=&dealerID=123456&birthday=1970-12-31";
$arr = Array("koop_id" => $this->get_option('wpsg_mod_targo_koop_id'),
"SessionID" => session_id(),
"amount" => $brutto,
"dealerID" => $this->get_option('wpsg_mod_targo_dealerid'),
"dealerText" => ($this->view['targoLink']),
"documentno" => $this->view['o_id'],
"gender" => $isotitel,
"surname" => toIso($oCustomer->getName()),
"firstname" => toIso($oCustomer->getFirstname()),
"street" => toIso($oOrder->getInvoiceStreetClear(true)),
"streetnumber" => toIso($oOrder->getInvoiceStreetNr()),
"zip" => toIso($oCustomer->getZip()),
"city" => toIso($oCustomer->getCity()),
"telnocode" => '',
"telno" => toIso($oCustomer->getPhone()),
"birthday" => $bd,
"email" => toIso($oCustomer->getEMail()),
"dealerShopURL" => ($this->get_option('wpsg_mod_targo_dealerShopURL')),
"dealerAbortURL" => ($this->get_option('wpsg_mod_targo_dealerAbortURL'))
);
$param = http_build_query($arr);
$hash = hash_hmac( 'sha256', $param, $key); // HMAC-SHA256
// Test
//$hash = "85ef6ddce9bbebffa250d6f8183f3f727af5f9fda879b73aa0685eb2d9386e70";
?>
<br /><br />
<b>Obligatorische Daten für Targobank</b><br />
<input type="text" id="koop_id" name="koop_id" value="<?php echo $this->get_option('wpsg_mod_targo_koop_id');?>" placeholder="koop_id"><br />
<input type="text" id="SessionID" name="sessionID" value="<?php echo session_id();?>" placeholder="sessionID"><br />
<input type="text" id="amount" name="amount" value="<?php echo $brutto;?>" placeholder="amount"><br />
<input type="text" id="dealerID" name="dealerID" value="<?php echo $this->get_option('wpsg_mod_targo_dealerid');?>" placeholder="dealerID"><br />
<input type="text" id="dealerText" name="dealerText" value="<?php echo $this->view['targoLink'];?>" placeholder="dealerText"><br />
<input type="text" id="documentno" name="documentno" value="<?php echo $this->view['o_id'];?>" placeholder="documentno"><br />
<b>Adressdaten aus Kundendaten</b><br />
<input type="text" id="gender" name="gender" value="<?php echo $isotitel;?>" placeholder="titel"><br />
<input type="text" id="surname" name="surname" value="<?php echo toIso($oCustomer->getName());?>" placeholder="surname"><br />
<input type="text" id="firstname" name="firstname" value="<?php echo toIso($oCustomer->getFirstname());?>" placeholder="firstname"><br />
<input type="text" id="street" name="street" value="<?php echo toIso($oOrder->getInvoiceStreetClear(true));?>" placeholder="street"><br />
<input type="text" id="streetnumber" name="streetnumber" value="<?php echo toIso($oOrder->getInvoiceStreetNr());?>" placeholder="streetnumber"><br />
<input type="text" id="zip" name="zip" value="<?php echo toIso($oCustomer->getZip());?>" placeholder="zip"><br />
<input type="text" id="city" name="city" value="<?php echo toIso($oCustomer->getCity());?>" placeholder="city"><br />
<input type="text" id="telnocode" name="telnocode" value="" placeholder="vorwahl"><br />
<input type="text" id="telno" name="telno" value="<?php echo toIso($oCustomer->getPhone());?>" placeholder="telno"><br />
<input type="text" id="birthday" name="birthday" value="<?php echo $bd;?>" placeholder="birthday"><br />
<input type="text" id="email" name="email" value="<?php echo toIso($oCustomer->getEMail());?>" placeholder="email"><br />
<b>Optionale Daten für Targobank</b><br />
<input type="text" id="dealerShopURL" name="dealerShopURL" value="<?php echo $this->get_option('wpsg_mod_targo_dealerShopURL');?>" placeholder="dealerShopURL"><br />
<input type="text" id="dealerAbortURL" name="dealerAbortURL" value="<?php echo $this->get_option('wpsg_mod_targo_dealerAbortURL');?>" placeholder="dealerAbortURL"><br />
<input type="text" id="hash" name="hash" value="<?php echo $hash;?>" placeholder="hash">(hashkey)<br />
<input type="submit" id="submit" name="submit" value="submit" >
</div>
</form>
<?php if ($this->get_option('wpsg_mod_targo_autostart') == '1') { ?>
<script type="text/javascript">/* <![CDATA[ */
jQuery(document).ready(function() {
window.setTimeout(function() {
//location.href = "<?php echo $url;?>";
jQuery('#submit').trigger("click");
}, 1000);
} );
/* ]]> */</script>
<?php } ?>
|