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