post_content, 'addonpayments' ) ) { wp_enqueue_script( 'addonp-select2-front', ADDONP_PLUGIN_URL . '/assets/js/jquery.select2.js', array( 'jquery' ), ADDONP_VERSION ); wp_enqueue_script( 'addonp-select2-custom-front', ADDONP_PLUGIN_URL . '/assets/js/addonp.front.custom.js', array( 'addonp-select2-front' ), ADDONP_VERSION ); wp_enqueue_script( 'jquery-ui-accordion' ); wp_register_style( 'addonp-select2-css-front', ADDONP_PLUGIN_URL . '/assets/css/select2.css', array(), ADDONP_VERSION ); wp_register_style( 'addonp-pure-css', ADDONP_PLUGIN_URL . '/assets/css/pure-min.css', array(), ADDONP_VERSION ); wp_register_style( 'addonp-custom-css-front', ADDONP_PLUGIN_URL . '/assets/css/custom-css-front.css', array(), ADDONP_VERSION ); wp_enqueue_style( 'addonp-select2-css-front' ); wp_enqueue_style( 'addonp-pure-css' ); wp_enqueue_style( 'addonp-custom-css-front' ); } } add_action( 'wp_enqueue_scripts', 'addonp_custom_settings_load_js_front'); function addonp_admin_notice_retention_error() { $retention_set = get_option('addonp_apply_retention_field'); $retention_percent = get_option('addonp_percent_retention_field'); $class = 'notice notice-error'; $message = __( 'AddonPayments Error: Retention is active, but you dont set Retention %. Please set it', 'addonpayments' ); if ( $retention_set == '1' && empty( $retention_percent ) ) { printf( '

%2$s

', esc_attr( $class ), esc_html( $message ) ); } } function addonp_admin_notice_tax_error() { $tax_set = get_option('addonp_price_with_tax_field'); $tax_percent = get_option('addonp_percent_tax_field'); $class = 'notice notice-error'; $message = __( 'AddonPayments Error: Tax is active, but you dont set Tax %. Please set it', 'addonpayments' ); if ( $tax_set == '1' && empty( $tax_percent ) ) { printf( '

%2$s

', esc_attr( $class ), esc_html( $message ) ); } } add_action( 'admin_notices', 'addonp_admin_notice_retention_error' ); add_action( 'admin_notices', 'addonp_admin_notice_tax_error' ); // Errors function addonp_get_error( $result ) { if ( ( $result >= 100 ) && ( $result <= 199 ) ) { if ( $result == '101' ) { $text_result = __( 'Declined by Bank – generally insufficient funds or incorrect card details (e.g. expiry date, card security code)', 'addonpayments' ); } elseif ( $result == '102' ) { $text_result = __( 'Referral to Bank (usually treated as a standard decline for ecommerce systems)', 'addonpayments' ); } elseif ( $result == '103' ) { $text_result = __( 'Card reported lost or stolen.', 'addonpayments' ); } elseif ( $result == '107' ) { $text_result = __( 'The transaction has been blocked as potentially fraudulent by our fraud management configuration', 'addonpayments' ); } else { $text_result = __( 'Declined by Bank', 'addonpayments' ); } } elseif ( ( $result >= 200 ) && ( $result <= 299 ) ) { $text_result = __( 'Error with bank systems – Please, try again later.', 'addonpayments' ); } elseif ( ( $result >= 300 ) && ( $result <= 399 ) ) { $text_result = __( 'Error with AddonPayments systems – Please, try again later.', 'addonpayments' ); } elseif ( $result == 666 ) { $text_result = __( 'Account deactivated – The AddonPayments account has been suspended. Please contact AddPayments.', 'addonpayments' ); } return $text_result; } function addonp_get_secret(){ $test = get_option( 'addonp_test_mode_field' ); if ( $test == '1' ) { $secret = get_option( 'addonp_shared_secret_test_field' ); } else { $secret = get_option( 'addonp_shared_secret_field' ); } return $secret; } function addonp_get_merchand_id(){ $test = get_option( 'addonp_test_mode_field' ); if ( $test == '1' ) { $merchand_id = get_option( 'addonp_merchant_id_test_field' ); } else { $merchand_id = get_option( 'addonp_merchant_id_field' ); } return $merchand_id; } function addonp_get_account(){ $test = get_option( 'addonp_test_mode_field' ); if ( $test == '1' ) { $account = get_option( 'addonp_account_test_field' ); } else { $account = get_option( 'addonp_account_field' ); } return $account; } // Add Shortcode function addonp_price_shortcode( $atts ) { global $wp; $user_type = get_option( 'addonp_user_type_label_field' ); $tax_active = get_option( 'addonp_price_with_tax_field' ); $currency_sign = get_option( 'addonp_currency_sign_field' ); $currency_place = get_option( 'addonp_place_currency_sign_field' ); $price_with_tax = get_option( 'addonp_price_with_or_without_tax_field' ); $show_price_with_tax = get_option( 'addonp_show_price_with_tax_field' ); $percent_tax = get_option( 'addonp_percent_tax_field' ); $text_excluded_tax = get_option( 'addonp_post_price_excluded_tax_field' ); $text_included_tax = get_option( 'addonp_post_price_included_tax_field' ); $retention = get_option( 'addonp_apply_retention_field' ); $show_text_retention = get_option( 'addonp_show_text_retention_field' ); $text_retention = get_option( 'addonp_text_active_retention_field' ); $text_buy_now = get_option( 'addonp_text_buy_now_field' ); $text_pay_now = get_option( 'addonp_text_pay_now' ); $post_permanlink = home_url( add_query_arg( array(), $wp->request ) ); $nonce_field = wp_nonce_field( 'addonpayments_action', 'addonpayments_nonce_field' ); $shipping_fields = maybe_unserialize( get_option( 'addonp_shipping_fields_to_screen_front_label_field' ) ); $billing_fields = maybe_unserialize( get_option( 'addonp_billing_fields_to_screen_front_label_field' ) ); $show_comments = get_option( 'addonp_coment1_fields_to_screen_front_label_field' ); // Attributes $atts = shortcode_atts( array( 'id' => '', 'product' => '', 'price' => '', ), $atts ); if ( $test == '1' ) { $url = 'https://hpp.sandbox.addonpayments.com/pay'; } else { $url = 'https://hpp.addonpayments.com/pay'; } //Base Price $price = $atts['price']; $id_product_block = $atts['id']; //Tax if ( $tax_active == '1' && $price_with_tax == 'withouttax' && $show_price_with_tax == '1' ) { $tax = ( $price * ( $percent_tax / 100 ) ); if ( $text_included_tax ) { $post_price = $text_included_tax; } else { $post_price = __( 'Included Tax', 'addonpayments' ); } } elseif ( $tax_active == '1' && $price_with_tax == 'withouttax' && ( empty( $show_price_with_tax ) || $show_price_with_tax == '0' ) ) { $tax = '0'; if ( $text_excluded_tax ) { $post_price = $text_excluded_tax; } else { $post_price = __( 'Included Tax', 'addonpayments' ); } } elseif ( $tax_active == '1' && $price_with_tax == 'withtax' && $show_price_with_tax == '1' ) { $tax = '0'; if ( $text_included_tax ) { $post_price = $text_included_tax; } else { $post_price = __( 'Included Tax', 'addonpayments' ); } } elseif ( $tax_active == '1' && $price_with_tax == 'withtax' && ( empty( $show_price_with_tax ) || $show_price_with_tax == '0' ) ) { $tax = '0'; if ( $text_excluded_tax ) { $post_price = $text_excluded_tax; } else { $post_price = __( 'Included Tax', 'addonpayments' ); } } elseif ( $tax_active == '0' || empty( $tax_active ) ) { $tax = '0'; $post_price = ''; } // Retention if ( $retention == '1' && $show_text_retention == '1' ) { if ( empty( $text_retention ) ) { $reten_field = "" . __('(A Retention will be applied if is needed)', 'addonpayments' ) . "
"; } else { $reten_field = "" . $text_retention . "
"; } } else { $reten_field = ''; } // Currency if ( $currency_place == 'front_space' ){ $currency_front = $currency_sign . ' '; $currency_back = ''; } elseif ( $currency_place == 'front_no_space' ) { $currency_front = $currency_sign; $currency_back = ''; } elseif ( $currency_place == 'back_no_space' ) { $currency_front = ''; $currency_back = $currency_sign; } elseif ( $currency_place == 'back_space' ){ $currency_front = ''; $currency_back = ' ' . $currency_sign; } $final_price_before_point = $price + $tax; $price_front = number_format( $final_price_before_point, 2, ',', '.'); if ( isset( $_POST['PROD_ID'] ) && ( $_POST['PROD_ID'] == $atts['product'] ) && isset( $_POST['addonpayments_nonce_field'] ) && wp_verify_nonce( $_POST['addonpayments_nonce_field'], 'addonpayments_action' ) ) { $test = ''; $merchand_id = ''; $secret = ''; $tax_active = ''; $price_with_tax = ''; $percent_tax = ''; $retention = ''; $percent_retention = ''; $currency = ''; $account = ''; $auto_set_flag = ''; $timestamp = ''; $str = ''; $orderid = ''; $post_permanlink = ''; $countries_to_appply_tax = ''; $countries_to_appply_retention = ''; $apply_retention_to_private = ''; $apply_retention_to_business = ''; $apply_retention_to_self_employed = ''; // $_POST if ( $_POST['user_type'] ) $user_type = sanitize_text_field( $_POST['user_type'] ); if ( $_POST['Full_Name'] ) $Full_Name = sanitize_text_field( $_POST['Full_Name'] ); if ( $_POST['shipping_country'] ) $shipping_country = sanitize_text_field( $_POST['shipping_country'] ); if ( $_POST['shipping_state'] ) $shipping_state = sanitize_text_field( $_POST['shipping_state'] ); if ( $_POST['shipping_postcode'] ) $shipping_postcode = sanitize_text_field( $_POST['shipping_postcode'] ); if ( $_POST['shipping_address'] ) $shipping_address = sanitize_text_field( $_POST['shipping_address'] ); if ( $_POST['shipping_email'] ) $shipping_email = sanitize_text_field( $_POST['shipping_email'] ); if ( $_POST['full_name_billing'] ) $full_name_billing = sanitize_text_field( $_POST['full_name_billing'] ); if ( $_POST['nic_tic_vat_name_billing'] ) $nic_tic_vat_name_billing = sanitize_text_field( $_POST['nic_tic_vat_name_billing'] ); if ( $_POST['billing_country'] ) $billing_country = sanitize_text_field( $_POST['billing_country'] ); if ( $_POST['billing_state'] ) $billing_state = sanitize_text_field( $_POST['billing_state'] ); if ( $_POST['billing_postcode'] ) $billing_postcode = sanitize_text_field( $_POST['billing_postcode'] ); if ( $_POST['billing_address'] ) $billing_address = sanitize_text_field( $_POST['billing_address'] ); if ( $_POST['billing_email'] ) $billing_email = sanitize_text_field( $_POST['billing_email'] ); if ( $_POST['PROD_ID'] ) $PROD_ID = sanitize_text_field( $_POST['PROD_ID'] ); if ( $_POST['COMMENT1'] ) $COMMENT1 = sanitize_text_field( $_POST['COMMENT1'] ); if ( $_POST['base_price'] ) $base_price = sanitize_text_field( $_POST['base_price'] ); if ( $_POST['post_permanlink'] ) $post_permanlink = sanitize_text_field( $_POST['post_permanlink'] ); if ( $_POST['billing_phone'] ) $billing_phone = sanitize_text_field( $_POST['billing_phone'] ); if ( $_POST['shipping_phone'] ) $shipping_phone = sanitize_text_field( $_POST['shipping_phone'] ); if ( $_POST['billing_city'] ) $billing_city = sanitize_text_field( $_POST['billing_city'] ); if ( $_POST['shipping_city'] ) $shipping_city = sanitize_text_field( $_POST['shipping_city'] ); // Saved Options $test = get_option( 'addonp_test_mode_field' ); $merchand_id = addonp_get_merchand_id(); $secret = addonp_get_secret(); $tax_active = get_option( 'addonp_price_with_tax_field' ); $price_with_tax = get_option( 'addonp_price_with_or_without_tax_field' ); $percent_tax = get_option( 'addonp_percent_tax_field' ); $retention = get_option( 'addonp_apply_retention_field' ); $percent_retention = get_option( 'addonp_percent_retention_field' ); $currency = get_option( 'addonp_currency_field' ); $account = addonp_get_account(); $auto_set_flag = get_option( 'addonp_auto_set_flag_field' ); $timestamp = date("YmdHis"); $str = 'abcdefghijklmnABCEDEFGHIJKLMNO1234567890'; $orderid = str_shuffle( $str ); $countries_to_appply_tax = maybe_unserialize( get_option( 'addonp_country_tax_label_field' ) ); $countries_to_appply_retention = maybe_unserialize( get_option( 'addonp_country_retention_label_field' ) ); $apply_retention_to_private = get_option( 'addonp_apply_retention_to_private_field' ); $apply_retention_to_business = get_option( 'addonp_apply_retention_to_business_field' ); $apply_retention_to_self_employed = get_option( 'addonp_apply_retention_to_self_employed_field' ); $text_pay_now_addonP = get_option( 'addonp_text_pay_addonpayments' ); $text_continue_to_pay = get_option( 'addonp_text_continue_to_pay_button_field' ); $addonpayment_language = get_option( 'addonp_addonpayments_language_field' ); if ( ! empty( $text_pay_now_addonP ) ) { $text_pay_now_addonP_buttom = $text_pay_now_addonP; } else { $text_pay_now_addonP_buttom = __( 'Pay Now', 'adonpayments' ); } if ( ! empty( $text_continue_to_pay ) ) { $text_continue_to_pay_buttom = $text_continue_to_pay; } else { $text_continue_to_pay_buttom = __( 'Continue to AddonPayments to Pay', 'adonpayments' ); } if ( $billing_country ) { $country = $billing_country; } else { $country = $shipping_country; } if ( $apply_retention_to_private == '1' && $user_type == 'private_user' ) { $apply_user_type = true; } elseif ( $apply_retention_to_business == '1' && $user_type == 'business' ) { $apply_user_type = true; } elseif ( $apply_retention_to_self_employed == '1' && $user_type == 'self_employed' ) { $apply_user_type = true; } else { $apply_user_type = false; } if ( ! empty( $countries_to_appply_tax ) && in_array( $country, $countries_to_appply_tax ) && $tax_active == '1' && $price_with_tax == 'withouttax' ) { $tax = ( $base_price * ( $percent_tax / 100 ) ); } else { $tax = '0'; } if ( ! empty( $countries_to_appply_retention ) && in_array( $country, $countries_to_appply_retention ) && $retention == '1' && $apply_user_type ) { $retention = ( $base_price * ( $percent_retention / 100 ) ); } else { $retention = '0'; } $final_price_before_point = $base_price + $tax - $retention; $final_price = number_format( $final_price_before_point, 2, '', ''); // Create Order $Order = wp_insert_post( array( 'post_title' => 'Ordered:' . ' ' . $PROD_ID . ' ' . 'by' . ' ' . $Full_Name, 'post_type' => 'addonp_orders', 'post_status' => 'addonp-pending-paid', 'ping_status' => 'closed', 'comment_status' => 'closed', ) ); $update_post = array( 'ID' => $Order, 'post_title' => 'Order: #' . $Order . ' ' . 'ordered:' . ' ' . $PROD_ID . ' ' . 'by' . ' ' . $Full_Name, ); wp_update_post( $update_post ); // Add meta to Order add_post_meta( $Order, '_addonp_order_id', $Order, true ); add_post_meta( $Order, '_addonp_user_type', $user_type, true ); add_post_meta( $Order, '_addonp_Full_Name', $Full_Name, true ); add_post_meta( $Order, '_addonp_shipping_country', $shipping_country, true ); add_post_meta( $Order, '_addonp_shipping_state', $shipping_state, true ); add_post_meta( $Order, '_addonp_shipping_postcode', $shipping_postcode, true ); add_post_meta( $Order, '_addonp_shipping_address', $shipping_address, true ); add_post_meta( $Order, '_addonp_shipping_email', $shipping_email, true ); add_post_meta( $Order, '_addonp_full_name_billing', $full_name_billing, true ); add_post_meta( $Order, '_addonp_nic_tic_vat_name_billing', $nic_tic_vat_name_billing, true ); add_post_meta( $Order, '_addonp_billing_country', $billing_country, true ); add_post_meta( $Order, '_addonp_billing_state', $billing_state, true ); add_post_meta( $Order, '_addonp_billing_postcode', $billing_postcode, true ); add_post_meta( $Order, '_addonp_billing_address', $billing_address, true ); add_post_meta( $Order, '_addonp_billing_email', $billing_email, true ); add_post_meta( $Order, '_addonp_PROD_ID', $PROD_ID, true ); add_post_meta( $Order, '_addonp_COMMENT1', $COMMENT1, true ); add_post_meta( $Order, '_addonp_base_price', $base_price, true ); add_post_meta( $Order, '_addonp_tax_price', $tax, true ); add_post_meta( $Order, '_addonp_tax_apply', $percent_tax, true ); add_post_meta( $Order, '_addonp_retention_apply', $percent_retention, true ); add_post_meta( $Order, '_addonp_retention_price', $retention, true ); add_post_meta( $Order, '_addonp_link_where_bought', $post_permanlink, true ); add_post_meta( $Order, '_addonp_final_price_addon', $final_price, true ); add_post_meta( $Order, '_addonp_billing_phone_order', $billing_phone, true ); add_post_meta( $Order, '_addonp_shipping_phone_order', $shipping_phone, true ); add_post_meta( $Order, '_addonp_shipping_city_order', $shipping_city, true ); add_post_meta( $Order, '_addonp_billing_city_order', $billing_city, true ); $string_sha1_1 = sha1( $timestamp . '.' . $merchand_id . '.' . $Order . '.' . $final_price . '.' . $currency ); $string_sha1_2 = sha1( $string_sha1_1 . '.' . $secret ); if ( $id_product_block == '' ) { $div_form_id = 'addonpayments'; } else { $div_form_id = 'addonpayments' . $id_product_block; } if ( $test == '1' ) { $url = 'https://hpp.sandbox.addonpayments.com/pay'; } else { $url = 'https://hpp.addonpayments.com/pay'; } $post = '
'; } else { $post = ''; } if ( isset( $_POST['RESULT'] ) && ( isset( $_POST['COMMENT2'] ) && $_POST['COMMENT2'] == $atts['product'] ) ) { if ( isset( $_POST['RESULT'] ) ) $result = sanitize_text_field( $_POST['RESULT'] ); if ( isset( $_POST['AUTHCODE'] ) ) $authcode = sanitize_text_field( $_POST['AUTHCODE'] ); if ( isset( $_POST['MESSAGE'] ) ) $message = sanitize_text_field( $_POST['MESSAGE'] ); if ( isset( $_POST['PASREF'] ) ) $pasref = sanitize_text_field( $_POST['PASREF'] ); if ( isset( $_POST['AVSPOSTCODERESPONSE'] ) ) $avspostcoderesponse = sanitize_text_field( $_POST['AVSPOSTCODERESPONSE'] ); if ( isset( $_POST['AVSADDRESSRESPONSE'] ) ) $avsaddressresponse = sanitize_text_field( $_POST['AVSADDRESSRESPONSE'] ); if ( isset( $_POST['CVNRESULT'] ) ) $cvnresult = sanitize_text_field( $_POST['CVNRESULT'] ); if ( isset( $_POST['ACCOUNT'] ) ) $account = sanitize_text_field( $_POST['ACCOUNT'] ); if ( isset( $_POST['ORDER_ID'] ) ) $order_id = sanitize_text_field( $_POST['ORDER_ID'] ); if ( isset( $_POST['TIMESTAMP'] ) ) $timestamp = sanitize_text_field( $_POST['TIMESTAMP'] ); if ( isset( $_POST['AMOUNT'] ) ) $amount = sanitize_text_field( $_POST['AMOUNT'] ); if ( isset( $_POST['BATCHID'] ) ) $batchid = sanitize_text_field( $_POST['BATCHID'] ); if ( isset( $_POST['SHA1HASH'] ) ) $sha1hash = sanitize_text_field( $_POST['SHA1HASH'] ); if ( isset( $_POST['MERCHANT_RESPONSE_URL'] ) ) $merchand_response_url = sanitize_text_field( $_POST['MERCHANT_RESPONSE_URL'] ); if ( isset( $_POST['COMMENT2'] ) ) $product = sanitize_text_field( $_POST['COMMENT2'] ); $merchand_id = addonp_get_merchand_id(); $secret = addonp_get_secret(); $final_price = get_post_meta( $order_id, '_addonp_final_price_addon', true ); $strkey = 'abcdefghijklmnopqrstuvwxyzABCEDEFGHIJKLMNOPQRSTUVWXYZ1234567890'; $randomkey = str_shuffle( $str ); $timekey = date("YmdHis"); $post_permanlink_return = $merchand_response_url; $key_product = $randomkey . $timekey; $string_sha1_1 = sha1( $timestamp . '.' . $merchand_id . '.' . $order_id . '.' . $result . '.' . $message . '.' . $pasref . '.' . $authcode ); $string_sha1_2 = sha1( $string_sha1_1 . '.' . $secret ); if ( $string_sha1_2 == $sha1hash ) { // hash OK if ( $result == '00' ) { // Transaction OK if ( $final_price ) { //Price Ok $update_order = array ( 'ID' => $order_id, 'post_status' => 'addonp-paid', ); wp_update_post( $update_order ); add_post_meta( $order_id, '_addonp_order_result', $result, true ); add_post_meta( $order_id, '_addonp_order_authcode', $authcode, true ); add_post_meta( $order_id, '_addonp_order_passref', $pasref, true ); add_post_meta( $order_id, '_addonp_order_passref', $avspostcoderesponse, true ); add_post_meta( $order_id, '_addonp_order_avsaddressresponse', $avsaddressresponse, true ); add_post_meta( $order_id, '_addonp_order_cvnresult', $cvnresult, true ); add_post_meta( $order_id, '_addonp_order_account', $account, true ); add_post_meta( $order_id, '_addonp_order_batchid', $batchid, true ); add_post_meta( $order_id, '_addonp_order_key_product', $key_product, true ); $process = '
' . __( 'Thank you for your purchase', 'addonpayments' ) . '
' . __( 'Your Order number is #', 'addonpayments' ) . $order_id . '
' . '' . __( 'Return to the website', 'addonpayments' ) . '
'; } else { // Different price $update_order = array ( 'ID' => $order_id, 'post_status' => 'addonp-check', ); wp_update_post( $update_order ); add_post_meta( $order_id, '_addonp_order_result', $result, true ); add_post_meta( $order_id, '_addonp_order_authcode', $authcode, true ); add_post_meta( $order_id, '_addonp_order_passref', $pasref, true ); add_post_meta( $order_id, '_addonp_order_passref', $avspostcoderesponse, true ); add_post_meta( $order_id, '_addonp_order_avsaddressresponse', $avsaddressresponse, true ); add_post_meta( $order_id, '_addonp_order_cvnresult', $cvnresult, true ); add_post_meta( $order_id, '_addonp_order_account', $account, true ); add_post_meta( $order_id, '_addonp_order_batchid', $batchid, true ); add_post_meta( $order_id, '_addonp_order_key_product', $key_product, true ); $process = '
' . __( 'We need to check your purchase', 'addonpayments' ) . '
' . __( 'We will contact with you once we check the transaction #', 'addonpayments' ) . $order_id . '
' . __( 'We appreciate your patience', 'addonpayments' ) . '
' . '' . __( 'Return to the website', 'addonpayments' ) . '
'; } } else { //ko Transaction $update_order = array ( 'ID' => $order_id, 'post_status' => 'addonp-error', ); $error_text = addonp_get_error( $result ); wp_update_post( $update_order ); add_post_meta( $order_id, '_addonp_order_result', $result, true ); add_post_meta( $order_id, '_addonp_order_authcode', $authcode, true ); add_post_meta( $order_id, '_addonp_order_passref', $pasref, true ); add_post_meta( $order_id, '_addonp_order_passref', $avspostcoderesponse, true ); add_post_meta( $order_id, '_addonp_order_avsaddressresponse', $avsaddressresponse, true ); add_post_meta( $order_id, '_addonp_order_cvnresult', $cvnresult, true ); add_post_meta( $order_id, '_addonp_order_account', $account, true ); add_post_meta( $order_id, '_addonp_order_batchid', $batchid, true ); add_post_meta( $order_id, '_addonp_order_key_product', $key_product, true ); $process = '
' . __( 'There was an error', 'addonpayments' ) . '
' . __( 'The error was', 'addonpayments' ) . ' ' . $result . '
' . $error_text . '
' . '' . __( 'Return to the website', 'addonpayments' ) . '
'; } } else { // KO hash $update_order = array ( 'ID' => $order_id, 'post_status' => 'addonp-suspended', ); wp_update_post( $update_order ); add_post_meta( $order_id, '_addonp_order_result', $result, true ); add_post_meta( $order_id, '_addonp_order_authcode', $authcode, true ); add_post_meta( $order_id, '_addonp_order_passref', $pasref, true ); add_post_meta( $order_id, '_addonp_order_passref', $avspostcoderesponse, true ); add_post_meta( $order_id, '_addonp_order_avsaddressresponse', $avsaddressresponse, true ); add_post_meta( $order_id, '_addonp_order_cvnresult', $cvnresult, true ); add_post_meta( $order_id, '_addonp_order_account', $account, true ); add_post_meta( $order_id, '_addonp_order_batchid', $batchid, true ); add_post_meta( $order_id, '_addonp_order_key_product', $key_product, true ); $process = '
' . __( 'Wrong hash, the order has been suspended', 'addonpayments' ) . '
' . __( 'Please contact with us if you think that this is and error', 'addonpayments' ) . '
' . __( 'The order number is', 'addonpayments' ) . ' ' . $order_id . '
' . '' . __( 'Return to the website', 'addonpayments' ) . '
'; } } else { $process = ''; } // Shipping fields if ( ! empty( $shipping_fields ) && in_array( 'user_type', $shipping_fields ) ) { $user_type = ''; } else { $user_type = ''; } if ( ! empty( $shipping_fields ) && in_array( 'Full_Name', $shipping_fields ) ) { $Full_Name = ''; } else { $Full_Name = ''; } if ( ! empty( $shipping_fields ) && in_array( 'shipping_city', $shipping_fields ) ) { $shipping_city = ''; } else { $shipping_city = ''; } if ( ! empty( $shipping_fields ) && in_array( 'shipping_country', $shipping_fields ) ) { $shipping_country = ''; } else { $shipping_country = ''; } if ( ! empty( $shipping_fields ) && in_array( 'shipping_state', $shipping_fields ) ) { $shipping_state = ''; } else { $shipping_state = ''; } if ( ! empty( $shipping_fields ) && in_array( 'shipping_postcode', $shipping_fields ) ) { $shipping_postcode = ''; } else { $shipping_postcode = ''; } if ( ! empty( $shipping_fields ) && in_array( 'shipping_address', $shipping_fields ) ) { $shipping_address = ''; } else { $shipping_address = ''; } if ( ! empty( $shipping_fields ) && in_array( 'shipping_email', $shipping_fields ) ) { $shipping_email = ''; } else { $shipping_email = ''; } if ( ! empty( $shipping_fields ) && in_array( 'shipping_phone', $shipping_fields ) ) { $shipping_phone = ''; } else { $shipping_phone = ''; } // Billing fields if ( ! empty( $billing_fields ) && in_array( 'full_name_billing', $billing_fields ) ) { $full_name_billing = ''; } else { $full_name_billing = ''; } if ( ! empty( $billing_fields ) && in_array( 'nic_tic_vat_name_billing', $billing_fields ) ) { $nic_tic_vat_name_billing = ''; } else { $nic_tic_vat_name_billing = ''; } if ( ! empty( $billing_fields ) && in_array( 'billing_city', $billing_fields ) ) { $billing_city = ''; } else { $billing_city = ''; } if ( ! empty( $billing_fields ) && in_array( 'billing_country', $billing_fields ) ) { $billing_country = ''; } else { $billing_country = ''; } if ( ! empty( $billing_fields ) && in_array( 'billing_state', $billing_fields ) ) { $billing_state = ''; } else { $billing_state = ''; } if ( ! empty( $billing_fields ) && in_array( 'billing_postcode', $billing_fields ) ) { $billing_postcode = ''; } else { $billing_postcode = ''; } if ( ! empty( $billing_fields ) && in_array( 'billing_address', $billing_fields ) ) { $billing_address = ''; } else { $billing_address = ''; } if ( ! empty( $billing_fields ) && in_array( 'billing_email', $billing_fields ) ) { $billing_email = ''; } else { $billing_email = ''; } if ( ! empty( $billing_fields ) && in_array( 'billing_phone', $billing_fields ) ) { $billing_phone = ''; } else { $billing_phone = ''; } if ( ! empty( $shipping_fields ) ) { if ( empty( $billing_fields ) ) { $full = '-full'; } else { $full = ''; } $shipping_content = '
' . __( 'Shipping Data', 'addonpayments' ) . '' . $user_type . $Full_Name . $shipping_country . $shipping_state . $shipping_city . $shipping_address . $shipping_postcode . $shipping_email . $shipping_phone . '
'; } else { $shipping_content = ''; } if ( ! empty( $billing_fields ) ) { if ( empty( $shipping_fields ) ) { $full = '-full'; } else { $full = ''; } $billing_content = '
' . __( 'Billing Data', 'addonpayments' ) . '' . $full_name_billing . $nic_tic_vat_name_billing . $billing_country . $billing_state . $billing_city . $billing_address . $billing_postcode . $billing_email . $billing_phone . '
'; } else { $billing_fields = ''; } if ( ! empty( $text_buy_now ) ) { $text_buy_now_button = $text_buy_now; } else { $text_buy_now_button = __( 'Buy Now', 'addonpayments' ); } if ( ! empty( $text_pay_now ) ) { $text_pay_now_button = $text_pay_now; } else { $text_pay_now_button = __( 'Pay Now with AddonPayments', 'addonpayments' ); } if ( $show_comments == '1' ) { $COMMENT1 = '
' . __( 'Comment for your Order', 'addonpayments' ) . '
'; } else { $COMMENT1 = ''; } if ( $id_product_block == '' ) { $div_acordeon_id = 'addond_accordion'; } else { $div_acordeon_id = 'addond_accordion' . $id_product_block; } $form = '
' . __( 'Price: ', 'addonpayments' ) . $currency_front . $price_front . $currency_back . '' . ' ' . '' . $post_price . '
' . $reten_field . '

' . $text_buy_now_button . '

' . $shipping_content . $billing_content . '
' . $COMMENT1 . ' ' . $nonce_field . '
'; if ( ! empty( $post ) ) { return $post; } elseif ( ! empty( $process ) ) { return $process; } else { return $form; } } add_shortcode( 'addonpayments', 'addonp_price_shortcode' );