| 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: 736 $
|
|
|
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: santander.php 736 2011-09-26 12:58:19Z tiefland $
|
|
|
21 |
|
|
|
22 |
require_once "creditcard.interface.php";
|
|
|
23 |
|
|
|
24 |
class santander implements creditcard
|
|
|
25 |
{
|
|
|
26 |
protected $ini;
|
|
|
27 |
|
|
|
28 |
function __construct()
|
|
|
29 |
{
|
|
|
30 |
if ( !is_array( $_SESSION["INI"] ) )
|
|
|
31 |
{
|
|
|
32 |
$this->ini = $GLOBALS["INI"];
|
|
|
33 |
}
|
|
|
34 |
else
|
|
|
35 |
{
|
|
|
36 |
$this->ini = $_SESSION["INI"];
|
|
|
37 |
}
|
|
|
38 |
}
|
|
|
39 |
function getCreditcardStatus( $bestellId, $summe = null )
|
|
|
40 |
{
|
|
|
41 |
if ( is_null( $summe ) )
|
|
|
42 |
{
|
|
|
43 |
$summe = getBasketSummeBrutto();
|
|
|
44 |
}
|
|
|
45 |
$summe = round( $summe, 2 );
|
|
|
46 |
$benutzer = $this->ini["finanzierung"]["zugang"];
|
|
|
47 |
$passwort = $this->ini["finanzierung"]["passwort"];
|
|
|
48 |
$bestellId = $bestellId;
|
|
|
49 |
if ( Eigenschaft( 13 ) )
|
|
|
50 |
{
|
|
|
51 |
$benutzer = $this->ini["finanzierung"]["zugang2"];
|
|
|
52 |
$passwort = $this->ini["finanzierung"]["passwort2"];
|
|
|
53 |
}
|
|
|
54 |
$server = $this->ini["finanzierung"]["server"];
|
|
|
55 |
$leasingId = $this->ini["finanzierung"]["prefix"] . $bestellId;
|
|
|
56 |
$anrede = utf8_encode( $_SESSION["SHOP"]["buy"]["Persdata"]["Anrede"] );
|
|
|
57 |
$vorname = utf8_encode( $_SESSION["SHOP"]["buy"]["Persdata"]["Vorname"] );
|
|
|
58 |
$nachname = utf8_encode( $_SESSION["SHOP"]["buy"]["Persdata"]["Nachname"] );
|
|
|
59 |
$email = utf8_encode( $_SESSION["SHOP"]["buy"]["Persdata"]["email"] );
|
|
|
60 |
$strasse = utf8_encode( $_SESSION["SHOP"]["buy"]["Persdata"]["Strasse"] .
|
|
|
61 |
" " . $_SESSION["SHOP"]["buy"]["Persdata"]["Hausnummer"] );
|
|
|
62 |
$ort = utf8_encode( $_SESSION["SHOP"]["buy"]["Persdata"]["Ort"] );
|
|
|
63 |
$plz = utf8_encode( $_SESSION["SHOP"]["buy"]["Persdata"]["PLZ"] );
|
|
|
64 |
$tel = str_replace( " ", "", $_SESSION["SHOP"]["buy"]["Persdata"]["Telefon"] );
|
|
|
65 |
$telefon = utf8_encode( $tel );
|
|
|
66 |
$birthday = $_SESSION["SHOP"]["buy"]["Persdata"]["birthday"];
|
|
|
67 |
$summe_str = sprintf( "%.02f", $summe );
|
|
|
68 |
$land = "Deutschland";
|
|
|
69 |
$options = array( "trace" => 1, "exceptions" => true );
|
|
|
70 |
try
|
|
|
71 |
{
|
|
|
72 |
$url = "https://" . $server .
|
|
|
73 |
"/webquick/services/FinanceService?wsdl";
|
|
|
74 |
$soap = new SoapClient( $url, $options );
|
|
|
75 |
$erg = $soap->storeFinanceData2( $bestellId, $leasingId, $benutzer,
|
|
|
76 |
$passwort, $summe, $anrede, $vorname, $nachname, $email,
|
|
|
77 |
$strasse, $ort, $plz, $land, $telefon, $birthday );
|
|
|
78 |
if ( $erg == 0 )
|
|
|
79 |
{
|
|
|
80 |
$out = "
|
|
|
81 |
<form action=\"https://$server/webquick/deutsch/startWebfinanz.jsp\" method=\"get\" name=\"finanzierung\" id='zahlung'>
|
|
|
82 |
<input type=\"hidden\" name=\"leasID\" value=\"" .
|
|
|
83 |
$leasingId . "\">
|
|
|
84 |
<input type=\"hidden\" name=\"haendlernr\" value=\"" .
|
|
|
85 |
$benutzer . "\">
|
|
|
86 |
<input type=\"hidden\" name=\"ordernr\" value=\"" .
|
|
|
87 |
$bestellId . "\">
|
|
|
88 |
<input type=\"submit\" value=\"finanzieren\">
|
|
|
89 |
</form>
|
|
|
90 |
";
|
|
|
91 |
}
|
|
|
92 |
else
|
|
|
93 |
{
|
|
|
94 |
if ( $this->ini["change_order"] )
|
|
|
95 |
{
|
|
|
96 |
$_SESSION["zahlarten"]["finanzierung"] = false;
|
|
|
97 |
$ret["error"] = true;
|
|
|
98 |
$out = $this->_getMsg( $ret, "init_fehler", $bestellId );
|
|
|
99 |
}
|
|
|
100 |
admin_debug( $soap->__getLastRequest() );
|
|
|
101 |
admin_debug( $soap->__getLastResponse() );
|
|
|
102 |
admin_debug( $url );
|
|
|
103 |
admin_debug( $erg );
|
|
|
104 |
admin_debug( $bestellId );
|
|
|
105 |
admin_debug( $leasingId );
|
|
|
106 |
admin_debug( $benutzer );
|
|
|
107 |
admin_debug( $passwort );
|
|
|
108 |
admin_debug( $summe );
|
|
|
109 |
admin_debug( $anrede );
|
|
|
110 |
admin_debug( $vorname );
|
|
|
111 |
admin_debug( $nachname );
|
|
|
112 |
admin_debug( $email );
|
|
|
113 |
admin_debug( $strasse );
|
|
|
114 |
admin_debug( $ort );
|
|
|
115 |
admin_debug( $plz );
|
|
|
116 |
admin_debug( $land );
|
|
|
117 |
admin_debug( $telefon );
|
|
|
118 |
admin_debug( $birthday );
|
|
|
119 |
}
|
|
|
120 |
}
|
|
|
121 |
catch ( exception $e )
|
|
|
122 |
{
|
|
|
123 |
if ( $this->ini["change_order"] )
|
|
|
124 |
{
|
|
|
125 |
$_SESSION["zahlarten"]["finanzierung"] = false;
|
|
|
126 |
$ret["error"] = true;
|
|
|
127 |
$out = $this->_getMsg( $ret, "init_fehler", $bestellId );
|
|
|
128 |
}
|
|
|
129 |
admin_debug( $soap->__getLastRequest() );
|
|
|
130 |
admin_debug( $soap->__getLastResponse() );
|
|
|
131 |
admin_debug( $url );
|
|
|
132 |
admin_debug( $erg );
|
|
|
133 |
admin_debug( $bestellId );
|
|
|
134 |
admin_debug( $leasingId );
|
|
|
135 |
admin_debug( $benutzer );
|
|
|
136 |
admin_debug( $passwort );
|
|
|
137 |
admin_debug( $summe_str );
|
|
|
138 |
admin_debug( $anrede );
|
|
|
139 |
admin_debug( $vorname );
|
|
|
140 |
admin_debug( $nachname );
|
|
|
141 |
admin_debug( $email );
|
|
|
142 |
admin_debug( $strasse );
|
|
|
143 |
admin_debug( $ort );
|
|
|
144 |
admin_debug( $plz );
|
|
|
145 |
admin_debug( $telefon );
|
|
|
146 |
admin_debug( $birthday );
|
|
|
147 |
admin_debug( $e );
|
|
|
148 |
}
|
|
|
149 |
return $out;
|
|
|
150 |
}
|
|
|
151 |
function getCreditcardReturnStatus( $bestellId )
|
|
|
152 |
{
|
|
|
153 |
$server = $this->ini["finanzierung"]["server"];
|
|
|
154 |
$leasingId = $this->ini["finanzierung"]["prefix"] . $bestellId;
|
|
|
155 |
$url = "https://" . $server .
|
|
|
156 |
"/webquick/services/FinanceService?wsdl";
|
|
|
157 |
$soap = new SoapClient( $url );
|
|
|
158 |
$erg = $soap->__soapCall( "getStatus2", array( "orderid" => $leasingId,
|
|
|
159 |
"leasingid" => $bestellId, "vendornumber" => $this->ini["finanzierung"]["zugang"],
|
|
|
160 |
"password" => $this->ini["finanzierung"]["passwort"] ) );
|
|
|
161 |
return var_export( $erg, true );
|
|
|
162 |
}
|
|
|
163 |
function genCheckSum( $src )
|
|
|
164 |
{
|
|
|
165 |
switch ( $this->ini["kreditkarte"]["sha_algo"] )
|
|
|
166 |
{
|
|
|
167 |
case "sha512":
|
|
|
168 |
$data = hash( "sha512", $src );
|
|
|
169 |
break;
|
|
|
170 |
case "sha256":
|
|
|
171 |
$data = hash( "sha256", $src );
|
|
|
172 |
break;
|
|
|
173 |
case "sha1":
|
|
|
174 |
default:
|
|
|
175 |
$data = sha1( $src );
|
|
|
176 |
break;
|
|
|
177 |
}
|
|
|
178 |
return $data;
|
|
|
179 |
}
|
|
|
180 |
private function _getMsg( $ret, $status, $bestellId )
|
|
|
181 |
{
|
|
|
182 |
if ( USE_TRANSLATION2 === true )
|
|
|
183 |
{
|
|
|
184 |
if ( $this->ini["change_order"] )
|
|
|
185 |
{
|
|
|
186 |
$abschluss = $GLOBALS["langstrings"]["buy"]["click_button"];
|
|
|
187 |
}
|
|
|
188 |
else
|
|
|
189 |
{
|
|
|
190 |
$abschluss = $GLOBALS["langstrings"]["buy"]["cancel_order"];
|
|
|
191 |
}
|
|
|
192 |
} elseif ( $_SESSION["languageException"] )
|
|
|
193 |
{
|
|
|
194 |
if ( $this->ini["change_order"] )
|
|
|
195 |
{
|
|
|
196 |
$abschluss =
|
|
|
197 |
"Click on the button to choose an other payment method.";
|
|
|
198 |
}
|
|
|
199 |
else
|
|
|
200 |
{
|
|
|
201 |
$abschluss = "Therefore we will now cancel your order.";
|
|
|
202 |
}
|
|
|
203 |
}
|
|
|
204 |
else
|
|
|
205 |
{
|
|
|
206 |
if ( $this->ini["change_order"] )
|
|
|
207 |
{
|
|
|
208 |
$abschluss =
|
|
|
209 |
"Klicken Sie auf den Button, um eine andere Zahlweise auszuwählen.";
|
|
|
210 |
}
|
|
|
211 |
else
|
|
|
212 |
{
|
|
|
213 |
$abschluss =
|
|
|
214 |
"Deshalb werden wir nun Ihre Bestellung nun stornieren.";
|
|
|
215 |
}
|
|
|
216 |
}
|
|
|
217 |
switch ( $status )
|
|
|
218 |
{
|
|
|
219 |
case "init_fehler":
|
|
|
220 |
if ( USE_TRANSLATION2 === true )
|
|
|
221 |
{
|
|
|
222 |
$msg = $GLOBALS["langstrings"]["buy"]["santander_not_avail"];
|
|
|
223 |
} elseif ( $_SESSION["languageException"] )
|
|
|
224 |
{
|
|
|
225 |
$msg =
|
|
|
226 |
"Unfourtunately the payment via Santander-bank is not available at the moment. ";
|
|
|
227 |
}
|
|
|
228 |
else
|
|
|
229 |
{
|
|
|
230 |
$msg =
|
|
|
231 |
"Leider steht die Finanzierung über die Santander-Bank zur Zeit nicht zur Verfügung. ";
|
|
|
232 |
}
|
|
|
233 |
break;
|
|
|
234 |
}
|
|
|
235 |
$msg .= $abschluss;
|
|
|
236 |
if ( $ret["error"] && $this->ini["change_order"] )
|
|
|
237 |
{
|
|
|
238 |
$msg .= '
|
|
|
239 |
<form method="post" action="/">
|
|
|
240 |
<input type="hidden" name="best_id" value="' . $bestellId .
|
|
|
241 |
'">
|
|
|
242 |
<input type="hidden" name="email" value="' . $_SESSION["SHOP"]["buy"]["Persdata"]["email"] .
|
|
|
243 |
'">
|
|
|
244 |
<input type="hidden" name="mode" value="change_order">
|
|
|
245 |
<input type="submit" value="Zahlart / Bestellung ändern">
|
|
|
246 |
</form>
|
|
|
247 |
';
|
|
|
248 |
}
|
|
|
249 |
return $msg;
|
|
|
250 |
}
|
|
|
251 |
}
|
|
|
252 |
?>
|