ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilPurchaseBMFGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
32 include_once './payment/classes/class.ilPaymentShoppingCart.php';
33 include_once './payment/classes/class.ilPaymentShoppingCartGUI.php';
34 include_once './payment/classes/class.ilPaymentCoupons.php';
35 include_once './payment/classes/class.ilBMFSettings.php';
36 #include_once dirname(__FILE__)."/../bmf/lib/ePayment/cfg_epayment.inc.php";
37 include_once dirname(__FILE__)."/../bmf/lib/SOAP/class.ilBMFClient.php";
38 include_once 'Services/Payment/classes/class.ilShopVatsList.php';
39 
41 {
42  var $ctrl;
43  var $tpl;
44 
45  var $user_obj;
46  var $coupon_obj = null;
47  var $error;
49 
51  private $totalVat = 0;
52 
54  {
55  global $ilias, $ilDB, $lng, $tpl, $rbacsystem, $ilCtrl, $ilTabs;
56  $this->ilias = $ilias;
57  $this->db = $ilDB;
58  $this->lng = $lng;
59  $this->ctrl = $ilCtrl;
60  $this->tpl = $tpl;
61 
62  // Get user object
63  $this->user_obj = $user_obj;
64 
65  $this->coupon_obj = new ilPaymentCoupons($this->user_obj);
66 
67  if (!is_array($_SESSION["bmf"]["personal_data"]))
68  {
69  $_SESSION["bmf"]["personal_data"]["firstname"] = $this->user_obj->getFirstname();
70  $_SESSION["bmf"]["personal_data"]["lastname"] = $this->user_obj->getLastname();
71  if (strpos("_" . $this->user_obj->getStreet(), " ") > 0)
72  {
73  $houseNo = substr($this->user_obj->getStreet(), strrpos($this->user_obj->getStreet(), " ")+1);
74  $street = substr($this->user_obj->getStreet(), 0, strlen($this->user_obj->getStreet())-(strlen($houseNo)+1));
75  $_SESSION["bmf"]["personal_data"]["street"] = $street;
76  $_SESSION["bmf"]["personal_data"]["house_number"] = $houseNo;
77  }
78  else
79  {
80  $_SESSION["bmf"]["personal_data"]["street"] = $this->user_obj->getStreet();
81  $_SESSION["bmf"]["personal_data"]["house_number"] = "";
82  }
83  $_SESSION["bmf"]["personal_data"]["po_box"] = "";
84  $_SESSION["bmf"]["personal_data"]["zipcode"] = $this->user_obj->getZipcode();
85  $_SESSION["bmf"]["personal_data"]["city"] = $this->user_obj->getCity();
86  $_SESSION["bmf"]["personal_data"]["country"] = $this->__getCountryCode($this->user_obj->getCountry());
87  $_SESSION["bmf"]["personal_data"]["email"] = $this->user_obj->getEmail();
88  $_SESSION["bmf"]["personal_data"]["language"] = $this->user_obj->getLanguage();
89  }
90 
91  if (!is_array($_SESSION["coupons"]["bmf"]))
92  {
93  $_SESSION["coupons"]["bmf"] = array();
94  }
95 
96  $this->__loadTemplate();
97 
98  $this->error = "";
99 
100  $this->lng->loadLanguageModule("payment");
101 
102  $ilTabs->clearTargets();
103  $ilTabs->clearSubTabs();
104  }
105 
106  function cancel()
107  {
108  ilUtil::redirect("./payment.php");
109  }
110 
111  function showPersonalData()
112  {
113  // user_id $this->user_obj->getId()
114  // all
115 
116  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
117 
118  if(!count($items = $this->psc_obj->getEntries(PAY_METHOD_BMF)))
119  {
120 
121  $this->tpl->setVariable("HEADER",$this->lng->txt('pay_bmf_your_order'));
122  $this->tpl->touchBlock("stop_floating");
123  ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
124 
125  }
126  else
127  {
128 
129  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.pay_bmf_personal_data.html','payment');
130  #$this->tpl = new ilTemplate('tpl.pay_bmf_personal_data.html', true, true, 'payment');
131 
132  $this->tpl->setVariable("PERSONAL_DATA_FORMACTION",$this->ctrl->getFormAction($this));
133 
134  // set table header
135  $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_pays_b.gif'));
136  $this->tpl->setVariable("ALT_IMG",$this->lng->txt('obj_usr'));
137  $this->tpl->setVariable("HEADER",$this->lng->txt('pay_step1'));
138  $this->tpl->setVariable("TITLE",$this->lng->txt('pay_bmf_personal_data'));
139  $this->tpl->setVariable("DESCRIPTION",$this->lng->txt('pay_bmf_description_personal_data'));
140  $this->tpl->touchBlock("stop_floating");
141  $this->tpl->setVariable("TXT_CLOSE_WINDOW",$this->lng->txt('close_window'));
142 
143  // set plain text variables
144  $this->tpl->setVariable("TXT_FIRSTNAME",$this->lng->txt('firstname'));
145  $this->tpl->setVariable("TXT_LASTNAME",$this->lng->txt('lastname'));
146  $this->tpl->setVariable("TXT_STREET",$this->lng->txt('street'));
147  $this->tpl->setVariable("TXT_HOUSE_NUMBER",$this->lng->txt('pay_bmf_house_number'));
148  $this->tpl->setVariable("TXT_OR",$this->lng->txt('pay_bmf_or'));
149  $this->tpl->setVariable("TXT_PO_BOX",$this->lng->txt('pay_bmf_po_box'));
150  $this->tpl->setVariable("TXT_ZIPCODE",$this->lng->txt('zipcode'));
151  $this->tpl->setVariable("TXT_CITY",$this->lng->txt('city'));
152  $this->tpl->setVariable("TXT_COUNTRY",$this->lng->txt('country'));
153  $this->tpl->setVariable("TXT_EMAIL",$this->lng->txt('email'));
154 
155  $this->tpl->setVariable("INPUT_VALUE",ucfirst($this->lng->txt('next')));
156  $this->tpl->setVariable("CANCEL",$this->lng->txt('cancel'));
157 
158  // fill defaults
159 
160  $this->error != "" && isset($_POST['country']) ? $this->__showCountries($this->tpl, $_POST['country']) : $this->__showCountries($this->tpl, $_SESSION['bmf']['personal_data']['country']);
161 /* $this->tpl->setVariable("FIRSTNAME",
162  $this->error != "" && isset($_POST['firstname'])
163  ? ilUtil::prepareFormOutput($_POST['firstname'],true)
164  : ilUtil::prepareFormOutput($_SESSION['bmf']["personal_data"]['vorname'],true));
165  $this->tpl->setVariable("LASTNAME",
166  $this->error != "" && isset($_POST['lastname'])
167  ? ilUtil::prepareFormOutput($_POST['lastname'],true)
168  : ilUtil::prepareFormOutput($_SESSION['bmf']["personal_data"]['nachname'],true));*/
169  $this->tpl->setVariable("FIRSTNAME", $this->user_obj->getFirstname());
170  $this->tpl->setVariable("LASTNAME", $this->user_obj->getLastname());
171  $this->tpl->setVariable("STREET",
172  $this->error != "" && isset($_POST['street'])
173  ? ilUtil::prepareFormOutput($_POST['street'],true)
174  : ilUtil::prepareFormOutput($_SESSION['bmf']["personal_data"]['street'],true));
175  $this->tpl->setVariable("HOUSE_NUMBER",
176  $this->error != "" && isset($_POST['house_number'])
177  ? ilUtil::prepareFormOutput($_POST['house_number'],true)
178  : ilUtil::prepareFormOutput($_SESSION['bmf']["personal_data"]['house_number'],true));
179  $this->tpl->setVariable("PO_BOX",
180  $this->error != "" && isset($_POST['po_box'])
181  ? ilUtil::prepareFormOutput($_POST['po_box'],true)
182  : ilUtil::prepareFormOutput($_SESSION['bmf']["personal_data"]['po_box'],true));
183  $this->tpl->setVariable("ZIPCODE",
184  $this->error != "" && isset($_POST['zipcode'])
185  ? ilUtil::prepareFormOutput($_POST['zipcode'],true)
186  : ilUtil::prepareFormOutput($_SESSION['bmf']["personal_data"]['zipcode'],true));
187  $this->tpl->setVariable("CITY",
188  $this->error != "" && isset($_POST['city'])
189  ? ilUtil::prepareFormOutput($_POST['city'],true)
190  : ilUtil::prepareFormOutput($_SESSION['bmf']["personal_data"]['city'],true));
191  $this->tpl->setVariable("EMAIL", $this->user_obj->getEmail());
192 
193  }
194  }
195 
196  function getPersonalData()
197  {
198 
199  if ($_SESSION["bmf"]["personal_data"]["firstname"] == "" ||
200  $_SESSION["bmf"]["personal_data"]["lastname"] == "" ||
201  $_POST["zipcode"] == "" ||
202  $_POST["city"] == "" ||
203  $_POST["country"] == "" ||
204  $_SESSION["bmf"]["personal_data"]["email"] == "")
205  {
206  $this->error = $this->lng->txt('pay_bmf_personal_data_not_valid');
207  ilUtil::sendInfo($this->error);
208  $this->showPersonalData();
209  return;
210  }
211  if (($_POST["street"] == "" && $_POST["house_number"] == "" && $_POST["po_box"] == "") ||
212  (($_POST["street"] != "" || $_POST["house_number"] != "") && $_POST["po_box"] != "") ||
213  ($_POST["street"] != "" && $_POST["house_number"] == "") ||
214  ($_POST["street"] == "" && $_POST["house_number"] != ""))
215  {
216  $this->error = $this->lng->txt('pay_bmf_street_or_pobox');
217  ilUtil::sendInfo($this->error);
218  $this->showPersonalData();
219  return;
220  }
221 
222 
223  $_SESSION["bmf"]["personal_data"]["firstname"] = $this->user_obj->getFirstname();
224  $_SESSION["bmf"]["personal_data"]["lastname"] = $this->user_obj->getLastname();
225  $_SESSION["bmf"]["personal_data"]["street"] = $_POST["street"];
226  $_SESSION["bmf"]["personal_data"]["house_number"] = $_POST["house_number"];
227  $_SESSION["bmf"]["personal_data"]["po_box"] = $_POST["po_box"];
228  $_SESSION["bmf"]["personal_data"]["zipcode"] = $_POST["zipcode"];
229  $_SESSION["bmf"]["personal_data"]["city"] = $_POST["city"];
230  $_SESSION["bmf"]["personal_data"]["country"] = $_POST["country"];
231  $_SESSION["bmf"]["personal_data"]["email"] = $this->user_obj->getEmail();
232  $_SESSION["bmf"]["personal_data"]["language"] = $this->user_obj->getLanguage();
233 
234  if ($_SESSION["bmf"]["personal_data"]["country"] != "DE")
235  {
236  if ($_SESSION["bmf"]["payment_type"] == "debit_entry")
237  {
238  $_SESSION["bmf"]["payment_type"] = "";
239  }
240  }
241 
242  $this->error = "";
243  $this->showPaymentType();
244  }
245 
246  function showPaymentType()
247  {
248  // user_id $this->user_obj->getId()
249  // all
250 
251  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
252 
253  if(!count($items = $this->psc_obj->getEntries(PAY_METHOD_BMF)))
254  {
255 
256  $this->tpl->setVariable("HEADER",$this->lng->txt('pay_bmf_your_order'));
257  $this->tpl->touchBlock("stop_floating");
258  ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
259 
260  }
261  else
262  {
263 
264  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.pay_bmf_payment_type.html','payment');
265 
266  $this->tpl->setVariable("PAYMENT_TYPE_FORMACTION",$this->ctrl->getFormAction($this));
267 
268  // set table header
269  $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_pays_b.gif'));
270  $this->tpl->setVariable("ALT_IMG",$this->lng->txt('obj_usr'));
271  $this->tpl->setVariable("HEADER",$this->lng->txt('pay_step2'));
272  $this->tpl->setVariable("TITLE",$this->lng->txt('pay_bmf_payment_type'));
273  $this->tpl->setVariable("DESCRIPTION",$this->lng->txt('pay_bmf_description_payment_type'));
274  $this->tpl->touchBlock("stop_floating");
275  $this->tpl->setVariable("TXT_CLOSE_WINDOW",$this->lng->txt('close_window'));
276 
277  // set plain text variables
278  if ($_SESSION["bmf"]["personal_data"]["country"] == "DE")
279  {
280  $this->tpl->setVariable("TXT_DEBIT_ENTRY",$this->lng->txt('pay_bmf_debit_entry'));
281  }
282  $this->tpl->setVariable("TXT_CREDIT_CARD",$this->lng->txt('pay_bmf_credit_card'));
283 
284  $this->tpl->setVariable("INPUT_VALUE",ucfirst($this->lng->txt('next')));
285  $this->tpl->setVariable("CANCEL",$this->lng->txt('cancel'));
286 
287  // fill defaults
288 
289  if ($this->error != "" &&
290  isset($_POST["payment_type"]))
291  {
292  $this->tpl->setVariable("PAYMENT_TYPE_" . strtoupper($_POST["payment_type"]), " checked") ;
293  }
294  else
295  {
296  if (($_SESSION["bmf"]["personal_data"]["country"] != "DE" && $_POST["payment_type"] != "debit_entry") ||
297  $_SESSION["bmf"]["personal_data"]["country"] == "DE")
298  {
299  $this->tpl->setVariable("PAYMENT_TYPE_" . strtoupper($_SESSION["bmf"]["payment_type"]), " checked") ;
300  }
301  }
302 
303  // Button
304  $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
305  $this->tpl->setCurrentBlock("btn_cell");
306  $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "showPersonalData"));
307  $this->tpl->setVariable("BTN_TXT", $this->lng->txt('pay_bmf_back'));
308  $this->tpl->parseCurrentBlock("btn_cell");
309 
310  }
311  }
312 
313  function getPaymentType()
314  {
315  if (($_POST["payment_type"] != "credit_card" && $_POST["payment_type"] != "debit_entry") ||
316  ($_SESSION["bmf"]["personal_data"]["country"] != "DE" && $_POST["payment_type"] == "debit_entry"))
317  {
318  $this->error = $this->lng->txt('pay_bmf_payment_type_not_valid');
319  ilUtil::sendInfo($this->error);
320  $this->showPaymentType();
321  return;
322  }
323 
324  $_SESSION["bmf"]["payment_type"] = $_POST["payment_type"];
325 
326  $this->error = "";
327  if ($_SESSION["bmf"]["payment_type"] == "credit_card")
328  {
329  $this->showCreditCard();
330  }
331  else
332  {
333  $this->showDebitEntry();
334  }
335  }
336 
337  function showDebitEntry()
338  {
339  // user_id $this->user_obj->getId()
340  // all
341 
342 /* if ($_SESSION["bmf"]["debit_entry"]["kontoinhaber"] == "" &&
343  $this->error == "" &&
344  $_POST["account_holder"] == "")
345  {
346  $_SESSION["bmf"]["debit_entry"]["kontoinhaber"] = $_SESSION["bmf"]["personal_data"]["vorname"] . " " . $_SESSION["bmf"]["personal_data"]["nachname"];
347  }*/
348 
349  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
350 
351  if(!count($items = $this->psc_obj->getEntries(PAY_METHOD_BMF)))
352  {
353 
354  $this->tpl->setVariable("HEADER",$this->lng->txt('pay_bmf_your_order'));
355  $this->tpl->touchBlock("stop_floating");
356  ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
357 
358  }
359  else
360  {
361 
362  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.pay_bmf_debit_entry.html','payment');
363  #$this->tpl = new ilTemplate('tpl.pay_bmf_debit_entry.html', true, true, 'payment');
364 
365  $this->__showShoppingCart();
366 
367  $this->tpl->setVariable("DEBIT_ENTRY_FORMACTION",$this->ctrl->getFormAction($this));
368 
369  // set table header
370  $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_pays_b.gif'));
371  $this->tpl->setVariable("ALT_IMG",$this->lng->txt('obj_usr'));
372  $this->tpl->setVariable("HEADER",$this->lng->txt('pay_step3_debit_entry'));
373  $this->tpl->setVariable("TITLE",$this->lng->txt('pay_bmf_debit_entry_data'));
374  $this->tpl->setVariable("DESCRIPTION",$this->lng->txt('pay_bmf_description_debit_entry'));
375  $this->tpl->touchBlock("stop_floating");
376  $this->tpl->setVariable("TXT_CLOSE_WINDOW",$this->lng->txt('close_window'));
377 
378  // set plain text variables
379  $this->tpl->setVariable("TXT_ACCOUNT_HOLDER",$this->lng->txt('pay_bmf_account_holder'));
380  $this->tpl->setVariable("TXT_OPTIONAL",$this->lng->txt('pay_bmf_optional'));
381  $this->tpl->setVariable("TXT_BANK_CODE",$this->lng->txt('pay_bmf_bank_code'));
382  $this->tpl->setVariable("TXT_ACCOUNT_NUMBER",$this->lng->txt('pay_bmf_account_number'));
383  $this->tpl->setVariable("TXT_TERMS_CONDITIONS",$this->lng->txt('pay_bmf_terms_conditions'));
384  $this->tpl->setVariable("TXT_TERMS_CONDITIONS_READ",$this->lng->txt('pay_bmf_terms_conditions_read'));
385  $this->tpl->setVariable("TXT_TERMS_CONDITIONS_SHOW",$this->lng->txt('pay_bmf_terms_conditions_show'));
386  $this->tpl->setVariable("LINK_TERMS_CONDITIONS","./payment.php?view=conditions");
387  $this->tpl->setVariable("TXT_PASSWORD",$this->lng->txt('password'));
388  $this->tpl->setVariable("TXT_CONFIRM_ORDER",$this->lng->txt('pay_confirm_order'));
389 
390  $this->tpl->setVariable("INPUT_VALUE",$this->lng->txt('pay_send_order'));
391  $this->tpl->setVariable("CANCEL",$this->lng->txt('cancel'));
392 
393  // fill defaults
394 
395  $this->tpl->setVariable("ACCOUNT_HOLDER",
396  $this->error != "" && isset($_POST['account_holder'])
397  ? ilUtil::prepareFormOutput($_POST['account_holder'],true)
398  : ilUtil::prepareFormOutput($_SESSION['bmf']["debit_entry"]['kontoinhaber'],true));
399  $this->tpl->setVariable("BANK_CODE",
400  $this->error != "" && isset($_POST['bank_code'])
401  ? ilUtil::prepareFormOutput($_POST['bank_code'],true)
402  : ilUtil::prepareFormOutput($_SESSION['bmf']["debit_entry"]['BLZ'],true));
403  $this->tpl->setVariable("ACCOUNT_NUMBER",
404  $this->error != "" && isset($_POST['account_number'])
405  ? ilUtil::prepareFormOutput($_POST['account_number'],true)
406  : ilUtil::prepareFormOutput($_SESSION['bmf']["debit_entry"]['kontoNr'],true));
407 /* if ($this->error != "" &&
408  isset($_POST["terms_conditions"]))
409  {
410  $this->tpl->setVariable("TERMS_CONDITIONS_" . strtoupper($_POST["terms_conditions"]), " checked") ;
411  }*/
412 /* if ($this->error != "" &&
413  isset($_POST["password"]))
414  {
415  $this->tpl->setVariable("PASSWORD", ilUtil::prepareFormOutput($_POST['password'],true));
416  }*/
417 
418  // Button
419  $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
420  $this->tpl->setCurrentBlock("btn_cell");
421  $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "showPaymentType"));
422  $this->tpl->setVariable("BTN_TXT", $this->lng->txt('pay_bmf_back'));
423  $this->tpl->parseCurrentBlock("btn_cell");
424 
425  }
426  }
427 
428  function getDebitEntry()
429  {
430  if ($_POST["account_holder"] == "" ||
431  $_POST["bank_code"] == "" ||
432  $_POST["account_number"] == "")
433  {
434  $this->error = $this->lng->txt('pay_bmf_debit_entry_not_valid');
435  ilUtil::sendInfo($this->error);
436  $this->showDebitEntry();
437  return;
438  }
439  if ($_POST["terms_conditions"] != 1)
440  {
441  $this->error = $this->lng->txt('pay_bmf_check_terms_conditions');
442  ilUtil::sendInfo($this->error);
443  $this->showDebitEntry();
444  return;
445  }
446  if ($_POST["password"] == "" ||
447  md5($_POST["password"]) != $this->user_obj->getPasswd())
448  {
449  $this->error = $this->lng->txt('pay_bmf_password_not_valid');
450  ilUtil::sendInfo($this->error);
451  $this->showDebitEntry();
452  return;
453  }
454 
455  $_SESSION["bmf"]["debit_entry"]["BLZ"] = $_POST["bank_code"];
456  $_SESSION["bmf"]["debit_entry"]["kontoinhaber"] = $_POST["account_holder"];
457  $_SESSION["bmf"]["debit_entry"]["kontoNr"] = $_POST["account_number"];
458 
459  $this->error = "";
460  $this->sendDebitEntry();
461  }
462 
463  function sendDebitEntry()
464  {
465  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
466 
467  $this->psc_obj->clearCouponItemsSession();
468 
469  if(!count($items = $this->psc_obj->getEntries(PAY_METHOD_BMF)))
470  {
471 
472  $this->tpl->setVariable("HEADER",$this->lng->txt('pay_bmf_your_order'));
473  $this->tpl->touchBlock("stop_floating");
474  ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
475 
476  }
477  else
478  {
479  $customer = new KundenstammdatenPflegeWS();
480 
481  $newCustomer = new Kunde($this->user_obj->getId());
482 
483  $resultCustomerObj = $customer->anlegenKunde($newCustomer);
484 
485  $resultCustomer = $resultCustomerObj->ergebnis;
486 
487  if (is_object($resultCustomer))
488  {
489  if ($resultCustomer->code < 0)
490  {
491  $error = $this->lng->txt('pay_bmf_server_error_code') . " " . $resultCustomer->code . ": " . $resultCustomer->kurzText . "<br>\n" . $resultCustomer->langText;
492  if ($resultCustomer->code == -103 ||
493  $resultCustomer->code == -104 ||
494  $resultCustomer->code == -107 ||
495  ($resultCustomer->code <= -202 && $resultCustomer->code >= -208) ||
496  $resultCustomer->code == -213)
497  {
499  $this->showPersonalData();
500  }
501  else
502  {
503  $error .= "<br>\n" . $this->lng->txt('pay_bmf_server_error_sysadmin');
505  $this->showPersonalData();
506  }
507  }
508  else
509  {
510  $payment = new LastschriftWS();
511 
512  $debitEntry = new Lastschrift();
513 
514  $address = new LieferAdresse();
515 
516  $bank = new Bankverbindung();
517 
518  $sc_obj =& new ilPaymentShoppingCart($this->user_obj);
519 
520  $tmp_bookEntries = $sc_obj->getShoppingCart();
521  if (!is_array($tmp_bookEntries))
522  {
523  ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
524  }
525  else
526  {
527  $totalAmount = 0;
528  for ($i = 0; $i < count($tmp_bookEntries); $i++)
529  {
530  $booking = true;
531 
532  if (!empty($_SESSION["coupons"]["bmf"]))
533  {
534  $price = $tmp_bookEntries[$i]["betrag"];
535  $tmp_bookEntries[$i]["math_price"] = (float) $price;
536 
537  foreach ($_SESSION["coupons"]["bmf"] as $key => $coupon)
538  {
539  $this->coupon_obj->setId($coupon["pc_pk"]);
540  $this->coupon_obj->setCurrentCoupon($coupon);
541 
542  $tmp_pobject =& new ilPaymentObject($this->user_obj, $tmp_bookEntries[$i]['pobject_id']);
543 
544  if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
545  {
546  $_SESSION["coupons"]["bmf"][$key]["total_objects_coupon_price"] += (float) $price;
547  $_SESSION["coupons"]["bmf"][$key]["items"][] = $tmp_bookEntries[$i];
548  $booking = false;
549  }
550 
551  unset($tmp_pobject);
552  }
553  }
554 
555  if ($booking)
556  {
557  $tmp_bookEntries[$i]["betrag_string"] = number_format( (float) $tmp_bookEntries[$i]["betrag"] , 2, ",", ".");
558 
559  $bookEntries[] = new Buchung($tmp_bookEntries[$i]);
560  $totalAmount += $tmp_bookEntries[$i]["betrag"];
561  }
562  else
563  {
564  $tmp_bookEntries[$i]["betrag_string"] = number_format( (float) $tmp_bookEntries[$i]["betrag"] , 2, ",", ".");
565  }
566  }
567 
568  $coupon_discount_items = $this->psc_obj->calcDiscountPrices($_SESSION["coupons"]["bmf"]);
569 
570  if (is_array($coupon_discount_items) && !empty($coupon_discount_items))
571  {
572  foreach ($coupon_discount_items as $item)
573  {
574  $item["betrag"] = $item["discount_price"];
575  $bookEntries[] = new Buchung($item);
576  $totalAmount += $item["betrag"];
577  }
578  }
579 
580  $values = array("betrag" => $totalAmount, "buchungen" => $bookEntries);
581  $bookingList = new BuchungsListe($this->user_obj->getId(), $values);
582  }
583 
584 
585 
586  $resultObj = $payment->abbuchenOhneEinzugsermaechtigung($resultCustomerObj->kunde->EShopKundenNr, $address, $bank, $bookingList);
587  $result = $resultObj->ergebnis;
588 
589  if (is_object($result))
590  {
591  if ($result->code < 0)
592  {
593  $this->tpl->setVariable("HEADER",$this->lng->txt('error'));
594  $this->tpl->touchBlock("stop_floating");
595  $error = $this->lng->txt('pay_bmf_server_error_code') . " " . $result->code . ": " . $result->kurzText . "<br>\n" . $result->langText;
596  if ($result->code == -103 ||
597  $result->code == -104 ||
598  $result->code == -107 ||
599  ($result->code <= -202 && $result->code >= -208) ||
600  $result->code == -213)
601  {
603  $this->showPersonalData();
604  }
605  else if ($result->code == -507 ||
606  $result->code == -510 ||
607  $result->code == -511)
608  {
610  $this->showPaymentType();
611  }
612  else if ($result->code == -402 ||
613  $result->code == -402 ||
614  $result->code == -403 ||
615  $result->code == -406 ||
616  $result->code == -410 ||
617  $result->code == -413 ||
618  $result->code == -701 ||
619  $result->code == -702 ||
620  $result->code == -703)
621  {
623  $this->showDebitEntry();
624  }
625  else
626  {
627  $error .= "<br>\n" . $this->lng->txt('pay_bmf_server_error_sysadmin');
629  $this->showPersonalData();
630  }
631 
632  }
633  else
634  {
635  $resultCustomerObj->kunde->vorname = utf8_decode($resultCustomerObj->kunde->vorname);
636  $resultCustomerObj->kunde->nachname = utf8_decode($resultCustomerObj->kunde->nachname);
637  $resultCustomerObj->kunde->rechnungsAdresse->strasse = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->strasse);
638  $resultCustomerObj->kunde->rechnungsAdresse->hausNr = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->hausNr);
639  $resultCustomerObj->kunde->rechnungsAdresse->postfach = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->postfach);
640  $resultCustomerObj->kunde->rechnungsAdresse->PLZ = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->PLZ);
641  $resultCustomerObj->kunde->rechnungsAdresse->ort = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->ort);
642  $resultCustomerObj->kunde->rechnungsAdresse->land = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->land);
643 
644  // everything ok => send confirmation, fill statistik, delete session, delete shopping cart.
645  $this->__sendBill($resultCustomerObj->kunde, $_SESSION["bmf"]["payment_type"], $bookingList, $resultObj);
646 
647  $this->__addBookings($resultObj,$bookingList->getTransaction());
648  $this->__emptyShoppingCart();
649  $this->__clearSession();
650 
651  $this->tpl->setVariable("HEADER",$this->lng->txt('pay_bmf_your_order'));
652  $this->tpl->setVariable("DESCRIPTION",$this->lng->txt('pay_bmf_thanks'));
653  $this->tpl->touchBlock("stop_floating");
654 
655  ilUtil::sendInfo($this->lng->txt('pay_bmf_thanks'));
656 
657  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.pay_bmf_debit_entry.html','payment');
658 
659  if ($this->ilias->getSetting("https") != 1)
660  {
661  $this->tpl->setCurrentBlock("buyed_objects");
662  #$this->tpl->setVariable("LINK_GOTO_BUYED_OBJECTS", "./payment.php?baseClass=ilpaymentbuyedobjectsgui&cmd=2");
663  #$link = $this->ctrl->getLinkTargetByClass('ilpaymentbuyedobjectsgui', 'showItems');
664  $link = $this->ctrl->getLinkTargetByClass('ilshopboughtobjectsgui');
665  $this->tpl->setVariable("LINK_GOTO_BUYED_OBJECTS", $link);
666  $this->tpl->setVariable("TXT_GOTO_BUYED_OBJECTS", $this->lng->txt('pay_goto_buyed_objects'));
667  $this->tpl->parseCurrentBlock("buyed_objects");
668  }
669  $this->tpl->setVariable("TXT_CLOSE_WINDOW", $this->lng->txt('close_window'));
670  }
671  }
672  else
673  {
674  $this->tpl->setVariable("HEADER",$this->lng->txt('error'));
675  $this->tpl->touchBlock("stop_floating");
676  ilUtil::sendInfo($this->lng->txt('pay_bmf_server_error_communication'));
677  }
678  }
679  }
680  else
681  {
682  $this->tpl->setVariable("HEADER",$this->lng->txt('error'));
683  $this->tpl->touchBlock("stop_floating");
684  ilUtil::sendInfo($this->lng->txt('pay_bmf_server_error_communication'));
685  }
686  }
687  }
688 
689  function showCreditCard()
690  {
691  // user_id $this->user_obj->getId()
692  // all
693 
694 /* if ($_SESSION["bmf"]["credit_card"]["karteninhaber"] == "" &&
695  $this->error == "" &&
696  $_POST["card_holder"] == "")
697  {
698  $_SESSION["bmf"]["credit_card"]["karteninhaber"] = $_SESSION["bmf"]["personal_data"]["vorname"] . " " . $_SESSION["bmf"]["personal_data"]["nachname"];
699  }*/
700 
701  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
702 
703  if(!count($items = $this->psc_obj->getEntries(PAY_METHOD_BMF)))
704  {
705 
706  $this->tpl->setVariable("HEADER",$this->lng->txt('pay_bmf_your_order'));
707  $this->tpl->touchBlock("stop_floating");
708  ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
709 
710  }
711  else
712  {
713 
714  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.pay_bmf_credit_card.html','payment');
715  #$this->tpl = new ilTemplate('tpl.pay_bmf_credit_card.html', true, true, 'payment');
716  $this->__showShoppingCart();
717 
718  $this->tpl->setVariable("CREDIT_CARD_FORMACTION",$this->ctrl->getFormAction($this));
719 
720  // set table header
721  $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_pays_b.gif'));
722  $this->tpl->setVariable("ALT_IMG",$this->lng->txt('obj_usr'));
723  $this->tpl->setVariable("HEADER",$this->lng->txt('pay_step3_credit_card'));
724  $this->tpl->setVariable("TITLE",$this->lng->txt('pay_bmf_credit_card_data'));
725  $this->tpl->setVariable("DESCRIPTION",$this->lng->txt('pay_bmf_description_credit_card'));
726  $this->tpl->touchBlock("stop_floating");
727  $this->tpl->setVariable("TXT_CLOSE_WINDOW",$this->lng->txt('close_window'));
728 
729  // set plain text variables
730  $this->tpl->setVariable("TXT_CARD_HOLDER",$this->lng->txt('pay_bmf_card_holder'));
731  $this->tpl->setVariable("TXT_CHECK_NUMBER",$this->lng->txt('pay_bmf_check_number'));
732  $this->tpl->setVariable("TXT_OPTIONAL",$this->lng->txt('pay_bmf_optional'));
733  $this->tpl->setVariable("TXT_CARD_NUMBER",$this->lng->txt('pay_bmf_card_number'));
734  $this->tpl->setVariable("TXT_VALIDITY",$this->lng->txt('pay_bmf_validity'));
735  $this->tpl->setVariable("TXT_TERMS_CONDITIONS",$this->lng->txt('pay_bmf_terms_conditions'));
736  $this->tpl->setVariable("TXT_TERMS_CONDITIONS_READ",$this->lng->txt('pay_bmf_terms_conditions_read'));
737  $this->tpl->setVariable("TXT_TERMS_CONDITIONS_SHOW",$this->lng->txt('pay_bmf_terms_conditions_show'));
738  $this->tpl->setVariable("LINK_TERMS_CONDITIONS","./payment.php?view=conditions");
739  $this->tpl->setVariable("TXT_PASSWORD",$this->lng->txt('password'));
740  $this->tpl->setVariable("TXT_CONFIRM_ORDER",$this->lng->txt('pay_confirm_order'));
741 
742  $this->tpl->setVariable("INPUT_VALUE",$this->lng->txt('pay_send_order'));
743  $this->tpl->setVariable("CANCEL",$this->lng->txt('cancel'));
744 
745  // fill defaults
746 
747  $this->tpl->setVariable("CARD_HOLDER",
748  $this->error != "" && isset($_POST['card_holder'])
749  ? ilUtil::prepareFormOutput($_POST['card_holder'],true)
750  : ilUtil::prepareFormOutput($_SESSION['bmf']["credit_card"]['karteninhaber'],true));
751  $this->tpl->setVariable("CARD_NUMBER_BLOCK_1",
752  $this->error != "" && isset($_POST['card_number']['block_1'])
753  ? ilUtil::prepareFormOutput($_POST['card_number']['block_1'],true)
754  : ilUtil::prepareFormOutput($_SESSION['bmf']["credit_card"]['kreditkartenNr']['block_1'],true));
755  $this->tpl->setVariable("CARD_NUMBER_BLOCK_2",
756  $this->error != "" && isset($_POST['card_number']['block_2'])
757  ? ilUtil::prepareFormOutput($_POST['card_number']['block_2'],true)
758  : ilUtil::prepareFormOutput($_SESSION['bmf']["credit_card"]['kreditkartenNr']['block_2'],true));
759  $this->tpl->setVariable("CARD_NUMBER_BLOCK_3",
760  $this->error != "" && isset($_POST['card_number']['block_3'])
761  ? ilUtil::prepareFormOutput($_POST['card_number']['block_3'],true)
762  : ilUtil::prepareFormOutput($_SESSION['bmf']["credit_card"]['kreditkartenNr']['block_3'],true));
763  $this->tpl->setVariable("CARD_NUMBER_BLOCK_4",
764  $this->error != "" && isset($_POST['card_number']['block_4'])
765  ? ilUtil::prepareFormOutput($_POST['card_number']['block_4'],true)
766  : ilUtil::prepareFormOutput($_SESSION['bmf']["credit_card"]['kreditkartenNr']['block_4'],true));
767  $this->tpl->setVariable("CHECK_NUMBER",
768  $this->error != "" && isset($_POST['check_number'])
769  ? ilUtil::prepareFormOutput($_POST['check_number'],true)
770  : ilUtil::prepareFormOutput($_SESSION['bmf']["credit_card"]['kartenpruefnummer'],true));
771  for ($i = 1; $i <= 12; $i++)
772  {
773  $this->tpl->setCurrentBlock("loop_validity_months");
774  $this->tpl->setVariable("LOOP_VALIDITY_MONTHS", $i < 10 ? "0" . $i : $i);
775  $this->tpl->setVariable("LOOP_VALIDITY_MONTHS_TXT", $i < 10 ? "0" . $i : $i);
776  if ($this->error != "" &&
777  isset($_POST['validity']['month']))
778  {
779  if ($_POST['validity']['month'] == $i)
780  {
781  $this->tpl->setVariable("LOOP_VALIDITY_MONTHS_SELECTED", " selected");
782  }
783  }
784  else
785  {
786  if ($_SESSION["bmf"]["credit_card"]["gueltigkeit"]["monat"] == $i)
787  {
788  $this->tpl->setVariable("LOOP_VALIDITY_MONTHS_SELECTED", " selected");
789  }
790  }
791  $this->tpl->parseCurrentBlock("loop_validity_months");
792  }
793  for ($i = date("Y"); $i <= (date("Y")+6); $i++)
794  {
795  $this->tpl->setCurrentBlock("loop_validity_years");
796  $this->tpl->setVariable("LOOP_VALIDITY_YEARS", $i);
797  $this->tpl->setVariable("LOOP_VALIDITY_YEARS_TXT", $i);
798  if ($this->error != "" &&
799  isset($_POST['validity']['year']))
800  {
801  if ($_POST['validity']['year'] == $i)
802  {
803  $this->tpl->setVariable("LOOP_VALIDITY_YEARS_SELECTED", " selected");
804  }
805  }
806  else
807  {
808  if ($_SESSION["bmf"]["credit_card"]["gueltigkeit"]["jahr"] == $i)
809  {
810  $this->tpl->setVariable("LOOP_VALIDITY_YEARS_SELECTED", " selected");
811  }
812  }
813  $this->tpl->parseCurrentBlock("loop_validity_years");
814  }
815 /* if ($this->error != "" &&
816  isset($_POST["terms_conditions"]))
817  {
818  $this->tpl->setVariable("TERMS_CONDITIONS_" . $_POST["terms_conditions"], " checked") ;
819  }*/
820 /* if ($this->error != "" &&
821  isset($_POST["password"]))
822  {
823  $this->tpl->setVariable("PASSWORD", ilUtil::prepareFormOutput($_POST['password'],true));
824  }*/
825 
826  // Button
827  $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
828  $this->tpl->setCurrentBlock("btn_cell");
829  $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "showPaymentType"));
830  $this->tpl->setVariable("BTN_TXT", $this->lng->txt('pay_bmf_back'));
831  $this->tpl->parseCurrentBlock("btn_cell");
832 
833  }
834  }
835 
836  function getCreditCard()
837  {
838  if ($_POST["card_holder"] == "" ||
839  $_POST["card_number"]["block_1"] == "" ||
840  $_POST["card_number"]["block_2"] == "" ||
841  $_POST["card_number"]["block_3"] == "" ||
842  $_POST["card_number"]["block_4"] == "" ||
843  $_POST["validity"]["month"] == "" ||
844  $_POST["validity"]["year"] == "" ||
845  $_POST["validity"]["year"]."-".$_POST["validity"]["month"] < date("Y-m"))
846  {
847  $this->error = $this->lng->txt('pay_bmf_credit_card_not_valid');
848  ilUtil::sendInfo($this->error);
849  $this->showCreditCard();
850  return;
851  }
852  if ($_POST["terms_conditions"] != 1)
853  {
854  $this->error = $this->lng->txt('pay_bmf_check_terms_conditions');
855  ilUtil::sendInfo($this->error);
856  $this->showCreditCard();
857  return;
858  }
859  if ($_POST["password"] == "" ||
860  md5($_POST["password"]) != $this->user_obj->getPasswd())
861  {
862  $this->error = $this->lng->txt('pay_bmf_password_not_valid');
863  ilUtil::sendInfo($this->error);
864  $this->showCreditCard();
865  return;
866  }
867 
868  $_SESSION["bmf"]["credit_card"]["gueltigkeit"]["monat"] = $_POST["validity"]["month"];
869  $_SESSION["bmf"]["credit_card"]["gueltigkeit"]["jahr"] = $_POST["validity"]["year"];
870  $_SESSION["bmf"]["credit_card"]["karteninhaber"] = $_POST["card_holder"];
871  $_SESSION["bmf"]["credit_card"]["kreditkartenNr"]["block_1"] = $_POST["card_number"]["block_1"];
872  $_SESSION["bmf"]["credit_card"]["kreditkartenNr"]["block_2"] = $_POST["card_number"]["block_2"];
873  $_SESSION["bmf"]["credit_card"]["kreditkartenNr"]["block_3"] = $_POST["card_number"]["block_3"];
874  $_SESSION["bmf"]["credit_card"]["kreditkartenNr"]["block_4"] = $_POST["card_number"]["block_4"];
875  $_SESSION["bmf"]["credit_card"]["kartenpruefnummer"] = $_POST["check_number"];
876  # zum testen
877  $this->error = "";
878  $this->sendCreditCard();
879  }
880 
881  function sendCreditCard()
882  {
883  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
884 
885  $this->psc_obj->clearCouponItemsSession();
886 
887  if(!count($items = $this->psc_obj->getEntries(PAY_METHOD_BMF)))
888  {
889 
890  $this->tpl->setVariable("HEADER",$this->lng->txt('pay_bmf_your_order'));
891  $this->tpl->touchBlock("stop_floating");
892  ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
893 
894  }
895  else
896  {
897  $payment = new KreditkartenzahlungWS();
898 
899  $customer = new Kunde($this->user_obj->getId());
900 
901  $creditCard = new Kreditkarte();
902 
903  $sc_obj =& new ilPaymentShoppingCart($this->user_obj);
904 
905  $tmp_bookEntries = $sc_obj->getShoppingCart();
906  if (!is_array($tmp_bookEntries))
907  {
908  ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
909  }
910  else
911  {
912  $totalAmount = 0;
913  for ($i = 0; $i < count($tmp_bookEntries); $i++)
914  {
915  $booking = true;
916 
917  if (!empty($_SESSION["coupons"]["bmf"]))
918  {
919  $price = $tmp_bookEntries[$i]["betrag"];
920  $tmp_bookEntries[$i]["math_price"] = (float) $price;
921 
922  foreach ($_SESSION["coupons"]["bmf"] as $key => $coupon)
923  {
924  $this->coupon_obj->setId($coupon["pc_pk"]);
925  $this->coupon_obj->setCurrentCoupon($coupon);
926 
927  $tmp_pobject =& new ilPaymentObject($this->user_obj, $tmp_bookEntries[$i]['pobject_id']);
928 
929  if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
930  {
931  $_SESSION["coupons"]["bmf"][$key]["total_objects_coupon_price"] += (float) $price;
932  $_SESSION["coupons"]["bmf"][$key]["items"][] = $tmp_bookEntries[$i];
933 
934  $booking = false;
935  }
936 
937  unset($tmp_pobject);
938  }
939  }
940 
941  if ($booking)
942  {
943  $tmp_bookEntries[$i]["betrag_string"] = number_format( (float) $tmp_bookEntries[$i]["betrag"] , 2, ",", ".");
944 
945  $bookEntries[] = new Buchung($tmp_bookEntries[$i]);
946  $totalAmount += $tmp_bookEntries[$i]["betrag"];
947  }
948  else
949  {
950  $tmp_bookEntries[$i]["betrag_string"] = number_format( (float) $tmp_bookEntries[$i]["betrag"] , 2, ",", ".");
951  }
952  }
953 
954  $coupon_discount_items = $this->psc_obj->calcDiscountPrices($_SESSION["coupons"]["bmf"]);
955 
956  if (is_array($coupon_discount_items) && !empty($coupon_discount_items))
957  {
958  foreach ($coupon_discount_items as $item)
959  {
960  $item["betrag"] = $item["discount_price"];
961  $bookEntries[] = new Buchung($item);
962  $totalAmount += $item["discount_price"];
963  }
964  }
965 
966  $values = array("betrag" => $totalAmount, "buchungen" => $bookEntries);
967  $bookingList = new BuchungsListe($this->user_obj->getId(), $values);
968  }
969 
970  $resultObj = $payment->zahlenUndAnlegenKunde($customer, $creditCard, $bookingList);
971  $result = $resultObj->ergebnis;
972 
973 // if(true == true) #zum testen
974  if (is_object($result))
975  {
976 
977  if ($result->code < 0)
978  {
979  $this->tpl->setVariable("HEADER",$this->lng->txt('error'));
980  $this->tpl->touchBlock("stop_floating");
981  $error = $this->lng->txt('pay_bmf_server_error_code') . " " . $result->code . ": " . $result->kurzText . "<br>\n" . $result->langText;
982  if ($result->code == -103 ||
983  $result->code == -104 ||
984  $result->code == -107 ||
985  ($result->code <= -202 && $result->code >= -208) ||
986  $result->code == -213)
987  {
989  $this->showPersonalData();
990  }
991  else if ($result->code == -507 ||
992  $result->code == -510 ||
993  $result->code == -511)
994  {
996  $this->showPaymentType();
997  }
998  else if ($result->code == -701 ||
999  $result->code == -1701 ||
1000  $result->code == -1706 ||
1001  $result->code == -1707 ||
1002  $result->code == -1710 ||
1003  $result->code == -1711)
1004  {
1006  $this->showCreditCard();
1007  }
1008  else
1009  {
1010  $error .= "<br>\n" . $this->lng->txt('pay_bmf_server_error_sysadmin');
1012  $this->showPersonalData();
1013  }
1014 
1015  }
1016  else
1017  {
1018 #zum testen
1019  // everything ok => send confirmation, fill statistik, delete session, delete shopping cart.
1020  $this->__sendBill($customer, $_SESSION["bmf"]["payment_type"], $bookingList, $resultObj);
1021 
1022  $this->__addBookings($resultObj,$bookingList->getTransaction());
1023  $this->__emptyShoppingCart();
1024  $this->__clearSession();
1025 
1026  $this->tpl->setVariable("HEADER",$this->lng->txt('pay_bmf_your_order'));
1027  $this->tpl->setVariable("DESCRIPTION",$this->lng->txt('pay_bmf_thanks'));
1028  $this->tpl->touchBlock("stop_floating");
1029 
1030  ilUtil::sendInfo($this->lng->txt('pay_bmf_thanks'));
1031 
1032  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.pay_bmf_credit_card.html','payment');
1033  #$this->tpl = new ilTemplate('tpl.pay_bmf_credit_card.html', true, true, 'payment');
1034  if ($this->ilias->getSetting("https") != 1)
1035  {
1036  $this->tpl->setCurrentBlock("buyed_objects");
1037  #$this->ctrl->redirectByClass("ilPaymentBuyedObjectsGUI", "ilpaymentbuyedobjectsgui");
1038  #$link = $this->ctrl->getLinkTargetByClass('ilpaymentbuyedobjectsgui', 'showItems');
1039  $link = $this->ctrl->getLinkTargetByClass('ilshopboughtobjectsgui');
1040  $this->tpl->setVariable("LINK_GOTO_BUYED_OBJECTS", $link);
1041  $this->tpl->setVariable("TXT_GOTO_BUYED_OBJECTS", $this->lng->txt('pay_goto_buyed_objects'));
1042  $this->tpl->parseCurrentBlock("buyed_objects");
1043  }
1044  $this->tpl->setVariable("TXT_CLOSE_WINDOW", $this->lng->txt('close_window'));
1045  }
1046 
1047  }
1048  else
1049  {
1050  $this->tpl->setVariable("HEADER",$this->lng->txt('error'));
1051  $this->tpl->touchBlock("stop_floating");
1052  ilUtil::sendInfo($this->lng->txt('pay_bmf_server_error_communication'));
1053  }
1054  #zum testen
1055  }
1056 
1057  }
1058 
1062  function &executeCommand()
1063  {
1064  global $tree;
1065 
1066  $cmd = $this->ctrl->getCmd();
1067 
1068  switch ($this->ctrl->getNextClass($this))
1069  {
1070 
1071  default:
1072  if(!$cmd = $this->ctrl->getCmd())
1073  {
1074  $cmd = 'showPersonalData';
1075  }
1076  $this->$cmd();
1077  break;
1078  }
1079  }
1080 
1081  // PRIVATE
1082  function __sendBill($customer, $paymentType, $bookingList, $result)
1083  {
1084  include_once './classes/class.ilTemplate.php';
1085  include_once "./Services/Utilities/classes/class.ilUtil.php";
1086  include_once './payment/classes/class.ilGeneralSettings.php';
1087  include_once './payment/classes/class.ilPaymentShoppingCart.php';
1088  include_once 'Services/Mail/classes/class.ilMimeMail.php';
1089 
1090  $sc_obj =& new ilPaymentShoppingCart($this->user_obj);
1091  $genSet = new ilGeneralSettings();
1092 
1093  $tpl = new ilTemplate("./payment/templates/default/tpl.pay_bmf_bill.html", true, true, true);
1094 
1095  $tpl->setVariable("VENDOR_ADDRESS", nl2br(utf8_decode($genSet->get("address"))));
1096  $tpl->setVariable("VENDOR_ADD_INFO", nl2br(utf8_decode($genSet->get("add_info"))));
1097  $tpl->setVariable("VENDOR_BANK_DATA", nl2br(utf8_decode($genSet->get("bank_data"))));
1098  $tpl->setVariable("TXT_BANK_DATA", utf8_decode($this->lng->txt("pay_bank_data")));
1099 
1100  $tpl->setVariable("CUSTOMER_FIRSTNAME", $customer->vorname);
1101  $tpl->setVariable("CUSTOMER_LASTNAME", $customer->nachname);
1102  if ($customer->rechnungsAdresse->strasse != "" &&
1103  $customer->rechnungsAdresse->hausNr != "")
1104  {
1105  $tpl->setVariable("CUSTOMER_STREET_POBOX", $customer->rechnungsAdresse->strasse . " ". $customer->rechnungsAdresse->hausNr);
1106  }
1107  else
1108  {
1109  $tpl->setVariable("CUSTOMER_STREET_POBOX", $customer->rechnungsAdresse->postfach);
1110  }
1111  $tpl->setVariable("CUSTOMER_ZIPCODE", $customer->rechnungsAdresse->PLZ);
1112  $tpl->setVariable("CUSTOMER_CITY", $customer->rechnungsAdresse->ort);
1113  $tpl->setVariable("CUSTOMER_COUNTRY", $this->__getCountryName($customer->rechnungsAdresse->land));
1114 
1115  $tpl->setVariable("BILL_NO", $result->buchungsListe->kassenzeichen);
1116  $tpl->setVariable("DATE", date("d.m.Y"));
1117 
1118  $tpl->setVariable("TXT_BILL", utf8_decode($this->lng->txt("pays_bill")));
1119  $tpl->setVariable("TXT_BILL_NO", utf8_decode($this->lng->txt("pay_bill_no")));
1120  $tpl->setVariable("TXT_DATE", utf8_decode($this->lng->txt("date")));
1121 
1122  $tpl->setVariable("TXT_ARTICLE", utf8_decode($this->lng->txt("pay_article")));
1123  $tpl->setVariable('TXT_VAT_RATE', utf8_decode($this->lng->txt('vat_rate')));
1124  $tpl->setVariable('TXT_VAT_UNIT', utf8_decode($this->lng->txt('vat_unit')));
1125  $tpl->setVariable("TXT_PRICE", utf8_decode($this->lng->txt("price_a")));
1126 
1127  $bookEntries = $sc_obj->getShoppingCart();
1128  for ($i = 0; $i < count($bookEntries); $i++)
1129  {
1130  $tmp_pobject =& new ilPaymentObject($this->user_obj, $bookEntries[$i]['pobject_id']);
1131 
1132  $assigned_coupons = '';
1133  if (!empty($_SESSION["coupons"]["bmf"]))
1134  {
1135  foreach ($_SESSION["coupons"]["bmf"] as $key => $coupon)
1136  {
1137  $this->coupon_obj->setId($coupon["pc_pk"]);
1138  $this->coupon_obj->setCurrentCoupon($coupon);
1139 
1140  if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
1141  {
1142  $assigned_coupons .= '<br />' . $this->lng->txt('paya_coupons_coupon') . ': ' . $coupon["pcc_code"];
1143  }
1144  }
1145  }
1146 
1147  $tpl->setCurrentBlock("loop");
1148  $tpl->setVariable("LOOP_OBJ_TYPE", utf8_decode($this->lng->txt($bookEntries[$i]["typ"])));
1149  $tpl->setVariable("LOOP_TITLE", $bookEntries[$i]["buchungstext"]. $assigned_coupons);
1150  $tpl->setVariable("LOOP_TXT_ENTITLED_RETRIEVE", utf8_decode($this->lng->txt("pay_entitled_retrieve")));
1151  $tpl->setVariable("LOOP_DURATION", $bookEntries[$i]["dauer"] . " " . utf8_decode($this->lng->txt("paya_months")));
1152  $tpl->setVariable('LOOP_VAT_RATE', ilShopUtils::_formatVAT($bookEntries[$i]['vat_rate']));
1153  $tpl->setVariable('LOOP_VAT_UNIT', ilShopUtils::_formatFloat($bookEntries[$i]['vat_unit']).' '.$genSet->get('currency_unit'));
1154 
1155  $totalVat += (float)$bookEntries[$i]['vat_unit'];
1156 
1157  $tpl->setVariable("LOOP_PRICE", number_format($bookEntries[$i]["betrag"], 2, ",", ".") . " " . $genSet->get("currency_unit"));
1158  $tpl->parseCurrentBlock("loop");
1159 
1160  unset($tmp_pobject);
1161  }
1162 
1163  if (!empty($_SESSION["coupons"]["bmf"]))
1164  {
1165  if (count($items = $bookEntries))
1166  {
1167  $sub_total_amount = $bookingList->betrag;
1168 
1169  foreach ($_SESSION["coupons"]["bmf"] as $coupon)
1170  {
1171  $this->coupon_obj->setId($coupon["pc_pk"]);
1172  $this->coupon_obj->setCurrentCoupon($coupon);
1173 
1174  $total_object_price = 0.0;
1175  $current_coupon_bonus = 0.0;
1176 
1177  foreach ($bookEntries as $item)
1178  {
1179  $tmp_pobject =& new ilPaymentObject($this->user_obj, $item['pobject_id']);
1180 
1181  if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
1182  {
1183  $total_object_price += $item["betrag"];
1184  }
1185 
1186  unset($tmp_pobject);
1187  }
1188 
1189  $current_coupon_bonus = $this->coupon_obj->getCouponBonus($total_object_price);
1190 
1191  $sub_total_amount += $current_coupon_bonus;
1192 
1193  $tpl->setCurrentBlock("cloop");
1194  $tpl->setVariable("TXT_COUPON", utf8_decode($this->lng->txt("paya_coupons_coupon") . " " . $coupon["pcc_code"]));
1195  $tpl->setVariable("BONUS", number_format($current_coupon_bonus * (-1), 2, ',', '.') . " " . $genSet->get("currency_unit"));
1196  $tpl->parseCurrentBlock();
1197  }
1198 
1199  $tpl->setVariable("TXT_SUBTOTAL_AMOUNT", utf8_decode($this->lng->txt("pay_bmf_subtotal_amount")));
1200  $tpl->setVariable("SUBTOTAL_AMOUNT", number_format($sub_total_amount, 2, ",", ".") . " " . $genSet->get("currency_unit"));
1201  }
1202  }
1203 
1204  if ($bookingList->betrag < 0) $bookingList->betrag = 0.0;
1205 
1206  $tpl->setVariable("TXT_TOTAL_AMOUNT", utf8_decode($this->lng->txt("pay_bmf_total_amount")));
1207  $tpl->setVariable("TOTAL_AMOUNT", number_format($bookingList->betrag, 2, ",", ".") . " " . $genSet->get("currency_unit"));
1208 
1209  if ($this->totalVat > 0)
1210  {
1211  $tpl->setVariable("TOTAL_VAT", ilShopUtils::_formatFloat($totalVat) . " " . $genSet->get('currency_unit'));
1212  $tpl->setVariable("TXT_TOTAL_VAT", utf8_decode($this->lng->txt("pay_bmf_vat_included")));
1213  }
1214 
1215  if ($paymentType == "debit_entry")
1216  {
1217  $tpl->setVariable("TXT_PAYMENT_TYPE", utf8_decode($this->lng->txt("pay_payed_debit_entry")));
1218  }
1219  else
1220  {
1221  $tpl->setVariable("TXT_PAYMENT_TYPE", utf8_decode($this->lng->txt("pay_payed_credit_card")));
1222  }
1223 
1224  if (!@file_exists($genSet->get("pdf_path")))
1225  {
1226  ilUtil::makeDir($genSet->get("pdf_path"));
1227  }
1228 
1229  if (@file_exists($genSet->get("pdf_path")))
1230  {
1231  ilUtil::html2pdf($tpl->get(), $genSet->get("pdf_path") . "/" . $result->buchungsListe->kassenzeichen . ".pdf");
1232  }
1233 
1234  if (@file_exists($genSet->get("pdf_path") . "/" . $result->buchungsListe->kassenzeichen . ".pdf") &&
1235  $customer->EMailAdresse != "" &&
1236  $this->ilias->getSetting("admin_email") != "")
1237  {
1238  $m= new ilMimeMail; // create the mail
1239  $m->From( $this->ilias->getSetting("admin_email") );
1240  $m->To( $customer->EMailAdresse );
1241  $m->Subject( $this->lng->txt("pay_message_subject") );
1242  $message = $this->lng->txt("pay_message_hello") . " " . utf8_encode($customer->vorname) . " " . utf8_encode($customer->nachname) . ",\n\n";
1243  $message .= $this->lng->txt("pay_message_thanks") . "\n\n";
1244  $message .= $this->lng->txt("pay_message_attachment") . "\n\n";
1245  $message .= $this->lng->txt("pay_message_regards") . "\n\n";
1246  $message .= strip_tags($genSet->get("address"));
1247  $m->Body( $message ); // set the body
1248  $m->Attach( $genSet->get("pdf_path") . "/" . $result->buchungsListe->kassenzeichen . ".pdf", "application/pdf" ) ; // attach a file of type image/gif
1249  $m->Send(); // send the mail
1250  }
1251 
1252  @unlink($genSet->get("pdf_path") . "/" . $result->buchungsListe->kassenzeichen . ".html");
1253  @unlink($genSet->get("pdf_path") . "/" . $result->buchungsListe->kassenzeichen . ".pdf");
1254 
1255  }
1256 
1257  function __addBookings($a_result,$a_transaction)
1258  {
1259  global $ilObjDataCache;
1260 
1261  include_once './payment/classes/class.ilPaymentBookings.php';
1262  include_once './payment/classes/class.ilPaymentShoppingCart.php';
1263  include_once './payment/classes/class.ilPaymentObject.php';
1264  include_once './payment/classes/class.ilPaymentPrices.php';
1265  include_once './Services/Payment/classes/class.ilShopUtils.php';
1266 
1267  $booking_obj =& new ilPaymentBookings();
1268 
1269  $sc_obj =& new ilPaymentShoppingCart($this->user_obj);
1270 
1271  $items = $sc_obj->getEntries(PAY_METHOD_BMF);
1272 
1273  $sc_obj->clearCouponItemsSession();
1274 
1275  foreach($items as $entry)
1276  {
1277  $pobject =& new ilPaymentObject($this->user_obj,$entry['pobject_id']);
1278 
1279  $price = ilPaymentPrices::_getPrice($entry['price_id']);
1280 
1281  if (!empty($_SESSION["coupons"]["bmf"]))
1282  {
1283  $entry["math_price"] = $entry['price']; // (float) ilPaymentPrices::_getPriceFromArray($price);
1284  foreach ($_SESSION["coupons"]["bmf"] as $key => $coupon)
1285  {
1286  $this->coupon_obj->setId($coupon["pc_pk"]);
1287  $this->coupon_obj->setCurrentCoupon($coupon);
1288 
1289  if ($this->coupon_obj->isObjectAssignedToCoupon($pobject->getRefId()))
1290  {
1291  $_SESSION["coupons"]["bmf"][$key]["total_objects_coupon_price"] += $entry['price']; //(float) ilPaymentPrices::_getPriceFromArray($price);
1292  $_SESSION["coupons"]["bmf"][$key]["items"][] = $entry;
1293  }
1294  }
1295  }
1296 
1297  unset($pobject);
1298  }
1299 
1300  $coupon_discount_items = $sc_obj->calcDiscountPrices($_SESSION["coupons"]["bmf"]);
1301 
1302  $i = 0;
1303  foreach($items as $entry)
1304  {
1305  $pobject =& new ilPaymentObject($this->user_obj,$entry['pobject_id']);
1306 
1307  $price = ilPaymentPrices::_getPrice($entry['price_id']);
1308 
1309  if (array_key_exists($entry["pobject_id"], $coupon_discount_items))
1310  {
1311  $bonus = $coupon_discount_items[$entry["pobject_id"]]["math_price"] - $coupon_discount_items[$entry["pobject_id"]]["discount_price"];
1312  }
1313 
1314  $booking_obj->setTransaction($a_transaction);
1315  $booking_obj->setPobjectId($entry['pobject_id']);
1316  $booking_obj->setCustomerId($this->user_obj->getId());
1317  $booking_obj->setVendorId($pobject->getVendorId());
1318  $booking_obj->setPayMethod($pobject->getPayMethod());
1319  $booking_obj->setOrderDate(time());
1320  $booking_obj->setDuration($price['duration']);
1321  $booking_obj->setPrice(ilPaymentPrices::_getPriceString($entry['price_id']));
1322  //$booking_obj->setDiscount($bonus > 0 ? ilPaymentPrices::_getPriceStringFromAmount((-1) * $bonus) : "");
1323  $booking_obj->setDiscount($bonus > 0 ? ilPaymentPrices::_getPriceStringFromAmount((-1) * $bonus) : 0);
1324  $booking_obj->setPayed(1);
1325  $booking_obj->setAccess(1);
1326  $booking_obj->setVoucher($a_result->buchungsListe->buchungen[$i++]->belegNr);
1327  $booking_obj->setTransactionExtern($a_result->buchungsListe->kassenzeichen);
1328 
1329  $obj_id = $ilObjDataCache->lookupObjId($pobject->getRefId());
1330  $obj_title = $ilObjDataCache->lookupTitle($obj_id);
1331 
1332  $oVAT = new ilShopVats((int)$pobject->getVatId());
1333  $obj_vat_rate = $oVAT->getRate();
1334  $obj_vat_unit = $pobject->getVat(ilPaymentPrices::_getPriceString($entry['price_id']));
1335 
1336  $booking_obj->setObjectTitle($obj_title);
1337  $booking_obj->setVatRate($obj_vat_rate);
1338  $booking_obj->setVatUnit($obj_vat_unit);
1339 
1340  //sets the customers address for the bill if enabled in administration
1341  include_once './payment/classes/class.ilPayMethods.php';
1342 
1343  $save_user_adr_bmf = (int) ilPayMethods::_enabled('save_user_adr_bmf') ? 1 : 0;
1344 
1345  if($save_user_adr_bmf == 1)
1346  {
1347  $booking_obj->setStreet($_SESSION['bmf']['personal_data']['street'], $_SESSION['bmf']['personal_data']['house_number']);
1348  $booking_obj->setPoBox($_SESSION['bmf']['personal_data']['po_box']);
1349  $booking_obj->setZipcode($_SESSION['bmf']['personal_data']['zipcode']);
1350  $booking_obj->setCity($_SESSION['bmf']['personal_data']['city']);
1351  $booking_obj->setCountry($_SESSION['bmf']['personal_data']['country']);
1352  }
1353 
1354  $current_booking_id = $booking_obj->add();
1355 
1356  if (!empty($_SESSION["coupons"]["bmf"]) && $current_booking_id)
1357  {
1358  foreach ($_SESSION["coupons"]["bmf"] as $coupon)
1359  {
1360  $this->coupon_obj->setId($coupon["pc_pk"]);
1361  $this->coupon_obj->setCurrentCoupon($coupon);
1362 
1363  if ($this->coupon_obj->isObjectAssignedToCoupon($pobject->getRefId()))
1364  {
1365  $this->coupon_obj->addCouponForBookingId($current_booking_id);
1366  }
1367  }
1368  }
1369 
1370  unset($current_booking_id);
1371  unset($pobject);
1372  }
1373 
1374  if (!empty($_SESSION["coupons"]["bmf"]))
1375  {
1376  foreach ($_SESSION["coupons"]["bmf"] as $coupon)
1377  {
1378  $this->coupon_obj->setId($coupon["pc_pk"]);
1379  $this->coupon_obj->setCurrentCoupon($coupon);
1380  $this->coupon_obj->addTracking();
1381  }
1382  }
1383  }
1384 
1386  {
1387  include_once './payment/classes/class.ilPaymentShoppingCart.php';
1388 
1389  $sc_obj =& new ilPaymentShoppingCart($this->user_obj);
1390 
1391  return $sc_obj->emptyShoppingCart();
1392  }
1393 
1394  function __clearSession()
1395  {
1396  $_SESSION["coupons"]["bmf"] = "";
1397  $_SESSION["bmf"]["payment_type"] = "";
1398  $_SESSION["bmf"]["debit_entry"] = array();
1399  $_SESSION["bmf"]["credit_card"] = array();
1400  }
1401 
1402  function __loadTemplate()
1403  {
1404  $this->tpl->addBlockFile("CONTENT", "content", "tpl.payb_content.html");
1405 
1406  $this->__buildStylesheet();
1407  $this->__buildStatusline();
1408  }
1409 
1411  {
1412  $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
1413 # $this->__buildLocator();
1414  }
1415 
1416  function __buildLocator()
1417  {
1418  $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html", "Services/Locator");
1419  $this->tpl->setVariable("TXT_LOCATOR",$this->lng->txt("locator"));
1420 
1421  $this->tpl->setCurrentBlock("locator_item");
1422  $this->tpl->setVariable("ITEM", $this->lng->txt("personal_desktop"));
1423  $this->tpl->setVariable("LINK_ITEM","../ilias.php?baseClass=ilPersonalDesktopGUI");
1424  #$this->tpl->setVariable("LINK_ITEM", "../usr_personaldesktop.php");
1425  $this->tpl->parseCurrentBlock();
1426 
1427  $this->tpl->setCurrentBlock("locator_item");
1428  $this->tpl->setVariable("PREFIX",'>&nbsp;');
1429 # $this->tpl->setVariable("ITEM", $this->lng->txt("pay_locator"));
1430  $this->tpl->setVariable("ITEM", "Payment");
1431  $this->tpl->setVariable("LINK_ITEM", "./payment.php");
1432  $this->tpl->parseCurrentBlock();
1433 
1434  // CHECK for new mail and info
1435  ilUtil::sendInfo();
1436 
1437  return true;
1438  }
1439 
1441  {
1442  $this->tpl->setVariable("LOCATION_STYLESHEET",ilUtil::getStyleSheetLocation());
1443  }
1444 
1448  function __showCountries(&$tpl, $value = "")
1449  {
1450  $countries = $this->__getCountries();
1451  foreach($countries as $code => $text)
1452  {
1453  $tpl->setCurrentBlock("loop_countries");
1454  $tpl->setVariable("LOOP_COUNTRIES", $code);
1455  $tpl->setVariable("LOOP_COUNTRIES_TXT", $text);
1456  if ($value != "" &&
1457  $value == $code)
1458  {
1459  $tpl->setVariable("LOOP_COUNTRIES_SELECTED", " selected");
1460  }
1461  $tpl->parseCurrentBlock("loop_countries");
1462  }
1463  $tpl->setVariable("TXT_PLEASE_SELECT", $this->lng->txt("pay_bmf_please_select"));
1464  return;
1465  }
1466 
1467  function __getCountries()
1468  {
1469  global $lng;
1470 
1471  $lng->loadLanguageModule("meta");
1472 
1473  $cntcodes = array ("DE","ES","FR","GB","AT","CH","AF","AL","DZ","AS","AD","AO",
1474  "AI","AQ","AG","AR","AM","AW","AU","AT","AZ","BS","BH","BD","BB","BY",
1475  "BE","BZ","BJ","BM","BT","BO","BA","BW","BV","BR","IO","BN","BG","BF",
1476  "BI","KH","CM","CA","CV","KY","CF","TD","CL","CN","CX","CC","CO","KM",
1477  "CG","CK","CR","CI","HR","CU","CY","CZ","DK","DJ","DM","DO","TP","EC",
1478  "EG","SV","GQ","ER","EE","ET","FK","FO","FJ","FI","FR","FX","GF","PF",
1479  "TF","GA","GM","GE","DE","GH","GI","GR","GL","GD","GP","GU","GT","GN",
1480  "GW","GY","HT","HM","HN","HU","IS","IN","ID","IR","IQ","IE","IL","IT",
1481  "JM","JP","JO","KZ","KE","KI","KP","KR","KW","KG","LA","LV","LB","LS",
1482  "LR","LY","LI","LT","LU","MO","MK","MG","MW","MY","MV","ML","MT","MH",
1483  "MQ","MR","MU","YT","MX","FM","MD","MC","MN","MS","MA","MZ","MM","NA",
1484  "NR","NP","NL","AN","NC","NZ","NI","NE","NG","NU","NF","MP","NO","OM",
1485  "PK","PW","PA","PG","PY","PE","PH","PN","PL","PT","PR","QA","RE","RO",
1486  "RU","RW","KN","LC","VC","WS","SM","ST","SA","CH","SN","SC","SL","SG",
1487  "SK","SI","SB","SO","ZA","GS","ES","LK","SH","PM","SD","SR","SJ","SZ",
1488  "SE","SY","TW","TJ","TZ","TH","TG","TK","TO","TT","TN","TR","TM","TC",
1489  "TV","UG","UA","AE","GB","UY","US","UM","UZ","VU","VA","VE","VN","VG",
1490  "VI","WF","EH","YE","ZR","ZM","ZW");
1491  $cntrs = array();
1492  foreach($cntcodes as $cntcode)
1493  {
1494  $cntrs[$cntcode] = $lng->txt("meta_c_".$cntcode);
1495  }
1496  asort($cntrs);
1497  return $cntrs;
1498  }
1499 
1500  function __getCountryCode($value = "")
1501  {
1502  $countries = $this->__getCountries();
1503  foreach($countries as $code => $text)
1504  {
1505  if ($text == $value)
1506  {
1507  return $code;
1508  }
1509  }
1510  return;
1511  }
1512 
1513  function __getCountryName($value = "")
1514  {
1515  $countries = $this->__getCountries();
1516  return $countries[$value];
1517  }
1518 
1519 /* function __getShoppingCart()
1520  {
1521  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
1522 
1523  if(!count($items = $this->psc_obj->getEntries(PAY_METHOD_BMF)))
1524  {
1525  return 0;
1526  }
1527 
1528  $counter = 0;
1529  foreach($items as $item)
1530  {
1531  $tmp_pobject =& new ilPaymentObject($this->user_obj,$item['pobject_id']);
1532 
1533  $tmp_obj =& ilObjectFactory::getInstanceByRefId($tmp_pobject->getRefId());
1534 
1535  $f_result[$counter]["buchungstext"] = $tmp_obj->getTitle();
1536 
1537  $price_arr = ilPaymentPrices::_getPrice($item['price_id']);
1538 
1539  $price = (int) $price_arr['unit_value'];
1540 
1541  if ($price_arr['sub_unit_value'] != "" &&
1542  $price_arr['sub_unit_value'] > 0)
1543  {
1544  $price .= '.'.( (int) $price_arr['sub_unit_value']);
1545  }
1546  $f_result[$counter]["betrag"] = $price * 1.0;
1547 
1548  unset($tmp_obj);
1549  unset($tmp_pobject);
1550 
1551  ++$counter;
1552  }
1553  return $f_result;
1554  }
1555 
1556  function __getTotalAmount()
1557  {
1558  $amount = 0;
1559 
1560  if (is_array($result = $this->__getShoppingCart()))
1561  {
1562  for ($i = 0; $i < count($result); $i++)
1563  {
1564  $amount += $result[$i]["betrag"];
1565  }
1566  }
1567 
1568  return $amount;
1569  }*/
1570 
1572  {
1573  include_once './payment/classes/class.ilGeneralSettings.php';
1574 
1575  $genSet = new ilGeneralSettings();
1576  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
1577 
1578  if(!count($items = $this->psc_obj->getEntries(PAY_METHOD_BMF)))
1579  {
1580  ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
1581  }
1582 
1583  $counter = 0;
1584  foreach($items as $item)
1585  {
1586 
1587  $tmp_pobject =& new ilPaymentObject($this->user_obj,$item['pobject_id']);
1588 
1589  $tmp_obj =& ilObjectFactory::getInstanceByRefId($tmp_pobject->getRefId());
1590 
1591  $price_arr = ilPaymentPrices::_getPrice($item['price_id']);
1592 
1593  $assigned_coupons = '';
1594  if (!empty($_SESSION["coupons"]["bmf"]))
1595  {
1596  foreach ($_SESSION["coupons"]["bmf"] as $key => $coupon)
1597  {
1598  $this->coupon_obj->setId($coupon["pc_pk"]);
1599  $this->coupon_obj->setCurrentCoupon($coupon);
1600 
1601  if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
1602  {
1603  $assigned_coupons .= '<br />' . $this->lng->txt('paya_coupons_coupon') . ': ' . $coupon["pcc_code"];
1604  }
1605  }
1606  }
1607 
1608  $f_result[$counter][] = $tmp_obj->getTitle();
1609  if ($assigned_coupons != '') $f_result[$counter][count($f_result[$counter]) - 1] .= $assigned_coupons;
1610 
1611 // $f_result[$counter][] = $price_arr['duration'] . " " . $this->lng->txt("paya_months");
1612  if($price_arr['duration'] == 0)
1613  {
1614  $f_result[$counter][] = $this->lng->txt('unlimited_duration');
1615  }
1616  else
1617  {
1618  $f_result[$counter][] = $price_arr['duration'] . ' ' . $this->lng->txt('paya_months');
1619  }
1620 
1621  $oVAT = new ilShopVats((int)$tmp_pobject->getVatId());
1622  $f_result[$counter][] = ilShopUtils::_formatVAT($oVAT->getRate());
1623 
1624  $float_price = $price_arr['price'];
1625 
1626  $f_result[$counter][] = $tmp_pobject->getVat($float_price, 'GUI').' '.$genSet->get('currency_unit');
1627  $this->totalVat = $this->totalVat + $tmp_pobject->getVat($float_price);
1628 
1629  $f_result[$counter][] = ilPaymentPrices::_getPriceString($item['price_id']);
1630 
1631  unset($tmp_obj);
1632  unset($tmp_pobject);
1633 
1634  ++$counter;
1635  }
1636 
1637  return $this->__showItemsTable($f_result);
1638  }
1639 
1640  function &__initTableGUI()
1641  {
1642  include_once "./Services/Table/classes/class.ilTableGUI.php";
1643 
1644  return new ilTableGUI(0,false);
1645  }
1646 
1647  function __showItemsTable($a_result_set)
1648  {
1649 
1650  include_once './payment/classes/class.ilGeneralSettings.php';
1651 
1652  $genSet = new ilGeneralSettings();
1653 
1654  $tbl =& $this->__initTableGUI();
1655  $tpl =& $tbl->getTemplateObject();
1656 
1657  // SET FORMAACTION
1658  $tpl->setCurrentBlock("tbl_form_header");
1659 
1660  $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
1661  $tpl->parseCurrentBlock();
1662 
1663  $tbl->setTitle($this->lng->txt("paya_shopping_cart"),"icon_pays_b.gif",$this->lng->txt("paya_shopping_cart"));
1664  $tbl->setHeaderNames(array($this->lng->txt("title"),
1665  $this->lng->txt("duration"),
1666  $this->lng->txt('vat_rate'),
1667  $this->lng->txt('vat_unit'),
1668  $this->lng->txt("price_a")));
1669 
1670  $tbl->setHeaderVars(array("title",
1671  "duration",
1672  "vat_rate",
1673  "vat_unit",
1674  "price"),
1675  array("cmd" => "",
1676  "cmdClass" => "ilpurchasebmfgui",
1677  "cmdNode" => $_GET["cmdNode"]));
1678 
1679  $tbl->disable("footer");
1680  $tbl->disable("sort");
1681  $tbl->disable("linkbar");
1682 
1683  $offset = $_GET["offset"];
1684  $order = $_GET["sort_by"];
1685  $direction = $_GET["sort_order"] ? $_GET['sort_order'] : 'desc';
1686 
1687  $tbl->setOrderColumn($order,'title');
1688  $tbl->setOrderDirection($direction);
1689  $tbl->setOffset($offset);
1690  $tbl->setLimit($_GET["limit"]);
1691  $tbl->setMaxCount(count($a_result_set));
1692 # $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
1693  $tbl->setData($a_result_set);
1694 
1695  $sc_obj =& new ilPaymentShoppingCart($this->user_obj);
1696 
1697  $totalAmount = $sc_obj->getTotalAmount();
1698 
1699  $tpl->setCurrentBlock("tbl_footer_linkbar");
1700  $amount .= "<table class=\"\" style=\"float: right;\">\n";
1701  if (!empty($_SESSION["coupons"]["bmf"]))
1702  {
1703  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
1704 
1705  if (count($items = $this->psc_obj->getEntries(PAY_METHOD_BMF)))
1706  {
1707  $amount .= "<tr>\n";
1708  $amount .= "<td>\n";
1709  $amount .= "<b>" . $this->lng->txt("pay_bmf_subtotal_amount") . ":";
1710  $amount .= "</td>\n";
1711  $amount .= "<td>\n";
1712  $amount .= number_format($totalAmount[PAY_METHOD_BMF], 2, ',', '.') . " " . $genSet->get("currency_unit") . "</b>";
1713  $amount .= "</td>\n";
1714  $amount .= "</tr>\n";
1715 
1716  foreach ($_SESSION["coupons"]["bmf"] as $coupon)
1717  {
1718  $this->coupon_obj->setCurrentCoupon($coupon);
1719  $this->coupon_obj->setId($coupon["pc_pk"]);
1720 
1721  $total_object_price = 0.0;
1722  $current_coupon_bonus = 0.0;
1723 
1724  foreach ($items as $item)
1725  {
1726  $tmp_pobject =& new ilPaymentObject($this->user_obj, $item['pobject_id']);
1727 
1728  if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
1729  {
1730  $price_data = ilPaymentPrices::_getPrice($item['price_id']);
1731  $price = (float) $price_data["price"];
1732 
1733  $total_object_price += $price;
1734  }
1735 
1736  unset($tmp_pobject);
1737  }
1738 
1739  $current_coupon_bonus = $this->coupon_obj->getCouponBonus($total_object_price);
1740  $totalAmount[PAY_METHOD_BMF] += $current_coupon_bonus * (-1);
1741 
1742  $amount .= "<tr>\n";
1743  $amount .= "<td>\n";
1744  $amount .= $this->lng->txt("paya_coupons_coupon") . " " . $coupon["pcc_code"] . ":";
1745  $amount .= "</td>\n";
1746  $amount .= "<td>\n";
1747  $amount .= number_format($current_coupon_bonus * (-1), 2, ',', '.') . " " . $genSet->get("currency_unit");
1748  $amount .= "</td>\n";
1749  $amount .= "</tr>\n";
1750  }
1751 
1752 
1753  if ($totalAmount[PAY_METHOD_BMF] < 0)
1754  {
1755  $totalAmount[PAY_METHOD_BMF] = 0;
1756  $this->totalVat = 0;
1757  }
1758  }
1759  }
1760 
1761  $amount .= "<tr>\n";
1762  $amount .= "<td>\n";
1763  $amount .= "<b>" . $this->lng->txt("pay_bmf_total_amount") . ":";
1764  $amount .= "</td>\n";
1765  $amount .= "<td>\n";
1766  $amount .= number_format($totalAmount[PAY_METHOD_BMF], 2, ',', '.') . " " . $genSet->get("currency_unit");
1767  $amount .= "</td>\n";
1768  $amount .= "</tr>\n";
1769 
1770  if ($this->totalVat > 0)
1771  {
1772  $amount .= "<tr>\n";
1773  $amount .= "<td>\n";
1774  $amount .= $this->lng->txt('pay_bmf_vat_included') . ":";
1775  $amount .= "</td>\n";
1776  $amount .= "<td>\n";
1777  $amount .= ilShopUtils::_formatFloat($this->totalVat) . " " . $genSet->get('currency_unit');
1778  $amount .= "</td>\n";
1779  $amount .= "</tr>\n";
1780  }
1781 
1782  $amount .= "</table>\n";
1783 
1784  $tpl->setVariable("LINKBAR", $amount);
1785  $tpl->parseCurrentBlock("tbl_footer_linkbar");
1786  $tpl->setCurrentBlock('tbl_footer');
1787  $tpl->setVariable('COLUMN_COUNT',5);
1788  $tpl->parseCurrentBlock();
1789  $tbl->render();
1790 
1791  $this->tpl->setVariable("ITEMS_TABLE",$tbl->tpl->get());
1792 
1793  return true;
1794  }
1795 
1796 }
1797 
1799 {
1800 
1801  var $_soapClient = NULL;
1802 
1804  {
1805  $bmfSetObj = ilBMFSettings::getInstance();
1806  $bmfConfig = $bmfSetObj->getAll();
1807 
1808  $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"])));
1809  }
1810 
1811  function anlegenKunde ($customer)
1812  {
1813  $bmfSetObj = ilBMFSettings::getInstance();
1814  $bmfConfig = $bmfSetObj->getAll();
1815 
1816  $tmp = array(
1817  'mandantNr' => $bmfConfig["mandantNr"],
1818  'kunde' => $customer
1819  );
1820 
1821  $result = $this->_soapClient->call("anlegenKunde", $tmp, "KundenstammdatenPflegeWS");
1822  return $result;
1823  }
1824 
1825 };
1826 
1828 {
1829  var $_soapClient = NULL;
1830 
1832  {
1833  $bmfSetObj = ilBMFSettings::getInstance();
1834  $bmfConfig = $bmfSetObj->getAll();
1835 
1836  $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"])));
1837  }
1838 
1839  function validierenKreditkarte($creditCard)
1840  {
1841  $bmfSetObj = ilBMFSettings::getInstance();
1842  $bmfConfig = $bmfSetObj->getAll();
1843 
1844  $tmp = array(
1845  'mandantNr' => $bmfConfig["mandantNr"],
1846  'kreditkarte' => $creditCard,
1847  'waehrungskennzeichen' => $bmfConfig["waehrungskennzeichen"]
1848  );
1849 
1850  $result = $this->_soapClient->call("validierenKreditkarte", $tmp, "KreditkartenzahlungWS");
1851  return $result;
1852  }
1853 
1854  function zahlenUndAnlegenKunde($customer, $creditCard, $bookingList)
1855  {
1856  $bmfSetObj = ilBMFSettings::getInstance();
1857  $bmfConfig = $bmfSetObj->getAll();
1858 
1859  $lieferadresse = new LieferAdresse();
1860 
1861  $tmp = array(
1862  'mandantNr' => $bmfConfig["mandantNr"],
1863  'Kunde' => $customer,
1864  'Kreditkarte' => $creditCard,
1865  'buchungsListe' => $bookingList,
1866  'lieferadresse' => $lieferadresse
1867  );
1868 
1869  $result = $this->_soapClient->call("zahlenUndAnlegenKunde", $tmp, "KreditkartenzahlungWS");
1870  return $result;
1871  }
1872 }
1873 
1875 {
1876 
1877  var $_soapClient = NULL;
1878 
1879  function LastschriftWS ()
1880  {
1881  $bmfSetObj = ilBMFSettings::getInstance();
1882  $bmfConfig = $bmfSetObj->getAll();
1883 
1884  $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"])));
1885  }
1886 
1887  function abbuchenOhneEinzugsermaechtigung($eShopCustomerNumber, $address, $bank, $bookingList)
1888  {
1889  $bmfSetObj = ilBMFSettings::getInstance();
1890  $bmfConfig = $bmfSetObj->getAll();
1891 
1892  $tmp = array(
1893  'mandantNr' => $bmfConfig["mandantNr"],
1894  'eShopKundenNr' => $eShopCustomerNumber,
1895  'lieferAdresse' => $address,
1896  'bankverbindung' => $bank,
1897  'buchungsListe' => $bookingList
1898  );
1899 
1900  $result = $this->_soapClient->call("abbuchenOhneEinzugsermaechtigung", $tmp, "LastschriftWS");
1901  return $result;
1902  }
1903 
1904 };
1905 
1906 class Kunde
1907 {
1908  var $OBJTypeNS = array ('namespace' => 'http://www.bff.bund.de/ePayment' , 'type' => 'Kunde');
1909 
1910  function Kunde ($customerNumber = "", $values = "")
1911  {
1912 /* if ($customerNumber != "")
1913  {
1914  $this->EShopKundenNr = $customerNumber;
1915  }
1916  else
1917  {*/
1918  $this->EShopKundenNr = time() . "_" . substr(md5(uniqid(rand(), true)), 0, 4);
1919  if ($customerNumber != "")
1920  {
1921  $this->EShopKundenNr = $customerNumber . "_" . time() . "_" . substr(md5(uniqid(rand(), true)), 0, 4);
1922  }
1923 /* }*/
1924 
1925  if ($values == "")
1926  {
1927  $values = $_SESSION["bmf"]["personal_data"];
1928  }
1929 
1930  if ($values["language"] != NULL)
1931  {
1932  $this->sprache = $values["language"];
1933  }
1934  if ($values["firstname"] != NULL)
1935  {
1936  $this->vorname = utf8_decode($values["firstname"]);
1937  }
1938  if ($values["lastname"] != NULL)
1939  {
1940  $this->nachname = utf8_decode($values["lastname"]);
1941  }
1942  if ($values["email"] != NULL)
1943  {
1944  $this->EMailAdresse = utf8_decode($values["email"]);
1945  }
1946 
1947  $address = new Adresse();
1948 
1949  $this->rechnungsAdresse = $address;
1950  }
1951 
1953  {
1954  return $this->EShopKundenNr;
1955  }
1956 
1957 }
1958 
1959 class Adresse
1960 {
1961  var $OBJTypeNS = array ('namespace' => 'http://www.bff.bund.de/ePayment' , 'type' => 'Adresse');
1962 
1963  function Adresse ($values = "")
1964  {
1965  if ($values == "")
1966  {
1967  $values = $_SESSION["bmf"]["personal_data"];
1968  }
1969 
1970  if (is_array($values))
1971  {
1972  if ($values["street"] != NULL)
1973  {
1974  $this->strasse = utf8_decode($values["street"]);
1975  }
1976  if ($values["house_number"] != NULL)
1977  {
1978  $this->hausNr = utf8_decode($values["house_number"]);
1979  }
1980  if ($values["po_box"] != NULL)
1981  {
1982  $this->postfach = utf8_decode($values["po_box"]);
1983  }
1984  if ($values["country"] != NULL)
1985  {
1986  $this->land = utf8_decode($values["country"]);
1987  }
1988  if ($values["zipcode"] != NULL)
1989  {
1990  $this->PLZ = utf8_decode($values["zipcode"]);
1991  }
1992  if ($values["city"] != NULL)
1993  {
1994  $this->ort = utf8_decode($values["city"]);
1995  }
1996  }
1997  }
1998 
1999 }
2000 
2002 {
2003  var $OBJTypeNS = array ('namespace' => 'http://www.bff.bund.de/ePayment' , 'type' => 'Kreditkarte');
2004 
2005  function Kreditkarte ($values = "")
2006  {
2007  if ($values == "")
2008  {
2009  $values = $_SESSION["bmf"]["credit_card"];
2010  }
2011 
2012  if (is_array($values))
2013  {
2014  if ($values["karteninhaber"] != NULL)
2015  {
2016  $this->karteninhaber = utf8_decode($values["karteninhaber"]);
2017  }
2018  if ($values["kartenpruefnummer"] != NULL)
2019  {
2020  $this->kartenpruefnummer = utf8_decode($values["kartenpruefnummer"]);
2021  }
2022  if (is_array ($values["kreditkartenNr"]) &&
2023  count($values["kreditkartenNr"]) == 4)
2024  {
2025  for ($i = 1; $i <= count($values["kreditkartenNr"]); $i++)
2026  {
2027  $this->kreditkartenNr .= utf8_decode($values["kreditkartenNr"]["block_".$i]);# . "-";
2028  }
2029 # $this->kreditkartenNr = substr($this->kreditkartenNr, 0, strlen($this->kreditkartenNr)-1);
2030  }
2031  if (is_array($values["gueltigkeit"]) &&
2032  $values["gueltigkeit"]["monat"] != "" &&
2033  $values["gueltigkeit"]["jahr"] != "")
2034  {
2035  $this->gueltigkeit = utf8_decode($values["gueltigkeit"]["monat"]);
2036  $this->gueltigkeit .= utf8_decode($values["gueltigkeit"]["jahr"]);
2037  }
2038  }
2039  }
2040 
2041 }
2042 
2044 {
2045  var $OBJTypeNS = array ('namespace' => 'http://www.bff.bund.de/ePayment' , 'type' => 'Lastschrift');
2046 
2047  function Lastschrift ($customerNumber = "", $values = "")
2048  {
2049  $this->EShopKundenNr = time() . "_" . substr(md5(uniqid(rand(), true)), 0, 4);
2050  if ($customerNumber != "")
2051  {
2052  $this->EShopKundenNr = $customerNumber . "_" . time() . "_" . substr(md5(uniqid(rand(), true)), 0, 4);
2053  }
2054  }
2055 
2056 }
2057 
2059 {
2060  var $OBJTypeNS = array ('namespace' => 'http://www.bff.bund.de/ePayment' , 'type' => 'Bankverbindung');
2061 
2062  function Bankverbindung ($values = "")
2063  {
2064  if ($values == "")
2065  {
2066  $values = $_SESSION["bmf"]["debit_entry"];
2067  }
2068 
2069  if (is_array($values))
2070  {
2071  if ($values["kontoinhaber"] != NULL)
2072  {
2073  $this->kontoinhaber = utf8_decode($values["kontoinhaber"]);
2074  }
2075  if ($values["kontoNr"] != NULL)
2076  {
2077  $this->kontoNr = utf8_decode($values["kontoNr"]);
2078  }
2079  if ($values["BLZ"] != NULL)
2080  {
2081  $this->BLZ = utf8_decode($values["BLZ"]);
2082  }
2083  }
2084  }
2085 
2086 }
2087 
2088 class Buchung
2089 {
2090  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');
2091 
2092  function Buchung($values = "")
2093  {
2094  $bmfSetObj = ilBMFSettings::getInstance();
2095  $bmfConfig = $bmfSetObj->getAll();
2096 
2097  if ($bmfConfig["haushaltsstelle"] != NULL)
2098  {
2099  $this->haushaltsstelle = $bmfConfig["haushaltsstelle"];
2100  }
2101  if ($bmfConfig["objektNr"] != NULL)
2102  {
2103  $this->objektnummer = $bmfConfig["objektNr"];
2104  }
2105 
2106  if (is_array($values))
2107  {
2108  if ($values["buchungstext"] != NULL)
2109  {
2110  $buchungstext = utf8_decode($values["buchungstext"]);
2111  if(strlen($buchungstext) > 16)
2112  {
2113  $buchungstext = substr($buchungstext,0,15).'...';
2114  }
2115 
2116  $this->buchungstext = $buchungstext;
2117  }
2118  if ($values["betrag"] != "")
2119  {
2120  $this->betrag = $values["betrag"];
2121  }
2122  }
2123  }
2124 
2125  /* Die BelegNr wird vom BMF zur�ck geliefert */
2126  function setVoucherNumber($voucherNumber)
2127  {
2128  if ($voucherNumber != NULL)
2129  {
2130  $this->belegNr = $voucherNumber;
2131  }
2132  }
2133 
2134  function getVoucherNumber()
2135  {
2136  return $this->belegNr;
2137  }
2138 }
2139 
2141 {
2142  var $OBJTypeNS = array ('namespace' => 'http://www.bff.bund.de/ePayment', 'nsPrefix' => 'ns2', 'type' => 'BuchungsListe');
2143 
2144  function BuchungsListe($userId, $values = "")
2145  {
2146  global $ilias;
2147 
2148  $bmfSetObj = ilBMFSettings::getInstance();
2149  $bmfConfig = $bmfSetObj->getAll();
2150 
2151  if ($bmfConfig["bewirtschafterNr"] != NULL)
2152  {
2153  $this->bewirtschafterNr = $bmfConfig["bewirtschafterNr"];
2154  }
2155  if ($bmfConfig["waehrungskennzeichen"] != NULL)
2156  {
2157  $this->waehrungskennzeichen = $bmfConfig["waehrungskennzeichen"];
2158  }
2159  $this->faelligkeitsdatum = date("Y-m-d") . "T" . date("H:i:s") . "Z";
2160  if ($bmfConfig["kennzeichenMahnverfahren"] != NULL)
2161  {
2162  $this->kennzeichenMahnverfahren = $bmfConfig["kennzeichenMahnverfahren"];
2163  }
2164 
2165  $inst_id_time = $ilias->getSetting('inst_id').'_'.$userId.'_'.substr((string) time(),-3);
2166  $this->EShopTransaktionsNr = $inst_id_time.substr(md5(uniqid(rand(), true)), 0, 4);
2167 
2168  if (is_array($values))
2169  {
2170  if ($values["betrag"] != NULL)
2171  {
2172  $this->betrag = $values["betrag"];
2173  }
2174  if ($values["buchungen"] != NULL)
2175  {
2176  $this->buchungen = $values["buchungen"];
2177  }
2178  }
2179  }
2180  function getTransaction()
2181  {
2182  return $this->EShopTransaktionsNr;
2183  }
2184 
2185  /* Das Kassenzeichen wird vom BMF zur�ck geliefert */
2186  function setKassenzeichen($kassenzeichen)
2187  {
2188  if ($kassenzeichen != NULL)
2189  {
2190  $this->kassenzeichen = $kassenzeichen;
2191  }
2192  }
2193 
2194  function getKassenzeichen()
2195  {
2196  return $this->kassenzeichen;
2197  }
2198 
2199 }
2200 
2202 {
2203  var $OBJTypeNS = array ('namespace' => 'http://www.bff.bund.de/ePayment' , 'type' => 'LieferAdresse');
2204 
2205  function LieferAdresse ($values = "")
2206  {
2207  if ($values == "")
2208  {
2209  $values = $_SESSION["bmf"]["personal_data"];
2210  }
2211 
2212  if (is_array($values))
2213  {
2214  if ($values["firstname"] != NULL)
2215  {
2216  $this->vorname = utf8_decode($values["firstname"]);
2217  }
2218  if ($values["lastname"] != NULL)
2219  {
2220  $this->nachname = utf8_decode($values["lastname"]);
2221  }
2222  if ($values["street"] != NULL)
2223  {
2224  $this->strasse = utf8_decode($values["street"]);
2225  }
2226  if ($values["house_number"] != NULL)
2227  {
2228  $this->hausNr = utf8_decode($values["house_number"]);
2229  }
2230  if ($values["po_box"] != NULL)
2231  {
2232  $this->postfach = utf8_decode($values["po_box"]);
2233  }
2234  if ($values["country"] != NULL)
2235  {
2236  $this->land = utf8_decode($values["country"]);
2237  }
2238  if ($values["zipcode"] != NULL)
2239  {
2240  $this->PLZ = utf8_decode($values["zipcode"]);
2241  }
2242  if ($values["city"] != NULL)
2243  {
2244  $this->ort = utf8_decode($values["city"]);
2245  }
2246  }
2247  }
2248 }
2249 
2250 ?>