13 include_once
'./Services/Payment/classes/class.ilPaymentShoppingCart.php';
14 include_once
'./Services/Payment/classes/class.ilShopShoppingCartGUI.php';
15 include_once
'./Services/Payment/classes/class.ilPaymentCoupons.php';
16 include_once
'./Services/Payment/classes/class.ilShopVatsList.php';
17 include_once
'./Services/Payment/classes/class.ilPayMethods.php';
39 $this->ilias = $ilias;
46 $this->session_var = $this->pmethod_obj->getPmTitle();
54 if (!is_array(
$_SESSION[$this->session_var][
'personal_data']))
58 if (strpos(
'_' . $this->user_obj->getStreet(),
' ') > 0)
60 $houseNo = substr($this->user_obj->getStreet(), strrpos($this->user_obj->getStreet(),
' ')+1);
61 $street = substr($this->user_obj->getStreet(), 0, strlen($this->user_obj->getStreet())-(strlen($houseNo)+1));
75 $_SESSION[
$this->session_var][
'personal_data'][
'language'] = $this->user_obj->getLanguage();
78 if (!is_array(
$_SESSION[
'coupons'][$this->session_var]))
85 $this->lng->loadLanguageModule(
'payment');
87 $ilTabs->clearTargets();
88 $ilTabs->clearSubTabs();
100 if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
102 $this->tpl->setVariable(
'HEADER',$this->lng->txt(
'pay_bmf_your_order'));
103 $this->tpl->touchBlock(
'stop_floating');
108 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
111 $oForm->setFormAction($this->ctrl->getFormAction($this,
'getPersonalData'));
112 $oForm->setTitle($this->lng->txt(
'pay_bmf_personal_data'));
115 $oFirstname->
setValue($this->user_obj->getFirstname());
116 $oForm->addItem($oFirstname);
119 $oLastname->
setValue($this->user_obj->getLastname());
120 $oForm->addItem($oLastname);
122 $oStreet =
new ilTextInputGUI($this->lng->txt(
'street'),
'street');
126 $oForm->addItem($oStreet);
128 $oHouseNumber =
new ilTextInputGUI($this->lng->txt(
'pay_bmf_house_number'),
'house_number');
129 $oHouseNumber->
setValue($this->error !=
'' && isset(
$_POST[
'house_number'])
132 $oForm->addItem($oHouseNumber);
134 $oPoBox =
new ilTextInputGUI($this->lng->txt(
'pay_bmf_or').
' '.$this->lng->txt(
'pay_bmf_po_box'),
'po_box');
138 $oForm->addItem($oPoBox);
140 $oZipCode =
new ilTextInputGUI($this->lng->txt(
'zipcode'),
'zipcode');
141 $oZipCode->
setValue($this->error !=
'' && isset(
$_POST[
'zipcode'])
144 $oForm->addItem($oZipCode);
150 $oForm->addItem($oCity);
154 $oCountry->setValue($this->error !=
'' && isset(
$_POST[
'country']) ?
$_POST[
'country']
155 :
$_SESSION[$this->session_var][
'personal_data'][
'country']);
156 $oForm->addItem($oCountry);
159 $oEmail->
setValue($this->user_obj->getEmail());
160 $oForm->addItem($oEmail);
162 $oForm->addcommandButton(
'getPersonalData',ucfirst($this->lng->txt(
'next')));
164 $this->tpl->setVariable(
'FORM', $oForm->getHTML());
171 if (
$_SESSION[$this->session_var][
'personal_data'][
'firstname'] ==
'' ||
172 $_SESSION[$this->session_var][
'personal_data'][
'lastname'] ==
'' ||
173 $_POST[
'zipcode'] ==
'' ||
175 $_POST[
'country'] ==
'' ||
176 $_SESSION[$this->session_var][
'personal_data'][
'email'] ==
'')
179 $this->error = $this->lng->txt(
'pay_bmf_personal_data_not_valid');
185 if ((
$_POST[
'street'] ==
'' &&
$_POST[
'house_number'] ==
'' &&
$_POST[
'po_box'] ==
'') ||
186 ((
$_POST[
'street'] !=
'' ||
$_POST[
'house_number'] !=
'') &&
$_POST[
'po_box'] !=
'') ||
187 (
$_POST[
'street'] !=
'' &&
$_POST[
'house_number'] ==
'') ||
188 (
$_POST[
'street'] ==
'' &&
$_POST[
'house_number'] !=
''))
190 $this->error = $this->lng->txt(
'pay_bmf_street_or_pobox');
217 if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
219 $this->tpl->setVariable(
'HEADER',$this->lng->txt(
'pay_bmf_your_order'));
220 $this->tpl->touchBlock(
'stop_floating');
225 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.pay_bill_confirm.html',
'Services/Payment');
229 $this->tpl->setVariable(
'BILL_CONFIRM_FORMACTION',$this->ctrl->getFormAction($this));
233 $this->tpl->setVariable(
'ALT_IMG',$this->lng->txt(
'obj_usr'));
234 $this->tpl->touchBlock(
'stop_floating');
235 $this->tpl->setVariable(
'TXT_CLOSE_WINDOW',$this->lng->txt(
'close_window'));
238 $this->tpl->setVariable(
'TXT_TERMS_CONDITIONS',$this->lng->txt(
'pay_bmf_terms_conditions'));
239 $this->tpl->setVariable(
'TXT_TERMS_CONDITIONS_READ',$this->lng->txt(
'pay_bmf_terms_conditions_read'));
240 $this->tpl->setVariable(
'TXT_TERMS_CONDITIONS_SHOW',$this->lng->txt(
'pay_bmf_terms_conditions_show'));
241 $this->tpl->setVariable(
'LINK_TERMS_CONDITIONS',
'./payment.php?view=conditions');
242 $this->tpl->setVariable(
'TXT_PASSWORD',$this->lng->txt(
'password'));
243 $this->tpl->setVariable(
'TXT_CONFIRM_ORDER',$this->lng->txt(
'pay_confirm_order'));
245 $this->tpl->setVariable(
'INPUT_VALUE',$this->lng->txt(
'pay_send_order'));
246 $this->tpl->setVariable(
'CANCEL',$this->lng->txt(
'cancel'));
247 if ($this->error !=
'' &&
248 isset(
$_POST[
'terms_conditions']))
250 $this->tpl->setVariable(
'TERMS_CONDITIONS_' . strtoupper(
$_POST[
'terms_conditions']),
' checked') ;
252 if ($this->error !=
'' &&
253 isset(
$_POST[
'password']))
259 $this->tpl->addBlockfile(
'BUTTONS',
'buttons',
'tpl.buttons.html');
260 $this->tpl->setCurrentBlock(
'btn_cell');
261 $this->tpl->setVariable(
'BTN_LINK', $this->ctrl->getLinkTarget($this,
'showPersonalData'));
262 $this->tpl->setVariable(
'BTN_TXT', $this->lng->txt(
'pay_bmf_back'));
263 $this->tpl->parseCurrentBlock(
'btn_cell');
274 $cmd = $this->ctrl->getCmd();
276 switch ($this->ctrl->getNextClass($this))
279 if(!
$cmd = $this->ctrl->getCmd())
281 $cmd =
'showPersonalData';
295 $sc = $this->psc_obj->getShoppingCart($this->pm_id);
297 $this->psc_obj->clearCouponItemsSession();
299 if (is_array($sc) && count($sc) > 0)
301 include_once
'./Services/Payment/classes/class.ilPaymentBookings.php';
304 for ($i = 0; $i < count($sc); $i++)
306 if (!empty(
$_SESSION[
'coupons'][$this->session_var]))
308 $sc[$i][
'math_price'] = (float) $sc[$i][
'price'];
310 $tmp_pobject =
new ilPaymentObject($this->user_obj, $sc[$i][
'pobject_id']);
312 foreach (
$_SESSION[
'coupons'][$this->session_var] as $key => $coupon)
314 $this->coupon_obj->setId($coupon[
'pc_pk']);
315 $this->coupon_obj->setCurrentCoupon($coupon);
317 if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
328 $coupon_discount_items = $this->psc_obj->calcDiscountPrices(
$_SESSION[
'coupons'][$this->session_var]);
330 $inst_id_time = $this->ilias->getSetting(
'inst_id').
'_'.$this->user_obj->getId().
'_'.substr((
string) time(),-3);
331 $transaction = $inst_id_time.substr(md5(uniqid(rand(),
true)), 0, 4);
333 for ($i = 0; $i < count($sc); $i++)
338 $price = $sc[$i][
'price'];
341 if (array_key_exists($sc[$i][
'pobject_id'], $coupon_discount_items))
343 $bonus = $coupon_discount_items[$sc[$i][
'pobject_id']][
'math_price'] - $coupon_discount_items[$sc[$i][
'pobject_id']][
'discount_price'];
346 $book_obj->setTransaction($transaction);
347 $book_obj->setPobjectId($sc[$i][
'pobject_id']);
348 $book_obj->setCustomerId($this->user_obj->getId());
349 $book_obj->setVendorId($pobjectData[
'vendor_id']);
350 $book_obj->setPayMethod($pobjectData[
'pay_method']);
351 $book_obj->setOrderDate(time());
352 $book_obj->setDuration($sc[$i][
'duration']);
353 $book_obj->setUnlimitedDuration($sc[i][
'unlimited_duration']);
354 $book_obj->setPrice($sc[$i][
'price_string']);
356 $book_obj->setDiscount($bonus > 0 ? (round($bonus, 2)* (-1)) : 0);
357 $book_obj->setPayed(1);
358 $book_obj->setAccess(1);
360 $book_obj->setVoucher(
'');
361 $book_obj->setTransactionExtern(
'');
363 $book_obj->setVatRate($sc[$i][
'vat_rate']);
364 $book_obj->setVatUnit($sc[$i][
'vat_unit']);
365 $book_obj->setObjectTitle(strip_tags($sc[$i][
'object_title']));
369 $book_obj->setVoucher($external_data[
'voucher']);
370 $book_obj->setTransactionExtern($external_data[
'transaction_extern']);
371 $book_obj->setStreet($external_data[
'street'],
'');
372 $book_obj->setZipcode($external_data[
'zipcode']);
373 $book_obj->setCity($external_data[
'city']);
374 $book_obj->setCountry($external_data[
'country']);
377 if(isset(
$_SESSION[$this->session_var][
'personal_data']))
379 $book_obj->setStreet(
$_SESSION[$this->session_var][
'personal_data'][
'street'],
$_SESSION[$this->session_var][
'personal_data'][
'house_number']);
380 $book_obj->setPoBox(
$_SESSION[$this->session_var][
'personal_data'][
'po_box']);
381 $book_obj->setZipcode(
$_SESSION[$this->session_var][
'personal_data'][
'zipcode']);
382 $book_obj->setCity(
$_SESSION[$this->session_var][
'personal_data'][
'city']);
383 $book_obj->setCountry(
$_SESSION[$this->session_var][
'personal_data'][
'country']);
387 $book_obj->setStreet($this->user_obj->getStreet(),
'');
388 $book_obj->setPoBox($this->user_obj->getPoBox());
389 $book_obj->setZipcode($this->user_obj->getZipCode());
390 $book_obj->setCity($this->user_obj->getCity());
391 $book_obj->setCountry($this->user_obj->getCountry());
394 $booking_id = $book_obj->add();
396 if (!empty(
$_SESSION[
'coupons'][$this->session_var]) && $booking_id)
398 foreach (
$_SESSION[
'coupons'][$this->session_var] as $coupon)
400 $this->coupon_obj->setId($coupon[
'pc_pk']);
401 $this->coupon_obj->setCurrentCoupon($coupon);
403 if ($this->coupon_obj->isObjectAssignedToCoupon($pobject->getRefId()))
405 $this->coupon_obj->addCouponForBookingId($booking_id);
410 $obj_id = $ilObjDataCache->lookupObjId($pobjectData[
'ref_id']);
411 $obj_type = $ilObjDataCache->lookupType($obj_id);
412 $obj_title = $ilObjDataCache->lookupTitle($obj_id);
414 $bookings[
'list'][] = array(
415 'pobject_id' => $sc[$i][
'pobject_id'],
417 'title' =>
'['.$obj_id.
']: ' . $obj_title,
418 'duration' => $sc[$i][
'duration'],
419 'vat_rate' => $sc[$i][
'vat_rate'],
420 'vat_unit' => $sc[$i][
'vat_unit'],
421 'price_string' => $sc[$i][
'price_string'],
422 'price' => $sc[$i][
'price'],
426 $total += $sc[$i][
'price'];
427 $total_vat += $sc[$i][
'vat_unit'];
429 if ($sc[$i][
'psc_id']) $this->psc_obj->delete($sc[$i][
'psc_id']);
432 if (!empty(
$_SESSION[
'coupons'][$this->session_var]))
434 foreach (
$_SESSION[
'coupons'][$this->session_var] as $coupon)
436 $this->coupon_obj->setId($coupon[
'pc_pk']);
437 $this->coupon_obj->setCurrentCoupon($coupon);
438 $this->coupon_obj->addTracking();
443 $bookings[
'total'] =
$total;
444 $bookings[
'total_vat'] = $total_vat;
445 $bookings[
'transaction'] = $transaction;
446 $bookings[
'street'] = $book_obj->getStreet();
447 $bookings[
'zipcode'] = $book_obj->getZipCode();
448 $bookings[
'city'] = $book_obj->getCity();
449 $bookings[
'country'] = $book_obj->getCountry();
450 $bookings[
'transaction_extern'] = $book_obj->getTransactionExtern();
461 include_once
'./classes/class.ilTemplate.php';
462 include_once
'./Services/Utilities/classes/class.ilUtil.php';
463 include_once
'./Services/Payment/classes/class.ilGeneralSettings.php';
464 include_once
'./Services/Payment/classes/class.ilPaymentShoppingCart.php';
465 include_once
'Services/Mail/classes/class.ilMimeMail.php';
469 $currency = $genSet->get(
'currency_unit');
471 $tpl =
new ilTemplate(
'./Services/Payment/templates/default/tpl.pay_bill.html',
true,
true,
true);
473 $tpl->setVariable(
'VENDOR_ADDRESS', nl2br(utf8_decode($genSet->get(
'address'))));
474 $tpl->setVariable(
'VENDOR_ADD_INFO', nl2br(utf8_decode($genSet->get(
'add_info'))));
475 $tpl->setVariable(
'VENDOR_BANK_DATA', nl2br(utf8_decode($genSet->get(
'bank_data'))));
476 $tpl->setVariable(
'TXT_BANK_DATA', utf8_decode($this->lng->txt(
'pay_bank_data')));
479 $tpl->setVariable(
'CUSTOMER_FIRSTNAME', $this->user_obj->getFirstname());
480 $tpl->setVariable(
'CUSTOMER_LASTNAME', $this->user_obj->getLastname());
481 if($bookings[
'po_box']==
'')
483 $tpl->setVariable(
'CUSTOMER_STREET', $bookings[
'street']);
487 $tpl->setVariable(
'CUSTOMER_STREET', $bookings[
'po_box']);
489 $tpl->setVariable(
'CUSTOMER_ZIPCODE', $bookings[
'zipcode']);
490 $tpl->setVariable(
'CUSTOMER_CITY', $bookings[
'city']);
491 $tpl->setVariable(
'CUSTOMER_COUNTRY', $bookings[
'country']);
493 $tpl->setVariable(
'BILL_NO', $bookings[
'transaction']);
494 $tpl->setVariable(
'DATE', date(
'd.m.Y'));
496 $tpl->setVariable(
'TXT_BILL', utf8_decode($this->lng->txt(
'pays_bill')));
497 $tpl->setVariable(
'TXT_BILL_NO', utf8_decode($this->lng->txt(
'pay_bill_no')));
498 $tpl->setVariable(
'TXT_DATE', utf8_decode($this->lng->txt(
'date')));
500 $tpl->setVariable(
'TXT_ARTICLE', utf8_decode($this->lng->txt(
'pay_article')));
501 $tpl->setVariable(
'TXT_VAT_RATE', utf8_decode($this->lng->txt(
'vat_rate')));
502 $tpl->setVariable(
'TXT_VAT_UNIT', utf8_decode($this->lng->txt(
'vat_unit')));
503 $tpl->setVariable(
'TXT_PRICE', utf8_decode($this->lng->txt(
'price_a')));
505 for ($i = 0; $i < count($bookings[
'list']); $i++)
507 $tmp_pobject =
new ilPaymentObject($this->user_obj, $bookings[
'list'][$i][
'pobject_id']);
509 $assigned_coupons =
'';
510 if (!empty(
$_SESSION[
'coupons'][$this->session_var]))
512 foreach (
$_SESSION[
'coupons'][$this->session_var] as $coupon)
514 $this->coupon_obj->setId($coupon[
'pc_pk']);
515 $this->coupon_obj->setCurrentCoupon($coupon);
517 if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
519 $assigned_coupons .=
'<br />' . $this->lng->txt(
'paya_coupons_coupon') .
': ' . $coupon[
'pcc_code'];
524 $tpl->setCurrentBlock(
'loop');
525 $tpl->setVariable(
'LOOP_OBJ_TYPE', utf8_decode($this->lng->txt($bookings[
'list'][$i][
'type'])));
526 $tpl->setVariable(
'LOOP_TITLE',$tmp = utf8_decode($bookings[
'list'][$i][
'title']));
527 $tpl->setVariable(
'LOOP_COUPON', utf8_decode( $assigned_coupons));
528 $tpl->setVariable(
'LOOP_TXT_ENTITLED_RETRIEVE', utf8_decode($this->lng->txt(
'pay_entitled_retrieve')));
530 if( $bookings[
'list'][$i][
'duration'] == 0)
532 $tpl->setVariable(
'LOOP_DURATION', utf8_decode($this->lng->txt(
'unlimited_duration')));
535 $tpl->setVariable(
'LOOP_DURATION', $bookings[
'list'][$i][
'duration'] .
' ' . utf8_decode($this->lng->txt(
'paya_months')));
537 #$currency = $bookings['list'][$i]['currency_unit'];
538 $tpl->setVariable(
'LOOP_VAT_RATE', $bookings[
'list'][$i][
'vat_rate'].
' %');
539 $tpl->setVariable(
'LOOP_VAT_UNIT', $bookings[
'list'][$i][
'vat_unit'].
' '.$currency);
540 $tpl->setVariable(
'LOOP_PRICE', $bookings[
'list'][$i][
'price'].
' '.$currency);
541 $tpl->parseCurrentBlock(
'loop');
546 if (!empty(
$_SESSION[
'coupons'][$this->session_var]))
548 if (count($items = $bookings[
'list']))
550 $sub_total_amount = $bookings[
'total'];
552 foreach (
$_SESSION[
'coupons'][$this->session_var] as $coupon)
554 $this->coupon_obj->setId($coupon[
'pc_pk']);
555 $this->coupon_obj->setCurrentCoupon($coupon);
557 $total_object_price = 0.0;
558 $current_coupon_bonus = 0.0;
560 foreach ($bookings[
'list'] as $item)
562 $tmp_pobject =&
new ilPaymentObject($this->user_obj, $item[
'pobject_id']);
564 if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
566 $total_object_price += $item[
'price'];
571 $current_coupon_bonus = $this->coupon_obj->getCouponBonus($total_object_price);
572 $bonus += $current_coupon_bonus * (-1);
574 $tpl->setCurrentBlock(
'cloop');
575 $tpl->setVariable(
'TXT_COUPON', utf8_decode($this->lng->txt(
'paya_coupons_coupon') .
' ' . $coupon[
'pcc_code']));
576 $tpl->setVariable(
'BONUS', number_format($bonus, 2,
',',
'.') .
' ' .$currency);
578 $tpl->parseCurrentBlock();
581 $tpl->setVariable(
'TXT_SUBTOTAL_AMOUNT', utf8_decode($this->lng->txt(
'pay_bmf_subtotal_amount')));
582 $tpl->setVariable(
'SUBTOTAL_AMOUNT', number_format($sub_total_amount, 2,
',',
'.') .
' ' .$currency);
586 if ($bookings[
'total'] < 0)
588 $bookings[
'total'] = 0.0;
592 $tpl->setVariable(
'TXT_TOTAL_AMOUNT', utf8_decode($this->lng->txt(
'pay_bmf_total_amount')));
593 $tpl->setVariable(
'TOTAL_AMOUNT', number_format($bookings[
'total']-$current_coupon_bonus, 2,
',',
'.') .
' ' . $currency);
594 if ($bookings[
'total_vat'] > 0)
596 $tpl->setVariable(
'TOTAL_VAT', $bookings[
'total_vat'].
' ' .$currency);
597 $tpl->setVariable(
'TXT_TOTAL_VAT', utf8_decode($this->lng->txt(
'pay_bmf_vat_included')));
600 $tpl->setVariable(
'TXT_PAYMENT_TYPE', utf8_decode($this->lng->txt(
'pay_payed_bill')));
602 if (!@file_exists($genSet->get(
'pdf_path')))
608 if (@file_exists($genSet->get(
'pdf_path')))
610 ilUtil::html2pdf($tpl->get(), $genSet->get(
'pdf_path') .
'/' . $bookings[
'transaction'] .
'.pdf');
613 if (@file_exists($genSet->get(
'pdf_path') .
'/' . $bookings[
'transaction'] .
'.pdf') &&
614 $this->user_obj->getEmail() !=
'' &&
615 $this->ilias->getSetting(
'admin_email') !=
'')
618 $m->
From( $this->ilias->getSetting(
'admin_email') );
619 $m->To( $this->user_obj->getEmail() );
620 $m->Subject( $this->lng->txt(
'pay_message_subject') );
621 $message = $this->lng->txt(
'pay_message_hello') .
' ' . $this->user_obj->getFirstname() .
' ' . $this->user_obj->getLastname() .
",\n\n";
622 $message .= $this->lng->txt(
'pay_message_thanks') .
"\n\n";
623 $message .= $this->lng->txt(
'pay_message_attachment') .
"\n\n";
624 $message .= $this->lng->txt(
'pay_message_regards') .
"\n\n";
625 $message .= strip_tags($genSet->get(
'address'));
626 $m->Body( $message );
627 $m->Attach( $genSet->get(
'pdf_path') .
'/' . $bookings[
'transaction'] .
'.pdf',
'application/pdf' ) ;
631 @unlink($genSet->get(
'pdf_path') .
'/' . $bookings[
'transaction'] .
'.html');
632 @unlink($genSet->get(
'pdf_path') .
'/' . $bookings[
'transaction'] .
'.pdf');
634 unset($current_booking_id);
636 unset(
$_SESSION[
'coupons'][$this->session_var]);
641 include_once
'./Services/Payment/classes/class.ilPaymentShoppingCart.php';
645 return $sc_obj->emptyShoppingCart();
656 $this->tpl->addBlockFile(
'CONTENT',
'content',
'tpl.payb_content.html');
664 $this->tpl->addBlockFile(
'STATUSLINE',
'statusline',
'tpl.statusline.html');
665 # $this->__buildLocator();
670 $this->tpl->addBlockFile(
'LOCATOR',
'locator',
'tpl.locator.html');
671 $this->tpl->setVariable(
'TXT_LOCATOR',$this->lng->txt(
'locator'));
673 $this->tpl->setCurrentBlock(
'locator_item');
674 $this->tpl->setVariable(
'ITEM', $this->lng->txt(
'personal_desktop'));
675 $this->tpl->setVariable(
'LINK_ITEM',
'../ilias.php?baseClass=ilPersonalDesktopGUI');
676 $this->tpl->parseCurrentBlock();
678 $this->tpl->setCurrentBlock(
'locator_item');
679 $this->tpl->setVariable(
'PREFIX',
'> ');
680 $this->tpl->setVariable(
'ITEM',
'Payment');
681 $this->tpl->setVariable(
'LINK_ITEM',
'./payment.php');
682 $this->tpl->parseCurrentBlock();
702 $lng->loadLanguageModule(
'meta');
704 $cntcodes = array (
'DE',
'ES',
'FR',
'GB',
'AT',
'CH',
'AF',
'AL',
'DZ',
'AS',
'AD',
'AO',
705 'AI',
'AQ',
'AG',
'AR',
'AM',
'AW',
'AU',
'AT',
'AZ',
'BS',
'BH',
'BD',
'BB',
'BY',
706 'BE',
'BZ',
'BJ',
'BM',
'BT',
'BO',
'BA',
'BW',
'BV',
'BR',
'IO',
'BN',
'BG',
'BF',
707 'BI',
'KH',
'CM',
'CA',
'CV',
'KY',
'CF',
'TD',
'CL',
'CN',
'CX',
'CC',
'CO',
'KM',
708 'CG',
'CK',
'CR',
'CI',
'HR',
'CU',
'CY',
'CZ',
'DK',
'DJ',
'DM',
'DO',
'TP',
'EC',
709 'EG',
'SV',
'GQ',
'ER',
'EE',
'ET',
'FK',
'FO',
'FJ',
'FI',
'FR',
'FX',
'GF',
'PF',
710 'TF',
'GA',
'GM',
'GE',
'DE',
'GH',
'GI',
'GR',
'GL',
'GD',
'GP',
'GU',
'GT',
'GN',
711 'GW',
'GY',
'HT',
'HM',
'HN',
'HU',
'IS',
'IN',
'ID',
'IR',
'IQ',
'IE',
'IL',
'IT',
712 'JM',
'JP',
'JO',
'KZ',
'KE',
'KI',
'KP',
'KR',
'KW',
'KG',
'LA',
'LV',
'LB',
'LS',
713 'LR',
'LY',
'LI',
'LT',
'LU',
'MO',
'MK',
'MG',
'MW',
'MY',
'MV',
'ML',
'MT',
'MH',
714 'MQ',
'MR',
'MU',
'YT',
'MX',
'FM',
'MD',
'MC',
'MN',
'MS',
'MA',
'MZ',
'MM',
'NA',
715 'NR',
'NP',
'NL',
'AN',
'NC',
'NZ',
'NI',
'NE',
'NG',
'NU',
'NF',
'MP',
'NO',
'OM',
716 'PK',
'PW',
'PA',
'PG',
'PY',
'PE',
'PH',
'PN',
'PL',
'PT',
'PR',
'QA',
'RE',
'RO',
717 'RU',
'RW',
'KN',
'LC',
'VC',
'WS',
'SM',
'ST',
'SA',
'CH',
'SN',
'SC',
'SL',
'SG',
718 'SK',
'SI',
'SB',
'SO',
'ZA',
'GS',
'ES',
'LK',
'SH',
'PM',
'SD',
'SR',
'SJ',
'SZ',
719 'SE',
'SY',
'TW',
'TJ',
'TZ',
'TH',
'TG',
'TK',
'TO',
'TT',
'TN',
'TR',
'TM',
'TC',
720 'TV',
'UG',
'UA',
'AE',
'GB',
'UY',
'US',
'UM',
'UZ',
'VU',
'VA',
'VE',
'VN',
'VG',
721 'VI',
'WF',
'EH',
'YE',
'ZR',
'ZM',
'ZW');
723 foreach($cntcodes as $cntcode)
725 $cntrs[$cntcode] = $lng->txt(
'meta_c_'.$cntcode);
734 foreach($countries as $code => $text)
747 return $countries[$value];
754 if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
760 foreach($items as $item)
762 $tmp_pobject =&
new ilPaymentObject($this->user_obj,$item[
'pobject_id']);
767 $f_result[$counter][
"object_title"] = $tmp_obj->getTitle();
771 $f_result[$counter][
"object_title"] = $this->lng->txt(
'object_not_found');
776 $price = (float) $price_arr[
'price'];
777 $f_result[$counter][
'price'] = $price * 1.0;
793 for ($i = 0; $i < count(
$result); $i++)
795 $amount +=
$result[$i][
'price'];
804 if (
$_POST[
'terms_conditions'] != 1)
806 $this->error = $this->lng->txt(
'pay_bmf_check_terms_conditions');
811 if (
$_POST[
'password'] ==
'' ||
812 md5(
$_POST[
'password']) != $this->user_obj->getPasswd())
814 $this->error = $this->lng->txt(
'pay_bmf_password_not_valid');
828 include_once
'./Services/Payment/classes/class.ilGeneralSettings.php';
834 if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
840 foreach($items as $item)
842 $tmp_pobject =
new ilPaymentObject($this->user_obj,$item[
'pobject_id']);
848 $assigned_coupons =
'';
849 if (!empty(
$_SESSION[
'coupons'][$this->session_var]))
851 foreach (
$_SESSION[
'coupons'][$this->session_var] as $key => $coupon)
853 $this->coupon_obj->setId($coupon[
'pc_pk']);
854 $this->coupon_obj->setCurrentCoupon($coupon);
856 if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
858 $assigned_coupons .=
'<br />' . $this->lng->txt(
'paya_coupons_coupon') .
': ' . $coupon[
'pcc_code'];
862 $f_result[$counter][
'item'] =
'';
865 $f_result[$counter][
'title'] = $tmp_obj->getTitle();
869 $f_result[$counter][
'title'] = $this->lng->txt(
'object_not_found');
871 if ($assigned_coupons !=
'') $f_result[$counter][count($f_result[$counter]) - 1] .= $assigned_coupons;
873 if($price_arr[
'duration'] == 0)
875 $f_result[$counter][
'duration'] = $this->lng->txt(
'unlimited_duration');
879 $f_result[$counter][
'duration'] = $price_arr[
'duration'] .
' ' . $this->lng->txt(
'paya_months');
882 $oVAT =
new ilShopVats((
int)$tmp_pobject->getVatId());
885 $float_price = $price_arr[
'price'];
888 $f_result[$counter][
'vat_unit'] = $tmp_pobject->getVat($float_price,
'GUI').
' '.$genSet->get(
'currency_unit');
889 $this->totalVat = $this->totalVat + $tmp_pobject->getVat($float_price);
904 include_once
'./Services/Payment/classes/class.ilGeneralSettings.php';
907 include_once
'./Services/Payment/classes/class.ilShoppingCartTableGUI.php';
910 $tbl->setId(
'tbl_id_'.$this->session_var);
911 $tbl->setTitle($this->lng->txt(
'paya_shopping_cart'));
916 $tbl->setRowTemplate(
"tpl.shop_shoppingcart_row.html",
"Services/Payment");
917 $tbl->addColumn(
'',
'item',
'1%');
918 $tbl->addColumn($this->lng->txt(
'title'),
'title',
'30%');
919 $tbl->addColumn($this->lng->txt(
'duration'),
'duration',
'30%');
920 $tbl->addColumn($this->lng->txt(
'vat_rate'),
'vat_rate',
'15%');
921 $tbl->addColumn($this->lng->txt(
'vat_unit'),
'vat_unit',
'15%');
922 $tbl->addColumn($this->lng->txt(
'price_a'),
'price',
'10%');
923 $tbl->disable(
'sort');
925 #$tbl->setPrefix("table". $a_pay_method['pm_title']."_");
929 $totalAmount = $sc_obj->getTotalAmount();
931 if (!empty(
$_SESSION[
'coupons'][$this->session_var]))
933 if (count($items = $sc_obj->getEntries($this->pm_id)))
935 $tbl->setTotalData(
'TXT_SUB_TOTAL', $this->lng->txt(
'pay_bmf_subtotal_amount') .
": ");
936 $tbl->setTotalData(
'VAL_SUB_TOTAL', number_format($totalAmount[$this->pm_id], 2,
',',
'.') .
" " . $genSet->get(
'currency_unit'));
937 #$tbl->setTotalData('VAL_SUB_TOTAL',ilPaymentPrices::_formatPriceToString($totalAmount[$a_pay_method['pm_id']], (int)$this->default_currency['currency_id'] ));
939 foreach (
$_SESSION[
'coupons'][$this->session_var] as $coupon)
941 $this->coupon_obj->setId($coupon[
'pc_pk']);
942 $this->coupon_obj->setCurrentCoupon($coupon);
944 $total_object_price = 0.0;
945 $current_coupon_bonus = 0.0;
947 foreach ($items as $item)
949 $tmp_pobject =
new ilPaymentObject($this->user_obj, $item[
'pobject_id']);
951 if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
954 $price = (float) $price_data[
'price'];
956 $total_object_price += $price;
961 $current_coupon_bonus = $this->coupon_obj->getCouponBonus($total_object_price);
962 $totalAmount[$current_coupon_bonus] += $current_coupon_bonus * (-1);
963 $tbl->setTotalData(
'TXT_COUPON_BONUS', $this->lng->txt(
'paya_coupons_coupon') .
" " . $coupon[
'pcc_code'] .
": ");
964 $tbl->setTotalData(
'VAL_COUPON_BONUS', number_format($current_coupon_bonus * (-1), 2,
',',
'.') .
" " . $genSet->get(
'currency_unit'));
967 if ($totalAmount[$this->pm_id] < 0)
976 $tbl->setTotalData(
'TXT_TOTAL_AMOUNT', $this->lng->txt(
'pay_bmf_total_amount').
": ");
977 $tbl->setTotalData(
'VAL_TOTAL_AMOUNT', number_format($this->totalAmount[$this->pm_id] , 2,
',',
'.') .
" " . $genSet->get(
'currency_unit')); #.$item[
'currency']);
980 #$currency_conversion_totalvat = (float)$_SESSION['currency_conversion'][$a_pay_method['pm_title']]['total_vat'];
981 #if($currency_conversion_totalvat > 0) $this->totalVat = $currency_conversion_totalvat;
983 if ($this->totalVat > 0)
985 $tbl->setTotalData(
'TXT_TOTAL_VAT', $this->lng->txt(
'pay_bmf_vat_included') .
": ");
986 $tbl->setTotalData(
'VAL_TOTAL_VAT', number_format($this->totalVat , 2,
',',
'.') .
" " . $genSet->get(
'currency_unit'));
989 $tbl->setData($a_result_set);
990 $this->tpl->setVariable(
'ITEMS_TABLE',$tbl->getCartHTML());