init
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?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')
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user