/**
  * Override's parent so this gateway integration class can act like one that uses
  * a separate IPN or not, depending on what is set in the payment methods settings form
  * @return boolean
  */
 public function uses_separate_IPN_request()
 {
     if ($this->_override_use_separate_IPN_request !== null) {
         $this->set_uses_separate_IPN_request($this->_override_use_separate_IPN_request);
     }
     return parent::uses_separate_IPN_request();
 }
 /**
  * Constructs and initialize iDEAL gateway
  *
  * @param EEM_Gateways $model
  */
 public function __construct(EEM_Gateways $model)
 {
     $this->_gateway_name = 'pronamic_pay_ideal';
     $this->_path = str_replace('\\', '/', __FILE__);
     $this->_btn_img = plugins_url('images/ideal/ee-4-icon.png', Pronamic_WP_Pay_Plugin::$file);
     // @see https://github.com/eventespresso/event-espresso-core/blob/4.2.2.reg/core/db_classes/EE_Offsite_Gateway.class.php#L4
     // @see https://github.com/eventespresso/event-espresso-core/blob/4.2.2.reg/core/db_classes/EE_Gateway.class.php#L26
     parent::__construct($model);
 }
 /**
  * Also sets the gateway url class variable based on whether debug mode is enabled or not
  * @param array $settings_array
  */
 public function set_settings($settings_array)
 {
     parent::set_settings($settings_array);
     if ($this->_debug_mode) {
         $this->_gateway_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
     } else {
         $this->_gateway_url = 'https://www.paypal.com/cgi-bin/webscr';
     }
 }
 protected function __construct(EEM_Gateways &$model)
 {
     $this->_gateway_name = 'Paypal_Standard';
     $this->_button_base = 'paypal-logo.png';
     $this->_path = str_replace('\\', '/', __FILE__);
     $this->addField('rm', '2');
     // Return method = POST
     $this->addField('cmd', '_xclick');
     parent::__construct($model);
     if (!$this->_payment_settings['use_sandbox']) {
         $this->_gatewayUrl = 'https://www.paypal.com/cgi-bin/webscr';
     } else {
         $this->_gatewayUrl = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
     }
 }
 /**
  * _process_off_site_payment
  *
  * @access private
  * @param \EE_Offsite_Gateway $gateway
  * @return \EE_Payment
  */
 private function _process_off_site_payment(EE_Offsite_Gateway $gateway)
 {
     try {
         // if gateway uses_separate_IPN_request, then we don't have to process the IPN manually
         if ($gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request()) {
             $payment = $this->checkout->transaction->last_payment();
             //$payment_source = 'last_payment';
         } else {
             // get payment details and process results
             /** @type EE_Payment_Processor $payment_processor */
             $payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
             $payment = $payment_processor->process_ipn($_REQUEST, $this->checkout->transaction, $this->checkout->payment_method, true, false);
             //$payment_source = 'process_ipn';
         }
     } catch (Exception $e) {
         // let's just eat the exception and try to move on using any previously set payment info
         $payment = $this->checkout->transaction->last_payment();
         //$payment_source = 'last_payment after Exception';
         // but if we STILL don't have a payment object
         if (!$payment instanceof EE_Payment) {
             // then we'll object ! ( not object like a thing... but object like what a lawyer says ! )
             $this->_handle_payment_processor_exception($e);
         }
     }
     // DEBUG LOG
     //$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__,
     //	array(
     //		'process_ipn_payment' => $payment,
     //		'payment_source'      => $payment_source,
     //	)
     //);
     return $payment;
 }