Blame | Letzte Änderung | Log anzeigen | RSS feed
<?php/*** @package php_share* @author Webagentur Niewerth <tiefland@weban.de>* @copyright 2011 Webagentur Niewerth* @license propietary http://www.weban.de* @version $Rev: 736 $* @filesource**//**** @package php_share* @author Webagentur Niewerth <tiefland@weban.de>* @copyright 2011 Webagentur Niewerth*/// SVN: $Id: santander.php 736 2011-09-26 12:58:19Z tiefland $require_once "creditcard.interface.php";class santander implements creditcard{protected $ini;function __construct(){if ( !is_array( $_SESSION["INI"] ) ){$this->ini = $GLOBALS["INI"];}else{$this->ini = $_SESSION["INI"];}}function getCreditcardStatus( $bestellId, $summe = null ){if ( is_null( $summe ) ){$summe = getBasketSummeBrutto();}$summe = round( $summe, 2 );$benutzer = $this->ini["finanzierung"]["zugang"];$passwort = $this->ini["finanzierung"]["passwort"];$bestellId = $bestellId;if ( Eigenschaft( 13 ) ){$benutzer = $this->ini["finanzierung"]["zugang2"];$passwort = $this->ini["finanzierung"]["passwort2"];}$server = $this->ini["finanzierung"]["server"];$leasingId = $this->ini["finanzierung"]["prefix"] . $bestellId;$anrede = utf8_encode( $_SESSION["SHOP"]["buy"]["Persdata"]["Anrede"] );$vorname = utf8_encode( $_SESSION["SHOP"]["buy"]["Persdata"]["Vorname"] );$nachname = utf8_encode( $_SESSION["SHOP"]["buy"]["Persdata"]["Nachname"] );$email = utf8_encode( $_SESSION["SHOP"]["buy"]["Persdata"]["email"] );$strasse = utf8_encode( $_SESSION["SHOP"]["buy"]["Persdata"]["Strasse"] ." " . $_SESSION["SHOP"]["buy"]["Persdata"]["Hausnummer"] );$ort = utf8_encode( $_SESSION["SHOP"]["buy"]["Persdata"]["Ort"] );$plz = utf8_encode( $_SESSION["SHOP"]["buy"]["Persdata"]["PLZ"] );$tel = str_replace( " ", "", $_SESSION["SHOP"]["buy"]["Persdata"]["Telefon"] );$telefon = utf8_encode( $tel );$birthday = $_SESSION["SHOP"]["buy"]["Persdata"]["birthday"];$summe_str = sprintf( "%.02f", $summe );$land = "Deutschland";$options = array( "trace" => 1, "exceptions" => true );try{$url = "https://" . $server ."/webquick/services/FinanceService?wsdl";$soap = new SoapClient( $url, $options );$erg = $soap->storeFinanceData2( $bestellId, $leasingId, $benutzer,$passwort, $summe, $anrede, $vorname, $nachname, $email,$strasse, $ort, $plz, $land, $telefon, $birthday );if ( $erg == 0 ){$out = "<form action=\"https://$server/webquick/deutsch/startWebfinanz.jsp\" method=\"get\" name=\"finanzierung\" id='zahlung'><input type=\"hidden\" name=\"leasID\" value=\"" .$leasingId . "\"><input type=\"hidden\" name=\"haendlernr\" value=\"" .$benutzer . "\"><input type=\"hidden\" name=\"ordernr\" value=\"" .$bestellId . "\"><input type=\"submit\" value=\"finanzieren\"></form>";}else{if ( $this->ini["change_order"] ){$_SESSION["zahlarten"]["finanzierung"] = false;$ret["error"] = true;$out = $this->_getMsg( $ret, "init_fehler", $bestellId );}admin_debug( $soap->__getLastRequest() );admin_debug( $soap->__getLastResponse() );admin_debug( $url );admin_debug( $erg );admin_debug( $bestellId );admin_debug( $leasingId );admin_debug( $benutzer );admin_debug( $passwort );admin_debug( $summe );admin_debug( $anrede );admin_debug( $vorname );admin_debug( $nachname );admin_debug( $email );admin_debug( $strasse );admin_debug( $ort );admin_debug( $plz );admin_debug( $land );admin_debug( $telefon );admin_debug( $birthday );}}catch ( exception $e ){if ( $this->ini["change_order"] ){$_SESSION["zahlarten"]["finanzierung"] = false;$ret["error"] = true;$out = $this->_getMsg( $ret, "init_fehler", $bestellId );}admin_debug( $soap->__getLastRequest() );admin_debug( $soap->__getLastResponse() );admin_debug( $url );admin_debug( $erg );admin_debug( $bestellId );admin_debug( $leasingId );admin_debug( $benutzer );admin_debug( $passwort );admin_debug( $summe_str );admin_debug( $anrede );admin_debug( $vorname );admin_debug( $nachname );admin_debug( $email );admin_debug( $strasse );admin_debug( $ort );admin_debug( $plz );admin_debug( $telefon );admin_debug( $birthday );admin_debug( $e );}return $out;}function getCreditcardReturnStatus( $bestellId ){$server = $this->ini["finanzierung"]["server"];$leasingId = $this->ini["finanzierung"]["prefix"] . $bestellId;$url = "https://" . $server ."/webquick/services/FinanceService?wsdl";$soap = new SoapClient( $url );$erg = $soap->__soapCall( "getStatus2", array( "orderid" => $leasingId,"leasingid" => $bestellId, "vendornumber" => $this->ini["finanzierung"]["zugang"],"password" => $this->ini["finanzierung"]["passwort"] ) );return var_export( $erg, true );}function genCheckSum( $src ){switch ( $this->ini["kreditkarte"]["sha_algo"] ){case "sha512":$data = hash( "sha512", $src );break;case "sha256":$data = hash( "sha256", $src );break;case "sha1":default:$data = sha1( $src );break;}return $data;}private function _getMsg( $ret, $status, $bestellId ){if ( USE_TRANSLATION2 === true ){if ( $this->ini["change_order"] ){$abschluss = $GLOBALS["langstrings"]["buy"]["click_button"];}else{$abschluss = $GLOBALS["langstrings"]["buy"]["cancel_order"];}} elseif ( $_SESSION["languageException"] ){if ( $this->ini["change_order"] ){$abschluss ="Click on the button to choose an other payment method.";}else{$abschluss = "Therefore we will now cancel your order.";}}else{if ( $this->ini["change_order"] ){$abschluss ="Klicken Sie auf den Button, um eine andere Zahlweise auszuwählen.";}else{$abschluss ="Deshalb werden wir nun Ihre Bestellung nun stornieren.";}}switch ( $status ){case "init_fehler":if ( USE_TRANSLATION2 === true ){$msg = $GLOBALS["langstrings"]["buy"]["santander_not_avail"];} elseif ( $_SESSION["languageException"] ){$msg ="Unfourtunately the payment via Santander-bank is not available at the moment. ";}else{$msg ="Leider steht die Finanzierung über die Santander-Bank zur Zeit nicht zur Verfügung. ";}break;}$msg .= $abschluss;if ( $ret["error"] && $this->ini["change_order"] ){$msg .= '<form method="post" action="/"><input type="hidden" name="best_id" value="' . $bestellId .'"><input type="hidden" name="email" value="' . $_SESSION["SHOP"]["buy"]["Persdata"]["email"] .'"><input type="hidden" name="mode" value="change_order"><input type="submit" value="Zahlart / Bestellung ändern"></form>';}return $msg;}}?>