Skip to content

Commit 6fc2910

Browse files
authored
Merge pull request #219 from BoulangerV/OX6-104-Oxid6.4_Tests
OX6-104 : Fix encryption method handling for direct debit
2 parents 6f1f4f9 + f0b220c commit 6fc2910

File tree

1 file changed

+37
-19
lines changed

1 file changed

+37
-19
lines changed

extend/application/controllers/fcPayOnePaymentView.php

+37-19
Original file line numberDiff line numberDiff line change
@@ -794,17 +794,26 @@ public function fcpoGetActiveThemePath() {
794794
*/
795795
public function getHashELVWithChecktype()
796796
{
797-
$sHash = md5(
797+
$oConfig = $this->_oFcpoHelper->fcpoGetConfig();
798+
$sFCPOHashMethod = $oConfig->getConfigParam('sFCPOHashMethod');
799+
$sKey = $this->getPortalKey();
800+
801+
$sData =
798802
$this->getSubAccountId() .
799-
$this->getChecktype() .
800-
$this->getEncoding() .
801-
$this->getMerchantId() .
802-
$this->_getOperationModeELV() .
803-
$this->getPortalId() .
804-
'bankaccountcheck' .
805-
'JSON' .
806-
$this->getPortalKey()
807-
);
803+
$this->getChecktype() .
804+
$this->getEncoding() .
805+
$this->getMerchantId() .
806+
$this->_getOperationModeELV() .
807+
$this->getPortalId() .
808+
'bankaccountcheck' .
809+
'JSON';
810+
811+
$sHashMD5 = md5($sData.$sKey);
812+
$sHashSha2 = hash_hmac('sha384', $sData, $sKey);
813+
814+
$sHash = ($sFCPOHashMethod == 'sha2-384')
815+
? $sHashSha2 : $sHashMD5;
816+
808817
return $sHash;
809818
}
810819

@@ -815,16 +824,25 @@ public function getHashELVWithChecktype()
815824
*/
816825
public function getHashELVWithoutChecktype()
817826
{
818-
$sHash = md5(
827+
$oConfig = $this->_oFcpoHelper->fcpoGetConfig();
828+
$sFCPOHashMethod = $oConfig->getConfigParam('sFCPOHashMethod');
829+
$sKey = $this->getPortalKey();
830+
831+
$sData =
819832
$this->getSubAccountId() .
820-
$this->getEncoding() .
821-
$this->getMerchantId() .
822-
$this->_getOperationModeELV() .
823-
$this->getPortalId() .
824-
'bankaccountcheck' .
825-
'JSON' .
826-
$this->getPortalKey()
827-
);
833+
$this->getEncoding() .
834+
$this->getMerchantId() .
835+
$this->_getOperationModeELV() .
836+
$this->getPortalId() .
837+
'bankaccountcheck' .
838+
'JSON';
839+
840+
$sHashMD5 = md5($sData.$sKey);
841+
$sHashSha2 = hash_hmac('sha384', $sData, $sKey);
842+
843+
$sHash = ($sFCPOHashMethod == 'sha2-384')
844+
? $sHashSha2 : $sHashMD5;
845+
828846
return $sHash;
829847
}
830848

0 commit comments

Comments
 (0)