| Server IP : 10.200.247.200 / Your IP : 216.73.217.19 Web Server : Apache System : Linux synergy-usa-sites 6.8.0-138-generic #138-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 31 22:41:49 UTC 2026 x86_64 User : jeremy ( 1001) PHP Version : 8.4.25 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/usa_sites/pcisecureform.com/php/MerchantProcessor/ |
Upload File : |
<?
class Site
{
public $name;
public $initial_processors = array();
public $current_initial_processor = 0;
public $rebill_processors = array();
public $current_rebill_processor = 0;
private $lock;
function __construct($name)
{
$this->name = $name;
}
function __sleep()
{
return array('name','initial_processors','current_initial_processor','rebill_processors','current_rebill_processor');
}
function Acquire()
{
//TODO: this line intermitantly causes the server to lock up because owner permissions get fowled up.
//$this->lock = fopen("/tmp/merchant" . $this->name . "lock.txt", "w+");
//flock($this->lock, LOCK_EX);
}
function Release()
{
//flock($this->lock, LOCK_UN);
//fclose($this->lock);
}
function IncrementInitialProcessor()
{
$this->current_initial_processor++;
if ($this->current_initial_processor > (count($this->initial_processors)-1))
{
$this->current_initial_processor = 0;
}
}
function IncrementRebillProcessor()
{
$this->current_rebill_processor++;
if ($this->current_rebill_processor > (count($this->rebill_processors)-1))
{
$this->current_rebill_processor = 0;
}
}
function GetInitialProcessor($amount)
{
$proc = $this->initial_processors[$this->current_initial_processor];
if ($proc->CheckLimit($amount)) { return $proc;}
else
{
$this->IncrementInitialProcessor();
return $this->GetInitialProcessor($amount);
}
}
/*
If the requested rebill processor is not found default to the next
defined rebill processor
*/
function GetRebillProcessor($amount, $rebill_processor = '')
{
$proc = NULL;
if(trim($rebill_processor) != '') {
$numb_procs = count($this->rebill_processors);
for($proc_index = 0; $proc_index < $numb_procs; $proc_index++) {
if($this->rebill_processors[$proc_index]->name == $rebill_processor) {
$this->current_rebill_processor = $proc_index;
$proc = $this->rebill_processors[$this->current_rebill_processor];
break;
}
}
} else {
$this->IncrementRebillProcessor();
$proc = $this->rebill_processors[$this->current_rebill_processor];
}
if (!empty($proc) && get_class($proc) == 'Processor' && $proc->CheckLimit($amount)) {
return $proc;
} else {
return $this->GetRebillProcessor($amount);
}
}
function AddInitialAmount($amount)
{
$proc = $this->initial_processors[$this->current_initial_processor];
$proc->AddAmount($amount);
#$this->IncrementInitialProcessor();
}
function AddRebillAmount($amount)
{
$proc = $this->rebill_processors[$this->current_rebill_processor];
$proc->AddAmount($amount);
#$this->IncrementRebillProcessor();
}
function ResetAmountCharged()
{
foreach ($this->initial_processors as $proc)
{
$proc->ResetAmountCharged();
}
foreach ($this->rebill_processors as $proc)
{
$proc->ResetAmountCharged();
}
}
}
?>