33 lines
920 B
PHP
33 lines
920 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace Esun\OceanpaymentKlarna\Test\Unit\Model;
|
|
|
|
use Esun\OceanpaymentKlarna\Model\Signature;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class SignatureTest extends TestCase
|
|
{
|
|
public function testCreatesHostedRequestSignatureInOceanpaymentFieldOrder(): void
|
|
{
|
|
$data = [
|
|
'account' => 'account',
|
|
'terminal' => 'terminal',
|
|
'backUrl' => 'https://example.com/back',
|
|
'order_number' => 'ORDER-1',
|
|
'order_currency' => 'USD',
|
|
'order_amount' => '10.00',
|
|
'billing_firstName' => 'Jane',
|
|
'billing_lastName' => 'Doe',
|
|
'billing_email' => 'jane@example.com',
|
|
];
|
|
|
|
$plain = implode('', array_values($data)) . 'secure-code';
|
|
|
|
self::assertSame(
|
|
hash('sha256', $plain),
|
|
(new Signature())->createRequest($data, 'secure-code')
|
|
);
|
|
}
|
|
}
|