示例#1
0
function as_tours_booking_paypal_confirm($tour_orders_id)
{
    $token_paypal = $_GET["token"];
    $payer_id = $_GET["PayerID"];
    $error = "";
    $tour_orders_status = get_post_meta($tour_orders_id, "_as_tour_orders_status", true);
    if ($tour_orders_status == 2) {
        as_save_post_meta($tour_orders_id, "as_tour_orders_paypal_payer_id", $_GET["PayerID"]);
        $token = get_post_meta($tour_orders_id, "as_tour_orders_paypal_token", true);
        if (urldecode($token) == $token_paypal) {
            $paypal = new ASPayPal();
            $baseUrl = get_permalink($tour_orders_id);
            $tour_orders_opt = get_post_meta($tour_orders_id, '_as_tour_orders', true);
            $tour_orders_opt = unserialize($tour_orders_opt);
            $tour_id = get_post_meta($tour_orders_id, "_as_tour_id", true);
            $tour_data = get_post($tour_id);
            $paypal_item = array("item_name" => $tour_data->post_title . "- Order ID : " . $tour_orders_opt["tour_order_id"], "item_price" => $tour_orders_opt["tour_order_price"], "item_numer" => 1, "item_desc" => '', "item_qty" => 1, "token" => $token_paypal, "payer_id" => $payer_id);
            $result = $paypal->doCheckOut($paypal_item);
            if (isset($result["transaction"])) {
                as_save_post_meta($tour_orders_id, "as_tour_orders_paypal_transaction", $result["transaction"]);
            }
            if (isset($result["message"])) {
                $error = $result["message"];
            }
            if ($result["status"]) {
                as_save_post_meta($tour_orders_id, "_as_tour_orders_status", 1);
            }
        }
    }
    return $error;
}
示例#2
0
function as_tours_orders_customer_info_save($post_id, $post)
{
    global $tour_orders_customer_info_default;
    // verify this came from the our screen and with proper authorization,
    // because save_post can be triggered at other times
    if (!wp_verify_nonce($_POST['as_tours_orders_customer_info_noncename'], plugin_basename(__FILE__))) {
        return $post->ID;
    }
    // Is the user allowed to edit the post or page?
    if (!current_user_can('edit_post', $post->ID)) {
        return $post->ID;
    }
    // OK, we're authenticated: we need to find and save the data
    // We'll put it into an array to make it easier to loop though.
    $as_tour_customer_info = $_POST['as_customer_info'];
    $tour_orders_customer_info = array_merge($tour_orders_customer_info_default, $as_tour_customer_info);
    if (!as_tour_check_customer_info($tour_orders_customer_info)) {
        return $post->ID;
    } else {
        as_save_post_meta($post->ID, "_as_tour_orders_customer_info", serialize($tour_orders_customer_info));
    }
}
示例#3
0
function as_tours_options_save($post_id, $post)
{
    // verify this came from the our screen and with proper authorization,
    // because save_post can be triggered at other times
    if (!wp_verify_nonce($_POST['as_eventmeta_noncename'], plugin_basename(__FILE__))) {
        return $post->ID;
    }
    // Is the user allowed to edit the post or page?
    if (!current_user_can('edit_post', $post->ID)) {
        return $post->ID;
    }
    // OK, we're authenticated: we need to find and save the data
    // We'll put it into an array to make it easier to loop though.
    $as_tours_opt = $_POST['as_tours_opt'];
    global $tour_opt_default;
    // Add values of $events_meta as custom fields
    if (!$as_tours_opt || empty($as_tours_opt)) {
        $as_tours_opt = array();
    }
    foreach ($as_tours_opt as $key => $value) {
        if ($key != 'tour_type' && (!is_numeric($value) || $value < 0)) {
            $as_tours_opt[$key] = 0;
        }
    }
    $tour_opt = array_merge($tour_opt_default, $as_tours_opt);
    as_save_post_meta($post->ID, "_as_tours_options", serialize($tour_opt));
}