Skip to content

Instantly share code, notes, and snippets.

@bdgeorge
Last active August 29, 2015 14:19
Show Gist options
  • Save bdgeorge/0af8c147b4a8775d7cf6 to your computer and use it in GitHub Desktop.
Save bdgeorge/0af8c147b4a8775d7cf6 to your computer and use it in GitHub Desktop.
Eway subsription bug with Woocommerce

#Woocommerce Eway bug test

This bug has two parts that may or may not be related.

First any subscription orders made using Eway create token customers with their country set to "Afghanistan".

This is incorrect and may be triggering a second much more serious error when subscription's fail and need to be renewed.

When their credit card eventually expires or fails due to some other reason (eg insufficient funds) on the next recurrence of their subscription it will fail. The invoice that gets generated doesn't carry a valid payment method, instead it displays the error to the customer no available payment methods for your state

Screen shots and source code are available in a private bitbucket repo (invitation sent to [email protected]).

##My setup - although any will probably do ###Tax Set up for Australian Tax - see the setup/tax_rates.csv file

Prices entered inclusive of tax and displaying inclusive of tax

###General Options Base Location = Australia - Victoria

Currency Australian Dollars

###Eway Connect the eway payment system to your sandbox

##Testing ###Issue 1 - wrong country in Eway Create a simple subscription product, add it to your cart and checkout with the test eway credit card (4444 3333 2222 1111).

Log in to the Eway sandbox, go to Payments > Token Payments > Search Customers

Find the customer you just created and in the actions menu select edit details - the country will be showing as 'Afghanistan'

###Issue 2 - "no available payment methods for your state" on renewal Create a simple subscription product, add it to your cart and checkout with the test eway credit card (4444 3333 2222 1111).

Log into Eway sandbox, in sandbox settings set the sandbox to always decline transactions (by default eway sends 05, Do not honour) this simulates a card that can no longer pay for a transaction.

Put wordpress and woocommerce into debug mode.

In the admin look in Tools > Scheduled Actions, find the next subscription event for that order and trigger it.

Now Log out of Wordpress you must be logged out to view the site as a customer would

Look at the "Invoice for renewal order" email that was just generated, click the link in it to "Pay Now"

This will take you to the checkout page with the message about "no available payment methods for your state".

See /results/ErrorMessageInWoocommerce for a failed eway subscription payment.png for example screenshot of this.

Login as the customer and verify that the same error message persists, there is no way for the customer to pay for this failed transaction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment