function _change_order_amount_total($total)
 {
     return TravelHelper::convert_money($total);
 }
示例#2
0
 function check_completePurchase($order_id = false)
 {
     //Check cart is not empty
     if ($order_id and false !== get_post_status($order_id)) {
         $total = get_post_meta($order_id, 'total_price', true);
         $gateway = Omnipay::create('PayPal_Express');
         $gateway->setUsername($this->apiUserName);
         $gateway->setPassword($this->apiPass);
         $gateway->setSignature($this->apiSignature);
         $gateway->setTestMode(true);
         $amount = TravelHelper::convert_money($total);
         $order_token_code = get_post_meta($order_id, 'order_token_code', true);
         if (!$order_token_code) {
             $array = array('gateway_name' => 'st_paypal', 'order_code' => $order_id, 'status' => 'success');
             $array_error = array('gateway_name' => 'st_paypal', 'order_code' => $order_id, 'status' => 'error');
         } else {
             $array = array('gateway_name' => 'st_paypal', 'order_token_code' => $order_token_code, 'status' => 'success');
             $array_error = array('gateway_name' => 'st_paypal', 'order_token_code' => $order_token_code, 'status' => 'error');
         }
         $response = $gateway->completePurchase(array('amount' => (double) $amount, 'currency' => TravelHelper::get_current_currency('name'), 'description' => __('Traveler Booking', ST_TEXTDOMAIN), 'returnUrl' => add_query_arg($array, STCart::get_success_link()), 'cancelUrl' => add_query_arg($array_error, STCart::get_success_link())))->send();
         if ($response->isSuccessful()) {
             $data = $response->getData();
             $data2 = $gateway->fetchCheckout(array('transactionReference' => $data['TOKEN']))->send();
             $transaction_data = $data2->getData();
             //Try to create user and create new orders with paypal transaction detail
             return STGatewayPaypal::paypal_checkout($transaction_data, $order_id);
             //return true;
         } elseif ($response->isRedirect()) {
             //$response->redirect(); // this will automatically forward the customer
             return array('status' => false, 'redirect_url' => $response->getRedirectUrl(), 'func' => 'check_completePurchase');
             //                    return ;
         } else {
             // not successful
             return array('status' => false, 'message' => $response->getMessage());
         }
     } else {
         // not successful
         return array('status' => false, 'message' => __('Order Code is not exists', ST_TEXTDOMAIN));
     }
 }
        <?php 
if (isset($item_data['_st_infant_number']) and $infant = st_wc_parse_order_item_meta($item_data['_st_infant_number'])) {
    ?>
        <li>
            <span class="meta-label"><?php 
    echo __('Infant number:', ST_TEXTDOMAIN);
    ?>
</span>
            <span class="meta-data">
                <?php 
    echo esc_html($infant);
    ?>
                x
                <?php 
    if (isset($item_data['_st_infant_price']) and $infant_price = st_wc_parse_order_item_meta($item_data['_st_infant_price'])) {
        $infant_price = TravelHelper::convert_money($data_price['infant_price'] / $infant);
        ?>
                    <?php 
        echo TravelHelper::format_money_raw($infant_price);
        ?>
                <?php 
    }
    ?>
            </span>
        </li>
        <?php 
}
?>
        <?php 
if (isset($item_data['_st_discount_rate'])) {
    $data = st_wc_parse_order_item_meta($item_data['_st_discount_rate']);
示例#4
0
                foreach ($list_item_equipment as $key => $value) {
                    if (!empty($value)) {
                        $title = explode('--', $value);
                    }
                    $mang_ss[] = $title[0];
                }
            }
        }
        $i = 0;
        foreach ($item_equipment as $key => $val) {
            $checked = null;
            $item = $val['title'] . '--' . $val['cars_equipment_list_price'];
            if (in_array($val['title'], $mang_ss)) {
                $checked = 'checked';
            }
            $cars_equipment_list_price = TravelHelper::convert_money($val['cars_equipment_list_price']);
            $cars_equipment_list_price = TravelHelper::format_money($cars_equipment_list_price, false);
            echo '<div class="form-group" style="margin-bottom: 10px">
                                                            <label for="item_equipment-' . $i . '"><input ' . $checked . ' id="item_equipment-' . $i . '" type="checkbox" name="item_equipment[]" value="' . $val['title'] . '--' . $cars_equipment_list_price . '">' . $val['title'] . '(' . $cars_equipment_list_price . ')</label>
                                                            </div>';
            $i++;
        }
    }
}
?>
                                        </div>
                                        <span class="spinner"></span>
                                    </div>
                                </div>
                                <?php 
if (st()->get_option('tax_enable', 'off') == 'on' && st()->get_option('st_tax_include_enable', 'off') == 'off') {
示例#5
0
 static function getInfoCarPartner()
 {
     $car_id = intval(STInput::request('car_id', ''));
     $data = array('price' => 'not infomation', 'item_equipment' => 'not infomation');
     if ($car_id <= 0 || get_post_type($car_id) != 'st_cars') {
         echo json_encode($data);
         die;
     } else {
         $price = floatval(get_post_meta($car_id, 'cars_price', true));
         $data['price'] = TravelHelper::format_money($price) . ' / ' . self::get_price_unit();
         $item_equipment = get_post_meta($car_id, 'cars_equipment_list', true);
         if (is_array($item_equipment) && count($item_equipment)) {
             $html = '<table class="table">';
             $i = 0;
             foreach ($item_equipment as $key => $val) {
                 $price_unit = isset($v['price_unit']) ? $v['price_unit'] : '';
                 $price_max = isset($v['cars_equipment_list_price_max']) ? $v['cars_equipment_list_price_max'] : '';
                 $cars_equipment_list_price = TravelHelper::convert_money($val['cars_equipment_list_price']);
                 $cars_equipment_list_price = TravelHelper::format_money($cars_equipment_list_price, false);
                 $html .= '
                     <tr>
                         <td>
                             <label for="item_equipment-' . $i . '" class="ml20"><input data-price="' . $cars_equipment_list_price . '" data-title="' . $val['title'] . '" data-price-max="' . $price_max . '" data-price-unit="' . $price_unit . '" class="i-check list_equipment" id="item_equipment-' . $i . '" type="checkbox" value="' . $val['title'] . '--' . $cars_equipment_list_price . '">' . $val['title'] . ' (' . TravelHelper::format_money($val['cars_equipment_list_price']) . ')</label>
                         </td>
                     </tr>
                 ';
                 $i++;
             }
             $html .= "</table>";
             $data['item_equipment'] = $html;
         }
         echo json_encode($data);
         die;
     }
 }
 function _change_order_amount_total($total)
 {
     $debug = debug_backtrace();
     //            foreach($debug as $k=> $key)
     //            {
     //                var_dump($key['function']);
     //            }
     if (isset($debug[4]['function']) and $debug[4]['function'] == 'get_formatted_order_total') {
         return $total;
     }
     return TravelHelper::convert_money($total);
 }