92 lines
2.8 KiB
PHP
92 lines
2.8 KiB
PHP
<?php
|
|
/**
|
|
* osBilling - Open Billing Software
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
* Originally authored by Deon George
|
|
*
|
|
* @author Deon George <deonATleenooksDOTnet>
|
|
* @copyright 2009 Deon George
|
|
* @link http://osb.leenooks.net
|
|
* @license http://www.gnu.org/licenses/
|
|
* @package AgileBill
|
|
* @subpackage Checkout:Paypal
|
|
*/
|
|
|
|
# When we are called back after a payment, we come directly here, and thus our config.inc hasnt been parsed.
|
|
if (defined('PATH_MODULES'))
|
|
include_once(PATH_MODULES.'checkout/base_checkout_plugin.class.php');
|
|
else
|
|
include_once('../../modules/checkout/base_checkout_plugin.class.php');
|
|
|
|
abstract class plg_chout_base_PAYPAL extends base_checkout_plugin {
|
|
public function __construct($checkout_id=false,$multi=false) {
|
|
$this->type = 'redirect';
|
|
$this->return_url = sprintf('%splugins/checkout/%s.php',SSL_URL,$this->name);
|
|
|
|
if ($multi) {
|
|
$this->success_url = URL.'?_page=invoice:thankyou&_next_page=invoice:user_view&id=';
|
|
$this->decline_url = URL.'?_page=invoice:checkout_multiple&id=';
|
|
} else {
|
|
$this->success_url = URL.'?_page=invoice:thankyou&_next_page=account:account&id=';
|
|
$this->decline_url = URL.'?_page=invoice:user_view&id=';
|
|
}
|
|
|
|
$this->support_cur = array('AUD','USD','GBP','EUR','CAD','JPY');
|
|
$this->getDetails($checkout_id);
|
|
}
|
|
|
|
protected function getLocation($uri=true,$nojs=false) {
|
|
switch ($this->cfg['mode']) {
|
|
case 1:
|
|
return ($uri ? 'https://' : '').'www.paypal.com';
|
|
break;
|
|
case 0:
|
|
if (! $nojs)
|
|
echo '<script type="text/javascript">alert("This transaction is in TEST mode, payment will NOT be made.") </script>';
|
|
return ($uri ? 'https://' : '').'www.sandbox.paypal.com';
|
|
break;
|
|
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
# Validate the user submitted billing details at checkout:
|
|
function validate($VAR) {
|
|
return true;
|
|
}
|
|
|
|
# Perform a transaction for an (new invoice):
|
|
function bill_invoice($VAR) {
|
|
return true;
|
|
}
|
|
|
|
# Issue a refund for a paid invoice (captured charges w/gateway)
|
|
function refund($VAR) {
|
|
return true;
|
|
}
|
|
|
|
# Void a authorized charge (gateways only)
|
|
function void($VAR) {
|
|
return true;
|
|
}
|
|
|
|
# Stores new billing details, & return account_billing_id (gateway only)
|
|
public function store_billing($VAR) {
|
|
return null;
|
|
}
|
|
}
|