Skip to content

Commit

Permalink
temp hash commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mustapayev committed Nov 17, 2024
1 parent 9969d93 commit 2935aed
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 10 deletions.
5 changes: 5 additions & 0 deletions src/Crypt/KuveytPosCrypt.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
];
Expand Down
18 changes: 16 additions & 2 deletions src/Crypt/PayFlexCPV4Crypt.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
11 changes: 10 additions & 1 deletion src/Crypt/PosNetCrypt.php
Original file line number Diff line number Diff line change
Expand Up @@ -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),

Check failure on line 81 in src/Crypt/PosNetCrypt.php

View workflow job for this annotation

GitHub Actions / test (7.4, prefer-stable)

Parameter #1 $posAccount of method Mews\Pos\Crypt\PosNetCrypt::createSecurityData() expects Mews\Pos\Entity\Account\PosNetAccount, Mews\Pos\Entity\Account\AbstractPosAccount given.

Check failure on line 81 in src/Crypt/PosNetCrypt.php

View workflow job for this annotation

GitHub Actions / test (8.0, prefer-stable)

Parameter #1 $posAccount of method Mews\Pos\Crypt\PosNetCrypt::createSecurityData() expects Mews\Pos\Entity\Account\PosNetAccount, Mews\Pos\Entity\Account\AbstractPosAccount given.
];
$hashStr = implode(static::HASH_SEPARATOR, $secondHashData);

return $this->hashString($hashStr);
}

/**
Expand Down
12 changes: 11 additions & 1 deletion src/Crypt/ToslaPosCrypt.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/DataMapper/RequestDataMapper/PosNetRequestDataMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 2935aed

Please sign in to comment.