diff --git a/src/Crypt/KuveytPosCrypt.php b/src/Crypt/KuveytPosCrypt.php index a2ec1f12..ca1bbd17 100644 --- a/src/Crypt/KuveytPosCrypt.php +++ b/src/Crypt/KuveytPosCrypt.php @@ -60,6 +60,11 @@ public function createHash(AbstractPosAccount $posAccount, array $requestData): // non-payment request may not have MerchantOrderId and Amount fields $requestData['MerchantOrderId'] ?? '', $requestData['Amount'] ?? '', + + // non 3d payments does not have OkUrl and FailUrl fields + $requestData['OkUrl'] ?? '', + $requestData['FailUrl'] ?? '', + $posAccount->getUsername(), $hashedPassword, ]; diff --git a/src/Crypt/PayFlexCPV4Crypt.php b/src/Crypt/PayFlexCPV4Crypt.php index b1d4f40b..3521edf1 100644 --- a/src/Crypt/PayFlexCPV4Crypt.php +++ b/src/Crypt/PayFlexCPV4Crypt.php @@ -41,10 +41,24 @@ public function check3DHash(AbstractPosAccount $posAccount, array $data): bool } /** - * @inheritdoc + * todo "ErrorCode" => "5029" + * "ResponseMessage" => "Geçersiz İstek" hash ile istek gonderince hatasi aliyoruz. + * + * {@inheritDoc} */ public function createHash(AbstractPosAccount $posAccount, array $requestData): string { - throw new NotImplementedException(); + $hashData = [ + $posAccount->getClientId(), + $requestData['AmountCode'], + $requestData['Amount'], + $posAccount->getPassword(), + '', + 'VBank3DPay2014', // todo + ]; + + $hashStr = implode(static::HASH_SEPARATOR, $hashData); + + return $this->hashString($hashStr); } } diff --git a/src/Crypt/PosNetCrypt.php b/src/Crypt/PosNetCrypt.php index 56910f4b..7f974d9e 100644 --- a/src/Crypt/PosNetCrypt.php +++ b/src/Crypt/PosNetCrypt.php @@ -73,7 +73,16 @@ public function check3DHash(AbstractPosAccount $posAccount, array $data): bool */ public function createHash(AbstractPosAccount $posAccount, array $requestData): string { - throw new NotImplementedException(); + $secondHashData = [ + $requestData['id'], + $requestData['amount'], + $requestData['currency'], + $posAccount->getClientId(), + $this->createSecurityData($posAccount), + ]; + $hashStr = implode(static::HASH_SEPARATOR, $secondHashData); + + return $this->hashString($hashStr); } /** diff --git a/src/Crypt/ToslaPosCrypt.php b/src/Crypt/ToslaPosCrypt.php index ae28e03b..93529e97 100644 --- a/src/Crypt/ToslaPosCrypt.php +++ b/src/Crypt/ToslaPosCrypt.php @@ -67,7 +67,17 @@ public function check3DHash(AbstractPosAccount $posAccount, array $data): bool */ public function createHash(AbstractPosAccount $posAccount, array $requestData): string { - return $this->create3DHash($posAccount, $requestData); + $hashData = [ + $posAccount->getStoreKey(), + $posAccount->getClientId(), + $posAccount->getUsername(), + $requestData['rnd'], + $requestData['timeSpan'], + ]; + + $hashStr = \implode(static::HASH_SEPARATOR, $hashData); + + return $this->hashString($hashStr); } /** diff --git a/src/DataMapper/RequestDataMapper/PayFlexCPV4PosRequestDataMapper.php b/src/DataMapper/RequestDataMapper/PayFlexCPV4PosRequestDataMapper.php index 4dfbf8b6..1e62669a 100644 --- a/src/DataMapper/RequestDataMapper/PayFlexCPV4PosRequestDataMapper.php +++ b/src/DataMapper/RequestDataMapper/PayFlexCPV4PosRequestDataMapper.php @@ -111,7 +111,7 @@ public function create3DEnrollmentCheckRequestData(AbstractPosAccount $posAccoun $requestData['InstallmentCount'] = (string) $this->valueFormatter->formatInstallment($order['installment']); } - $requestData['HashedData'] = $this->crypt->create3DHash($posAccount, $requestData); + $requestData['HashedData'] = $this->crypt->createHash($posAccount, $requestData); return $requestData; } diff --git a/src/DataMapper/RequestDataMapper/PosNetRequestDataMapper.php b/src/DataMapper/RequestDataMapper/PosNetRequestDataMapper.php index b143ea88..13417204 100644 --- a/src/DataMapper/RequestDataMapper/PosNetRequestDataMapper.php +++ b/src/DataMapper/RequestDataMapper/PosNetRequestDataMapper.php @@ -40,7 +40,7 @@ public function create3DPaymentRequestData(AbstractPosAccount $posAccount, array $mappedOrder['amount'] = $this->valueFormatter->formatAmount($order['amount']); $mappedOrder['currency'] = $this->valueMapper->mapCurrency($order['currency']); - $hash = $this->crypt->create3DHash($posAccount, $mappedOrder); + $hash = $this->crypt->createHash($posAccount, $mappedOrder); return [ 'mid' => $posAccount->getClientId(), @@ -295,7 +295,7 @@ public function create3DResolveMerchantRequestData(AbstractPosAccount $posAccoun $mappedOrder['amount'] = $this->valueFormatter->formatAmount($order['amount']); $mappedOrder['currency'] = $this->valueMapper->mapCurrency($order['currency']); - $hash = $this->crypt->create3DHash($posAccount, $mappedOrder); + $hash = $this->crypt->createHash($posAccount, $mappedOrder); return [ 'mid' => $posAccount->getClientId(), diff --git a/src/DataMapper/RequestDataMapper/ToslaPosRequestDataMapper.php b/src/DataMapper/RequestDataMapper/ToslaPosRequestDataMapper.php index 6650c07e..7e8e3083 100644 --- a/src/DataMapper/RequestDataMapper/ToslaPosRequestDataMapper.php +++ b/src/DataMapper/RequestDataMapper/ToslaPosRequestDataMapper.php @@ -36,7 +36,7 @@ public function create3DEnrollmentCheckRequestData(AbstractPosAccount $posAccoun 'timeSpan' => $this->valueFormatter->formatDateTime($order['time_span'], 'timeSpan'), ]; - $requestData['hash'] = $this->crypt->create3DHash($posAccount, $requestData); + $requestData['hash'] = $this->crypt->createHash($posAccount, $requestData); return $this->getRequestAccountData($posAccount) + $requestData; } diff --git a/src/DataMapper/RequestDataMapper/VakifKatilimPosRequestDataMapper.php b/src/DataMapper/RequestDataMapper/VakifKatilimPosRequestDataMapper.php index 4561ef31..71694a8a 100644 --- a/src/DataMapper/RequestDataMapper/VakifKatilimPosRequestDataMapper.php +++ b/src/DataMapper/RequestDataMapper/VakifKatilimPosRequestDataMapper.php @@ -52,7 +52,7 @@ public function create3DPaymentRequestData(AbstractPosAccount $posAccount, array 'TransactionSecurity' => $this->valueMapper->mapSecureType(PosInterface::MODEL_3D_SECURE), ]; - $result['HashData'] = $this->crypt->create3DHash($posAccount, $result); + $result['HashData'] = $this->crypt->createHash($posAccount, $result); return $result; } @@ -94,7 +94,7 @@ public function create3DEnrollmentCheckRequestData(KuveytPosAccount $kuveytPosAc $inputs['CardCVV2'] = $creditCard->getCvv(); } - $inputs['HashData'] = $this->crypt->create3DHash($kuveytPosAccount, $inputs); + $inputs['HashData'] = $this->crypt->createHash($kuveytPosAccount, $inputs); return $inputs; }