Plugin Directory

Changeset 2502108


Ignore:
Timestamp:
03/23/2021 10:04:28 PM (5 years ago)
Author:
Helcim
Message:
  • Optimized Plugin
  • Updated plugin to work with Create an Account on Checkout
  • Tested upto woocommerce v5.1.0
Location:
helcim-commerce-for-woocommerce/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • helcim-commerce-for-woocommerce/trunk/class-wc-commerce-helcim.php

    r2489884 r2502108  
    1111 * @class        WC_Commerce_Helcim_JS
    1212 * @extends    WC_Payment_Gateway
    13  * @version    1.2.1
     13 * @version    1.2.2
    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.2.1';
     39        $this->version = '1.2.2';
    4040
    4141        // LOAD SETTINGS
     
    339339        // SET DEFAULT
    340340        $helcim_args = array(
    341             'accountId' => $this->accountId,
    342             'apiToken' => $this->apiToken,
    343             'transactionType' => $this->transactionType,
    344             'terminalId' => $this->terminalId,
    345             'test' => $this->isTest(),
    346             'ecommerce' => 1,
    347             'cvvIndicator' => 1,
    348             'ipAddress' => $ipAddress
    349         );
     341            'accountId' => $this->accountId,
     342            'apiToken' => $this->apiToken,
     343            'transactionType' => $this->transactionType,
     344            'terminalId' => $this->terminalId,
     345            'test' => $this->isTest(),
     346            'ecommerce' => 1,
     347            'cvvIndicator' => 1,
     348            'ipAddress' => $ipAddress,
     349            'thirdParty' => 'woocommerce'
     350        );
    350351
    351352        // ADD IP TO CHECK WITH
     
    355356        $helcim_args['amount'] = number_format($order->get_total(),2,'.','');
    356357        $helcim_args['currency'] = get_woocommerce_currency();
    357         $helcim_args['amountShipping']= number_format($shippingAmount,2,'.','');
    358         $helcim_args['amountTax'] = number_format($order->get_total_tax(),2,'.','');
    359         $helcim_args['amountDiscount'] = number_format('-'.$discountAmount + $refundAmount,2,'.','');
    360         // $helcim_args['shippingMethod'] = '';
    361         // $helcim_args['taxDetails'] = '';
    362 
    363         // ORDER INFO
    364         $helcim_args['orderNumber'] = $this->set_order_number($order->get_order_number());
    365         $helcim_args['comments'] = $order->get_customer_note();
    366 
    367         // CHECK
    368         if($this->isJS()){
    369             $createAccount = 0;
    370             if ($_POST['createaccount']) {
    371                 $createAccount = (int)$_POST['createaccount'];
    372             }
    373 
    374             if ($createAccount == 1) {
    375                 $helcim_args['updateCustomerCode'] = true;
     358        $helcim_args['amountShipping'] = number_format($shippingAmount, 2, '.', '');
     359        $helcim_args['amountTax'] = number_format($order->get_total_tax(), 2, '.', '');
     360        $helcim_args['amountDiscount'] = number_format('-' . $discountAmount + $refundAmount, 2, '.', '');
     361        // $helcim_args['shippingMethod'] = '';
     362        // $helcim_args['taxDetails'] = '';
     363
     364        // ORDER INFO
     365        $helcim_args['orderNumber'] = $this->set_order_number($order->get_order_number());
     366        $helcim_args['comments'] = $order->get_customer_note();
     367
     368        // CUSTOMER INFO
     369        if (get_current_user_id()) {
     370            $helcim_args['customerCode'] = get_current_user_id();
     371        }
     372
     373        // CHECK
     374        if ($this->isJS()) {
     375            // look for generated customer code from verify transaction not matching user's id
     376            if (isset($_POST['customerCode'], $helcim_args['customerCode'])
     377                && $_POST['customerCode'] !== $helcim_args['customerCode']) {
     378                $helcim_args['customerCodeOld'] = $_POST['customerCode'];
    376379            }
    377380
    378             // CARD INFO
    379             if(isset($_POST['cardToken'])){ $helcim_args['cardToken'] = $_POST['cardToken']; }
    380             $helcim_args['cardF4L4Skip'] = 1;
    381 
    382         }elseif($this->isDirect()){
     381            // CARD INFO
     382            if (isset($_POST['cardToken'])) {
     383                $helcim_args['cardToken'] = $_POST['cardToken'];
     384            }
     385            $helcim_args['cardF4L4Skip'] = 1;
     386        }elseif($this->isDirect()){
    383387
    384388            // CARD INFO
     
    391395
    392396        }
    393 
    394         // CUSTOMER INFO
    395         if(get_current_user_id()){ $helcim_args['customerCode'] = get_current_user_id(); }
    396397
    397398        // GO THROUGH EACH
     
    468469    * @return array
    469470    */
    470     public function process_payment( $order_id ) {
    471 
    472         global $woocommerce;
    473 
    474         // GET ORDER
    475         $order = new WC_Order( $order_id );
    476 
    477         // BUILD POST DATA
    478         $helcim_args = $this->build_post_data($order);
    479 
    480         // CREATE POST STRING
    481         $postString = http_build_query($helcim_args);
    482 
    483         // SET CURL OPTIONS
    484         $curlOptions = array(
    485             CURLOPT_RETURNTRANSFER => 1,
     471    public function process_payment( $order_id )
     472    {
     473        global $woocommerce;
     474
     475        // GET ORDER
     476        $order = wc_get_order($order_id);
     477
     478        // BUILD POST DATA
     479        $helcim_args = $this->build_post_data($order);
     480
     481        // CREATE POST STRING
     482        $postString = http_build_query($helcim_args);
     483
     484        // SET CURL OPTIONS
     485        $curlOptions = array(
     486            CURLOPT_RETURNTRANSFER => 1,
    486487            CURLOPT_AUTOREFERER => TRUE,
    487488            CURLOPT_FRESH_CONNECT => TRUE,
     
    788789    * @return void
    789790    */
    790     public function validate_fields(){
    791 
    792         // SET GLOBAL
    793         global $woocommerce;
    794 
    795         // CHECK METHOD
    796         if($this->isJS() and @$_POST['createaccount'] != 1){
    797 
    798             // HELCIM JS METHOD
    799 
    800             // CHECK FOR RESPONSE
    801             if(isset($_POST['response']) and $_POST['response'] == 1){
    802 
    803                 // CHECK
    804                 if(!isset($_POST['cardToken'])){
    805 
    806                     // SET NOTICE
     791    public function validate_fields()
     792    {
     793        // SET GLOBAL
     794        global $woocommerce;
     795
     796        // CHECK METHOD
     797        if ($this->isJS()) {
     798            // HELCIM JS METHOD
     799
     800            // CHECK FOR RESPONSE
     801            if (isset($_POST['response']) and $_POST['response'] == 1) {
     802                // CHECK
     803                if (!isset($_POST['cardToken'])) {
     804                    // SET NOTICE
    807805                    wc_add_notice('Failed Tokenizing Card','error');
    808806
  • helcim-commerce-for-woocommerce/trunk/index.php

    r2489884 r2502108  
    44Plugin URI: https://www.helcim.com/
    55Description: Helcim Commerce for WooCommerce
    6 Version: 1.2.1
     6Version: 1.2.2
    77Author: Helcim Inc.
    88Author URI: https://www.helcim.com/
  • helcim-commerce-for-woocommerce/trunk/readme.txt

    r2489884 r2502108  
    33Tags: helcim, helcim commerce, woocommerce, woocommerce payments, woocommerce payment gateway, payment gateway, shopping cart, wordpress payment gateway, woocommerce shopping cart, wordpress shopping cart, payment gateway for woocommerce, payments, credit cards, accept credit cards, recurring billing, woocommerce gateway, woocommerce payment plugin, woocommerce credit cards, accept credit cards woocommerce, credit card gateway woocommerce, accept credit cards on woocommerce, process payments, process credit cards, accept visa, accept mastercard,checkout, accept payments, merchant account, merchant services
    44Requires at least: 4.7.3
    5 Tested up to: 5.6.2
     5Tested up to: 5.7.0
    66
    77== Description ==
     
    1919
    2020**REQUIREMENTS:**       
    21        - WooCommerce 2.6.14 to 5.0.0
     21       - WooCommerce 2.6.14 to 5.1.0
    2222       - [US Merchant Account Sign Up](https://admin.helcim.com/signup/ "Unlock Payment Gateway")     
    2323
     
    7272
    7373== Changelog ==
     74
     75= 1.2.2 =
     76* Optimized Plugin
     77* Updated plugin to work with Create an Account on Checkout
     78* Tested upto woocommerce v5.1.0
    7479
    7580= 1.2.1 =
  • helcim-commerce-for-woocommerce/trunk/uninstall.php

    r2489884 r2502108  
    55 * Uninstalls Helcim Gateway.
    66 *
    7  * @version    1.2.1
     7 * @version    1.2.2
    88 * @author        Helcim Inc.
    99 */
Note: See TracChangeset for help on using the changeset viewer.