Plugin Directory

Changeset 2778366


Ignore:
Timestamp:
08/31/2022 03:44:01 PM (4 years ago)
Author:
sprinque
Message:

v.1.0.7

Location:
sprinque
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • sprinque/trunk/assets/js/frontend.js

    r2777074 r2778366  
    144144    var orderPayed = false;
    145145
     146    $("body").on("click", "#place_order", function(event) {
     147        if(!orderPayed && $('#payment_method_wpm_srinque_pay').length && $('#payment_method_wpm_srinque_pay').is(':checked')) {
     148
     149            var errorFound = false;
     150            $( ".woocommerce-billing-fields .validate-required" ).each(function( index ) {
     151                if($(this).find('input.input-text').length && $(this).find('input.input-text').val().length === 0) {
     152                    $(this).addClass('woocommerce-invalid').addClass('woocommerce-invalid-required-field');
     153                    errorFound = true;
     154                }
     155            });
     156
     157            if(errorFound) {
     158                return;
     159            }
     160
     161            event.preventDefault();
     162
     163            get_companies_list();
     164            showPopup('#wpm-modal-form');
     165        }
     166    });
     167
    146168    setInterval(function() {
    147         if(!$('#srinque_pay').length) {
    148             $('#place_order').after('<button type="button" class="button alt" id="srinque_pay">Place order</button>');
    149         }
    150         if(!orderPayed && $('#payment_method_wpm_srinque_pay').length && $('#payment_method_wpm_srinque_pay').is(':checked')) {
    151             $('#srinque_pay').show();
    152             $('#place_order').hide();
    153         } else {
    154             $('#srinque_pay').hide();
    155             $('#place_order').show();
    156         }
    157169        if($('#address_company_pay').length && $('#address_company_pay').val().length > 0 &&
    158170            $('#city_company_pay').length && $('#city_company_pay').val().length > 0 &&
     
    160172                $('#register_buyer_company').prop('disabled', false);
    161173            }
    162         $('.wc_payment_method.payment_method_wpm_srinque_pay label').html(admin.method_title);
    163         $('.payment_box.payment_method_wpm_srinque_pay p').html(admin.method_description);
     174
     175        if($('.wc_payment_method.payment_method_wpm_srinque_pay label').html() !== admin.method_title) {
     176            $('.wc_payment_method.payment_method_wpm_srinque_pay label').html(admin.method_title);
     177        }
     178        if($('.payment_box.payment_method_wpm_srinque_pay p').html() !== admin.method_description) {
     179            $('.payment_box.payment_method_wpm_srinque_pay p').html(admin.method_description);
     180        }
    164181    }, 100);
    165182
    166183    setInterval(function() {
    167         $('.company-not-found').html(admin.not_found_companies);
    168         $('#cant-find-business').html(admin.cant_find_business);
    169         $('#add-manually-business').html(admin.add_manually_business);
     184        if($('.company-not-found').html() !== admin.not_found_companies) {
     185            $('.company-not-found').html(admin.not_found_companies);
     186        }
     187        if($('#cant-find-business').html() !== admin.cant_find_business) {
     188            $('#cant-find-business').html(admin.cant_find_business);
     189        }
     190        if($('#add-manually-business').html() !== admin.add_manually_business) {
     191            $('#add-manually-business').html(admin.add_manually_business);
     192        }
    170193    }, 500);
    171194
     
    195218    });
    196219
    197     $("body").on("click", "#srinque_pay", function(event) {
    198         if($('#payment_method_wpm_srinque_pay').length && $('#payment_method_wpm_srinque_pay').is(':checked') && !orderPayed) {
    199             var errorFound = false;
    200             $( ".woocommerce-billing-fields .validate-required" ).each(function( index ) {
    201                 if($(this).find('input.input-text').length && $(this).find('input.input-text').val().length === 0) {
    202                     $(this).addClass('woocommerce-invalid').addClass('woocommerce-invalid-required-field');
    203                     errorFound = true;
    204                 }
    205             });
    206 
    207             if(errorFound) {
    208                 $("#place_order").trigger("click");
    209                 return;
    210             }
    211 
    212             get_companies_list();
    213             showPopup('#wpm-modal-form');
    214         }
    215     });
    216 
    217220    $("body").on("change", "#select_country_pay", function(event) {
    218221        $('.error-confirm-order').hide();
     
    270273        $('#company_name_pay').val(company_name);
    271274        $('#billing_company').val(company_name);
    272         $('#selected-company-name').val(company_reg_code);
    273275        $('#reg_number_pay').val(company_reg_code);
    274276        $('#confirm-company-order').prop('disabled', false);
     
    314316
    315317        $('#confirm-company-order').prop('disabled', true);
    316         $('#selected-company-name').val('');
    317318        $('.search-company-result').removeClass('search-company-result_loading search-company-result_loaded').html('');
    318319
     
    532533        var zip_code = $('#billing_postcode').val();
    533534        var country_code = $('#select_country_pay').val();
     535        var email = $('#billing_email').val();
    534536
    535537        $('.cant-complete-autorization').hide();
     
    546548                    'zip_code': zip_code,
    547549                    'country_code': country_code,
     550                    'email': email,
    548551                    'nonce': admin.nonce
    549552                },
     
    614617    }
    615618
    616     get_companies_list();
     619    if($('#select_country_pay').length && $('#company_name_pay').length) {
     620        get_companies_list();
     621    }
    617622});
  • sprinque/trunk/include/payment_method.php

    r2777074 r2778366  
    121121            $this->testmode     = 'yes' === $this->get_option( 'testmode' );
    122122            $this->api_key      = $this->get_option( 'api_key' );
     123            $this->order_prefix      = $this->get_option( 'order_prefix' );
    123124
    124125            // Actions
    125126            add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
    126             add_action( 'woocommerce_thankyou_' . $this->id, array( $this, 'thankyou_page' ) );
    127 
    128             // Customer Emails
    129             add_action( 'woocommerce_email_before_order_table', array( $this, 'email_instructions' ), 10, 3 );
    130127
    131128            // Visual Hooks
     
    325322        public function sprinque_authorize_company_order() {
    326323            // Create ID for future created order
    327             $_SESSION['order_id'] = time();
     324            $_SESSION['order_id'] = time().$this->order_prefix;
    328325
    329326            // Get Buyer ID from Logged user
     
    345342                    'country_code'  => sanitize_text_field( $_POST['country_code'] )
    346343                ],
     344                'issued_by' => sanitize_text_field( $_POST['email'] )
    347345            ];
    348346
     
    516514                    'default'     => '',
    517515                    'desc_tip'    => true,
     516                ),
     517                'order_prefix'      => array(
     518                    'title'       => __( 'Order ID Prefix', 'sprinque' ),
     519                    'type'        => 'text',
     520                    'description' => __( 'Add Prefix after Order ID number for invoices', 'sprinque' ),
     521                    'default'     => '',
     522                    'desc_tip'    => true,
    518523                )
    519524            ) );
    520         }
    521 
    522         /**
    523          * Output for the order received page.
    524          */
    525         public function thankyou_page() {
    526             if ( $this->instructions ) {
    527                 echo esc_html(wpautop( wptexturize( $this->instructions ) ));
    528             }
    529         }
    530 
    531         /**
    532          * Add content to the WC emails.
    533          */
    534         public function email_instructions( $order, $sent_to_admin, $plain_text = false ) {
    535             if ( $this->instructions && ! $sent_to_admin && $this->id === $order->payment_method && $order->has_status( 'processing' ) ) {
    536                 echo esc_html(wpautop( wptexturize( $this->instructions ) ) . PHP_EOL);
    537             }
    538525        }
    539526
  • sprinque/trunk/languages/sprinque-de_DE.po

    r2777074 r2778366  
    44"Report-Msgid-Bugs-To: \n"
    55"POT-Creation-Date: 2022-08-06 20:54+0000\n"
    6 "PO-Revision-Date: 2022-08-23 15:38+0000\n"
     6"PO-Revision-Date: 2022-08-29 15:41+0000\n"
    77"Last-Translator: \n"
    88"Language-Team: German\n"
     
    115115#: include/payment_method.php:515
    116116msgid ""
    117 "Find it in your Profile at the Srinque. Overview > My Account > API Keys and URLs"
    118 msgstr ""
    119 "Du findest ihn in deinem Profil bei Sprinque. Übersicht > Mein Konto > API-Schlüssel und URLs"
     117"Find it in your Profile at the Srinque. Overview > My Account > API Keys and "
     118"URLs"
     119msgstr ""
     120"Du findest ihn in deinem Profil bei Sprinque. Übersicht > Mein Konto > API-"
     121"Schlüssel und URLs"
    120122
    121123#: templates/frontend/srinque_pay_modal_form.php:82
     
    249251"a decision is made. <br>We will notify you by email once the review is "
    250252"complete."
    251 msgstr "Die Genehmigung kann bis zu 24 Stunden dauern. Deine Bestellung ist erst bestätigt, wenn eine Entscheidung getroffen wurde. Wir werden dich per E-Mail benachrichtigen, sobald die Prüfung abgeschlossen ist."
     253msgstr ""
     254"Die Genehmigung kann bis zu 24 Stunden dauern. Deine Bestellung ist erst "
     255"bestätigt, wenn eine Entscheidung getroffen wurde. Wir werden dich per E-"
     256"Mail benachrichtigen, sobald die Prüfung abgeschlossen ist."
    252257
    253258#: templates/frontend/srinque_pay_modal_form.php:64
  • sprinque/trunk/languages/sprinque-nl_NL.po

    r2777074 r2778366  
    44"Report-Msgid-Bugs-To: \n"
    55"POT-Creation-Date: 2022-08-06 20:54+0000\n"
    6 "PO-Revision-Date: 2022-08-23 15:37+0000\n"
     6"PO-Revision-Date: 2022-08-29 15:41+0000\n"
    77"Last-Translator: \n"
    88"Language-Team: Dutch\n"
     
    115115#: include/payment_method.php:515
    116116msgid ""
    117 "Find it in your Profile at the Srinque. Overview > My Account > API Keys and URLs"
    118 msgstr ""
    119 "Vind het in je profiel onder Sprinque. Overzicht > mijn account > API sleutel en URLs"
     117"Find it in your Profile at the Srinque. Overview > My Account > API Keys and "
     118"URLs"
     119msgstr ""
     120"Vind het in je profiel onder Sprinque. Overzicht > mijn account > API "
     121"sleutel en URLs"
    120122
    121123#: templates/frontend/srinque_pay_modal_form.php:82
     
    184186#: templates/frontend/srinque_pay_modal_form.php:9
    185187msgid "Please select your business"
    186 msgstr "Selecteer uw bedrijf"
     188msgstr "Selecteer je bedrijf"
    187189
    188190#: templates/frontend/srinque_pay_modal_form.php:50
     
    215217#: templates/frontend/srinque_pay_modal_form.php:79
    216218msgid "Resend Code"
    217 msgstr "Code opnieuw verzenden"
     219msgstr "Verstuur de code nogmaals"
    218220
    219221#: templates/frontend/srinque_pay_modal_form.php:12
     
    246248"a decision is made. <br>We will notify you by email once the review is "
    247249"complete."
    248 msgstr "Dit kan 24 uur duren. Je besetelling is nog niet bevestigd tot de beslissing is gemaakt. <br> We sturen je een bericht zodra de beoordeling voltooid is."
     250msgstr ""
     251"Je verzoek om op factuur te betalen wordt behandeld. Dit kan 24 uur duren. "
     252"Je besetelling is nog niet bevestigd tot beoordeling is afgerond. <br> We "
     253"sturen je een bericht zodra de beoordeling voltooid is."
    249254
    250255#: templates/frontend/srinque_pay_modal_form.php:64
  • sprinque/trunk/readme.txt

    r2777074 r2778366  
    22
    33Contributors: Sprinque
    4 Tags: sprinque, payment sprinque, api sprinque, company sprinque
     4Tags: B2B payments, B2B BNPL, net payment terms
    55Requires at least: 3.5.0
    66Tested up to: 6.0
    77Requires PHP: 5.3
    8 Stable tag: 1.0.6
     8Stable tag: 1.0.7
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    1313
    1414== Description ==
     15No admin. No hassle. No risk.
     16Sprinque 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. Business buyers can select to pay by invoice and pay up to 90 days later, while you get paid instantly and without incurring additional risk.
     17Built to integrate seamlessly with your WordPress webshop, Sprinque will appear in the checkout as a payment method for business buyers. When business buyers choose to pay by invoice, Sprinque conducts a real-time fraud and risk assessment. Approved buyers will be given a credit limit and payment term, which can be used for multiple purchases. This will increase conversion and incentivize business buyers to return.
     18Sprinque also offers your buyers convenient ways to pay for their invoices, when payment is due. We are exclusively focused on payment services for B2B transactions with the sole purpose of helping businesses grow safely in a digital world.
    1519
    16 Sprinque Payments - demand payments by company
     20== Beyond a standard payment method ==
     21Sprinque is on a mission to help businesses grow safely in a digital world. With our fraud and risk engine, we’re able to safely assign a net payment term to new and existing buyers online - all in real time and without adding friction to the buyer.
     22Business buyers are used to getting payment terms in the offline world and by leveraging this practice in your webshop, you’ll be able to convert more business buyers and increase retention.
     23Our automatic and real-time assessment replaces manual and time-consuming fraud and credit risk assessment, reducing operational and financial complexity. In order to extend payment terms to your business buyers, you don’t need to become a credit risk specialist, we’ll take care of this.
     24Sprinque takes away the risk of late payments and defaults for all payments we’ve approved. By paying you instantly when receiving the final invoice via API, we take away the risk of extending payment terms and improve your cash flow.
     25Visit our website [sprinque.com](https://sprinque.com) for more information or mail to [support@sprinque.com](mailto:support@sprinque.com)
     26
     27== Screenshots ==
     281. Enter billing details of the buyer.
     292. Buyer selects and pays with pay by invoice, provided by Sprinque.
     303. Buyer enters registration details.
     314. Sprinque verifies the email address of the buyer.
     325. Real time verification of the buyer's account.
     336. Order is successfully confirmed.
     347. Sprinque sends white-label payment reminders to the buyer.
    1735
    1836== Installation ==
     371. In your admin panel, go to Plugins > Add New.
     382. Click Upload Plugin and Choose File, then select the plugin’s .zip file.
     393. Click Install Now.
     404. Click Activate to use your new plugin right away.
    1941
    20 1. In your admin panel, go to Plugins > Add New.
    21 2. Click Upload Plugin and Choose File, then select the plugin's .zip file. Click Install Now.
    22 3. Click Activate to use your new plugin right away.
     42== Want to learn more? Get in touch ==
     43Contact us via [support@sprinque.com](mailto:support@sprinque.com) or visit [our website](https://www.sprinque.com/ "https://www.sprinque.com/").
    2344
    2445== Frequently Asked Questions ==
     
    2950
    3051== Changelog ==
     52
     53= 1.0.7 - August 31, 2022 =
     54* Updated logic around place order button
     55* Added order ID prefix (actually postfix)
     56* Updated docs and translations
     57* Improved plugin speed (way translations are applied)
    3158
    3259= 1.0.6 - August 26, 2022 =
  • sprinque/trunk/sprinque.php

    r2777074 r2778366  
    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.0.6
     7Version: 1.0.7
    88Text Domain: sprinque
    99Domain Path: /languages
     
    1212define( 'PLUGIN_SRINQUE_DIR', __DIR__ );
    1313define( 'PLUGIN_SRINQUE_PATH', plugins_url( '', __FILE__ ) );
    14 
    1514
    1615load_plugin_textdomain( 'sprinque', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
     
    5655        $order_refunds = $order->get_refunds();
    5756        $transaction_id = get_post_meta( $order_id, 'transaction_id' ) ? get_post_meta( $order_id, 'transaction_id', true ) : false;
     57
     58        $settings = get_option( 'woocommerce_wpm_srinque_pay_settings', true );
    5859
    5960        // Loop through the order refunds array
     
    7374            'action'        => 'generate_wpo_wcpdf',
    7475            'document_type' => 'invoice',
    75             'order_ids'     => $order->get_id(),
     76            'order_ids'     => $order->get_id().$settings['order_prefix'],
    7677            'order_key'     => $order->get_order_key(),
    7778        ), admin_url( 'admin-ajax.php' ) );
     
    177178        $transaction_id = get_post_meta( $order_id, 'transaction_id' ) ? get_post_meta( $order_id, 'transaction_id', true ) : false;
    178179
     180        $settings = get_option( 'woocommerce_wpm_srinque_pay_settings', true );
     181
    179182        // Create PDF Link for Invoice
    180183        $pdf_url = add_query_arg( array(
    181184            'action'        => 'generate_wpo_wcpdf',
    182185            'document_type' => 'invoice',
    183             'order_ids'     => $order->get_id(),
     186            'order_ids'     => $order->get_id().$settings['order_prefix'],
    184187            'order_key'     => $order->get_order_key(),
    185188        ), admin_url( 'admin-ajax.php' ) );
     
    231234        $order = wc_get_order( $order_id );
    232235
     236        $settings = get_option( 'woocommerce_wpm_srinque_pay_settings', true );
     237
    233238        // Create PDF Link for Invoice
    234239        $pdf_url = add_query_arg( array(
    235240            'action'        => 'generate_wpo_wcpdf',
    236241            'document_type' => 'invoice',
    237             'order_ids'     => $order->get_id(),
     242            'order_ids'     => $order->get_id().$settings['order_prefix'],
    238243            'order_key'     => $order->get_order_key(),
    239244        ), admin_url( 'admin-ajax.php' ) );
     
    322327            ) );
    323328
     329            $settings = get_option( 'woocommerce_wpm_srinque_pay_settings', true );
     330
    324331            // Change order Status
    325332            foreach ( $orders as $order ) {
     
    329336                    // Prepare Data to Send
    330337                    $data = [
    331                         'merchant_order_id' => $order->get_id(),
     338                        'merchant_order_id' => $order->get_id().$settings['order_prefix'],
    332339                        'order_amount'      => $order->get_total(),
    333340                        'shipping_address'  => [
     
    337344                            'country_code'  => $order->get_billing_country()
    338345                        ],
     346                        'issued_by' => $order->get_billing_email()
    339347                    ];
    340348
     
    425433    public function include_scripts_and_styles() {
    426434        // Register styles
    427         wp_enqueue_style( 'wpm_srinque_pay', PLUGIN_SRINQUE_PATH . '/assets/css/frontend.css', false, '1.0.84', 'all' );
     435        wp_enqueue_style( 'wpm_srinque_pay', PLUGIN_SRINQUE_PATH . '/assets/css/frontend.css', false, '1.0.91', 'all' );
    428436
    429437        // Register scripts
    430         wp_enqueue_script( 'wpm_srinque_pay', PLUGIN_SRINQUE_PATH . '/assets/js/frontend.js', array( 'jquery' ), '1.0.84', 'all' );
     438        wp_enqueue_script( 'wpm_srinque_pay', PLUGIN_SRINQUE_PATH . '/assets/js/frontend.js', array( 'jquery' ), '1.0.91', 'all' );
    431439        wp_localize_script( 'wpm_srinque_pay', 'admin', array(
    432440            'ajaxurl' => admin_url( 'admin-ajax.php' ),
     
    438446            'add_manually_business' => __( "Add buyer manually", 'sprinque' ),
    439447            'fields_not_filled' => __( "Not all required fields are filled", 'sprinque' ),
    440             'loading' => __( "Loading...", 'sprinque' )
     448            'loading' => __( "Loading...", 'sprinque' ),
     449            'place_order' => __( "Place order", 'sprinque' ),
    441450        ) );
    442451    }
  • sprinque/trunk/templates/frontend/srinque_pay_modal_form.php

    r2771284 r2778366  
    2727                        <input type="text" id="reg_number_pay" placeholder="<?php _e( "Registration number", 'sprinque' ); ?>">
    2828                    </div>
    29                    
    30                     <input type="hidden" id="selected-company-name">
     29
    3130                    <button class="wpm-btn wpm-btn_primary wpm-btn_mt wpm-btn_block" type="button" id="confirm-company-order" disabled><?php _e( "Confirm", 'sprinque' ); ?></button>
    3231                    <div class="error-confirm-order" style="display: none;"><?php _e( "Not all required fields is filled", 'sprinque' ); ?></div>
Note: See TracChangeset for help on using the changeset viewer.