diff --git a/assets/css/admin.scss b/assets/css/admin.scss index 27ba4f7a5..0feaaf131 100644 --- a/assets/css/admin.scss +++ b/assets/css/admin.scss @@ -2542,7 +2542,8 @@ &.turnstile_empty_key_validate, &.hcaptcha_empty_key_validate, &.enable-stripe-model, - &.enable-authorize-net-model { + &.enable-authorize-net-model, + &.enable-square-model{ opacity: 0.45; &:hover { diff --git a/assets/extensions-json/sections/all_extensions.json b/assets/extensions-json/sections/all_extensions.json index 359d6e5f5..3a0d51240 100644 --- a/assets/extensions-json/sections/all_extensions.json +++ b/assets/extensions-json/sections/all_extensions.json @@ -806,6 +806,22 @@ "setting_url": "admin.php?page=evf-settings&tab=integration§ion=pipedrive", "demo_video_url": "wJPX0EJ2OiI", "popular_rank": 32 + }, + { + "title": "Square", + "slug": "everest-forms-square", + "name": "Everest Forms - Square", + "image": "extensions-json/sections/images/square-payment.png", + "excerpt": "Connect your Everest Forms data to your Trello accounts. Use Trello API to link Everest Forms with Trello, syncing your website's form submissions with Trello tasks.", + "link": "https://docs.everestforms.net/docs/trello/?utm_source=dashboard-all-features&utm_medium=card-documentation-link", + "released_date": "20/05/2024", + "plan": [ + "personal", + "agency", + "themegrill agency" + ], + "setting_url": "admin.php?page=evf-settings&tab=payment", + "demo_video_url": "" } ] } diff --git a/assets/extensions-json/sections/images/square-payment.png b/assets/extensions-json/sections/images/square-payment.png new file mode 100644 index 000000000..e5fd1f2f6 Binary files /dev/null and b/assets/extensions-json/sections/images/square-payment.png differ diff --git a/assets/js/admin/evf-setup.js b/assets/js/admin/evf-setup.js index 24474a2ac..65cd7637a 100644 --- a/assets/js/admin/evf-setup.js +++ b/assets/js/admin/evf-setup.js @@ -124,6 +124,7 @@ jQuery(function ($) { page: pagenow, name: $itemRow.data("name"), slug: $itemRow.data("slug"), + is_feature : $itemRow.data('is_feature') }, }); }); @@ -509,6 +510,7 @@ jQuery(function ($) { page: pagenow, name: $(event).data("name"), slug: $(event).data("slug"), + is_feature : $( event ).data( 'is_feature' ) }, }); diff --git a/assets/js/admin/form-builder.js b/assets/js/admin/form-builder.js index 9b5bdbdfb..665003fb3 100644 --- a/assets/js/admin/form-builder.js +++ b/assets/js/admin/form-builder.js @@ -23,8 +23,6 @@ var $value = $(this).val(); $(this).val($value.replace(/<\s*script/gi, '').replace(/\s+on\w+\s*=/gi, ' ')); }); - - }); $( document ).ready( function( $ ) { diff --git a/assets/js/admin/upgrade.js b/assets/js/admin/upgrade.js index 87c7130c5..65deccab2 100644 --- a/assets/js/admin/upgrade.js +++ b/assets/js/admin/upgrade.js @@ -9,6 +9,7 @@ jQuery( function( $ ) { $( document.body ).on( 'click dragstart', '.evf-registered-item.evf-upgrade-addon', this.evf_upgrade_addon ); $( document.body ).on( 'click dragstart', '.evf-registered-item.enable-stripe-model', this.enable_stripe_model ); $( document.body ).on( 'click dragstart', '.evf-registered-item.enable-authorize-net-model', this.enable_authorize_net_model ); + $( document.body ).on( 'click dragstart', '.evf-registered-item.enable-square-model', this.enable_square_model ); $( document.body ).on( 'click dragstart', '.everest-forms-field-option-row.upgrade-modal', this.feature_upgrade ); $( document.body ).on( 'click dragstart', '.evf-upgradable-feature, .everest-forms-btn-group span.upgrade-modal', this.feature_upgrade ); $( document.body ).on( 'click dragstart', '.evf-one-time-draggable-field, .evf-registered-item.evf-one-time-draggable-field', this.evf_one_time_draggable_field ); @@ -200,6 +201,22 @@ jQuery( function( $ ) { } }); }, + enable_square_model : function ( e ){ + e.preventDefault(); + $.alert({ + title: evf_upgrade.enable_square_title, + content: evf_upgrade.enable_square_message, + icon: 'dashicons dashicons-info', + type: 'blue', + buttons : { + confirm : { + text: evf_data.i18n_close, + btnClass: 'btn-confirm', + keys: ['enter'] + } + } + }); + }, evf_one_time_draggable_field: function( e ){ e.preventDefault(); $.alert({ diff --git a/assets/js/frontend/ajax-submission.js b/assets/js/frontend/ajax-submission.js index 234c618b0..8895409c1 100644 --- a/assets/js/frontend/ajax-submission.js +++ b/assets/js/frontend/ajax-submission.js @@ -26,6 +26,19 @@ jQuery( function( $ ) { return false; } + //For square payment credit card validation. + var squareMsgContainer = formTuple.find(".everest-forms-gateway[data-gateway='square']").find('.sq-card-message-error'); + if ( squareMsgContainer.length > 0 ) { + var squareErrorMsg = squareMsgContainer.text(); + $( document ).ready( function() { + $( '#card-errors' ).html( squareErrorMsg ).show(); + $( '.evf-submit' ).text( 'Submit' ); + $( '.evf-submit' ).attr( 'disabled', false); + }); + formTuple.trigger( 'focusout' ).trigger( 'change' ).trigger( 'submit' ); + return false; + } + if ( typeof tinyMCE !== 'undefined' ) { tinyMCE.triggerSave(); } @@ -154,6 +167,11 @@ jQuery( function( $ ) { formTuple.trigger( 'evf_process_payment', xhr.data ); return; } + if( 'square' === formTuple.find( ".everest-forms-gateway[data-gateway='square']" ).data('gateway') ){ + formTuple.trigger( 'everest_forms_frontend_payment_before_success_message', xhr.data ); + return; + } + formTuple.trigger( 'reset' ); formTuple.closest( '.everest-forms' ).html( '' + quiz_reporting + preview_confirmation ).focus(); localStorage.removeItem(formTuple.attr('id')); diff --git a/changelog.txt b/changelog.txt index bd7ed378f..eda697f13 100644 --- a/changelog.txt +++ b/changelog.txt @@ -4,6 +4,7 @@ * Feature - Enable minimum time for form submission. * Feature - Delete option in Header logo in PDF Submission. * Enhancement - Custom file name field settings. +* Dev - Square Payment. * Dev - Transaction Table. * Dev - Salesflare into Module. * Dev - ConvertKit Compatibility. diff --git a/includes/admin/class-evf-admin-assets.php b/includes/admin/class-evf-admin-assets.php index fdd1c99f1..ebd6ba364 100644 --- a/includes/admin/class-evf-admin-assets.php +++ b/includes/admin/class-evf-admin-assets.php @@ -225,6 +225,8 @@ public function admin_scripts() { 'enable_stripe_message' => esc_html__( 'Enable Stripe Payment gateway in payments section to use this field.', 'everest-forms' ), 'enable_authorize_net_title' => esc_html__( 'Please enable Authorize.Net', 'everest-forms' ), 'enable_authorize_net_message' => esc_html__( 'Enable Authorize.Net Payment gateway in payments section to use this field.', 'everest-forms' ), + 'enable_square_title' => esc_html( 'Please enable Square', 'everest-forms' ), + 'enable_square_message' => esc_html__( 'Enable Square Payment gateway in payments section to use this field.', 'everest-forms' ), 'evf_install_and_active_nonce' => wp_create_nonce( 'install_and_active_nonce' ), 'upgrade_plan_title' => esc_html__( 'is a Premium Addon', 'everest-forms' ), 'upgrade_plan_message' => esc_html__( 'This addon requires premium plan. Please upgrade to the Premium plan to unlock all these awesome field.', 'everest-forms' ), diff --git a/includes/class-evf-form-task.php b/includes/class-evf-form-task.php index 89cd8f606..ceba8efb9 100644 --- a/includes/class-evf-form-task.php +++ b/includes/class-evf-form-task.php @@ -187,7 +187,7 @@ public function do_task( $entry ) { do_action( "everest_forms_process_before_{$form_id}", $entry, $this->form_data ); $ajax_form_submission = isset( $this->form_data['settings']['ajax_form_submission'] ) ? $this->form_data['settings']['ajax_form_submission'] : 0; - if ( isset( $this->form_data['payments']['stripe']['enable_stripe'] ) && '1' === $this->form_data['payments']['stripe']['enable_stripe'] ) { + if ( ( isset( $this->form_data['payments']['stripe']['enable_stripe'] ) && '1' === $this->form_data['payments']['stripe']['enable_stripe'] ) || ( isset( $this->form_data['payments']['square']['enable_square'] ) && '1' === $this->form_data['payments']['square']['enable_square'] ) ) { $ajax_form_submission = '1'; } if ( '1' === $ajax_form_submission ) { diff --git a/includes/class-evf-forms-features.php b/includes/class-evf-forms-features.php index c722870fe..506594372 100644 --- a/includes/class-evf-forms-features.php +++ b/includes/class-evf-forms-features.php @@ -60,6 +60,7 @@ public function form_fields( $fields ) { 'EVF_Field_Color', 'EVF_Field_Reset', 'EVF_Field_Lookup', + 'EVF_Field_Payment_Square', ); return array_merge( $fields, $pro_fields ); diff --git a/includes/fields/class-evf-field-payment-square.php b/includes/fields/class-evf-field-payment-square.php new file mode 100644 index 000000000..bf5df7cc7 --- /dev/null +++ b/includes/fields/class-evf-field-payment-square.php @@ -0,0 +1,36 @@ +name = esc_html__( 'Square', 'everest-forms' ); + $this->type = 'square-payment'; + $this->icon = 'evf-icon evf-icon-payment'; + $this->order = 231; + $this->group = 'payment'; + $this->is_pro = true; + $this->plan = 'personal agency themegrill-agency'; + $this->addon = 'everest-forms-square'; + $this->links = array( + 'image_id' => '', + 'vedio_id' => 'a5EcKjwWD1A', + ); + + parent::__construct(); + } +} diff --git a/includes/shortcodes/class-evf-shortcode-form.php b/includes/shortcodes/class-evf-shortcode-form.php index a47e89d3d..c13642993 100644 --- a/includes/shortcodes/class-evf-shortcode-form.php +++ b/includes/shortcodes/class-evf-shortcode-form.php @@ -906,7 +906,7 @@ private static function view( $atts ) { $form_enabled = isset( $form_data['form_enabled'] ) ? absint( $form_data['form_enabled'] ) : 1; $kff_enabled = isset( $settings['keyboard_friendly_form'] ) ? absint( $settings['keyboard_friendly_form'] ) : 0; $disable_message = isset( $form_data['settings']['form_disable_message'] ) ? evf_string_translation( $form_data['id'], 'form_disable_message', $form_data['settings']['form_disable_message'] ) : __( 'This form is disabled.', 'everest-forms' ); - if ( isset( $form_data['payments']['stripe']['enable_stripe'] ) && '1' === $form_data['payments']['stripe']['enable_stripe'] ) { + if ( ( isset( $form_data['payments']['stripe']['enable_stripe'] ) && '1' === $form_data['payments']['stripe']['enable_stripe'] ) || ( isset( $form_data['payments']['square']['enable_square'] ) && '1' === $form_data['payments']['square']['enable_square'] ) ) { $ajax_form_submission = isset( $settings['ajax_form_submission'] ) ? 1 : 0; } else { $ajax_form_submission = isset( $settings['ajax_form_submission'] ) ? $settings['ajax_form_submission'] : 0; diff --git a/readme.txt b/readme.txt index 2dacf97e5..884764e26 100644 --- a/readme.txt +++ b/readme.txt @@ -312,6 +312,7 @@ Yes you can! Join in on our [GitHub repository](https://github.com/wpeverest/eve * Feature - Enable minimum time for form submission. * Feature - Delete option in Header logo in PDF Submission. * Enhancement - Custom file name field settings. +* Dev - Square Payment. * Dev - Transaction Table. * Dev - Salesflare into Module. * Dev - ConvertKit Compatibility.