| 3 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/**
|
|
|
4 |
* @package php_share
|
|
|
5 |
* @author Webagentur Niewerth <tiefland@weban.de>
|
|
|
6 |
* @copyright 2011 Webagentur Niewerth
|
|
|
7 |
* @license propietary http://www.weban.de
|
|
|
8 |
* @version $Rev: 760 $
|
|
|
9 |
* @filesource
|
|
|
10 |
*
|
|
|
11 |
*/
|
|
|
12 |
|
|
|
13 |
/**
|
|
|
14 |
*
|
|
|
15 |
* @package php_share
|
|
|
16 |
* @author Webagentur Niewerth <tiefland@weban.de>
|
|
|
17 |
* @copyright 2011 Webagentur Niewerth
|
|
|
18 |
*/
|
|
|
19 |
|
|
|
20 |
// SVN: $Id: billsafe.php 760 2011-10-12 14:04:01Z tiefland $
|
|
|
21 |
|
|
|
22 |
require_once "creditcard.interface.php";
|
|
|
23 |
require_once "Billsfafe_HttpResponse.class.php";
|
|
|
24 |
require_once "Config.php";
|
|
|
25 |
|
|
|
26 |
class billsafe implements creditcard
|
|
|
27 |
{
|
|
|
28 |
protected $ini;
|
|
|
29 |
protected $version;
|
|
|
30 |
protected $date;
|
|
|
31 |
|
|
|
32 |
function __construct()
|
|
|
33 |
{
|
|
|
34 |
$this->date =
|
|
|
35 |
'$Date: 2011-10-12 16:04:01 +0200 (Wed, 12 Oct 2011) $';
|
|
|
36 |
$this->version = substr( $this->date, 7, 19 );
|
|
|
37 |
if ( !is_array( $_SESSION["INI"] ) )
|
|
|
38 |
{
|
|
|
39 |
$this->ini = $GLOBALS["INI"];
|
|
|
40 |
}
|
|
|
41 |
else
|
|
|
42 |
{
|
|
|
43 |
$this->ini = $_SESSION["INI"];
|
|
|
44 |
}
|
|
|
45 |
}
|
|
|
46 |
function getCreditcardStatus( $bestellId, $summe = null )
|
|
|
47 |
{
|
|
|
48 |
global $Userdata;
|
|
|
49 |
if ( is_null( $summe ) )
|
|
|
50 |
{
|
|
|
51 |
$summe = getBasketSumme();
|
|
|
52 |
}
|
|
|
53 |
//$summe = ( double )$summe;
|
|
|
54 |
$server = $this->ini["billsafe"]["server"];
|
|
|
55 |
try
|
|
|
56 |
{
|
|
|
57 |
$url = $server;
|
|
|
58 |
$params["merchant_id"] = $this->ini["billsafe"]["zugang"];
|
|
|
59 |
$params["merchant_license"] = $this->ini["billsafe"]["secret"];
|
|
|
60 |
$params["application_signature"] = $this->ini["billsafe"]["signature"];
|
|
|
61 |
$params["application_version"] = $this->version;
|
|
|
62 |
$params["method"] = $this->ini["billsafe"]["method"];
|
|
|
63 |
$params["format"] = $this->ini["billsafe"]["format"];
|
|
|
64 |
$params["order_number"] = $bestellId;
|
|
|
65 |
$params["order_amount"] = $summe;
|
|
|
66 |
$params["order_taxAmount"] = round( getBasketSummeMwSt(), 2 );
|
|
|
67 |
$params["order_currencyCode"] = "EUR";
|
|
|
68 |
//$params["customer_id"] = $Userdata["ID"];
|
|
|
69 |
$params["customer_gender"] = ( $_SESSION["SHOP"]["buy"]["Persdata"]["Anrede"] ==
|
|
|
70 |
"Frau" ) ? "f" : "m";
|
|
|
71 |
$params["customer_firstname"] = $_SESSION["SHOP"]["buy"]["Persdata"]["Vorname"];
|
|
|
72 |
$params["customer_lastname"] = $_SESSION["SHOP"]["buy"]["Persdata"]["Nachname"];
|
|
|
73 |
$params["customer_street"] = $_SESSION["SHOP"]["buy"]["Persdata"]["Strasse"];
|
|
|
74 |
$params["customer_houseNumber"] = $_SESSION["SHOP"]["buy"]["Persdata"]["Hausnummer"];
|
|
|
75 |
$params["customer_postcode"] = $_SESSION["SHOP"]["buy"]["Persdata"]["PLZ"];
|
|
|
76 |
$params["customer_city"] = $_SESSION["SHOP"]["buy"]["Persdata"]["Ort"];
|
|
|
77 |
$params["customer_country"] = "DE";
|
|
|
78 |
$params["customer_email"] = $_SESSION["SHOP"]["buy"]["Persdata"]["email"];
|
|
|
79 |
$params["customer_phone"] = $_SESSION["SHOP"]["buy"]["Persdata"]["Telefon"];
|
|
|
80 |
$items = getBasketItems();
|
|
|
81 |
foreach ( $items as $item_id => $item )
|
|
|
82 |
{
|
|
|
83 |
$params["articleList_" . $item_id . "_number"] = $item["ID"];
|
|
|
84 |
$params["articleList_" . $item_id . "_name"] = $item["kurzbezeichnung"];
|
|
|
85 |
//$params["articleList_" . $item_id . "_description"] = $item["beschreibung"];
|
|
|
86 |
$params["articleList_" . $item_id . "_quantity"] = $item["Menge"];
|
|
|
87 |
if ( $this->ini["netto_preise"] == 1 )
|
|
|
88 |
{
|
|
|
89 |
$params["articleList_" . $item_id . "_netPrice"] = $item["preis"];
|
|
|
90 |
}
|
|
|
91 |
else
|
|
|
92 |
{
|
|
|
93 |
$params["articleList_" . $item_id . "_grossPrice"] =
|
|
|
94 |
$item["preis"];
|
|
|
95 |
}
|
|
|
96 |
$params["articleList_" . $item_id . "_tax"] = 19;
|
|
|
97 |
$params["articleList_" . $item_id . "_type"] = ( $item["Father"] ==
|
|
|
98 |
-3 ) ? "shipment" : "goods";
|
|
|
99 |
if ( is_numeric( $item["preis2"] ) && $item["preis2"] >
|
|
|
100 |
|
|
|
101 |
{
|
|
|
102 |
$item_id++;
|
|
|
103 |
$name = ( getAufschlag() < 0 ) ?
|
|
|
104 |
"Zahlungssystemaufschlagrabatt" :
|
|
|
105 |
"Zahlungssystemaufschlag";
|
|
|
106 |
$name .= " (" . getProzent() . "%)";
|
|
|
107 |
$params["articleList_" . $item_id . "_number"] =
|
|
|
108 |
999999;
|
|
|
109 |
$params["articleList_" . $item_id . "_name"] = $name;
|
|
|
110 |
//$params["articleList_" . $item_id . "_description"] = $item["beschreibung"];
|
|
|
111 |
$params["articleList_" . $item_id . "_quantity"] = 1;
|
|
|
112 |
if ( $this->ini["netto_preise"] == 1 )
|
|
|
113 |
{
|
|
|
114 |
$params["articleList_" . $item_id . "_netPrice"] =
|
|
|
115 |
getAufschlag();
|
|
|
116 |
}
|
|
|
117 |
else
|
|
|
118 |
{
|
|
|
119 |
$params["articleList_" . $item_id .
|
|
|
120 |
"_grossPrice"] = getAufschlag();
|
|
|
121 |
}
|
|
|
122 |
$params["articleList_" . $item_id . "_tax"] = 19;
|
|
|
123 |
$params["articleList_" . $item_id . "_type"] =
|
|
|
124 |
"handling";
|
|
|
125 |
}
|
|
|
126 |
}
|
|
|
127 |
$b_url = $this->ini["absoluteURL"];
|
|
|
128 |
$b_url = ( $this->ini["ssl_buy"] ) ? str_replace( "http://",
|
|
|
129 |
"https://", $b_url ) : $b_url;
|
|
|
130 |
$params["url_return"] = $b_url . "/billsafe_accept_" . $bestellId .
|
|
|
131 |
".html";
|
|
|
132 |
$params["url_cancel"] = $b_url . "/billsafe_cancel_" . $bestellId .
|
|
|
133 |
".html";
|
|
|
134 |
$params["product"] = "invoice";
|
|
|
135 |
|
|
|
136 |
foreach ( $params as $key => $val )
|
|
|
137 |
{
|
|
|
138 |
$param_arr[] = urlencode( utf8_encode( $key ) ) . "=" .
|
|
|
139 |
urlencode( utf8_encode( $val ) );
|
|
|
140 |
}
|
|
|
141 |
$params = "" . implode( "&", $param_arr );
|
|
|
142 |
//echo $params;
|
|
|
143 |
$p_url = parse_url( $url );
|
|
|
144 |
$header[] = 'POST ' . $p_url["path"] . ' HTTP/1.1';
|
|
|
145 |
$header[] = 'Host: ' . $p_url["host"];
|
|
|
146 |
$header[] = 'Content-Type: text/plain';
|
|
|
147 |
$header[] = 'Content-Length: ' . strlen( $params );
|
|
|
148 |
$header[] = 'Accept-Encoding: identity'; //no compression yet
|
|
|
149 |
$auth = $this->ini["billsafe"]["user"] . ':' . $this->ini["billsafe"]["password"];
|
|
|
150 |
$header[] = 'Authorization: Basic ' . base64_encode( $auth );
|
|
|
151 |
$header[] = 'Connection: close';
|
|
|
152 |
|
|
|
153 |
$header = utf8_encode( implode( "\r\n", $header ) );
|
|
|
154 |
|
|
|
155 |
$fp = fsockopen( "ssl://" . $p_url["host"], 443, $error_nr,
|
|
|
156 |
$error_msg );
|
|
|
157 |
|
|
|
158 |
if ( $fp )
|
|
|
159 |
{
|
|
|
160 |
if ( fwrite( $fp, $header . "\r\n\r\n" . $params ) )
|
|
|
161 |
{
|
|
|
162 |
while ( !feof( $fp ) )
|
|
|
163 |
{
|
|
|
164 |
$rawResponse .= fgets( $fp, 4096 );
|
|
|
165 |
}
|
|
|
166 |
|
|
|
167 |
}
|
|
|
168 |
}
|
|
|
169 |
$response["full"] = $this->_parseResponse( $rawResponse );
|
|
|
170 |
$cfg = new Config();
|
|
|
171 |
$cfg_out = $cfg->parseConfig( $response["full"]->body, "XML",
|
|
|
172 |
array( "isFile" => false ) );
|
|
|
173 |
$xml = $cfg_out->toArray();
|
|
|
174 |
$response["parsed"] = $xml["root"]["response"];
|
|
|
175 |
|
|
|
176 |
if ( $response["parsed"]["ack"] == "OK" )
|
|
|
177 |
{
|
|
|
178 |
$ret = "
|
|
|
179 |
<form name='rechnung' action='" . $this->ini["billsafe"]["gateway"] .
|
|
|
180 |
"' id='zahlung'>
|
|
|
181 |
<input type='hidden' name='token' value='" . $response["parsed"]["token"] .
|
|
|
182 |
"'>
|
|
|
183 |
<input type='submit' value='per Rechnung bezahlen'>
|
|
|
184 |
</form>
|
|
|
185 |
<script type=\"text/javascript\">
|
|
|
186 |
zahlungsubmit();
|
|
|
187 |
</script>
|
|
|
188 |
";
|
|
|
189 |
}
|
|
|
190 |
else
|
|
|
191 |
{
|
|
|
192 |
admin_debug( $response["parsed"] );
|
|
|
193 |
if ( $this->ini["change_order"] )
|
|
|
194 |
{
|
|
|
195 |
$_SESSION["zahlarten"]["billsafe"] = false;
|
|
|
196 |
$ret["error"] = true;
|
|
|
197 |
$ret = $this->_getMsg( $ret, "init_fehler", $bestellId );
|
|
|
198 |
}
|
|
|
199 |
}
|
|
|
200 |
fclose( $fp );
|
|
|
201 |
return $ret;
|
|
|
202 |
}
|
|
|
203 |
catch ( exception $e )
|
|
|
204 |
{
|
|
|
205 |
admin_debug( $e );
|
|
|
206 |
$_SESSION["zahlarten"]["billsafe"] = false;
|
|
|
207 |
$ret["error"] = true;
|
|
|
208 |
$ret = $this->_getMsg( $ret, "init_fehler", $bestellId );
|
|
|
209 |
}
|
|
|
210 |
}
|
|
|
211 |
function getCreditcardReturnStatus( $bestellId )
|
|
|
212 |
{
|
|
|
213 |
$server = $this->ini["billsafe"]["server"];
|
|
|
214 |
try
|
|
|
215 |
{
|
|
|
216 |
$table = ( $this->ini["dbConnect"]["order_db"] ) ? $this->
|
|
|
217 |
ini["dbConnect"]["order_db"] . "." : "";
|
|
|
218 |
$table .= "Bestellung";
|
|
|
219 |
$query = "SELECT
|
|
|
220 |
Bemerkung
|
|
|
221 |
FROM
|
|
|
222 |
$table
|
|
|
223 |
WHERE
|
|
|
224 |
id=$bestellId
|
|
|
225 |
";
|
|
|
226 |
$res = mysql_query( $query, $GLOBALS["order_dbh"] );
|
|
|
227 |
$row = mysql_fetch_assoc( $res );
|
|
|
228 |
$bemerkung = $row["Bemerkung"];
|
|
|
229 |
if ( $_GET["action"] == "accept" )
|
|
|
230 |
{
|
|
|
231 |
$params["merchant_id"] = $this->ini["billsafe"]["zugang"];
|
|
|
232 |
$params["merchant_license"] = $this->ini["billsafe"]["secret"];
|
|
|
233 |
$params["application_signature"] = $this->ini["billsafe"]["signature"];
|
|
|
234 |
$params["application_version"] = $this->version;
|
|
|
235 |
$params["method"] = "getTransactionResult";
|
|
|
236 |
$params["token"] = $_GET["token"];
|
|
|
237 |
$params["format"] = $this->ini["billsafe"]["format"];
|
|
|
238 |
foreach ( $params as $key => $val )
|
|
|
239 |
{
|
|
|
240 |
$param_arr[] = urlencode( utf8_encode( $key ) ) .
|
|
|
241 |
"=" . urlencode( utf8_encode( $val ) );
|
|
|
242 |
}
|
|
|
243 |
$params = "" . implode( "&", $param_arr );
|
|
|
244 |
//var_dump($params);
|
|
|
245 |
$p_url = parse_url( $server );
|
|
|
246 |
|
|
|
247 |
$header[] = 'POST ' . $p_url["path"] . ' HTTP/1.1';
|
|
|
248 |
$header[] = 'Host: ' . $p_url["host"];
|
|
|
249 |
$header[] = 'Content-Type: text/plain';
|
|
|
250 |
$header[] = 'Content-Length: ' . strlen( $params );
|
|
|
251 |
$header[] = 'Accept-Encoding: identity'; //no compression yet
|
|
|
252 |
$auth = $this->ini["billsafe"]["user"] . ':' . $this->
|
|
|
253 |
ini["billsafe"]["password"];
|
|
|
254 |
$header[] = 'Authorization: Basic ' . base64_encode( $auth );
|
|
|
255 |
$header[] = 'Connection: close';
|
|
|
256 |
|
|
|
257 |
$header = utf8_encode( implode( "\r\n", $header ) );
|
|
|
258 |
|
|
|
259 |
$fp = fsockopen( "ssl://" . $p_url["host"], 443, $error_nr,
|
|
|
260 |
$error_msg );
|
|
|
261 |
|
|
|
262 |
if ( $fp )
|
|
|
263 |
{
|
|
|
264 |
if ( fwrite( $fp, $header . "\r\n\r\n" . $params ) )
|
|
|
265 |
{
|
|
|
266 |
while ( !feof( $fp ) )
|
|
|
267 |
{
|
|
|
268 |
$rawResponse .= fgets( $fp, 4096 );
|
|
|
269 |
}
|
|
|
270 |
|
|
|
271 |
}
|
|
|
272 |
}
|
|
|
273 |
$response["full"] = $this->_parseResponse( $rawResponse );
|
|
|
274 |
$cfg = new Config();
|
|
|
275 |
$cfg_out = $cfg->parseConfig( $response["full"]->body,
|
|
|
276 |
"XML", array( "isFile" => false ) );
|
|
|
277 |
$xml = $cfg_out->toArray();
|
|
|
278 |
$response["parsed"] = $xml["root"]["response"];
|
|
|
279 |
if ( $response["parsed"]["ack"] == "OK" )
|
|
|
280 |
{
|
|
|
281 |
switch ( $response["parsed"]["status"] )
|
|
|
282 |
{
|
|
|
283 |
case "ACCEPTED":
|
|
|
284 |
$res = true;
|
|
|
285 |
$kk_info["code"] = $response["parsed"]["transactionId"];
|
|
|
286 |
$kk_info["anbieter"] = "billsafe";
|
|
|
287 |
$kk_info["status"] = "offen";
|
|
|
288 |
$bemerkung .=
|
|
|
289 |
"Die Zahlung wurde von BillSAFE am " .
|
|
|
290 |
date( "d.m.Y" ) . " um " . date( "H:i" ) .
|
|
|
291 |
" Uhr genehmigt!\nTransaktionsnummer: " .
|
|
|
292 |
$kk_info["code"] . "\n";
|
|
|
293 |
if ( USE_TRANSLATION2 === true )
|
|
|
294 |
{
|
|
|
295 |
$msg = $GLOBALS["langstrings"]["buy"]["billsafe_accepted"];
|
|
|
296 |
} elseif ( $_SESSION["languageException"] )
|
|
|
297 |
{
|
|
|
298 |
$msg = "Thanks for your purchase at " .
|
|
|
299 |
__SHOP__ . "!";
|
|
|
300 |
}
|
|
|
301 |
else
|
|
|
302 |
{
|
|
|
303 |
$msg =
|
|
|
304 |
"Vielen Dank für Ihren Einkauf bei " .
|
|
|
305 |
__SHOP__ . "!";
|
|
|
306 |
}
|
|
|
307 |
$sql_u_ab = "
|
|
|
308 |
UPDATE
|
|
|
309 |
artikel_to_Bestellung AS ab
|
|
|
310 |
SET
|
|
|
311 |
rechnungStatus='schreiben'
|
|
|
312 |
WHERE
|
|
|
313 |
Bestellung=$bestellId
|
|
|
314 |
AND
|
|
|
315 |
artikel IN (SELECT ID FROM artikel WHERE ID=ab.artikel AND Father !=-3)
|
|
|
316 |
";
|
|
|
317 |
mysql_query( $sql_u_ab, $GLOBALS["order_dbh"] );
|
|
|
318 |
break;
|
|
|
319 |
case "DECLINED":
|
|
|
320 |
$kk_info["code"] = $response["parsed"]["declineReason"]["code"];
|
|
|
321 |
$kk_info["status"] = "abgelehnt";
|
|
|
322 |
$_SESSION["zahlarten"]["billsafe"] = false;
|
|
|
323 |
$kk_info["anbieter"] = "billsafe";
|
|
|
324 |
$bemerkung .=
|
|
|
325 |
"Die Zahlung wurde von Billsafe am " .
|
|
|
326 |
date( "d.m.Y" ) . " um " . date( "H:i" ) .
|
|
|
327 |
" Uhr abgelehnt!\nGrund: " . $response["parsed"]["declineReason"]["message"] .
|
|
|
328 |
"\n";
|
|
|
329 |
$res = false;
|
|
|
330 |
break;
|
|
|
331 |
}
|
|
|
332 |
fclose( $fp );
|
|
|
333 |
}
|
|
|
334 |
else
|
|
|
335 |
{
|
|
|
336 |
admin_debug( $response["parsed"] );
|
|
|
337 |
$res = false;
|
|
|
338 |
$msg = "Ein Fehler ist aufgetreten! ";
|
|
|
339 |
}
|
|
|
340 |
} elseif ( $_GET["action"] == "cancel" )
|
|
|
341 |
{
|
|
|
342 |
$bemerkung .=
|
|
|
343 |
"Die Zahlung per billsafe wurde vom Kunden am " .
|
|
|
344 |
date( "d.m.Y" ) . " um " . date( "H:i" ) .
|
|
|
345 |
" Uhr abgebrochen!\n";
|
|
|
346 |
$kk_info["code"] = "";
|
|
|
347 |
$kk_info["status"] = "abgebrochen";
|
|
|
348 |
$res = false;
|
|
|
349 |
}
|
|
|
350 |
if ( is_array( $kk_info ) )
|
|
|
351 |
{
|
|
|
352 |
$kk_info_str = serialize( $kk_info );
|
|
|
353 |
}
|
|
|
354 |
$query = "
|
|
|
355 |
UPDATE
|
|
|
356 |
$table
|
|
|
357 |
SET
|
|
|
358 |
";
|
|
|
359 |
if ( $kk_info_str )
|
|
|
360 |
{
|
|
|
361 |
$query .= "
|
|
|
362 |
kk_info='$kk_info_str',
|
|
|
363 |
";
|
|
|
364 |
}
|
|
|
365 |
$query .= "
|
|
|
366 |
Bemerkung='$bemerkung'
|
|
|
367 |
WHERE
|
|
|
368 |
id=$bestellId
|
|
|
369 |
";
|
|
|
370 |
mysql_query( $query, $GLOBALS["order_dbh"] );
|
|
|
371 |
$ret = array( "error" => !$res );
|
|
|
372 |
if ( $ret["error"] )
|
|
|
373 |
{
|
|
|
374 |
$msg .= $this->_getMsg( $ret, $kk_info["status"], $bestellId );
|
|
|
375 |
}
|
|
|
376 |
$ret["meld"] = $msg;
|
|
|
377 |
return $ret;
|
|
|
378 |
}
|
|
|
379 |
catch ( exception $e )
|
|
|
380 |
{
|
|
|
381 |
admin_debug( $e );
|
|
|
382 |
}
|
|
|
383 |
}
|
|
|
384 |
function genCheckSum( $src )
|
|
|
385 |
{
|
|
|
386 |
switch ( $this->ini["kreditkarte"]["sha_algo"] )
|
|
|
387 |
{
|
|
|
388 |
case "sha512":
|
|
|
389 |
$data = hash( "sha512", $src );
|
|
|
390 |
break;
|
|
|
391 |
case "sha256":
|
|
|
392 |
$data = hash( "sha256", $src );
|
|
|
393 |
break;
|
|
|
394 |
case "sha1":
|
|
|
395 |
default:
|
|
|
396 |
$data = sha1( $src );
|
|
|
397 |
break;
|
|
|
398 |
}
|
|
|
399 |
return $data;
|
|
|
400 |
}
|
|
|
401 |
private function _parseResponse( $responceString )
|
|
|
402 |
{
|
|
|
403 |
if ( empty( $responceString ) )
|
|
|
404 |
{
|
|
|
405 |
throw new Exception( 'invalid response' );
|
|
|
406 |
}
|
|
|
407 |
|
|
|
408 |
$separator = "\r\n\r\n";
|
|
|
409 |
$separatorLength = strlen( $separator );
|
|
|
410 |
|
|
|
411 |
$headerEndPosition = strpos( $responceString, "\r\n\r\n" );
|
|
|
412 |
|
|
|
413 |
if ( $headerEndPosition === false )
|
|
|
414 |
{
|
|
|
415 |
throw new Exception( 'invalid response' );
|
|
|
416 |
}
|
|
|
417 |
|
|
|
418 |
$header = substr( $responceString, 0, $headerEndPosition );
|
|
|
419 |
//$this->_verbose( "[response header] \r\n" . $header );
|
|
|
420 |
|
|
|
421 |
$body = substr( $responceString, $headerEndPosition + $separatorLength );
|
|
|
422 |
|
|
|
423 |
$response = new Billsafe_HttpResponse();
|
|
|
424 |
|
|
|
425 |
if ( preg_match( '#http/\d.\d (\d+) (.*)#i', $header, $match ) )
|
|
|
426 |
{
|
|
|
427 |
$response->statusCode = trim( $match[1] );
|
|
|
428 |
$response->statusText = trim( $match[2] );
|
|
|
429 |
}
|
|
|
430 |
|
|
|
431 |
if ( preg_match( '#Content-Type: (.*)#i', $header, $match ) )
|
|
|
432 |
{
|
|
|
433 |
$response->contentType = trim( $match[1] );
|
|
|
434 |
}
|
|
|
435 |
|
|
|
436 |
if ( preg_match( '#Content-Length: (.*)#i', $header, $match ) )
|
|
|
437 |
{
|
|
|
438 |
$response->contentLength = ( int )trim( $match[1] );
|
|
|
439 |
}
|
|
|
440 |
|
|
|
441 |
if ( preg_match( '#Transfer-Encoding: chunked#i', $header, $match ) )
|
|
|
442 |
{
|
|
|
443 |
$response->body = $this->_joinChunks( $body );
|
|
|
444 |
$response->contentLength = strlen( $response->body );
|
|
|
445 |
}
|
|
|
446 |
else
|
|
|
447 |
{
|
|
|
448 |
$response->body = trim( $body );
|
|
|
449 |
}
|
|
|
450 |
|
|
|
451 |
//$this->_verbose( "[response body] \r\n" . $response->body );
|
|
|
452 |
|
|
|
453 |
return $response;
|
|
|
454 |
}
|
|
|
455 |
private function _getMsg( $ret, $status, $bestellId )
|
|
|
456 |
{
|
|
|
457 |
if ( USE_TRANSLATION2 === true )
|
|
|
458 |
{
|
|
|
459 |
if ( $this->ini["change_order"] )
|
|
|
460 |
{
|
|
|
461 |
$abschluss = $GLOBALS["langstrings"]["buy"]["click_button"];
|
|
|
462 |
}
|
|
|
463 |
else
|
|
|
464 |
{
|
|
|
465 |
$abschluss = $GLOBALS["langstrings"]["buy"]["cancel_order"];
|
|
|
466 |
}
|
|
|
467 |
} elseif ( $_SESSION["languageException"] )
|
|
|
468 |
{
|
|
|
469 |
if ( $this->ini["change_order"] )
|
|
|
470 |
{
|
|
|
471 |
$abschluss =
|
|
|
472 |
"Click on the button to choose an other payment method.";
|
|
|
473 |
}
|
|
|
474 |
else
|
|
|
475 |
{
|
|
|
476 |
$abschluss = "Therefore we will now cancel your order.";
|
|
|
477 |
}
|
|
|
478 |
}
|
|
|
479 |
else
|
|
|
480 |
{
|
|
|
481 |
if ( $this->ini["change_order"] )
|
|
|
482 |
{
|
|
|
483 |
$abschluss =
|
|
|
484 |
"Klicken Sie auf den Button, um eine andere Zahlweise auszuwählen.";
|
|
|
485 |
}
|
|
|
486 |
else
|
|
|
487 |
{
|
|
|
488 |
$abschluss =
|
|
|
489 |
"Deshalb werden wir nun Ihre Bestellung nun stornieren.";
|
|
|
490 |
}
|
|
|
491 |
}
|
|
|
492 |
switch ( $status )
|
|
|
493 |
{
|
|
|
494 |
case "init_fehler":
|
|
|
495 |
if ( USE_TRANSLATION2 === true )
|
|
|
496 |
{
|
|
|
497 |
$msg = $GLOBALS["langstrings"]["buy"]["billsafe_not_avail"];
|
|
|
498 |
} elseif ( $_SESSION["languageException"] )
|
|
|
499 |
{
|
|
|
500 |
$msg =
|
|
|
501 |
"Unfourtunately Billsafe is not available at the moment. ";
|
|
|
502 |
}
|
|
|
503 |
else
|
|
|
504 |
{
|
|
|
505 |
$msg =
|
|
|
506 |
"Leider steht Billsafe zur Zeit nicht zur Verfügung. ";
|
|
|
507 |
}
|
|
|
508 |
break;
|
|
|
509 |
case "abgebrochen":
|
|
|
510 |
if ( USE_TRANSLATION2 === true )
|
|
|
511 |
{
|
|
|
512 |
$msg = $GLOBALS["langstrings"]["buy"]["order_canceled"];
|
|
|
513 |
} elseif ( $_SESSION["languageException"] )
|
|
|
514 |
{
|
|
|
515 |
$msg = "You have canceled the payment. ";
|
|
|
516 |
}
|
|
|
517 |
else
|
|
|
518 |
{
|
|
|
519 |
$msg = "Sie haben die Zahlung abgebrochen. ";
|
|
|
520 |
}
|
|
|
521 |
break;
|
|
|
522 |
case "abgelehnt":
|
|
|
523 |
if ( USE_TRANSLATION2 === true )
|
|
|
524 |
{
|
|
|
525 |
$msg = $GLOBALS["langstrings"]["buy"]["billsafe_declined"];
|
|
|
526 |
} elseif ( $_SESSION["languageException"] )
|
|
|
527 |
{
|
|
|
528 |
$msg =
|
|
|
529 |
"Unfortunately the payment over BILLSAFE is not possible. ";
|
|
|
530 |
}
|
|
|
531 |
else
|
|
|
532 |
{
|
|
|
533 |
$msg =
|
|
|
534 |
"Leider ist der Rechungskauf mit BillSAFE nicht möglich. ";
|
|
|
535 |
}
|
|
|
536 |
break;
|
|
|
537 |
}
|
|
|
538 |
$msg .= $abschluss;
|
|
|
539 |
if ( $this->ini["change_order"] )
|
|
|
540 |
{
|
|
|
541 |
$msg .= '
|
|
|
542 |
<form method="post" action="/">
|
|
|
543 |
<input type="hidden" name="best_id" value="' . $bestellId .
|
|
|
544 |
'">
|
|
|
545 |
<input type="hidden" name="email" value="' . $_SESSION["SHOP"]["buy"]["Persdata"]["email"] .
|
|
|
546 |
'">
|
|
|
547 |
<input type="hidden" name="mode" value="change_order">
|
|
|
548 |
<input type="submit" value="Zahlart / Bestellung ändern">
|
|
|
549 |
</form>
|
|
|
550 |
';
|
|
|
551 |
}
|
|
|
552 |
return $msg;
|
|
|
553 |
}
|
|
|
554 |
}
|
|
|
555 |
?>
|