00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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
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
00103
00104
00105 $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
00106
00107 if(!count($items = $this->psc_obj->getEntries(PAY_METHOD_BMF)))
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
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
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
00147
00148 $this->error != "" && isset($_POST['country']) ? $this->__showCountries($this->tpl, $_POST['country']) : $this->__showCountries($this->tpl, $_SESSION['bmf']['personal_data']['land']);
00149
00150
00151
00152
00153
00154
00155
00156
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
00180
00181
00182
00183 $this->tpl->setVariable("EMAIL", $this->user_obj->getEmail());
00184
00185 }
00186 }
00187
00188 function getPersonalData()
00189 {
00190
00191
00192 if ($_SESSION["bmf"]["personal_data"]["vorname"] == "" ||
00193 $_SESSION["bmf"]["personal_data"]["nachname"] == "" ||
00194 $_POST["zipcode"] == "" ||
00195 $_POST["city"] == "" ||
00196 $_POST["country"] == "" ||
00197
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
00217
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
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
00245
00246
00247 $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
00248
00249 if(!count($items = $this->psc_obj->getEntries(PAY_METHOD_BMF)))
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
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
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
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
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
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345 $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
00346
00347 if(!count($items = $this->psc_obj->getEntries(PAY_METHOD_BMF)))
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
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
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
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
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
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(PAY_METHOD_BMF)))
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
00480 $resultCustomer = $resultCustomerObj->ergebnis;
00481
00482 if (is_object($resultCustomer))
00483 {
00484 if ($resultCustomer->code < 0)
00485 {
00486 $error = $this->lng->txt('pay_bmf_server_error_code') . " " . $resultCustomer->code . ": " . $resultCustomer->kurzText . "<br>\n" . $resultCustomer->langText;
00487 if ($resultCustomer->code == -103 ||
00488 $resultCustomer->code == -104 ||
00489 $resultCustomer->code == -107 ||
00490 ($resultCustomer->code <= -202 && $resultCustomer->code >= -208) ||
00491 $resultCustomer->code == -213)
00492 {
00493 sendInfo($error);
00494 $this->showPersonalData();
00495 }
00496 else
00497 {
00498 $error .= "<br>\n" . $this->lng->txt('pay_bmf_server_error_sysadmin');
00499 sendInfo($error);
00500 $this->showPersonalData();
00501 }
00502 }
00503 else
00504 {
00505 $payment = new LastschriftWS();
00506
00507 $debitEntry = new Lastschrift();
00508
00509 $address = new LieferAdresse();
00510
00511 $bank = new Bankverbindung();
00512
00513 $sc_obj =& new ilPaymentShoppingCart($this->user_obj);
00514
00515 $tmp_bookEntries = $sc_obj->getShoppingCart();
00516 if (!is_array($tmp_bookEntries))
00517 {
00518 sendInfo($this->lng->txt('pay_shopping_cart_empty'));
00519 }
00520 else
00521 {
00522 $totalAmount = 0;
00523 for ($i = 0; $i < count($tmp_bookEntries); $i++)
00524 {
00525 $bookEntries[] = new Buchung($tmp_bookEntries[$i]);
00526 $totalAmount += $tmp_bookEntries[$i]["betrag"];
00527 }
00528
00529 $values = array("betrag" => $totalAmount, "buchungen" => $bookEntries);
00530 $bookingList = new BuchungsListe($this->user_obj->getId(), $values);
00531 }
00532
00533 # vd($address);
00534 # vd($debitEntry);
00535 # vd($bank);
00536 # vd($bookingList);
00537
00538 $resultObj = $payment->abbuchenOhneEinzugsermaechtigung($resultCustomerObj->kunde->EShopKundenNr, $address, $bank, $bookingList);
00539 $result = $resultObj->ergebnis;
00540
00541 if (is_object($result))
00542 {
00543 if ($result->code < 0)
00544 {
00545 $this->tpl->setVariable("HEADER",$this->lng->txt('error'));
00546 $this->tpl->touchBlock("stop_floating");
00547 $error = $this->lng->txt('pay_bmf_server_error_code') . " " . $result->code . ": " . $result->kurzText . "<br>\n" . $result->langText;
00548 if ($result->code == -103 ||
00549 $result->code == -104 ||
00550 $result->code == -107 ||
00551 ($result->code <= -202 && $result->code >= -208) ||
00552 $result->code == -213)
00553 {
00554 sendInfo($error);
00555 $this->showPersonalData();
00556 }
00557 else if ($result->code == -507 ||
00558 $result->code == -510 ||
00559 $result->code == -511)
00560 {
00561 sendInfo($error);
00562 $this->showPaymentType();
00563 }
00564 else if ($result->code == -402 ||
00565 $result->code == -402 ||
00566 $result->code == -403 ||
00567 $result->code == -406 ||
00568 $result->code == -410 ||
00569 $result->code == -413 ||
00570 $result->code == -701 ||
00571 $result->code == -702 ||
00572 $result->code == -703)
00573 {
00574 sendInfo($error);
00575 $this->showDebitEntry();
00576 }
00577 else
00578 {
00579 $error .= "<br>\n" . $this->lng->txt('pay_bmf_server_error_sysadmin');
00580 sendInfo($error);
00581 $this->showPersonalData();
00582 }
00583
00584 }
00585 else
00586 {
00587 $resultCustomerObj->kunde->vorname = utf8_decode($resultCustomerObj->kunde->vorname);
00588 $resultCustomerObj->kunde->nachname = utf8_decode($resultCustomerObj->kunde->nachname);
00589 $resultCustomerObj->kunde->rechnungsAdresse->strasse = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->strasse);
00590 $resultCustomerObj->kunde->rechnungsAdresse->hausNr = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->hausNr);
00591 $resultCustomerObj->kunde->rechnungsAdresse->postfach = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->postfach);
00592 $resultCustomerObj->kunde->rechnungsAdresse->PLZ = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->PLZ);
00593 $resultCustomerObj->kunde->rechnungsAdresse->ort = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->ort);
00594 $resultCustomerObj->kunde->rechnungsAdresse->land = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->land);
00595
00596
00597 $this->__sendBill($resultCustomerObj->kunde, $_SESSION["bmf"]["payment_type"], $bookingList, $resultObj);
00598
00599 $this->__addBookings($resultObj,$bookingList->getTransaction());
00600 $this->__emptyShoppingCart();
00601 $this->__clearSession();
00602
00603 $this->tpl->setVariable("HEADER",$this->lng->txt('pay_bmf_your_order'));
00604 $this->tpl->setVariable("DESCRIPTION",$this->lng->txt('pay_bmf_thanks'));
00605 $this->tpl->touchBlock("stop_floating");
00606
00607 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.pay_bmf_debit_entry.html','payment');
00608 if ($this->ilias->getSetting("https") != 1)
00609 {
00610 $this->tpl->setCurrentBlock("buyed_objects");
00611 $this->tpl->setVariable("LINK_GOTO_BUYED_OBJECTS", "payment.php?cmdClass=ilpaymentbuyedobjectsgui&cmdNode=2");
00612 $this->tpl->setVariable("TXT_GOTO_BUYED_OBJECTS", $this->lng->txt('pay_goto_buyed_objects'));
00613 $this->tpl->parseCurrentBlock("buyed_objects");
00614 }
00615 $this->tpl->setVariable("TXT_CLOSE_WINDOW", $this->lng->txt('close_window'));
00616 }
00617 }
00618 else
00619 {
00620 $this->tpl->setVariable("HEADER",$this->lng->txt('error'));
00621 $this->tpl->touchBlock("stop_floating");
00622 sendInfo($this->lng->txt('pay_bmf_server_error_communication'));
00623 }
00624 }
00625 }
00626 else
00627 {
00628 $this->tpl->setVariable("HEADER",$this->lng->txt('error'));
00629 $this->tpl->touchBlock("stop_floating");
00630 sendInfo($this->lng->txt('pay_bmf_server_error_communication'));
00631 }
00632
00633 }
00634 }
00635
00636 function showCreditCard()
00637 {
00638
00639
00640
00641
00642
00643
00644
00645
00646
00647
00648 $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
00649
00650 if(!count($items = $this->psc_obj->getEntries(PAY_METHOD_BMF)))
00651 {
00652
00653 $this->tpl->setVariable("HEADER",$this->lng->txt('pay_bmf_your_order'));
00654 $this->tpl->touchBlock("stop_floating");
00655 sendInfo($this->lng->txt('pay_shopping_cart_empty'));
00656
00657 }
00658 else
00659 {
00660
00661 $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.pay_bmf_credit_card.html',true);
00662
00663 $this->__showShoppingCart();
00664
00665 $this->tpl->setVariable("CREDIT_CARD_FORMACTION",$this->ctrl->getFormAction($this));
00666
00667
00668 $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_pays_b.gif'));
00669 $this->tpl->setVariable("ALT_IMG",$this->lng->txt('obj_usr'));
00670 $this->tpl->setVariable("HEADER",$this->lng->txt('pay_step3_credit_card'));
00671 $this->tpl->setVariable("TITLE",$this->lng->txt('pay_bmf_credit_card_data'));
00672 $this->tpl->setVariable("DESCRIPTION",$this->lng->txt('pay_bmf_description_credit_card'));
00673 $this->tpl->touchBlock("stop_floating");
00674 $this->tpl->setVariable("TXT_CLOSE_WINDOW",$this->lng->txt('close_window'));
00675
00676
00677 $this->tpl->setVariable("TXT_CARD_HOLDER",$this->lng->txt('pay_bmf_card_holder'));
00678 $this->tpl->setVariable("TXT_CHECK_NUMBER",$this->lng->txt('pay_bmf_check_number'));
00679 $this->tpl->setVariable("TXT_OPTIONAL",$this->lng->txt('pay_bmf_optional'));
00680 $this->tpl->setVariable("TXT_CARD_NUMBER",$this->lng->txt('pay_bmf_card_number'));
00681 $this->tpl->setVariable("TXT_VALIDITY",$this->lng->txt('pay_bmf_validity'));
00682 $this->tpl->setVariable("TXT_TERMS_CONDITIONS",$this->lng->txt('pay_bmf_terms_conditions'));
00683 $this->tpl->setVariable("TXT_TERMS_CONDITIONS_READ",$this->lng->txt('pay_bmf_terms_conditions_read'));
00684 $this->tpl->setVariable("TXT_TERMS_CONDITIONS_SHOW",$this->lng->txt('pay_bmf_terms_conditions_show'));
00685 $this->tpl->setVariable("LINK_TERMS_CONDITIONS","./show_terms_conditions.php");
00686 $this->tpl->setVariable("TXT_PASSWORD",$this->lng->txt('password'));
00687 $this->tpl->setVariable("TXT_CONFIRM_ORDER",$this->lng->txt('pay_confirm_order'));
00688
00689 $this->tpl->setVariable("INPUT_VALUE",$this->lng->txt('pay_send_order'));
00690 $this->tpl->setVariable("CANCEL",$this->lng->txt('cancel'));
00691
00692
00693
00694 $this->tpl->setVariable("CARD_HOLDER",
00695 $this->error != "" && isset($_POST['card_holder'])
00696 ? ilUtil::prepareFormOutput($_POST['card_holder'],true)
00697 : ilUtil::prepareFormOutput($_SESSION['bmf']["credit_card"]['karteninhaber'],true));
00698 $this->tpl->setVariable("CARD_NUMBER_BLOCK_1",
00699 $this->error != "" && isset($_POST['card_number']['block_1'])
00700 ? ilUtil::prepareFormOutput($_POST['card_number']['block_1'],true)
00701 : ilUtil::prepareFormOutput($_SESSION['bmf']["credit_card"]['kreditkartenNr']['block_1'],true));
00702 $this->tpl->setVariable("CARD_NUMBER_BLOCK_2",
00703 $this->error != "" && isset($_POST['card_number']['block_2'])
00704 ? ilUtil::prepareFormOutput($_POST['card_number']['block_2'],true)
00705 : ilUtil::prepareFormOutput($_SESSION['bmf']["credit_card"]['kreditkartenNr']['block_2'],true));
00706 $this->tpl->setVariable("CARD_NUMBER_BLOCK_3",
00707 $this->error != "" && isset($_POST['card_number']['block_3'])
00708 ? ilUtil::prepareFormOutput($_POST['card_number']['block_3'],true)
00709 : ilUtil::prepareFormOutput($_SESSION['bmf']["credit_card"]['kreditkartenNr']['block_3'],true));
00710 $this->tpl->setVariable("CARD_NUMBER_BLOCK_4",
00711 $this->error != "" && isset($_POST['card_number']['block_4'])
00712 ? ilUtil::prepareFormOutput($_POST['card_number']['block_4'],true)
00713 : ilUtil::prepareFormOutput($_SESSION['bmf']["credit_card"]['kreditkartenNr']['block_4'],true));
00714 $this->tpl->setVariable("CHECK_NUMBER",
00715 $this->error != "" && isset($_POST['check_number'])
00716 ? ilUtil::prepareFormOutput($_POST['check_number'],true)
00717 : ilUtil::prepareFormOutput($_SESSION['bmf']["credit_card"]['kartenpruefnummer'],true));
00718 for ($i = 1; $i <= 12; $i++)
00719 {
00720 $this->tpl->setCurrentBlock("loop_validity_months");
00721 $this->tpl->setVariable("LOOP_VALIDITY_MONTHS", $i < 10 ? "0" . $i : $i);
00722 $this->tpl->setVariable("LOOP_VALIDITY_MONTHS_TXT", $i < 10 ? "0" . $i : $i);
00723 if ($this->error != "" &&
00724 isset($_POST['validity']['month']))
00725 {
00726 if ($_POST['validity']['month'] == $i)
00727 {
00728 $this->tpl->setVariable("LOOP_VALIDITY_MONTHS_SELECTED", " selected");
00729 }
00730 }
00731 else
00732 {
00733 if ($_SESSION["bmf"]["credit_card"]["gueltigkeit"]["monat"] == $i)
00734 {
00735 $this->tpl->setVariable("LOOP_VALIDITY_MONTHS_SELECTED", " selected");
00736 }
00737 }
00738 $this->tpl->parseCurrentBlock("loop_validity_months");
00739 }
00740 for ($i = date("Y"); $i <= (date("Y")+6); $i++)
00741 {
00742 $this->tpl->setCurrentBlock("loop_validity_years");
00743 $this->tpl->setVariable("LOOP_VALIDITY_YEARS", $i);
00744 $this->tpl->setVariable("LOOP_VALIDITY_YEARS_TXT", $i);
00745 if ($this->error != "" &&
00746 isset($_POST['validity']['year']))
00747 {
00748 if ($_POST['validity']['year'] == $i)
00749 {
00750 $this->tpl->setVariable("LOOP_VALIDITY_YEARS_SELECTED", " selected");
00751 }
00752 }
00753 else
00754 {
00755 if ($_SESSION["bmf"]["credit_card"]["gueltigkeit"]["jahr"] == $i)
00756 {
00757 $this->tpl->setVariable("LOOP_VALIDITY_YEARS_SELECTED", " selected");
00758 }
00759 }
00760 $this->tpl->parseCurrentBlock("loop_validity_years");
00761 }
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772
00773
00774 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00775 $this->tpl->setCurrentBlock("btn_cell");
00776 $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "showPaymentType"));
00777 $this->tpl->setVariable("BTN_TXT", $this->lng->txt('pay_bmf_back'));
00778 $this->tpl->parseCurrentBlock("btn_cell");
00779
00780 }
00781 }
00782
00783 function getCreditCard()
00784 {
00785 if ($_POST["card_holder"] == "" ||
00786 $_POST["card_number"]["block_1"] == "" ||
00787 $_POST["card_number"]["block_2"] == "" ||
00788 $_POST["card_number"]["block_3"] == "" ||
00789 $_POST["card_number"]["block_4"] == "" ||
00790 $_POST["validity"]["month"] == "" ||
00791 $_POST["validity"]["year"] == "" ||
00792 $_POST["validity"]["year"]."-".$_POST["validity"]["month"] < date("Y-m"))
00793 {
00794 $this->error = $this->lng->txt('pay_bmf_credit_card_not_valid');
00795 sendInfo($this->error);
00796 $this->showCreditCard();
00797 return;
00798 }
00799 if ($_POST["terms_conditions"] != 1)
00800 {
00801 $this->error = $this->lng->txt('pay_bmf_check_terms_conditions');
00802 sendInfo($this->error);
00803 $this->showCreditCard();
00804 return;
00805 }
00806 if ($_POST["password"] == "" ||
00807 md5($_POST["password"]) != $this->user_obj->getPasswd())
00808 {
00809 $this->error = $this->lng->txt('pay_bmf_password_not_valid');
00810 sendInfo($this->error);
00811 $this->showCreditCard();
00812 return;
00813 }
00814
00815 $_SESSION["bmf"]["credit_card"]["gueltigkeit"]["monat"] = $_POST["validity"]["month"];
00816 $_SESSION["bmf"]["credit_card"]["gueltigkeit"]["jahr"] = $_POST["validity"]["year"];
00817 $_SESSION["bmf"]["credit_card"]["karteninhaber"] = $_POST["card_holder"];
00818 $_SESSION["bmf"]["credit_card"]["kreditkartenNr"]["block_1"] = $_POST["card_number"]["block_1"];
00819 $_SESSION["bmf"]["credit_card"]["kreditkartenNr"]["block_2"] = $_POST["card_number"]["block_2"];
00820 $_SESSION["bmf"]["credit_card"]["kreditkartenNr"]["block_3"] = $_POST["card_number"]["block_3"];
00821 $_SESSION["bmf"]["credit_card"]["kreditkartenNr"]["block_4"] = $_POST["card_number"]["block_4"];
00822 $_SESSION["bmf"]["credit_card"]["kartenpruefnummer"] = $_POST["check_number"];
00823
00824 $this->error = "";
00825 $this->sendCreditCard();
00826 }
00827
00828 function sendCreditCard()
00829 {
00830
00831 $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
00832
00833 if(!count($items = $this->psc_obj->getEntries(PAY_METHOD_BMF)))
00834 {
00835
00836 $this->tpl->setVariable("HEADER",$this->lng->txt('pay_bmf_your_order'));
00837 $this->tpl->touchBlock("stop_floating");
00838 sendInfo($this->lng->txt('pay_shopping_cart_empty'));
00839
00840 }
00841 else
00842 {
00843
00844 $payment = new KreditkartenzahlungWS();
00845
00846 $customer = new Kunde($this->user_obj->getId());
00847
00848 $creditCard = new Kreditkarte();
00849
00850 $sc_obj =& new ilPaymentShoppingCart($this->user_obj);
00851
00852 $tmp_bookEntries = $sc_obj->getShoppingCart();
00853 if (!is_array($tmp_bookEntries))
00854 {
00855 sendInfo($this->lng->txt('pay_shopping_cart_empty'));
00856 }
00857 else
00858 {
00859 $totalAmount = 0;
00860 for ($i = 0; $i < count($tmp_bookEntries); $i++)
00861 {
00862 $bookEntries[] = new Buchung($tmp_bookEntries[$i]);
00863 $totalAmount += $tmp_bookEntries[$i]["betrag"];
00864 }
00865
00866 $values = array("betrag" => $totalAmount, "buchungen" => $bookEntries);
00867 $bookingList = new BuchungsListe($this->user_obj->getId(), $values);
00868 }
00869
00870 # vd($customer);
00871 # vd($creditCard);
00872 # vd($bookingList);
00873
00874 $resultObj = $payment->zahlenUndAnlegenKunde($customer, $creditCard, $bookingList);
00875 $result = $resultObj->ergebnis;
00876
00877 # vd($result);
00878
00879 if (is_object($result))
00880 {
00881 if ($result->code < 0)
00882 {
00883 $this->tpl->setVariable("HEADER",$this->lng->txt('error'));
00884 $this->tpl->touchBlock("stop_floating");
00885 $error = $this->lng->txt('pay_bmf_server_error_code') . " " . $result->code . ": " . $result->kurzText . "<br>\n" . $result->langText;
00886 if ($result->code == -103 ||
00887 $result->code == -104 ||
00888 $result->code == -107 ||
00889 ($result->code <= -202 && $result->code >= -208) ||
00890 $result->code == -213)
00891 {
00892 sendInfo($error);
00893 $this->showPersonalData();
00894 }
00895 else if ($result->code == -507 ||
00896 $result->code == -510 ||
00897 $result->code == -511)
00898 {
00899 sendInfo($error);
00900 $this->showPaymentType();
00901 }
00902 else if ($result->code == -701 ||
00903 $result->code == -1701 ||
00904 $result->code == -1706 ||
00905 $result->code == -1707 ||
00906 $result->code == -1710 ||
00907 $result->code == -1711)
00908 {
00909 sendInfo($error);
00910 $this->showCreditCard();
00911 }
00912 else
00913 {
00914 $error .= "<br>\n" . $this->lng->txt('pay_bmf_server_error_sysadmin');
00915 sendInfo($error);
00916 $this->showPersonalData();
00917 }
00918
00919 }
00920 else
00921 {
00922
00923 $this->__sendBill($customer, $_SESSION["bmf"]["payment_type"], $bookingList, $resultObj);
00924
00925 $this->__addBookings($resultObj,$bookingList->getTransaction());
00926 $this->__emptyShoppingCart();
00927 $this->__clearSession();
00928
00929 $this->tpl->setVariable("HEADER",$this->lng->txt('pay_bmf_your_order'));
00930 $this->tpl->setVariable("DESCRIPTION",$this->lng->txt('pay_bmf_thanks'));
00931 $this->tpl->touchBlock("stop_floating");
00932
00933 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.pay_bmf_credit_card.html','payment');
00934 if ($this->ilias->getSetting("https") != 1)
00935 {
00936 $this->tpl->setCurrentBlock("buyed_objects");
00937 $this->tpl->setVariable("LINK_GOTO_BUYED_OBJECTS", "payment/payment.php?cmdClass=ilpaymentbuyedobjectsgui&cmdNode=2");
00938 $this->tpl->setVariable("TXT_GOTO_BUYED_OBJECTS", $this->lng->txt('pay_goto_buyed_objects'));
00939 $this->tpl->parseCurrentBlock("buyed_objects");
00940 }
00941 $this->tpl->setVariable("TXT_CLOSE_WINDOW", $this->lng->txt('close_window'));
00942 }
00943 }
00944 else
00945 {
00946 $this->tpl->setVariable("HEADER",$this->lng->txt('error'));
00947 $this->tpl->touchBlock("stop_floating");
00948 sendInfo($this->lng->txt('pay_bmf_server_error_communication'));
00949 }
00950
00951 }
00952
00953 }
00954
00958 function &executeCommand()
00959 {
00960 global $tree;
00961
00962 $cmd = $this->ctrl->getCmd();
00963 switch ($this->ctrl->getNextClass($this))
00964 {
00965
00966 default:
00967 if(!$cmd = $this->ctrl->getCmd())
00968 {
00969 $cmd = 'showPersonalData';
00970 }
00971 $this->$cmd();
00972 break;
00973 }
00974 }
00975
00976
00977 function __sendBill($customer, $paymentType, $bookingList, $result)
00978 {
00979 include_once './classes/class.ilTemplate.php';
00980 include_once './classes/class.ilUtil.php';
00981 include_once './payment/classes/class.ilGeneralSettings.php';
00982 include_once './payment/classes/class.ilPaymentShoppingCart.php';
00983 include_once './classes/class.ilMimeMail.php';
00984
00985 $sc_obj =& new ilPaymentShoppingCart($this->user_obj);
00986 $genSet = new ilGeneralSettings();
00987
00988 $tpl = new ilTemplate("./payment/templates/default/tpl.pay_bmf_bill.html", true, true, true);
00989
00990 $tpl->setVariable("VENDOR_ADDRESS", nl2br(utf8_decode($genSet->get("address"))));
00991 $tpl->setVariable("VENDOR_ADD_INFO", nl2br(utf8_decode($genSet->get("add_info"))));
00992 $tpl->setVariable("VENDOR_BANK_DATA", nl2br(utf8_decode($genSet->get("bank_data"))));
00993 $tpl->setVariable("TXT_BANK_DATA", utf8_decode($this->lng->txt("pay_bank_data")));
00994
00995 $tpl->setVariable("CUSTOMER_FIRSTNAME", $customer->vorname);
00996 $tpl->setVariable("CUSTOMER_LASTNAME", $customer->nachname);
00997 if ($customer->rechnungsAdresse->strasse != "" &&
00998 $customer->rechnungsAdresse->hausNr != "")
00999 {
01000 $tpl->setVariable("CUSTOMER_STREET_POBOX", $customer->rechnungsAdresse->strasse . " ". $customer->rechnungsAdresse->hausNr);
01001 }
01002 else
01003 {
01004 $tpl->setVariable("CUSTOMER_STREET_POBOX", $customer->rechnungsAdresse->postfach);
01005 }
01006 $tpl->setVariable("CUSTOMER_ZIPCODE", $customer->rechnungsAdresse->PLZ);
01007 $tpl->setVariable("CUSTOMER_CITY", $customer->rechnungsAdresse->ort);
01008 $tpl->setVariable("CUSTOMER_COUNTRY", $this->__getCountryName($customer->rechnungsAdresse->land));
01009
01010 $tpl->setVariable("BILL_NO", $result->buchungsListe->kassenzeichen);
01011 $tpl->setVariable("DATE", date("d.m.Y"));
01012
01013 $tpl->setVariable("TXT_BILL", utf8_decode($this->lng->txt("pays_bill")));
01014 $tpl->setVariable("TXT_BILL_NO", utf8_decode($this->lng->txt("pay_bill_no")));
01015 $tpl->setVariable("TXT_DATE", utf8_decode($this->lng->txt("date")));
01016
01017 $tpl->setVariable("TXT_ARTICLE", utf8_decode($this->lng->txt("pay_article")));
01018 $tpl->setVariable("TXT_PRICE", utf8_decode($this->lng->txt("price_a")));
01019
01020 $bookEntries = $sc_obj->getShoppingCart();
01021 for ($i = 0; $i < count($bookEntries); $i++)
01022 {
01023 $tpl->setCurrentBlock("loop");
01024 $tpl->setVariable("LOOP_OBJ_TYPE", utf8_decode($this->lng->txt($bookEntries[$i]["typ"])));
01025 $tpl->setVariable("LOOP_TITLE", $bookEntries[$i]["buchungstext"]);
01026 $tpl->setVariable("LOOP_TXT_ENTITLED_RETRIEVE", utf8_decode($this->lng->txt("pay_entitled_retrieve")));
01027 $tpl->setVariable("LOOP_DURATION", $bookEntries[$i]["dauer"] . " " . utf8_decode($this->lng->txt("paya_months")));
01028 $tpl->setVariable("LOOP_PRICE", number_format($bookEntries[$i]["betrag"], 2, ",", ".") . " " . $genSet->get("currency_unit"));
01029 $tpl->parseCurrentBlock("loop");
01030 }
01031
01032 $tpl->setVariable("TXT_TOTAL_AMOUNT", utf8_decode($this->lng->txt("pay_bmf_total_amount")));
01033 $tpl->setVariable("TOTAL_AMOUNT", number_format($bookingList->betrag, 2, ",", ".") . " " . $genSet->get("currency_unit"));
01034 if (($vat = $sc_obj->getVat($bookingList->betrag)) > 0)
01035 {
01036 $tpl->setVariable("VAT", number_format($vat, 2, ",", ".") . " " . $genSet->get("currency_unit"));
01037 $tpl->setVariable("TXT_VAT", $genSet->get("vat_rate") . "% " . utf8_decode($this->lng->txt("pay_bmf_vat_included")));
01038 }
01039
01040 if ($paymentType == "debit_entry")
01041 {
01042 $tpl->setVariable("TXT_PAYMENT_TYPE", utf8_decode($this->lng->txt("pay_payed_debit_entry")));
01043 }
01044 else
01045 {
01046 $tpl->setVariable("TXT_PAYMENT_TYPE", utf8_decode($this->lng->txt("pay_payed_credit_card")));
01047 }
01048
01049 if (!@file_exists($genSet->get("pdf_path")))
01050 {
01051 ilUtil::makeDir($genSet->get("pdf_path"));
01052 }
01053
01054 if (@file_exists($genSet->get("pdf_path")))
01055 {
01056 ilUtil::html2pdf($tpl->get(), $genSet->get("pdf_path") . "/" . $result->buchungsListe->kassenzeichen . ".pdf");
01057 }
01058
01059 if (@file_exists($genSet->get("pdf_path") . "/" . $result->buchungsListe->kassenzeichen . ".pdf") &&
01060 $customer->EMailAdresse != "" &&
01061 $this->ilias->getSetting("admin_email") != "")
01062 {
01063 $m= new ilMimeMail;
01064 $m->From( $this->ilias->getSetting("admin_email") );
01065 $m->To( $customer->EMailAdresse );
01066 $m->Subject( $this->lng->txt("pay_message_subject") );
01067 $message = $this->lng->txt("pay_message_hello") . " " . utf8_encode($customer->vorname) . " " . utf8_encode($customer->nachname) . ",\n\n";
01068 $message .= $this->lng->txt("pay_message_thanks") . "\n\n";
01069 $message .= $this->lng->txt("pay_message_attachment") . "\n\n";
01070 $message .= $this->lng->txt("pay_message_regards") . "\n\n";
01071 $message .= strip_tags($genSet->get("address"));
01072 $m->Body( $message );
01073 $m->Attach( $genSet->get("pdf_path") . "/" . $result->buchungsListe->kassenzeichen . ".pdf", "application/pdf" ) ;
01074 $m->Send();
01075 }
01076
01077 @unlink($genSet->get("pdf_path") . "/" . $result->buchungsListe->kassenzeichen . ".html");
01078 @unlink($genSet->get("pdf_path") . "/" . $result->buchungsListe->kassenzeichen . ".pdf");
01079
01080 }
01081
01082 function __addBookings($a_result,$a_transaction)
01083 {
01084 include_once './payment/classes/class.ilPaymentBookings.php';
01085 include_once './payment/classes/class.ilPaymentShoppingCart.php';
01086 include_once './payment/classes/class.ilPaymentObject.php';
01087 include_once './payment/classes/class.ilPaymentPrices.php';
01088
01089 $booking_obj =& new ilPaymentBookings();
01090
01091 $sc_obj =& new ilPaymentShoppingCart($this->user_obj);
01092
01093 $i = 0;
01094 foreach($sc_obj->getEntries(PAY_METHOD_BMF) as $entry)
01095 {
01096 $pobject =& new ilPaymentObject($this->user_obj,$entry['pobject_id']);
01097
01098 $price = ilPaymentPrices::_getPrice($entry['price_id']);
01099
01100 $booking_obj->setTransaction($a_transaction);
01101 $booking_obj->setPobjectId($entry['pobject_id']);
01102 $booking_obj->setCustomerId($this->user_obj->getId());
01103 $booking_obj->setVendorId($pobject->getVendorId());
01104 $booking_obj->setPayMethod($pobject->getPayMethod());
01105 $booking_obj->setOrderDate(time());
01106 $booking_obj->setDuration($price['duration']);
01107 $booking_obj->setPrice(ilPaymentPrices::_getPriceString($entry['price_id']));
01108 $booking_obj->setPayed(1);
01109 $booking_obj->setAccess(1);
01110 $booking_obj->setVoucher($a_result->buchungsListe->buchungen[$i++]->belegNr);
01111 $booking_obj->setTransactionExtern($a_result->buchungsListe->kassenzeichen);
01112
01113 $booking_obj->add();
01114
01115 unset($pobject);
01116 }
01117 }
01118
01119 function __emptyShoppingCart()
01120 {
01121 include_once './payment/classes/class.ilPaymentShoppingCart.php';
01122
01123 $sc_obj =& new ilPaymentShoppingCart($this->user_obj);
01124
01125 return $sc_obj->emptyShoppingCart();
01126 }
01127
01128 function __clearSession()
01129 {
01130 $_SESSION["bmf"]["payment_type"] = "";
01131 $_SESSION["bmf"]["debit_entry"] = "";
01132 $_SESSION["bmf"]["credit_card"] = "";
01133 }
01134
01135 function __loadTemplate()
01136 {
01137 $this->tpl->addBlockFile("CONTENT", "content", "tpl.payb_content.html");
01138
01139 $this->__buildStylesheet();
01140 $this->__buildStatusline();
01141 }
01142
01143 function __buildStatusline()
01144 {
01145 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
01146 # $this->__buildLocator();
01147 }
01148
01149 function __buildLocator()
01150 {
01151 $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html");
01152 $this->tpl->setVariable("TXT_LOCATOR",$this->lng->txt("locator"));
01153
01154 $this->tpl->setCurrentBlock("locator_item");
01155 $this->tpl->setVariable("ITEM", $this->lng->txt("personal_desktop"));
01156 $this->tpl->setVariable("LINK_ITEM","../ilias.php?baseClass=ilPersonalDesktopGUI");
01157 #$this->tpl->setVariable("LINK_ITEM", "../usr_personaldesktop.php");
01158 $this->tpl->parseCurrentBlock();
01159
01160 $this->tpl->setCurrentBlock("locator_item");
01161 $this->tpl->setVariable("PREFIX",'> ');
01162 # $this->tpl->setVariable("ITEM", $this->lng->txt("pay_locator"));
01163 $this->tpl->setVariable("ITEM", "Payment");
01164 $this->tpl->setVariable("LINK_ITEM", "./payment.php");
01165 $this->tpl->parseCurrentBlock();
01166
01167
01168 sendInfo();
01169
01170 return true;
01171 }
01172
01173 function __buildStylesheet()
01174 {
01175 $this->tpl->setVariable("LOCATION_STYLESHEET",ilUtil::getStyleSheetLocation());
01176 $this->tpl->setVariable("LOCATION_JAVASCRIPT",ilUtil::getJSPath('functions.js'));
01177 }
01178
01182 function __showCountries(&$tpl, $value = "")
01183 {
01184 $countries = $this->__getCountries();
01185 foreach($countries as $code => $text)
01186 {
01187 $tpl->setCurrentBlock("loop_countries");
01188 $tpl->setVariable("LOOP_COUNTRIES", $code);
01189 $tpl->setVariable("LOOP_COUNTRIES_TXT", $text);
01190 if ($value != "" &&
01191 $value == $code)
01192 {
01193 $tpl->setVariable("LOOP_COUNTRIES_SELECTED", " selected");
01194 }
01195 $tpl->parseCurrentBlock("loop_countries");
01196 }
01197 $tpl->setVariable("TXT_PLEASE_SELECT", $this->lng->txt("pay_bmf_please_select"));
01198 return;
01199 }
01200
01201 function __getCountries()
01202 {
01203 global $lng;
01204
01205 $lng->loadLanguageModule("meta");
01206
01207 $cntcodes = array ("DE","ES","FR","GB","AT","CH","AF","AL","DZ","AS","AD","AO",
01208 "AI","AQ","AG","AR","AM","AW","AU","AT","AZ","BS","BH","BD","BB","BY",
01209 "BE","BZ","BJ","BM","BT","BO","BA","BW","BV","BR","IO","BN","BG","BF",
01210 "BI","KH","CM","CA","CV","KY","CF","TD","CL","CN","CX","CC","CO","KM",
01211 "CG","CK","CR","CI","HR","CU","CY","CZ","DK","DJ","DM","DO","TP","EC",
01212 "EG","SV","GQ","ER","EE","ET","FK","FO","FJ","FI","FR","FX","GF","PF",
01213 "TF","GA","GM","GE","DE","GH","GI","GR","GL","GD","GP","GU","GT","GN",
01214 "GW","GY","HT","HM","HN","HU","IS","IN","ID","IR","IQ","IE","IL","IT",
01215 "JM","JP","JO","KZ","KE","KI","KP","KR","KW","KG","LA","LV","LB","LS",
01216 "LR","LY","LI","LT","LU","MO","MK","MG","MW","MY","MV","ML","MT","MH",
01217 "MQ","MR","MU","YT","MX","FM","MD","MC","MN","MS","MA","MZ","MM","NA",
01218 "NR","NP","NL","AN","NC","NZ","NI","NE","NG","NU","NF","MP","NO","OM",
01219 "PK","PW","PA","PG","PY","PE","PH","PN","PL","PT","PR","QA","RE","RO",
01220 "RU","RW","KN","LC","VC","WS","SM","ST","SA","CH","SN","SC","SL","SG",
01221 "SK","SI","SB","SO","ZA","GS","ES","LK","SH","PM","SD","SR","SJ","SZ",
01222 "SE","SY","TW","TJ","TZ","TH","TG","TK","TO","TT","TN","TR","TM","TC",
01223 "TV","UG","UA","AE","GB","UY","US","UM","UZ","VU","VA","VE","VN","VG",
01224 "VI","WF","EH","YE","ZR","ZM","ZW");
01225 $cntrs = array();
01226 foreach($cntcodes as $cntcode)
01227 {
01228 $cntrs[$cntcode] = $lng->txt("meta_c_".$cntcode);
01229 }
01230 asort($cntrs);
01231 return $cntrs;
01232 }
01233
01234 function __getCountryCode($value = "")
01235 {
01236 $countries = $this->__getCountries();
01237 foreach($countries as $code => $text)
01238 {
01239 if ($text == $value)
01240 {
01241 return $code;
01242 }
01243 }
01244 return;
01245 }
01246
01247 function __getCountryName($value = "")
01248 {
01249 $countries = $this->__getCountries();
01250 return $countries[$value];
01251 }
01252
01253
01254
01255
01256
01257
01258
01259
01260
01261
01262
01263
01264
01265
01266
01267
01268
01269
01270
01271
01272
01273
01274
01275
01276
01277
01278
01279
01280
01281
01282
01283
01284
01285
01286
01287
01288
01289
01290
01291
01292
01293
01294
01295
01296
01297
01298
01299
01300
01301
01302
01303
01304
01305 function __showShoppingCart()
01306 {
01307
01308 $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
01309
01310 if(!count($items = $this->psc_obj->getEntries(PAY_METHOD_BMF)))
01311 {
01312 sendInfo($this->lng->txt('pay_shopping_cart_empty'));
01313 }
01314
01315 $counter = 0;
01316 foreach($items as $item)
01317 {
01318 $tmp_pobject =& new ilPaymentObject($this->user_obj,$item['pobject_id']);
01319
01320 $tmp_obj =& ilObjectFactory::getInstanceByRefId($tmp_pobject->getRefId());
01321
01322 $price_arr = ilPaymentPrices::_getPrice($item['price_id']);
01323
01324 $f_result[$counter][] = $tmp_obj->getTitle();
01325 $f_result[$counter][] = $price_arr['duration'] . " " . $this->lng->txt("paya_months");
01326
01327 $f_result[$counter][] = ilPaymentPrices::_getPriceString($item['price_id']);;
01328
01329 unset($tmp_obj);
01330 unset($tmp_pobject);
01331
01332 ++$counter;
01333 }
01334
01335 return $this->__showItemsTable($f_result);
01336 }
01337
01338 function &__initTableGUI()
01339 {
01340 include_once "./classes/class.ilTableGUI.php";
01341
01342 return new ilTableGUI(0,false);
01343 }
01344
01345 function __showItemsTable($a_result_set)
01346 {
01347 include_once './payment/classes/class.ilGeneralSettings.php';
01348
01349 $genSet = new ilGeneralSettings();
01350
01351 $tbl =& $this->__initTableGUI();
01352 $tpl =& $tbl->getTemplateObject();
01353
01354
01355 $tpl->setCurrentBlock("tbl_form_header");
01356
01357 $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
01358 $tpl->parseCurrentBlock();
01359
01360 $tbl->setTitle($this->lng->txt("paya_shopping_cart"),"icon_pays_b.gif",$this->lng->txt("paya_shopping_cart"));
01361 $tbl->setHeaderNames(array($this->lng->txt("title"),
01362 $this->lng->txt("duration"),
01363 $this->lng->txt("price_a")));
01364
01365 $tbl->setHeaderVars(array("title",
01366 "duration",
01367 "price"),
01368 array("cmd" => "",
01369 "cmdClass" => "ilpurchasebmfgui",
01370 "cmdNode" => $_GET["cmdNode"]));
01371
01372 $tbl->disable("footer");
01373 $tbl->disable("sort");
01374 $tbl->disable("linkbar");
01375
01376 $offset = $_GET["offset"];
01377 $order = $_GET["sort_by"];
01378 $direction = $_GET["sort_order"] ? $_GET['sort_order'] : 'desc';
01379
01380 $tbl->setOrderColumn($order,'title');
01381 $tbl->setOrderDirection($direction);
01382 $tbl->setOffset($offset);
01383 $tbl->setLimit($_GET["limit"]);
01384 $tbl->setMaxCount(count($a_result_set));
01385 # $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
01386 $tbl->setData($a_result_set);
01387
01388 $sc_obj =& new ilPaymentShoppingCart($this->user_obj);
01389
01390 $totalAmount = $sc_obj->getTotalAmount();
01391 $vat = $sc_obj->getVat($totalAmount[PAY_METHOD_BMF]);
01392
01393 $tpl->setCurrentBlock("tbl_footer_linkbar");
01394 $amount = "<b>" . $this->lng->txt("pay_bmf_total_amount") . ": " . number_format($totalAmount[PAY_METHOD_BMF], 2, ',', '.') . " " . $genSet->get("currency_unit") . "</b>";
01395 if ($vat > 0)
01396 {
01397 $amount .= "<br>\n" . $genSet->get("vat_rate") . "% " . $this->lng->txt("pay_bmf_vat_included") . ": " . number_format($vat, 2, ',', '.') . " " . $genSet->get("currency_unit");
01398 }
01399 $tpl->setVariable("LINKBAR", $amount);
01400 $tpl->parseCurrentBlock("tbl_footer_linkbar");
01401 $tpl->setCurrentBlock('tbl_footer');
01402 $tpl->setVariable('COLUMN_COUNT',3);
01403 $tpl->parseCurrentBlock();
01404 $tbl->render();
01405
01406 $this->tpl->setVariable("ITEMS_TABLE",$tbl->tpl->get());
01407
01408 return true;
01409 }
01410
01411 }
01412
01413 class KundenstammdatenPflegeWS
01414 {
01415
01416 var $_soapClient = NULL;
01417
01418 function KundenstammdatenPflegeWS ()
01419 {
01420 global $bmfConfig;
01421
01422 $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"])));
01423 }
01424
01425 function anlegenKunde ($customer)
01426 {
01427 global $bmfConfig;
01428
01429 $tmp = array(
01430 'mandantNr' => $bmfConfig["mandantNr"],
01431 'kunde' => $customer
01432 );
01433
01434 $result = $this->_soapClient->call("anlegenKunde", $tmp, "KundenstammdatenPflegeWS");
01435 return $result;
01436 }
01437
01438 };
01439
01440 class KreditkartenzahlungWS
01441 {
01442 var $_soapClient = NULL;
01443
01444 function KreditkartenzahlungWS()
01445 {
01446 global $bmfConfig;
01447
01448 $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"])));
01449 }
01450
01451 function validierenKreditkarte($creditCard)
01452 {
01453 global $bmfConfig;
01454
01455 $tmp = array(
01456 'mandantNr' => $bmfConfig["mandantNr"],
01457 'kreditkarte' => $creditCard,
01458 'waehrungskennzeichen' => $bmfConfig["waehrungskennzeichen"]
01459 );
01460
01461 $result = $this->_soapClient->call("validierenKreditkarte", $tmp, "KreditkartenzahlungWS");
01462 return $result;
01463 }
01464
01465 function zahlenUndAnlegenKunde($customer, $creditCard, $bookingList)
01466 {
01467 global $bmfConfig;
01468
01469 $lieferadresse = new LieferAdresse();
01470
01471 $tmp = array(
01472 'mandantNr' => $bmfConfig["mandantNr"],
01473 'Kunde' => $customer,
01474 'Kreditkarte' => $creditCard,
01475 'buchungsListe' => $bookingList,
01476 'lieferadresse' => $lieferadresse
01477 );
01478
01479 $result = $this->_soapClient->call("zahlenUndAnlegenKunde", $tmp, "KreditkartenzahlungWS");
01480 return $result;
01481 }
01482 }
01483
01484 class LastschriftWS
01485 {
01486
01487 var $_soapClient = NULL;
01488
01489 function LastschriftWS ()
01490 {
01491 global $bmfConfig;
01492
01493 $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"])));
01494 }
01495
01496 function abbuchenOhneEinzugsermaechtigung($eShopCustomerNumber, $address, $bank, $bookingList)
01497 {
01498 global $bmfConfig;
01499
01500 $tmp = array(
01501 'mandantNr' => $bmfConfig["mandantNr"],
01502 'eShopKundenNr' => $eShopCustomerNumber,
01503 'lieferAdresse' => $address,
01504 'bankverbindung' => $bank,
01505 'buchungsListe' => $bookingList
01506 );
01507
01508 $result = $this->_soapClient->call("abbuchenOhneEinzugsermaechtigung", $tmp, "LastschriftWS");
01509 return $result;
01510 }
01511
01512 };
01513
01514 class Kunde
01515 {
01516 var $OBJTypeNS = array ('namespace' => 'http://www.bff.bund.de/ePayment' , 'type' => 'Kunde');
01517
01518 function Kunde ($customerNumber = "", $values = "")
01519 {
01520
01521
01522
01523
01524
01525
01526 $this->EShopKundenNr = time() . "_" . substr(md5(uniqid(rand(), true)), 0, 4);
01527 if ($customerNumber != "")
01528 {
01529 $this->EShopKundenNr = $customerNumber . "_" . time() . "_" . substr(md5(uniqid(rand(), true)), 0, 4);
01530 }
01531
01532
01533 if ($values == "")
01534 {
01535 $values = $_SESSION["bmf"]["personal_data"];
01536 }
01537
01538 if ($values["sprache"] != NULL)
01539 {
01540 $this->sprache = $values["sprache"];
01541 }
01542 if ($values["vorname"] != NULL)
01543 {
01544 $this->vorname = utf8_decode($values["vorname"]);
01545 }
01546 if ($values["nachname"] != NULL)
01547 {
01548 $this->nachname = utf8_decode($values["nachname"]);
01549 }
01550 if ($values["EMailAdresse"] != NULL)
01551 {
01552 $this->EMailAdresse = utf8_decode($values["EMailAdresse"]);
01553 }
01554
01555 $address = new Adresse();
01556
01557 $this->rechnungsAdresse = $address;
01558 }
01559
01560 function getEShopCustomerNumber()
01561 {
01562 return $this->EShopKundenNr;
01563 }
01564
01565 }
01566
01567 class Adresse
01568 {
01569 var $OBJTypeNS = array ('namespace' => 'http://www.bff.bund.de/ePayment' , 'type' => 'Adresse');
01570
01571 function Adresse ($values = "")
01572 {
01573 if ($values == "")
01574 {
01575 $values = $_SESSION["bmf"]["personal_data"];
01576 }
01577
01578 if (is_array($values))
01579 {
01580 if ($values["strasse"] != NULL)
01581 {
01582 $this->strasse = utf8_decode($values["strasse"]);
01583 }
01584 if ($values["hausNr"] != NULL)
01585 {
01586 $this->hausNr = utf8_decode($values["hausNr"]);
01587 }
01588 if ($values["postfach"] != NULL)
01589 {
01590 $this->postfach = utf8_decode($values["postfach"]);
01591 }
01592 if ($values["land"] != NULL)
01593 {
01594 $this->land = utf8_decode($values["land"]);
01595 }
01596 if ($values["PLZ"] != NULL)
01597 {
01598 $this->PLZ = utf8_decode($values["PLZ"]);
01599 }
01600 if ($values["ort"] != NULL)
01601 {
01602 $this->ort = utf8_decode($values["ort"]);
01603 }
01604 }
01605 }
01606
01607 }
01608
01609 class Kreditkarte
01610 {
01611 var $OBJTypeNS = array ('namespace' => 'http://www.bff.bund.de/ePayment' , 'type' => 'Kreditkarte');
01612
01613 function Kreditkarte ($values = "")
01614 {
01615 if ($values == "")
01616 {
01617 $values = $_SESSION["bmf"]["credit_card"];
01618 }
01619
01620 if (is_array($values))
01621 {
01622 if ($values["karteninhaber"] != NULL)
01623 {
01624 $this->karteninhaber = utf8_decode($values["karteninhaber"]);
01625 }
01626 if ($values["kartenpruefnummer"] != NULL)
01627 {
01628 $this->kartenpruefnummer = utf8_decode($values["kartenpruefnummer"]);
01629 }
01630 if (is_array ($values["kreditkartenNr"]) &&
01631 count($values["kreditkartenNr"]) == 4)
01632 {
01633 for ($i = 1; $i <= count($values["kreditkartenNr"]); $i++)
01634 {
01635 $this->kreditkartenNr .= utf8_decode($values["kreditkartenNr"]["block_".$i]);# . "-";
01636 }
01637 # $this->kreditkartenNr = substr($this->kreditkartenNr, 0, strlen($this->kreditkartenNr)-1);
01638 }
01639 if (is_array($values["gueltigkeit"]) &&
01640 $values["gueltigkeit"]["monat"] != "" &&
01641 $values["gueltigkeit"]["jahr"] != "")
01642 {
01643 $this->gueltigkeit = utf8_decode($values["gueltigkeit"]["monat"]);
01644 $this->gueltigkeit .= utf8_decode($values["gueltigkeit"]["jahr"]);
01645 }
01646 }
01647 }
01648
01649 }
01650
01651 class Lastschrift
01652 {
01653 var $OBJTypeNS = array ('namespace' => 'http://www.bff.bund.de/ePayment' , 'type' => 'Lastschrift');
01654
01655 function Lastschrift ($customerNumber = "", $values = "")
01656 {
01657 $this->EShopKundenNr = time() . "_" . substr(md5(uniqid(rand(), true)), 0, 4);
01658 if ($customerNumber != "")
01659 {
01660 $this->EShopKundenNr = $customerNumber . "_" . time() . "_" . substr(md5(uniqid(rand(), true)), 0, 4);
01661 }
01662 }
01663
01664 }
01665
01666 class Bankverbindung
01667 {
01668 var $OBJTypeNS = array ('namespace' => 'http://www.bff.bund.de/ePayment' , 'type' => 'Bankverbindung');
01669
01670 function Bankverbindung ($values = "")
01671 {
01672 if ($values == "")
01673 {
01674 $values = $_SESSION["bmf"]["debit_entry"];
01675 }
01676
01677 if (is_array($values))
01678 {
01679 if ($values["kontoinhaber"] != NULL)
01680 {
01681 $this->kontoinhaber = utf8_decode($values["kontoinhaber"]);
01682 }
01683 if ($values["kontoNr"] != NULL)
01684 {
01685 $this->kontoNr = utf8_decode($values["kontoNr"]);
01686 }
01687 if ($values["BLZ"] != NULL)
01688 {
01689 $this->BLZ = utf8_decode($values["BLZ"]);
01690 }
01691 }
01692 }
01693
01694 }
01695
01696 class Buchung
01697 {
01698 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');
01699
01700 function Buchung($values = "")
01701 {
01702 global $bmfConfig;
01703
01704 if ($bmfConfig["haushaltsstelle"] != NULL)
01705 {
01706 $this->haushaltsstelle = $bmfConfig["haushaltsstelle"];
01707 }
01708 if ($bmfConfig["objektNr"] != NULL)
01709 {
01710 $this->objektnummer = $bmfConfig["objektNr"];
01711 }
01712
01713 if (is_array($values))
01714 {
01715 if ($values["buchungstext"] != NULL)
01716 {
01717 $buchungstext = utf8_decode($values["buchungstext"]);
01718 if(strlen($buchungstext) > 16)
01719 {
01720 $buchungstext = substr($buchungstext,0,15).'...';
01721 }
01722
01723 $this->buchungstext = $buchungstext;
01724 }
01725 if ($values["betrag"] != "")
01726 {
01727 $this->betrag = $values["betrag"];
01728 }
01729 }
01730 }
01731
01732
01733 function setVoucherNumber($voucherNumber)
01734 {
01735 if ($voucherNumber != NULL)
01736 {
01737 $this->belegNr = $voucherNumber;
01738 }
01739 }
01740
01741 function getVoucherNumber()
01742 {
01743 return $this->belegNr;
01744 }
01745 }
01746
01747 class BuchungsListe
01748 {
01749 var $OBJTypeNS = array ('namespace' => 'http://www.bff.bund.de/ePayment', 'nsPrefix' => 'ns2', 'type' => 'BuchungsListe');
01750
01751 function BuchungsListe($userId, $values = "")
01752 {
01753 global $bmfConfig,$ilias;
01754
01755 if ($bmfConfig["bewirtschafterNr"] != NULL)
01756 {
01757 $this->bewirtschafterNr = $bmfConfig["bewirtschafterNr"];
01758 }
01759 if ($bmfConfig["waehrungskennzeichen"] != NULL)
01760 {
01761 $this->waehrungskennzeichen = $bmfConfig["waehrungskennzeichen"];
01762 }
01763 $this->faelligkeitsdatum = date("Y-m-d") . "T" . date("H:i:s") . "Z";
01764 if ($bmfConfig["kennzeichenMahnverfahren"] != NULL)
01765 {
01766 $this->kennzeichenMahnverfahren = $bmfConfig["kennzeichenMahnverfahren"];
01767 }
01768
01769 $inst_id_time = $ilias->getSetting('inst_id').'_'.$userId.'_'.substr((string) time(),-3);
01770 $this->EShopTransaktionsNr = $inst_id_time.substr(md5(uniqid(rand(), true)), 0, 4);
01771
01772 if (is_array($values))
01773 {
01774 if ($values["betrag"] != NULL)
01775 {
01776 $this->betrag = $values["betrag"];
01777 }
01778 if ($values["buchungen"] != NULL)
01779 {
01780 $this->buchungen = $values["buchungen"];
01781 }
01782 }
01783 }
01784 function getTransaction()
01785 {
01786 return $this->EShopTransaktionsNr;
01787 }
01788
01789
01790 function setKassenzeichen($kassenzeichen)
01791 {
01792 if ($kassenzeichen != NULL)
01793 {
01794 $this->kassenzeichen = $kassenzeichen;
01795 }
01796 }
01797
01798 function getKassenzeichen()
01799 {
01800 return $this->kassenzeichen;
01801 }
01802
01803 }
01804
01805 class LieferAdresse
01806 {
01807 var $OBJTypeNS = array ('namespace' => 'http://www.bff.bund.de/ePayment' , 'type' => 'LieferAdresse');
01808
01809 function LieferAdresse ($values = "")
01810 {
01811 if ($values == "")
01812 {
01813 $values = $_SESSION["bmf"]["personal_data"];
01814 }
01815
01816 if (is_array($values))
01817 {
01818 if ($values["vorname"] != NULL)
01819 {
01820 $this->vorname = utf8_decode($values["vorname"]);
01821 }
01822 if ($values["nachname"] != NULL)
01823 {
01824 $this->nachname = utf8_decode($values["nachname"]);
01825 }
01826 if ($values["strasse"] != NULL)
01827 {
01828 $this->strasse = utf8_decode($values["strasse"]);
01829 }
01830 if ($values["hausNr"] != NULL)
01831 {
01832 $this->hausNr = utf8_decode($values["hausNr"]);
01833 }
01834 if ($values["postfach"] != NULL)
01835 {
01836 $this->postfach = utf8_decode($values["postfach"]);
01837 }
01838 if ($values["land"] != NULL)
01839 {
01840 $this->land = utf8_decode($values["land"]);
01841 }
01842 if ($values["PLZ"] != NULL)
01843 {
01844 $this->PLZ = utf8_decode($values["PLZ"]);
01845 }
01846 if ($values["ort"] != NULL)
01847 {
01848 $this->ort = utf8_decode($values["ort"]);
01849 }
01850 }
01851 }
01852 }
01853
01854 ?>