• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

payment/classes/class.ilPurchaseBMFGUI.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00032 include_once './payment/classes/class.ilPaymentShoppingCart.php';
00033 include_once './payment/classes/class.ilPaymentShoppingCartGUI.php';
00034 include_once dirname(__FILE__)."/../bmf/lib/ePayment/cfg_epayment.inc.php";
00035 include_once dirname(__FILE__)."/../bmf/lib/SOAP/class.ilBMFClient.php";
00036 
00037 class ilPurchaseBMFGUI
00038 {
00039         var $ctrl;
00040         var $tpl;
00041 
00042         var $user_obj;
00043         var $error;
00044         var $shoppingCart;
00045 
00046         var $soapClient;
00047 
00048         function ilPurchaseBMFGUI(&$user_obj)
00049         {
00050                 global $ilias,$ilDB,$lng,$tpl,$rbacsystem;
00051                 $this->ilias =& $ilias;
00052                 $this->db =& $ilDB;
00053                 $this->lng =& $lng;
00054                 $this->tpl =& $tpl;
00055 
00056                 global $ilCtrl;
00057 
00058                 $this->ctrl =& $ilCtrl;
00059                 $this->tpl =& $tpl;
00060 
00061                 // Get user object
00062                 $this->user_obj =& $user_obj;
00063 
00064                 if (!is_array($_SESSION["bmf"]["personal_data"]))
00065                 {
00066                         $_SESSION["bmf"]["personal_data"]["vorname"] = $this->user_obj->getFirstname();
00067                         $_SESSION["bmf"]["personal_data"]["nachname"] = $this->user_obj->getLastname();
00068                         if (strpos("_" . $this->user_obj->getStreet(), " ") > 0)
00069                         {
00070                                 $houseNo = substr($this->user_obj->getStreet(), strrpos($this->user_obj->getStreet(), " ")+1);
00071                                 $street = substr($this->user_obj->getStreet(), 0, strlen($this->user_obj->getStreet())-(strlen($houseNo)+1));
00072                                 $_SESSION["bmf"]["personal_data"]["strasse"] = $street;
00073                                 $_SESSION["bmf"]["personal_data"]["hausNr"] = $houseNo;
00074                         }
00075                         else
00076                         {
00077                                 $_SESSION["bmf"]["personal_data"]["strasse"] = $this->user_obj->getStreet();
00078                                 $_SESSION["bmf"]["personal_data"]["hausNr"] = "";
00079                         }
00080                         $_SESSION["bmf"]["personal_data"]["postfach"] = "";
00081                         $_SESSION["bmf"]["personal_data"]["PLZ"] = $this->user_obj->getZipcode();
00082                         $_SESSION["bmf"]["personal_data"]["ort"] = $this->user_obj->getCity();
00083                         $_SESSION["bmf"]["personal_data"]["land"] = $this->__getCountryCode($this->user_obj->getCountry());
00084                         $_SESSION["bmf"]["personal_data"]["EMailAdresse"] = $this->user_obj->getEmail();
00085                         $_SESSION["bmf"]["personal_data"]["sprache"] = $this->user_obj->getLanguage();
00086                 }
00087 
00088                 $this->__loadTemplate();
00089 
00090                 $this->error = "";
00091 
00092                 $this->lng->loadLanguageModule("payment");
00093         }
00094 
00095         function cancel()
00096         {
00097                 ilUtil::redirect("./payment.php");
00098         }
00099 
00100         function showPersonalData()
00101         {
00102                 // user_id $this->user_obj->getId()
00103                 // all
00104 
00105                 $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
00106 
00107                 if(!count($items = $this->psc_obj->getEntries()))
00108                 {
00109 
00110                         $this->tpl->setVariable("HEADER",$this->lng->txt('pay_bmf_your_order'));
00111                         $this->tpl->touchBlock("stop_floating");
00112                         sendInfo($this->lng->txt('pay_shopping_cart_empty'));
00113 
00114                 }
00115                 else
00116                 {
00117 
00118                 $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.pay_bmf_personal_data.html',true);
00119 
00120                 $this->tpl->setVariable("PERSONAL_DATA_FORMACTION",$this->ctrl->getFormAction($this));
00121 
00122                 // set table header
00123                 $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_pays_b.gif'));
00124                 $this->tpl->setVariable("ALT_IMG",$this->lng->txt('obj_usr'));
00125                 $this->tpl->setVariable("HEADER",$this->lng->txt('pay_step1'));
00126                 $this->tpl->setVariable("TITLE",$this->lng->txt('pay_bmf_personal_data'));
00127                 $this->tpl->setVariable("DESCRIPTION",$this->lng->txt('pay_bmf_description_personal_data'));
00128                 $this->tpl->touchBlock("stop_floating");
00129                 $this->tpl->setVariable("TXT_CLOSE_WINDOW",$this->lng->txt('close_window'));
00130 
00131                 // set plain text variables
00132                 $this->tpl->setVariable("TXT_FIRSTNAME",$this->lng->txt('firstname'));
00133                 $this->tpl->setVariable("TXT_LASTNAME",$this->lng->txt('lastname'));
00134                 $this->tpl->setVariable("TXT_STREET",$this->lng->txt('street'));
00135                 $this->tpl->setVariable("TXT_HOUSE_NUMBER",$this->lng->txt('pay_bmf_house_number'));
00136                 $this->tpl->setVariable("TXT_OR",$this->lng->txt('pay_bmf_or'));
00137                 $this->tpl->setVariable("TXT_PO_BOX",$this->lng->txt('pay_bmf_po_box'));
00138                 $this->tpl->setVariable("TXT_ZIPCODE",$this->lng->txt('zipcode'));
00139                 $this->tpl->setVariable("TXT_CITY",$this->lng->txt('city'));
00140                 $this->tpl->setVariable("TXT_COUNTRY",$this->lng->txt('country'));
00141                 $this->tpl->setVariable("TXT_EMAIL",$this->lng->txt('email'));
00142 
00143                 $this->tpl->setVariable("INPUT_VALUE",ucfirst($this->lng->txt('next')));
00144                 $this->tpl->setVariable("CANCEL",$this->lng->txt('cancel'));
00145 
00146                 // fill defaults
00147 
00148                 $this->error != "" && isset($_POST['country']) ? $this->__showCountries($this->tpl, $_POST['country']) : $this->__showCountries($this->tpl, $_SESSION['bmf']['personal_data']['land']);
00149 /*              $this->tpl->setVariable("FIRSTNAME",
00150                                                                 $this->error != "" && isset($_POST['firstname'])
00151                                                                 ? ilUtil::prepareFormOutput($_POST['firstname'],true)
00152                                                                 : ilUtil::prepareFormOutput($_SESSION['bmf']["personal_data"]['vorname'],true));
00153                 $this->tpl->setVariable("LASTNAME",
00154                                                                 $this->error != "" && isset($_POST['lastname'])
00155                                                                 ? ilUtil::prepareFormOutput($_POST['lastname'],true)
00156                                                                 : ilUtil::prepareFormOutput($_SESSION['bmf']["personal_data"]['nachname'],true));*/
00157                 $this->tpl->setVariable("FIRSTNAME", $this->user_obj->getFirstname());
00158                 $this->tpl->setVariable("LASTNAME", $this->user_obj->getLastname());
00159                 $this->tpl->setVariable("STREET",
00160                                                                 $this->error != "" && isset($_POST['street'])
00161                                                                 ? ilUtil::prepareFormOutput($_POST['street'],true)
00162                                                                 : ilUtil::prepareFormOutput($_SESSION['bmf']["personal_data"]['strasse'],true));
00163                 $this->tpl->setVariable("HOUSE_NUMBER",
00164                                                                 $this->error != "" && isset($_POST['house_number'])
00165                                                                 ? ilUtil::prepareFormOutput($_POST['house_number'],true)
00166                                                                 : ilUtil::prepareFormOutput($_SESSION['bmf']["personal_data"]['hausNr'],true));
00167                 $this->tpl->setVariable("PO_BOX",
00168                                                                 $this->error != "" && isset($_POST['po_box'])
00169                                                                 ? ilUtil::prepareFormOutput($_POST['po_box'],true)
00170                                                                 : ilUtil::prepareFormOutput($_SESSION['bmf']["personal_data"]['postfach'],true));
00171                 $this->tpl->setVariable("ZIPCODE",
00172                                                                 $this->error != "" && isset($_POST['zipcode'])
00173                                                                 ? ilUtil::prepareFormOutput($_POST['zipcode'],true)
00174                                                                 : ilUtil::prepareFormOutput($_SESSION['bmf']["personal_data"]['PLZ'],true));
00175                 $this->tpl->setVariable("CITY",
00176                                                                 $this->error != "" && isset($_POST['city'])
00177                                                                 ? ilUtil::prepareFormOutput($_POST['city'],true)
00178                                                                 : ilUtil::prepareFormOutput($_SESSION['bmf']["personal_data"]['ort'],true));
00179 /*              $this->tpl->setVariable("EMAIL",
00180                                                                 $this->error != "" && isset($_POST['email'])
00181                                                                 ? ilUtil::prepareFormOutput($_POST['email'],true)
00182                                                                 : ilUtil::prepareFormOutput($_SESSION['bmf']["personal_data"]['EMailAdresse'],true));*/
00183                 $this->tpl->setVariable("EMAIL", $this->user_obj->getEmail());
00184 
00185                 }
00186         }
00187 
00188         function getPersonalData()
00189         {
00190 /*              if ($_POST"firstname"] == "" ||
00191                         $_POST["lastname"] == "" ||*/
00192                 if ($_SESSION["bmf"]["personal_data"]["vorname"] == "" ||
00193                         $_SESSION["bmf"]["personal_data"]["nachname"] == "" ||
00194                         $_POST["zipcode"] == "" ||
00195                         $_POST["city"] == "" ||
00196                         $_POST["country"] == "" ||
00197 /*                      $_POST["email"] == "")*/
00198                         $_SESSION["bmf"]["personal_data"]["EMailAdresse"] == "")
00199                 {
00200                         $this->error = $this->lng->txt('pay_bmf_personal_data_not_valid');
00201                         sendInfo($this->error);
00202                         $this->showPersonalData();
00203                         return;
00204                 }
00205                 if (($_POST["street"] == "" && $_POST["house_number"] == "" && $_POST["po_box"] == "") ||
00206                         (($_POST["street"] != "" || $_POST["house_number"] != "") && $_POST["po_box"] != "") ||
00207                         ($_POST["street"] != "" && $_POST["house_number"] == "") ||
00208                         ($_POST["street"] == "" && $_POST["house_number"] != ""))
00209                 {
00210                         $this->error = $this->lng->txt('pay_bmf_street_or_pobox');
00211                         sendInfo($this->error);
00212                         $this->showPersonalData();
00213                         return;
00214                 }
00215 
00216 /*              $_SESSION["bmf"]["personal_data"]["vorname"] = $_POST["firstname"];
00217                 $_SESSION["bmf"]["personal_data"]["nachname"] = $_POST["lastname"];*/
00218                 $_SESSION["bmf"]["personal_data"]["vorname"] = $this->user_obj->getFirstname();
00219                 $_SESSION["bmf"]["personal_data"]["nachname"] = $this->user_obj->getLastname();
00220                 $_SESSION["bmf"]["personal_data"]["strasse"] = $_POST["street"];
00221                 $_SESSION["bmf"]["personal_data"]["hausNr"] = $_POST["house_number"];
00222                 $_SESSION["bmf"]["personal_data"]["postfach"] = $_POST["po_box"];
00223                 $_SESSION["bmf"]["personal_data"]["PLZ"] = $_POST["zipcode"];
00224                 $_SESSION["bmf"]["personal_data"]["ort"] = $_POST["city"];
00225                 $_SESSION["bmf"]["personal_data"]["land"] = $_POST["country"];
00226 /*              $_SESSION["bmf"]["personal_data"]["EMailAdresse"] = $_POST["email"];*/
00227                 $_SESSION["bmf"]["personal_data"]["EmailAdresse"] = $this->user_obj->getEmail();
00228                 $_SESSION["bmf"]["personal_data"]["sprache"] = $this->user_obj->getLanguage();
00229 
00230                 if ($_SESSION["bmf"]["personal_data"]["land"] != "DE")
00231                 {
00232                         if ($_SESSION["bmf"]["payment_type"] == "debit_entry")
00233                         {
00234                                 $_SESSION["bmf"]["payment_type"] = "";
00235                         }
00236                 }
00237 
00238                 $this->error = "";
00239                 $this->showPaymentType();
00240         }
00241 
00242         function showPaymentType()
00243         {
00244                 // user_id $this->user_obj->getId()
00245                 // all
00246 
00247                 $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
00248 
00249                 if(!count($items = $this->psc_obj->getEntries()))
00250                 {
00251 
00252                         $this->tpl->setVariable("HEADER",$this->lng->txt('pay_bmf_your_order'));
00253                         $this->tpl->touchBlock("stop_floating");
00254                         sendInfo($this->lng->txt('pay_shopping_cart_empty'));
00255 
00256                 }
00257                 else
00258                 {
00259 
00260                 $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.pay_bmf_payment_type.html',true);
00261 
00262                 $this->tpl->setVariable("PAYMENT_TYPE_FORMACTION",$this->ctrl->getFormAction($this));
00263 
00264                 // set table header
00265                 $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_pays_b.gif'));
00266                 $this->tpl->setVariable("ALT_IMG",$this->lng->txt('obj_usr'));
00267                 $this->tpl->setVariable("HEADER",$this->lng->txt('pay_step2'));
00268                 $this->tpl->setVariable("TITLE",$this->lng->txt('pay_bmf_payment_type'));
00269                 $this->tpl->setVariable("DESCRIPTION",$this->lng->txt('pay_bmf_description_payment_type'));
00270                 $this->tpl->touchBlock("stop_floating");
00271                 $this->tpl->setVariable("TXT_CLOSE_WINDOW",$this->lng->txt('close_window'));
00272 
00273                 // set plain text variables
00274                 if ($_SESSION["bmf"]["personal_data"]["land"] == "DE")
00275                 {
00276                         $this->tpl->setVariable("TXT_DEBIT_ENTRY",$this->lng->txt('pay_bmf_debit_entry'));
00277                 }
00278                 $this->tpl->setVariable("TXT_CREDIT_CARD",$this->lng->txt('pay_bmf_credit_card'));
00279 
00280                 $this->tpl->setVariable("INPUT_VALUE",ucfirst($this->lng->txt('next')));
00281                 $this->tpl->setVariable("CANCEL",$this->lng->txt('cancel'));
00282 
00283                 // fill defaults
00284 
00285                 if ($this->error != "" &&
00286                         isset($_POST["payment_type"]))
00287                 {
00288                         $this->tpl->setVariable("PAYMENT_TYPE_" . strtoupper($_POST["payment_type"]), " checked") ;
00289                 }
00290                 else
00291                 {
00292                         if (($_SESSION["bmf"]["personal_data"]["land"] != "DE" && $_POST["payment_type"] != "debit_entry") ||
00293                                 $_SESSION["bmf"]["personal_data"]["land"] == "DE")
00294                         {
00295                                 $this->tpl->setVariable("PAYMENT_TYPE_" . strtoupper($_SESSION["bmf"]["payment_type"]), " checked") ;
00296                         }
00297                 }
00298 
00299                 // Button
00300                 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00301                 $this->tpl->setCurrentBlock("btn_cell");
00302                 $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "showPersonalData"));
00303                 $this->tpl->setVariable("BTN_TXT", $this->lng->txt('pay_bmf_back'));
00304                 $this->tpl->parseCurrentBlock("btn_cell");
00305 
00306                 }
00307         }
00308 
00309         function getPaymentType()
00310         {
00311                 if (($_POST["payment_type"] != "credit_card" && $_POST["payment_type"] != "debit_entry") ||
00312                         ($_SESSION["bmf"]["personal_data"]["land"] != "DE" && $_POST["payment_type"] == "debit_entry"))
00313                 {
00314                         $this->error = $this->lng->txt('pay_bmf_payment_type_not_valid');
00315                         sendInfo($this->error);
00316                         $this->showPaymentType();
00317                         return;
00318                 }
00319 
00320                 $_SESSION["bmf"]["payment_type"] = $_POST["payment_type"];
00321 
00322                 $this->error = "";
00323                 if ($_SESSION["bmf"]["payment_type"] == "credit_card")
00324                 {
00325                         $this->showCreditCard();
00326                 }
00327                 else
00328                 {
00329                         $this->showDebitEntry();
00330                 }
00331         }
00332 
00333         function showDebitEntry()
00334         {
00335                 // user_id $this->user_obj->getId()
00336                 // all
00337 
00338 /*              if ($_SESSION["bmf"]["debit_entry"]["kontoinhaber"] == "" &&
00339                         $this->error == "" &&
00340                         $_POST["account_holder"] == "")
00341                 {
00342                         $_SESSION["bmf"]["debit_entry"]["kontoinhaber"] = $_SESSION["bmf"]["personal_data"]["vorname"] . " " . $_SESSION["bmf"]["personal_data"]["nachname"];
00343                 }*/
00344 
00345                 $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
00346 
00347                 if(!count($items = $this->psc_obj->getEntries()))
00348                 {
00349 
00350                         $this->tpl->setVariable("HEADER",$this->lng->txt('pay_bmf_your_order'));
00351                         $this->tpl->touchBlock("stop_floating");
00352                         sendInfo($this->lng->txt('pay_shopping_cart_empty'));
00353 
00354                 }
00355                 else
00356                 {
00357 
00358                 $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.pay_bmf_debit_entry.html',true);
00359 
00360                 $this->__showShoppingCart();
00361 
00362                 $this->tpl->setVariable("DEBIT_ENTRY_FORMACTION",$this->ctrl->getFormAction($this));
00363 
00364                 // set table header
00365                 $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_pays_b.gif'));
00366                 $this->tpl->setVariable("ALT_IMG",$this->lng->txt('obj_usr'));
00367                 $this->tpl->setVariable("HEADER",$this->lng->txt('pay_step3_debit_entry'));
00368                 $this->tpl->setVariable("TITLE",$this->lng->txt('pay_bmf_debit_entry_data'));
00369                 $this->tpl->setVariable("DESCRIPTION",$this->lng->txt('pay_bmf_description_debit_entry'));
00370                 $this->tpl->touchBlock("stop_floating");
00371                 $this->tpl->setVariable("TXT_CLOSE_WINDOW",$this->lng->txt('close_window'));
00372 
00373                 // set plain text variables
00374                 $this->tpl->setVariable("TXT_ACCOUNT_HOLDER",$this->lng->txt('pay_bmf_account_holder'));
00375                 $this->tpl->setVariable("TXT_OPTIONAL",$this->lng->txt('pay_bmf_optional'));
00376                 $this->tpl->setVariable("TXT_BANK_CODE",$this->lng->txt('pay_bmf_bank_code'));
00377                 $this->tpl->setVariable("TXT_ACCOUNT_NUMBER",$this->lng->txt('pay_bmf_account_number'));
00378                 $this->tpl->setVariable("TXT_TERMS_CONDITIONS",$this->lng->txt('pay_bmf_terms_conditions'));
00379                 $this->tpl->setVariable("TXT_TERMS_CONDITIONS_READ",$this->lng->txt('pay_bmf_terms_conditions_read'));
00380                 $this->tpl->setVariable("TXT_TERMS_CONDITIONS_SHOW",$this->lng->txt('pay_bmf_terms_conditions_show'));
00381                 $this->tpl->setVariable("LINK_TERMS_CONDITIONS","./show_terms_conditions.php");
00382                 $this->tpl->setVariable("TXT_PASSWORD",$this->lng->txt('password'));
00383                 $this->tpl->setVariable("TXT_CONFIRM_ORDER",$this->lng->txt('pay_confirm_order'));
00384 
00385                 $this->tpl->setVariable("INPUT_VALUE",$this->lng->txt('pay_send_order'));
00386                 $this->tpl->setVariable("CANCEL",$this->lng->txt('cancel'));
00387 
00388                 // fill defaults
00389 
00390                 $this->tpl->setVariable("ACCOUNT_HOLDER",
00391                                                                 $this->error != "" && isset($_POST['account_holder'])
00392                                                                 ? ilUtil::prepareFormOutput($_POST['account_holder'],true)
00393                                                                 : ilUtil::prepareFormOutput($_SESSION['bmf']["debit_entry"]['kontoinhaber'],true));
00394                 $this->tpl->setVariable("BANK_CODE",
00395                                                                 $this->error != "" && isset($_POST['bank_code'])
00396                                                                 ? ilUtil::prepareFormOutput($_POST['bank_code'],true)
00397                                                                 : ilUtil::prepareFormOutput($_SESSION['bmf']["debit_entry"]['BLZ'],true));
00398                 $this->tpl->setVariable("ACCOUNT_NUMBER",
00399                                                                 $this->error != "" && isset($_POST['account_number'])
00400                                                                 ? ilUtil::prepareFormOutput($_POST['account_number'],true)
00401                                                                 : ilUtil::prepareFormOutput($_SESSION['bmf']["debit_entry"]['kontoNr'],true));
00402 /*              if ($this->error != "" &&
00403                         isset($_POST["terms_conditions"]))
00404                 {
00405                         $this->tpl->setVariable("TERMS_CONDITIONS_" . strtoupper($_POST["terms_conditions"]), " checked") ;
00406                 }*/
00407 /*              if ($this->error != "" &&
00408                         isset($_POST["password"]))
00409                 {
00410                         $this->tpl->setVariable("PASSWORD", ilUtil::prepareFormOutput($_POST['password'],true));
00411                 }*/
00412 
00413                 // Button
00414                 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00415                 $this->tpl->setCurrentBlock("btn_cell");
00416                 $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "showPaymentType"));
00417                 $this->tpl->setVariable("BTN_TXT", $this->lng->txt('pay_bmf_back'));
00418                 $this->tpl->parseCurrentBlock("btn_cell");
00419 
00420                 }
00421         }
00422 
00423         function getDebitEntry()
00424         {
00425                 if ($_POST["account_holder"] == "" ||
00426                         $_POST["bank_code"] == "" ||
00427                         $_POST["account_number"] == "")
00428                 {
00429                         $this->error = $this->lng->txt('pay_bmf_debit_entry_not_valid');
00430                         sendInfo($this->error);
00431                         $this->showDebitEntry();
00432                         return;
00433                 }
00434                 if ($_POST["terms_conditions"] != 1)
00435                 {
00436                         $this->error = $this->lng->txt('pay_bmf_check_terms_conditions');
00437                         sendInfo($this->error);
00438                         $this->showDebitEntry();
00439                         return;
00440                 }
00441                 if ($_POST["password"] == "" ||
00442                         md5($_POST["password"]) != $this->user_obj->getPasswd())
00443                 {
00444                         $this->error = $this->lng->txt('pay_bmf_password_not_valid');
00445                         sendInfo($this->error);
00446                         $this->showDebitEntry();
00447                         return;
00448                 }
00449 
00450                 $_SESSION["bmf"]["debit_entry"]["BLZ"] = $_POST["bank_code"];
00451                 $_SESSION["bmf"]["debit_entry"]["kontoinhaber"] = $_POST["account_holder"];
00452                 $_SESSION["bmf"]["debit_entry"]["kontoNr"] = $_POST["account_number"];
00453 
00454                 $this->error = "";
00455                 $this->sendDebitEntry();
00456         }
00457 
00458         function sendDebitEntry()
00459         {
00460 
00461                 $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
00462 
00463                 if(!count($items = $this->psc_obj->getEntries()))
00464                 {
00465 
00466                         $this->tpl->setVariable("HEADER",$this->lng->txt('pay_bmf_your_order'));
00467                         $this->tpl->touchBlock("stop_floating");
00468                         sendInfo($this->lng->txt('pay_shopping_cart_empty'));
00469 
00470                 }
00471                 else
00472                 {
00473 
00474                 $customer = new KundenstammdatenPflegeWS();
00475 
00476                 $newCustomer = new Kunde($this->user_obj->getId());
00477                 
00478                 $resultCustomerObj = $customer->anlegenKunde($newCustomer);
00479                 $resultCustomer = $resultCustomerObj->ergebnis;
00480 
00481                 if (is_object($resultCustomer))
00482                 {
00483                         if ($resultCustomer->code < 0)
00484                         {
00485                                 $error = $this->lng->txt('pay_bmf_server_error_code') . " " . $result->code . ": " . $result->kurzText . "<br>\n" . $result->langText;
00486                                 if ($resultCustomer->code == -103 ||
00487                                         $resultCustomer->code == -104 ||
00488                                         $resultCustomer->code == -107 ||
00489                                         ($resultCustomer->code <= -202 && $resultCustomer->code >= -208) ||
00490                                         $resultCustomer->code == -213)
00491                                 {
00492                                         sendInfo($error);
00493                                         $this->showPersonalData();
00494                                 }
00495                                 else
00496                                 {
00497                                         $error .= "<br>\n" . $this->lng->txt('pay_bmf_server_error_sysadmin');
00498                                         sendInfo($error);
00499                                         $this->showPersonalData();
00500                                 }
00501                         }
00502                         else
00503                         {
00504                                 $payment = new LastschriftWS();
00505                 
00506                                 $debitEntry = new Lastschrift();
00507                 
00508                                 $address = new LieferAdresse();
00509                 
00510                                 $bank = new Bankverbindung();
00511                 
00512                                 $sc_obj =& new ilPaymentShoppingCart($this->user_obj);
00513 
00514                                 $tmp_bookEntries = $sc_obj->getShoppingCart();
00515                                 if (!is_array($tmp_bookEntries))
00516                                 {
00517                                         sendInfo($this->lng->txt('pay_shopping_cart_empty'));
00518                                 }
00519                                 else
00520                                 {
00521                                         $totalAmount = 0;
00522                                         for ($i = 0; $i < count($tmp_bookEntries); $i++)
00523                                         {
00524                                                 $bookEntries[] = new Buchung($tmp_bookEntries[$i]);
00525                                                 $totalAmount += $tmp_bookEntries[$i]["betrag"];
00526                                         }
00527                 
00528                                         $values = array("betrag" => $totalAmount, "buchungen" => $bookEntries);
00529                                         $bookingList = new BuchungsListe($this->user_obj->getId(), $values);
00530                                 }
00531                 
00532                 #               vd($address);
00533                 #               vd($debitEntry);
00534                 #               vd($bank);
00535                 #               vd($bookingList);
00536                 
00537                                 $resultObj = $payment->abbuchenOhneEinzugsermaechtigung($resultCustomerObj->kunde->EShopKundenNr, $address, $bank, $bookingList);
00538                                 $result = $resultObj->ergebnis;
00539                 
00540                                 if (is_object($result))
00541                                 {
00542                                         if ($result->code < 0)
00543                                         {
00544                                                 $this->tpl->setVariable("HEADER",$this->lng->txt('error'));
00545                                                 $this->tpl->touchBlock("stop_floating");
00546                                                 $error = $this->lng->txt('pay_bmf_server_error_code') . " " . $result->code . ": " . $result->kurzText . "<br>\n" . $result->langText;
00547                                                 if ($result->code == -103 ||
00548                                                         $result->code == -104 ||
00549                                                         $result->code == -107 ||
00550                                                         ($result->code <= -202 && $result->code >= -208) ||
00551                                                         $result->code == -213)
00552                                                 {
00553                                                         sendInfo($error);
00554                                                         $this->showPersonalData();
00555                                                 }
00556                                                 else if ($result->code == -507 ||
00557                                                         $result->code == -510 ||
00558                                                         $result->code == -511)
00559                                                 {
00560                                                         sendInfo($error);
00561                                                         $this->showPaymentType();
00562                                                 }
00563                                                 else if ($result->code == -402 ||
00564                                                         $result->code == -402 ||
00565                                                         $result->code == -403 ||
00566                                                         $result->code == -406 ||
00567                                                         $result->code == -410 ||
00568                                                         $result->code == -413 ||
00569                                                         $result->code == -701 ||
00570                                                         $result->code == -702 ||
00571                                                         $result->code == -703)
00572                                                 {
00573                                                         sendInfo($error);
00574                                                         $this->showDebitEntry();
00575                                                 }
00576                                                 else
00577                                                 {
00578                                                         $error .= "<br>\n" . $this->lng->txt('pay_bmf_server_error_sysadmin');
00579                                                         sendInfo($error);
00580                                                         $this->showPersonalData();
00581                                                 }
00582                 
00583                                         }
00584                                         else
00585                                         {
00586                                                 $resultCustomerObj->kunde->vorname = utf8_decode($resultCustomerObj->kunde->vorname);
00587                                                 $resultCustomerObj->kunde->nachname = utf8_decode($resultCustomerObj->kunde->nachname);
00588                                                 $resultCustomerObj->kunde->rechnungsAdresse->strasse  = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->strasse);
00589                                                 $resultCustomerObj->kunde->rechnungsAdresse->hausNr  = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->hausNr);
00590                                                 $resultCustomerObj->kunde->rechnungsAdresse->postfach = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->postfach);
00591                                                 $resultCustomerObj->kunde->rechnungsAdresse->PLZ = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->PLZ);
00592                                                 $resultCustomerObj->kunde->rechnungsAdresse->ort = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->ort);
00593                                                 $resultCustomerObj->kunde->rechnungsAdresse->land = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->land);
00594 
00595                                                 // everything ok => send confirmation, fill statistik, delete session, delete shopping cart.
00596                                                 $this->__sendBill($resultCustomerObj->kunde, $_SESSION["bmf"]["payment_type"], $bookingList, $resultObj);
00597 
00598                                                 $this->__addBookings($resultObj,$bookingList->getTransaction());
00599                                                 $this->__emptyShoppingCart();
00600                                                 $this->__clearSession();
00601                 
00602                                                 $this->tpl->setVariable("HEADER",$this->lng->txt('pay_bmf_your_order'));
00603                                                 $this->tpl->setVariable("DESCRIPTION",$this->lng->txt('pay_bmf_thanks'));
00604                                                 $this->tpl->touchBlock("stop_floating");
00605 
00606                                                 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.pay_bmf_debit_entry.html','payment');
00607                                                 if ($this->ilias->getSetting("https") != 1)
00608                                                 {
00609                                                         $this->tpl->setCurrentBlock("buyed_objects");
00610                                                         $this->tpl->setVariable("LINK_GOTO_BUYED_OBJECTS", "payment.php?cmdClass=ilpaymentbuyedobjectsgui&cmdNode=2");
00611                                                         $this->tpl->setVariable("TXT_GOTO_BUYED_OBJECTS", $this->lng->txt('pay_goto_buyed_objects'));
00612                                                         $this->tpl->parseCurrentBlock("buyed_objects");
00613                                                 }
00614                                                 $this->tpl->setVariable("TXT_CLOSE_WINDOW", $this->lng->txt('close_window'));
00615                                         }
00616                                 }
00617                                 else
00618                                 {
00619                                         $this->tpl->setVariable("HEADER",$this->lng->txt('error'));
00620                                         $this->tpl->touchBlock("stop_floating");
00621                                         sendInfo($this->lng->txt('pay_bmf_server_error_communication'));
00622                                 }
00623                         }
00624                 }
00625                 else
00626                 {
00627                         $this->tpl->setVariable("HEADER",$this->lng->txt('error'));
00628                         $this->tpl->touchBlock("stop_floating");
00629                         sendInfo($this->lng->txt('pay_bmf_server_error_communication'));
00630                 }
00631 
00632                 }
00633         }
00634 
00635         function showCreditCard()
00636         {
00637                 // user_id $this->user_obj->getId()
00638                 // all
00639 
00640 /*              if ($_SESSION["bmf"]["credit_card"]["karteninhaber"] == "" &&
00641                         $this->error == "" &&
00642                         $_POST["card_holder"] == "")
00643                 {
00644                         $_SESSION["bmf"]["credit_card"]["karteninhaber"] = $_SESSION["bmf"]["personal_data"]["vorname"] . " " . $_SESSION["bmf"]["personal_data"]["nachname"];
00645                 }*/
00646 
00647                 $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
00648 
00649                 if(!count($items = $this->psc_obj->getEntries()))
00650                 {
00651 
00652                         $this->tpl->setVariable("HEADER",$this->lng->txt('pay_bmf_your_order'));
00653                         $this->tpl->touchBlock("stop_floating");
00654                         sendInfo($this->lng->txt('pay_shopping_cart_empty'));
00655 
00656                 }
00657                 else
00658                 {
00659 
00660                 $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.pay_bmf_credit_card.html',true);
00661 
00662                 $this->__showShoppingCart();
00663 
00664                 $this->tpl->setVariable("CREDIT_CARD_FORMACTION",$this->ctrl->getFormAction($this));
00665 
00666                 // set table header
00667                 $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_pays_b.gif'));
00668                 $this->tpl->setVariable("ALT_IMG",$this->lng->txt('obj_usr'));
00669                 $this->tpl->setVariable("HEADER",$this->lng->txt('pay_step3_credit_card'));
00670                 $this->tpl->setVariable("TITLE",$this->lng->txt('pay_bmf_credit_card_data'));
00671                 $this->tpl->setVariable("DESCRIPTION",$this->lng->txt('pay_bmf_description_credit_card'));
00672                 $this->tpl->touchBlock("stop_floating");
00673                 $this->tpl->setVariable("TXT_CLOSE_WINDOW",$this->lng->txt('close_window'));
00674 
00675                 // set plain text variables
00676                 $this->tpl->setVariable("TXT_CARD_HOLDER",$this->lng->txt('pay_bmf_card_holder'));
00677                 $this->tpl->setVariable("TXT_CHECK_NUMBER",$this->lng->txt('pay_bmf_check_number'));
00678                 $this->tpl->setVariable("TXT_OPTIONAL",$this->lng->txt('pay_bmf_optional'));
00679                 $this->tpl->setVariable("TXT_CARD_NUMBER",$this->lng->txt('pay_bmf_card_number'));
00680                 $this->tpl->setVariable("TXT_VALIDITY",$this->lng->txt('pay_bmf_validity'));
00681                 $this->tpl->setVariable("TXT_TERMS_CONDITIONS",$this->lng->txt('pay_bmf_terms_conditions'));
00682                 $this->tpl->setVariable("TXT_TERMS_CONDITIONS_READ",$this->lng->txt('pay_bmf_terms_conditions_read'));
00683                 $this->tpl->setVariable("TXT_TERMS_CONDITIONS_SHOW",$this->lng->txt('pay_bmf_terms_conditions_show'));
00684                 $this->tpl->setVariable("LINK_TERMS_CONDITIONS","./show_terms_conditions.php");
00685                 $this->tpl->setVariable("TXT_PASSWORD",$this->lng->txt('password'));
00686                 $this->tpl->setVariable("TXT_CONFIRM_ORDER",$this->lng->txt('pay_confirm_order'));
00687 
00688                 $this->tpl->setVariable("INPUT_VALUE",$this->lng->txt('pay_send_order'));
00689                 $this->tpl->setVariable("CANCEL",$this->lng->txt('cancel'));
00690 
00691                 // fill defaults
00692 
00693                 $this->tpl->setVariable("CARD_HOLDER",
00694                                                                 $this->error != "" && isset($_POST['card_holder'])
00695                                                                 ? ilUtil::prepareFormOutput($_POST['card_holder'],true)
00696                                                                 : ilUtil::prepareFormOutput($_SESSION['bmf']["credit_card"]['karteninhaber'],true));
00697                 $this->tpl->setVariable("CARD_NUMBER_BLOCK_1",
00698                                                                 $this->error != "" && isset($_POST['card_number']['block_1'])
00699                                                                 ? ilUtil::prepareFormOutput($_POST['card_number']['block_1'],true)
00700                                                                 : ilUtil::prepareFormOutput($_SESSION['bmf']["credit_card"]['kreditkartenNr']['block_1'],true));
00701                 $this->tpl->setVariable("CARD_NUMBER_BLOCK_2",
00702                                                                 $this->error != "" && isset($_POST['card_number']['block_2'])
00703                                                                 ? ilUtil::prepareFormOutput($_POST['card_number']['block_2'],true)
00704                                                                 : ilUtil::prepareFormOutput($_SESSION['bmf']["credit_card"]['kreditkartenNr']['block_2'],true));
00705                 $this->tpl->setVariable("CARD_NUMBER_BLOCK_3",
00706                                                                 $this->error != "" && isset($_POST['card_number']['block_3'])
00707                                                                 ? ilUtil::prepareFormOutput($_POST['card_number']['block_3'],true)
00708                                                                 : ilUtil::prepareFormOutput($_SESSION['bmf']["credit_card"]['kreditkartenNr']['block_3'],true));
00709                 $this->tpl->setVariable("CARD_NUMBER_BLOCK_4",
00710                                                                 $this->error != "" && isset($_POST['card_number']['block_4'])
00711                                                                 ? ilUtil::prepareFormOutput($_POST['card_number']['block_4'],true)
00712                                                                 : ilUtil::prepareFormOutput($_SESSION['bmf']["credit_card"]['kreditkartenNr']['block_4'],true));
00713                 $this->tpl->setVariable("CHECK_NUMBER",
00714                                                                 $this->error != "" && isset($_POST['check_number'])
00715                                                                 ? ilUtil::prepareFormOutput($_POST['check_number'],true)
00716                                                                 : ilUtil::prepareFormOutput($_SESSION['bmf']["credit_card"]['kartenpruefnummer'],true));
00717                 for ($i = 1; $i <= 12; $i++)
00718                 {
00719                         $this->tpl->setCurrentBlock("loop_validity_months");
00720                         $this->tpl->setVariable("LOOP_VALIDITY_MONTHS", $i < 10 ? "0" . $i : $i);
00721                         $this->tpl->setVariable("LOOP_VALIDITY_MONTHS_TXT", $i < 10 ? "0" . $i : $i);
00722                         if ($this->error != "" &&
00723                                 isset($_POST['validity']['month']))
00724                         {
00725                                 if ($_POST['validity']['month'] == $i)
00726                                 {
00727                                         $this->tpl->setVariable("LOOP_VALIDITY_MONTHS_SELECTED", " selected");
00728                                 }
00729                         }
00730                         else
00731                         {
00732                                 if ($_SESSION["bmf"]["credit_card"]["gueltigkeit"]["monat"] == $i)
00733                                 {
00734                                         $this->tpl->setVariable("LOOP_VALIDITY_MONTHS_SELECTED", " selected");
00735                                 }
00736                         }
00737                         $this->tpl->parseCurrentBlock("loop_validity_months");
00738                 }
00739                 for ($i = date("Y"); $i <= (date("Y")+6); $i++)
00740                 {
00741                         $this->tpl->setCurrentBlock("loop_validity_years");
00742                         $this->tpl->setVariable("LOOP_VALIDITY_YEARS", $i);
00743                         $this->tpl->setVariable("LOOP_VALIDITY_YEARS_TXT", $i);
00744                         if ($this->error != "" &&
00745                                 isset($_POST['validity']['year']))
00746                         {
00747                                 if ($_POST['validity']['year'] == $i)
00748                                 {
00749                                         $this->tpl->setVariable("LOOP_VALIDITY_YEARS_SELECTED", " selected");
00750                                 }
00751                         }
00752                         else
00753                         {
00754                                 if ($_SESSION["bmf"]["credit_card"]["gueltigkeit"]["jahr"] == $i)
00755                                 {
00756                                         $this->tpl->setVariable("LOOP_VALIDITY_YEARS_SELECTED", " selected");
00757                                 }
00758                         }
00759                         $this->tpl->parseCurrentBlock("loop_validity_years");
00760                 }
00761 /*              if ($this->error != "" &&
00762                         isset($_POST["terms_conditions"]))
00763                 {
00764                         $this->tpl->setVariable("TERMS_CONDITIONS_" . $_POST["terms_conditions"], " checked") ;
00765                 }*/
00766 /*              if ($this->error != "" &&
00767                         isset($_POST["password"]))
00768                 {
00769                         $this->tpl->setVariable("PASSWORD", ilUtil::prepareFormOutput($_POST['password'],true));
00770                 }*/
00771 
00772                 // Button
00773                 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00774                 $this->tpl->setCurrentBlock("btn_cell");
00775                 $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "showPaymentType"));
00776                 $this->tpl->setVariable("BTN_TXT", $this->lng->txt('pay_bmf_back'));
00777                 $this->tpl->parseCurrentBlock("btn_cell");
00778 
00779                 }
00780         }
00781 
00782         function getCreditCard()
00783         {
00784                 if ($_POST["card_holder"] == "" ||
00785                         $_POST["card_number"]["block_1"] == "" ||
00786                         $_POST["card_number"]["block_2"] == "" ||
00787                         $_POST["card_number"]["block_3"] == "" ||
00788                         $_POST["card_number"]["block_4"] == "" ||
00789                         $_POST["validity"]["month"] == "" ||
00790                         $_POST["validity"]["year"] == "" ||
00791                         $_POST["validity"]["year"]."-".$_POST["validity"]["month"] < date("Y-m"))
00792                 {
00793                         $this->error = $this->lng->txt('pay_bmf_credit_card_not_valid');
00794                         sendInfo($this->error);
00795                         $this->showCreditCard();
00796                         return;
00797                 }
00798                 if ($_POST["terms_conditions"] != 1)
00799                 {
00800                         $this->error = $this->lng->txt('pay_bmf_check_terms_conditions');
00801                         sendInfo($this->error);
00802                         $this->showCreditCard();
00803                         return;
00804                 }
00805                 if ($_POST["password"] == "" ||
00806                         md5($_POST["password"]) != $this->user_obj->getPasswd())
00807                 {
00808                         $this->error = $this->lng->txt('pay_bmf_password_not_valid');
00809                         sendInfo($this->error);
00810                         $this->showCreditCard();
00811                         return;
00812                 }
00813 
00814                 $_SESSION["bmf"]["credit_card"]["gueltigkeit"]["monat"] = $_POST["validity"]["month"];
00815                 $_SESSION["bmf"]["credit_card"]["gueltigkeit"]["jahr"] = $_POST["validity"]["year"];
00816                 $_SESSION["bmf"]["credit_card"]["karteninhaber"] = $_POST["card_holder"];
00817                 $_SESSION["bmf"]["credit_card"]["kreditkartenNr"]["block_1"] = $_POST["card_number"]["block_1"];
00818                 $_SESSION["bmf"]["credit_card"]["kreditkartenNr"]["block_2"] = $_POST["card_number"]["block_2"];
00819                 $_SESSION["bmf"]["credit_card"]["kreditkartenNr"]["block_3"] = $_POST["card_number"]["block_3"];
00820                 $_SESSION["bmf"]["credit_card"]["kreditkartenNr"]["block_4"] = $_POST["card_number"]["block_4"];
00821                 $_SESSION["bmf"]["credit_card"]["kartenpruefnummer"] = $_POST["check_number"];
00822 
00823                 $this->error = "";
00824                 $this->sendCreditCard();
00825         }
00826 
00827         function sendCreditCard()
00828         {
00829 
00830                 $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
00831 
00832                 if(!count($items = $this->psc_obj->getEntries()))
00833                 {
00834 
00835                         $this->tpl->setVariable("HEADER",$this->lng->txt('pay_bmf_your_order'));
00836                         $this->tpl->touchBlock("stop_floating");
00837                         sendInfo($this->lng->txt('pay_shopping_cart_empty'));
00838 
00839                 }
00840                 else
00841                 {
00842 
00843                 $payment = new KreditkartenzahlungWS();
00844 
00845                 $customer = new Kunde($this->user_obj->getId());
00846 
00847                 $creditCard = new Kreditkarte();
00848 
00849                 $sc_obj =& new ilPaymentShoppingCart($this->user_obj);
00850 
00851                 $tmp_bookEntries = $sc_obj->getShoppingCart();
00852                 if (!is_array($tmp_bookEntries))
00853                 {
00854                         sendInfo($this->lng->txt('pay_shopping_cart_empty'));
00855                 }
00856                 else
00857                 {
00858                         $totalAmount = 0;
00859                         for ($i = 0; $i < count($tmp_bookEntries); $i++)
00860                         {
00861                                 $bookEntries[] = new Buchung($tmp_bookEntries[$i]);
00862                                 $totalAmount += $tmp_bookEntries[$i]["betrag"];
00863                         }
00864 
00865                         $values = array("betrag" => $totalAmount, "buchungen" => $bookEntries);
00866                         $bookingList = new BuchungsListe($this->user_obj->getId(), $values);
00867                 }
00868 
00869 #               vd($customer);
00870 #               vd($creditCard);
00871 #               vd($bookingList);
00872 
00873                 $resultObj = $payment->zahlenUndAnlegenKunde($customer, $creditCard, $bookingList);
00874                 $result = $resultObj->ergebnis;
00875 
00876 #               vd($result);
00877 
00878                 if (is_object($result))
00879                 {
00880                         if ($result->code < 0)
00881                         {
00882                                 $this->tpl->setVariable("HEADER",$this->lng->txt('error'));
00883                                 $this->tpl->touchBlock("stop_floating");
00884                                 $error = $this->lng->txt('pay_bmf_server_error_code') . " " . $result->code . ": " . $result->kurzText . "<br>\n" . $result->langText;
00885                                 if ($result->code == -103 ||
00886                                         $result->code == -104 ||
00887                                         $result->code == -107 ||
00888                                         ($result->code <= -202 && $result->code >= -208) ||
00889                                         $result->code == -213)
00890                                 {
00891                                         sendInfo($error);
00892                                         $this->showPersonalData();
00893                                 }
00894                                 else if ($result->code == -507 ||
00895                                         $result->code == -510 ||
00896                                         $result->code == -511)
00897                                 {
00898                                         sendInfo($error);
00899                                         $this->showPaymentType();
00900                                 }
00901                                 else if ($result->code == -701 ||
00902                                         $result->code == -1701 ||
00903                                         $result->code == -1706 ||
00904                                         $result->code == -1707 ||
00905                                         $result->code == -1710 ||
00906                                         $result->code == -1711)
00907                                 {
00908                                         sendInfo($error);
00909                                         $this->showCreditCard();
00910                                 }
00911                                 else
00912                                 {
00913                                         $error .= "<br>\n" . $this->lng->txt('pay_bmf_server_error_sysadmin');
00914                                         sendInfo($error);
00915                                         $this->showPersonalData();
00916                                 }
00917 
00918                         }
00919                         else
00920                         {
00921                                 // everything ok => send confirmation, fill statistik, delete session, delete shopping cart.
00922                                 $this->__sendBill($customer, $_SESSION["bmf"]["payment_type"], $bookingList, $resultObj);
00923 
00924                                 $this->__addBookings($resultObj,$bookingList->getTransaction());
00925                                 $this->__emptyShoppingCart();
00926                                 $this->__clearSession();
00927 
00928                                 $this->tpl->setVariable("HEADER",$this->lng->txt('pay_bmf_your_order'));
00929                                 $this->tpl->setVariable("DESCRIPTION",$this->lng->txt('pay_bmf_thanks'));
00930                                 $this->tpl->touchBlock("stop_floating");
00931 
00932                                 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.pay_bmf_credit_card.html','payment');
00933                                 if ($this->ilias->getSetting("https") != 1)
00934                                 {
00935                                         $this->tpl->setCurrentBlock("buyed_objects");
00936                                         $this->tpl->setVariable("LINK_GOTO_BUYED_OBJECTS", "payment/payment.php?cmdClass=ilpaymentbuyedobjectsgui&cmdNode=2");
00937                                         $this->tpl->setVariable("TXT_GOTO_BUYED_OBJECTS", $this->lng->txt('pay_goto_buyed_objects'));
00938                                         $this->tpl->parseCurrentBlock("buyed_objects");
00939                                 }
00940                                 $this->tpl->setVariable("TXT_CLOSE_WINDOW", $this->lng->txt('close_window'));
00941                         }
00942                 }
00943                 else
00944                 {
00945                         $this->tpl->setVariable("HEADER",$this->lng->txt('error'));
00946                         $this->tpl->touchBlock("stop_floating");
00947                         sendInfo($this->lng->txt('pay_bmf_server_error_communication'));
00948                 }
00949 
00950                 }
00951 
00952         }
00953 
00957         function &executeCommand()
00958         {
00959                 global $tree;
00960 
00961                 $cmd = $this->ctrl->getCmd();
00962                 switch ($this->ctrl->getNextClass($this))
00963                 {
00964 
00965                         default:
00966                                 if(!$cmd = $this->ctrl->getCmd())
00967                                 {
00968                                         $cmd = 'showPersonalData';
00969                                 }
00970                                 $this->$cmd();
00971                                 break;
00972                 }
00973         }
00974 
00975         // PRIVATE
00976         function __sendBill($customer, $paymentType, $bookingList, $result)
00977         {
00978                 include_once './classes/class.ilTemplate.php';
00979                 include_once './classes/class.ilUtil.php';
00980                 include_once './payment/classes/class.ilGeneralSettings.php';
00981                 include_once './payment/classes/class.ilPaymentShoppingCart.php';
00982                 include_once './classes/class.ilMimeMail.php';
00983                 
00984                 $sc_obj =& new ilPaymentShoppingCart($this->user_obj);
00985                 $genSet = new ilGeneralSettings();
00986 
00987                 $tpl = new ilTemplate("./payment/templates/default/tpl.pay_bmf_bill.html", true, true, true);
00988   
00989                 $tpl->setVariable("VENDOR_ADDRESS", nl2br(utf8_decode($genSet->get("address"))));
00990                 $tpl->setVariable("VENDOR_ADD_INFO", nl2br(utf8_decode($genSet->get("add_info"))));
00991                 $tpl->setVariable("VENDOR_BANK_DATA", nl2br(utf8_decode($genSet->get("bank_data"))));
00992                 $tpl->setVariable("TXT_BANK_DATA", utf8_decode($this->lng->txt("pay_bank_data")));
00993 
00994                 $tpl->setVariable("CUSTOMER_FIRSTNAME", $customer->vorname);
00995                 $tpl->setVariable("CUSTOMER_LASTNAME", $customer->nachname);
00996                 if ($customer->rechnungsAdresse->strasse != "" &&
00997                         $customer->rechnungsAdresse->hausNr != "")
00998                 {
00999                         $tpl->setVariable("CUSTOMER_STREET_POBOX", $customer->rechnungsAdresse->strasse . " ". $customer->rechnungsAdresse->hausNr);
01000                 }
01001                 else
01002                 {
01003                         $tpl->setVariable("CUSTOMER_STREET_POBOX", $customer->rechnungsAdresse->postfach);
01004                 }
01005                 $tpl->setVariable("CUSTOMER_ZIPCODE", $customer->rechnungsAdresse->PLZ);
01006                 $tpl->setVariable("CUSTOMER_CITY", $customer->rechnungsAdresse->ort);
01007                 $tpl->setVariable("CUSTOMER_COUNTRY", $this->__getCountryName($customer->rechnungsAdresse->land));
01008 
01009                 $tpl->setVariable("BILL_NO", $result->buchungsListe->kassenzeichen);
01010                 $tpl->setVariable("DATE", date("d.m.Y"));
01011 
01012                 $tpl->setVariable("TXT_BILL", utf8_decode($this->lng->txt("pays_bill")));
01013                 $tpl->setVariable("TXT_BILL_NO", utf8_decode($this->lng->txt("pay_bill_no")));
01014                 $tpl->setVariable("TXT_DATE", utf8_decode($this->lng->txt("date")));
01015 
01016                 $tpl->setVariable("TXT_ARTICLE", utf8_decode($this->lng->txt("pay_article")));
01017                 $tpl->setVariable("TXT_PRICE", utf8_decode($this->lng->txt("price_a")));
01018 
01019                 $bookEntries = $sc_obj->getShoppingCart();
01020                 for ($i = 0; $i < count($bookEntries); $i++)
01021                 {
01022                         $tpl->setCurrentBlock("loop");
01023                         $tpl->setVariable("LOOP_OBJ_TYPE", utf8_decode($this->lng->txt($bookEntries[$i]["typ"])));
01024                         $tpl->setVariable("LOOP_TITLE", $bookEntries[$i]["buchungstext"]);
01025                         $tpl->setVariable("LOOP_TXT_ENTITLED_RETRIEVE", utf8_decode($this->lng->txt("pay_entitled_retrieve")));
01026                         $tpl->setVariable("LOOP_DURATION", $bookEntries[$i]["dauer"] . " " . utf8_decode($this->lng->txt("paya_months")));
01027                         $tpl->setVariable("LOOP_PRICE", number_format($bookEntries[$i]["betrag"], 2, ",", ".") . " " . $genSet->get("currency_unit"));
01028                         $tpl->parseCurrentBlock("loop");
01029                 }
01030 
01031                 $tpl->setVariable("TXT_TOTAL_AMOUNT", utf8_decode($this->lng->txt("pay_bmf_total_amount")));
01032                 $tpl->setVariable("TOTAL_AMOUNT", number_format($bookingList->betrag, 2, ",", ".") . " " . $genSet->get("currency_unit"));
01033                 if (($vat = $sc_obj->getVat($bookingList->betrag)) > 0)
01034                 {
01035                         $tpl->setVariable("VAT", number_format($vat, 2, ",", ".") . " " . $genSet->get("currency_unit"));
01036                         $tpl->setVariable("TXT_VAT", $genSet->get("vat_rate") . "% " . utf8_decode($this->lng->txt("pay_bmf_vat_included")));
01037                 }
01038 
01039                 if ($paymentType == "debit_entry")
01040                 {
01041                         $tpl->setVariable("TXT_PAYMENT_TYPE", utf8_decode($this->lng->txt("pay_payed_debit_entry")));
01042                 }
01043                 else
01044                 {
01045                         $tpl->setVariable("TXT_PAYMENT_TYPE", utf8_decode($this->lng->txt("pay_payed_credit_card")));
01046                 }
01047 
01048                 if (!@file_exists($genSet->get("pdf_path")))
01049                 {
01050                         ilUtil::makeDir($genSet->get("pdf_path"));
01051                 }
01052 
01053                 if (@file_exists($genSet->get("pdf_path")))
01054                 {
01055                         ilUtil::html2pdf($tpl->get(), $genSet->get("pdf_path") . "/" . $result->buchungsListe->kassenzeichen . ".pdf");
01056                 }
01057 
01058                 if (@file_exists($genSet->get("pdf_path") . "/" . $result->buchungsListe->kassenzeichen . ".pdf") &&
01059                         $customer->EMailAdresse != "" &&
01060                         $this->ilias->getSetting("admin_email") != "")
01061                 {
01062                         $m= new ilMimeMail; // create the mail
01063                         $m->From( $this->ilias->getSetting("admin_email") );
01064                         $m->To( $customer->EMailAdresse );
01065                         $m->Subject( $this->lng->txt("pay_message_subject") );  
01066                         $message = $this->lng->txt("pay_message_hello") . " " . utf8_encode($customer->vorname) . " " . utf8_encode($customer->nachname) . ",\n\n";
01067                         $message .= $this->lng->txt("pay_message_thanks") . "\n\n";
01068                         $message .= $this->lng->txt("pay_message_attachment") . "\n\n";
01069                         $message .= $this->lng->txt("pay_message_regards") . "\n\n";
01070                         $message .= strip_tags($genSet->get("address"));
01071                         $m->Body( $message );   // set the body
01072                         $m->Attach( $genSet->get("pdf_path") . "/" . $result->buchungsListe->kassenzeichen . ".pdf", "application/pdf" ) ;      // attach a file of type image/gif
01073                         $m->Send();     // send the mail
01074                 }
01075 
01076                 @unlink($genSet->get("pdf_path") . "/" . $result->buchungsListe->kassenzeichen . ".html");
01077                 @unlink($genSet->get("pdf_path") . "/" . $result->buchungsListe->kassenzeichen . ".pdf");
01078 
01079         }
01080 
01081         function __addBookings($a_result,$a_transaction)
01082         {
01083                 include_once './payment/classes/class.ilPaymentBookings.php';
01084                 include_once './payment/classes/class.ilPaymentShoppingCart.php';
01085                 include_once './payment/classes/class.ilPaymentObject.php';
01086                 include_once './payment/classes/class.ilPaymentPrices.php';
01087                 
01088                 $booking_obj =& new ilPaymentBookings();
01089                 
01090                 $sc_obj =& new ilPaymentShoppingCart($this->user_obj);
01091 
01092                 $i = 0;
01093                 foreach($sc_obj->getEntries() as $entry)
01094                 {
01095                         $pobject =& new ilPaymentObject($this->user_obj,$entry['pobject_id']);
01096 
01097                         $price = ilPaymentPrices::_getPrice($entry['price_id']);
01098 
01099                         $booking_obj->setTransaction($a_transaction);
01100                         $booking_obj->setPobjectId($entry['pobject_id']);
01101                         $booking_obj->setCustomerId($this->user_obj->getId());
01102                         $booking_obj->setVendorId($pobject->getVendorId());
01103                         $booking_obj->setPayMethod($pobject->getPayMethod());
01104                         $booking_obj->setOrderDate(time());
01105                         $booking_obj->setDuration($price['duration']);
01106                         $booking_obj->setPrice(ilPaymentPrices::_getPriceString($entry['price_id']));
01107                         $booking_obj->setPayed(1);
01108                         $booking_obj->setAccess(1);
01109                         $booking_obj->setVoucher($a_result->buchungsListe->buchungen[$i++]->belegNr);
01110                         $booking_obj->setTransactionExtern($a_result->buchungsListe->kassenzeichen);
01111 
01112                         $booking_obj->add();
01113 
01114                         unset($pobject);
01115                 }
01116         }
01117 
01118         function __emptyShoppingCart()
01119         {
01120                 include_once './payment/classes/class.ilPaymentShoppingCart.php';
01121                 
01122                 $sc_obj =& new ilPaymentShoppingCart($this->user_obj);
01123 
01124                 return $sc_obj->emptyShoppingCart();
01125         }
01126                 
01127         function __clearSession()
01128         {
01129                 $_SESSION["bmf"]["payment_type"] = "";
01130                 $_SESSION["bmf"]["debit_entry"] = "";
01131                 $_SESSION["bmf"]["credit_card"] = "";
01132         }
01133 
01134         function __loadTemplate()
01135         {
01136                 $this->tpl->addBlockFile("CONTENT", "content", "tpl.payb_content.html");
01137 
01138                 $this->__buildStylesheet();
01139                 $this->__buildStatusline();
01140         }
01141 
01142         function  __buildStatusline()
01143         {
01144                 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
01145 #               $this->__buildLocator();
01146         }
01147 
01148         function __buildLocator()
01149         {
01150                 $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html");
01151                 $this->tpl->setVariable("TXT_LOCATOR",$this->lng->txt("locator"));
01152 
01153                 $this->tpl->setCurrentBlock("locator_item");
01154                 $this->tpl->setVariable("ITEM", $this->lng->txt("personal_desktop"));
01155                 $this->tpl->setVariable("LINK_ITEM","../ilias.php?baseClass=ilPersonalDesktopGUI");
01156                 #$this->tpl->setVariable("LINK_ITEM", "../usr_personaldesktop.php");
01157                 $this->tpl->parseCurrentBlock();
01158 
01159                 $this->tpl->setCurrentBlock("locator_item");
01160                 $this->tpl->setVariable("PREFIX",'>&nbsp;');
01161 #               $this->tpl->setVariable("ITEM", $this->lng->txt("pay_locator"));
01162                 $this->tpl->setVariable("ITEM", "Payment");
01163                 $this->tpl->setVariable("LINK_ITEM", "./payment.php");
01164                 $this->tpl->parseCurrentBlock();
01165 
01166                 // CHECK for new mail and info
01167                 sendInfo();
01168 
01169                 return true;
01170         }
01171 
01172         function __buildStylesheet()
01173         {
01174                 $this->tpl->setVariable("LOCATION_STYLESHEET",ilUtil::getStyleSheetLocation());
01175                 $this->tpl->setVariable("LOCATION_JAVASCRIPT",ilUtil::getJSPath('functions.js'));
01176         }
01177 
01181         function __showCountries(&$tpl, $value = "")
01182         {
01183                 $countries = $this->__getCountries();
01184                 foreach($countries as $code => $text)
01185                 {
01186                         $tpl->setCurrentBlock("loop_countries");
01187                         $tpl->setVariable("LOOP_COUNTRIES", $code);
01188                         $tpl->setVariable("LOOP_COUNTRIES_TXT", $text);
01189                         if ($value != "" &&
01190                                 $value == $code)
01191                         {
01192                                 $tpl->setVariable("LOOP_COUNTRIES_SELECTED", " selected");
01193                         }
01194                         $tpl->parseCurrentBlock("loop_countries");
01195                 }
01196                 $tpl->setVariable("TXT_PLEASE_SELECT", $this->lng->txt("pay_bmf_please_select"));
01197                 return;
01198         }
01199 
01200         function __getCountries()
01201         {
01202                 global $lng;
01203 
01204                 $lng->loadLanguageModule("meta");
01205 
01206                 $cntcodes = array ("DE","ES","FR","GB","AT","CH","AF","AL","DZ","AS","AD","AO",
01207                         "AI","AQ","AG","AR","AM","AW","AU","AT","AZ","BS","BH","BD","BB","BY",
01208                         "BE","BZ","BJ","BM","BT","BO","BA","BW","BV","BR","IO","BN","BG","BF",
01209                         "BI","KH","CM","CA","CV","KY","CF","TD","CL","CN","CX","CC","CO","KM",
01210                         "CG","CK","CR","CI","HR","CU","CY","CZ","DK","DJ","DM","DO","TP","EC",
01211                         "EG","SV","GQ","ER","EE","ET","FK","FO","FJ","FI","FR","FX","GF","PF",
01212                         "TF","GA","GM","GE","DE","GH","GI","GR","GL","GD","GP","GU","GT","GN",
01213                         "GW","GY","HT","HM","HN","HU","IS","IN","ID","IR","IQ","IE","IL","IT",
01214                         "JM","JP","JO","KZ","KE","KI","KP","KR","KW","KG","LA","LV","LB","LS",
01215                         "LR","LY","LI","LT","LU","MO","MK","MG","MW","MY","MV","ML","MT","MH",
01216                         "MQ","MR","MU","YT","MX","FM","MD","MC","MN","MS","MA","MZ","MM","NA",
01217                         "NR","NP","NL","AN","NC","NZ","NI","NE","NG","NU","NF","MP","NO","OM",
01218                         "PK","PW","PA","PG","PY","PE","PH","PN","PL","PT","PR","QA","RE","RO",
01219                         "RU","RW","KN","LC","VC","WS","SM","ST","SA","CH","SN","SC","SL","SG",
01220                         "SK","SI","SB","SO","ZA","GS","ES","LK","SH","PM","SD","SR","SJ","SZ",
01221                         "SE","SY","TW","TJ","TZ","TH","TG","TK","TO","TT","TN","TR","TM","TC",
01222                         "TV","UG","UA","AE","GB","UY","US","UM","UZ","VU","VA","VE","VN","VG",
01223                         "VI","WF","EH","YE","ZR","ZM","ZW");
01224                 $cntrs = array();
01225                 foreach($cntcodes as $cntcode)
01226                 {
01227                         $cntrs[$cntcode] = $lng->txt("meta_c_".$cntcode);
01228                 }
01229                 asort($cntrs);
01230                 return $cntrs;
01231         }
01232 
01233         function __getCountryCode($value = "")
01234         {
01235                 $countries = $this->__getCountries();
01236                 foreach($countries as $code => $text)
01237                 {
01238                         if ($text == $value)
01239                         {
01240                                 return $code;
01241                         }
01242                 }
01243                 return;
01244         }
01245 
01246         function __getCountryName($value = "")
01247         {
01248                 $countries = $this->__getCountries();
01249                 return $countries[$value];
01250         }
01251 
01252 /*      function __getShoppingCart()
01253         {
01254                 $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
01255 
01256                 if(!count($items = $this->psc_obj->getEntries()))
01257                 {
01258                         return 0;
01259                 }
01260 
01261                 $counter = 0;
01262                 foreach($items as $item)
01263                 {
01264                         $tmp_pobject =& new ilPaymentObject($this->user_obj,$item['pobject_id']);
01265 
01266                         $tmp_obj =& ilObjectFactory::getInstanceByRefId($tmp_pobject->getRefId());
01267 
01268                         $f_result[$counter]["buchungstext"] = $tmp_obj->getTitle();
01269 
01270                         $price_arr = ilPaymentPrices::_getPrice($item['price_id']);
01271 
01272                         $price = (int) $price_arr['unit_value'];
01273 
01274                         if ($price_arr['sub_unit_value'] != "" &&
01275                                 $price_arr['sub_unit_value'] > 0)
01276                         {
01277                                 $price .= '.'.( (int) $price_arr['sub_unit_value']);
01278                         }
01279                         $f_result[$counter]["betrag"] = $price * 1.0;
01280 
01281                         unset($tmp_obj);
01282                         unset($tmp_pobject);
01283 
01284                         ++$counter;
01285                 }
01286                 return $f_result;
01287         }
01288 
01289         function __getTotalAmount()
01290         {
01291                 $amount = 0;
01292 
01293                 if (is_array($result = $this->__getShoppingCart()))
01294                 {
01295                         for ($i = 0; $i < count($result); $i++)
01296                         {
01297                                 $amount += $result[$i]["betrag"];
01298                         }
01299                 }
01300 
01301                 return $amount;
01302         }*/
01303 
01304         function __showShoppingCart()
01305         {
01306 
01307                 $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
01308 
01309                 if(!count($items = $this->psc_obj->getEntries()))
01310                 {
01311                         sendInfo($this->lng->txt('pay_shopping_cart_empty'));
01312                 }
01313 
01314                 $counter = 0;
01315                 foreach($items as $item)
01316                 {
01317                         $tmp_pobject =& new ilPaymentObject($this->user_obj,$item['pobject_id']);
01318 
01319                         $tmp_obj =& ilObjectFactory::getInstanceByRefId($tmp_pobject->getRefId());
01320 
01321                         $price_arr = ilPaymentPrices::_getPrice($item['price_id']);
01322 
01323                         $f_result[$counter][] = $tmp_obj->getTitle();
01324                         $f_result[$counter][] = $price_arr['duration'] . " " . $this->lng->txt("paya_months");
01325 
01326                         $f_result[$counter][] = ilPaymentPrices::_getPriceString($item['price_id']);;
01327 
01328                         unset($tmp_obj);
01329                         unset($tmp_pobject);
01330 
01331                         ++$counter;
01332                 }
01333 
01334                 return $this->__showItemsTable($f_result);
01335         }
01336 
01337         function &__initTableGUI()
01338         {
01339                 include_once "./classes/class.ilTableGUI.php";
01340 
01341                 return new ilTableGUI(0,false);
01342         }
01343 
01344         function __showItemsTable($a_result_set)
01345         {
01346                 include_once './payment/classes/class.ilGeneralSettings.php';
01347                 
01348                 $genSet = new ilGeneralSettings();
01349 
01350                 $tbl =& $this->__initTableGUI();
01351                 $tpl =& $tbl->getTemplateObject();
01352 
01353                 // SET FORMAACTION
01354                 $tpl->setCurrentBlock("tbl_form_header");
01355 
01356                 $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
01357                 $tpl->parseCurrentBlock();
01358 
01359                 $tbl->setTitle($this->lng->txt("paya_shopping_cart"),"icon_pays_b.gif",$this->lng->txt("paya_shopping_cart"));
01360                 $tbl->setHeaderNames(array($this->lng->txt("title"),
01361                                                                    $this->lng->txt("duration"),
01362                                                                    $this->lng->txt("price_a")));
01363 
01364                 $tbl->setHeaderVars(array("title",
01365                                                                   "duration",
01366                                                                   "price"),
01367                                                         array("cmd" => "",
01368                                                                   "cmdClass" => "ilpurchasebmfgui",
01369                                                                   "cmdNode" => $_GET["cmdNode"]));
01370 
01371                 $tbl->disable("footer");
01372                 $tbl->disable("sort");
01373                 $tbl->disable("linkbar");
01374 
01375                 $offset = $_GET["offset"];
01376                 $order = $_GET["sort_by"];
01377                 $direction = $_GET["sort_order"] ? $_GET['sort_order'] : 'desc';
01378 
01379                 $tbl->setOrderColumn($order,'title');
01380                 $tbl->setOrderDirection($direction);
01381                 $tbl->setOffset($offset);
01382                 $tbl->setLimit($_GET["limit"]);
01383                 $tbl->setMaxCount(count($a_result_set));
01384 #               $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
01385                 $tbl->setData($a_result_set);
01386 
01387                 $sc_obj =& new ilPaymentShoppingCart($this->user_obj);
01388 
01389                 $totalAmount =  $sc_obj->getTotalAmount();
01390                 $vat = $sc_obj->getVat($totalAmount);
01391 
01392                 $tpl->setCurrentBlock("tbl_footer_linkbar");
01393                 $amount = "<b>" . $this->lng->txt("pay_bmf_total_amount") . ": " . number_format($totalAmount, 2, ',', '.') . " " . $genSet->get("currency_unit") . "</b>";
01394                 if ($vat > 0)
01395                 {
01396                         $amount .= "<br>\n" . $genSet->get("vat_rate") . "% " . $this->lng->txt("pay_bmf_vat_included") . ": " . number_format($vat, 2, ',', '.') . " " . $genSet->get("currency_unit");
01397                 }
01398                 $tpl->setVariable("LINKBAR", $amount);
01399                 $tpl->parseCurrentBlock("tbl_footer_linkbar");
01400                 $tpl->setCurrentBlock('tbl_footer');
01401                 $tpl->setVariable('COLUMN_COUNT',3);
01402                 $tpl->parseCurrentBlock();
01403                 $tbl->render();
01404 
01405                 $this->tpl->setVariable("ITEMS_TABLE",$tbl->tpl->get());
01406 
01407                 return true;
01408         }
01409 
01410 }
01411 
01412 class KundenstammdatenPflegeWS
01413 {
01414    
01415         var $_soapClient = NULL;
01416       
01417         function KundenstammdatenPflegeWS ()
01418         {
01419                 global $bmfConfig;
01420 
01421                 $this->_soapClient = new ilBMFClient($bmfConfig["ePaymentServer"], false, false, array('curl' => array(CURLOPT_SSLCERT => $bmfConfig["clientCertificate"], CURLE_SSL_PEER_CERTIFICATE => $bmfConfig["caCertificate"], CURLOPT_TIMEOUT => (int)$bmfConfig["timeOut"])));
01422         }
01423       
01424         function anlegenKunde ($customer)
01425         {
01426                 global $bmfConfig;
01427 
01428                 $tmp = array(
01429                         'mandantNr' => $bmfConfig["mandantNr"],
01430                         'kunde' => $customer
01431                 );
01432 
01433                 $result = $this->_soapClient->call("anlegenKunde", $tmp, "KundenstammdatenPflegeWS");
01434                 return $result;
01435       }
01436 
01437 };
01438 
01439 class KreditkartenzahlungWS
01440 {
01441         var $_soapClient = NULL;
01442 
01443         function KreditkartenzahlungWS()
01444         {
01445                 global $bmfConfig;
01446 
01447                 $this->_soapClient = new ilBMFClient($bmfConfig["ePaymentServer"], false, false, array('curl' => array(CURLOPT_SSLCERT => $bmfConfig["clientCertificate"], CURLE_SSL_PEER_CERTIFICATE => $bmfConfig["caCertificate"], CURLOPT_TIMEOUT => (int)$bmfConfig["timeOut"])));
01448         }
01449 
01450         function validierenKreditkarte($creditCard)
01451         {
01452                 global $bmfConfig;
01453 
01454                 $tmp = array(
01455                         'mandantNr' => $bmfConfig["mandantNr"],
01456                         'kreditkarte' => $creditCard,
01457                         'waehrungskennzeichen' => $bmfConfig["waehrungskennzeichen"]
01458                 );
01459 
01460                 $result = $this->_soapClient->call("validierenKreditkarte", $tmp, "KreditkartenzahlungWS");
01461                 return $result;
01462         }
01463 
01464         function zahlenUndAnlegenKunde($customer, $creditCard, $bookingList)
01465         {
01466                 global $bmfConfig;
01467 
01468                 $lieferadresse = new LieferAdresse();
01469 
01470                 $tmp = array(
01471                         'mandantNr' => $bmfConfig["mandantNr"],
01472                         'Kunde' => $customer,
01473                         'Kreditkarte' => $creditCard,
01474                         'buchungsListe' => $bookingList,
01475                         'lieferadresse' => $lieferadresse
01476                 );
01477 
01478                 $result = $this->_soapClient->call("zahlenUndAnlegenKunde", $tmp, "KreditkartenzahlungWS");
01479                 return $result;
01480         }
01481 }
01482 
01483 class LastschriftWS
01484 {
01485 
01486         var $_soapClient = NULL;
01487 
01488         function LastschriftWS ()
01489         {
01490                 global $bmfConfig;
01491 
01492                 $this->_soapClient = new ilBMFClient($bmfConfig["ePaymentServer"], false, false, array('curl' => array(CURLOPT_SSLCERT => $bmfConfig["clientCertificate"], CURLE_SSL_PEER_CERTIFICATE => $bmfConfig["caCertificate"], CURLOPT_TIMEOUT => (int)$bmfConfig["timeOut"])));
01493         }
01494       
01495         function abbuchenOhneEinzugsermaechtigung($eShopCustomerNumber, $address, $bank, $bookingList)
01496         {
01497                 global $bmfConfig;
01498 
01499                 $tmp = array(
01500                         'mandantNr' => $bmfConfig["mandantNr"],
01501                         'eShopKundenNr' => $eShopCustomerNumber,
01502                         'lieferAdresse' => $address,
01503                         'bankverbindung' => $bank,
01504                         'buchungsListe' => $bookingList
01505                 );
01506 
01507                 $result = $this->_soapClient->call("abbuchenOhneEinzugsermaechtigung", $tmp, "LastschriftWS");
01508                 return $result;
01509         }
01510 
01511 };
01512 
01513 class Kunde
01514 {
01515     var $OBJTypeNS = array ('namespace' => 'http://www.bff.bund.de/ePayment' , 'type' => 'Kunde');
01516 
01517         function Kunde ($customerNumber = "", $values = "")
01518     {
01519 /*              if ($customerNumber != "")
01520                 {
01521                         $this->EShopKundenNr = $customerNumber;
01522                 }
01523                 else
01524                 {*/
01525                         $this->EShopKundenNr = time() . "_" . substr(md5(uniqid(rand(), true)), 0, 4);
01526                 if ($customerNumber != "")
01527                 {
01528                         $this->EShopKundenNr = $customerNumber . "_" . time() . "_" . substr(md5(uniqid(rand(), true)), 0, 4);
01529                 }
01530 /*              }*/
01531 
01532                 if ($values == "")
01533                 {
01534                         $values = $_SESSION["bmf"]["personal_data"];
01535                 }
01536 
01537                 if ($values["sprache"] != NULL)
01538                 {
01539                         $this->sprache = $values["sprache"];
01540                 }
01541                 if ($values["vorname"] != NULL)
01542                 {
01543                         $this->vorname = utf8_decode($values["vorname"]);
01544                 }
01545                 if ($values["nachname"] != NULL)
01546                 {
01547                         $this->nachname = utf8_decode($values["nachname"]);
01548                 }
01549                 if ($values["EMailAdresse"] != NULL)
01550                 {
01551                         $this->EMailAdresse = utf8_decode($values["EMailAdresse"]);
01552                 }
01553 
01554                 $address = new Adresse();
01555 
01556                 $this->rechnungsAdresse = $address;
01557         }
01558 
01559         function getEShopCustomerNumber()
01560         {
01561                 return $this->EShopKundenNr;
01562         }
01563 
01564 }
01565 
01566 class Adresse
01567 {
01568     var $OBJTypeNS = array ('namespace' => 'http://www.bff.bund.de/ePayment' , 'type' => 'Adresse');
01569 
01570         function Adresse ($values = "")
01571     {
01572                 if ($values == "")
01573                 {
01574                         $values = $_SESSION["bmf"]["personal_data"];
01575                 }
01576 
01577                 if (is_array($values))
01578                 {
01579                         if ($values["strasse"] != NULL)
01580                         {
01581                                 $this->strasse = utf8_decode($values["strasse"]);
01582                         }
01583                         if ($values["hausNr"] != NULL)
01584                         {
01585                                 $this->hausNr = utf8_decode($values["hausNr"]);
01586                         }
01587                         if ($values["postfach"] != NULL)
01588                         {
01589                                 $this->postfach = utf8_decode($values["postfach"]);
01590                         }
01591                         if ($values["land"] != NULL)
01592                         {
01593                                 $this->land = utf8_decode($values["land"]);
01594                         }
01595                         if ($values["PLZ"] != NULL)
01596                         {
01597                                 $this->PLZ = utf8_decode($values["PLZ"]);
01598                         }
01599                         if ($values["ort"] != NULL)
01600                         {
01601                                 $this->ort = utf8_decode($values["ort"]);
01602                         }
01603                 }
01604         }
01605 
01606 }
01607 
01608 class Kreditkarte
01609 {
01610     var $OBJTypeNS = array ('namespace' => 'http://www.bff.bund.de/ePayment' , 'type' => 'Kreditkarte');
01611 
01612         function Kreditkarte ($values = "")
01613     {
01614                 if ($values == "")
01615                 {
01616                         $values = $_SESSION["bmf"]["credit_card"];
01617                 }
01618 
01619                 if (is_array($values))
01620                 {
01621                         if ($values["karteninhaber"] != NULL)
01622                         {
01623                                 $this->karteninhaber = utf8_decode($values["karteninhaber"]);
01624                         }
01625                         if ($values["kartenpruefnummer"] != NULL)
01626                         {
01627                                 $this->kartenpruefnummer = utf8_decode($values["kartenpruefnummer"]);
01628                         }
01629                         if (is_array ($values["kreditkartenNr"]) &&
01630                                 count($values["kreditkartenNr"]) == 4)
01631                         {
01632                                 for ($i = 1; $i <= count($values["kreditkartenNr"]); $i++)
01633                                 {
01634                                         $this->kreditkartenNr .= utf8_decode($values["kreditkartenNr"]["block_".$i]);# . "-";
01635                                 }
01636 #                               $this->kreditkartenNr = substr($this->kreditkartenNr, 0, strlen($this->kreditkartenNr)-1);
01637                         }
01638                         if (is_array($values["gueltigkeit"]) &&
01639                                 $values["gueltigkeit"]["monat"] != "" &&
01640                                 $values["gueltigkeit"]["jahr"] != "")
01641                         {
01642                                 $this->gueltigkeit = utf8_decode($values["gueltigkeit"]["monat"]);
01643                                 $this->gueltigkeit .= utf8_decode($values["gueltigkeit"]["jahr"]);
01644                         }
01645                 }
01646         }
01647 
01648 }
01649 
01650 class Lastschrift
01651 {
01652     var $OBJTypeNS = array ('namespace' => 'http://www.bff.bund.de/ePayment' , 'type' => 'Lastschrift');
01653 
01654         function Lastschrift ($customerNumber = "", $values = "")
01655     {
01656                 $this->EShopKundenNr = time() . "_" . substr(md5(uniqid(rand(), true)), 0, 4);
01657                 if ($customerNumber != "")
01658                 {
01659                         $this->EShopKundenNr = $customerNumber . "_" . time() . "_" . substr(md5(uniqid(rand(), true)), 0, 4);
01660                 }
01661         }
01662 
01663 }
01664 
01665 class Bankverbindung
01666 {
01667     var $OBJTypeNS = array ('namespace' => 'http://www.bff.bund.de/ePayment' , 'type' => 'Bankverbindung');
01668 
01669         function Bankverbindung ($values = "")
01670     {
01671                 if ($values == "")
01672                 {
01673                         $values = $_SESSION["bmf"]["debit_entry"];
01674                 }
01675 
01676                 if (is_array($values))
01677                 {
01678                         if ($values["kontoinhaber"] != NULL)
01679                         {
01680                                 $this->kontoinhaber = utf8_decode($values["kontoinhaber"]);
01681                         }
01682                         if ($values["kontoNr"] != NULL)
01683                         {
01684                                 $this->kontoNr = utf8_decode($values["kontoNr"]);
01685                         }
01686                         if ($values["BLZ"] != NULL)
01687                         {
01688                                 $this->BLZ = utf8_decode($values["BLZ"]);
01689                         }
01690                 }
01691         }
01692 
01693 }
01694 
01695 class Buchung
01696 {
01697     var $OBJTypeNS = array ('namespace' => 'http://schemas.xmlsoap.org/soap/encoding/', 'nsPrefix' => 'ns3', 'type' => 'Buchung', 'pnamespace' => 'http://www.bff.bund.de/ePayment', 'pnsPrefix' => 'ns2', 'item' => 'ns2:Buchung');
01698 
01699     function Buchung($values = "")
01700     {
01701                 global $bmfConfig;
01702 
01703                 if ($bmfConfig["haushaltsstelle"] != NULL)
01704                 {
01705                         $this->haushaltsstelle = $bmfConfig["haushaltsstelle"];
01706                 }
01707                 if ($bmfConfig["objektNr"] != NULL)
01708                 {
01709                         $this->objektnummer = $bmfConfig["objektNr"];
01710                 }
01711 
01712                 if (is_array($values))
01713                 {
01714                         if ($values["buchungstext"] != NULL)
01715                         {
01716                                 $buchungstext = utf8_decode($values["buchungstext"]);
01717                                 if(strlen($buchungstext) > 16)
01718                                 {
01719                                         $buchungstext = substr($buchungstext,0,15).'...';
01720                                 }
01721                                 
01722                                 $this->buchungstext = $buchungstext;
01723                         }
01724                         if ($values["betrag"] != "")
01725                         {
01726                                 $this->betrag = $values["betrag"];
01727                         }
01728                 }
01729         }
01730 
01731         /* Die BelegNr wird vom BMF zurück geliefert */
01732         function setVoucherNumber($voucherNumber)
01733         {
01734                 if ($voucherNumber != NULL)
01735                 {
01736                         $this->belegNr = $voucherNumber;
01737                 }
01738         }
01739 
01740         function getVoucherNumber()
01741         {
01742                 return $this->belegNr;
01743         }
01744 }
01745 
01746 class BuchungsListe
01747 {
01748     var $OBJTypeNS = array ('namespace' => 'http://www.bff.bund.de/ePayment', 'nsPrefix' => 'ns2', 'type' => 'BuchungsListe');
01749 
01750     function BuchungsListe($userId, $values = "")
01751     {
01752                 global $bmfConfig,$ilias;
01753 
01754                 if ($bmfConfig["bewirtschafterNr"] != NULL)
01755                 {
01756                         $this->bewirtschafterNr = $bmfConfig["bewirtschafterNr"];
01757                 }
01758                 if ($bmfConfig["waehrungskennzeichen"] != NULL)
01759                 {
01760                         $this->waehrungskennzeichen = $bmfConfig["waehrungskennzeichen"];
01761                 }
01762                 $this->faelligkeitsdatum = date("Y-m-d") . "T" . date("H:i:s") . "Z";
01763                 if ($bmfConfig["kennzeichenMahnverfahren"] != NULL)
01764                 {
01765                         $this->kennzeichenMahnverfahren = $bmfConfig["kennzeichenMahnverfahren"];
01766                 }
01767                 
01768                 $inst_id_time = $ilias->getSetting('inst_id').'_'.$userId.'_'.substr((string) time(),-3);
01769                 $this->EShopTransaktionsNr = $inst_id_time.substr(md5(uniqid(rand(), true)), 0, 4);
01770 
01771                 if (is_array($values))
01772                 {
01773                         if ($values["betrag"] != NULL)
01774                         {
01775                                 $this->betrag = $values["betrag"];
01776                         }
01777                         if ($values["buchungen"] != NULL)
01778                         {
01779                                 $this->buchungen = $values["buchungen"];
01780                         }
01781                 }
01782         }
01783         function getTransaction()
01784         {
01785                 return $this->EShopTransaktionsNr;
01786         }
01787 
01788         /* Das Kassenzeichen wird vom BMF zurück geliefert */
01789         function setKassenzeichen($kassenzeichen)
01790         {
01791                 if ($kassenzeichen != NULL)
01792                 {
01793                         $this->kassenzeichen = $kassenzeichen;
01794                 }
01795         }
01796 
01797         function getKassenzeichen()
01798         {
01799                 return $this->kassenzeichen;
01800         }
01801 
01802 }
01803 
01804 class LieferAdresse
01805 {
01806     var $OBJTypeNS = array ('namespace' => 'http://www.bff.bund.de/ePayment' , 'type' => 'LieferAdresse');
01807 
01808         function LieferAdresse ($values = "")
01809     {
01810                 if ($values == "")
01811                 {
01812                         $values = $_SESSION["bmf"]["personal_data"];
01813                 }
01814 
01815                 if (is_array($values))
01816                 {
01817                         if ($values["vorname"] != NULL)
01818                         {
01819                                 $this->vorname = utf8_decode($values["vorname"]);
01820                         }
01821                         if ($values["nachname"] != NULL)
01822                         {
01823                                 $this->nachname = utf8_decode($values["nachname"]);
01824                         }
01825                         if ($values["strasse"] != NULL)
01826                         {
01827                                 $this->strasse = utf8_decode($values["strasse"]);
01828                         }
01829                         if ($values["hausNr"] != NULL)
01830                         {
01831                                 $this->hausNr = utf8_decode($values["hausNr"]);
01832                         }
01833                         if ($values["postfach"] != NULL)
01834                         {
01835                                 $this->postfach = utf8_decode($values["postfach"]);
01836                         }
01837                         if ($values["land"] != NULL)
01838                         {
01839                                 $this->land = utf8_decode($values["land"]);
01840                         }
01841                         if ($values["PLZ"] != NULL)
01842                         {
01843                                 $this->PLZ = utf8_decode($values["PLZ"]);
01844                         }
01845                         if ($values["ort"] != NULL)
01846                         {
01847                                 $this->ort = utf8_decode($values["ort"]);
01848                         }
01849                 }
01850         }
01851 }
01852 
01853 ?>

Generated on Fri Dec 13 2013 11:57:59 for ILIAS Release_3_6_x_branch .rev 46809 by  doxygen 1.7.1