protected function _buildCheckoutView($gateway) { $ssl = Cart66Setting::getValue('auth_force_ssl'); if ($ssl) { if (!Cart66Common::isHttps()) { $sslUrl = "https://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]; wp_redirect($sslUrl); exit; } } // use manual gateway form to gather user information require_once CART66_PATH . "/gateways/Cart66ManualGateway.php"; $gateway = new Cart66_paymill_for_wordpress(); if (!Cart66Session::get('Cart66Cart')) { Cart66Session::set('Cart66Cart', new Cart66Cart()); } if (!$GLOBALS['paymill_active']) { paymill_load_frontend_scripts(); // load frontend scripts // settings $GLOBALS['paymill_active'] = true; $cart_total = intval(Cart66Session::get('Cart66Cart')->getGrandTotal(false) * 100); $currency = CURRENCY_CODE; $no_logos = false; ob_start(); // form ids echo '<script> paymill_form_checkout_id = "#Cart66_paymill_for_wordpress_form"; paymill_form_checkout_submit_id = "#Cart66CheckoutButton"; paymill_shop_name = "cart66"; paymill_pcidss3 = ' . (empty($GLOBALS['paymill_settings']->paymill_general_settings['pci_dss_3']) || $GLOBALS['paymill_settings']->paymill_general_settings['pci_dss_3'] != '1' ? 1 : 0) . '; paymill_pcidss3_lang = "' . substr(apply_filters('plugin_locale', get_locale(), $domain), 0, 2) . '"; </script> '; require_once PAYMILL_DIR . 'lib/tpl/checkout_form.php'; $view .= '<h2>' . __('Payment Information', 'paymill') . '</h2>'; $view .= ob_get_clean(); $checkout = Cart66Common::getView('views/checkout.php', array('gateway' => $gateway), true, true); $view .= str_replace(array('Cart66ManualGateway', 'Payment Information'), array('Cart66_paymill_for_wordpress', 'Contact Information'), $checkout); } else { $view = '<div class="paymill_notification paymill_notification_once_only"><strong>Error:</strong> Paymill can be loaded once only on the same page.</div>'; } return $view; }
function form() { if (!$GLOBALS['paymill_active']) { paymill_load_frontend_scripts(); // load frontend scripts // settings $GLOBALS['paymill_active'] = true; $cart_total = $this->amount('total') * 100; $currency = $this->currency(); $cc_logo = plugins_url('', __FILE__) . '/../img/cc_logos_v.png'; $no_logos = true; // form ids echo '<script> paymill_form_checkout_id = "#checkout"; paymill_form_checkout_submit_id = "#checkout-button"; paymill_shop_name = "shopplugin"; paymill_pcidss3 = ' . (empty($GLOBALS['paymill_settings']->paymill_general_settings['pci_dss_3']) || $GLOBALS['paymill_settings']->paymill_general_settings['pci_dss_3'] != '1' ? 1 : 0) . '; paymill_pcidss3_lang = "' . substr(apply_filters('plugin_locale', get_locale(), $domain), 0, 2) . '"; </script>'; // html / icons echo '<p style="margin-top:10px;" id="paymill_framebox">'; $icon = '<a href="https://www.paymill.com/" target="_blank"><img src="' . plugins_url('', __FILE__) . '/../img/logo.png" alt="PAYMILL" /></a>'; if (isset($GLOBALS['paymill_settings']->paymill_general_settings['payments_display']) && is_array($GLOBALS['paymill_settings']->paymill_general_settings['payments_display']) && count($GLOBALS['paymill_settings']->paymill_general_settings['payments_display']) > 0) { foreach ($GLOBALS['paymill_settings']->paymill_general_settings['payments_display'] as $name => $type) { if ($type == 1) { $icon .= '<img src="' . plugins_url('', __FILE__) . '/../img/logos/' . $name . '.png" style="vertical-align:middle;" alt="' . $name . '" />'; } } } echo $icon; echo '</p><div id="payment">'; require_once PAYMILL_DIR . 'lib/tpl/checkout_form.php'; echo '</div><div style="background-image:url(' . plugins_url('', __FILE__) . '/../img/line.png);background-position:-300px;background-repeat:no-repeat;height:3px;line-height:3px;padding:0px;margin:5px 0px 10px 0px;"></div>'; } else { echo '<div class="paymill_notification paymill_notification_once_only"><strong>Error:</strong> Paymill can be loaded once only on the same page.</div>'; } }
public function payment_fields() { global $woocommerce; if (!$GLOBALS['paymill_active']) { paymill_load_frontend_scripts(); // load frontend scripts // settings $GLOBALS['paymill_active'] = true; $cart_total = WC_Payment_Gateway::get_order_total() * 100; $currency = get_woocommerce_currency(); $no_logos = true; // form ids echo '<script> paymill_form_checkout_id = "form.checkout, form#order_review"; paymill_form_checkout_submit_id = "#place_order"; paymill_shop_name = "woocommerce"; paymill_pcidss3 = ' . (empty($GLOBALS['paymill_settings']->paymill_general_settings['pci_dss_3']) || $GLOBALS['paymill_settings']->paymill_general_settings['pci_dss_3'] != '1' ? 1 : 0) . '; paymill_pcidss3_lang = "' . substr(apply_filters('plugin_locale', get_locale(), $domain), 0, 2) . '"; </script>'; echo '<a href="https://www.paymill.com/" target="_blank"><img src="' . WC_HTTPS::force_https_url($this->logo_small) . '" alt="' . $this->title . '" /></a>'; echo '<p class="paymill_payment_description">' . $this->settings['description'] . '</p>'; require_once PAYMILL_DIR . 'lib/tpl/checkout_form.php'; } else { echo '<div class="paymill_notification paymill_notification_once_only"><strong>Error:</strong> Paymill can be loaded once only on the same page.</div>'; } return true; }
function widget($args, $instance) { global $wpdb; if (!$GLOBALS['paymill_active'] && isset($GLOBALS['paymill_settings']->paymill_pay_button_settings['products']) && count($GLOBALS['paymill_settings']->paymill_pay_button_settings['products']) > 0 && get_the_ID() != get_option('woocommerce_check_page_id')) { paymill_load_frontend_scripts(); // load frontend scripts $GLOBALS['paymill_active'] = true; echo $args['before_widget']; if (strlen($instance['title']) > 0) { echo $args['before_title']; echo $instance['title']; echo $args['after_title']; } if (defined('PAYMILL_PAYBUTTON_ORDER_SUCCESS') && PAYMILL_PAYBUTTON_ORDER_SUCCESS === true) { echo __('Thank you for your order.', 'paymill'); } else { // settings $currency = $GLOBALS['paymill_settings']->paymill_pay_button_settings['currency']; $cc_logo = plugins_url('', __FILE__) . '/../img/cc_logos_v.png'; $title = apply_filters('widget_title', $instance['title']); $show_fields = isset($GLOBALS['paymill_settings']->paymill_pay_button_settings['fields_show']) ? $GLOBALS['paymill_settings']->paymill_pay_button_settings['fields_show'] : false; if (isset($instance['products_list']) && strlen($instance['products_list']) > 0) { $products_whitelist = explode(',', $instance['products_list']); } else { $products_whitelist = unserialize($instance['products']); } // form ids echo '<script> paymill_form_checkout_id = ".checkout"; paymill_form_checkout_submit_id = "#place_order"; paymill_shop_name = "paybutton"; paymill_pcidss3 = ' . (empty($GLOBALS['paymill_settings']->paymill_general_settings['pci_dss_3']) || $GLOBALS['paymill_settings']->paymill_general_settings['pci_dss_3'] != '1' ? 1 : 0) . '; paymill_pcidss3_lang = "' . substr(apply_filters('plugin_locale', get_locale(), $domain), 0, 2) . '"; </script>'; if ($this->subscriptions === false) { $this->subscriptions = new paymill_subscriptions('pay_button'); } $offers = $this->subscriptions->offerGetList(); // html / icons echo ' <div id="payment" class="paymill_pay_button"> <form action="#" method="post" class="checkout"> '; if (file_exists(get_template_directory() . '/paymill/pay_button.php')) { require get_template_directory() . '/paymill/pay_button.php'; } else { require PAYMILL_DIR . 'lib/tpl/pay_button.php'; } echo '<div class="paymill_payment_title">' . __('Payment', 'paymill') . '</div>'; require PAYMILL_DIR . 'lib/tpl/checkout_form.php'; echo ' <input type="submit" id="place_order" value="' . __('Pay now', 'paymill') . '"/> </form> </div> '; } echo $args['after_widget']; } elseif (empty($GLOBALS['paymill_settings']->paymill_pay_button_settings['products']) || count($GLOBALS['paymill_settings']->paymill_pay_button_settings['products']) == 0) { echo '<div class="paymill_notification paymill_notification_once_only"><strong>Error:</strong> You must have set at least one product.</div>'; } else { echo '<div class="paymill_notification paymill_notification_once_only"><strong>Error:</strong> Paymill can be loaded once only on the same page.</div>'; } }
/** * Echo fields you need to add to the payment screen, like your credit card info fields. * If you don't need to add form fields set $skip_form to true so this page can be skipped * at checkout. * * @param array $cart. Contains the cart contents for the current blog, global cart if $mp->global_cart is true * @param array $shipping_info. Contains shipping info and email in case you need it */ function payment_form($global_cart, $shipping_info) { global $mp; if (!$GLOBALS['paymill_active']) { paymill_load_frontend_scripts(); // load frontend scripts // settings $GLOBALS['paymill_active'] = true; $cart_total = $this->paymill_getCartTotal($global_cart); $currency = $this->paymill_getCurrency(); $no_logos = false; ob_start(); // form ids echo '<script> paymill_form_checkout_id = "#mp_payment_form"; paymill_form_checkout_submit_id = "#mp_payment_confirm"; paymill_shop_name = "marketpress"; paymill_pcidss3 = ' . (empty($GLOBALS['paymill_settings']->paymill_general_settings['pci_dss_3']) || $GLOBALS['paymill_settings']->paymill_general_settings['pci_dss_3'] != '1' ? 1 : 0) . '; paymill_pcidss3_lang = "' . substr(apply_filters('plugin_locale', get_locale(), $domain), 0, 2) . '"; </script>'; echo do_shortcode($mp->get_setting('gateways->paymill-for-wordpress->instructions')); require_once PAYMILL_DIR . 'lib/tpl/checkout_form.php'; return ob_get_clean(); } else { echo '<div class="paymill_notification paymill_notification_once_only"><strong>Error:</strong> Paymill can be loaded once only on the same page.</div>'; } }
function process_html_redirect() { // read tran id if (!($tran_id = $this->_read_transaction_id())) { return __('Transaction Id invalid', 'mgm'); } // get trans if (!($tran = mgm_get_transaction($tran_id))) { return __('Transaction invalid', 'mgm'); } // Check user id is set if subscription_purchase. issue #1049 if ($tran['payment_type'] == 'subscription_purchase' && (!isset($tran['data']['user_id']) || isset($tran['data']['user_id']) && (int) $tran['data']['user_id'] < 1)) { return __('Transaction invalid . User id field is empty', 'mgm'); } // get user $user_id = $tran['data']['user_id']; $user = get_userdata($user_id); // log // mgm_pr($tran); // update pack/transaction: this is to confirm the module code if it is different mgm_update_transaction(array('module' => $this->module), $tran_id); // cc field // $cc_fields = $this->_get_ccfields($user, $tran); // validate card: This will validate card and reload the form with errors // if validated process_credit_card() method will be called internally $html = $this->validate_cc_fields_process(__FUNCTION__); // the html /* $html .='<form action="'. $this->_get_endpoint('html_redirect') .'" method="post" class="mgm_form" name="' . $this->code . '_form" id="' . $this->code . '_form"> <input type="hidden" name="tran_id" value="'.$tran_id.'"> <input type="hidden" name="submit_from" value="'.__FUNCTION__.'"> '. $cc_fields .' </form>'; */ // html / icons ob_start(); if (!$GLOBALS['paymill_active']) { paymill_load_frontend_scripts(); // load frontend scripts // settings $GLOBALS['paymill_active'] = true; $country = 'DE'; $cart_total = $tran['data']['cost'] * 100; $currency = $tran['data']['currency']; $cc_logo = plugins_url('', __FILE__) . '/../img/cc_logos_v.png'; // form ids echo '<script> paymill_form_checkout_id = ".checkout"; paymill_form_checkout_submit_id = "#place_order"; paymill_shop_name = "magicmembers"; paymill_pcidss3 = ' . (empty($GLOBALS['paymill_settings']->paymill_general_settings['pci_dss_3']) || $GLOBALS['paymill_settings']->paymill_general_settings['pci_dss_3'] != '1' ? 1 : 0) . '; paymill_pcidss3_lang = "' . substr(apply_filters('plugin_locale', get_locale(), $domain), 0, 2) . '"; </script>'; echo '<div id="payment" class="paymill_pay_button paymill_magicmembers"><form action="' . $this->_get_endpoint('return') . '" name="' . $this->code . '_form" method="post" id="' . $this->code . '_form" class="checkout">'; require PAYMILL_DIR . 'lib/tpl/checkout_form.php'; echo ' <input type="submit" id="place_order" value="' . __('Pay now', 'paymill') . '"/> <input type="hidden" name="tran_id" value="' . $tran_id . '"> <input type="hidden" name="submit_from" value="' . __FUNCTION__ . '"> '; echo '</form></div>'; } else { echo '<div class="paymill_notification paymill_notification_once_only"><strong>Error:</strong> Paymill can be loaded once only on the same page.</div>'; } $html = ob_get_clean(); // return return $html; }