コード例 #1
0
ファイル: et-authorize.php プロジェクト: maratdev/alllancer
 function __construct($settings = array(), $mode)
 {
     $this->_x_test_request = ET_Payment::get_payment_test_mode();
     $api = ET_Authorize::get_api();
     if ($this->_x_test_request) {
         $this->_post_location = 'https://test.authorize.net/gateway/transact.dll';
     } else {
         $this->_post_location = 'https://secure.authorize.net/gateway/transact.dll ';
     }
     $this->_login = $api['x_login'];
     $this->_md5_hash = $api['x_MD5_hash'];
     $this->_transaction_key = $api['x_transaction_key'];
     $this->_x_method = 'cc';
     $this->_x_show_form = 'payment_form';
     $default_settings = array('return' => 'http://localhost', 'cancel' => 'http://localhost');
     $settings = wp_parse_args($settings, $default_settings);
     $this->_x_receipt_link_url = $settings['return'];
 }
コード例 #2
0
 function do_checkout(ET_Order $order)
 {
     $md5 = isset($_REQUEST['x_MD5_Hash']) ? $_REQUEST['x_MD5_Hash'] : '';
     $amount = isset($_REQUEST['x_amount']) ? $_REQUEST['x_amount'] : '';
     $trans_id = isset($_REQUEST['x_trans_id']) ? $_REQUEST['x_trans_id'] : '';
     $payment = new ET_Authorize($this->_settings, 1);
     if ($md5 == $payment->generate_hash($amount, $trans_id)) {
         $this->_order->set_status('publish');
         $this->_order->update_order();
         return array('ACK' => true, 'payment' => 'authorize', 'payment_status' => 'Completed');
     } else {
         return array('ACK' => false, 'payment' => 'authorize', 'payment_status' => 'error');
     }
 }