Jump to content

WorldPay Payment Gateway Extension Error


Nickh

Recommended Posts

Hi - first time using CubeCartv6 had been waiting for WorldPay to complete the installation on the payment gateway and at the moment i'm in the payment gateway test mode.

I have two issues that I cant see mentioned anywhere:

1, When transferring to WorldPay

'country' => $this->_basket['billing_address']['country'], 

should be defined as "The shopper's country, as 2-character ISO code, uppercase." this is mandatory, currently 'United Kingdom' is sent to WorldPay. If I hardcode to

'country' => 'GB' 

this works OK, is there a translation page that can translate the country name to 2-charactrer ISO code?

2, with https://secure-test.worldpay.com/wcc/purchase the return URL to CubeCart has the following: 

http://test.mysite.com/index.php_a=complete&orderKey=123456789^123456789^3043418930&paymentStatus=AUTHORISED&paymentAmount=4500&paymentCurrency=GBP&mac=aaabbbcccdddeeefff111222333&source=WP

However the order doesn't change from 'pending' to 'processing' - can anyone tell me why this is? 

Quote

GET:
'Before Sanitise:' =>
'_a' => complete
'orderKey' => 123456789^123456789^3043418930
'paymentStatus' => AUTHORISED
'paymentAmount' => 4500
'paymentCurrency' => GBP
'mac' => aaabbbcccdddeeefff111222333
'source' => WP
'After Sanitise:' =>
'_a' => complete
'orderKey' => 123456789^123456789^3043418930
'paymentStatus' => AUTHORISED
'paymentAmount' => 4500
'paymentCurrency' => GBP
'mac' => aaabbbcccdddeeefff111222333
'source' => WP

Link to comment
Share on other sites

1. I'll make a post on the Github to have the programmers address this. In the meantime, edit that line to read:
'country'    => $this->_basket['billing_address']['country_iso'],

2. According to the WorldPay gateway for CubeCart, what is expected is: 'cartId' and 'transStatus'. This gateway is not going to use any of the key/value pairs being returned as you have listed above.

Could it be the case where WorldPay has completely revamped its API in the past year?

Link to comment
Share on other sites

I think the documentation was saying, "In test mode, for the customer's name in the data sent to us, make it AUTHORISED so that we will send back a transStatus of Y." That tells me there is no control panel setting that would be necessary if the testing was done on an order where the customer was named AUTHORISED.

But I could be wrong.

On the other hand, it makes excellent sense to incorporate this as how could a new store owner know to do this with regards to testing their new WorldPay merchant account?

Link to comment
Share on other sites

  • 4 weeks later...

That file, return.php, loads the $_GET array with needed values, then has PHP run CubeCart's main startup file, index.php.

Those $_GET values will have CubeCart process the $_RESPONSE which should have the 'cartId' (important!), the 'transId', and the transStatus' values.

For an order you know was transacted by WorldPay, please look in that order's Edit screens, Transaction Logs tab.

If there aren't any entries in the Transaction Logs table, then either 1) the payment processor is not making a proper request to your_store/return.php or 2) there is a problem with how return.php is running index.php.

1) To determine if WorldPay is making contyact with your store, you will need to find your store's web server access logs. You typically find these logs in your hosted site's control panel (Cpanel?). Examine the logs for requests made to /modules/gateway/WorldPay/return.php.

2) The command to run index.php is:
require('..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'index.php');
where DIRECTORY_SEPARATOR is PHP's constant value for the character the server's operating system uses for separating folder names: '\' for Windows, '/' for any others.

The result is: require('../../../index.php');

Some server admins have implemented a server security feature where a multiple "../" sequence is forbidden. You will need to consult your hosting provider if this extended path traversal denial is what is happening. PHP may also have logged an error if denied. It is sometimes difficult to find PHP's error_log.

If there are entries in the Transactions Logs table, the Notes column may explain why an order is still at Pending.

Link to comment
Share on other sites

Hi - I'm still having problems with the WorldPay module, can i add somewhere in the debug output of the array for $_RESPONSE thats used in the 'function process' in gateway.class.php?

The CubeCart_Transactions table is empty 

Can we test extended path traversal is enabled? - or can we put the full path to index.php?

Thanks Nick

 

 
Link to comment
Share on other sites

Looking at the server logs for our customer, Worldpay is making contact back to the server OK (status 200) using the expected POST (point 1) and then the index.php is being called correctly (again status 200) immediately afterwards (various sensitive information changed to XXXXX's) followed by a number of other GETs for resources (304 or 200) - all appears fine but the order is not updated to Processing nor any transaction recorded

195.35.90.68 - - [14/Mar/2016:16:14:35 +0000] "POST /admin.php?installation=XXXXXXX&_g=plugins&module=WorldPay&msgType=authResult&type=gateway HTTP/1.0" 200 2535 "-" "WJHRO/1.0 (WorldPay Java HTTP Request Object)"

82.17.59.245 - - [14/Mar/2016:16:14:37 +0000] "GET /index.php?_a=complete&orderKey=XXXXXXXXXXXXXX&paymentStatus=AUTHORISED&paymentAmount=1735&paymentCurrency=GBP&mac=d908373b7ebdfbbecc898517e0754c5d&source=WP HTTP/1.1" 200 8720 "-" "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko"
 

Link to comment
Share on other sites

The first log entry is weird.

The standard URL for the admin to bring up the module's settings screen is, for example: /admin.php?_g=plugins&type=gateway&module=2Checkout

There is the strange installation and msgType keys in the querystring. I do not recognize those.

Receiving communication by an outside party should never be through the admin.php (although, getting a report using a 'feed access key' does happen this way).

Link to comment
Share on other sites

  • 1 year later...

Did anyone ever get to the bottom of the order status not updating from pending to processing and the lack of transaction information when customers pay by WorldPay?

We have recently moved over to Worldpay from paypal and it's proving to be a challenge as our staff that look after cubecart and webshop orders don't have access to the payments account on worldpay, so with no change from pending to processing and also not putting any transaction details in place ( as paypal did ) is creating a lot of leg work between our warehouse and sales office staff checking payments and getting further information.

Thanks in advance,

Nick

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...