Coder Social home page Coder Social logo

fatzebra-woocommerce's Introduction

Fat Zebra WooCommerce Plugin

Version 1.5.12 for API Version 1.0

A WordPress plugin to add Fat Zebra support to WooCommerce for Australian Merchants.

Dependencies

  • WordPress
  • WooCommerce 2.5

This plugin uses wp_http_request to submit data to Fat Zebra - this means that you do not need to ensure cURL or similar is installed on your site, the function will determine the most suitable technique to use.

Install the plugin

There are two methods to install the plugin:

Copy the file to the WordPress plugins directory:

  1. Make a new directory in [SITE_ROOT]/wp-content/plugins called fatzebra-woocommerce
  2. Copy the file class-wc-fatzebra.php to this new directory.
  3. Activate the newly installed plugin in the WordPress Plugin Manager.

Install the plugin from WordPress (Coming Soon)

  1. Search for the WooCommerce Fat Zebra plugin from the WordPress Plugin Manager.
  2. Install the plugin.
  3. Activate the newly installed plugin.

Configuration

  1. Visit the WooCommerce settings page, and click on the Payment Gateways tab.
  2. Click on Fat Zebra to edit the settings. If you do not see Fat Zebra in the list at the top of the screen make sure you have activated the plugin in the WordPress Plugin Manager.
  3. Enable the Payment Method, name it Credit Card (this will show up on the payment page your customer sees) and add in your credentials. Click Save.

You should now be able to test the purchases via Fat Zebra.

Support

If you have any issue with the Fat Zebra Gateway for WooCommerce please contact us at [email protected] and we will be more then happy to help out.

Pull Requests

If you would like to contribute to the plugin please fork the project, make your changes within a feature branch and then submit a pull request. All pull requests will be reviewed as soon as possible and integrated into the main branch if deemed suitable.

fatzebra-woocommerce's People

Contributors

adambarnesfz avatar amasses avatar chrisatomix avatar obelmont avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fatzebra-woocommerce's Issues

Re-Tokenization Broken Again in WC2.6.7+

We've just discovered that in WooCommerce 2.6.7 they changed the type of the input fields on the credit card form from "text" to "tel":

2.6.7 - 2016-10-26
Tweak - Improve credit card fields for better mobile experience.

https://wordpress.org/plugins/woocommerce/changelog/

As a result, the code fix from #9 no longer works and re-tokenization is broken in all subsequent versions.

We have fixed it locally with the following change, from:

jQuery('form.checkout').on('change', '#wc-fatzebra-cc-form input[type=text]', function() {
  jQuery('#fatzebra-token').val('');
});

to:

jQuery('form.checkout').on('change', '#wc-fatzebra-cc-form input.input-text', function() {
  jQuery('#fatzebra-token').val('');
});

I have confirmed that this fix is backwards compatible.

Can't save Woocommerce Orders while FZ active (On latest Wordpress)

Looks like this might be a compatability issue with the latest version of Wordpress?

Our client is on WPEnginge, who regularly auto-updates wordpress.
The client recently flagged me that they can't change the order-status manually anymore. Doing so causes the 'Wordpress has encountered a critical error'.

I traced the issue to the FatZebra plugin, and when disabled the error no longer happens.

Note:
The client theme is rather old and we've run into PHP8.1 and WP6.1 issues in the past, but they never had this issue.
It could be some weird incompatibility in the theme, but if you have any ideas what would cause FZ to trigger a critical error on post save, that'd be great to know.

Depreciation notices
[13-Mar-2024 02:52:43 UTC] PHP Deprecated: Creation of dynamic property WC_FatZebra::$gateway_id is deprecated in /nas/content/live/HIDDENCLIENTSITENAME/wp-content/plugins/woocommerce-artspay-gateway-2.2.5/class-wc-fatzebra.php on line 148
[13-Mar-2024 02:52:43 UTC] PHP Deprecated: Creation of dynamic property WC_FatZebra::$version is deprecated in /nas/content/live/HIDDENCLIENTSITENAME/wp-content/plugins/woocommerce-artspay-gateway-2.2.5/class-wc-fatzebra.php on line 150
[13-Mar-2024 02:52:43 UTC] PHP Deprecated: Creation of dynamic property WC_FatZebra::$api_version is deprecated in /nas/content/live/HIDDENCLIENTSITENAME/wp-content/plugins/woocommerce-artspay-gateway-2.2.5/class-wc-fatzebra.php on line 154
[13-Mar-2024 02:52:43 UTC] PHP Deprecated: Creation of dynamic property WC_FatZebra::$live_url is deprecated in /nas/content/live/HIDDENCLIENTSITENAME/wp-content/plugins/woocommerce-artspay-gateway-2.2.5/class-wc-fatzebra.php on line 155
[13-Mar-2024 02:52:43 UTC] PHP Deprecated: Creation of dynamic property WC_FatZebra::$sandbox_url is deprecated in /nas/content/live/HIDDENCLIENTSITENAME/wp-content/plugins/woocommerce-artspay-gateway-2.2.5/class-wc-fatzebra.php on line 156
[13-Mar-2024 02:52:43 UTC] PHP Deprecated: Creation of dynamic property WC_FatZebra::$params is deprecated in /nas/content/live/HIDDENCLIENTSITENAME/wp-content/plugins/woocommerce-artspay-gateway-2.2.5/class-wc-fatzebra.php on line 158
[13-Mar-2024 02:52:43 UTC] PHP Deprecated: Creation of dynamic property WC_FatZebra::$country_map is deprecated in /nas/content/live/HIDDENCLIENTSITENAME/wp-content/plugins/woocommerce-artspay-gateway-2.2.5/class-wc-fatzebra.php on line 159
[13-Mar-2024 02:52:43 UTC] PHP Deprecated: Creation of dynamic property WC_FatZebra::$gateway_id is deprecated in /nas/content/live/HIDDENCLIENTSITENAME/wp-content/plugins/woocommerce-artspay-gateway-2.2.5/class-wc-fatzebra.php on line 148
[13-Mar-2024 02:52:43 UTC] PHP Deprecated: Creation of dynamic property WC_FatZebra::$version is deprecated in /nas/content/live/HIDDENCLIENTSITENAME/wp-content/plugins/woocommerce-artspay-gateway-2.2.5/class-wc-fatzebra.php on line 150
[13-Mar-2024 02:52:43 UTC] PHP Deprecated: Creation of dynamic property WC_FatZebra::$api_version is deprecated in /nas/content/live/HIDDENCLIENTSITENAME/wp-content/plugins/woocommerce-artspay-gateway-2.2.5/class-wc-fatzebra.php on line 154
[13-Mar-2024 02:52:43 UTC] PHP Deprecated: Creation of dynamic property WC_FatZebra::$live_url is deprecated in /nas/content/live/HIDDENCLIENTSITENAME/wp-content/plugins/woocommerce-artspay-gateway-2.2.5/class-wc-fatzebra.php on line 155
[13-Mar-2024 02:52:43 UTC] PHP Deprecated: Creation of dynamic property WC_FatZebra::$sandbox_url is deprecated in /nas/content/live/HIDDENCLIENTSITENAME/wp-content/plugins/woocommerce-artspay-gateway-2.2.5/class-wc-fatzebra.php on line 156
[13-Mar-2024 02:52:43 UTC] PHP Deprecated: Creation of dynamic property WC_FatZebra::$params is deprecated in /nas/content/live/HIDDENCLIENTSITENAME/wp-content/plugins/woocommerce-artspay-gateway-2.2.5/class-wc-fatzebra.php on line 158
[13-Mar-2024 02:52:43 UTC] PHP Deprecated: Creation of dynamic property WC_FatZebra::$country_map is deprecated in /nas/content/live/HIDDENCLIENTSITENAME/wp-content/plugins/woocommerce-artspay-gateway-2.2.5/class-wc-fatzebra.php on line 159
[13-Mar-2024 02:52:43 UTC] PHP Deprecated: Creation of dynamic property WC_FatZebra_GooglePay::$parent_settings is deprecated in /nas/content/live/HIDDENCLIENTSITENAME/wp-content/plugins/woocommerce-artspay-gateway-2.2.5/class-wc-fatzebra-googlepay.php on line 15
[13-Mar-2024 02:52:43 UTC] PHP Deprecated: Creation of dynamic property WC_FatZebra_GooglePay::$gateway_id is deprecated in /nas/content/live/HIDDENCLIENTSITENAME/wp-content/plugins/woocommerce-artspay-gateway-2.2.5/class-wc-fatzebra-googlepay.php on line 18
[13-Mar-2024 02:52:43 UTC] PHP Deprecated: Creation of dynamic property WC_FatZebra_GooglePay::$version is deprecated in /nas/content/live/HIDDENCLIENTSITENAME/wp-content/plugins/woocommerce-artspay-gateway-2.2.5/class-wc-fatzebra-googlepay.php on line 22
[13-Mar-2024 02:52:43 UTC] PHP Deprecated: Creation of dynamic property WC_FatZebra_GooglePay::$api_version is deprecated in /nas/content/live/HIDDENCLIENTSITENAME/wp-content/plugins/woocommerce-artspay-gateway-2.2.5/class-wc-fatzebra-googlepay.php on line 24
[13-Mar-2024 02:52:43 UTC] PHP Deprecated: Creation of dynamic property WC_FatZebra_GooglePay::$live_url is deprecated in /nas/content/live/HIDDENCLIENTSITENAME/wp-content/plugins/woocommerce-artspay-gateway-2.2.5/class-wc-fatzebra-googlepay.php on line 25
[13-Mar-2024 02:52:43 UTC] PHP Deprecated: Creation of dynamic property WC_FatZebra_GooglePay::$sandbox_url is deprecated in /nas/content/live/HIDDENCLIENTSITENAME/wp-content/plugins/woocommerce-artspay-gateway-2.2.5/class-wc-fatzebra-googlepay.php on line 26
[13-Mar-2024 02:52:43 UTC] PHP Deprecated: Creation of dynamic property WC_FatZebra_GooglePay::$sandbox_paynow_url is deprecated in /nas/content/live/HIDDENCLIENTSITENAME/wp-content/plugins/woocommerce-artspay-gateway-2.2.5/class-wc-fatzebra-googlepay.php on line 27
[13-Mar-2024 02:52:43 UTC] PHP Deprecated: Creation of dynamic property WC_FatZebra_GooglePay::$live_paynow_url is deprecated in /nas/content/live/HIDDENCLIENTSITENAME/wp-content/plugins/woocommerce-artspay-gateway-2.2.5/class-wc-fatzebra-googlepay.php on line 28
[13-Mar-2024 02:52:43 UTC] PHP Deprecated: Creation of dynamic property WC_FatZebra_GooglePay::$params is deprecated in /nas/content/live/HIDDENCLIENTSITENAME/wp-content/plugins/woocommerce-artspay-gateway-2.2.5/class-wc-fatzebra-googlepay.php on line 31`

FatZebra crashes when using HHVM

[Thu Feb 11 11:58:34 2016] [hphp] [11277:7fcba7fff700:2:000391] [] \nFatal error: Uncaught exception 'BadMethodCallException' with message 'Call to a member function get() on a non-object (null)' in /sites/sitename/www/wp-content/plugins/woocommerce-fat-zebra-gateway/class-wc-fatzebra-visacheckout.php:713\nStack trace:\n#0 /sites/sitename/www/wp-includes/plugin.php(235): fz_visacheckout_force_gateway()\n#1 /sites/sitename/www/wp-content/plugins/woocommerce/includes/class-wc-payment-gateways.php(155): apply_filters()\n#2 /sites/sitename/www/wp-content/plugins/woocommerce-subscriptions/includes/admin/class-wcs-admin-post-types.php(858): WC_Payment_Gateways->get_available_payment_gateways()\n#3 /sites/sitename/www/wp-includes/plugin.php(525): WCS_Admin_Post_Types::restrict_by_payment_method()\n#4 /sites/sitename/www/wp-admin/includes/class-wp-posts-list-table.php(452): do_action()\n#5 /sites/sitename/www/wp-admin/includes/class-wp-list-table.php(1186): WP_Posts_List_Table->extra_tablenav()\n#6 /sites/sitename/www/wp-admin/includes/class-wp-list-table.php(1126): WP_List_Table->display_tablenav()\n#7 /sites/sitename/www/wp-admin/edit.php(344): WP_List_Table->display()\n#8 {main}

We've created a fix which doesn't error out HHVM in order to allow this function to work, although the fix is a little 'hacky' rather than a permanent solution by catching the error and returning the $gateways variable.

Not sure whether or not it's pull worthy however as there may be more graceful ways to fix without having to catch exceptions;

function fz_visacheckout_force_gateway($gateways) {
try {
if (is_null(WC()->session->get('visa_wallet_callid'))) {
return $gateways;
} else {

  $forced_gateways = array();
  $forced_gateways['fatzebra_visacheckout'] = $gateways['fatzebra_visacheckout'];

  return $forced_gateways;
}

} catch (Exception $e) { return $gateways; }
}

Tokenization broken again in WC2.6

WooCommerce version: 2.6.4
WordPress version: 4.6.1
FatZebra Plugin version: 1.5.10

The following line of code in fatzebra.js no longer works:

jQuery('form.checkout').on('change', '#fatzebra-cc-form input[type=text]', function() {
  jQuery('#fatzebra-token').val('');
});

This causes a regression of the issue resolved in #5 :
"Changing the credit card details after a failed transaction did not trigger a new tokenization"

Upon testing I found that the code should look like this:

jQuery('form.checkout').on('change', '#wc-fatzebra-cc-form input[type=text]', function() {
  jQuery('#fatzebra-token').val('');
});

It looks like WooCommerce 2.6 prefixes the class with "wc-" now.

I have manually patched my local version for now.

PHP Error in plugin 1.5.10

The following code in class-wc-fatzebra.php on line 246:

      if ($this->direct_post_enabled()) {
        $this->supports = array_push($this->supports, 'tokenization');
      }

generates the following error on the checkout:

Warning: in_array() expects parameter 2 to be array, integer given in /wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-payment-gateway.php on line 359

As documented, array_push does not return the array itself:
http://php.net/manual/en/function.array-push.php
It returns the number of elements in the array.

The correct code should be:

      if ($this->direct_post_enabled()) {
        array_push($this->supports, 'tokenization');
      }

Direct Post not working correctly

There have been several issues with Direct Post in this plugin.

  1. The name of the card token field was referenced incorrectly, causing Direct Post not to work
  2. Changing the credit card details after a failed transaction did not trigger a new tokenization

I have submitted a PR with the fixes I applied: #4

BUG: Payments are out by 1 cent

Unfortunately because this plugin uses an unreliable method to convert from dollars to cents (floats to an integer), payments can be out by 1 cent in some cases.

For example:
WooCommerce Order Total: $134.95
FatZebra Payment Received: $134.94 (13494 cents)

This is a common issue in PHP:
http://stackoverflow.com/questions/5651026/surprising-float-int-conversion-in-php

The lines in question look like this:

(int)($order->get_total() * 100);

I'm working on a fix for our site right now, will submit a PR shortly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.