Plugin Directory

Changeset 2124916


Ignore:
Timestamp:
07/17/2019 10:41:34 PM (7 years ago)
Author:
Helcim
Message:
  • Optimized Plugin
  • Register and Checkout feature is now available
  • Google reCAPTCHA v3 now available for Helcim.js payment method
Location:
helcim-commerce-for-woocommerce/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • helcim-commerce-for-woocommerce/trunk/assets/js/helcim-scripts.js

    r2105724 r2124916  
    546546    var createaccount = document.getElementById('createaccount');
    547547    var paymentMethod = document.getElementById('payment_method_helcimjs');
     548    var captchaField = document.getElementById('g-recaptcha-response');
     549
     550    // CHECK FOR CAPTCHA
     551    if (captchaField != null && captchaField.value == ""){
     552        generateCaptchaToken().then(function(value){
     553            hcmStartProcess();
     554        });
     555        return false;
     556    }
    548557
    549558    // CLEAR RESPONSE
     
    657666    }, function(error){
    658667
     668        // CLEAR CAPTCHA ON ERROR
     669        hcmCreateHiddenInputFields(woocommerceForm,'g-recaptcha-response','');
     670
    659671        // TRANSACTION FAILED
    660672        console.log(helcimResults.innerHTML);
  • helcim-commerce-for-woocommerce/trunk/class-wc-commerce-helcim.php

    r2105724 r2124916  
    1111 * @class       WC_Commerce_Helcim_JS
    1212 * @extends     WC_Payment_Gateway
    13  * @version     1.1.6
     13 * @version     1.1.7
    1414 * @author      Helcim Inc.
    1515 */
     
    3737        $this->commerce_url = 'https://secure.myhelcim.com/api/';
    3838        $this->helcimjs_url = 'https://secure.myhelcim.com/js/version2.js';
    39         $this->version = '1.1.6';
     39        $this->version = '1.1.7';
    4040
    4141        // LOAD SETTINGS
     
    5454        $this->transactionType  = $this->get_option( 'transactionType' );
    5555        $this->terminalId       = $this->get_option( 'terminalId' );
     56        $this->requireCaptcha   = $this->get_option( 'requireCaptcha' ) == 'yes' ? 1 : 0;
    5657
    5758        if ($this->show_logo)
     
    256257        );
    257258
     259        // REQUIRE CAPTCHA
     260        $this->form_fields['requireCaptcha'] = array(
     261            'title' => __('Require Captcha', 'woocommerce' ),
     262            'type' => 'checkbox',
     263            'label' => __( 'Require Customer to Pass Captcha to avoid Fraud (Only works when Payment Method is Helcim JS)', 'woocommerce' ),
     264            'default' => 'yes'
     265        );
     266
    258267    }
    259268
     
    649658        ?>
    650659
     660        <?php if($this->requireCaptcha){ ?>
     661
     662        <!-- RECAPTCHA -->
     663        <input type="hidden" id="g-recaptcha-response" name="g-recaptcha-response">
     664
     665        <?php if($this->isTest()){ echo("<script type='text/javascript' src='https://www.google.com/recaptcha/api.js?render=6LcgxK0UAAAAAH9gzsILRr82KZSLrBcry9RynMn4'></script>"); ?>
     666
     667            <script>var site_key = '6LcgxK0UAAAAAH9gzsILRr82KZSLrBcry9RynMn4';</script>
     668
     669        <?php }else{ echo("<script type='text/javascript' src='https://www.google.com/recaptcha/api.js?render=6LdixK0UAAAAABmBXVo_jyFJSkQ5Doj9kloLyxGG'></script>"); ?>
     670
     671            <script>var site_key = '6LdixK0UAAAAABmBXVo_jyFJSkQ5Doj9kloLyxGG';</script>
     672
     673        <?php } ?>
     674
     675        <script>
     676
     677        function generateCaptchaToken(){
     678
     679            return new Promise(function(resolve, reject) {
     680
     681                grecaptcha.ready(function() {
     682
     683                    grecaptcha.execute(site_key, {action: 'helcimJSCheckout'})
     684
     685                    .then(function(token) {
     686
     687                        document.getElementById('g-recaptcha-response').value = token;
     688                        resolve();
     689
     690                    });
     691
     692                });
     693
     694            });
     695
     696        }
     697
     698        </script>
     699
     700        <?php } ?>
     701
    651702        <?php if($this->isJS()){ ?>
    652703
     
    657708            <script type="text/javascript">
    658709
    659                 // UPDATE SUBMIT BUTTON
     710            // UPDATE SUBMIT BUTTON
    660711                hcmUpdateSubmit();
    661712
     
    716767                    <td><input type="text" class="input-text" size="4" value="" id="cardCVV" name="cardCVV"></td>
    717768                </tr>
     769
    718770            </tbody>
    719771        </table>
  • helcim-commerce-for-woocommerce/trunk/index.php

    r2105724 r2124916  
    44Plugin URI: https://www.helcim.com/
    55Description: Helcim Commerce for WooCommerce
    6 Version: 1.1.6
     6Version: 1.1.7
    77Author: Helcim Inc.
    88Author URI: https://www.helcim.com/
  • helcim-commerce-for-woocommerce/trunk/readme.txt

    r2105724 r2124916  
    7373== Changelog ==
    7474
     75= 1.1.7 =
     76* Optimized Plugin
     77* Register and Checkout feature is now available
     78* Google reCAPTCHA v3 now available for Helcim.js payment method
     79
    7580= 1.1.6 =
    7681* Optimized Plugin
  • helcim-commerce-for-woocommerce/trunk/uninstall.php

    r2105724 r2124916  
    55 * Uninstalls Helcim Gateway.
    66 *
    7  * @version     1.1.6
     7 * @version     1.1.7
    88 * @author      Helcim Inc.
    99 */
Note: See TracChangeset for help on using the changeset viewer.