PEEL Shopping
Open source ecommerce : PEEL Shopping
fonctions.php
Go to the documentation of this file.
1 <?php
2 // This file should be in UTF8 without BOM - Accents examples: éèê
3 // +----------------------------------------------------------------------+
4 // | Copyright (c) 2004-2015 Advisto SAS, service PEEL - contact@peel.fr |
5 // +----------------------------------------------------------------------+
6 // | This file is part of PEEL Shopping 8.0.0, which is subject to an |
7 // | opensource GPL license: you are allowed to customize the code |
8 // | for your own needs, but must keep your changes under GPL |
9 // | More information: https://www.peel.fr/lire/licence-gpl-70.html |
10 // +----------------------------------------------------------------------+
11 // | Author: Advisto SAS, RCS 479 205 452, France, https://www.peel.fr/ |
12 // +----------------------------------------------------------------------+
13 // $Id: fonctions.php 47016 2015-09-23 15:02:15Z sdelaporte $
14 if (!defined('PAYPAL_SANDBOX')) {
15  // Mettre à true pour faire des tests avec des comptes Sandbox
16  define('PAYPAL_SANDBOX', !empty($GLOBALS['site_parameters']['paypal_sandbox']));
17 }
18 
46 function getPaypalForm($order_id, $lang, $amount, $currency_code, $user_email, $payment_times = 1, $sTexteLibre = '', $user_id, $prenom_ship, $nom_ship, $adresse_ship, $zip_ship, $ville_ship, $pays_ship, $telephone_ship, $prenom_bill = null, $nom_bill = null, $adresse_bill = null, $zip_bill = null, $ville_bill = null, $pays_bill = null, $telephone_bill = null)
47 {
48  if (PAYPAL_SANDBOX) {
49  $business = vb($GLOBALS['site_parameters']['secured_merchant_id']);
50  if(!empty($GLOBALS['site_parameters']['enable_paypal_iframe'])) {
51  $url = 'https://securepayments.sandbox.paypal.com/webapps/HostedSoleSolutionApp/webflow/sparta/hostedSoleSolutionProcess';
52  } else {
53  $url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
54  }
55  } else {
56  $business = vb($GLOBALS['site_parameters']['email_paypal']);
57  if (!empty($GLOBALS['site_parameters']['enable_paypal_integral_evolution']) && empty($GLOBALS['site_parameters']['enable_paypal_iframe'])) {
58  // Paypal integral evolution :
59  $url = 'https://securepayments.paypal.com/cgi-bin/acquiringweb';
60  } elseif(!empty($GLOBALS['site_parameters']['enable_paypal_integral_evolution']) && !empty($GLOBALS['site_parameters']['enable_paypal_iframe'])) {
61  $url = 'https://securepayments.paypal.com/webapps/HostedSoleSolutionApp/webflow/sparta/hostedSoleSolutionProcess';
62  } else {
63  $url = 'https://www.paypal.com/cgi-bin/webscr';
64  }
65  }
66  // La déclaration no_shipping empêche la validation par Paypal des adresses
67  // alors que la documentation indique que c'est simplement censé empêcher l'utilisateur de changer l'adresse quand il arrive sur paypal
68  // et éviter ainsi d'avoir une information en BDD différente de celle modifiée en dernier par l'utilisateur
69  // => évitez d'utiliser <input type="hidden" name="no_shipping" value="1" />
70  $tpl = $GLOBALS['tplEngine']->createTemplate('modules/paypal_form.tpl');
71  $tpl->assign('url', $url);
72  $tpl->assign('charset', GENERAL_ENCODING);
73  // L'activation de paypal intégrale évolution nécessite d'avoir souscrit à l'offre auprès de paypal.
74  $tpl->assign('enable_paypal_integral_evolution', !empty($GLOBALS['site_parameters']['enable_paypal_integral_evolution']));
75  // L'activation de la version iframe nécessite paypal intégrale évolution
76  $tpl->assign('enable_paypal_iframe', !empty($GLOBALS['site_parameters']['enable_paypal_iframe']) && !empty($GLOBALS['site_parameters']['enable_paypal_integral_evolution']));
77  $tpl->assign('business', $business);
78  $tpl->assign('item_name', $GLOBALS['site'] . ' '.$GLOBALS["STR_ORDER_NAME"].' ' . $order_id);
79  $tpl->assign('item_number', intval($order_id));
80  $tpl->assign('amount', round($amount, 2));
81  $tpl->assign('first_name', str_replace(array("\n", "\r", "\r\n"), "", $prenom_ship));
82  $tpl->assign('last_name', str_replace(array("\n", "\r", "\r\n"), "", $nom_ship));
83  $tpl->assign('address1', String::substr(str_replace(array("\n", "\r", "\r\n"), "", $adresse_ship), 0, 100));
84  $tpl->assign('address2', String::substr(str_replace(array("\n", "\r", "\r\n"), "", $adresse_ship), 100, 100));
85  $tpl->assign('zip', str_replace(array("\n", "\r", "\r\n"), "", $zip_ship));
86  $tpl->assign('city', str_replace(array("\n", "\r", "\r\n"), "", $ville_ship));
87  $tpl->assign('country', String::strtoupper(String::substr(get_country_iso_2_letter_code(trim($pays_ship)), 0, 2)));
88  $tpl->assign('prenom_bill', str_replace(array("\n", "\r", "\r\n"), "", $prenom_bill));
89  $tpl->assign('nom_bill', str_replace(array("\n", "\r", "\r\n"), "", $nom_bill));
90  $tpl->assign('adresse1_bill', String::substr(str_replace(array("\n", "\r", "\r\n"), "", $adresse_bill), 0, 100));
91  $tpl->assign('adresse2_bill', String::substr(str_replace(array("\n", "\r", "\r\n"), "", $adresse_bill), 100, 100));
92  $tpl->assign('zip_bill', str_replace(array("\n", "\r", "\r\n"), "", $zip_bill));
93  $tpl->assign('ville_bill', str_replace(array("\n", "\r", "\r\n"), "", $ville_bill));
94  $tpl->assign('pays_bill', String::strtoupper(String::substr(get_country_iso_2_letter_code(trim($pays_bill)), 0, 2)));
95  $tpl->assign('return', $GLOBALS['wwwroot'] . '/modules/paypal/ok.php?id=' . $order_id);
96  $tpl->assign('cancel_return', $GLOBALS['wwwroot'] . '/modules/paypal/nok.php?id=' . $order_id);
97  $tpl->assign('notify_url', get_url('/modules/paypal/ipn.php'));
98  $tpl->assign('currency_code', $currency_code);
99  $tpl->assign('lc', $lang);
100  $tpl->assign('email', $user_email);
101  $tpl->assign('paypal_bouton_src', $GLOBALS['STR_MODULE_PAYPAL_BOUTON']);
102  $tpl->assign('paypal_button_alt', $GLOBALS['STR_MODULE_PAYPAL_BUTTON_ALT']);
103  $tpl->assign('additional_fields', vb($GLOBALS['site_parameters']['paypal_additional_fields']));
104 
105  $form = $tpl->fetch();
106  return $form;
107 }
108 
static strtoupper($string)
Returns string with all alphabetic characters converted to uppercase.
Definition: String.php:154
$lang
Definition: spellchecker.php:9
if(!empty($_GET['id'])) if(isset($_POST['form_name'], $_POST['form_subject'], $_POST['form_text'], $_POST['form_lang'])&&empty($_GET['id'])) if(empty($_GET['id'])) $tpl
if(!defined('IN_PEEL')) $GLOBALS['page_types_array']
Definition: fonctions.php:19
if(!defined('PAYPAL_SANDBOX')) getPaypalForm($order_id, $lang, $amount, $currency_code, $user_email, $payment_times=1, $sTexteLibre= '', $user_id, $prenom_ship, $nom_ship, $adresse_ship, $zip_ship, $ville_ship, $pays_ship, $telephone_ship, $prenom_bill=null, $nom_bill=null, $adresse_bill=null, $zip_bill=null, $ville_bill=null, $pays_bill=null, $telephone_bill=null)
Génère le formulaire de paiement Paypal.
Definition: fonctions.php:46
vb(&$var, $default=null)
Variable blanche if $var n'est pas défini, retourne $default, sinon retourne $var.
Definition: format.php:97
if(strlen($date2)== '10') if($type== 'users-by-age'&&a_priv('admin_users', true)) elseif($type== 'forums-count'&&a_priv('admin_content', true)) elseif($type== 'forums-categories'&&a_priv('admin_content', true)) elseif($type== 'users-count'&&a_priv('admin_users', true)) elseif($type== 'product-categories'&&a_priv('admin_products', true)) elseif($type== 'users-by-sex'&&a_priv('admin_users', true)) elseif($type== 'users-by-country'&&a_priv('admin_users', true)) elseif($type== 'sales'&&a_priv('admin_sales', true))
Definition: chart-data.php:160
static substr($string, $start, $length=null)
Returns the portion of string specified by the start and length parameters.
Definition: String.php:112
get_country_iso_2_letter_code($country_id_or_name, $guess_if_not_found=true)
get_country_iso_2_letter_code()
Definition: format.php:348

This documentation for Open ecommerce PEEL Shopping and PEEL.fr has been generated by Doxygen on Thu Oct 15 2015 14:31:00 - Peel ecommerce is a product of Agence web Advisto SAS. All rights reserved.