Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

paypal.php
Go to the documentation of this file.
1 <?
3 //
4 // $Id: invoice.php,v 1.2 2001/02/20 16:12:48 bf Exp $
5 //
6 // B�rd Farstad <bf@ez.no>
7 // Created on: <02-Feb-2001 18:28:36 bf>
8 //
9 // This source file is part of Exponential Basic, publishing software.
10 // Copyright (C) 1999-2000 eZ systems as
11 //
12 // This program is free software; you can redistribute it and/or
13 // modify it under the terms of the GNU General Public License
14 // as published by the Free Software Foundation; either version 2
15 // of the License, or (at your option) any later version.
16 //
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program; if not, write to the Free Software
24 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
25 //
26
27
28 // include_once( "classes/ezhttptool.php" );
29 // include_once( "classes/INIFile.php" );
30 // include_once( "ezaddress/classes/ezaddress.php" );
31
32 // retrieve site.ini config variables
33 $indexFile = $ini->Index;
34 $wwwDir = $ini->WWWDir;
35 $PaypalEmail = $ini->variable( "Checkout", "PaypalEmail" );
36 $ShopName = $ini->variable( "site", "SiteTitle" );
37 $CurrencyCode = $ini->variable( "Checkout", "CurrencyCode" );
38 $SiteLogo = $ini->variable( "Checkout", "SiteLogo" );
39 $PageStyle = $ini->variable( "Checkout", "PageStyle" );
40 $LanguageCode = $ini->variable( "Checkout", "LanguageCode" );
41 $PaypalMode = $ini->variable( "Checkout", "PaypalMode" );
42
43 // get billing address
44 $billingAddress = new eZAddress( $session->variable( "BillingAddressID" ) );
45 $region = $billingAddress->region();
46 $country = $billingAddress->country();
47
48 // build POST URL
49
50 if ( $PaypalMode == 'Sandbox' )
51 $URL = 'https://www.sandbox.paypal.com/cgi-bin/webscr?';
52 elseif ( $PaypalMode == 'Paypal' )
53 $URL = 'https://www.paypal.com/cgi-bin/webscr?';
54 else
55 {
56 print('Error: PaypalMode variable in site.ini not set!');
57 exit();
58 }
59
60 $URL .= 'cmd=_ext-enter';
61 $URL .= '&redirect_cmd=_xclick';
62 $URL .= '&business='.$PaypalEmail;
63 $URL .= '&item_name='.urlencode($ShopName);
64
65 if ( $SiteLogo != "" )
66 $URL .= $SiteLogo;
67
68 $URL .= '&currency_code='.$CurrencyCode;
69 $URL .= '&amount='.$ChargeTotal;
70 $URL .= '&email='.$user->Email();
71 $URL .= '&first_name='.$user->firstName();
72 $URL .= '&last_name='.$user->lastName();
73 $URL .= '&address1='.urlencode($billingAddress->street1());
74 $URL .= '&address2='.urlencode($billingAddress->street2());
75 $URL .= '&city='.urlencode($billingAddress->place());
76
77 if ( $region )
78 $URL .= '&state='.$region->Abbreviation();
79
80 $URL .= '&state=TX';
81 $URL .= '&zip='.$billingAddress->zip();
82 $URL .= '&country='.$country->iso();
83 $URL .= '&lc='.$LanguageCode;
84 $URL .= '&return=http://'.$HTTP_HOST.$wwwDir.$indexFile.'/trade/ordersendt/'.$session->variable( "OrderID" );
85 $URL .= '&cancel_return=http://'.$HTTP_HOST.$wwwDir.$indexFile.'/trade/checkout/';
86 if ($PageStyle != "")
87 $URL .= '&page_style='.$PageStyle;
88 $URL .= '&address_override=1';
89 $URL .= '&invoice='.$session->variable( "OrderID" );
90 $URL .= '&notify_url=http://'.$HTTP_HOST.$wwwDir.$indexFile.'/trade/paypal/'.$session->variable( "OrderID" ).'/'.$session->id().'/';
91 $URL .= '&no_note=1';
92 $URL .= '&no_shipping=1';
93
94 // include_once( "classes/ezlog.php" );
95 // $writeURL = print_r($URL, true);
96 // eZPBLog::writeNotice( $writeURL."\n" );
97 // eZDebug::writeNotice( "Payment Processing URL: $URL" );
98
99 eZHTTPTool::header("Location: $URL");
100
101 ?>
$session
$session
Definition: admin/articlelist.php:44
eZAddress
Definition: ezaddress.php:42
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
$ini
$ini
Definition: classes/admin/linklist.php:64
exit
exit
Definition: folder.php:81
else
else
Definition: paypal.php:55
$indexFile
$indexFile
Definition: paypal.php:33
$country
$country
Definition: paypal.php:46
$wwwDir
$wwwDir
Definition: paypal.php:34
$PageStyle
$PageStyle
Definition: paypal.php:39
$URL
$URL
Definition: paypal.php:60
$SiteLogo
$SiteLogo
Definition: paypal.php:38
$billingAddress
$billingAddress
Definition: paypal.php:44
$region
$region
Definition: paypal.php:45
$PaypalEmail
$PaypalEmail
Definition: paypal.php:35
$PaypalMode
$PaypalMode
Definition: paypal.php:41
$CurrencyCode
$CurrencyCode
Definition: paypal.php:37
$ShopName
$ShopName
Definition: paypal.php:36
$LanguageCode
$LanguageCode
Definition: paypal.php:40
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.