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';
49 parent::__construct($this->user_obj, $this->pay_method);
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 if (
$_POST[
"password"] ==
"" ||
389 md5(
$_POST[
"password"]) != $this->user_obj->getPasswd())
391 $this->error = $this->lng->txt(
'pay_bmf_password_not_valid');
398 $_SESSION[
"bmf"][
"debit_entry"][
"kontoinhaber"] =
$_POST[
"account_holder"];
409 $this->psc_obj->clearCouponItemsSession();
411 if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
414 $this->tpl->setVariable(
"HEADER",$this->lng->txt(
'pay_bmf_your_order'));
415 $this->tpl->touchBlock(
"stop_floating");
423 $newCustomer =
new Kunde($this->user_obj->getId());
425 $resultCustomerObj = $customer->anlegenKunde($newCustomer);
427 $resultCustomer = $resultCustomerObj->ergebnis;
429 if (is_object($resultCustomer))
431 if ($resultCustomer->code < 0)
433 $error = $this->lng->txt(
'pay_bmf_server_error_code') .
" " . $resultCustomer->code .
": " . $resultCustomer->kurzText .
"<br>\n" . $resultCustomer->langText;
434 if ($resultCustomer->code == -103 ||
435 $resultCustomer->code == -104 ||
436 $resultCustomer->code == -107 ||
437 ($resultCustomer->code <= -202 && $resultCustomer->code >= -208) ||
438 $resultCustomer->code == -213)
445 $error .=
"<br>\n" . $this->lng->txt(
'pay_bmf_server_error_sysadmin');
462 $tmp_bookEntries = $sc_obj->getShoppingCart();
463 if (!is_array($tmp_bookEntries))
470 for ($i = 0; $i < count($tmp_bookEntries); $i++)
476 $price = $tmp_bookEntries[$i][
"price"];
477 $tmp_bookEntries[$i][
"math_price"] = (float) $price;
479 foreach (
$_SESSION[
"coupons"][
"bmf"] as $key => $coupon)
481 $this->coupon_obj->setId($coupon[
"pc_pk"]);
482 $this->coupon_obj->setCurrentCoupon($coupon);
484 $tmp_pobject =
new ilPaymentObject($this->user_obj, $tmp_bookEntries[$i][
'pobject_id']);
486 if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
488 $_SESSION[
"coupons"][
"bmf"][$key][
"total_objects_coupon_price"] += (float) $price;
489 $_SESSION[
"coupons"][
"bmf"][$key][
"items"][] = $tmp_bookEntries[$i];
499 $tmp_bookEntries[$i][
"price_string"] = number_format( (
float) $tmp_bookEntries[$i][
"price"] , 2,
",",
".");
500 $bookEntries[] =
new Buchung($tmp_bookEntries[$i]);
501 $totalAmount += $tmp_bookEntries[$i][
"price"];
505 $tmp_bookEntries[$i][
"price_string"] = number_format( (
float) $tmp_bookEntries[$i][
"price"] , 2,
",",
".");
509 $coupon_discount_items = $this->psc_obj->calcDiscountPrices(
$_SESSION[
"coupons"][
"bmf"]);
511 if (is_array($coupon_discount_items) && !empty($coupon_discount_items))
513 foreach ($coupon_discount_items as $item)
515 $item[
"price"]= $item[
"discount_price"];
516 $bookEntries[] =
new Buchung($item);
517 $totalAmount += $item[
"price"];
521 $values = array(
"betrag" => $totalAmount,
"buchungen" => $bookEntries);
522 $bookingList =
new BuchungsListe($this->user_obj->getId(), $values);
527 $resultObj = $payment->abbuchenOhneEinzugsermaechtigung($resultCustomerObj->kunde->EShopKundenNr, $address, $bank, $bookingList);
528 $result = $resultObj->ergebnis;
530 if (is_object($result))
532 if ($result->code < 0)
534 $this->tpl->setVariable(
"HEADER",$this->lng->txt(
'error'));
535 $this->tpl->touchBlock(
"stop_floating");
536 $error = $this->lng->txt(
'pay_bmf_server_error_code') .
" " . $result->code .
": " . $result->kurzText .
"<br>\n" . $result->langText;
537 if ($result->code == -103 ||
538 $result->code == -104 ||
539 $result->code == -107 ||
540 ($result->code <= -202 && $result->code >= -208) ||
541 $result->code == -213)
546 else if ($result->code == -507 ||
547 $result->code == -510 ||
548 $result->code == -511)
553 else if ($result->code == -402 ||
554 $result->code == -402 ||
555 $result->code == -403 ||
556 $result->code == -406 ||
557 $result->code == -410 ||
558 $result->code == -413 ||
559 $result->code == -701 ||
560 $result->code == -702 ||
561 $result->code == -703)
568 $error .=
"<br>\n" . $this->lng->txt(
'pay_bmf_server_error_sysadmin');
576 $resultCustomerObj->kunde->vorname = utf8_decode($resultCustomerObj->kunde->vorname);
577 $resultCustomerObj->kunde->nachname = utf8_decode($resultCustomerObj->kunde->nachname);
578 $resultCustomerObj->kunde->rechnungsAdresse->strasse = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->strasse);
579 $resultCustomerObj->kunde->rechnungsAdresse->hausNr = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->hausNr);
580 $resultCustomerObj->kunde->rechnungsAdresse->postfach = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->postfach);
581 $resultCustomerObj->kunde->rechnungsAdresse->PLZ = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->PLZ);
582 $resultCustomerObj->kunde->rechnungsAdresse->ort = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->ort);
583 $resultCustomerObj->kunde->rechnungsAdresse->land = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->land);
586 $external_data = array();
587 $external_data[
'voucher'] = $resultObj->buchungsListe->buchungen[$b++]->belegNr;
588 $external_data[
'transaction_extern'] = $resultObj->buchungsListe->kassenzeichen;
589 $external_data[
'street'] = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->strasse).
' '.utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->hausNr);
590 $external_data[
'po_box'] = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->postfach);
591 $external_data[
'zipcode'] = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->PLZ);
592 $external_data[
'city'] = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->ort);
593 $external_data[
'country'] = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->land);
595 parent::__addbookings($external_data);
600 $this->tpl->setVariable(
"HEADER",$this->lng->txt(
'pay_bmf_your_order'));
601 $this->tpl->setVariable(
"DESCRIPTION",$this->lng->txt(
'pay_bmf_thanks'));
602 $this->tpl->touchBlock(
"stop_floating");
606 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.pay_bmf_debit_entry.html',
'Services/Payment');
608 if ($this->ilias->getSetting(
"https") != 1)
610 $this->tpl->setCurrentBlock(
"buyed_objects");
611 $link = $this->ctrl->getLinkTargetByClass(
'ilshopboughtobjectsgui');
612 $this->tpl->setVariable(
"LINK_GOTO_BUYED_OBJECTS", $link);
613 $this->tpl->setVariable(
"TXT_GOTO_BUYED_OBJECTS", $this->lng->txt(
'pay_goto_buyed_objects'));
614 $this->tpl->parseCurrentBlock(
"buyed_objects");
616 $this->tpl->setVariable(
"TXT_CLOSE_WINDOW", $this->lng->txt(
'close_window'));
621 $this->tpl->setVariable(
"HEADER",$this->lng->txt(
'error'));
622 $this->tpl->touchBlock(
"stop_floating");
629 $this->tpl->setVariable(
"HEADER",$this->lng->txt(
'error'));
630 $this->tpl->touchBlock(
"stop_floating");
650 if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
653 $this->tpl->setVariable(
"HEADER",$this->lng->txt(
'pay_bmf_your_order'));
654 $this->tpl->touchBlock(
"stop_floating");
661 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.pay_bmf_credit_card.html',
'Services/Payment');
664 $this->tpl->setVariable(
"CREDIT_CARD_FORMACTION",$this->ctrl->getFormAction($this));
668 $this->tpl->setVariable(
"ALT_IMG",$this->lng->txt(
'obj_usr'));
669 $this->tpl->setVariable(
"HEADER",$this->lng->txt(
'pay_step3_credit_card'));
670 $this->tpl->setVariable(
"TITLE",$this->lng->txt(
'pay_bmf_credit_card_data'));
671 $this->tpl->setVariable(
"DESCRIPTION",$this->lng->txt(
'pay_bmf_description_credit_card'));
672 $this->tpl->touchBlock(
"stop_floating");
673 $this->tpl->setVariable(
"TXT_CLOSE_WINDOW",$this->lng->txt(
'close_window'));
676 $this->tpl->setVariable(
"TXT_CARD_HOLDER",$this->lng->txt(
'pay_bmf_card_holder'));
677 $this->tpl->setVariable(
"TXT_CHECK_NUMBER",$this->lng->txt(
'pay_bmf_check_number'));
678 $this->tpl->setVariable(
"TXT_OPTIONAL",$this->lng->txt(
'pay_bmf_optional'));
679 $this->tpl->setVariable(
"TXT_CARD_NUMBER",$this->lng->txt(
'pay_bmf_card_number'));
680 $this->tpl->setVariable(
"TXT_VALIDITY",$this->lng->txt(
'pay_bmf_validity'));
681 $this->tpl->setVariable(
"TXT_TERMS_CONDITIONS",$this->lng->txt(
'pay_bmf_terms_conditions'));
682 $this->tpl->setVariable(
"TXT_TERMS_CONDITIONS_READ",$this->lng->txt(
'pay_bmf_terms_conditions_read'));
683 $this->tpl->setVariable(
"TXT_TERMS_CONDITIONS_SHOW",$this->lng->txt(
'pay_bmf_terms_conditions_show'));
684 $this->tpl->setVariable(
"LINK_TERMS_CONDITIONS",
"./payment.php?view=conditions");
685 $this->tpl->setVariable(
"TXT_PASSWORD",$this->lng->txt(
'password'));
686 $this->tpl->setVariable(
"TXT_CONFIRM_ORDER",$this->lng->txt(
'pay_confirm_order'));
688 $this->tpl->setVariable(
"INPUT_VALUE",$this->lng->txt(
'pay_send_order'));
689 $this->tpl->setVariable(
"CANCEL",$this->lng->txt(
'cancel'));
693 $this->tpl->setVariable(
"CARD_HOLDER",
694 $this->error !=
"" && isset(
$_POST[
'card_holder'])
697 $this->tpl->setVariable(
"CARD_NUMBER_BLOCK_1",
698 $this->error !=
"" && isset(
$_POST[
'card_number'][
'block_1'])
701 $this->tpl->setVariable(
"CARD_NUMBER_BLOCK_2",
702 $this->error !=
"" && isset(
$_POST[
'card_number'][
'block_2'])
705 $this->tpl->setVariable(
"CARD_NUMBER_BLOCK_3",
706 $this->error !=
"" && isset(
$_POST[
'card_number'][
'block_3'])
709 $this->tpl->setVariable(
"CARD_NUMBER_BLOCK_4",
710 $this->error !=
"" && isset(
$_POST[
'card_number'][
'block_4'])
713 $this->tpl->setVariable(
"CHECK_NUMBER",
714 $this->error !=
"" && isset(
$_POST[
'check_number'])
717 for ($i = 1; $i <= 12; $i++)
719 $this->tpl->setCurrentBlock(
"loop_validity_months");
720 $this->tpl->setVariable(
"LOOP_VALIDITY_MONTHS", $i < 10 ?
"0" . $i : $i);
721 $this->tpl->setVariable(
"LOOP_VALIDITY_MONTHS_TXT", $i < 10 ?
"0" . $i : $i);
722 if ($this->error !=
"" &&
723 isset(
$_POST[
'validity'][
'month']))
725 if (
$_POST[
'validity'][
'month'] == $i)
727 $this->tpl->setVariable(
"LOOP_VALIDITY_MONTHS_SELECTED",
" selected");
732 if (
$_SESSION[
"bmf"][
"credit_card"][
"gueltigkeit"][
"monat"] == $i)
734 $this->tpl->setVariable(
"LOOP_VALIDITY_MONTHS_SELECTED",
" selected");
737 $this->tpl->parseCurrentBlock(
"loop_validity_months");
739 for ($i = date(
"Y"); $i <= (date(
"Y")+6); $i++)
741 $this->tpl->setCurrentBlock(
"loop_validity_years");
742 $this->tpl->setVariable(
"LOOP_VALIDITY_YEARS", $i);
743 $this->tpl->setVariable(
"LOOP_VALIDITY_YEARS_TXT", $i);
744 if ($this->error !=
"" &&
745 isset(
$_POST[
'validity'][
'year']))
747 if (
$_POST[
'validity'][
'year'] == $i)
749 $this->tpl->setVariable(
"LOOP_VALIDITY_YEARS_SELECTED",
" selected");
754 if (
$_SESSION[
"bmf"][
"credit_card"][
"gueltigkeit"][
"jahr"] == $i)
756 $this->tpl->setVariable(
"LOOP_VALIDITY_YEARS_SELECTED",
" selected");
759 $this->tpl->parseCurrentBlock(
"loop_validity_years");
773 $this->tpl->addBlockfile(
"BUTTONS",
"buttons",
"tpl.buttons.html");
774 $this->tpl->setCurrentBlock(
"btn_cell");
775 $this->tpl->setVariable(
"BTN_LINK", $this->ctrl->getLinkTarget($this,
"showPaymentType"));
776 $this->tpl->setVariable(
"BTN_TXT", $this->lng->txt(
'pay_bmf_back'));
777 $this->tpl->parseCurrentBlock(
"btn_cell");
784 if (
$_POST[
"card_holder"] ==
"" ||
785 $_POST[
"card_number"][
"block_1"] ==
"" ||
786 $_POST[
"card_number"][
"block_2"] ==
"" ||
787 $_POST[
"card_number"][
"block_3"] ==
"" ||
788 $_POST[
"card_number"][
"block_4"] ==
"" ||
789 $_POST[
"validity"][
"month"] ==
"" ||
790 $_POST[
"validity"][
"year"] ==
"" ||
791 $_POST[
"validity"][
"year"].
"-".
$_POST[
"validity"][
"month"] < date(
"Y-m"))
793 $this->error = $this->lng->txt(
'pay_bmf_credit_card_not_valid');
798 if (
$_POST[
"terms_conditions"] != 1)
800 $this->error = $this->lng->txt(
'pay_bmf_check_terms_conditions');
805 if (
$_POST[
"password"] ==
"" ||
806 md5(
$_POST[
"password"]) != $this->user_obj->getPasswd())
808 $this->error = $this->lng->txt(
'pay_bmf_password_not_valid');
814 $_SESSION[
"bmf"][
"credit_card"][
"gueltigkeit"][
"monat"] =
$_POST[
"validity"][
"month"];
815 $_SESSION[
"bmf"][
"credit_card"][
"gueltigkeit"][
"jahr"] =
$_POST[
"validity"][
"year"];
816 $_SESSION[
"bmf"][
"credit_card"][
"karteninhaber"] =
$_POST[
"card_holder"];
817 $_SESSION[
"bmf"][
"credit_card"][
"kreditkartenNr"][
"block_1"] =
$_POST[
"card_number"][
"block_1"];
818 $_SESSION[
"bmf"][
"credit_card"][
"kreditkartenNr"][
"block_2"] =
$_POST[
"card_number"][
"block_2"];
819 $_SESSION[
"bmf"][
"credit_card"][
"kreditkartenNr"][
"block_3"] =
$_POST[
"card_number"][
"block_3"];
820 $_SESSION[
"bmf"][
"credit_card"][
"kreditkartenNr"][
"block_4"] =
$_POST[
"card_number"][
"block_4"];
821 $_SESSION[
"bmf"][
"credit_card"][
"kartenpruefnummer"] =
$_POST[
"check_number"];
831 $this->psc_obj->clearCouponItemsSession();
833 if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
836 $this->tpl->setVariable(
"HEADER",$this->lng->txt(
'pay_bmf_your_order'));
837 $this->tpl->touchBlock(
"stop_floating");
845 $customer =
new Kunde($this->user_obj->getId());
851 $tmp_bookEntries = $sc_obj->getShoppingCart();
852 if (!is_array($tmp_bookEntries))
859 for ($i = 0; $i < count($tmp_bookEntries); $i++)
865 $price = $tmp_bookEntries[$i][
"price"];
866 $tmp_bookEntries[$i][
"math_price"] = (float) $price;
868 foreach (
$_SESSION[
"coupons"][
"bmf"] as $key => $coupon)
870 $this->coupon_obj->setId($coupon[
"pc_pk"]);
871 $this->coupon_obj->setCurrentCoupon($coupon);
873 $tmp_pobject =
new ilPaymentObject($this->user_obj, $tmp_bookEntries[$i][
'pobject_id']);
875 if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
877 $_SESSION[
"coupons"][
"bmf"][$key][
"total_objects_coupon_price"] += (float) $price;
878 $_SESSION[
"coupons"][
"bmf"][$key][
"items"][] = $tmp_bookEntries[$i];
889 $tmp_bookEntries[$i][
"price_string"] = number_format( (
float) $tmp_bookEntries[$i][
"price"] , 2,
",",
".");
891 $bookEntries[] =
new Buchung($tmp_bookEntries[$i]);
892 $totalAmount += $tmp_bookEntries[$i][
"betrag"];
896 $tmp_bookEntries[$i][
"price_string"] = number_format( (
float) $tmp_bookEntries[$i][
"price"] , 2,
",",
".");
900 $coupon_discount_items = $this->psc_obj->calcDiscountPrices(
$_SESSION[
"coupons"][
"bmf"]);
902 if (is_array($coupon_discount_items) && !empty($coupon_discount_items))
904 foreach ($coupon_discount_items as $item)
906 $item[
"price"] = $item[
"discount_price"];
907 $bookEntries[] =
new Buchung($item);
908 $totalAmount += $item[
"discount_price"];
912 $values = array(
"betrag" => $totalAmount,
"buchungen" => $bookEntries);
913 $bookingList =
new BuchungsListe($this->user_obj->getId(), $values);
916 $resultObj = $payment->zahlenUndAnlegenKunde($customer, $creditCard, $bookingList);
917 $result = $resultObj->ergebnis;
920 if (is_object($result))
923 if ($result->code < 0)
925 $this->tpl->setVariable(
"HEADER",$this->lng->txt(
'error'));
926 $this->tpl->touchBlock(
"stop_floating");
927 $error = $this->lng->txt(
'pay_bmf_server_error_code') .
" " . $result->code .
": " . $result->kurzText .
"<br>\n" . $result->langText;
928 if ($result->code == -103 ||
929 $result->code == -104 ||
930 $result->code == -107 ||
931 ($result->code <= -202 && $result->code >= -208) ||
932 $result->code == -213)
937 else if ($result->code == -507 ||
938 $result->code == -510 ||
939 $result->code == -511)
944 else if ($result->code == -701 ||
945 $result->code == -1701 ||
946 $result->code == -1706 ||
947 $result->code == -1707 ||
948 $result->code == -1710 ||
949 $result->code == -1711)
956 $error .=
"<br>\n" . $this->lng->txt(
'pay_bmf_server_error_sysadmin');
966 $external_data = array();
967 $external_data[
'voucher'] = $resultObj->buchungsListe->buchungen[$b++]->belegNr;
968 $external_data[
'transaction_extern'] = $resultObj->buchungsListe->kassenzeichen;
969 $external_data[
'street'] = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->strasse).
' '.utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->hausNr);
970 $external_data[
'po_box'] = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->postfach);
971 $external_data[
'zipcode'] = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->PLZ);
972 $external_data[
'city'] = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->ort);
973 $external_data[
'country'] = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->land);
975 parent::__addbookings($external_data);
980 $this->tpl->setVariable(
"HEADER",$this->lng->txt(
'pay_bmf_your_order'));
981 $this->tpl->setVariable(
"DESCRIPTION",$this->lng->txt(
'pay_bmf_thanks'));
982 $this->tpl->touchBlock(
"stop_floating");
986 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.pay_bmf_credit_card.html',
'Services/Payment');
988 if ($this->ilias->getSetting(
"https") != 1)
990 $this->tpl->setCurrentBlock(
"buyed_objects");
991 $link = $this->ctrl->getLinkTargetByClass(
'ilshopboughtobjectsgui');
992 $this->tpl->setVariable(
"LINK_GOTO_BUYED_OBJECTS", $link);
993 $this->tpl->setVariable(
"TXT_GOTO_BUYED_OBJECTS", $this->lng->txt(
'pay_goto_buyed_objects'));
994 $this->tpl->parseCurrentBlock(
"buyed_objects");
996 $this->tpl->setVariable(
"TXT_CLOSE_WINDOW", $this->lng->txt(
'close_window'));
1002 $this->tpl->setVariable(
"HEADER",$this->lng->txt(
'error'));
1003 $this->tpl->touchBlock(
"stop_floating");
1018 $cmd = $this->ctrl->getCmd();
1020 switch ($this->ctrl->getNextClass($this))
1024 if(!
$cmd = $this->ctrl->getCmd())
1026 $cmd =
'showPersonalData';
1045 $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"])));
1055 'kunde' => $customer
1058 $result = $this->_soapClient->call(
"anlegenKunde", $tmp,
"KundenstammdatenPflegeWS");
1073 $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"])));
1083 'kreditkarte' => $creditCard,
1084 'waehrungskennzeichen' =>
$bmfConfig[
"waehrungskennzeichen"]
1087 $result = $this->_soapClient->call(
"validierenKreditkarte", $tmp,
"KreditkartenzahlungWS");
1100 'Kunde' => $customer,
1101 'Kreditkarte' => $creditCard,
1102 'buchungsListe' => $bookingList,
1103 'lieferadresse' => $lieferadresse
1106 $result = $this->_soapClient->call(
"zahlenUndAnlegenKunde", $tmp,
"KreditkartenzahlungWS");
1121 $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"])));
1131 'eShopKundenNr' => $eShopCustomerNumber,
1132 'lieferAdresse' => $address,
1133 'bankverbindung' => $bank,
1134 'buchungsListe' => $bookingList
1137 $result = $this->_soapClient->call(
"abbuchenOhneEinzugsermaechtigung", $tmp,
"LastschriftWS");
1145 var
$OBJTypeNS = array (
'namespace' =>
'http://www.bff.bund.de/ePayment' ,
'type' =>
'Kunde');
1147 function Kunde ($customerNumber =
"", $values =
"")
1155 $this->EShopKundenNr = time() .
"_" . substr(md5(uniqid(rand(),
true)), 0, 4);
1156 if ($customerNumber !=
"")
1158 $this->EShopKundenNr = $customerNumber .
"_" . time() .
"_" . substr(md5(uniqid(rand(),
true)), 0, 4);
1164 $values =
$_SESSION[
"bmf"][
"personal_data"];
1167 if ($values[
"language"] != NULL)
1169 $this->sprache = $values[
"language"];
1171 if ($values[
"firstname"] != NULL)
1173 $this->vorname = utf8_decode($values[
"firstname"]);
1175 if ($values[
"lastname"] != NULL)
1177 $this->nachname = utf8_decode($values[
"lastname"]);
1179 if ($values[
"email"] != NULL)
1181 $this->EMailAdresse = utf8_decode($values[
"email"]);
1186 $this->rechnungsAdresse = $address;
1191 return $this->EShopKundenNr;
1198 var
$OBJTypeNS = array (
'namespace' =>
'http://www.bff.bund.de/ePayment' ,
'type' =>
'Adresse');
1204 $values =
$_SESSION[
"bmf"][
"personal_data"];
1207 if (is_array($values))
1209 if ($values[
"street"] != NULL)
1211 $this->strasse = utf8_decode($values[
"street"]);
1213 if ($values[
"house_number"] != NULL)
1215 $this->hausNr = utf8_decode($values[
"house_number"]);
1217 if ($values[
"po_box"] != NULL)
1219 $this->postfach = utf8_decode($values[
"po_box"]);
1221 if ($values[
"country"] != NULL)
1223 $this->land = utf8_decode($values[
"country"]);
1225 if ($values[
"zipcode"] != NULL)
1227 $this->PLZ = utf8_decode($values[
"zipcode"]);
1229 if ($values[
"city"] != NULL)
1231 $this->ort = utf8_decode($values[
"city"]);
1240 var
$OBJTypeNS = array (
'namespace' =>
'http://www.bff.bund.de/ePayment' ,
'type' =>
'Kreditkarte');
1246 $values =
$_SESSION[
"bmf"][
"credit_card"];
1249 if (is_array($values))
1251 if ($values[
"karteninhaber"] != NULL)
1253 $this->karteninhaber = utf8_decode($values[
"karteninhaber"]);
1255 if ($values[
"kartenpruefnummer"] != NULL)
1257 $this->kartenpruefnummer = utf8_decode($values[
"kartenpruefnummer"]);
1259 if (is_array ($values[
"kreditkartenNr"]) &&
1260 count($values[
"kreditkartenNr"]) == 4)
1262 for ($i = 1; $i <= count($values[
"kreditkartenNr"]); $i++)
1264 $this->kreditkartenNr .= utf8_decode($values[
"kreditkartenNr"][
"block_".$i]);# .
"-";
1266 # $this->kreditkartenNr = substr($this->kreditkartenNr, 0, strlen($this->kreditkartenNr)-1);
1268 if (is_array($values[
"gueltigkeit"]) &&
1269 $values[
"gueltigkeit"][
"monat"] !=
"" &&
1270 $values[
"gueltigkeit"][
"jahr"] !=
"")
1272 $this->gueltigkeit = utf8_decode($values[
"gueltigkeit"][
"monat"]);
1273 $this->gueltigkeit .= utf8_decode($values[
"gueltigkeit"][
"jahr"]);
1282 var
$OBJTypeNS = array (
'namespace' =>
'http://www.bff.bund.de/ePayment' ,
'type' =>
'Lastschrift');
1286 $this->EShopKundenNr = time() .
"_" . substr(md5(uniqid(rand(),
true)), 0, 4);
1287 if ($customerNumber !=
"")
1289 $this->EShopKundenNr = $customerNumber .
"_" . time() .
"_" . substr(md5(uniqid(rand(),
true)), 0, 4);
1297 var
$OBJTypeNS = array (
'namespace' =>
'http://www.bff.bund.de/ePayment' ,
'type' =>
'Bankverbindung');
1303 $values =
$_SESSION[
"bmf"][
"debit_entry"];
1306 if (is_array($values))
1308 if ($values[
"kontoinhaber"] != NULL)
1310 $this->kontoinhaber = utf8_decode($values[
"kontoinhaber"]);
1312 if ($values[
"kontoNr"] != NULL)
1314 $this->kontoNr = utf8_decode($values[
"kontoNr"]);
1316 if ($values[
"BLZ"] != NULL)
1318 $this->BLZ = utf8_decode($values[
"BLZ"]);
1327 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');
1336 $this->haushaltsstelle =
$bmfConfig[
"haushaltsstelle"];
1340 $this->objektnummer =
$bmfConfig[
"objektNr"];
1343 if (is_array($values))
1345 if ($values[
"buchungstext"] != NULL)
1347 $buchungstext = utf8_decode($values[
"buchungstext"]);
1348 if(strlen($buchungstext) > 16)
1350 $buchungstext = substr($buchungstext,0,15).
'...';
1353 $this->buchungstext = $buchungstext;
1355 if ($values[
"betrag"] !=
"")
1357 $this->betrag = $values[
"betrag"];
1365 if ($voucherNumber != NULL)
1367 $this->belegNr = $voucherNumber;
1373 return $this->belegNr;
1379 var
$OBJTypeNS = array (
'namespace' =>
'http://www.bff.bund.de/ePayment',
'nsPrefix' =>
'ns2',
'type' =>
'BuchungsListe');
1390 $this->bewirtschafterNr =
$bmfConfig[
"bewirtschafterNr"];
1392 if (
$bmfConfig[
"waehrungskennzeichen"] != NULL)
1394 $this->waehrungskennzeichen =
$bmfConfig[
"waehrungskennzeichen"];
1396 $this->faelligkeitsdatum = date(
"Y-m-d") .
"T" . date(
"H:i:s") .
"Z";
1397 if (
$bmfConfig[
"kennzeichenMahnverfahren"] != NULL)
1399 $this->kennzeichenMahnverfahren =
$bmfConfig[
"kennzeichenMahnverfahren"];
1402 $inst_id_time = $ilias->getSetting(
'inst_id').
'_'.$userId.
'_'.substr((
string) time(),-3);
1403 $this->EShopTransaktionsNr = $inst_id_time.substr(md5(uniqid(rand(),
true)), 0, 4);
1405 if (is_array($values))
1407 if ($values[
"betrag"] != NULL)
1409 $this->betrag = $values[
"betrag"];
1411 if ($values[
"buchungen"] != NULL)
1413 $this->buchungen = $values[
"buchungen"];
1419 return $this->EShopTransaktionsNr;
1425 if ($kassenzeichen != NULL)
1427 $this->kassenzeichen = $kassenzeichen;
1433 return $this->kassenzeichen;
1440 var
$OBJTypeNS = array (
'namespace' =>
'http://www.bff.bund.de/ePayment' ,
'type' =>
'LieferAdresse');
1446 $values =
$_SESSION[
"bmf"][
"personal_data"];
1449 if (is_array($values))
1451 if ($values[
"firstname"] != NULL)
1453 $this->vorname = utf8_decode($values[
"firstname"]);
1455 if ($values[
"lastname"] != NULL)
1457 $this->nachname = utf8_decode($values[
"lastname"]);
1459 if ($values[
"street"] != NULL)
1461 $this->strasse = utf8_decode($values[
"street"]);
1463 if ($values[
"house_number"] != NULL)
1465 $this->hausNr = utf8_decode($values[
"house_number"]);
1467 if ($values[
"po_box"] != NULL)
1469 $this->postfach = utf8_decode($values[
"po_box"]);
1471 if ($values[
"country"] != NULL)
1473 $this->land = utf8_decode($values[
"country"]);
1475 if ($values[
"zipcode"] != NULL)
1477 $this->PLZ = utf8_decode($values[
"zipcode"]);
1479 if ($values[
"city"] != NULL)
1481 $this->ort = utf8_decode($values[
"city"]);