コード例 #1
0
function execute_transaction($transInfo, $mode)
{
    $processor = new processor_class($mode);
    return $processor->process_transaction($transInfo);
}
コード例 #2
0
 function processRebill()
 {
     $error = NULL;
     if (!$this->row) {
         $error = array("status" => "Transaction not found");
     }
     if ($this->row['subscriptionTable']['ss_ID'] == "") {
         $error = array("status" => "Subscription not found");
     }
     if (!$this->row['subscriptionTable']['ss_ID']) {
         $error = array("status" => "Subscription not found");
     }
     if (is_null($this->row['subscriptionTable']['ss_ID'])) {
         $error = array("status" => "Subscription not found");
     }
     if (is_null($this->row['rebillingTable']['rd_subaccount'])) {
         $error = array("status" => "Invalid Price Point");
     }
     if ($this->row['rebillingTable']['recur_day'] < 2) {
         $error = array("status" => "No Recur Period Set");
     }
     if (strtotime($this->row['subscriptionTable']['ss_rebill_next_date']) > time()) {
         $error = array("status" => "Subscription does not Rebill yet");
     }
     if ($error) {
         $this->process_failed_rebill($error['status']);
         return $error;
     }
     $islive = "Live";
     $transArr = $this->buildTrans();
     $this->setActive();
     $supported_banks = bank_ChooseSupported($this->row['subscriptionTable']['ss_billing_type'], $transArr['en_ID'], $transArr['bank_id']);
     $transArr['bank_id'] = $supported_banks['chosen'];
     $processor = new processor_class('Live');
     $response = $processor->process_transaction($transArr);
     //$response = execute_transaction(&$transArr,$islive);
     if ($response['status'] == 'A' || $response['status'] == 'P') {
         $this->process_successful_rebill($response);
     } else {
         $this->process_failed_rebill($response);
     }
     $this->row = $this->getRow();
     // Update Status
     if (strtotime($this->row['subscriptionTable']['ss_rebill_next_date']) < time() + 24 * 60 * 60) {
         dieLog("ERROR: subscription to rebill in less than a day!! " . $this->row['subscriptionTable']['ss_rebill_next_date'] . print_r($this, true));
     }
     return $response;
 }