Ticket #1910: PayPalCommon.php

File PayPalCommon.php, 24.3 KB (added by Torsten Riemer, 5 years ago)
Line 
1<?php
2/* -----------------------------------------------------------------------------------------
3 $Id: PayPalCommon.php 12890 2020-09-21 14:08:35Z GTB $
4
5 modified eCommerce Shopsoftware
6 http://www.modified-shop.org
7
8 Copyright (c) 2009 - 2013 [www.modified-shop.org]
9 -----------------------------------------------------------------------------------------
10 Released under the GNU General Public License
11 ---------------------------------------------------------------------------------------*/
12
13
14// include needed classes
15require_once(DIR_FS_EXTERNAL.'paypal/classes/PayPalAuth.php');
16
17
18// used classes
19use PayPal\Api\FlowConfig;
20use PayPal\Api\Presentation;
21use PayPal\Api\WebProfile;
22use PayPal\Api\InputFields;
23
24
25class PayPalCommon extends PayPalAuth {
26
27
28 function __construct() {
29
30 }
31
32
33 function link_encoding($string) {
34 $string = str_replace('&amp;', '&', $string);
35
36 return $string;
37 }
38
39
40 function encode_utf8($string) {
41 if (is_array($string)) {
42 foreach ($string as $key => $value) {
43 $string[$key] = $this->encode_utf8($value);
44 }
45 } else {
46 $string = decode_htmlentities($string);
47 $cur_encoding = mb_detect_encoding($string);
48 if ($cur_encoding == "UTF-8" && mb_check_encoding($string, "UTF-8")) {
49 return $string;
50 } else {
51 return mb_convert_encoding($string, "UTF-8", $_SESSION['language_charset']);
52 }
53 }
54
55 return $string;
56 }
57
58
59 function decode_utf8($string) {
60 if (is_array($string)) {
61 foreach ($string as $key => $value) {
62 $string[$key] = $this->decode_utf8($value);
63 }
64 } else {
65 $string = decode_utf8($string);
66 }
67
68 return $string;
69 }
70
71
72 function format_price_currency($price) {
73 $xtPrice = new xtcPrice('EUR', $_SESSION['customers_status']['customers_status_id']);
74 return $xtPrice->xtcFormat($price, true);
75 }
76
77
78 function get_min_installment_amount() {
79 return array(
80 'amount' => 99.00,
81 'currency' => 'EUR',
82 );
83 }
84
85
86 function get_max_installment_amount() {
87 return array(
88 'amount' => 5000.00,
89 'currency' => 'EUR',
90 );
91 }
92
93
94 function save_config($sql_data_array) {
95 if (is_array($sql_data_array) && count($sql_data_array) > 0) {
96 foreach ($sql_data_array as $sql_data) {
97 $this->delete_config($sql_data['config_key']);
98 xtc_db_perform(TABLE_PAYPAL_CONFIG, $sql_data);
99 }
100 }
101 }
102
103
104 function delete_config($value, $col = 'config_key') {
105 xtc_db_query("DELETE FROM ".TABLE_PAYPAL_CONFIG." WHERE ".$col." = '".xtc_db_input($value)."'");
106 }
107
108
109 function get_config($config_key) {
110 static $config_array;
111
112 if (!is_array($config_array)) {
113 $config_array = array();
114 }
115
116 if (!isset($config_array[$config_key])) {
117 $config_array[$config_key] = '';
118 $config_query = xtDBquery("SELECT config_value
119 FROM ".TABLE_PAYPAL_CONFIG."
120 WHERE config_key = '".xtc_db_input($config_key)."'");
121 if (xtc_db_num_rows($config_query, true) > 0) {
122 $config = xtc_db_fetch_array($config_query, true);
123 $config_array[$config_key] = $config['config_value'];
124 }
125 }
126
127 return $config_array[$config_key];
128 }
129
130
131 function get_totals($totals, $calc_total = false, $subtotal = 0) {
132
133 for ($i = 0, $n = sizeof($totals); $i < $n; $i ++) {
134 switch(((isset($totals[$i]['code'])) ? $totals[$i]['code'] : $totals[$i]['class'])) {
135 case 'ot_subtotal':
136 $sortorder_subtotal = $totals[$i]['sort_order'];
137 break;
138 }
139 }
140
141 for ($i = 0, $n = sizeof($totals); $i < $n; $i ++) {
142 switch(((isset($totals[$i]['code'])) ? $totals[$i]['code'] : $totals[$i]['class'])) {
143 case 'ot_subtotal_no_tax':
144 break;
145 case 'ot_subtotal':
146 $this->details->setSubtotal((($subtotal > 0) ? $subtotal : $totals[$i]['value']));
147 break;
148 case 'ot_total':
149 $this->amount->setTotal($totals[$i]['value']);
150 break;
151 case 'ot_shipping':
152 $this->details->setShipping($totals[$i]['value']);
153 break;
154 case 'ot_tax':
155 if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0
156 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1
157 )
158 {
159 $this->details->setTax($this->details->getTax() + $totals[$i]['value']);
160 }
161 break;
162 default:
163 if ($totals[$i]['sort_order'] > $sortorder_subtotal) {
164 if($totals[$i]['value'] < 0) {
165 $this->details->setShippingDiscount($this->details->getShippingDiscount() + $totals[$i]['value']);
166 } else {
167 $this->details->setHandlingFee($this->details->getHandlingFee() + $totals[$i]['value']);
168 }
169 }
170 break;
171 }
172 }
173
174 $total = $this->calc_total();
175 $amount_total = $this->amount->getTotal();
176
177 if ($calc_total === true && $this->details->getSubtotal() > 0) {
178 $this->amount->setTotal($total);
179 } elseif ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0
180 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1
181 && $this->details->getShippingDiscount() == 0
182 )
183 {
184 if ((string)$amount_total != (string)$total) {
185 $this->details->setTax($this->details->getTax() + ($amount_total - $total));
186 }
187 } else {
188 if ((string)$amount_total != (string)$total) {
189 if ($this->details->getShippingDiscount() < 0) {
190 $this->details->setShippingDiscount($this->details->getShippingDiscount() + ($amount_total - $total));
191 } elseif ($this->details->getHandlingFee() > 0) {
192 $this->details->setHandlingFee($this->details->getHandlingFee() + ($amount_total - $total));
193 }
194 }
195 }
196 }
197
198
199 function calc_total() {
200 $total = 0;
201 $total += $this->details->getSubtotal();
202 $total += $this->details->getShipping();
203 $total += $this->details->getTax();
204 $total += $this->details->getHandlingFee();
205 $total += $this->details->getShippingDiscount();
206 $total += $this->details->getInsurance();
207 $total += $this->details->getGiftWrap();
208 $total += $this->details->getFee();
209
210 return $total;
211 }
212
213
214 function fix_totals($totals) {
215
216 for ($i = 0, $n = sizeof($totals); $i < $n; $i ++) {
217 switch(((isset($totals[$i]['code'])) ? $totals[$i]['code'] : $totals[$i]['class'])) {
218 case 'ot_tax':
219 $this->details->setTax($this->details->getTax() + $totals[$i]['value']);
220 $this->amount->setTotal($this->amount->getTotal() + $totals[$i]['value']);
221 break;
222 }
223 }
224 }
225
226
227 function check_discount() {
228 if ($this->details->getHandlingFee() > 0
229 || $this->details->getShippingDiscount() < 0
230 || $this->details->getInsurance() > 0
231 || $this->details->getGiftWrap() > 0
232 || $this->details->getFee() > 0
233 )
234 {
235 return true;
236 }
237 return false;
238 }
239
240
241 function get_shipping_cost() {
242 global $order, $PHP_SELF;
243
244 $shipping_cost = $order->info['shipping_cost'];
245
246 if ($shipping_cost > 0) {
247 if (basename($PHP_SELF) == FILENAME_CHECKOUT_PAYMENT) {
248 $shipping_modul = explode('_',$order->info['shipping_class']);
249 $shipping_tax_class = constant('MODULE_SHIPPING_'.strtoupper($shipping_modul[0]).'_TAX_CLASS');
250 $shipping_tax_rate = xtc_get_tax_rate($shipping_tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
251 $shipping_cost = $order->info['shipping_cost'] * (1 + ($shipping_tax_rate / 100));
252 }
253 }
254 return $shipping_cost;
255 }
256
257
258 function calculate_total($plain = true) {
259 global $order;
260
261 $order_backup = $order;
262
263 if (isset($_SESSION['shipping'])) {
264 if (!class_exists('shipping')) {
265 require_once (DIR_WS_CLASSES . 'shipping.php');
266 }
267 $shipping_modules = new shipping($_SESSION['shipping']);
268 }
269
270 if (!class_exists('order')) {
271 require_once (DIR_WS_CLASSES . 'order.php');
272 }
273 $order = new order();
274
275 if (!class_exists('order_total')) {
276 require_once (DIR_WS_CLASSES . 'order_total.php');
277 }
278 $order_total_modules = new order_total();
279 $order_total = $order_total_modules->process();
280
281 $total = $order->info['total'];
282
283 $order = $order_backup;
284
285 if ($plain === false) {
286 return $order_total;
287 }
288
289 return $total;
290 }
291
292
293 function get_payment_profile_data() {
294 $address_override = false;
295 $profile_id = $this->get_config('PAYPAL_'.strtoupper($this->code.'_'.$_SESSION['language_code']).'_PROFILE');
296
297 if ($profile_id == '') {
298 $profile_id = $this->get_config('PAYPAL_STANDARD_PROFILE');
299 }
300
301 if ($profile_id != '') {
302 if ($this->get_config(strtoupper($profile_id).'_TIME') < (time() - (3600 * 24))) {
303 $profile = $this->get_profile($profile_id);
304
305 if (count($profile) > 0) {
306 $sql_data_array = array(
307 array(
308 'config_key' => strtoupper($profile_id).'_TIME',
309 'config_value' => time(),
310 ),
311 array(
312 'config_key' => strtoupper($profile_id).'_ADDRESS',
313 'config_value' => $profile[0]['input_fields']['address_override'],
314 ),
315 );
316 $this->save_config($sql_data_array);
317 $address_override = (($profile[0]['input_fields']['address_override'] == '0') ? true : false);
318 } else {
319 $profile_id = $this->delete_profile($profile_id);
320 }
321 } else {
322 $address_override = (($this->get_config(strtoupper($profile_id).'_ADDRESS') == '0') ? true : false);
323 }
324 }
325
326 return array(
327 'profile_id' => $profile_id,
328 'address_override' => $address_override,
329 );
330 }
331
332
333 function get_profile($id) {
334
335 // auth
336 $apiContext = $this->apiContext();
337
338 // set WebProfile
339 $webProfile = new WebProfile();
340
341 try {
342 $webProfileList = $webProfile->get($id, $apiContext);
343 $valid = true;
344 } catch (Exception $ex) {
345 $this->LoggingManager->log('DEBUG', 'Profile', array('exception' => $ex));
346 $valid = false;
347 }
348
349 // set array
350 $list_array = array();
351
352 if ($valid === true) {
353 $profile = $webProfileList;
354 $flowConfig = $profile->getFlowConfig();
355 $inputFields = $profile->getInputFields();
356 $presentation = $profile->getPresentation();
357
358 $list_array[] = array(
359 'id' => $profile->getId(),
360 'name' => $profile->getName(),
361 'status' => (($this->get_config('PAYPAL_STANDARD_PROFILE') == $profile->getId()) ? true : false),
362 'flow_config' => array(
363 'landing_page_type' => ((is_object($flowConfig)) ? $flowConfig->getLandingPageType() : ''),
364 'user_action' => ((is_object($flowConfig)) ? $flowConfig->getUserAction() : ''),
365 ),
366 'input_fields' => array(
367 'allow_note' => ((is_object($inputFields)) ? $inputFields->getAllowNote() : ''),
368 'no_shipping' => ((is_object($inputFields)) ? $inputFields->getNoShipping() : ''),
369 'address_override' => ((is_object($inputFields)) ? $inputFields->getAddressOverride() : ''),
370 ),
371 'presentation' => array(
372 'brand_name' => ((is_object($presentation)) ? $presentation->getBrandName() : ''),
373 'logo_image' => ((is_object($presentation)) ? $presentation->getLogoImage() : ''),
374 'locale_code' => ((is_object($presentation)) ? $presentation->getLocaleCode() : ''),
375 ),
376 );
377 }
378
379 return $list_array;
380 }
381
382
383 function delete_profile($id) {
384
385 // auth
386 $apiContext = $this->apiContext();
387
388 // set WebProfile
389 $webProfile = new WebProfile();
390 $webProfile->setId($id);
391
392 try {
393 $webProfile->delete($apiContext);
394 } catch (Exception $ex) {
395 $this->LoggingManager->log('DEBUG', 'Profile', array('exception' => $ex));
396 }
397
398 if ($id == $this->get_config('PAYPAL_STANDARD_PROFILE')) {
399 $this->delete_config('PAYPAL_STANDARD_PROFILE');
400 }
401
402 $this->delete_config($id, 'config_value');
403 }
404
405
406 function login_customer($customer, $customer_id = '') {
407 global $econda, $messageStack;
408
409 // include needed function
410 require_once (DIR_FS_INC.'xtc_write_user_info.inc.php');
411
412 $where = " WHERE customers_email_address = '".xtc_db_input($customer['info']['email_address'])."' AND account_type = '0' ";
413 if ($customer_id != '') {
414 $where = " WHERE customers_id = '".(int)$customer_id."' "
415 }
416
417 // check if customer exists
418 $check_customer_query = xtc_db_query("SELECT customers_id,
419 customers_vat_id,
420 customers_firstname,
421 customers_lastname,
422 customers_gender,
423 customers_password,
424 customers_email_address,
425 customers_default_address_id,
426 account_type
427 FROM ".TABLE_CUSTOMERS."
428 ".$where);
429 if (xtc_db_num_rows($check_customer_query) < 1) {
430 $this->create_account($customer);
431 } else {
432 if (SESSION_RECREATE == 'True') {
433 xtc_session_recreate();
434 }
435 $check_customer = xtc_db_fetch_array($check_customer_query);
436
437 $check_country_query = xtc_db_query("SELECT entry_country_id,
438 entry_zone_id
439 FROM ".TABLE_ADDRESS_BOOK."
440 WHERE customers_id = '".(int) $check_customer['customers_id']."'
441 AND address_book_id = '".$check_customer['customers_default_address_id']."'");
442 $check_country = xtc_db_fetch_array($check_country_query);
443
444 $_SESSION['customer_gender'] = $check_customer['customers_gender'];
445 $_SESSION['customer_first_name'] = $check_customer['customers_firstname'];
446 $_SESSION['customer_last_name'] = $check_customer['customers_lastname'];
447 $_SESSION['customer_email_address'] = $check_customer['customers_email_address'];
448 $_SESSION['customer_id'] = $check_customer['customers_id'];
449 $_SESSION['customer_vat_id'] = $check_customer['customers_vat_id'];
450 $_SESSION['customer_default_address_id'] = $check_customer['customers_default_address_id'];
451 $_SESSION['customer_country_id'] = $check_country['entry_country_id'];
452 $_SESSION['customer_zone_id'] = $check_country['entry_zone_id'];
453 $_SESSION['account_type'] = $check_customer['account_type'];
454
455 xtc_db_query("UPDATE ".TABLE_CUSTOMERS_INFO."
456 SET customers_info_date_of_last_logon = now(),
457 customers_info_number_of_logons = customers_info_number_of_logons+1
458 WHERE customers_info_id = '".(int) $_SESSION['customer_id']."'");
459 xtc_write_user_info((int) $_SESSION['customer_id']);
460
461 // restore cart contents
462 $_SESSION['cart']->restore_contents();
463
464 // restore wishlist contents
465 if (isset($_SESSION['wishlist'])
466 && is_object($_SESSION['wishlist'])
467 )
468 {
469 $_SESSION['wishlist']->restore_contents();
470 }
471
472 if (isset($econda) && is_object($econda)) {
473 $econda->_loginUser();
474 }
475 if ($_SESSION['old_customers_basket_cart'] === true) {
476 unset($_SESSION['old_customers_basket_cart']);
477 unset($_SESSION['paypal']);
478
479 $messageStack->add_session('info_message_3', TEXT_SAVED_BASKET);
480 xtc_redirect(xtc_href_link(FILENAME_SHOPPING_CART, ''), 'NONSSL');
481 }
482 }
483
484 }
485
486
487 function create_account($customer) {
488
489 // include needed function
490 require_once (DIR_FS_INC.'xtc_encrypt_password.inc.php');
491 require_once (DIR_FS_INC.'xtc_create_password.inc.php');
492 require_once (DIR_FS_INC.'generate_customers_cid.inc.php');
493
494 $password = xtc_create_password(8);
495
496 $sql_data_array = array(
497 'customers_status' => DEFAULT_CUSTOMERS_STATUS_ID_GUEST,
498 'customers_gender' => $customer['info']['gender'],
499 'customers_firstname' => $customer['customers']['customers_firstname'],
500 'customers_lastname' => $customer['customers']['customers_lastname'],
501 'customers_email_address' => $customer['info']['email_address'],
502 'customers_telephone' => $customer['info']['telephone'],
503 'customers_dob' => xtc_date_raw($customer['info']['dob']),
504 'customers_password' => xtc_encrypt_password($password),
505 'customers_date_added' => 'now()',
506 'customers_last_modified' => 'now()',
507 'account_type' => '1',
508 );
509
510 if (ACCOUNT_OPTIONS == 'account') {
511 $sql_data_array['account_type'] = '0';
512 $sql_data_array['customers_cid'] = generate_customers_cid(true);
513 $sql_data_array['customers_status'] = DEFAULT_CUSTOMERS_STATUS_ID;
514 $sql_data_array['password_request_time'] = 'now()';
515
516 // send password with order mail
517 $_SESSION['paypal_express_new_customer'] = 'true';
518 }
519
520 xtc_db_perform(TABLE_CUSTOMERS, $sql_data_array);
521
522 $customer_id = xtc_db_insert_id();
523
524 $data = $customer['customers'];
525 $data['gender'] = $customer['info']['gender'];
526
527 $address_id = $this->create_address_book($customer_id, $data);
528
529 xtc_db_query("UPDATE " . TABLE_CUSTOMERS . "
530 SET customers_default_address_id = '" . (int)$address_id . "'
531 WHERE customers_id = '" . (int)$customer_id . "'");
532
533 $sql_data_array = array('customers_info_id' => (int)$customer_id,
534 'customers_info_number_of_logons' => '1',
535 'customers_info_date_account_created' => 'now()',
536 'customers_info_date_of_last_logon' => 'now()'
537 );
538 xtc_db_perform(TABLE_CUSTOMERS_INFO, $sql_data_array);
539
540 // login
541 $this->login_customer($customer, $customer_id);
542 }
543
544
545 function create_address_book($customer_id, $data, $shipping = false) {
546
547 $type = 'customers';
548 if ($shipping === true) {
549 $type = 'delivery';
550 }
551
552 $sql_data_array = array(
553 'customers_id' => $customer_id,
554 'entry_gender' => $data['gender'],
555 'entry_firstname' => $data[$type.'_firstname'],
556 'entry_lastname' => $data[$type.'_lastname'],
557 'entry_company' => $data[$type.'_company'],
558 'entry_street_address' => $data[$type.'_street_address'],
559 'entry_suburb' => $data[$type.'_suburb'],
560 'entry_postcode' => $data[$type.'_postcode'],
561 'entry_city' => $data[$type.'_city'],
562 'entry_country_id' => $data[$type.'_country_id'],
563 'entry_zone_id' => $data[$type.'_zone_id'],
564 'entry_state' => $data[$type.'_state'],
565 'address_date_added' => 'now()',
566 'address_last_modified' => 'now()'
567 );
568
569 xtc_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
570
571 $address_id = xtc_db_insert_id();
572
573 return $address_id;
574 }
575
576
577 function get_shipping_address($customer_id, $data) {
578
579 $where = '';
580 if (ACCOUNT_COMPANY == 'true') {
581 $where .= " AND entry_company = '".xtc_db_input($data['delivery_company'])."'";
582 }
583 if (ACCOUNT_SUBURB == 'true') {
584 $where .= " AND entry_suburb = '".xtc_db_input($data['delivery_suburb'])."'";
585 }
586 if (ACCOUNT_STATE == 'true') {
587 $where .= " AND entry_zone_id = '".xtc_db_input($data['delivery_zone_id'])."'";
588 $where .= " AND entry_state = '".xtc_db_input($data['delivery_state'])."'";
589 }
590
591 $check_address_query = xtc_db_query("SELECT address_book_id
592 FROM ".TABLE_ADDRESS_BOOK."
593 WHERE customers_id = '".$customer_id."'
594 ".$where."
595 AND entry_firstname = '".xtc_db_input($data['delivery_firstname'])."'
596 AND entry_lastname = '".xtc_db_input($data['delivery_lastname'])."'
597 AND entry_street_address = '".xtc_db_input($data['delivery_street_address'])."'
598 AND entry_postcode = '".xtc_db_input($data['delivery_postcode'])."'
599 AND entry_city = '".xtc_db_input($data['delivery_city'])."'
600 AND entry_lastname = '".xtc_db_input($data['delivery_lastname'])."'
601 AND entry_lastname = '".xtc_db_input($data['delivery_lastname'])."'");
602 if (xtc_db_num_rows($check_address_query) == 1) {
603 $check_address = xtc_db_fetch_array($check_address_query);
604 $address_id = $check_address['address_book_id'];
605 } else {
606 $address_id = $this->create_address_book($customer_id, $data, true);
607 }
608
609 return $address_id;
610 }
611
612
613 function get_presentment_details($amount, $currency, $iso_code_2, $type, $single = true) {
614 global $request_type;
615
616 $pp_smarty = new Smarty();
617
618 $min_amount = $this->get_min_installment_amount();
619 $max_amount = $this->get_max_installment_amount();
620
621 if ((string)$amount >= (string)$min_amount['amount']
622 && (string)$amount <= (string)$max_amount['amount']
623 )
624 {
625 if ($this->get_config('MODULE_PAYMENT_'.strtoupper($this->code).'_UPSTREAM_'.strtoupper($type)) == '1') {
626 $presentment_array = $this->get_presentment($amount, $currency, $iso_code_2, $single);
627 $pp_smarty->assign('presentment', array($presentment_array));
628 if ($type == 'payment') {
629 $pp_smarty->assign('details', '1');
630 $pp_smarty->assign('logo_image', xtc_image(DIR_WS_IMAGES.'icons/pp_credit-german_v_rgb.png'));
631 } else {
632 $pp_smarty->assign('details', (((int)$presentment_array['apr'] == 0) ? '0' : '1'));
633 if ((int)$presentment_array['apr'] == 0) {
634 $pp_smarty->assign('logo_image', xtc_image(DIR_WS_IMAGES.'icons/pp_credit-german_h_rgb.png'));
635 }
636 }
637 } else {
638 $pp_smarty->assign('logo_image', xtc_image(DIR_WS_IMAGES.'icons/pp_credit-german_h_rgb.png'));
639 }
640
641 if (!defined('POPUP_CONTENT_LINK_PARAMETERS')) {
642 define('POPUP_CONTENT_LINK_PARAMETERS', '&KeepThis=true&TB_iframe=true&height=400&width=600');
643 }
644 if (!defined('POPUP_CONTENT_LINK_CLASS')) {
645 define('POPUP_CONTENT_LINK_CLASS', 'thickbox');
646 }
647 $link_parameters = defined('TPL_POPUP_CONTENT_LINK_PARAMETERS') ? TPL_POPUP_CONTENT_LINK_PARAMETERS : POPUP_CONTENT_LINK_PARAMETERS;
648 $link_class = defined('TPL_POPUP_CONTENT_LINK_CLASS') ? TPL_POPUP_CONTENT_LINK_CLASS : POPUP_CONTENT_LINK_CLASS;
649 $link = xtc_href_link('callback/paypal/paypalinstallment.php', 'amount='.$amount.'&country='.$iso_code_2.$link_parameters, $request_type);
650
651 $store_owner = explode("\n", STORE_NAME_ADDRESS);
652 for ($i=0, $n=count($store_owner); $i<$n; $i++) {
653 if (trim($store_owner[$i]) == '') {
654 unset($store_owner[$i]);
655 } else {
656 $store_owner[$i] = trim($store_owner[$i]);
657 }
658 }
659 $store_owner = implode(', ', $store_owner);
660
661 $pp_smarty->assign($type, true);
662 $pp_smarty->assign('creditor', $store_owner);
663 $pp_smarty->assign('link_class', $link_class);
664 $pp_smarty->assign('link', $link);
665 $pp_smarty->assign('notice', constant('TEXT_PAYPALINSTALLMENT_NOTICE_'.strtoupper($type)));
666 $pp_smarty->assign('total_amount', $this->format_price_currency($amount));
667 } else {
668 $pp_smarty = new Smarty();
669 $pp_smarty->assign($type, true);
670 $pp_smarty->assign('nopresentment', true);
671 $pp_smarty->assign('min_amount', $this->format_price_currency($min_amount['amount']));
672 $pp_smarty->assign('max_amount', $this->format_price_currency($max_amount['amount']));
673 $pp_smarty->assign('logo_image', xtc_image(DIR_WS_IMAGES.'icons/pp_credit-german_h_rgb.png'));
674 }
675
676 $pp_smarty->assign('language', $_SESSION['language']);
677
678 $tpl_file = DIR_FS_EXTERNAL.'paypal/templates/presentment_info.html';
679 if (is_file(DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/module/paypal/presentment_info.html')) {
680 $tpl_file = DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/module/paypal/presentment_info.html';
681 }
682 $presentment = $pp_smarty->fetch($tpl_file);
683
684 return $presentment;
685 }
686
687}
688?>