18 include_once
'./Services/Payment/classes/class.ilBMFSettings.php';
19 #include_once dirname(__FILE__)."/../bmf/lib/ePayment/cfg_epayment.inc.php";
20 include_once dirname(__FILE__).
"/../bmf/lib/SOAP/class.ilBMFClient.php";
22 include_once
'./Services/Payment/classes/class.ilPayMethods.php';
23 include_once
'./Services/Payment/classes/class.ilPurchaseBaseGUI.php';
64 if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
67 $this->tpl->setVariable(
"HEADER",$this->lng->txt(
'pay_bmf_your_order'));
68 $this->tpl->touchBlock(
"stop_floating");
74 $this->tpl->setVariable(
"HEADER",$this->lng->txt(
'pay_step1'));
75 $this->tpl->setVariable(
"TITLE",$this->lng->txt(
'pay_bmf_personal_data'));
76 $this->tpl->setVariable(
"DESCRIPTION",$this->lng->txt(
'pay_bmf_description_personal_data'));
78 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
81 $oForm->setFormAction($this->ctrl->getFormAction($this,
'getPersonalData'));
82 $oForm->setTitle($this->lng->txt(
'pay_bmf_personal_data'));
85 $oFirstname->
setValue($this->user_obj->getFirstname());
86 $oForm->addItem($oFirstname);
89 $oLastname->
setValue($this->user_obj->getLastname());
90 $oForm->addItem($oLastname);
96 $oForm->addItem($oStreet);
98 $oHouseNumber =
new ilTextInputGUI($this->lng->txt(
'pay_bmf_house_number'),
'house_number');
99 $oHouseNumber->
setValue($this->error !=
'' && isset(
$_POST[
'house_number'])
102 $oForm->addItem($oHouseNumber);
104 $oPoBox =
new ilTextInputGUI($this->lng->txt(
'pay_bmf_or').
' '.$this->lng->txt(
'pay_bmf_po_box'),
'po_box');
108 $oForm->addItem($oPoBox);
110 $oZipCode =
new ilTextInputGUI($this->lng->txt(
'zipcode'),
'zipcode');
111 $oZipCode->
setValue($this->error !=
'' && isset(
$_POST[
'zipcode'])
114 $oForm->addItem($oZipCode);
120 $oForm->addItem($oCity);
125 $oCountry->setValue($this->error !=
'' && isset(
$_POST[
'country']) ?
$_POST[
'country']
126 :
$_SESSION[
'bmf'][
'personal_data'][
'country']);
127 $oForm->addItem($oCountry);
130 $oEmail->
setValue($this->user_obj->getEmail());
131 $oForm->addItem($oEmail);
133 $oForm->addcommandButton(
'getPersonalData',ucfirst($this->lng->txt(
'next')));
134 $this->tpl->setVariable(
'FORM',$oForm->getHTML());
142 if (
$_SESSION[
"bmf"][
"personal_data"][
"firstname"] ==
"" ||
143 $_SESSION[
"bmf"][
"personal_data"][
"lastname"] ==
"" ||
144 $_POST[
"zipcode"] ==
"" ||
146 $_POST[
"country"] ==
"" ||
147 $_SESSION[
"bmf"][
"personal_data"][
"email"] ==
"")
149 $this->error = $this->lng->txt(
'pay_bmf_personal_data_not_valid');
154 if ((
$_POST[
"street"] ==
"" &&
$_POST[
"house_number"] ==
"" &&
$_POST[
"po_box"] ==
"") ||
155 ((
$_POST[
"street"] !=
"" ||
$_POST[
"house_number"] !=
"") &&
$_POST[
"po_box"] !=
"") ||
156 (
$_POST[
"street"] !=
"" &&
$_POST[
"house_number"] ==
"") ||
157 (
$_POST[
"street"] ==
"" &&
$_POST[
"house_number"] !=
""))
159 $this->error = $this->lng->txt(
'pay_bmf_street_or_pobox');
166 $_SESSION[
"bmf"][
"personal_data"][
"firstname"] = $this->user_obj->getFirstname();
167 $_SESSION[
"bmf"][
"personal_data"][
"lastname"] = $this->user_obj->getLastname();
169 $_SESSION[
"bmf"][
"personal_data"][
"house_number"] =
$_POST[
"house_number"];
174 $_SESSION[
"bmf"][
"personal_data"][
"email"] = $this->user_obj->getEmail();
175 $_SESSION[
"bmf"][
"personal_data"][
"language"] = $this->user_obj->getLanguage();
177 if (
$_SESSION[
"bmf"][
"personal_data"][
"country"] !=
"DE")
179 if (
$_SESSION[
"bmf"][
"payment_type"] ==
"debit_entry")
196 if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
199 $this->tpl->setVariable(
"HEADER",$this->lng->txt(
'pay_bmf_your_order'));
200 $this->tpl->touchBlock(
"stop_floating");
207 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.pay_bmf_payment_type.html',
'Services/Payment');
209 $this->tpl->setVariable(
"PAYMENT_TYPE_FORMACTION",$this->ctrl->getFormAction($this));
213 $this->tpl->setVariable(
"ALT_IMG",$this->lng->txt(
'obj_usr'));
214 $this->tpl->setVariable(
"HEADER",$this->lng->txt(
'pay_step2'));
215 $this->tpl->setVariable(
"TITLE",$this->lng->txt(
'pay_bmf_payment_type'));
216 $this->tpl->setVariable(
"DESCRIPTION",$this->lng->txt(
'pay_bmf_description_payment_type'));
217 $this->tpl->touchBlock(
"stop_floating");
218 $this->tpl->setVariable(
"TXT_CLOSE_WINDOW",$this->lng->txt(
'close_window'));
221 if (
$_SESSION[
"bmf"][
"personal_data"][
"country"] ==
"DE")
223 $this->tpl->setVariable(
"TXT_DEBIT_ENTRY",$this->lng->txt(
'pay_bmf_debit_entry'));
225 $this->tpl->setVariable(
"TXT_CREDIT_CARD",$this->lng->txt(
'pay_bmf_credit_card'));
227 $this->tpl->setVariable(
"INPUT_VALUE",ucfirst($this->lng->txt(
'next')));
228 $this->tpl->setVariable(
"CANCEL",$this->lng->txt(
'cancel'));
232 if ($this->error !=
"" &&
233 isset(
$_POST[
"payment_type"]))
235 $this->tpl->setVariable(
"PAYMENT_TYPE_" . strtoupper(
$_POST[
"payment_type"]),
" checked") ;
239 if ((
$_SESSION[
"bmf"][
"personal_data"][
"country"] !=
"DE" &&
$_POST[
"payment_type"] !=
"debit_entry") ||
240 $_SESSION[
"bmf"][
"personal_data"][
"country"] ==
"DE")
242 $this->tpl->setVariable(
"PAYMENT_TYPE_" . strtoupper(
$_SESSION[
"bmf"][
"payment_type"]),
" checked") ;
247 $this->tpl->addBlockfile(
"BUTTONS",
"buttons",
"tpl.buttons.html");
248 $this->tpl->setCurrentBlock(
"btn_cell");
249 $this->tpl->setVariable(
"BTN_LINK", $this->ctrl->getLinkTarget($this,
"showPersonalData"));
250 $this->tpl->setVariable(
"BTN_TXT", $this->lng->txt(
'pay_bmf_back'));
251 $this->tpl->parseCurrentBlock(
"btn_cell");
258 if ((
$_POST[
"payment_type"] !=
"credit_card" &&
$_POST[
"payment_type"] !=
"debit_entry") ||
259 (
$_SESSION[
"bmf"][
"personal_data"][
"country"] !=
"DE" &&
$_POST[
"payment_type"] ==
"debit_entry"))
261 $this->error = $this->lng->txt(
'pay_bmf_payment_type_not_valid');
270 if (
$_SESSION[
"bmf"][
"payment_type"] ==
"credit_card")
294 if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
297 $this->tpl->setVariable(
"HEADER",$this->lng->txt(
'pay_bmf_your_order'));
298 $this->tpl->touchBlock(
"stop_floating");
305 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.pay_bmf_debit_entry.html',
'Services/Payment');
309 $this->tpl->setVariable(
"DEBIT_ENTRY_FORMACTION",$this->ctrl->getFormAction($this));
313 $this->tpl->setVariable(
"ALT_IMG",$this->lng->txt(
'obj_usr'));
314 $this->tpl->setVariable(
"HEADER",$this->lng->txt(
'pay_step3_debit_entry'));
315 $this->tpl->setVariable(
"TITLE",$this->lng->txt(
'pay_bmf_debit_entry_data'));
316 $this->tpl->setVariable(
"DESCRIPTION",$this->lng->txt(
'pay_bmf_description_debit_entry'));
317 $this->tpl->touchBlock(
"stop_floating");
318 $this->tpl->setVariable(
"TXT_CLOSE_WINDOW",$this->lng->txt(
'close_window'));
321 $this->tpl->setVariable(
"TXT_ACCOUNT_HOLDER",$this->lng->txt(
'pay_bmf_account_holder'));
322 $this->tpl->setVariable(
"TXT_OPTIONAL",$this->lng->txt(
'pay_bmf_optional'));
323 $this->tpl->setVariable(
"TXT_BANK_CODE",$this->lng->txt(
'pay_bmf_bank_code'));
324 $this->tpl->setVariable(
"TXT_ACCOUNT_NUMBER",$this->lng->txt(
'pay_bmf_account_number'));
325 $this->tpl->setVariable(
"TXT_TERMS_CONDITIONS",$this->lng->txt(
'pay_bmf_terms_conditions'));
326 $this->tpl->setVariable(
"TXT_TERMS_CONDITIONS_READ",$this->lng->txt(
'pay_bmf_terms_conditions_read'));
327 $this->tpl->setVariable(
"TXT_TERMS_CONDITIONS_SHOW",$this->lng->txt(
'pay_bmf_terms_conditions_show'));
328 $this->tpl->setVariable(
"LINK_TERMS_CONDITIONS",
"./payment.php?view=conditions");
329 $this->tpl->setVariable(
"TXT_PASSWORD",$this->lng->txt(
'password'));
330 $this->tpl->setVariable(
"TXT_CONFIRM_ORDER",$this->lng->txt(
'pay_confirm_order'));
332 $this->tpl->setVariable(
"INPUT_VALUE",$this->lng->txt(
'pay_send_order'));
333 $this->tpl->setVariable(
"CANCEL",$this->lng->txt(
'cancel'));
337 $this->tpl->setVariable(
"ACCOUNT_HOLDER",
338 $this->error !=
"" && isset(
$_POST[
'account_holder'])
341 $this->tpl->setVariable(
"BANK_CODE",
342 $this->error !=
"" && isset(
$_POST[
'bank_code'])
345 $this->tpl->setVariable(
"ACCOUNT_NUMBER",
346 $this->error !=
"" && isset(
$_POST[
'account_number'])
361 $this->tpl->addBlockfile(
"BUTTONS",
"buttons",
"tpl.buttons.html");
362 $this->tpl->setCurrentBlock(
"btn_cell");
363 $this->tpl->setVariable(
"BTN_LINK", $this->ctrl->getLinkTarget($this,
"showPaymentType"));
364 $this->tpl->setVariable(
"BTN_TXT", $this->lng->txt(
'pay_bmf_back'));
365 $this->tpl->parseCurrentBlock(
"btn_cell");
372 if (
$_POST[
"account_holder"] ==
"" ||
373 $_POST[
"bank_code"] ==
"" ||
374 $_POST[
"account_number"] ==
"")
376 $this->error = $this->lng->txt(
'pay_bmf_debit_entry_not_valid');
381 if (
$_POST[
"terms_conditions"] != 1)
383 $this->error = $this->lng->txt(
'pay_bmf_check_terms_conditions');
388 require_once
'Services/User/classes/class.ilUserPasswordManager.php';
389 $verified_passwd = ilUserPasswordManager::getInstance()->verifyPassword($this->user_obj,
ilUtil::stripSlashes(
$_POST[
"password"]));
390 if (
$_POST[
"password"] ==
"" || $verified_passwd ==
false)
392 $this->error = $this->lng->txt(
'pay_bmf_password_not_valid');
399 $_SESSION[
"bmf"][
"debit_entry"][
"kontoinhaber"] =
$_POST[
"account_holder"];
410 $this->psc_obj->clearCouponItemsSession();
412 if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
415 $this->tpl->setVariable(
"HEADER",$this->lng->txt(
'pay_bmf_your_order'));
416 $this->tpl->touchBlock(
"stop_floating");
424 $newCustomer =
new Kunde($this->user_obj->getId());
426 $resultCustomerObj = $customer->anlegenKunde($newCustomer);
428 $resultCustomer = $resultCustomerObj->ergebnis;
430 if (is_object($resultCustomer))
432 if ($resultCustomer->code < 0)
434 $error = $this->lng->txt(
'pay_bmf_server_error_code') .
" " . $resultCustomer->code .
": " . $resultCustomer->kurzText .
"<br>\n" . $resultCustomer->langText;
435 if ($resultCustomer->code == -103 ||
436 $resultCustomer->code == -104 ||
437 $resultCustomer->code == -107 ||
438 ($resultCustomer->code <= -202 && $resultCustomer->code >= -208) ||
439 $resultCustomer->code == -213)
446 $error .=
"<br>\n" . $this->lng->txt(
'pay_bmf_server_error_sysadmin');
463 $tmp_bookEntries = $sc_obj->getShoppingCart();
465 if (!is_array($tmp_bookEntries))
472 for ($i = 0; $i < count($tmp_bookEntries); $i++)
478 $price = $tmp_bookEntries[$i][
"price"];
479 $tmp_bookEntries[$i][
"math_price"] = $price;
481 foreach (
$_SESSION[
"coupons"][
"bmf"] as $key => $coupon)
483 $this->coupon_obj->setId($coupon[
"pc_pk"]);
484 $this->coupon_obj->setCurrentCoupon($coupon);
486 $tmp_pobject =
new ilPaymentObject($this->user_obj, $tmp_bookEntries[$i][
'pobject_id']);
488 if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
490 $_SESSION[
"coupons"][
"bmf"][$key][
"total_objects_coupon_price"] += $price;
491 $_SESSION[
"coupons"][
"bmf"][$key][
"items"][] = $tmp_bookEntries[$i];
501 $tmp_bookEntries[$i][
"price_string"] = number_format( (
float) $tmp_bookEntries[$i][
"price"] , 2,
".",
"");
502 $bookEntries[] =
new Buchung($tmp_bookEntries[$i]);
503 $totalAmount += $tmp_bookEntries[$i][
"price"];
507 $tmp_bookEntries[$i][
"price_string"] = number_format( (
float) $tmp_bookEntries[$i][
"price"] , 2,
",",
".");
511 $coupon_discount_items = $this->psc_obj->calcDiscountPrices(
$_SESSION[
"coupons"][
"bmf"]);
513 if (is_array($coupon_discount_items) && !empty($coupon_discount_items))
515 foreach ($coupon_discount_items as $item)
517 $item[
"price"]= number_format( (
float) $item[
"discount_price"], 2,
".",
"");
518 $bookEntries[] =
new Buchung($item);
519 $totalAmount += $item[
"price"];
523 $totalAmount = number_format( (
float) $totalAmount , 2,
".",
"");
524 $values = array(
"betrag" => $totalAmount,
"buchungen" => $bookEntries);
525 $bookingList =
new BuchungsListe($this->user_obj->getId(), $values);
530 $resultObj = $payment->abbuchenOhneEinzugsermaechtigung($resultCustomerObj->kunde->EShopKundenNr, $address, $bank, $bookingList);
531 $result = $resultObj->ergebnis;
537 $this->tpl->setVariable(
"HEADER",$this->lng->txt(
'error'));
538 $this->tpl->touchBlock(
"stop_floating");
539 $error = $this->lng->txt(
'pay_bmf_server_error_code') .
" " .
$result->code .
": " .
$result->kurzText .
"<br>\n" .
$result->langText;
549 else if (
$result->code == -507 ||
556 else if (
$result->code == -402 ||
571 $error .=
"<br>\n" . $this->lng->txt(
'pay_bmf_server_error_sysadmin');
579 $resultCustomerObj->kunde->vorname = utf8_decode($resultCustomerObj->kunde->vorname);
580 $resultCustomerObj->kunde->nachname = utf8_decode($resultCustomerObj->kunde->nachname);
581 $resultCustomerObj->kunde->rechnungsAdresse->strasse = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->strasse);
582 $resultCustomerObj->kunde->rechnungsAdresse->hausNr = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->hausNr);
583 $resultCustomerObj->kunde->rechnungsAdresse->postfach = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->postfach);
584 $resultCustomerObj->kunde->rechnungsAdresse->PLZ = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->PLZ);
585 $resultCustomerObj->kunde->rechnungsAdresse->ort = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->ort);
586 $resultCustomerObj->kunde->rechnungsAdresse->land = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->land);
589 $external_data = array();
590 $external_data[
'voucher'] = $resultObj->buchungsListe->buchungen[$b++]->belegNr;
591 $external_data[
'transaction_extern'] = $resultObj->buchungsListe->kassenzeichen;
592 $external_data[
'street'] = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->strasse).
' '.utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->hausNr);
593 $external_data[
'po_box'] = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->postfach);
594 $external_data[
'zipcode'] = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->PLZ);
595 $external_data[
'city'] = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->ort);
596 $external_data[
'country'] = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->land);
598 parent::__addbookings($external_data);
603 $this->tpl->setVariable(
"HEADER",$this->lng->txt(
'pay_bmf_your_order'));
604 $this->tpl->setVariable(
"DESCRIPTION",$this->lng->txt(
'pay_bmf_thanks'));
605 $this->tpl->touchBlock(
"stop_floating");
609 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.pay_bmf_debit_entry.html',
'Services/Payment');
611 if ($this->ilias->getSetting(
"https") != 1)
613 $this->tpl->setCurrentBlock(
"buyed_objects");
614 $link = $this->ctrl->getLinkTargetByClass(
'ilshopboughtobjectsgui');
615 $this->tpl->setVariable(
"LINK_GOTO_BUYED_OBJECTS", $link);
616 $this->tpl->setVariable(
"TXT_GOTO_BUYED_OBJECTS", $this->lng->txt(
'pay_goto_buyed_objects'));
617 $this->tpl->parseCurrentBlock(
"buyed_objects");
619 $this->tpl->setVariable(
"TXT_CLOSE_WINDOW", $this->lng->txt(
'close_window'));
624 $this->tpl->setVariable(
"HEADER",$this->lng->txt(
'error'));
625 $this->tpl->touchBlock(
"stop_floating");
632 $this->tpl->setVariable(
"HEADER",$this->lng->txt(
'error'));
633 $this->tpl->touchBlock(
"stop_floating");
653 if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
656 $this->tpl->setVariable(
"HEADER",$this->lng->txt(
'pay_bmf_your_order'));
657 $this->tpl->touchBlock(
"stop_floating");
664 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.pay_bmf_credit_card.html',
'Services/Payment');
667 $this->tpl->setVariable(
"CREDIT_CARD_FORMACTION",$this->ctrl->getFormAction($this));
671 $this->tpl->setVariable(
"ALT_IMG",$this->lng->txt(
'obj_usr'));
672 $this->tpl->setVariable(
"HEADER",$this->lng->txt(
'pay_step3_credit_card'));
673 $this->tpl->setVariable(
"TITLE",$this->lng->txt(
'pay_bmf_credit_card_data'));
674 $this->tpl->setVariable(
"DESCRIPTION",$this->lng->txt(
'pay_bmf_description_credit_card'));
675 $this->tpl->touchBlock(
"stop_floating");
676 $this->tpl->setVariable(
"TXT_CLOSE_WINDOW",$this->lng->txt(
'close_window'));
679 $this->tpl->setVariable(
"TXT_CARD_HOLDER",$this->lng->txt(
'pay_bmf_card_holder'));
680 $this->tpl->setVariable(
"TXT_CHECK_NUMBER",$this->lng->txt(
'pay_bmf_check_number'));
681 $this->tpl->setVariable(
"TXT_OPTIONAL",$this->lng->txt(
'pay_bmf_optional'));
682 $this->tpl->setVariable(
"TXT_CARD_NUMBER",$this->lng->txt(
'pay_bmf_card_number'));
683 $this->tpl->setVariable(
"TXT_VALIDITY",$this->lng->txt(
'pay_bmf_validity'));
684 $this->tpl->setVariable(
"TXT_TERMS_CONDITIONS",$this->lng->txt(
'pay_bmf_terms_conditions'));
685 $this->tpl->setVariable(
"TXT_TERMS_CONDITIONS_READ",$this->lng->txt(
'pay_bmf_terms_conditions_read'));
686 $this->tpl->setVariable(
"TXT_TERMS_CONDITIONS_SHOW",$this->lng->txt(
'pay_bmf_terms_conditions_show'));
687 $this->tpl->setVariable(
"LINK_TERMS_CONDITIONS",
"./payment.php?view=conditions");
688 $this->tpl->setVariable(
"TXT_PASSWORD",$this->lng->txt(
'password'));
689 $this->tpl->setVariable(
"TXT_CONFIRM_ORDER",$this->lng->txt(
'pay_confirm_order'));
691 $this->tpl->setVariable(
"INPUT_VALUE",$this->lng->txt(
'pay_send_order'));
692 $this->tpl->setVariable(
"CANCEL",$this->lng->txt(
'cancel'));
696 $this->tpl->setVariable(
"CARD_HOLDER",
697 $this->error !=
"" && isset(
$_POST[
'card_holder'])
700 $this->tpl->setVariable(
"CARD_NUMBER_BLOCK_1",
701 $this->error !=
"" && isset(
$_POST[
'card_number'][
'block_1'])
704 $this->tpl->setVariable(
"CARD_NUMBER_BLOCK_2",
705 $this->error !=
"" && isset(
$_POST[
'card_number'][
'block_2'])
708 $this->tpl->setVariable(
"CARD_NUMBER_BLOCK_3",
709 $this->error !=
"" && isset(
$_POST[
'card_number'][
'block_3'])
712 $this->tpl->setVariable(
"CARD_NUMBER_BLOCK_4",
713 $this->error !=
"" && isset(
$_POST[
'card_number'][
'block_4'])
716 $this->tpl->setVariable(
"CHECK_NUMBER",
717 $this->error !=
"" && isset(
$_POST[
'check_number'])
720 for ($i = 1; $i <= 12; $i++)
722 $this->tpl->setCurrentBlock(
"loop_validity_months");
723 $this->tpl->setVariable(
"LOOP_VALIDITY_MONTHS", $i < 10 ?
"0" . $i : $i);
724 $this->tpl->setVariable(
"LOOP_VALIDITY_MONTHS_TXT", $i < 10 ?
"0" . $i : $i);
725 if ($this->error !=
"" &&
726 isset(
$_POST[
'validity'][
'month']))
728 if (
$_POST[
'validity'][
'month'] == $i)
730 $this->tpl->setVariable(
"LOOP_VALIDITY_MONTHS_SELECTED",
" selected");
735 if (
$_SESSION[
"bmf"][
"credit_card"][
"gueltigkeit"][
"monat"] == $i)
737 $this->tpl->setVariable(
"LOOP_VALIDITY_MONTHS_SELECTED",
" selected");
740 $this->tpl->parseCurrentBlock(
"loop_validity_months");
742 for ($i = date(
"Y"); $i <= (date(
"Y")+6); $i++)
744 $this->tpl->setCurrentBlock(
"loop_validity_years");
745 $this->tpl->setVariable(
"LOOP_VALIDITY_YEARS", $i);
746 $this->tpl->setVariable(
"LOOP_VALIDITY_YEARS_TXT", $i);
747 if ($this->error !=
"" &&
748 isset(
$_POST[
'validity'][
'year']))
750 if (
$_POST[
'validity'][
'year'] == $i)
752 $this->tpl->setVariable(
"LOOP_VALIDITY_YEARS_SELECTED",
" selected");
757 if (
$_SESSION[
"bmf"][
"credit_card"][
"gueltigkeit"][
"jahr"] == $i)
759 $this->tpl->setVariable(
"LOOP_VALIDITY_YEARS_SELECTED",
" selected");
762 $this->tpl->parseCurrentBlock(
"loop_validity_years");
776 $this->tpl->addBlockfile(
"BUTTONS",
"buttons",
"tpl.buttons.html");
777 $this->tpl->setCurrentBlock(
"btn_cell");
778 $this->tpl->setVariable(
"BTN_LINK", $this->ctrl->getLinkTarget($this,
"showPaymentType"));
779 $this->tpl->setVariable(
"BTN_TXT", $this->lng->txt(
'pay_bmf_back'));
780 $this->tpl->parseCurrentBlock(
"btn_cell");
787 if (
$_POST[
"card_holder"] ==
"" ||
788 $_POST[
"card_number"][
"block_1"] ==
"" ||
789 $_POST[
"card_number"][
"block_2"] ==
"" ||
790 $_POST[
"card_number"][
"block_3"] ==
"" ||
791 $_POST[
"card_number"][
"block_4"] ==
"" ||
792 $_POST[
"validity"][
"month"] ==
"" ||
793 $_POST[
"validity"][
"year"] ==
"" ||
794 $_POST[
"validity"][
"year"].
"-".
$_POST[
"validity"][
"month"] < date(
"Y-m"))
796 $this->error = $this->lng->txt(
'pay_bmf_credit_card_not_valid');
801 if (
$_POST[
"terms_conditions"] != 1)
803 $this->error = $this->lng->txt(
'pay_bmf_check_terms_conditions');
809 require_once
'Services/User/classes/class.ilUserPasswordManager.php';
810 $verified_passwd = ilUserPasswordManager::getInstance()->verifyPassword($this->user_obj,
ilUtil::stripSlashes(
$_POST[
"password"]));
811 if (
$_POST[
"password"] ==
"" || $verified_passwd ==
false)
813 $this->error = $this->lng->txt(
'pay_bmf_password_not_valid');
819 $_SESSION[
"bmf"][
"credit_card"][
"gueltigkeit"][
"monat"] =
$_POST[
"validity"][
"month"];
820 $_SESSION[
"bmf"][
"credit_card"][
"gueltigkeit"][
"jahr"] =
$_POST[
"validity"][
"year"];
821 $_SESSION[
"bmf"][
"credit_card"][
"karteninhaber"] =
$_POST[
"card_holder"];
822 $_SESSION[
"bmf"][
"credit_card"][
"kreditkartenNr"][
"block_1"] =
$_POST[
"card_number"][
"block_1"];
823 $_SESSION[
"bmf"][
"credit_card"][
"kreditkartenNr"][
"block_2"] =
$_POST[
"card_number"][
"block_2"];
824 $_SESSION[
"bmf"][
"credit_card"][
"kreditkartenNr"][
"block_3"] =
$_POST[
"card_number"][
"block_3"];
825 $_SESSION[
"bmf"][
"credit_card"][
"kreditkartenNr"][
"block_4"] =
$_POST[
"card_number"][
"block_4"];
826 $_SESSION[
"bmf"][
"credit_card"][
"kartenpruefnummer"] =
$_POST[
"check_number"];
836 $this->psc_obj->clearCouponItemsSession();
838 if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
841 $this->tpl->setVariable(
"HEADER",$this->lng->txt(
'pay_bmf_your_order'));
842 $this->tpl->touchBlock(
"stop_floating");
850 $customer =
new Kunde($this->user_obj->getId());
856 $tmp_bookEntries = $sc_obj->getShoppingCart();
857 if (!is_array($tmp_bookEntries))
864 for ($i = 0; $i < count($tmp_bookEntries); $i++)
870 $price = $tmp_bookEntries[$i][
"price"];
871 $tmp_bookEntries[$i][
"math_price"] = $price;
873 foreach (
$_SESSION[
"coupons"][
"bmf"] as $key => $coupon)
875 $this->coupon_obj->setId($coupon[
"pc_pk"]);
876 $this->coupon_obj->setCurrentCoupon($coupon);
878 $tmp_pobject =
new ilPaymentObject($this->user_obj, $tmp_bookEntries[$i][
'pobject_id']);
880 if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
882 $_SESSION[
"coupons"][
"bmf"][$key][
"total_objects_coupon_price"] += $price;
883 $_SESSION[
"coupons"][
"bmf"][$key][
"items"][] = $tmp_bookEntries[$i];
894 $tmp_bookEntries[$i][
"price_string"] = number_format( (
float) $tmp_bookEntries[$i][
"price"] , 2,
",",
".");
896 $bookEntries[] =
new Buchung($tmp_bookEntries[$i]);
897 $totalAmount += $tmp_bookEntries[$i][
"price"];
901 $tmp_bookEntries[$i][
"price_string"] = number_format( (
float) $tmp_bookEntries[$i][
"price"] , 2,
",",
".");
905 $coupon_discount_items = $this->psc_obj->calcDiscountPrices(
$_SESSION[
"coupons"][
"bmf"]);
907 if (is_array($coupon_discount_items) && !empty($coupon_discount_items))
909 foreach ($coupon_discount_items as $item)
911 $item[
"price"] = number_format((
float)$item[
"discount_price"] , 2,
".",
"");
912 $bookEntries[] =
new Buchung($item);
913 $totalAmount += $item[
"discount_price"];
917 $totalAmount = number_format((
float)$totalAmount , 2,
".",
"");
918 $values = array(
"betrag" => $totalAmount,
"buchungen" => $bookEntries);
919 $bookingList =
new BuchungsListe($this->user_obj->getId(), $values);
922 $resultObj = $payment->zahlenUndAnlegenKunde($customer, $creditCard, $bookingList);
923 $result = $resultObj->ergebnis;
929 $this->tpl->setVariable(
"HEADER",$this->lng->txt(
'error'));
930 $this->tpl->touchBlock(
"stop_floating");
931 $error = $this->lng->txt(
'pay_bmf_server_error_code') .
" " .
$result->code .
": " .
$result->kurzText .
"<br>\n" .
$result->langText;
941 else if (
$result->code == -507 ||
948 else if (
$result->code == -701 ||
960 $error .=
"<br>\n" . $this->lng->txt(
'pay_bmf_server_error_sysadmin');
968 $external_data = array();
969 $external_data[
'voucher'] = $resultObj->buchungsListe->buchungen[$b++]->belegNr;
970 $external_data[
'transaction_extern'] = $resultObj->buchungsListe->kassenzeichen;
971 $external_data[
'street'] = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->strasse).
' '.utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->hausNr);
972 $external_data[
'po_box'] = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->postfach);
973 $external_data[
'zipcode'] = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->PLZ);
974 $external_data[
'city'] = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->ort);
975 $external_data[
'country'] = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->land);
977 parent::__addbookings($external_data);
982 $this->tpl->setVariable(
"HEADER",$this->lng->txt(
'pay_bmf_your_order'));
983 $this->tpl->setVariable(
"DESCRIPTION",$this->lng->txt(
'pay_bmf_thanks'));
984 $this->tpl->touchBlock(
"stop_floating");
988 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.pay_bmf_credit_card.html',
'Services/Payment');
990 if ($this->ilias->getSetting(
"https") != 1)
992 $this->tpl->setCurrentBlock(
"buyed_objects");
993 $link = $this->ctrl->getLinkTargetByClass(
'ilshopboughtobjectsgui');
994 $this->tpl->setVariable(
"LINK_GOTO_BUYED_OBJECTS", $link);
995 $this->tpl->setVariable(
"TXT_GOTO_BUYED_OBJECTS", $this->lng->txt(
'pay_goto_buyed_objects'));
996 $this->tpl->parseCurrentBlock(
"buyed_objects");
998 $this->tpl->setVariable(
"TXT_CLOSE_WINDOW", $this->lng->txt(
'close_window'));
1003 $this->tpl->setVariable(
"HEADER",$this->lng->txt(
'error'));
1004 $this->tpl->touchBlock(
"stop_floating");
1019 $cmd = $this->ctrl->getCmd();
1021 switch ($this->ctrl->getNextClass($this))
1025 if(!
$cmd = $this->ctrl->getCmd())
1027 $cmd =
'showPersonalData';
1046 $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"])));
1056 'kunde' => $customer
1059 $result = $this->_soapClient->call(
"anlegenKunde", $tmp,
"KundenstammdatenPflegeWS");
1074 $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"])));
1084 'kreditkarte' => $creditCard,
1085 'waehrungskennzeichen' =>
$bmfConfig[
"waehrungskennzeichen"]
1088 $result = $this->_soapClient->call(
"validierenKreditkarte", $tmp,
"KreditkartenzahlungWS");
1101 'Kunde' => $customer,
1102 'Kreditkarte' => $creditCard,
1103 'buchungsListe' => $bookingList,
1104 'lieferadresse' => $lieferadresse
1107 $result = $this->_soapClient->call(
"zahlenUndAnlegenKunde", $tmp,
"KreditkartenzahlungWS");
1122 $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"])));
1132 'eShopKundenNr' => $eShopCustomerNumber,
1133 'lieferAdresse' => $address,
1134 'bankverbindung' => $bank,
1135 'buchungsListe' => $bookingList
1138 $result = $this->_soapClient->call(
"abbuchenOhneEinzugsermaechtigung", $tmp,
"LastschriftWS");
1146 var
$OBJTypeNS = array (
'namespace' =>
'http://www.bff.bund.de/ePayment' ,
'type' =>
'Kunde');
1148 function Kunde ($customerNumber =
"", $values =
"")
1156 $this->EShopKundenNr = time() .
"_" . substr(md5(uniqid(rand(),
true)), 0, 4);
1157 if ($customerNumber !=
"")
1159 $this->EShopKundenNr = $customerNumber .
"_" . time() .
"_" . substr(md5(uniqid(rand(),
true)), 0, 4);
1165 $values =
$_SESSION[
"bmf"][
"personal_data"];
1168 if ($values[
"language"] != NULL)
1170 $this->sprache = $values[
"language"];
1172 if ($values[
"firstname"] != NULL)
1174 $this->vorname = utf8_decode($values[
"firstname"]);
1176 if ($values[
"lastname"] != NULL)
1178 $this->nachname = utf8_decode($values[
"lastname"]);
1180 if ($values[
"email"] != NULL)
1182 $this->EMailAdresse = utf8_decode($values[
"email"]);
1187 $this->rechnungsAdresse = $address;
1192 return $this->EShopKundenNr;
1199 var
$OBJTypeNS = array (
'namespace' =>
'http://www.bff.bund.de/ePayment' ,
'type' =>
'Adresse');
1205 $values =
$_SESSION[
"bmf"][
"personal_data"];
1208 if (is_array($values))
1210 if ($values[
"street"] != NULL)
1212 $this->strasse = utf8_decode($values[
"street"]);
1214 if ($values[
"house_number"] != NULL)
1216 $this->hausNr = utf8_decode($values[
"house_number"]);
1218 if ($values[
"po_box"] != NULL)
1220 $this->postfach = utf8_decode($values[
"po_box"]);
1222 if ($values[
"country"] != NULL)
1224 $this->land = utf8_decode($values[
"country"]);
1226 if ($values[
"zipcode"] != NULL)
1228 $this->PLZ = utf8_decode($values[
"zipcode"]);
1230 if ($values[
"city"] != NULL)
1232 $this->ort = utf8_decode($values[
"city"]);
1241 var
$OBJTypeNS = array (
'namespace' =>
'http://www.bff.bund.de/ePayment' ,
'type' =>
'Kreditkarte');
1247 $values =
$_SESSION[
"bmf"][
"credit_card"];
1250 if (is_array($values))
1252 if ($values[
"karteninhaber"] != NULL)
1254 $this->karteninhaber = utf8_decode($values[
"karteninhaber"]);
1256 if ($values[
"kartenpruefnummer"] != NULL)
1258 $this->kartenpruefnummer = utf8_decode($values[
"kartenpruefnummer"]);
1260 if (is_array ($values[
"kreditkartenNr"]) &&
1261 count($values[
"kreditkartenNr"]) == 4)
1263 for ($i = 1; $i <= count($values[
"kreditkartenNr"]); $i++)
1265 $this->kreditkartenNr .= utf8_decode($values[
"kreditkartenNr"][
"block_".$i]);# .
"-";
1267 # $this->kreditkartenNr = substr($this->kreditkartenNr, 0, strlen($this->kreditkartenNr)-1);
1269 if (is_array($values[
"gueltigkeit"]) &&
1270 $values[
"gueltigkeit"][
"monat"] !=
"" &&
1271 $values[
"gueltigkeit"][
"jahr"] !=
"")
1273 $this->gueltigkeit = utf8_decode($values[
"gueltigkeit"][
"monat"]);
1274 $this->gueltigkeit .= utf8_decode($values[
"gueltigkeit"][
"jahr"]);
1283 var
$OBJTypeNS = array (
'namespace' =>
'http://www.bff.bund.de/ePayment' ,
'type' =>
'Lastschrift');
1287 $this->EShopKundenNr = time() .
"_" . substr(md5(uniqid(rand(),
true)), 0, 4);
1288 if ($customerNumber !=
"")
1290 $this->EShopKundenNr = $customerNumber .
"_" . time() .
"_" . substr(md5(uniqid(rand(),
true)), 0, 4);
1298 var
$OBJTypeNS = array (
'namespace' =>
'http://www.bff.bund.de/ePayment' ,
'type' =>
'Bankverbindung');
1304 $values =
$_SESSION[
"bmf"][
"debit_entry"];
1307 if (is_array($values))
1309 if ($values[
"kontoinhaber"] != NULL)
1311 $this->kontoinhaber = utf8_decode($values[
"kontoinhaber"]);
1313 if ($values[
"kontoNr"] != NULL)
1315 $this->kontoNr = utf8_decode($values[
"kontoNr"]);
1317 if ($values[
"BLZ"] != NULL)
1319 $this->BLZ = utf8_decode($values[
"BLZ"]);
1328 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');
1337 $this->haushaltsstelle =
$bmfConfig[
"haushaltsstelle"];
1341 $this->objektnummer =
$bmfConfig[
"objektNr"];
1344 if (is_array($values))
1346 if ($values[
"object_title"] != NULL)
1348 $buchungstext = utf8_decode($values[
"object_title"]);
1349 if(strlen($buchungstext) > 16)
1351 $buchungstext = substr($buchungstext,0,15).
'...';
1354 $this->buchungstext = $buchungstext;
1356 if ($values[
"price"] !=
"")
1358 $this->betrag = (float)$values[
"price"];
1366 if ($voucherNumber != NULL)
1368 $this->belegNr = $voucherNumber;
1374 return $this->belegNr;
1380 var
$OBJTypeNS = array (
'namespace' =>
'http://www.bff.bund.de/ePayment',
'nsPrefix' =>
'ns2',
'type' =>
'BuchungsListe');
1391 $this->bewirtschafterNr =
$bmfConfig[
"bewirtschafterNr"];
1393 if (
$bmfConfig[
"waehrungskennzeichen"] != NULL)
1395 $this->waehrungskennzeichen =
$bmfConfig[
"waehrungskennzeichen"];
1397 $this->faelligkeitsdatum = date(
"Y-m-d") .
"T" . date(
"H:i:s") .
"Z";
1398 if (
$bmfConfig[
"kennzeichenMahnverfahren"] != NULL)
1400 $this->kennzeichenMahnverfahren =
$bmfConfig[
"kennzeichenMahnverfahren"];
1403 $inst_id_time = $ilias->getSetting(
'inst_id').
'_'.$userId.
'_'.substr((
string) time(),-3);
1404 $this->EShopTransaktionsNr = $inst_id_time.substr(md5(uniqid(rand(),
true)), 0, 4);
1406 if (is_array($values))
1408 if ($values[
"betrag"] != NULL)
1410 $this->betrag = (float)$values[
"betrag"];
1412 if ($values[
"buchungen"] != NULL)
1414 $this->buchungen = $values[
"buchungen"];
1420 return $this->EShopTransaktionsNr;
1426 if ($kassenzeichen != NULL)
1428 $this->kassenzeichen = $kassenzeichen;
1434 return $this->kassenzeichen;
1441 var
$OBJTypeNS = array (
'namespace' =>
'http://www.bff.bund.de/ePayment' ,
'type' =>
'LieferAdresse');
1447 $values =
$_SESSION[
"bmf"][
"personal_data"];
1450 if (is_array($values))
1452 if ($values[
"firstname"] != NULL)
1454 $this->vorname = utf8_decode($values[
"firstname"]);
1456 if ($values[
"lastname"] != NULL)
1458 $this->nachname = utf8_decode($values[
"lastname"]);
1460 if ($values[
"street"] != NULL)
1462 $this->strasse = utf8_decode($values[
"street"]);
1464 if ($values[
"house_number"] != NULL)
1466 $this->hausNr = utf8_decode($values[
"house_number"]);
1468 if ($values[
"po_box"] != NULL)
1470 $this->postfach = utf8_decode($values[
"po_box"]);
1472 if ($values[
"country"] != NULL)
1474 $this->land = utf8_decode($values[
"country"]);
1476 if ($values[
"zipcode"] != NULL)
1478 $this->PLZ = utf8_decode($values[
"zipcode"]);
1480 if ($values[
"city"] != NULL)
1482 $this->ort = utf8_decode($values[
"city"]);