Changeset 2852878
- Timestamp:
- 01/23/2023 11:54:37 AM (3 years ago)
- Location:
- sprinque
- Files:
-
- 16 edited
- 1 copied
-
tags/1.2.3 (copied) (copied from sprinque/trunk)
-
tags/1.2.3/assets/css/frontend.css (modified) (2 diffs)
-
tags/1.2.3/assets/css/frontend.scss (modified) (2 diffs)
-
tags/1.2.3/assets/js/frontend.js (modified) (8 diffs)
-
tags/1.2.3/include/payment_method.php (modified) (3 diffs)
-
tags/1.2.3/languages/sprinque.po (modified) (2 diffs)
-
tags/1.2.3/languages/sprinque.pot (modified) (2 diffs)
-
tags/1.2.3/readme.txt (modified) (2 diffs)
-
tags/1.2.3/sprinque.php (modified) (5 diffs)
-
trunk/assets/css/frontend.css (modified) (2 diffs)
-
trunk/assets/css/frontend.scss (modified) (2 diffs)
-
trunk/assets/js/frontend.js (modified) (8 diffs)
-
trunk/include/payment_method.php (modified) (3 diffs)
-
trunk/languages/sprinque.po (modified) (2 diffs)
-
trunk/languages/sprinque.pot (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/sprinque.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sprinque/tags/1.2.3/assets/css/frontend.css
r2849745 r2852878 593 593 } 594 594 .search-company-by input[type=radio] + .input-placeholder { 595 position: relative; 595 596 display: inline-block; 596 597 width: 18px; … … 602 603 border: 1px solid #B5B9E2; 603 604 } 605 .search-company-by input[type=radio] + .input-placeholder:after { 606 content: ""; 607 position: absolute; 608 display: none; 609 top: 3px; 610 left: 6px; 611 width: 5px; 612 height: 9px; 613 border: solid white; 614 border-width: 0 2px 2px 0; 615 -webkit-transform: rotate(45deg); 616 -ms-transform: rotate(45deg); 617 transform: rotate(45deg); 618 } 604 619 .search-company-by input[type=radio]:checked + .input-placeholder { 605 620 background-color: #00033C; 606 621 border-color: #00033C; 607 background-image: url("../img/checkmark.png"); 608 background-repeat: no-repeat; 609 background-position: center center;622 } 623 .search-company-by input[type=radio]:checked + .input-placeholder:after { 624 display: block; 610 625 } 611 626 -
sprinque/tags/1.2.3/assets/css/frontend.scss
r2849745 r2852878 769 769 770 770 & + .input-placeholder { 771 position: relative; 771 772 display: inline-block; 772 773 width: 18px; … … 777 778 box-sizing: border-box; 778 779 border: 1px solid #B5B9E2; 780 781 &:after { 782 content: ""; 783 position: absolute; 784 display: none; 785 top: 3px; 786 left: 6px; 787 width: 5px; 788 height: 9px; 789 border: solid white; 790 border-width: 0 2px 2px 0; 791 -webkit-transform: rotate(45deg); 792 -ms-transform: rotate(45deg); 793 transform: rotate(45deg); 794 } 779 795 } 780 796 &:checked + .input-placeholder { 781 797 background-color: #00033C; 782 798 border-color: #00033C; 783 background-image: url("../img/checkmark.png"); 784 background-repeat: no-repeat; 785 background-position: center center; 799 //background-image: url("../img/checkmark.png"); 800 //background-repeat: no-repeat; 801 //background-position: center center; 802 &:after { 803 display: block; 804 } 786 805 } 787 806 } -
sprinque/tags/1.2.3/assets/js/frontend.js
r2849745 r2852878 149 149 var orderPayed = false; 150 150 151 var buyer_email; 152 var merchant_buyer_id; 153 151 154 $("body").on("click", "#place_order", function(event) { 152 155 if(!orderPayed && $('#payment_method_wpm_srinque_pay').length && $('#payment_method_wpm_srinque_pay').is(':checked')) { … … 177 180 showPopup('#wpm-modal-form'); 178 181 179 // Exclude Sprinque domains from the fullstory 180 let hostname = window.location.hostname; 181 if(hostname !== 'sprinque.wp-masters.com' && hostname !== 'wp-demo.sprinque.com'){ 182 window['_fs_host'] = 'fullstory.com'; 183 window['_fs_script'] = 'edge.fullstory.com/s/fs.js'; 184 window['_fs_org'] = 'o-1ESJKB-na1'; 185 window['_fs_namespace'] = 'FS'; 186 (function(m,n,e,t,l,o,g,y){ 187 if (e in m) {if(m.console && m.console.log) { m.console.log('FullStory namespace conflict. Please set window["_fs_namespace"].');} return;} 188 g=m[e]=function(a,b,s){g.q?g.q.push([a,b,s]):g._api(a,b,s);};g.q=[]; 189 o=n.createElement(t);o.async=1;o.crossOrigin='anonymous';o.src='https://'+_fs_script; 190 y=n.getElementsByTagName(t)[0];y.parentNode.insertBefore(o,y); 191 g.identify=function(i,v,s){g(l,{uid:i},s);if(v)g(l,v,s)};g.setUserVars=function(v,s){g(l,v,s)};g.event=function(i,v,s){g('event',{n:i,p:v},s)}; 192 g.anonymize=function(){g.identify(!!0)}; 193 g.shutdown=function(){g("rec",!1)};g.restart=function(){g("rec",!0)}; 194 g.log = function(a,b){g("log",[a,b])}; 195 g.consent=function(a){g("consent",!arguments.length||a)}; 196 g.identifyAccount=function(i,v){o='account';v=v||{};v.acctId=i;g(o,v)}; 197 g.clearUserCookie=function(){}; 198 g.setVars=function(n, p){g('setVars',[n,p]);}; 199 g._w={};y='XMLHttpRequest';g._w[y]=m[y];y='fetch';g._w[y]=m[y]; 200 if(m[y])m[y]=function(){return g._w[y].apply(this,arguments)}; 201 g._v="1.3.0"; 202 })(window,document,window['_fs_namespace'],'script','user'); 203 } 182 // Set buyer email 183 buyer_email = $('#billing_email').val(); 184 185 // // Exclude Sprinque domains from the fullstory 186 // let hostname = window.location.hostname; 187 // if(hostname !== 'sprinque.wp-masters.com' && hostname !== 'wp-demo.sprinque.com'){ 188 // window['_fs_host'] = 'fullstory.com'; 189 // window['_fs_script'] = 'edge.fullstory.com/s/fs.js'; 190 // window['_fs_org'] = 'o-1ESJKB-na1'; 191 // window['_fs_namespace'] = 'FS'; 192 // (function(m,n,e,t,l,o,g,y){ 193 // if (e in m) {if(m.console && m.console.log) { m.console.log('FullStory namespace conflict. Please set window["_fs_namespace"].');} return;} 194 // g=m[e]=function(a,b,s){g.q?g.q.push([a,b,s]):g._api(a,b,s);};g.q=[]; 195 // o=n.createElement(t);o.async=1;o.crossOrigin='anonymous';o.src='https://'+_fs_script; 196 // y=n.getElementsByTagName(t)[0];y.parentNode.insertBefore(o,y); 197 // g.identify=function(i,v,s){g(l,{uid:i},s);if(v)g(l,v,s)};g.setUserVars=function(v,s){g(l,v,s)};g.event=function(i,v,s){g('event',{n:i,p:v},s)}; 198 // g.anonymize=function(){g.identify(!!0)}; 199 // g.shutdown=function(){g("rec",!1)};g.restart=function(){g("rec",!0)}; 200 // g.log = function(a,b){g("log",[a,b])}; 201 // g.consent=function(a){g("consent",!arguments.length||a)}; 202 // g.identifyAccount=function(i,v){o='account';v=v||{};v.acctId=i;g(o,v)}; 203 // g.clearUserCookie=function(){}; 204 // g.setVars=function(n, p){g('setVars',[n,p]);}; 205 // g._w={};y='XMLHttpRequest';g._w[y]=m[y];y='fetch';g._w[y]=m[y]; 206 // if(m[y])m[y]=function(){return g._w[y].apply(this,arguments)}; 207 // g._v="1.3.0"; 208 // })(window,document,window['_fs_namespace'],'script','user'); 209 // } 204 210 205 211 } … … 271 277 if($(this).val() == country) { 272 278 $('#select_country_pay').wpmSelect('setVal', country); 279 $('#company_name_pay').val($('#billing_company').val()); 273 280 } 274 281 }); … … 385 392 386 393 }); 387 388 var buyer_email;389 var merchant_buyer_id;390 394 391 395 $("body").on("click", "#register_buyer_company", function(event) { … … 441 445 } 442 446 } else { 443 $('.error-register-fields').html(response.message).show(); 447 let errorMessages = response.message; 448 if ('response' in response && 'errors' in response.response) { 449 errorMessages += searchAdditionalErrorHandler(response.response.errors) 450 } 451 452 $('.error-confirm-order').html(errorMessages).show(); 444 453 } 445 454 } … … 568 577 } 569 578 } else { 570 $('.error-confirm-order').show().html(response.message); 579 let errorMessages = response.message; 580 if ('response' in response && 'errors' in response.response) { 581 errorMessages += searchAdditionalErrorHandler(response.response.errors) 582 } 583 584 $('.error-confirm-order').show().html(errorMessages); 571 585 } 572 586 } … … 576 590 } 577 591 }); 592 593 function searchAdditionalErrorHandler(data) { 594 let resultHtml = ''; 595 596 try { 597 for (let key in data) { 598 data[key].forEach(errors => { 599 for (let field in errors) { 600 errors[field].forEach(message => { 601 resultHtml += '<p>' + message + '</p>'; 602 }); 603 } 604 }); 605 } 606 } catch (e) { 607 console.log(e); 608 } 609 610 return resultHtml; 611 } 578 612 579 613 function verify_company() { … … 786 820 var search_by = $('input[name="search_by"]:checked').val(); 787 821 788 if(country_code.length > 0 && company_name.length > 1&& !orderPayed) {822 if(country_code.length > 0 && company_name.length > 2 && !orderPayed) { 789 823 790 824 $('.search-company-result').addClass('search-company-result_loading'); -
sprinque/tags/1.2.3/include/payment_method.php
r2849683 r2852878 27 27 add_action( 'wp_ajax_nopriv_sprinque_register_buyer', 'sprinque_register_buyer_api', 99 ); 28 28 29 add_action( 'wp_ajax_sprinque_get_business_details', 'sprinque_get_business_details', 99 );30 add_action( 'wp_ajax_nopriv_sprinque_get_business_details', 'sprinque_get_business_details', 99 );31 32 29 add_action( 'wp_ajax_sprinque_get_countries_api', 'sprinque_get_countries_api', 99 ); 33 30 add_action( 'wp_ajax_nopriv_sprinque_get_countries_api', 'sprinque_get_countries_api', 99 ); … … 39 36 $SrinquePay = new WPM_SrinquePay; 40 37 $SrinquePay->sprinque_get_buyer_info(); 41 }42 43 /**44 * Get Buyer Info45 */46 function sprinque_get_business_details() {47 $SrinquePay = new WPM_SrinquePay;48 $SrinquePay->sprinque_get_business_details();49 38 } 50 39 … … 170 159 171 160 include( PLUGIN_SRINQUE_DIR . '/templates/frontend/srinque_pay_modal_form.php' ); 172 }173 174 /**175 * Get List Sprinque companies176 */177 public function sprinque_get_business_details() {178 if (! isset( $_POST['country_code'] ) || ! isset( $_POST['registration_number'] ) ) {179 return false;180 }181 182 $data = [183 'country_code' => sanitize_text_field($_POST['country_code']),184 'registration_number' => sanitize_text_field($_POST['registration_number'])185 ];186 187 $business = $this->srinque_api( $data, 'POST', '/search/business/details' );188 189 ob_start();190 include( PLUGIN_SRINQUE_DIR . '/templates/ajax/company_item.php' );191 $result = ob_get_clean();192 193 wp_send_json( [194 'status' => 'true',195 'html' => $result196 ] );197 161 } 198 162 -
sprinque/tags/1.2.3/languages/sprinque.po
r2849683 r2852878 117 117 msgstr "" 118 118 119 msgid "Company name" 120 msgstr "" 121 119 #: templates/frontend/srinque_pay_modal_form.php:31 122 120 msgid "VAT ID" 121 msgstr "" 122 123 #: templates/frontend/srinque_pay_modal_form.php:29 124 msgid "Company VAT ID" 123 125 msgstr "" 124 126 … … 180 182 #: templates/frontend/srinque_pay_modal_form.php:21 181 183 #: templates/frontend/srinque_pay_modal_form.php:22 184 #: templates/frontend/srinque_pay_modal_form.php:24 185 #: templates/frontend/srinque_pay_modal_form.php:26 182 186 msgid "Company Name" 183 187 msgstr "" -
sprinque/tags/1.2.3/languages/sprinque.pot
r2849683 r2852878 61 61 msgstr "" 62 62 63 msgid "Company name" 64 msgstr "" 65 63 #: templates/frontend/srinque_pay_modal_form.php:31 66 64 msgid "VAT ID" 65 msgstr "" 66 67 #: templates/frontend/srinque_pay_modal_form.php:29 68 msgid "Company VAT ID" 67 69 msgstr "" 68 70 … … 109 111 #: templates/frontend/srinque_pay_modal_form.php:21 110 112 #: templates/frontend/srinque_pay_modal_form.php:22 113 #: templates/frontend/srinque_pay_modal_form.php:24 114 #: templates/frontend/srinque_pay_modal_form.php:26 111 115 msgid "Company Name" 112 116 msgstr "" -
sprinque/tags/1.2.3/readme.txt
r2849745 r2852878 6 6 Tested up to: 6.0 7 7 Requires PHP: 5.3 8 Stable tag: 1.2. 28 Stable tag: 1.2.3 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 50 50 51 51 == Changelog == 52 53 = 1.2.3 - January 20, 2023 = 54 * Fixed save-checkout-fields-issue; 55 * Block search for less than 2 characters; 56 * The API errors have been displayed; 57 * Search to be executed when the country is changed; 58 * Edit email in the root form is reflected in the sprinque otp; 59 * Delete unused legacy search/business/details; 60 * Fixed vat-id related .po and .pot translations; 61 * Improved the search checkbox quality; 62 * Turned off the fullstory; 63 * Used PLUGIN_SRINQUE_VERSION for styles and js; 52 64 53 65 = 1.2.2 - January 17, 2023 = -
sprinque/tags/1.2.3/sprinque.php
r2849745 r2852878 5 5 Description: 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. 6 6 Author: Sprinque 7 Version: 1.2. 27 Version: 1.2.3 8 8 Text Domain: sprinque 9 9 Domain Path: /languages 10 10 */ 11 11 12 define( 'PLUGIN_SRINQUE_VERSION', '1.2.3' ); 12 13 define( 'PLUGIN_SRINQUE_DIR', __DIR__ ); 13 14 define( 'PLUGIN_SRINQUE_PATH', plugins_url( '', __FILE__ ) ); … … 62 63 // WebHook functions 63 64 add_action( 'init', [ $this, 'get_webhook_response' ], 99 ); 64 add_action( ' init', [ $this, 'save_checkout_fields' ], 99 );65 add_action( 'woocommerce_checkout_update_order_review', [ $this, 'save_checkout_fields' ], 99 ); 65 66 66 67 // Orders and cart … … 243 244 */ 244 245 public function save_checkout_fields() { 245 if (isset( $_POST['post_data'])) { 246 // Get Form data from Checkout 247 $form_data = explode( '&', sanitize_text_field( $_POST['post_data'] ) ); 248 $filtered = []; 249 250 // Prepare Array 251 foreach ( $form_data as $value ) { 252 $sliced = explode( '=', $value ); 253 $filtered[ $sliced[0] ] = $sliced[1]; 254 } 255 256 // Set Customer Billing Data 257 $this->setCustomerBillingData($filtered); 258 259 // Set Customer Shipping Data 260 $this->setCustomerShippingData($filtered); 261 } 246 // Get Form data from Checkout 247 $form_data = explode( '&', sanitize_text_field( $_POST['post_data'] ) ); 248 $filtered = []; 249 250 // Prepare Array 251 foreach ( $form_data as $value ) { 252 $sliced = explode( '=', $value ); 253 $filtered[ $sliced[0] ] = $sliced[1]; 254 } 255 256 // Set Customer Billing Data 257 $this->setCustomerBillingData($filtered); 258 259 // Set Customer Shipping Data 260 $this->setCustomerShippingData($filtered); 262 261 } 263 262 … … 443 442 // Prepare Data to Send 444 443 $data = [ 445 'merchant_order_id' => $order_id_from_sequential_plugin ?: $order->get_id(),444 'merchant_order_id' => ( $order_id_from_sequential_plugin ?: $order->get_id() ) . '_wh', 446 445 'order_amount' => $order->get_total(), 447 446 'shipping_address' => [ … … 559 558 public function include_scripts_and_styles() { 560 559 // Register styles 561 wp_enqueue_style( 'wpm_srinque_pay', PLUGIN_SRINQUE_PATH . '/assets/css/frontend.css', false, '1.0.91', 'all' );560 wp_enqueue_style( 'wpm_srinque_pay', PLUGIN_SRINQUE_PATH . '/assets/css/frontend.css', false, PLUGIN_SRINQUE_VERSION, 'all' ); 562 561 563 562 // Register scripts 564 563 $settings = get_option( 'woocommerce_wpm_srinque_pay_settings', true ); 565 wp_enqueue_script( 'wpm_srinque_pay', PLUGIN_SRINQUE_PATH . '/assets/js/frontend.js', array( 'jquery' ), '1.0.91', 'all' );564 wp_enqueue_script( 'wpm_srinque_pay', PLUGIN_SRINQUE_PATH . '/assets/js/frontend.js', array( 'jquery' ), PLUGIN_SRINQUE_VERSION, 'all' ); 566 565 wp_localize_script( 'wpm_srinque_pay', 'admin', array( 567 566 'ajaxurl' => admin_url( 'admin-ajax.php' ), -
sprinque/trunk/assets/css/frontend.css
r2849745 r2852878 593 593 } 594 594 .search-company-by input[type=radio] + .input-placeholder { 595 position: relative; 595 596 display: inline-block; 596 597 width: 18px; … … 602 603 border: 1px solid #B5B9E2; 603 604 } 605 .search-company-by input[type=radio] + .input-placeholder:after { 606 content: ""; 607 position: absolute; 608 display: none; 609 top: 3px; 610 left: 6px; 611 width: 5px; 612 height: 9px; 613 border: solid white; 614 border-width: 0 2px 2px 0; 615 -webkit-transform: rotate(45deg); 616 -ms-transform: rotate(45deg); 617 transform: rotate(45deg); 618 } 604 619 .search-company-by input[type=radio]:checked + .input-placeholder { 605 620 background-color: #00033C; 606 621 border-color: #00033C; 607 background-image: url("../img/checkmark.png"); 608 background-repeat: no-repeat; 609 background-position: center center;622 } 623 .search-company-by input[type=radio]:checked + .input-placeholder:after { 624 display: block; 610 625 } 611 626 -
sprinque/trunk/assets/css/frontend.scss
r2849745 r2852878 769 769 770 770 & + .input-placeholder { 771 position: relative; 771 772 display: inline-block; 772 773 width: 18px; … … 777 778 box-sizing: border-box; 778 779 border: 1px solid #B5B9E2; 780 781 &:after { 782 content: ""; 783 position: absolute; 784 display: none; 785 top: 3px; 786 left: 6px; 787 width: 5px; 788 height: 9px; 789 border: solid white; 790 border-width: 0 2px 2px 0; 791 -webkit-transform: rotate(45deg); 792 -ms-transform: rotate(45deg); 793 transform: rotate(45deg); 794 } 779 795 } 780 796 &:checked + .input-placeholder { 781 797 background-color: #00033C; 782 798 border-color: #00033C; 783 background-image: url("../img/checkmark.png"); 784 background-repeat: no-repeat; 785 background-position: center center; 799 //background-image: url("../img/checkmark.png"); 800 //background-repeat: no-repeat; 801 //background-position: center center; 802 &:after { 803 display: block; 804 } 786 805 } 787 806 } -
sprinque/trunk/assets/js/frontend.js
r2849745 r2852878 149 149 var orderPayed = false; 150 150 151 var buyer_email; 152 var merchant_buyer_id; 153 151 154 $("body").on("click", "#place_order", function(event) { 152 155 if(!orderPayed && $('#payment_method_wpm_srinque_pay').length && $('#payment_method_wpm_srinque_pay').is(':checked')) { … … 177 180 showPopup('#wpm-modal-form'); 178 181 179 // Exclude Sprinque domains from the fullstory 180 let hostname = window.location.hostname; 181 if(hostname !== 'sprinque.wp-masters.com' && hostname !== 'wp-demo.sprinque.com'){ 182 window['_fs_host'] = 'fullstory.com'; 183 window['_fs_script'] = 'edge.fullstory.com/s/fs.js'; 184 window['_fs_org'] = 'o-1ESJKB-na1'; 185 window['_fs_namespace'] = 'FS'; 186 (function(m,n,e,t,l,o,g,y){ 187 if (e in m) {if(m.console && m.console.log) { m.console.log('FullStory namespace conflict. Please set window["_fs_namespace"].');} return;} 188 g=m[e]=function(a,b,s){g.q?g.q.push([a,b,s]):g._api(a,b,s);};g.q=[]; 189 o=n.createElement(t);o.async=1;o.crossOrigin='anonymous';o.src='https://'+_fs_script; 190 y=n.getElementsByTagName(t)[0];y.parentNode.insertBefore(o,y); 191 g.identify=function(i,v,s){g(l,{uid:i},s);if(v)g(l,v,s)};g.setUserVars=function(v,s){g(l,v,s)};g.event=function(i,v,s){g('event',{n:i,p:v},s)}; 192 g.anonymize=function(){g.identify(!!0)}; 193 g.shutdown=function(){g("rec",!1)};g.restart=function(){g("rec",!0)}; 194 g.log = function(a,b){g("log",[a,b])}; 195 g.consent=function(a){g("consent",!arguments.length||a)}; 196 g.identifyAccount=function(i,v){o='account';v=v||{};v.acctId=i;g(o,v)}; 197 g.clearUserCookie=function(){}; 198 g.setVars=function(n, p){g('setVars',[n,p]);}; 199 g._w={};y='XMLHttpRequest';g._w[y]=m[y];y='fetch';g._w[y]=m[y]; 200 if(m[y])m[y]=function(){return g._w[y].apply(this,arguments)}; 201 g._v="1.3.0"; 202 })(window,document,window['_fs_namespace'],'script','user'); 203 } 182 // Set buyer email 183 buyer_email = $('#billing_email').val(); 184 185 // // Exclude Sprinque domains from the fullstory 186 // let hostname = window.location.hostname; 187 // if(hostname !== 'sprinque.wp-masters.com' && hostname !== 'wp-demo.sprinque.com'){ 188 // window['_fs_host'] = 'fullstory.com'; 189 // window['_fs_script'] = 'edge.fullstory.com/s/fs.js'; 190 // window['_fs_org'] = 'o-1ESJKB-na1'; 191 // window['_fs_namespace'] = 'FS'; 192 // (function(m,n,e,t,l,o,g,y){ 193 // if (e in m) {if(m.console && m.console.log) { m.console.log('FullStory namespace conflict. Please set window["_fs_namespace"].');} return;} 194 // g=m[e]=function(a,b,s){g.q?g.q.push([a,b,s]):g._api(a,b,s);};g.q=[]; 195 // o=n.createElement(t);o.async=1;o.crossOrigin='anonymous';o.src='https://'+_fs_script; 196 // y=n.getElementsByTagName(t)[0];y.parentNode.insertBefore(o,y); 197 // g.identify=function(i,v,s){g(l,{uid:i},s);if(v)g(l,v,s)};g.setUserVars=function(v,s){g(l,v,s)};g.event=function(i,v,s){g('event',{n:i,p:v},s)}; 198 // g.anonymize=function(){g.identify(!!0)}; 199 // g.shutdown=function(){g("rec",!1)};g.restart=function(){g("rec",!0)}; 200 // g.log = function(a,b){g("log",[a,b])}; 201 // g.consent=function(a){g("consent",!arguments.length||a)}; 202 // g.identifyAccount=function(i,v){o='account';v=v||{};v.acctId=i;g(o,v)}; 203 // g.clearUserCookie=function(){}; 204 // g.setVars=function(n, p){g('setVars',[n,p]);}; 205 // g._w={};y='XMLHttpRequest';g._w[y]=m[y];y='fetch';g._w[y]=m[y]; 206 // if(m[y])m[y]=function(){return g._w[y].apply(this,arguments)}; 207 // g._v="1.3.0"; 208 // })(window,document,window['_fs_namespace'],'script','user'); 209 // } 204 210 205 211 } … … 271 277 if($(this).val() == country) { 272 278 $('#select_country_pay').wpmSelect('setVal', country); 279 $('#company_name_pay').val($('#billing_company').val()); 273 280 } 274 281 }); … … 385 392 386 393 }); 387 388 var buyer_email;389 var merchant_buyer_id;390 394 391 395 $("body").on("click", "#register_buyer_company", function(event) { … … 441 445 } 442 446 } else { 443 $('.error-register-fields').html(response.message).show(); 447 let errorMessages = response.message; 448 if ('response' in response && 'errors' in response.response) { 449 errorMessages += searchAdditionalErrorHandler(response.response.errors) 450 } 451 452 $('.error-confirm-order').html(errorMessages).show(); 444 453 } 445 454 } … … 568 577 } 569 578 } else { 570 $('.error-confirm-order').show().html(response.message); 579 let errorMessages = response.message; 580 if ('response' in response && 'errors' in response.response) { 581 errorMessages += searchAdditionalErrorHandler(response.response.errors) 582 } 583 584 $('.error-confirm-order').show().html(errorMessages); 571 585 } 572 586 } … … 576 590 } 577 591 }); 592 593 function searchAdditionalErrorHandler(data) { 594 let resultHtml = ''; 595 596 try { 597 for (let key in data) { 598 data[key].forEach(errors => { 599 for (let field in errors) { 600 errors[field].forEach(message => { 601 resultHtml += '<p>' + message + '</p>'; 602 }); 603 } 604 }); 605 } 606 } catch (e) { 607 console.log(e); 608 } 609 610 return resultHtml; 611 } 578 612 579 613 function verify_company() { … … 786 820 var search_by = $('input[name="search_by"]:checked').val(); 787 821 788 if(country_code.length > 0 && company_name.length > 1&& !orderPayed) {822 if(country_code.length > 0 && company_name.length > 2 && !orderPayed) { 789 823 790 824 $('.search-company-result').addClass('search-company-result_loading'); -
sprinque/trunk/include/payment_method.php
r2849683 r2852878 27 27 add_action( 'wp_ajax_nopriv_sprinque_register_buyer', 'sprinque_register_buyer_api', 99 ); 28 28 29 add_action( 'wp_ajax_sprinque_get_business_details', 'sprinque_get_business_details', 99 );30 add_action( 'wp_ajax_nopriv_sprinque_get_business_details', 'sprinque_get_business_details', 99 );31 32 29 add_action( 'wp_ajax_sprinque_get_countries_api', 'sprinque_get_countries_api', 99 ); 33 30 add_action( 'wp_ajax_nopriv_sprinque_get_countries_api', 'sprinque_get_countries_api', 99 ); … … 39 36 $SrinquePay = new WPM_SrinquePay; 40 37 $SrinquePay->sprinque_get_buyer_info(); 41 }42 43 /**44 * Get Buyer Info45 */46 function sprinque_get_business_details() {47 $SrinquePay = new WPM_SrinquePay;48 $SrinquePay->sprinque_get_business_details();49 38 } 50 39 … … 170 159 171 160 include( PLUGIN_SRINQUE_DIR . '/templates/frontend/srinque_pay_modal_form.php' ); 172 }173 174 /**175 * Get List Sprinque companies176 */177 public function sprinque_get_business_details() {178 if (! isset( $_POST['country_code'] ) || ! isset( $_POST['registration_number'] ) ) {179 return false;180 }181 182 $data = [183 'country_code' => sanitize_text_field($_POST['country_code']),184 'registration_number' => sanitize_text_field($_POST['registration_number'])185 ];186 187 $business = $this->srinque_api( $data, 'POST', '/search/business/details' );188 189 ob_start();190 include( PLUGIN_SRINQUE_DIR . '/templates/ajax/company_item.php' );191 $result = ob_get_clean();192 193 wp_send_json( [194 'status' => 'true',195 'html' => $result196 ] );197 161 } 198 162 -
sprinque/trunk/languages/sprinque.po
r2849683 r2852878 117 117 msgstr "" 118 118 119 msgid "Company name" 120 msgstr "" 121 119 #: templates/frontend/srinque_pay_modal_form.php:31 122 120 msgid "VAT ID" 121 msgstr "" 122 123 #: templates/frontend/srinque_pay_modal_form.php:29 124 msgid "Company VAT ID" 123 125 msgstr "" 124 126 … … 180 182 #: templates/frontend/srinque_pay_modal_form.php:21 181 183 #: templates/frontend/srinque_pay_modal_form.php:22 184 #: templates/frontend/srinque_pay_modal_form.php:24 185 #: templates/frontend/srinque_pay_modal_form.php:26 182 186 msgid "Company Name" 183 187 msgstr "" -
sprinque/trunk/languages/sprinque.pot
r2849683 r2852878 61 61 msgstr "" 62 62 63 msgid "Company name" 64 msgstr "" 65 63 #: templates/frontend/srinque_pay_modal_form.php:31 66 64 msgid "VAT ID" 65 msgstr "" 66 67 #: templates/frontend/srinque_pay_modal_form.php:29 68 msgid "Company VAT ID" 67 69 msgstr "" 68 70 … … 109 111 #: templates/frontend/srinque_pay_modal_form.php:21 110 112 #: templates/frontend/srinque_pay_modal_form.php:22 113 #: templates/frontend/srinque_pay_modal_form.php:24 114 #: templates/frontend/srinque_pay_modal_form.php:26 111 115 msgid "Company Name" 112 116 msgstr "" -
sprinque/trunk/readme.txt
r2849745 r2852878 6 6 Tested up to: 6.0 7 7 Requires PHP: 5.3 8 Stable tag: 1.2. 28 Stable tag: 1.2.3 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 50 50 51 51 == Changelog == 52 53 = 1.2.3 - January 20, 2023 = 54 * Fixed save-checkout-fields-issue; 55 * Block search for less than 2 characters; 56 * The API errors have been displayed; 57 * Search to be executed when the country is changed; 58 * Edit email in the root form is reflected in the sprinque otp; 59 * Delete unused legacy search/business/details; 60 * Fixed vat-id related .po and .pot translations; 61 * Improved the search checkbox quality; 62 * Turned off the fullstory; 63 * Used PLUGIN_SRINQUE_VERSION for styles and js; 52 64 53 65 = 1.2.2 - January 17, 2023 = -
sprinque/trunk/sprinque.php
r2849745 r2852878 5 5 Description: 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. 6 6 Author: Sprinque 7 Version: 1.2. 27 Version: 1.2.3 8 8 Text Domain: sprinque 9 9 Domain Path: /languages 10 10 */ 11 11 12 define( 'PLUGIN_SRINQUE_VERSION', '1.2.3' ); 12 13 define( 'PLUGIN_SRINQUE_DIR', __DIR__ ); 13 14 define( 'PLUGIN_SRINQUE_PATH', plugins_url( '', __FILE__ ) ); … … 62 63 // WebHook functions 63 64 add_action( 'init', [ $this, 'get_webhook_response' ], 99 ); 64 add_action( ' init', [ $this, 'save_checkout_fields' ], 99 );65 add_action( 'woocommerce_checkout_update_order_review', [ $this, 'save_checkout_fields' ], 99 ); 65 66 66 67 // Orders and cart … … 243 244 */ 244 245 public function save_checkout_fields() { 245 if (isset( $_POST['post_data'])) { 246 // Get Form data from Checkout 247 $form_data = explode( '&', sanitize_text_field( $_POST['post_data'] ) ); 248 $filtered = []; 249 250 // Prepare Array 251 foreach ( $form_data as $value ) { 252 $sliced = explode( '=', $value ); 253 $filtered[ $sliced[0] ] = $sliced[1]; 254 } 255 256 // Set Customer Billing Data 257 $this->setCustomerBillingData($filtered); 258 259 // Set Customer Shipping Data 260 $this->setCustomerShippingData($filtered); 261 } 246 // Get Form data from Checkout 247 $form_data = explode( '&', sanitize_text_field( $_POST['post_data'] ) ); 248 $filtered = []; 249 250 // Prepare Array 251 foreach ( $form_data as $value ) { 252 $sliced = explode( '=', $value ); 253 $filtered[ $sliced[0] ] = $sliced[1]; 254 } 255 256 // Set Customer Billing Data 257 $this->setCustomerBillingData($filtered); 258 259 // Set Customer Shipping Data 260 $this->setCustomerShippingData($filtered); 262 261 } 263 262 … … 443 442 // Prepare Data to Send 444 443 $data = [ 445 'merchant_order_id' => $order_id_from_sequential_plugin ?: $order->get_id(),444 'merchant_order_id' => ( $order_id_from_sequential_plugin ?: $order->get_id() ) . '_wh', 446 445 'order_amount' => $order->get_total(), 447 446 'shipping_address' => [ … … 559 558 public function include_scripts_and_styles() { 560 559 // Register styles 561 wp_enqueue_style( 'wpm_srinque_pay', PLUGIN_SRINQUE_PATH . '/assets/css/frontend.css', false, '1.0.91', 'all' );560 wp_enqueue_style( 'wpm_srinque_pay', PLUGIN_SRINQUE_PATH . '/assets/css/frontend.css', false, PLUGIN_SRINQUE_VERSION, 'all' ); 562 561 563 562 // Register scripts 564 563 $settings = get_option( 'woocommerce_wpm_srinque_pay_settings', true ); 565 wp_enqueue_script( 'wpm_srinque_pay', PLUGIN_SRINQUE_PATH . '/assets/js/frontend.js', array( 'jquery' ), '1.0.91', 'all' );564 wp_enqueue_script( 'wpm_srinque_pay', PLUGIN_SRINQUE_PATH . '/assets/js/frontend.js', array( 'jquery' ), PLUGIN_SRINQUE_VERSION, 'all' ); 566 565 wp_localize_script( 'wpm_srinque_pay', 'admin', array( 567 566 'ajaxurl' => admin_url( 'admin-ajax.php' ),
Note: See TracChangeset
for help on using the changeset viewer.