public function __construct() { parent::__construct(); $this->title = __('Amazon Payments', 'wpsc'); $this->reference_id = !empty($_REQUEST['amazon_reference_id']) ? sanitize_text_field($_REQUEST['amazon_reference_id']) : ''; $this->user_is_authenticated = isset($_GET['amazon_payments_advanced']) && 'true' == $_GET['amazon_payments_advanced'] && isset($_GET['access_token']); $this->order_handler = WPSC_Amazon_Payments_Order_Handler::get_instance($this); add_action('init', array($this->order_handler, 'process_ipn')); // Define user set variables $this->seller_id = $this->setting->get('seller_id'); $this->mws_access_key = $this->setting->get('mws_access_key'); $this->secret_key = $this->setting->get('secret_key'); $this->sandbox = $this->setting->get('sandbox_mode') == '1' ? true : false; $this->payment_capture = $this->setting->get('payment_capture') !== null ? $this->setting->get('payment_capture') : ''; $this->client_id = $this->setting->get('client_id'); $base_country = new WPSC_Country(wpsc_get_base_country()); // Get endpoint $location = in_array($base_country->get_isocode(), array('US', 'GB', 'DE', 'JP')) ? $base_country->get_isocode() : 'US'; $this->endpoint = $this->sandbox ? $this->endpoints['sandbox'][$location] : $this->endpoints['production'][$location]; $this->define_widget_constants(); if (isset($_POST['post_data'])) { parse_str($_POST['post_data'], $post_data); if (isset($post_data['amazon_reference_id'])) { $this->reference_id = sanitize_text_field($post_data['amazon_reference_id']); } } }
/** * Constructor * * @access public */ public function __construct($options) { parent::__construct(); $this->title = __('Credit Card', PBCI_AUTHNET); //add_action( 'wpsc_before_shipping_of_shopping_cart', array( &$this, 'checkout_form' ) ); add_filter('wpsc_gateway_checkout_form_' . $this->gateway_name(), array(&$this, 'gateway_checkout_form_filter'), 10, 1); if (defined('AUTHORIZENET_API_LOGIN_ID')) { $this->api_login_id = AUTHORIZENET_API_LOGIN_ID; $this->api_login_id_can_change = false; } else { $this->api_login_id = $this->setting->get('api_login_id'); $this->api_login_id_can_change = true; } if (defined('AUTHORIZENET_TRANSACTION_KEY')) { $this->api_transaction_key = AUTHORIZENET_TRANSACTION_KEY; $this->api_transaction_key_can_change = false; } else { $this->api_transaction_key = $this->setting->get('api_transaction_key'); $this->api_transaction_key_can_change = true; } if (defined('AUTHORIZENET_SANDBOX')) { $this->sandbox_mode = (bool) AUTHORIZENET_SANDBOX; $this->sandbox_mode_can_change = false; } else { $this->sandbox_mode = (bool) $this->setting->get('sandbox_mode'); $this->sandbox_mode_can_change = true; } if (isset($_REQUEST['auth_net'])) { $card_data = $_REQUEST['auth_net']; if (empty($card_data['card_number'])) { $card_data['card_number'] = ''; } if (empty($card_data['expiry']['month'])) { $card_data['expiry']['month'] = '00'; } if (empty($card_data['expiry']['year'])) { $card_data['expiry']['year'] = '00'; } if (empty($card_data['card_code'])) { $card_data['card_code'] = ''; } if (isset($card_data['card_number'])) { $this->card_number = $this->digits_and_spaces_only($card_data['card_number']); } if (isset($card_data['expiry']['month'])) { $this->expiration_month = $this->digits_and_spaces_only($card_data['expiry']['month']); } if (isset($card_data['expiry']['year'])) { $this->expiration_year = $this->digits_and_spaces_only($card_data['expiry']['year']); } if (isset($card_data['card_code'])) { $this->card_verification_code = $this->digits_and_spaces_only($card_data['card_code']); } } }
/** * Constructor of WorldPay Payment Gateway * * @access public * @since 3.9 */ public function __construct() { parent::__construct(); $this->title = __('WorldPay Payment Gateway', 'wp-e-commerce'); $this->supports = array('default_credit_card_form', 'tev1'); $this->order_handler = WPSC_WorldPay_Payments_Order_Handler::get_instance($this); // Define user set variables $this->secure_net_id = $this->setting->get('secure_net_id'); $this->secure_key = $this->setting->get('secure_key'); $this->public_key = $this->setting->get('public_key'); $this->sandbox = $this->setting->get('sandbox_mode') == '1' ? true : false; $this->endpoint = $this->sandbox ? $this->endpoints['sandbox'] : $this->endpoints['production']; $this->payment_capture = $this->setting->get('payment_capture') !== null ? $this->setting->get('payment_capture') : ''; $this->auth = 'Basic ' . base64_encode($this->setting->get('secure_net_id') . ':' . $this->setting->get('secure_key')); }
/** * Displays the setup form * * @access public * @since 3.9 * @uses WPSC_Checkout_Form::get() * @uses WPSC_Checkout_Form::field_drop_down_options() * @uses WPSC_Checkout_Form::get_field_id_by_unique_name() * @uses WPSC_Payment_Gateway_Setting::get() * * @return void */ public function setup_form() { ?> <tr> <td colspan="2"> <p> <label for="wpsc-manual-gateway-setup"><?php _e('Instructions', 'wpsc'); ?> </label><br /> <textarea id="wpsc-manual-gateway-setup" cols='' rows='10' name='<?php echo esc_attr($this->setting->get_field_name('payment_instructions')); ?> '><?php echo esc_html($this->setting->get('payment_instructions')); ?> </textarea><br /> <small><?php _e('Enter the payment instructions that you wish to display to your customers when they make a purchase.', 'wpsc'); ?> </small><br /> <small><?php _e('For example, this is where you the Shop Owner might enter your bank account details or address so that your customer can make their manual payment.', 'wpsc'); ?> </small> </p> </td> </tr> <tr class='update_gateway' > <td colspan='2'> <div class='submit'> <input type='submit' value='<?php _e('Update »', 'wpsc'); ?> ' name='updateoption' /> </div> </td> </tr> <?php parent::setup_form(); }
public function process() { $total = $this->convert($this->purchase_log->get('totalprice')); $options = array('return_url' => $this->get_return_url(), 'invoice' => $this->purchase_log->get('sessionid')); $options += $this->checkout_data->get_gateway_data(); $options += $this->purchase_log->get_gateway_data(parent::get_currency_code(), $this->get_currency_code()); if ($this->setting->get('ipn', false)) { $options['notify_url'] = $this->get_notify_url(); } $response = $this->gateway->setup_purchase($options); if ($response->is_successful()) { $url = ($this->setting->get('sandbox_mode') ? self::SANDBOX_URL : self::LIVE_URL) . $response->get('token'); wp_redirect($url); } else { $_SESSION['paypal_express_checkout_errors'] = serialize($response->get_errors()); $url = add_query_arg(array('payment_gateway' => 'paypal-express-checkout', 'payment_gateway_callback' => 'display_paypal_error'), $this->get_return_url()); } wp_redirect($url); exit; }
/** * Process the SetExpressCheckout API Call * * @return void * * @since 3.9 */ public function process() { $total = $this->convert($this->purchase_log->get('totalprice')); $options = array('return_url' => $this->get_return_url(), 'message_id' => $this->purchase_log->get('id'), 'invoice' => $this->purchase_log->get('sessionid'), 'address_override' => 1); $options += $this->checkout_data->get_gateway_data(); $options += $this->purchase_log->get_gateway_data(parent::get_currency_code(), $this->get_currency_code()); if ($this->setting->get('ipn', false)) { $options['notify_url'] = $this->get_notify_url(); } // SetExpressCheckout $response = $this->gateway->setup_purchase($options); if ($response->is_successful()) { $params = $response->get_params(); if ($params['ACK'] == 'SuccessWithWarning') { $this->log_error($response); wpsc_update_customer_meta('paypal_express_checkout_errors', $response->get_errors()); } // Successful redirect $url = $this->get_redirect_url(array('token' => $response->get('token'))); } else { // SetExpressCheckout Failure $this->log_error($response); wpsc_update_customer_meta('paypal_express_checkout_errors', $response->get_errors()); $url = add_query_arg(array('payment_gateway' => 'paypal-express-checkout', 'payment_gateway_callback' => 'display_paypal_error'), $this->get_return_url()); } wp_redirect($url); exit; }
/** * Constructor of Manual Payment Gateway * * @access public * @since 3.9 */ public function __construct() { parent::__construct(); $this->title = __('Manual Payment Gateway 3.0', 'wpsc'); }
/** * Call the CreateButton API * * @return void * * @since 3.9 */ public function process() { $total = $this->convert($this->purchase_log->get('totalprice')); $options = array('return_url' => $this->get_return_url(), 'message_id' => $this->purchase_log->get('id'), 'invoice' => $this->purchase_log->get('sessionid'), 'address_override' => 1, 'paymentaction' => 'sale', 'template' => 'templateD', 'vendor' => $this->setting->get('vendor_id')); $options += $this->checkout_data->get_gateway_data(); $options += $this->purchase_log->get_gateway_data(parent::get_currency_code(), $this->get_currency_code()); if ($this->setting->get('ipn', false)) { $options['notify_url'] = $this->get_notify_url(); } // Detect Mobile Devices if (wp_is_mobile()) { $options['template'] = 'mobile-iframe'; } // BMCreateButton API call $response = $this->gateway->createButton($options); if ($response->is_successful()) { $params = $response->get_params(); $website_code = $params['WEBSITECODE']; // Log any warning if ($params['ACK'] == 'SuccessWithWarning') { $this->log_error($response); wpsc_update_customer_meta('paypal_pro_checkout_errors', $response->get_errors()); } // Write the Button code echo $website_code; } else { // Log errors and redirect user $this->log_error($response); wpsc_update_customer_meta('paypal_pro_checkout_errors', $response->get_errors()); $url = add_query_arg(array('payment_gateway' => 'paypal-pro', 'payment_gateway_callback' => 'display_paypal_error'), $this->get_return_url()); // Redirect to the Error Page wp_redirect($url); } // Stop further execution exit; }