I have a problem with the payment.

In the last step of the payment I get an error message saying "INCORRECT ON-LINE COMUNICATION". I just contacted the Bank and they told me that there is something wrong with the "On-line URL" in CECA control panel. They can not load the url I set there, which is: http://example.com/es/ceca/callback

If I try to load this URL I get a blank page with just the text: BAD REQUEST.

I think the problem is that I should remove the language segment of the url /es/ to get this: http://example.com/ceca/callback
Will this works. Am I in the right way?
Captures below.
thanks.
capture
capture

Comments

chefnelone created an issue. See original summary.

chefnelone’s picture

Issue summary: View changes
StatusFileSize
new141.44 KB
chefnelone’s picture

Issue summary: View changes
StatusFileSize
new56.46 KB
grisendo’s picture

Looks like a duplicate from this one?

https://www.drupal.org/node/2501023

chefnelone’s picture

Not sure, but I don't see any fix or workaround in that one...

grisendo’s picture

Not sure, cannot reproduce that one...

Can you debug function commerce_ceca_callback on commerce_ceca.module line ~450?

chefnelone’s picture

I can use dpm() function in that line. Which variable do I need to output?

chefnelone’s picture

If dpm() is not useful for you then can you please tell me how to do the debug, I don't know how to do it. Thanks.

grisendo’s picture

Please, send me a private message so we check your case in more detail.
Later, we will put here the solution and related patches.

Regards,

chefnelone’s picture

Can you send me your email so that I can send you the details.

chefnelone’s picture

I found what is the problem, but not how to fix it yet.

Let's say that I set the URL ONLINE OK like this: http://www.example.com/es/ceca/callback and then buy a product in the spanish language it WORKS FINE.
But if I buy a product in other language like "english" then it DOESN'T WORK.

The problem is the language segment in the URL ONLINE OK. It only works if the language selected in the website is the same than the language set in URL ONLINE OK /es/.

I tried to remove the language segment like this http://www.example.com/ceca/callback but I get another error message.

How can I fix this?

chefnelone’s picture

What if I just create a rule to redirect to the right language url. This is just a workaround but it would work... what do you think?

grisendo’s picture

So, the problem is that CECA backend (not Drupal, the one from the bank) only allows one page callback, not one per language :(

chefnelone’s picture

That's correct, there is only ONE field in Ceca Backend for this URL.

Do you know how can I fix this? I think this module should use a non specific language for this url like: http://www.example.com/ceca/callback

chefnelone’s picture

Any idea to fix this? Thanks

PaulJBis’s picture

Hello:

A provisional solution would be to disable the language check in the CECA module. That is, in the code block at the commerce_ceca_callback() function that checks whether the data returned by CECA is correct:

    if (
        isset($_POST['MerchantID']) && ($payment_method['settings']['merchant_id'] == $_POST['MerchantID'])
        &&
        isset($_POST['AcquirerBIN']) && ($payment_method['settings']['acquirer_bin'] == $_POST['AcquirerBIN'])
        &&
        isset($_POST['TerminalID']) && ($payment_method['settings']['terminal_id'] == $_POST['TerminalID'])
        &&
        isset($_POST['Importe']) && ($total == $_POST['Importe'])
        &&
        isset($_POST['TipoMoneda']) && ($currency == $_POST['TipoMoneda'])
        &&
        isset($_POST['Exponente']) && ($_POST['Exponente'] == 2)
        &&
        isset($_POST['Firma']) && ($signature == $_POST['Firma'])
        &&
       // isset($_POST['Idioma']) && ($lang_op == $_POST['Idioma'])
       // &&
        (isset($_POST['Referencia'])) && (isset($_POST['Num_aut']))

You can comment out the $_POST['idioma'] check. We have done so in our site, and it works. After all, according to the CECA docs (and common sense), the critical data to check if a transaction is correct are things like MerchantID, amount, digital signature, etc., but the language is hardly critical.