/** * Processes a payment using this Gateway */ public function process($order, $options) { if (isset($options['config_id'])) { $config_id = $options['config_id']; $gateway = Pronamic_WP_Pay_Plugin::get_gateway($config_id); if ($gateway) { $data = new Pronamic_WP_Pay_Extensions_AppThemes_PaymentData($order); if (filter_has_var(INPUT_POST, 'appthemes_pronamic_ideal')) { $payment = Pronamic_WP_Pay_Plugin::start($config_id, $gateway, $data); $error = $gateway->get_error(); if (is_wp_error($error)) { foreach ($error->get_error_messages() as $message) { echo $message; } } else { $gateway->redirect($payment); } } else { ?> <form method="post" action=""> <?php echo $gateway->get_input_html(); ?> <p> <?php printf('<input class="ideal-button" type="submit" name="appthemes_pronamic_ideal" value="%s" />', __('Pay with iDEAL', 'pronamic_ideal')); ?> </p> </form> <?php } } } }
/** * Acquirrer field input * * @param string $field_content * @param string $field * @param string $value * @param string $lead_id * @param string $form_id */ public static function acquirer_field_input($field_content, $field, $value, $lead_id, $form_id) { $type = RGFormsModel::get_input_type($field); if (Pronamic_WP_Pay_Extensions_GravityForms_IssuerDropDown::TYPE === $type) { $id = $field['id']; $field_id = IS_ADMIN || 0 === $form_id ? "input_{$id}" : 'input_' . $form_id . "_{$id}"; $class_suffix = RG_CURRENT_VIEW === 'entry' ? '_admin' : ''; $size = rgar($field, 'size'); $class = $size . $class_suffix; $css_class = trim(esc_attr($class) . ' gfield_ideal_acquirer_select'); $tab_index = GFCommon::get_tabindex(); $disabled_text = IS_ADMIN && 'entry' !== RG_CURRENT_VIEW ? "disabled='disabled'" : ''; $html = ''; $feed = get_pronamic_gf_pay_conditioned_feed_by_form_id($form_id, true); /** * Developing warning: * Don't use single quotes in the HTML you output, it is buggy in combination with SACK */ if (IS_ADMIN) { if (null === $feed) { $html .= sprintf("<a class='ideal-edit-link' href='%s' target='_blank'>%s</a>", add_query_arg('post_type', 'pronamic_pay_gf', admin_url('post-new.php')), __('Create iDEAL feed', 'pronamic_ideal')); } else { $html .= sprintf("<a class='ideal-edit-link' href='%s' target='_blank'>%s</a>", get_edit_post_link($feed->id), __('Edit iDEAL feed', 'pronamic_ideal')); } } $html_input = ''; $html_error = ''; if (null !== $feed) { $gateway = Pronamic_WP_Pay_Plugin::get_gateway($feed->config_id); if ($gateway) { $issuer_field = $gateway->get_issuer_field(); $error = $gateway->get_error(); if (is_wp_error($error)) { $html_error .= Pronamic_WP_Pay_Plugin::get_default_error_message(); $html_error .= '<br /><em>' . $error->get_error_message() . '</em>'; } elseif ($issuer_field) { $choices = $issuer_field['choices']; $options = Pronamic_WP_HTML_Helper::select_options_grouped($choices, $value); // Double quotes are not working, se we replace them with an single quote $options = str_replace('"', '\'', $options); $html_input = ''; $html_input .= sprintf("<select name='input_%d' id='%s' class='%s' %s %s>", $id, $field_id, $css_class, $tab_index, $disabled_text); $html_input .= sprintf('%s', $options); $html_input .= sprintf('</select>'); } } } if ($html_error) { $html .= sprintf("<div class='gfield_description validation_message'>"); $html .= sprintf('%s', $html_error); $html .= sprintf('</div>'); } else { $html .= sprintf("<div class='ginput_container ginput_ideal'>"); $html .= sprintf('%s', $html_input); $html .= sprintf('</div>'); } $field_content = $html; } return $field_content; }
public static function listen() { if (filter_has_var(INPUT_GET, 'Status') && filter_has_var(INPUT_GET, 'StatusCode') && filter_has_var(INPUT_GET, 'Merchant') && filter_has_var(INPUT_GET, 'OrderID') && filter_has_var(INPUT_GET, 'PaymentID') && filter_has_var(INPUT_GET, 'Reference') && filter_has_var(INPUT_GET, 'TransactionID') && filter_has_var(INPUT_GET, 'Checksum')) { $reference = filter_input(INPUT_GET, 'OrderID', FILTER_SANITIZE_STRING); $payment = get_pronamic_payment($reference); Pronamic_WP_Pay_Plugin::update_payment($payment); } }
public static function listen() { if (filter_has_var(INPUT_GET, 'mollie_webhook') && filter_has_var(INPUT_POST, 'id')) { $transaction_id = filter_input(INPUT_POST, 'id', FILTER_SANITIZE_STRING); $payment = get_pronamic_payment_by_transaction_id($transaction_id); Pronamic_WP_Pay_Plugin::update_payment($payment, false); } }
public static function listen() { if (filter_has_var(INPUT_POST, 'ems_notify_payment_id')) { $payment_id = filter_input(INPUT_POST, 'ems_notify_payment_id'); $payment = get_pronamic_payment($payment_id); Pronamic_WP_Pay_Plugin::update_payment($payment); } }
/** * Payment fields * * @see https://github.com/woothemes/woocommerce/blob/v1.6.6/templates/checkout/form-pay.php#L66 */ function payment_fields() { // @see https://github.com/woothemes/woocommerce/blob/v1.6.6/classes/gateways/class-wc-payment-gateway.php#L181 parent::payment_fields(); $gateway = Pronamic_WP_Pay_Plugin::get_gateway($this->config_id); if ($gateway) { echo $gateway->get_input_html(); } }
/** * Advanced inputs * * @return string */ private static function advanced_inputs() { $output = ''; $config_id = get_option(self::OPTION_CONFIG_ID); $gateway = Pronamic_WP_Pay_Plugin::get_gateway($config_id); if ($gateway) { $output = $gateway->get_input_html(); } return $output; }
public static function listen() { $data = Pronamic_WP_Pay_Gateways_Ogone_Security::get_request_data(); $data = array_change_key_case($data, CASE_UPPER); if (isset($data[Pronamic_WP_Pay_Gateways_Ogone_Parameters::NC_ERROR], $data['PAYID'], $data[Pronamic_WP_Pay_Gateways_Ogone_Parameters::ORDERID], $data[Pronamic_WP_Pay_Gateways_Ogone_Parameters::STATUS])) { $payment_id = $data[Pronamic_WP_Pay_Gateways_Ogone_Parameters::ORDERID]; $payment = get_pronamic_payment($payment_id); Pronamic_WP_Pay_Plugin::update_payment($payment); } }
public static function listen() { if (filter_has_var(INPUT_POST, 'Data') && filter_has_var(INPUT_POST, 'Seal')) { $input_data = filter_input(INPUT_POST, 'Data', FILTER_SANITIZE_STRING); $data = Pronamic_WP_Pay_Gateways_OmniKassa_Client::parse_piped_string($input_data); $transaction_reference = $data['transactionReference']; $payment = get_pronamic_payment_by_meta('_pronamic_payment_omnikassa_transaction_reference', $transaction_reference); Pronamic_WP_Pay_Plugin::update_payment($payment); } }
/** * Listen to ING Kassa Compleet webhook requests. */ public static function listen() { if (filter_has_var(INPUT_GET, 'ing_kassa_compleet_webhook')) { $data = json_decode(file_get_contents('php://input')); if (is_object($data) && isset($data->order_id)) { $payment = get_pronamic_payment_by_transaction_id($data->order_id); Pronamic_WP_Pay_Plugin::update_payment($payment, false); } } }
/** * Filters and sorting handler * * @see https://github.com/woothemes/woocommerce/blob/2.3.13/includes/admin/class-wc-admin-post-types.php#L1585-L1596 * * @param array $vars * @return array */ public function request($vars) { $screen = get_current_screen(); if (self::POST_TYPE === $screen->post_type) { if (!isset($vars['post_status'])) { $vars['post_status'] = array_keys(Pronamic_WP_Pay_Plugin::get_payment_states()); $vars['post_status'][] = 'publish'; } } return $vars; }
/** * Gets the form for all the settings related to this payment method type * * @return EE_Payment_Method_Form */ public function generate_new_settings_form() { EE_Registry::instance()->load_helper('Template'); $config_options = Pronamic_WP_Pay_Plugin::get_config_select_options(); // Fix for incorrect normalization strategy // @see https://github.com/eventespresso/event-espresso-core/blob/4.6.17.p/core/libraries/form_sections/inputs/EE_Form_Input_With_Options_Base.input.php#L89-L113 $select_option = $config_options[0]; unset($config_options[0]); $config_options = array('select' => $select_option) + $config_options; $form = new EE_Payment_Method_Form(array('extra_meta_inputs' => array('config_id' => new EE_Select_Input($config_options, array('html_label_text' => __('Configuration', 'pronamic_ideal'), 'default' => get_option('pronamic_pay_config_id'))), 'transaction_description' => new EE_Text_Input(array('html_label_text' => __('Transaction description', 'pronamic_ideal'), 'html_help_text' => sprintf(__('Available tags: %s', 'pronamic_ideal'), sprintf('<code>%s</code>', '{transaction_id}')), 'default' => __('Event Espresso transaction {transaction_id}', 'pronamic_ideal')))))); return $form; }
/** * Form gateway fields. * * @see https://github.com/Charitable/Charitable/blob/1.4.5/includes/donations/class-charitable-donation-form.php#L387 * @since 1.0.2 */ public static function form_gateway_fields($fields, $gateway) { if (get_class() === get_class($gateway)) { $payment_method = $gateway->payment_method; $config_id = $gateway->get_value('config_id'); $gateway = Pronamic_WP_Pay_Plugin::get_gateway($config_id); if ($gateway) { $gateway->set_payment_method($payment_method); $fields['pronamic-pay-input-html'] = array('type' => '', 'gateway' => $gateway); } } return $fields; }
/** * Get the gateway for this field. * * @return */ private function get_gateway() { $gateway = null; if (isset($this->pronamicPayConfigId) && !empty($this->pronamicPayConfigId)) { $gateway = Pronamic_WP_Pay_Plugin::get_gateway($this->pronamicPayConfigId); } if (!$gateway) { $feeds = get_pronamic_gf_pay_feeds_by_form_id($this->formId); foreach ($feeds as $feed) { $gateway = Pronamic_WP_Pay_Plugin::get_gateway($feed->config_id); if ($gateway && null !== $gateway->get_payment_method_field()) { return $gateway; } } } return $gateway; }
public static function listen() { // Also check for typo 'xml_notifaction', as this has been used in the past. if (filter_has_var(INPUT_GET, 'xml_notification') || filter_has_var(INPUT_GET, 'xml_notifaction')) { $data = file_get_contents('php://input'); $xml = Pronamic_WP_Util::simplexml_load_string($data); if (!is_wp_error($xml)) { $notification = Pronamic_WP_Pay_Gateways_IDealBasic_XML_NotificationParser::parse($xml); $purchase_id = $notification->get_purchase_id(); $payment = get_pronamic_payment_by_meta('_pronamic_payment_purchase_id', $purchase_id); if ($payment) { $payment->set_transaction_id($notification->get_transaction_id()); $payment->set_status($notification->get_status()); Pronamic_WP_Pay_Plugin::update_payment($payment); } } } }
/** * Process donation. * * @since 1.0.0 * @param mixed $return * @param int $donation_id * @param Charitable_Donation_Processor $processor * @param string $gateway * @return mixed array or boolean */ public static function pronamic_process_donation($return, $donation_id, $processor, $charitable_gateway) { $payment_method = $charitable_gateway->payment_method; $config_id = $charitable_gateway->get_value('config_id'); $gateway = Pronamic_WP_Pay_Plugin::get_gateway($config_id); if (!$gateway) { return false; } // Data $data = new Pronamic_WP_Pay_Extensions_Charitable_PaymentData($donation_id, $processor, $charitable_gateway); $gateway->set_payment_method($payment_method); $payment = Pronamic_WP_Pay_Plugin::start($config_id, $gateway, $data, $payment_method); $error = $gateway->get_error(); if (is_wp_error($error)) { charitable_get_notices()->add_error($error->get_error_message()); return false; } return array('redirect' => $payment->get_pay_redirect_url(), 'safe' => false); }
/** * Set redirection info * * @see https://github.com/eventespresso/event-espresso-core/blob/4.6.17.p/core/libraries/payment_methods/EE_Offsite_Gateway.lib.php#L51-L59 * * @param EEI_Payment $payment * @param type $billing_info * @param type $return_url * @param type $cancel_url */ public function set_redirection_info($ee_payment, $billing_info = array(), $return_url = null, $notify_url = null, $cancel_url = null) { $pronamic_gateway = Pronamic_WP_Pay_Plugin::get_gateway($this->_config_id); if ($pronamic_gateway) { $transaction = $ee_payment->transaction(); $total_line_item = $transaction->total_line_item(); $data = new Pronamic_WP_Pay_Extensions_EventEspresso_PaymentData($this, $total_line_item, $transaction); $pronamic_payment = Pronamic_WP_Pay_Plugin::start($this->_config_id, $pronamic_gateway, $data); $error = $pronamic_gateway->get_error(); if (is_wp_error($error)) { // @see https://github.com/eventespresso/event-espresso-core/blob/4.6.18.p/caffeinated/payment_methods/Mijireh/EEG_Mijireh.gateway.php#L147 $error_message = sprintf(__('Errors communicating with gateway: %s', 'pronamic_ideal'), implode(',', $error->get_error_messages())); EE_Error::add_error($error_message, __FILE__, __FUNCTION__, __LINE__); throw new EE_Error($error_message); } else { update_post_meta($pronamic_payment->get_id(), '_pronamic_payment_url_return', $return_url); update_post_meta($pronamic_payment->get_id(), '_pronamic_payment_url_success', $return_url); update_post_meta($pronamic_payment->get_id(), '_pronamic_payment_url_cancel', $cancel_url); update_post_meta($pronamic_payment->get_id(), '_pronamic_payment_url_error', $cancel_url); $redirect_url = $pronamic_payment->get_action_url(); $redirect_args = $pronamic_gateway->get_output_fields(); /* * Since Event Espresso uses an HTML form to redirect users to the payment gateway * we have to make sure an POST method is used when the redirect URL has query arguments. * Otheriwse the URL query arguments will be stripped by the users webbrowser. * Herefor we have to make sure the redirect arguments array is not empty. * * @see https://github.com/eventespresso/event-espresso-core/blob/4.6.18.p/core/db_classes/EE_Payment.class.php#L547 * @see http://stackoverflow.com/q/1116019 */ if (false !== strpos($redirect_url, '?') && empty($redirect_args)) { $redirect_args[] = ''; } $ee_payment->set_redirect_url($redirect_url); $ee_payment->set_redirect_args($redirect_args); } } else { $error = Pronamic_WP_Pay_Plugin::get_default_error_message(); // @see https://github.com/eventespresso/event-espresso-core/blob/4.6.18.p/caffeinated/payment_methods/Mijireh/EEG_Mijireh.gateway.php#L147 throw new EE_Error($error); } return $ee_payment; }
/** * Initialize */ public function init() { global $pronamic_pay_errors; $pronamic_pay_errors = array(); if (filter_has_var(INPUT_POST, 'pronamic_pay_nonce')) { $nonce = filter_input(INPUT_POST, 'pronamic_pay_nonce', FILTER_SANITIZE_STRING); if (wp_verify_nonce($nonce, 'pronamic_pay')) { $id = filter_input(INPUT_POST, 'pronamic_pay_form_id', FILTER_VALIDATE_INT); $config_id = get_post_meta($id, '_pronamic_payment_form_config_id', true); $valid = $this->validate(); if ($valid) { $gateway = Pronamic_WP_Pay_Plugin::get_gateway($config_id); if ($gateway) { $data = new Pronamic_WP_Pay_PaymentFormData(); $payment = Pronamic_WP_Pay_Plugin::start($config_id, $gateway, $data); $error = $gateway->get_error(); if (is_wp_error($error)) { Pronamic_WP_Pay_Plugin::render_errors($error); } else { // @see https://github.com/WordImpress/Give/blob/1.1/includes/payments/functions.php#L172-L178 // @see https://github.com/woothemes/woocommerce/blob/2.4.3/includes/wc-user-functions.php#L36-L118 $first_name = filter_input(INPUT_POST, 'pronamic_pay_first_name', FILTER_SANITIZE_STRING); $last_name = filter_input(INPUT_POST, 'pronamic_pay_last_name', FILTER_SANITIZE_STRING); $email = filter_input(INPUT_POST, 'pronamic_pay_email', FILTER_VALIDATE_EMAIL); $user = get_user_by('email', $email); if (!$user) { // Make a random string for password $password = wp_generate_password(10); // Make a user with the username as the email $user_id = wp_insert_user(array('user_login' => $email, 'user_pass' => $password, 'user_email' => $email, 'role' => 'payer', 'first_name' => $first_name, 'last_name' => $last_name)); // User $user = new WP_User($user_id); } wp_update_post(array('ID' => $payment->post->ID, 'post_author' => $user->ID)); $gateway->redirect($payment); } exit; } } } } }
/** * Admin notices * * @see https://github.com/WordPress/WordPress/blob/4.3.1/wp-admin/admin-header.php#L245-L250 */ public function admin_notices() { $screen = get_current_screen(); // Jetpack if ('jetpack' === $screen->parent_base) { return; } // License notice if ('valid' !== get_option('pronamic_pay_license_status')) { $class = Pronamic_WP_Pay_Plugin::get_number_payments() > 20 ? 'error' : 'updated'; printf('<div class="%s"><p>%s</p></div>', esc_attr($class), sprintf(__('<strong>Pronamic iDEAL</strong> — You have not <a href="%s">entered a (valid) Pronamic iDEAL support license key</a>, please get your license key at <a href="%s" target="_blank">Pronamic.eu</a>.', 'pronamic_ideal'), add_query_arg('page', 'pronamic_pay_settings', get_admin_url(null, 'admin.php')), 'http://www.pronamic.eu/plugins/pronamic-ideal/')); } // Stored notices $notices = get_option('pronamic_pay_admin_notices', array()); foreach ($notices as $name) { $file = plugin_dir_path(Pronamic_WP_Pay_Plugin::$file) . 'admin/notice-' . $name . '.php'; if (is_readable($file)) { include $file; } } }
/** * Submit to gateway */ public function submit() { $config_id = get_option(Pronamic_WP_Pay_Extensions_WPeCommerce_Extension::OPTION_CONFIG_ID); // Set process to 'order_received' (2) // @see http://plugins.trac.wordpress.org/browser/wp-e-commerce/tags/3.8.7.6.2/wpsc-includes/merchant.class.php#L301 // @see http://plugins.trac.wordpress.org/browser/wp-e-commerce/tags/3.8.7.6.2/wpsc-core/wpsc-functions.php#L115 $this->set_purchase_processed_by_purchid(Pronamic_WP_Pay_Extensions_WPeCommerce_WPeCommerce::PURCHASE_STATUS_ORDER_RECEIVED); $gateway = Pronamic_WP_Pay_Plugin::get_gateway($config_id); if ($gateway) { $data = new Pronamic_WP_Pay_Extensions_WPeCommerce_PaymentData($this); $payment = Pronamic_WP_Pay_Plugin::start($config_id, $gateway, $data); update_post_meta($payment->get_id(), '_pronamic_payment_wpsc_purchase_id', $data->get_purchase_id()); update_post_meta($payment->get_id(), '_pronamic_payment_wpsc_session_id', $data->get_session_id()); $error = $gateway->get_error(); if (is_wp_error($error)) { // @todo what todo? } else { $gateway->redirect($payment); } } }
function get_pronamic_gf_pay_conditioned_feed_by_form_id($form_id, $with_ideal_issuers = false) { $feeds = get_pronamic_gf_pay_feeds_by_form_id($form_id); if (!empty($feeds)) { $form = RGFormsModel::get_form_meta($form_id); if ($with_ideal_issuers) { foreach ($feeds as $feed) { $gateway = Pronamic_WP_Pay_Plugin::get_gateway($feed->config_id); if ($gateway && null !== $gateway->get_issuers()) { return $feed; } } } else { foreach ($feeds as $feed) { if (Pronamic_WP_Pay_Extensions_GravityForms_Util::is_condition_true($form, $feed)) { return $feed; } } } } return null; }
public static function listen() { if (filter_has_var(INPUT_GET, 'buckaroo_push')) { $method = Pronamic_WP_Pay_Server::get('REQUEST_METHOD', FILTER_SANITIZE_STRING); $data = array(); switch ($method) { case 'GET': $data = $_GET; break; case 'POST': $data = $_POST; // WPCS: CSRF OK break; } $data = array_change_key_case($data, CASE_LOWER); if (isset($data[Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::INVOICE_NUMBER], $data[Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::STATUS_CODE])) { $payment_id = $data[Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::INVOICE_NUMBER]; $payment = get_pronamic_payment($payment_id); Pronamic_WP_Pay_Plugin::update_payment($payment); } } }
/** * Process donation. * * @param int $donation_id * @param Charitable_Donation_Processor $processor * @param string $gateway * @since 1.0.0 */ public static function process_donation($donation_id, $processor, $gateway = null) { if (null === $gateway) { $gateway = new self(); } else { $gateway = new $gateway(); } $payment_method = $gateway->payment_method; $config_id = $gateway->get_value('config_id'); $gateway = Pronamic_WP_Pay_Plugin::get_gateway($config_id); if ($gateway) { // Data $data = new Pronamic_WP_Pay_Extensions_Charitable_PaymentData($donation_id, $processor); $gateway->set_payment_method($payment_method); $payment = Pronamic_WP_Pay_Plugin::start($config_id, $gateway, $data, $payment_method); $error = $gateway->get_error(); if (!is_wp_error($error)) { // Redirect $gateway->redirect($payment); } } }
/** * Process payment start * * @param EE_Line_Item $total_line_item * @param $transaction */ public function process_payment_start(EE_Line_Item $total_line_item, $transaction = null) { if (!$transaction) { $transaction = $total_line_item->transaction(); } $config_id = $this->_payment_settings['config_id']; $gateway = Pronamic_WP_Pay_Plugin::get_gateway($config_id); if ($gateway) { $data = new Pronamic_WP_Pay_Extensions_EventEspresso_PaymentData($this, $total_line_item, $transaction); $payment = Pronamic_WP_Pay_Plugin::start($config_id, $gateway, $data); $error = $gateway->get_error(); if (!is_wp_error($error)) { $offsite_form = $this->submitPayment(); $offsite_form['form'] = $gateway->get_form_html($payment, true); $this->_EEM_Gateways->set_off_site_form($offsite_form); $this->redirect_after_reg_step_3(); } } }
/** * Check if an iDEAL payment needs to be processed. */ public static function process_payment() { $do_process_payment = filter_input(INPUT_POST, 'pronamic_ideal_process_payment', FILTER_SANITIZE_STRING); if (strlen($do_process_payment) <= 0) { return; } // Prepare transaction data $unique_hash = it_exchange_create_unique_hash(); $current_customer = it_exchange_get_current_customer(); $transaction_object = it_exchange_generate_transaction_object(); if (!$transaction_object instanceof stdClass) { return; } it_exchange_add_transient_transaction(self::$slug, $unique_hash, $current_customer->ID, $transaction_object); $configuration_id = self::get_gateway_configuration_id(); $gateway = Pronamic_WP_Pay_Plugin::get_gateway($configuration_id); if ($gateway) { $data = new Pronamic_WP_Pay_Extensions_IThemesExchange_PaymentData($unique_hash, $transaction_object); $payment = Pronamic_WP_Pay_Plugin::start($configuration_id, $gateway, $data); $gateway->redirect($payment); exit; } }
<?php global $pronamic_pay_errors; $config_id = get_post_meta($id, '_pronamic_payment_form_config_id', true); $button_text = get_post_meta($id, '_pronamic_payment_form_button_text', true); $button_text = empty($button_text) ? __('Pay Now', 'pronamic_ideal') : $button_text; $amount_method = get_post_meta($id, '_pronamic_payment_form_amount_method', true); $amount_choices = get_post_meta($id, '_pronamic_payment_form_amount_choices', true); $methods_with_choices = array(Pronamic_WP_Pay_Admin_FormPostType::AMOUNT_METHOD_CHOICES_ONLY, Pronamic_WP_Pay_Admin_FormPostType::AMOUNT_METHOD_CHOICES_AND_INPUT); $gateway = Pronamic_WP_Pay_Plugin::get_gateway($config_id); if ($gateway) { ?> <div class="pronamic-pay-form-wrap"> <?php if (!is_singular('pronamic_pay_form')) { ?> <h2 class="pronamic-pay-form-title"><?php echo esc_html(get_the_title($id)); ?> </h2> <?php } ?> <form id="pronamic-pay-form-<?php echo esc_attr($id); ?>
/** * Purchase button * * @see http://plugins.trac.wordpress.org/browser/membership/tags/3.4.4.1/membershipincludes/includes/payment.form.php#L78 * * @param M_Subscription $subscription * @see http://plugins.trac.wordpress.org/browser/membership/tags/3.4.4.1/membershipincludes/classes/class.subscription.php * * @param array $pricing * @see http://plugins.trac.wordpress.org/browser/membership/tags/3.4.4.1/membershipincludes/classes/class.subscription.php#L110 * * array( * array( * 'period' => '1', * 'amount' => '50.00', * 'type' => 'indefinite', * 'unit' => 'm' * ) * ) * * @param int $user_id WordPress user/member ID */ public function purchase_button($subscription, $pricing, $user_id) { if (Pronamic_WP_Pay_Extensions_WPMUDEV_Membership_Membership::is_pricing_free($pricing)) { // @todo what todo? return; } else { $membership = Pronamic_WP_Pay_Extensions_WPMUDEV_Membership_Membership::get_membership($user_id); $config_id = get_option(Pronamic_WP_Pay_Extensions_WPMUDEV_Membership_Extension::OPTION_CONFIG_ID); $data = new Pronamic_WP_Pay_Extensions_WPMUDEV_Membership_PaymentData($subscription, $membership); $gateway = Pronamic_WP_Pay_Plugin::get_gateway($config_id); $gateway->set_payment_method($this->payment_method); if ($gateway) { // @see http://plugins.trac.wordpress.org/browser/membership/tags/3.4.4.1/membershipincludes/classes/membershipadmin.php#K2908 if ('new' === strtolower(Pronamic_WP_Pay_Extensions_WPMUDEV_Membership_Membership::get_option('formtype'))) { $action = add_query_arg(array('action' => 'buynow', 'subscription' => $data->get_subscription_id()), admin_url('admin-ajax.php')); } else { $action = '#pronamic-pay-form'; } printf('<form id="pronamic-pay-form" method="post" action="%s">', $action); printf('<img src="%s" alt="%s" />', esc_attr(plugins_url('images/ideal-logo-pay-off-2-lines.png', Pronamic_WP_Pay_Plugin::$file)), esc_attr__('iDEAL - Online payment through your own bank', 'pronamic_ideal')); echo '<div style="margin-top: 1em;">'; echo $gateway->get_input_html(); // Data $fields = array('subscription_id' => $data->get_subscription_id(), 'user_id' => $user_id); // Coupon if (function_exists('membership_get_current_coupon')) { $coupon = membership_get_current_coupon(); if ($coupon) { $fields['coupon_code'] = $coupon->get_coupon_code(); } } echo Pronamic_IDeal_IDeal::htmlHiddenFields($fields); // Submit button printf('<input type="submit" name="pronamic_pay_membership_%s" value="%s" />', esc_attr($this->gateway), esc_attr__('Pay', 'pronamic_ideal')); echo '</div>'; if (isset($this->error) && is_wp_error($this->error)) { foreach ($this->error->get_error_messages() as $message) { echo $message, '<br />'; } } printf('</form>'); } } }
<?php $states = Pronamic_WP_Pay_Plugin::get_payment_states(); ?> <div class="pronamic-pay-inner"> <p> <label for="pronamic-payment-status">Status:</span> <select id="pronamic-payment-status" name="pronamic_payment_status" class="medium-text"> <?php foreach ($states as $status => $label) { printf('<option value="%s" %s>%s</option>', esc_attr($status), selected($status, $post->post_status, false), esc_html($label)); } ?> </select> </p> </div> <div class="pronamic-pay-major-actions"> <div class="pronamic-pay-action"> <?php wp_nonce_field('pronamic_payment_update', 'pronamic_payment_nonce'); submit_button(__('Update', 'pronamic_ideal'), 'primary', 'pronamic_payment_update', false); ?> </div> <div class="clear"></div> </div>
/* Plugin Name: Pronamic iDEAL Plugin URI: http://www.pronamic.eu/plugins/pronamic-ideal/ Description: The Pronamic iDEAL plugin allows you to easily add the iDEAL payment method to your WordPress website. Version: 3.8.6 Requires at least: 3.6 Author: Pronamic Author URI: http://www.pronamic.eu/ Text Domain: pronamic_ideal Domain Path: /languages/ License: GPL GitHub URI: https://github.com/pronamic/wp-pronamic-ideal */ /** * Autoload */ if (version_compare(PHP_VERSION, '5.3', '>=')) { require_once plugin_dir_path(__FILE__) . 'vendor/autoload.php'; } elseif (version_compare(PHP_VERSION, '5.2', '>=')) { require_once plugin_dir_path(__FILE__) . 'vendor/autoload_52.php'; } /** * Bootstrap */ Pronamic_WP_Pay_Plugin::bootstrap(__FILE__);
/** * Advanced inputs * * @return string */ public static function advanced_inputs() { $output = ''; $config_id = get_option(Pronamic_WP_Pay_Extensions_WPeCommerce_Extension::OPTION_IDEAL_CONFIG_ID); $gateway = Pronamic_WP_Pay_Plugin::get_gateway($config_id); if ($gateway) { $gateway->set_payment_method(Pronamic_WP_Pay_PaymentMethods::IDEAL); $output = $gateway->get_input_html(); } return $output; }