/**
  * Finishes construction given the parent form section and this form section's name
  * @param EE_Form_Section_Proper $parent_form_section
  * @param string 	$name
  * @throws EE_Error
  */
 public function _construct_finalize($parent_form_section, $name)
 {
     if (!$this->_payment_method_type instanceof EE_PMT_Base) {
         throw new EE_Error(sprintf(__('Payment Method forms must have set their payment method type BEFORE calling _construct_finalize', 'event_espresso')));
     }
     //set the name of this form based on the payment method type
     if (!$this->_name && !$name) {
         $name = str_replace(" ", "_", ucwords(str_replace("_", " ", $this->_payment_method_type->system_name()))) . "_Settings_Form";
     }
     parent::_construct_finalize($parent_form_section, $name);
 }
 /**
  * Gets all the currencies which can be used by that payment method type
  * @param EE_PMT_Base $payment_method_type
  * @return EE_Currency[]
  */
 public function get_all_currencies_usable_by($payment_method_type)
 {
     if ($payment_method_type instanceof EE_PMT_Base && $payment_method_type->get_gateway()) {
         $currencies_supported = $payment_method_type->get_gateway()->currencies_supported();
     } else {
         $currencies_supported = EE_Gateway::all_currencies_supported;
     }
     if ($currencies_supported == EE_Gateway::all_currencies_supported || empty($currencies_supported)) {
         $currencies = $this->get_all_active();
     } else {
         $currencies = $this->get_all_active(array(array('CUR_code' => array('IN', $currencies_supported))));
     }
     return $currencies;
 }
 /**
  *
  * @param EE_Payment_Method $pm_instance
  * @return EE_PMT_Invoice
  */
 public function __construct($pm_instance = NULL)
 {
     $this->_pretty_name = __("Invoice", 'event_espresso');
     $this->_default_description = __('After clicking "Finalize Registration", you will be given instructions on how to access your invoice and complete your payment.', 'event_espresso');
     parent::__construct($pm_instance);
     $this->_default_button_url = $this->file_url() . 'lib' . DS . 'invoice-logo.png';
 }
 /**
  * Constructs and initializes an Event Espresso payment method
  *
  * @param EE_Payment_Method $pm_instance
  */
 public function __construct($pm_instance = null)
 {
     $this->_gateway = new Pronamic_WP_Pay_Extensions_EventEspresso_Gateway();
     $this->_pretty_name = __('Pronamic', 'pronamic_ideal');
     $this->_default_button_url = plugins_url('images/ideal/ee-4-icon.png', Pronamic_WP_Pay_Plugin::$file);
     parent::__construct($pm_instance);
 }
 /**
  *
  * @param EE_Payment_Method $pm_instance
  * @return EE_PMT_Mock_Onsite
  */
 public function __construct($pm_instance = NULL)
 {
     require_once $this->file_folder() . 'EEG_Mock_Onsite.gateway.php';
     $this->_gateway = new EEG_Mock_Onsite();
     $this->_pretty_name = __("Mock Onsite", 'event_espresso');
     parent::__construct($pm_instance);
 }
 /**
  *
  * @param EE_Payment_Method $pm_instance
  * @return EE_PMT_Bank
  */
 public function __construct($pm_instance = NULL)
 {
     $this->_pretty_name = __("Bank", 'event_espresso');
     parent::__construct($pm_instance);
     $this->_default_button_url = $this->file_url() . 'lib' . DS . 'bank-logo.png';
     $this->_default_description = __('Make payment using an electronic funds transfer from your bank.', 'event_espresso');
 }
 /**
  *
  * @param EE_Payment_Method $pm_instance
  * @return EE_PMT_New_Payment_Method_Offsite
  */
 public function __construct($pm_instance = NULL)
 {
     require_once $this->file_folder() . 'EEG_New_Payment_Method_Offsite.gateway.php';
     $this->_gateway = new EEG_New_Payment_Method_Offsite();
     $this->_pretty_name = __("New Payment Method Offsite", 'event_espresso');
     parent::__construct($pm_instance);
 }
 /**
  *
  * @param EE_Payment_Method $pm_instance
  * @return EE_PMT_Mijireh
  */
 public function __construct($pm_instance = NULL)
 {
     require_once $this->file_folder() . 'EEG_Mijireh.gateway.php';
     $this->_gateway = new EEG_Mijireh();
     $this->_pretty_name = __("Mijireh", 'event_espresso');
     $this->_default_description = __('After clicking "Finalize Registration", you will be able to enter your billing information and complete your payment.', 'event_espresso');
     parent::__construct($pm_instance);
     $this->_default_button_url = $this->file_url() . 'lib' . DS . 'mijireh-checkout-logo.png';
 }
 /**
  *
  * @param EE_Payment_Method $pm_instance
  * @return EE_PMT_Aim
  */
 public function __construct($pm_instance = NULL)
 {
     require_once $this->file_folder() . 'EEG_Aim.gateway.php';
     $this->_gateway = new EEG_AIM();
     $this->_pretty_name = __("Authorize.net AIM", 'event_espresso');
     $this->_default_description = __('Please provide the following billing information.', 'event_espresso');
     $this->_requires_https = true;
     parent::__construct($pm_instance);
 }
 /**
  * Logic to be accomplished when the payment attempt is complete.
  * Most payment methods don't need to do anything at this point; but some, like Mijireh, do.
  * (Mijireh is an offsite gateway which doesn't send an IPN. So when the user returns to EE from
  * mijireh, this method needs to be called so the Mijireh PM can ping Mijireh to know the status
  * of the payment). Fed a transaction because it's always assumed to be the last payment that
  *
  * @param EE_Transaction $transaction
  * @return EE_Payment
  * @throws \EE_Error
  */
 public function finalize_payment_for($transaction)
 {
     // PayPal standard actually sends the IPN info along with the user when they return to our site
     // so in case the IPN is arriving later, let's try to process an IPN!
     if ($_SERVER['REQUEST_METHOD'] === 'POST') {
         return $this->handle_ipn($_POST, $transaction);
     } else {
         return parent::finalize_payment_for($transaction);
     }
 }
 /**
  * Overrides parent so we always have all billing inputs in the returned array,
  * not just the ones included at the time. This helps simplify the gateway code
  * @param type $billing_form
  * @return array
  */
 protected function _get_billing_values_from_form($billing_form)
 {
     $all_billing_values_empty = array();
     foreach (array_keys($this->billing_input_names()) as $input_name) {
         $all_billing_values_empty[$input_name] = '';
     }
     return array_merge($all_billing_values_empty, parent::_get_billing_values_from_form($billing_form));
 }
 /**
  * Overrides parent's _get_billing_values_from_form because we want to
  * get the country's 2-character ISO code, not the name like most gateways
  * @param EE_Billing_Info_Form $billing_form
  * @return array
  */
 protected function _get_billing_values_from_form($billing_form)
 {
     $billing_values = parent::_get_billing_values_from_form($billing_form);
     $billing_values['country'] = $billing_form->get_input_value('country');
     $billing_values['credit_card_type'] = $billing_form->get_input_value('credit_card_type');
     return $billing_values;
 }
 /**
  * Creates a payment method of the specified type. Does not save it.
  *
  * @global WP_User    $current_user
  * @param EE_PMT_Base $pm_type_obj
  * @return EE_Payment_Method
  * @throws \EE_Error
  */
 public function create_payment_method_of_type($pm_type_obj)
 {
     global $current_user;
     $payment_method = EE_Payment_Method::new_instance(array('PMD_type' => $pm_type_obj->system_name(), 'PMD_name' => $pm_type_obj->pretty_name(), 'PMD_admin_name' => $pm_type_obj->pretty_name(), 'PMD_slug' => $pm_type_obj->system_name(), 'PMD_wp_user' => $current_user->ID, 'PMD_order' => EEM_Payment_Method::instance()->count(array(array('PMD_type' => array('!=', 'Admin_Only')))) * 10));
     return $payment_method;
 }
 /**
  *
  * @param EE_Payment_Method $pm_instance
  * @return EE_PMT_Admin_Only
  */
 public function __construct($pm_instance = NULL)
 {
     $this->_pretty_name = __("Admin Only", 'event_espresso');
     $this->_default_button_url = '';
     parent::__construct($pm_instance);
 }
 /**
  * Adjust the billing form data.
  * Need Country and State abbreviations, not full names.
  *
  * @param billing_form
  * @return array
  */
 protected function _get_billing_values_from_form($billing_form)
 {
     $billing_values = parent::_get_billing_values_from_form($billing_form);
     $billing_values['country'] = $billing_form->get_input_value('country');
     $state = EEM_State::instance()->get_col(array(array('STA_name' => $billing_values['state']), 'limit' => 1), 'STA_abbrev');
     $billing_values['state'] = $state[0];
     return $billing_values;
 }