first commit

This commit is contained in:
2025-01-06 20:47:25 +01:00
commit 3bdbd78c2f
25591 changed files with 3586440 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
<?php
namespace Paynow\Tests\Util;
use InvalidArgumentException;
use Paynow\Tests\TestCase;
use Paynow\Util\SignatureCalculator;
class SignatureCalculatorTest extends TestCase
{
public function testNotValidSuccessfully()
{
// given + when
$signatureCalculator = new SignatureCalculator('InvalidSecretKey', json_encode(['key' => 'value']));
// then
$this->assertNotEquals('hash', $signatureCalculator->getHash());
}
public function testShouldValidSuccessfully()
{
// given + when
$signatureCalculator = new SignatureCalculator(
'a621a1fb-b4d8-48ba-a6a3-2a28ed61f605',
json_encode([
'key1' => 'value1',
'key2' => 'value2',
])
);
// then
$this->assertEquals('rFAkhfbUFRn4bTR82qb742Mwy34g/CSi8frEHciZhCU=', $signatureCalculator->getHash());
}
public function testExceptionForEmptyData()
{
// given
$this->expectException(InvalidArgumentException::class);
// when
$signatureCalculator = new SignatureCalculator('a621a1fb-b4d8-48ba-a6a3-2a28ed61f605', "");
// then
}
}

View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;