コード例 #1
0
ファイル: Ipn.php プロジェクト: rexcarnation/XtraUpload-1
 /**
  * Ipn::authorize()
  *
  * Validate Authorize payments
  *
  * @access	public
  * @return	void
  */
 public function authorize()
 {
     // make sure there are no timeouts...
     echo lang('Processing...');
     flush();
     $gate = $this->db->get_where('gateways', array('name' => 'authorize'))->row();
     $gate_conf = json_decode($gate->settings);
     // Include the paypal library
     include_once APPPATH . 'libraries/payment/Authorize.php';
     $this->_gateway = 2;
     // Create an instance of the authorize.net library
     $my_authorize = new Authorize();
     // Log the IPN results
     // $my_authorize->ipn_log = TRUE;
     // Specify your authorize login and secret
     $my_authorize->set_user_info($gate_conf['login'], $gate_conf['secret']);
     // Enable test mode if needed
     $my_authorize->enable_test_mode();
     // Check validity and write down it
     if ($my_authorize->validate_ipn()) {
         $settings = json_decode(base64_decode($my_authorize->ipn_data['x_Cust_ID']));
         if ($settings['type'] == 'reg') {
             $this->_new_user_payment($settings['user_id'], $my_authorize->ipn_data['x_Amount']);
             redirect('/user/pay_complete');
         }
         redirect('/user/pay_cancel');
     } else {
         $this->_log_error($my_authorize->ipn_data);
         redirect('/user/pay_cancel');
     }
 }