示例#1
0
 public static function instance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
 function AuthorizeAIMVoid($TransactionID)
 {
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_osemsc' . DS . 'libraries' . DS . 'class.connection.php';
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_osemsc' . DS . 'libraries' . DS . 'Authnet.class.php';
     $pConfig = oseMscConfig::getConfig('payment', 'obj');
     if (empty($pConfig->an_loginid) || empty($pConfig->an_transkey)) {
         return false;
     }
     if (!isset($pConfig->cc_testmode) || $pConfig->cc_testmode == true) {
         $test_mode = true;
     } else {
         $test_mode = false;
     }
     $subdomain = $test_mode ? 'test' : 'secure';
     $cc_payment = Authnet::instance();
     $cc_payment->url = $subdomain . ".authorize.net";
     $cc_payment->setParameter('x_login', $pConfig->an_loginid);
     $cc_payment->setParameter('x_tran_key', $pConfig->an_transkey);
     $cc_payment->setParameter('x_email_customer', $pConfig->an_email_customer);
     $cc_payment->setParameter('x_merchant_email', $pConfig->an_merchant_email);
     $cc_payment->setParameter('x_email_merchant', $pConfig->an_email_merchant);
     $cc_payment->setTransactionType('VOID');
     $cc_payment->setParameter('x_trans_id', $TransactionID);
     $cc_payment->process();
     $return['isApproved'] = $cc_payment->isApproved();
     $return['ResponseText'] = $cc_payment->getResponseText();
     return $return;
 }