Function Reference: geodir_payment_form_2co
Summary
This function has not been documented yet.
Filters
‘geodir_worldpay_item_name’ [Line: 302]
Source Code
function geodir_payment_form_2co( $invoice_id ) { $invoice_info = geodir_get_invoice( $invoice_id ); $payment_method = get_payment_options( $invoice_info->paymentmethod ); $sandbox = $payment_method['payment_mode'] == 'sandbox' ? true : false; $user_id = $invoice_info->user_id; $post_id = $invoice_info->post_id; $package_id = $invoice_info->package_id; $item_name = $invoice_info->post_title; $item_name = apply_filters( 'geodir_worldpay_item_name', $item_name, $invoice_id ); $payable_amount = $invoice_info->paied_amount; $invoice_type = $invoice_info->invoice_type; $currency_code = geodir_get_currency_type(); $user_info = get_userdata( $user_id ); $payable_amount = $invoice_info->paied_amount; $post_title = $invoice_info->post_title; $client_name = geodir_get_client_name( $user_id ); $client_email = $user_info->user_email; $package_info = geodir_get_post_package_info($package_id, $post_id); $gd_post_info = geodir_get_post_info($post_id); $is_subscription = false; if ($invoice_type == 'add_listing' || $invoice_type == 'upgrade_listing' || $invoice_type == 'renew_listing') { if (!empty($package_info['sub_active'])) { $is_subscription = true; $sub_inerval_x = !empty($package_info['sub_units_num']) ? absint($package_info['sub_units_num']) : '1'; $sub_inerval_u = !empty($package_info['sub_units']) ? $package_info['sub_units'] : 'D'; $sub_duration_x = !empty($package_info['sub_units_num_times']) ? absint($package_info['sub_units_num_times']) : 0; $sub_trial_x = !empty($package_info['sub_units_num']) ? absint($package_info['sub_units_num']) : 0; $sub_trial_u = !empty($package_info['sub_num_trial_units']) ? $package_info['sub_num_trial_units'] : 'D'; $recurrence_u = 'Week'; if ($sub_inerval_u == 'W') { $recurrence_u = 'Week'; } else if ( $sub_inerval_u == 'M' ) { $recurrence_u = 'Month'; } else if ( $sub_inerval_u == 'Y' ) { $recurrence_u = 'Year'; } else { if ($sub_inerval_x%365 == 0) { $sub_inerval_u = 'Year'; $recurrence_u = $sub_inerval_x / 365; } else if ($sub_inerval_x%30 == 0) { $sub_inerval_xn = $sub_inerval_x / 30; $recurrence_u = 'Month'; } else { if ($sub_inerval_x > 56) { $sub_inerval_xn = round($sub_inerval_x / 30); $recurrence_u = 'Month'; } else { $sub_inerval_xn = round($sub_inerval_x / 7); $recurrence_u = 'Week'; } } $sub_inerval_x = max(1, $sub_inerval_xn); } $recurrence = $sub_inerval_x . ' ' . $recurrence_u; $duration = $sub_duration_x > 0 ? ($sub_duration_x * $sub_inerval_x) . ' ' . $recurrence_u : 'Forever'; } } $merchantid = $payment_method['vendorid']; if ( $merchantid == '' ) { $merchantid = '1303908'; } $submit_url = $sandbox ? 'https://sandbox.2checkout.com/checkout/purchase' : 'https://www.2checkout.com/checkout/purchase'; $sid = $merchantid; $name = $item_name; $price = $payable_amount; $x_receipt_link_url = $payment_method['ipnfilepath']; $add_params = array(); if (!empty($gd_post_info->post_country)) $add_params['country'] = $gd_post_info->post_country; if (!empty($gd_post_info->post_region)) $add_params['state'] = $gd_post_info->post_region; if (!empty($gd_post_info->post_city)) $add_params['city'] = $gd_post_info->post_city; if (!empty($gd_post_info->post_zip)) $add_params['zip'] = $gd_post_info->post_zip; if (!empty($gd_post_info->geodir_contact)) $add_params['phone'] = $gd_post_info->geodir_contact; $discount = ''; if ($is_subscription && !empty($invoice_info->coupon_code) && $invoice_info->discount > 0) { $recurring_coupon = geodir_payment_coupon_is_recurring($invoice_info->coupon_code) ? true : false; if ($recurring_coupon) { $price = $invoice_info->amount; $add_params['li_1_startup_fee'] = $invoice_info->discount * (-1); } } ?>