/** * Ipn::two_checkout() * * Validate Two Checkout payments * * @access public * @return void */ public function two_checkout() { // Include the paypal library include_once APPPATH . 'libraries/payment/TwoCo.php'; $this->_gateway = 3; $gate = $this->db->get_where('gateways', array('name' => 'twoco'))->row(); $gate_conf = json_decode($gate->settings); // Create an instance of the authorize.net library $my2_co = new TwoCo(); // Log the IPN results // $my2_co->ipn_log = TRUE; // Specify your authorize login and secret $my2_co->set_secret($gate_conf['secret_id']); // Enable test mode if needed $my2_co->enable_test_mode(); // Check validity and write down it if ($my2_co->validate_ipn()) { $settings = json_decode(base64_decode($my2_co->ipn_data['custom'])); if ($settings['type'] == 'reg') { $this->_new_user_payment($settings['user_id'], $my2_co->ipn_data['total']); redirect('/user/pay_complete'); } redirect('/user/pay_cancel'); } else { $this->_log_error($my2_co->ipn_data); redirect('/user/pay_cancel'); } }