1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* Package: PHP Bitaps API |
7
|
|
|
* |
8
|
|
|
* (c) Eldar Gazaliev <[email protected]> |
9
|
|
|
* |
10
|
|
|
* Link: <https://github.com/MyZik> |
11
|
|
|
* |
12
|
|
|
* For the full copyright and license information, please view the LICENSE file |
13
|
|
|
* that was distributed with this source code. |
14
|
|
|
*/ |
15
|
|
|
|
16
|
|
|
namespace Bitaps\WalletAPI\Request; |
17
|
|
|
|
18
|
|
|
class CreateWalletAddressRequest implements RequestInterface |
19
|
|
|
{ |
20
|
|
|
/** |
21
|
|
|
* Wallet ID |
22
|
|
|
* |
23
|
|
|
* @var string |
24
|
|
|
*/ |
25
|
|
|
private string $walletId; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Link to the payment notification handler |
29
|
|
|
* |
30
|
|
|
* @var string|null |
31
|
|
|
*/ |
32
|
|
|
private ?string $callbackLink; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Number of confirmations for payment notification, default 3 |
36
|
|
|
* |
37
|
|
|
* @var int|null |
38
|
|
|
*/ |
39
|
|
|
private ?int $confirmations; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @param string $walletId |
43
|
|
|
* @param string|null $callbackLink |
44
|
|
|
* @param int $confirmations |
45
|
|
|
*/ |
46
|
|
|
public function __construct(string $walletId, string $callbackLink = null, int $confirmations = 3) |
47
|
|
|
{ |
48
|
|
|
$this->walletId = $walletId; |
49
|
|
|
$this->callbackLink = $callbackLink; |
50
|
|
|
$this->confirmations = $confirmations; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @return string |
55
|
|
|
*/ |
56
|
|
|
public function getPathParams(): string |
57
|
|
|
{ |
58
|
|
|
return '/create/wallet/payment/address'; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @return array |
63
|
|
|
*/ |
64
|
|
|
public function getHeaders(): array |
65
|
|
|
{ |
66
|
|
|
return []; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @return array |
71
|
|
|
*/ |
72
|
|
|
public function getBody(): array |
73
|
|
|
{ |
74
|
|
|
return [ |
75
|
|
|
'wallet_id' => $this->walletId, |
76
|
|
|
$this->callbackLink === null ?: 'callback_link' => $this->callbackLink, |
77
|
|
|
'confirmations' => $this->confirmations |
78
|
|
|
]; |
79
|
|
|
} |
80
|
|
|
} |
81
|
|
|
|