If this is your first visit, check our documentation. To post, register or login.
Forums / Community Contributed Add-Ons / Addon Payment Modules / Payment module stuck at checkout_process & before_process function?

Payment module stuck at checkout_process & before_process function?

Started by kyle_coventry on 9 Aug 2011, 4:31 AM · Views: 5,282

Results 1 to 15 of 15
9 Aug 2011, 4:31 AM
#1
kyle_coventry avatar

kyle_coventry

New Zenner

Join Date:
Aug 2011
Posts:
8
Plugin Contributions:
0

Post #1 by kyle_coventry

Hey Guys -

Big issue here, fairly frustrating. Currently my checkout IS being processed by my gateway/payment module (aka the money is being transferred) but ZenCart stalls (blank page) at a checkout_process page that looks something like:

main_page=checkout_process

With a bunch of stuff after it. I've put in some echo's to try and track how far the code is firing within checkout_process.php and when a customer is successfully logged in, it gets all the way to:

// load the before_process function from the payment modules
$payment_modules->before_process();

At this point it does not fire anything else, and a blank page is presented to the user.

Is this a syntax error? Or is this an error with the module I've received from my payment gateway?

Really appreciate the help, been trying to reference other threads for a while on this now...

Thanks,

-kyle

9 Aug 2011, 4:59 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #2 by drbyte

What's the payment module? Looks like it's designed for much older versions of Zen Cart, and is passing unacceptable parameters, or parameters with very long values, both of which will cause a blank page when before_process() is run.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

9 Aug 2011, 10:05 PM
#3
kyle_coventry avatar

kyle_coventry

New Zenner

Join Date:
Aug 2011
Posts:
8
Plugin Contributions:
0

Post #3 by kyle_coventry

Thanks a ton for the prompt response, really encouraging to see some support on here.

I'm fairly certain you're correct. My clients gateway is EVO Canada, and they've supplied me with a credit card payment module that is supposed to be compatible with Zen, but it's entirely possible that it is only compatible with a much older version. It seems to be sending error messages via URL and other old-style things like that.

Are we going to need to migrate to a different provider? Unfortunately I doubt I have the time nor experience to modify their payment module to work with the updated Zen - is a different provider our only option?

Thanks!

9 Aug 2011, 10:11 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #4 by drbyte

Post the code from the before_process() function of the module, and we'll see what we can do with it.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

10 Aug 2011, 3:16 AM
#5
kyle_coventry avatar

kyle_coventry

New Zenner

Join Date:
Aug 2011
Posts:
8
Plugin Contributions:
0

Post #5 by kyle_coventry

Here she is:

function before_process() {

  if ($_GET['response'] == '1') return;
  if ($_GET['response'] == '2') {
    zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_GATEWAY_SERVICES_CC_TEXT_DECLINED_MESSAGE), 'SSL', true, false));
  }
  // Code 3 is an error - but anything else is an error too (IMHO)
    zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_GATEWAY_SERVICES_CC_TEXT_ERROR_MESSAGE), 'SSL', true, false));
}

Any help/direction is appreciated.

10 Aug 2011, 4:02 AM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #6 by drbyte

Wow, that's extremely basic.

You will need to rewrite both of those zen_redirect segments so that the error_message is passed via the messageStack instead of in the zen_href_link. And you'll want to skip the urlencoding.
An example of the changes you need to make is here: http://www.zen-cart.com/forum/showthread.php?p=1054133#post1054133

Or just make sure the language definitions for both of those MODULE_PAYMENT_xxxxxxxx_MESSAGE constants are less than 40 characters each.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

11 Aug 2011, 12:22 AM
#7
kyle_coventry avatar

kyle_coventry

New Zenner

Join Date:
Aug 2011
Posts:
8
Plugin Contributions:
0

Post #7 by kyle_coventry

Thanks again for the prompt response - tried it again with your suggestions and unfortunately I'm still receiving a blank page with a fairly length URL beginning with the checkout_process.php.

My new module looks like:

function before_process() {

  if ($_GET['response'] == '1') return;
  if ($_GET['response'] == '2') {
    global $messageStack;
	$messageStack->add_session('checkout_payment', MODULE_PAYMENT_NET1_TEXT_ERROR_MESSAGE, 'error');
	zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL', true, false));
  }
  // Code 3 is an error - but anything else is an error too (IMHO)
    global $messageStack;
	$messageStack->add_session('checkout_payment', MODULE_PAYMENT_NET1_TEXT_ERROR_MESSAGE, 'error');
	zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL', true, false));
}

Hopefully this was implemented correctly - let me know! Again, thanks for the help, but still having the same issue! Oh, and I ran the echo's again, and the checkout_process is still getting caught up at before_process.

-kyle

11 Aug 2011, 12:46 AM
#8
kyle_coventry avatar

kyle_coventry

New Zenner

Join Date:
Aug 2011
Posts:
8
Plugin Contributions:
0

Post #8 by kyle_coventry

Ah, ignore my error messages there... those don't apply to my payment module. I inserted the correct ones and it still displays the blank. Appreciate your thoughts.

11 Aug 2011, 3:58 AM
#9
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #9 by drbyte

So what exactly is that big long URL you're seeing when the blank page appears?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

12 Aug 2011, 1:49 AM
#10
kyle_coventry avatar

kyle_coventry

New Zenner

Join Date:
Aug 2011
Posts:
8
Plugin Contributions:
0

Post #10 by kyle_coventry

Here it is:

/index.php?main_page=checkout_process&response=1&responsetext=AP&authcode=21473Z&transactionid=1454050895&avsresponse=X&cvvresponse=M&orderid=&type=auth&response_code=100&username=1646363&time=20110812014732&amount=0.57&hash=65ec60ea3b30f0642e89694dcbb1d3f6

Make anything from that? Returning the confirmed transaction details by the looks of it, but something is causing the whole thing to just display blank...

12 Aug 2011, 3:23 AM
#11
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #11 by drbyte

The &hash= is triggering the vulnerability-probing-detection code, and getting blocked. Ask the payment gateway service for some other way to pass that parameter.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

25 Aug 2011, 7:28 AM
#12
youngblood avatar

youngblood

New Zenner

Join Date:
Apr 2010
Posts:
59
Plugin Contributions:
0

Post #12 by youngblood

I'm also getting the exact same issue with our Aliant gateway services processor. We've recently upgraded to 1.3.9h and we haven't been able to get it to work properly since.

Here's an example of the link we get...it's the same reaction if the card was declined or approved:

https://primevapor.com/index.php?main_page=checkout_process&response=2&responsetext=DECLINED&authcode=&transactionid=1461158939&avsresponse=U&cvvresponse=+&orderid=&type=sale&response_code=200&username=1535498&time=20110825072548&amount=14.90&hash=e179ab9df9fcb420a5281df6e9be7c9e

What else can I post here to help you guys solve the problem?

Thanks for your help community.

25 Aug 2011, 8:07 AM
#13
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #13 by drbyte

It is advised that you get them to pass their "hash=" parameter with some other keyname besides the word "hash".

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

25 Aug 2011, 9:26 AM
#14
youngblood avatar

youngblood

New Zenner

Join Date:
Apr 2010
Posts:
59
Plugin Contributions:
0

Post #14 by youngblood

After speaking with Numinex, we discovered that it was the length of the URL that was causing the error. If we removed the &hash=.... from the checkout_response link, it will work. Is there anyway to increase the amount of characters that Zen Cart can accept or is this more of a browser issue?

25 Aug 2011, 9:51 AM
#15
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #15 by drbyte

It's not a URL length issue, and it's neither a browser issue nor a Zen Cart capability issue. It's a malicious-visitor-deterrent feature. If you want to bypass those safeties, feel free to hack up the code to your liking.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.