|
1
|
|
|
<?php |
|
2
|
|
|
namespace Dokobit\Gateway\Tests\Integration\Signing; |
|
3
|
|
|
|
|
4
|
|
|
use Dokobit\Gateway\Query\Signing\Create; |
|
5
|
|
|
use Dokobit\Gateway\Result\Signing\CreateResult; |
|
6
|
|
|
use Dokobit\Gateway\Tests\Integration\TestCase; |
|
7
|
|
|
|
|
8
|
|
|
class CreateTest extends TestCase |
|
9
|
|
|
{ |
|
10
|
|
|
protected function setUp(): void |
|
11
|
|
|
{ |
|
12
|
|
|
parent::setUp(); |
|
13
|
|
|
$this->uploadFile(); |
|
14
|
|
|
} |
|
15
|
|
|
|
|
16
|
|
|
public function testSuccessMinimal() |
|
17
|
|
|
{ |
|
18
|
|
|
/** @var CreateResult $result */ |
|
19
|
|
|
$result = $this->client->get(new Create( |
|
20
|
|
|
'pdf', |
|
21
|
|
|
'CreateTest testSuccessMinimal signing', |
|
22
|
|
|
[ |
|
23
|
|
|
[ |
|
24
|
|
|
'token' => $this->fileToken, |
|
25
|
|
|
], |
|
26
|
|
|
] |
|
27
|
|
|
)); |
|
28
|
|
|
|
|
29
|
|
|
$this->assertSame(CreateResult::STATUS_OK, $result->getStatus()); |
|
30
|
|
|
$this->assertNotEmpty($result->getToken()); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
public function testSuccessFull() |
|
34
|
|
|
{ |
|
35
|
|
|
/** @var CreateResult $result */ |
|
36
|
|
|
$result = $this->client->get(new Create( |
|
37
|
|
|
'pdf', |
|
38
|
|
|
'CreateTest testSuccessFull signing', |
|
39
|
|
|
[ |
|
40
|
|
|
[ |
|
41
|
|
|
'token' => $this->fileToken, |
|
42
|
|
|
'type' => 'main', |
|
43
|
|
|
], |
|
44
|
|
|
], |
|
45
|
|
|
[ |
|
46
|
|
|
[ |
|
47
|
|
|
'id' => self::SIGNER1_ID, |
|
48
|
|
|
'name' => 'Kraft', |
|
49
|
|
|
'surname' => 'Lawrence', |
|
50
|
|
|
'signing_purpose' => 'signature', |
|
51
|
|
|
], |
|
52
|
|
|
[ |
|
53
|
|
|
'id' => self::SIGNER2_ID, |
|
54
|
|
|
'name' => 'Fleur', |
|
55
|
|
|
'surname' => 'Boland', |
|
56
|
|
|
'signing_purpose' => 'signature', |
|
57
|
|
|
], |
|
58
|
|
|
], |
|
59
|
|
|
'https://example.org/postback' |
|
60
|
|
|
)); |
|
61
|
|
|
|
|
62
|
|
|
$this->assertSame('ok', $result->getStatus()); |
|
63
|
|
|
$this->assertNotEmpty($result->getToken()); |
|
64
|
|
|
$signers = $result->getSigners(); |
|
65
|
|
|
$this->assertNotEmpty($signers); |
|
66
|
|
|
$this->assertArrayHasKey(self::SIGNER1_ID, $signers); |
|
67
|
|
|
$this->assertArrayHasKey(self::SIGNER2_ID, $signers); |
|
68
|
|
|
$this->assertNotEmpty($signers[self::SIGNER1_ID]); |
|
69
|
|
|
$this->assertNotEmpty($signers[self::SIGNER2_ID]); |
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
|