/** * Processes a direct refund request, saves the payment, and updates the transaction appropriately. * * @param EE_Payment_Method $payment_method * @param EE_Payment $payment_to_refund * @param array $refund_info * @return EE_Payment * @throws \EE_Error */ public function process_refund(EE_Payment_Method $payment_method, EE_Payment $payment_to_refund, $refund_info = array()) { if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds()) { $payment_method->type_obj()->process_refund($payment_to_refund, $refund_info); $this->update_txn_based_on_payment($payment_to_refund->transaction(), $payment_to_refund); } return $payment_to_refund; }
/** * _update_payment_method_button * * @access protected * @param \EE_Payment_Method $payment_method * @return \EE_Form_Section_HTML */ protected function _payment_method_settings(EE_Payment_Method $payment_method) { //modify the form so we only have/show fields that will be implemented for this version return $this->_simplify_form($payment_method->type_obj()->settings_form(), $payment_method->name()); }
/** * _get_return_url * * @access protected * @param \EE_Payment_Method $payment_method * @return string */ protected function _get_return_url(EE_Payment_Method $payment_method) { $return_url = ''; switch ($payment_method->type_obj()->payment_occurs()) { case EE_PMT_Base::offsite: $return_url = add_query_arg(array('action' => 'process_gateway_response', 'selected_method_of_payment' => $this->checkout->selected_method_of_payment, 'spco_txn' => $this->checkout->transaction->ID()), $this->reg_step_url()); break; case EE_PMT_Base::onsite: case EE_PMT_Base::offline: $return_url = $this->checkout->next_step->reg_step_url(); break; } return $return_url; }
/** * Gets the postmeta key that holds this attendee's billing info for the * specified payment method * @param EE_Payment_Method $payment_method * @return string */ public function get_billing_info_postmeta_name($payment_method) { if ($payment_method->type_obj() instanceof EE_PMT_Base) { return 'billing_info_' . $payment_method->type_obj()->system_name(); } else { return NULL; } }
/** * Sets the initial payment method properties (including extra meta) * * @param EE_Payment_Method $payment_method * @return EE_Payment_Method * @throws \EE_Error */ public function initialize_payment_method($payment_method) { $pm_type_obj = $payment_method->type_obj(); $payment_method->set_description($pm_type_obj->default_description()); if (!$payment_method->button_url()) { $payment_method->set_button_url($pm_type_obj->default_button_url()); } //now add setup its default extra meta properties $extra_metas = $pm_type_obj->settings_form()->extra_meta_inputs(); if (!empty($extra_metas)) { //verify the payment method has an ID before adding extra meta if (!$payment_method->ID()) { $payment_method->save(); } foreach ($extra_metas as $meta_name => $input) { $payment_method->update_extra_meta($meta_name, $input->raw_value()); } } return $payment_method; }