Fixing the Payfirma for WooCommerce Plugin

This post is only for those who use WooCommerce as their eCommerce platform and Payfirma as their credit card processor. This means that 99.9999% of you can stop reading right now.

The Payfirma plugin (currently version 2.6) for WooCommerce isn’t fully compatible with WooCommerce 3.x and Payfirma has said it has no plans to update it. So if you’re tired of the plugin generating a ton of php errors, here’s the solution that will take just a couple minutes of your time.

In the Payfirma_Woo_Gateway plugin, go to class > class.payfirma.php and scroll down to about line 508. Look for the block of code that reads:

// payfirma required arguments
    $payfirma_args = array(
        'first_name' => $order->billing_first_name,
        'last_name' => $order->billing_last_name,
        'company' => $order->billing_company,
        'address1' => $order->billing_address_1,
        'address2' => $order->billing_address_2,
        'city' => $order->billing_city,
        'province' => $order->billing_state,
        'postal_code' => $order->billing_postcode,
        'country' => $order->billing_country,
        'email' => $order->billing_email,
        'amount_tax' => $order->get_total_tax(),
        'amount' => $order->order_total,
        'order_id' => $order->id,
        'currency' => $currency,
        'telephone'=> $order->billing_phone,
        // from the cc form on the payment page.
        'card_number' => sanitize($_POST['card_number']),
        'card_expiry_month' => sanitize($_POST['card_expiry_month']),
        'card_expiry_year' => sanitize($_POST['card_expiry_year']),
        'cvv2' => sanitize($_POST['cvv2']),
        'key' => $this->key,
        'merchant_id' => $this->merchant_id,
        'function' => 'sale',
        'description'=>'Order #'.$order->id.' from '.get_bloginfo('url'),
		'do_not_store'=>'true',
        'ecom_source'=>'WooCommercev'.$version_num
    );

and change it to:

// payfirma required arguments
    $payfirma_args = array(
        'first_name' => $order->get_billing_first_name(),
        'last_name' => $order->get_billing_last_name(),
        'company' => $order->get_billing_company(),
        'address1' => $order->get_billing_address_1(),
        'address2' => $order->get_billing_address_2(),
        'city' => $order->get_billing_city(),
        'province' => $order->get_billing_state(),
        'postal_code' => $order->get_billing_postcode(),
        'country' => $order->get_billing_country(),
        'email' => $order->get_billing_email(),
        'amount_tax' => $order->get_total_tax(),
        'amount' => $order->get_total(),
        'order_id' => $order->get_id(),
        'currency' => $currency,
        'telephone'=> $order->get_billing_phone(),
        // from the cc form on the payment page.
        'card_number' => sanitize($_POST['card_number']),
        'card_expiry_month' => sanitize($_POST['card_expiry_month']),
        'card_expiry_year' => sanitize($_POST['card_expiry_year']),
        'cvv2' => sanitize($_POST['cvv2']),
        'key' => $this->key,
        'merchant_id' => $this->merchant_id,
        'function' => 'sale',
        'description'=>'Order #'.$order->get_id().' from '.get_bloginfo('url'),
		'do_not_store'=>'true',
        'ecom_source'=>'WooCommercev'.$version_num
    );

There are changes on 14 lines and spelling counts! Remember to test it to make sure it works :-)

 

Fixing the Payfirma for WooCommerce Plugin

Leave a Reply

Your email address will not be published. Required fields are marked *

All comments are moderated. Please be patient.

css.php