The bank has changed the hashkey algorithm on 2018-11-13, giving the following error:

Payment has failed with the following error message: hashes do not match

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

k.skarlatos created an issue. See original summary.

k.skarlatos’s picture

FileSize
1.48 KB

επισυνάπτω patch.

bserem’s picture

Will be patched on Monday!

Thanks for the patch

TheodorosPloumis’s picture

I get an error when apply the patch probably because of the empty spaces added or missing from the patch.

Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git a/commerce_winbank_redirect.pages.inc b/commerce_winbank_redirect.pages.inc
|index f573d07..eb347bb 100644
|--- a/commerce_winbank_redirect.pages.inc
|+++ b/commerce_winbank_redirect.pages.inc
--------------------------
Patching file commerce_winbank_redirect.pages.inc using Plan A...
patch: **** malformed patch at line 8: 

In any way, thanks k.skarlatos for the patch!

k.skarlatos’s picture

FileSize
1.47 KB

sorry for the incorrect patch. is this one ok?

vensires’s picture

Title: Νέος αλγόριθμος κρυπτογράφησης HashKey (HMACSHA256) » New hashing algorithm for HashKey (HMACSHA256)
vensires’s picture

@k.skarlatos please add some spaces in

$hash = strtoupper(hash_hmac('sha256',$long_str,$ticket_response['trans_ticket']));

after each , to follow the coding standards. Also, I took the opportunity of renaming the issue. If you may, please also change the description of the issue to English to keep it more... international. Other than that, you're fast! I came here to file my own patch on this and I found you already here! :D

@bserem before committing it, I would like to propose releasing it as 7.x-2.0. According to Winbank,

the change of the algorithm occured on 14th November. All businesses in production before that date still work with the old algorithm temporarily. In the near future, we will ask everyone to use the new algorithm, so it is good if you start doing this for your customers. You will have to send us the MerchantID of your clients to whom you have used the new HashKey so that we do the extra configuration from our part.

As a result, if anyone upgrades immediately, they will break their websites. If we release this as 7.x-2.0 and write proper release notes, then at least we have warned them.

bserem’s picture

Ok, waiting for a finished patch.

k.skarlatos’s picture

Hello, I just saw your reply. I will submit a correct patch shortly

k.skarlatos’s picture

FileSize
1.47 KB

Updated patch, hopefully it is ok now

k.skarlatos’s picture

Issue summary: View changes
vensires’s picture

Status: Active » Needs review

The bank updated the clients that the changes must be done on the websites by Monday, 15th of April, 2019.

Costas Vassilakis’s picture

Hello
I have applied the patch and I've been informed by the bank that the extra configuration from their part has been done.
But when I 'm checking out (checkout/static/payment) I receive the following error.

SoapFault: Server was unable to read request. ---> There is an error in XML document (2, 564). ---> Input string was not in a correct format. in SoapClient->__call() (line 310 of xxx/sites/all/modules/commerce_winbank_redirect/commerce_winbank_redirect.module).

TheodorosPloumis’s picture

@costas-vassilakis can you provide the code you mention? Because this may be not related to this issue.

Costas Vassilakis’s picture

I used the code from the patch.

$long_str = $ticket_response['trans_ticket'] . ';' . $ticket_request['PosId'] . ';' . $ticket_request['AcquirerId'] . ';';
$long_str .= $ticket_request['MerchantReference'] . ';' . $_POST['ApprovalCode'] . ';' . $_POST['Parameters'] .';';
$long_str .= $_POST['ResponseCode'] . ';' . $_POST['SupportReferenceID'] . ';' . $_POST['AuthStatus'] . ';' . $_POST['PackageNo'] . ';' . $_POST['StatusFlag'];
$hash = strtoupper(hash_hmac('sha256', $long_str, $ticket_response['trans_ticket']));

I don't see something wrong on this code. But when the bank changed the calculating method the redirection stopped working with the error I mentioned before:
SoapFault: Server was unable to read request. ---> There is an error in XML document (2, 564). ---> Input string was not in a correct format. in SoapClient->__call() (line 310 of xxx/sites/all/modules/commerce_winbank_redirect/commerce_winbank_redirect.module).

Is anybody using this module successfully after the calculating method changing?

Thanks

vensires’s picture

@costas-vassilakis could you check this patch? It also contains a few other changes (eg. definition WINBANK_PAY_COMPLETED is rewritten as COMMERCE_WINBANK_REDIRECT_PAY_COMPLETED). I am not completely sure it will work in your case but I definitely have it working in a site of mine. Please try it and update us.

Costas Vassilakis’s picture

@vensires I checked this Patch and I'm receiving the same error!!!

"Input string was not in a correct format. in SoapClient->__call()"

There are not other changes have been done on the site apart from these two patches.

Costas Vassilakis’s picture

@vensires Finally I managed to make it work. Apparently the patches are ok. The problem was a double rule in the payment methods for the winbank redirect method. I have not developed this site so I'm not sure about what caused it.
The title of the first one was "Credit Card on a secure environment provided by Winbank" and the payment settings fields where filled with the Merchant's credentials and the tile of the second one was "Credit Card on a secure environment provided by Winbank Greece" with all the setting fields unfilled. I filled the fields for the second one and disabled the first.

Thank you very much.

vensires’s picture

Priority: Normal » Major
Status: Needs review » Reviewed & tested by the community

@costas-vassilakis I didn't expect anything wrong to happen with the previous patch (the one k.skarlatos sent) but just in case I thought of passing my patched module too. I hide my patch for k.skarlatos's to be the only one displayed.

Also setting this to Major since the module stops working as of today.

  • bserem committed 1e2c618 on 7.x-1.x authored by vensires
    Issue #3015748 by k.skarlatos, vensires: New hashing algorithm for...
bserem’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.