5945 |
hartmut |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/**
|
|
|
4 |
* Dieses Template wird nach einer Targo Zahlung angezeigt
|
|
|
5 |
*/
|
|
|
6 |
|
|
|
7 |
if ($this->get_option('wpsg_mod_targo_url_use') == 0)
|
|
|
8 |
{
|
|
|
9 |
$url = $this->get_option('wpsg_mod_targo_url_live');
|
|
|
10 |
}
|
|
|
11 |
else
|
|
|
12 |
{
|
|
|
13 |
$url = $this->get_option('wpsg_mod_targo_url_test');
|
|
|
14 |
}
|
|
|
15 |
|
|
|
16 |
?>
|
|
|
17 |
|
|
|
18 |
<p><?php echo __('Um den Betrag mit einer Finanzierung bei der TARGOBANK zu bezahlen, klicken Sie bitte auf folgendes Logo.', 'wpsg'); ?></p>
|
|
|
19 |
<p>
|
|
|
20 |
<!--
|
|
|
21 |
<a title="<?php echo __('Mit Targo bezahlen', 'wpsg'); ?>" href="<?php echo $url; ?>">
|
|
|
22 |
<img src="<?php echo $this->getRessourceURL('gfx/targologo.png'); ?>" align="left" alt="<?php echo __('Finanzierung bei Targo beantragen.', 'wpsg'); ?>" style="margin-right:7px;">
|
|
|
23 |
|
|
|
24 |
</a>
|
|
|
25 |
-->
|
|
|
26 |
</p>
|
|
|
27 |
<script type="text/javascript">document.charset = 'ISO-8859-1';</script>
|
|
|
28 |
<form class="wpsg_productform" id="wpsg_produktform" accept-charset="ISO-8859-1" method="post" action="<?php echo $url ?>">
|
|
|
29 |
|
|
|
30 |
<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;">
|
|
|
31 |
|
|
|
32 |
<div style="display:none;">
|
|
|
33 |
<?php $o_id = $this->view['o_id'];
|
|
|
34 |
$k_id = $this->view['k_id'];
|
|
|
35 |
$oOrder = wpsg_order::getInstance($o_id);
|
|
|
36 |
$brutto = $oOrder->getAmount(WPSG_BRUTTO);
|
|
|
37 |
$brutto = wpsg_round($brutto, 2);
|
|
|
38 |
/** @var wpsg_customer */
|
|
|
39 |
$oCustomer = wpsg_customer::getInstance($k_id);
|
|
|
40 |
/*
|
|
|
41 |
$geb1 = $oCustomer->getBirthdate("Y-m-d");
|
|
|
42 |
$geb2 = $oCustomer->getBirthdate();
|
|
|
43 |
$geb3 = $oCustomer->data["geb"];
|
|
|
44 |
$geb4 = wpsg_date("Y-m-d", strtotime($geb3));
|
|
|
45 |
$geb5 = strtotime($geb3);
|
|
|
46 |
$geb6 = strtotime("0000-00-00");
|
|
|
47 |
$geb6 = strtotime("1901-12-13");
|
|
|
48 |
$geb6 = strtotime("1901-12-14");
|
|
|
49 |
*/
|
|
|
50 |
$dl = $this->view['targoLink'];
|
|
|
51 |
|
|
|
52 |
$street = $oOrder-> getInvoiceStreetClear(true);
|
|
|
53 |
$nr = $oOrder-> getInvoiceStreetNr();
|
|
|
54 |
|
|
|
55 |
?>
|
|
|
56 |
<?php ?>
|
|
|
57 |
<?php
|
|
|
58 |
|
|
|
59 |
if (method_exists($oCustomer, getTitle)) {
|
|
|
60 |
$titel = $oCustomer->getTitle();
|
|
|
61 |
}
|
|
|
62 |
else
|
|
|
63 |
{
|
|
|
64 |
$titel = $oCustomer->title;
|
|
|
65 |
}
|
|
|
66 |
$isotitel = '';
|
|
|
67 |
if (($titel == "Herr") || ($titel == "Frau")) $isotitel = toIso($titel);
|
|
|
68 |
|
|
|
69 |
$dt = $oCustomer->getBirthdate("Y-m-d");
|
|
|
70 |
|
|
|
71 |
if ($oCustomer->geb == '0000-00-00' || strtotime($dt) === false)
|
|
|
72 |
{
|
|
|
73 |
|
|
|
74 |
$bd = '';
|
|
|
75 |
|
|
|
76 |
}
|
|
|
77 |
else
|
|
|
78 |
{
|
|
|
79 |
|
|
|
80 |
$bd = $oCustomer->getBirthdate("Y-m-d");
|
|
|
81 |
|
|
|
82 |
}
|
|
|
83 |
|
|
|
84 |
|
|
|
85 |
function toIso($string) {
|
|
|
86 |
//return mb_convert_encoding($string, "ISO-8859-1");
|
|
|
87 |
return utf8_decode(utf8_encode($string));
|
|
|
88 |
}
|
|
|
89 |
|
|
|
90 |
$hash = '';
|
|
|
91 |
$key = '123456';
|
|
|
92 |
$key = $this->get_option('wpsg_mod_targo_hashkey');
|
|
|
93 |
//$param = "amount=5000&koop_id=testidkk89&dealerText=https%3A%2F%2Fwww.targobank.de&documentno=&".
|
|
|
94 |
// "dealerShopURL=&dealerAbortURL=&dealerID=123456&birthday=1970-12-31";
|
|
|
95 |
|
|
|
96 |
$arr = Array("koop_id" => $this->get_option('wpsg_mod_targo_koop_id'),
|
|
|
97 |
"SessionID" => session_id(),
|
|
|
98 |
"amount" => $brutto,
|
|
|
99 |
"dealerID" => $this->get_option('wpsg_mod_targo_dealerid'),
|
|
|
100 |
"dealerText" => ($this->view['targoLink']),
|
|
|
101 |
"documentno" => $this->view['o_id'],
|
|
|
102 |
"gender" => $isotitel,
|
|
|
103 |
"surname" => toIso($oCustomer->getName()),
|
|
|
104 |
"firstname" => toIso($oCustomer->getFirstname()),
|
|
|
105 |
"street" => toIso($oOrder->getInvoiceStreetClear(true)),
|
|
|
106 |
"streetnumber" => toIso($oOrder->getInvoiceStreetNr()),
|
|
|
107 |
"zip" => toIso($oCustomer->getZip()),
|
|
|
108 |
"city" => toIso($oCustomer->getCity()),
|
|
|
109 |
"telnocode" => '',
|
|
|
110 |
"telno" => toIso($oCustomer->getPhone()),
|
|
|
111 |
"birthday" => $bd,
|
|
|
112 |
"email" => toIso($oCustomer->getEMail()),
|
|
|
113 |
"dealerShopURL" => ($this->get_option('wpsg_mod_targo_dealerShopURL')),
|
|
|
114 |
"dealerAbortURL" => ($this->get_option('wpsg_mod_targo_dealerAbortURL'))
|
|
|
115 |
);
|
|
|
116 |
|
|
|
117 |
$param = http_build_query($arr);
|
|
|
118 |
|
|
|
119 |
|
|
|
120 |
$hash = hash_hmac( 'sha256', $param, $key); // HMAC-SHA256
|
|
|
121 |
|
|
|
122 |
// Test
|
|
|
123 |
//$hash = "85ef6ddce9bbebffa250d6f8183f3f727af5f9fda879b73aa0685eb2d9386e70";
|
|
|
124 |
|
|
|
125 |
?>
|
|
|
126 |
|
|
|
127 |
<br /><br />
|
|
|
128 |
<b>Obligatorische Daten für Targobank</b><br />
|
|
|
129 |
<input type="text" id="koop_id" name="koop_id" value="<?php echo $this->get_option('wpsg_mod_targo_koop_id');?>" placeholder="koop_id"><br />
|
|
|
130 |
<input type="text" id="SessionID" name="sessionID" value="<?php echo session_id();?>" placeholder="sessionID"><br />
|
|
|
131 |
<input type="text" id="amount" name="amount" value="<?php echo $brutto;?>" placeholder="amount"><br />
|
|
|
132 |
<input type="text" id="dealerID" name="dealerID" value="<?php echo $this->get_option('wpsg_mod_targo_dealerid');?>" placeholder="dealerID"><br />
|
|
|
133 |
<input type="text" id="dealerText" name="dealerText" value="<?php echo $this->view['targoLink'];?>" placeholder="dealerText"><br />
|
|
|
134 |
<input type="text" id="documentno" name="documentno" value="<?php echo $this->view['o_id'];?>" placeholder="documentno"><br />
|
|
|
135 |
|
|
|
136 |
|
|
|
137 |
|
|
|
138 |
|
|
|
139 |
<b>Adressdaten aus Kundendaten</b><br />
|
|
|
140 |
<input type="text" id="gender" name="gender" value="<?php echo $isotitel;?>" placeholder="titel"><br />
|
|
|
141 |
<input type="text" id="surname" name="surname" value="<?php echo toIso($oCustomer->getName());?>" placeholder="surname"><br />
|
|
|
142 |
<input type="text" id="firstname" name="firstname" value="<?php echo toIso($oCustomer->getFirstname());?>" placeholder="firstname"><br />
|
|
|
143 |
<input type="text" id="street" name="street" value="<?php echo toIso($oOrder->getInvoiceStreetClear(true));?>" placeholder="street"><br />
|
|
|
144 |
<input type="text" id="streetnumber" name="streetnumber" value="<?php echo toIso($oOrder->getInvoiceStreetNr());?>" placeholder="streetnumber"><br />
|
|
|
145 |
<input type="text" id="zip" name="zip" value="<?php echo toIso($oCustomer->getZip());?>" placeholder="zip"><br />
|
|
|
146 |
<input type="text" id="city" name="city" value="<?php echo toIso($oCustomer->getCity());?>" placeholder="city"><br />
|
|
|
147 |
<input type="text" id="telnocode" name="telnocode" value="" placeholder="vorwahl"><br />
|
|
|
148 |
<input type="text" id="telno" name="telno" value="<?php echo toIso($oCustomer->getPhone());?>" placeholder="telno"><br />
|
|
|
149 |
<input type="text" id="birthday" name="birthday" value="<?php echo $bd;?>" placeholder="birthday"><br />
|
|
|
150 |
<input type="text" id="email" name="email" value="<?php echo toIso($oCustomer->getEMail());?>" placeholder="email"><br />
|
|
|
151 |
|
|
|
152 |
<b>Optionale Daten für Targobank</b><br />
|
|
|
153 |
<input type="text" id="dealerShopURL" name="dealerShopURL" value="<?php echo $this->get_option('wpsg_mod_targo_dealerShopURL');?>" placeholder="dealerShopURL"><br />
|
|
|
154 |
<input type="text" id="dealerAbortURL" name="dealerAbortURL" value="<?php echo $this->get_option('wpsg_mod_targo_dealerAbortURL');?>" placeholder="dealerAbortURL"><br />
|
|
|
155 |
<input type="text" id="hash" name="hash" value="<?php echo $hash;?>" placeholder="hash">(hashkey)<br />
|
|
|
156 |
|
|
|
157 |
|
|
|
158 |
<input type="submit" id="submit" name="submit" value="submit" >
|
|
|
159 |
|
|
|
160 |
</div>
|
|
|
161 |
</form>
|
|
|
162 |
|
|
|
163 |
|
|
|
164 |
<?php if ($this->get_option('wpsg_mod_targo_autostart') == '1') { ?>
|
|
|
165 |
<script type="text/javascript">/* <![CDATA[ */
|
|
|
166 |
|
|
|
167 |
jQuery(document).ready(function() {
|
|
|
168 |
window.setTimeout(function() {
|
|
|
169 |
//location.href = "<?php echo $url;?>";
|
|
|
170 |
jQuery('#submit').trigger("click");
|
|
|
171 |
}, 1000);
|
|
|
172 |
} );
|
|
|
173 |
|
|
|
174 |
/* ]]> */</script>
|
5873 |
hartmut |
175 |
<?php } ?>
|