private function callback_register() { $form_args = wpsc_get_register_form_args(); $validation = wpsc_validate_form($form_args); if (is_wp_error($validation)) { wpsc_set_validation_errors($validation); return; } return wpsc_register_customer($_POST['username'], $_POST['password'], true); }
private function submit_payment_method() { global $wpsc_cart; if (!$this->verify_nonce('wpsc-checkout-form-payment-method')) { return; } if (empty($_POST['wpsc_payment_method']) && !wpsc_is_free_cart()) { $this->message_collection->add(__('Please select a payment method', 'wp-e-commerce'), 'validation'); } $valid = apply_filters('_wpsc_merchant_v2_validate_payment_method', true, $this); if (!$valid) { return; } $purchase_log_id = wpsc_get_customer_meta('current_purchase_log_id'); $purchase_log = new WPSC_Purchase_Log($purchase_log_id); $submitted_gateway = $_POST['wpsc_payment_method']; $purchase_log->set(array('gateway' => $submitted_gateway, 'base_shipping' => $wpsc_cart->calculate_base_shipping(), 'totalprice' => $wpsc_cart->calculate_total_price())); if ($this->maybe_add_guest_account() && isset($_POST['wpsc_create_account'])) { $email = wpsc_get_customer_meta('billingemail'); $user_id = wpsc_register_customer($email, $email, false); $purchase_log->set('user_ID', $user_id); wpsc_update_customer_meta('checkout_details', wpsc_get_customer_meta('checkout_details'), $user_id); update_user_meta($user_id, '_wpsc_visitor_id', wpsc_get_current_customer_id()); } $purchase_log->save(); $wpsc_cart->empty_db($purchase_log_id); $wpsc_cart->save_to_db($purchase_log_id); $wpsc_cart->submit_stock_claims($purchase_log_id); $wpsc_cart->log_id = $purchase_log_id; $this->wizard->completed_step('payment'); do_action('wpsc_submit_checkout', array('purchase_log_id' => $purchase_log_id, 'our_user_id' => isset($user_id) ? $user_id : get_current_user_id())); do_action('wpsc_submit_checkout_gateway', $submitted_gateway, $purchase_log); }