Plugin Directory

Changeset 2907071


Ignore:
Timestamp:
05/02/2023 03:14:16 PM (3 years ago)
Author:
sprinque
Message:

v.1.3.1

Location:
sprinque
Files:
14 edited
1 copied

Legend:

Unmodified
Added
Removed
  • sprinque/tags/1.3.1/assets/css/frontend.css

    r2903962 r2907071  
    363363}
    364364.modal-form.modal-form_show.modal-form_anim .modal-form-inner {
    365   top: 50%;
     365  top: 20px;
    366366  opacity: 1;
    367367  box-shadow: rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;
     
    398398  top: 30%;
    399399  left: 50%;
    400   transform: translate(calc(-50% - 32px), calc(-50% - 32px));
     400  transform: translate(calc(-50% - 32px), 0);
    401401}
    402402.modal-form-inner:focus {
  • sprinque/tags/1.3.1/assets/css/frontend.scss

    r2903962 r2907071  
    410410    }
    411411    .modal-form-inner {
    412       top: 50%;
     412      top: 20px;
    413413      opacity: 1;
    414414      box-shadow: rgb(0 0 0 / 20%) 0px 11px 15px -7px, rgb(0 0 0 / 14%) 0px 24px 38px 3px, rgb(0 0 0 / 12%) 0px 9px 46px 8px;
     
    454454  top: 30%;
    455455  left: 50%;
    456   transform: translate(calc(-50% - 32px), calc(-50% - 32px));
     456  transform: translate(calc(-50% - 32px), 0);
    457457  @media screen and (max-width: 575.98px) {
    458458    padding: 16px;
  • sprinque/tags/1.3.1/assets/js/frontend.js

    r2903962 r2907071  
    138138                }
    139139
     140                updateRegistrationNumberRequiredMark();
     141
    140142                toggle_radio_buttons();
    141143            }
     
    149151            $('#register_buyer_company').prop('disabled', isRegisterNewBusinessFieldsVal);
    150152        });
     153    }
     154
     155    function updateRegistrationNumberRequiredMark() {
     156        if (countries.length < 1) {
     157            return ;
     158        }
     159
     160        const country_code = $('#select_country_pay').val();
     161        const country = countries.find(country => country.code === country_code);
     162        const is_registration_number_required = country.is_registration_number_required;
     163
     164        if (is_registration_number_required) {
     165            $('.registration-number-required').show();
     166        } else {
     167            $('.registration-number-required, #reg_number_warning').hide();
     168        }
    151169    }
    152170
     
    397415
    398416    $("body").on("input", "#reg_number_pay", function(event) {
    399         const country_code = $('#select_country_pay').val().toLowerCase();
     417        let country_code_upper = $('#select_country_pay').val();
     418        const country_code = country_code_upper.toLowerCase();
    400419        const reg_number = $(this).val();
    401420        let language = document.documentElement.lang;
     
    403422        language = language.split('-');
    404423        language = language.shift();
    405         const validation = Sprinque.checkRegNumber(reg_number, country_code, language);
    406 
    407         if (!validation.isValid) {
    408             $('#reg_number_warning')
    409                 .show()
    410                 .text(validation.message);
     424
     425        const country = countries.find(country => country.code === country_code_upper);
     426        if (country.is_registration_number_required) {
     427            const validation = Sprinque.checkRegNumber(reg_number, country_code, language);
     428
     429            if (!validation.isValid) {
     430                $('#reg_number_warning')
     431                    .show()
     432                    .text(validation.message);
     433            } else {
     434                $('#reg_number_warning').hide();
     435            }
    411436        } else {
    412437            $('#reg_number_warning').hide();
     
    477502        var company_name = $('#company_name_pay').val();
    478503
     504        const country = countries.find(country => country.code === country_code);
     505        const is_registration_number_value = country.is_registration_number_required ? reg_number.length > 0 : true;
     506
    479507        $('.error-confirm-order').hide();
    480508
    481         if(reg_number.length > 0 && company_name.length > 1 && country_code.length > 0) {
     509        if(is_registration_number_value && company_name.length > 1 && country_code.length > 0) {
    482510            $('.register_new_business').show();
    483511            $('.search_already_added_company').hide();
     
    523551        }
    524552
     553        const country = countries.find(country => country.code === country_code);
     554        const is_registration_number_value = country.is_registration_number_required ? registration_number.length > 0 : true;
     555
    525556        // Here the problem on js layer
    526557        $('.error-register-fields').hide();
    527558
    528         if(business_name.length > 1 && registration_number.length > 0 && country_code.length > 0 && zip_code.length > 0 && city.length > 0
     559        if(business_name.length > 1 && is_registration_number_value && country_code.length > 0 && zip_code.length > 0 && city.length > 0
    529560            && address_line1.length > 0 && first_name.length > 0 && last_name.length > 0 && email.length > 0) {
    530561            $.ajax({
     
    725756        const credit_bureau_id = $selectedCompany.data('credit-bureau-id').toString();
    726757
     758        const country = countries.find(country => country.code === country_code);
     759        const is_registration_number_value = country.is_registration_number_required ? registration_number.length > 0 : true;
     760
    727761        $('.error-confirm-order').hide();
    728762
    729         if(business_name.length > 1 && registration_number.length > 0 && country_code.length > 0 && zip_code.length > 0 && city.length > 0
     763        if(business_name.length > 1 && is_registration_number_value && country_code.length > 0 && zip_code.length > 0 && city.length > 0
    730764            && address_line1.length > 0 && first_name.length > 0 && last_name.length > 0 && email.length > 0) {
    731765
     
    10461080                    countries = response;
    10471081                    toggle_radio_buttons();
     1082                    updateRegistrationNumberRequiredMark();
    10481083                }
    10491084            }
  • sprinque/tags/1.3.1/include/payment_method.php

    r2903962 r2907071  
    247247            $email = sanitize_text_field( $_POST['email'] );
    248248            $phone_number = sanitize_text_field($_POST['phone']);
    249             $phone_number = str_replace(' ', '', $phone_number);
     249            $phone_number = str_replace([' ', '/', '-'], '', $phone_number);
    250250            $phone = $phone_number;
    251251            $country = sanitize_text_field( $_POST['country_code'] );
     
    427427                    $fee /= 100.0;
    428428                    $data['order_amount'] *= 1.0 + $fee;
     429                    $data['order_amount'] = round($data['order_amount'], 2);
    429430                }
    430431            }
  • sprinque/tags/1.3.1/readme.txt

    r2903962 r2907071  
    66Tested up to: 6.0
    77Requires PHP: 5.3
    8 Stable tag: 1.3.0
     8Stable tag: 1.3.1
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    5050
    5151== Changelog ==
     52
     53= 1.3.1 - May 2, 2023 =
     54* Round order_amount to 2 decimals;
     55* Reg number required condition;
     56* Remove ' ', '/', '-' in phone number;
     57* Changed top position of the modal;
    5258
    5359= 1.3.0 - April 25, 2023 =
  • sprinque/tags/1.3.1/sprinque.php

    r2903962 r2907071  
    55Description: Sprinque for WordPress is a plugin that allows you to offer your business buyers net payment terms (15, 30, 60, 90 days) and thereby grow conversion and retention.
    66Author: Sprinque
    7 Version: 1.3.0
     7Version: 1.3.1
    88Text Domain: sprinque
    99Domain Path: /languages
    1010*/
    1111
    12 define( 'PLUGIN_SRINQUE_VERSION', '1.3.0' );
     12define( 'PLUGIN_SRINQUE_VERSION', '1.3.1' );
    1313define( 'PLUGIN_SRINQUE_DIR', __DIR__ );
    1414define( 'PLUGIN_SRINQUE_PATH', plugins_url( '', __FILE__ ) );
     
    402402                    $calculated_fee = $total * $fee_percents;
    403403                    $total += $calculated_fee;
     404                    $total = round($total, 2);
    404405
    405406                    // Prepare Data to Send
  • sprinque/tags/1.3.1/templates/frontend/srinque_pay_modal_form.php

    r2903962 r2907071  
    4242                    <div class="error-confirm-order" style="display: none;"><?php _e( "Not all required fields are filled", 'sprinque' ); ?></div>
    4343                    <div class="field-group">
    44                         <label><?php _e( "Registration number", 'sprinque' ); ?>*</label>
     44                        <label><?php _e( "Registration number", 'sprinque' ); ?><span class="registration-number-required">*</span></label>
    4545                        <input type="text" id="reg_number_pay" placeholder="<?php _e( "Registration number", 'sprinque' ); ?>">
    4646                        <div class="field-warning" id="reg_number_warning">
  • sprinque/trunk/assets/css/frontend.css

    r2903962 r2907071  
    363363}
    364364.modal-form.modal-form_show.modal-form_anim .modal-form-inner {
    365   top: 50%;
     365  top: 20px;
    366366  opacity: 1;
    367367  box-shadow: rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;
     
    398398  top: 30%;
    399399  left: 50%;
    400   transform: translate(calc(-50% - 32px), calc(-50% - 32px));
     400  transform: translate(calc(-50% - 32px), 0);
    401401}
    402402.modal-form-inner:focus {
  • sprinque/trunk/assets/css/frontend.scss

    r2903962 r2907071  
    410410    }
    411411    .modal-form-inner {
    412       top: 50%;
     412      top: 20px;
    413413      opacity: 1;
    414414      box-shadow: rgb(0 0 0 / 20%) 0px 11px 15px -7px, rgb(0 0 0 / 14%) 0px 24px 38px 3px, rgb(0 0 0 / 12%) 0px 9px 46px 8px;
     
    454454  top: 30%;
    455455  left: 50%;
    456   transform: translate(calc(-50% - 32px), calc(-50% - 32px));
     456  transform: translate(calc(-50% - 32px), 0);
    457457  @media screen and (max-width: 575.98px) {
    458458    padding: 16px;
  • sprinque/trunk/assets/js/frontend.js

    r2903962 r2907071  
    138138                }
    139139
     140                updateRegistrationNumberRequiredMark();
     141
    140142                toggle_radio_buttons();
    141143            }
     
    149151            $('#register_buyer_company').prop('disabled', isRegisterNewBusinessFieldsVal);
    150152        });
     153    }
     154
     155    function updateRegistrationNumberRequiredMark() {
     156        if (countries.length < 1) {
     157            return ;
     158        }
     159
     160        const country_code = $('#select_country_pay').val();
     161        const country = countries.find(country => country.code === country_code);
     162        const is_registration_number_required = country.is_registration_number_required;
     163
     164        if (is_registration_number_required) {
     165            $('.registration-number-required').show();
     166        } else {
     167            $('.registration-number-required, #reg_number_warning').hide();
     168        }
    151169    }
    152170
     
    397415
    398416    $("body").on("input", "#reg_number_pay", function(event) {
    399         const country_code = $('#select_country_pay').val().toLowerCase();
     417        let country_code_upper = $('#select_country_pay').val();
     418        const country_code = country_code_upper.toLowerCase();
    400419        const reg_number = $(this).val();
    401420        let language = document.documentElement.lang;
     
    403422        language = language.split('-');
    404423        language = language.shift();
    405         const validation = Sprinque.checkRegNumber(reg_number, country_code, language);
    406 
    407         if (!validation.isValid) {
    408             $('#reg_number_warning')
    409                 .show()
    410                 .text(validation.message);
     424
     425        const country = countries.find(country => country.code === country_code_upper);
     426        if (country.is_registration_number_required) {
     427            const validation = Sprinque.checkRegNumber(reg_number, country_code, language);
     428
     429            if (!validation.isValid) {
     430                $('#reg_number_warning')
     431                    .show()
     432                    .text(validation.message);
     433            } else {
     434                $('#reg_number_warning').hide();
     435            }
    411436        } else {
    412437            $('#reg_number_warning').hide();
     
    477502        var company_name = $('#company_name_pay').val();
    478503
     504        const country = countries.find(country => country.code === country_code);
     505        const is_registration_number_value = country.is_registration_number_required ? reg_number.length > 0 : true;
     506
    479507        $('.error-confirm-order').hide();
    480508
    481         if(reg_number.length > 0 && company_name.length > 1 && country_code.length > 0) {
     509        if(is_registration_number_value && company_name.length > 1 && country_code.length > 0) {
    482510            $('.register_new_business').show();
    483511            $('.search_already_added_company').hide();
     
    523551        }
    524552
     553        const country = countries.find(country => country.code === country_code);
     554        const is_registration_number_value = country.is_registration_number_required ? registration_number.length > 0 : true;
     555
    525556        // Here the problem on js layer
    526557        $('.error-register-fields').hide();
    527558
    528         if(business_name.length > 1 && registration_number.length > 0 && country_code.length > 0 && zip_code.length > 0 && city.length > 0
     559        if(business_name.length > 1 && is_registration_number_value && country_code.length > 0 && zip_code.length > 0 && city.length > 0
    529560            && address_line1.length > 0 && first_name.length > 0 && last_name.length > 0 && email.length > 0) {
    530561            $.ajax({
     
    725756        const credit_bureau_id = $selectedCompany.data('credit-bureau-id').toString();
    726757
     758        const country = countries.find(country => country.code === country_code);
     759        const is_registration_number_value = country.is_registration_number_required ? registration_number.length > 0 : true;
     760
    727761        $('.error-confirm-order').hide();
    728762
    729         if(business_name.length > 1 && registration_number.length > 0 && country_code.length > 0 && zip_code.length > 0 && city.length > 0
     763        if(business_name.length > 1 && is_registration_number_value && country_code.length > 0 && zip_code.length > 0 && city.length > 0
    730764            && address_line1.length > 0 && first_name.length > 0 && last_name.length > 0 && email.length > 0) {
    731765
     
    10461080                    countries = response;
    10471081                    toggle_radio_buttons();
     1082                    updateRegistrationNumberRequiredMark();
    10481083                }
    10491084            }
  • sprinque/trunk/include/payment_method.php

    r2903962 r2907071  
    247247            $email = sanitize_text_field( $_POST['email'] );
    248248            $phone_number = sanitize_text_field($_POST['phone']);
    249             $phone_number = str_replace(' ', '', $phone_number);
     249            $phone_number = str_replace([' ', '/', '-'], '', $phone_number);
    250250            $phone = $phone_number;
    251251            $country = sanitize_text_field( $_POST['country_code'] );
     
    427427                    $fee /= 100.0;
    428428                    $data['order_amount'] *= 1.0 + $fee;
     429                    $data['order_amount'] = round($data['order_amount'], 2);
    429430                }
    430431            }
  • sprinque/trunk/readme.txt

    r2903962 r2907071  
    66Tested up to: 6.0
    77Requires PHP: 5.3
    8 Stable tag: 1.3.0
     8Stable tag: 1.3.1
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    5050
    5151== Changelog ==
     52
     53= 1.3.1 - May 2, 2023 =
     54* Round order_amount to 2 decimals;
     55* Reg number required condition;
     56* Remove ' ', '/', '-' in phone number;
     57* Changed top position of the modal;
    5258
    5359= 1.3.0 - April 25, 2023 =
  • sprinque/trunk/sprinque.php

    r2903962 r2907071  
    55Description: Sprinque for WordPress is a plugin that allows you to offer your business buyers net payment terms (15, 30, 60, 90 days) and thereby grow conversion and retention.
    66Author: Sprinque
    7 Version: 1.3.0
     7Version: 1.3.1
    88Text Domain: sprinque
    99Domain Path: /languages
    1010*/
    1111
    12 define( 'PLUGIN_SRINQUE_VERSION', '1.3.0' );
     12define( 'PLUGIN_SRINQUE_VERSION', '1.3.1' );
    1313define( 'PLUGIN_SRINQUE_DIR', __DIR__ );
    1414define( 'PLUGIN_SRINQUE_PATH', plugins_url( '', __FILE__ ) );
     
    402402                    $calculated_fee = $total * $fee_percents;
    403403                    $total += $calculated_fee;
     404                    $total = round($total, 2);
    404405
    405406                    // Prepare Data to Send
  • sprinque/trunk/templates/frontend/srinque_pay_modal_form.php

    r2903962 r2907071  
    4242                    <div class="error-confirm-order" style="display: none;"><?php _e( "Not all required fields are filled", 'sprinque' ); ?></div>
    4343                    <div class="field-group">
    44                         <label><?php _e( "Registration number", 'sprinque' ); ?>*</label>
     44                        <label><?php _e( "Registration number", 'sprinque' ); ?><span class="registration-number-required">*</span></label>
    4545                        <input type="text" id="reg_number_pay" placeholder="<?php _e( "Registration number", 'sprinque' ); ?>">
    4646                        <div class="field-warning" id="reg_number_warning">
Note: See TracChangeset for help on using the changeset viewer.