1 | <?php |
||
5 | class TokenRequest |
||
6 | { |
||
7 | /** |
||
8 | * @var array |
||
9 | */ |
||
10 | protected $data = array(); |
||
11 | |||
12 | /** |
||
13 | * @param int $projectId |
||
14 | * @param string $userId |
||
15 | */ |
||
16 | 3 | public function __construct($projectId, $userId) |
|
17 | { |
||
18 | 3 | $this->data['user']['id']['value'] = $userId; |
|
19 | 3 | $this->data['settings']['project_id'] = $projectId; |
|
20 | 3 | } |
|
21 | |||
22 | /** |
||
23 | * @param string $email |
||
24 | * |
||
25 | * @return self |
||
26 | */ |
||
27 | 2 | public function setUserEmail($email) |
|
28 | { |
||
29 | 2 | $this->data['user']['email']['value'] = $email; |
|
30 | |||
31 | 2 | return $this; |
|
32 | } |
||
33 | |||
34 | /** |
||
35 | * @param string $name |
||
36 | * |
||
37 | * @return self |
||
38 | */ |
||
39 | 2 | public function setUserName($name) |
|
40 | { |
||
41 | 2 | $this->data['user']['name']['value'] = $name; |
|
42 | |||
43 | 2 | return $this; |
|
44 | } |
||
45 | |||
46 | /** |
||
47 | * @param string $currencyIsoCode |
||
48 | * |
||
49 | * @return self |
||
50 | */ |
||
51 | 2 | public function setCurrency($currencyIsoCode) |
|
52 | { |
||
53 | 2 | $this->data['settings']['currency'] = $currencyIsoCode; |
|
54 | |||
55 | 2 | return $this; |
|
56 | } |
||
57 | |||
58 | /** |
||
59 | * @param array $customParameters |
||
60 | * |
||
61 | * @return self |
||
62 | */ |
||
63 | 2 | public function setCustomParameters(array $customParameters) |
|
64 | { |
||
65 | 2 | $this->data['custom_parameters'] = $customParameters; |
|
66 | |||
67 | 2 | return $this; |
|
68 | } |
||
69 | |||
70 | /** |
||
71 | * @param string $externalId |
||
72 | * |
||
73 | * @return self |
||
74 | */ |
||
75 | 1 | public function setExternalPaymentId($externalId) |
|
76 | { |
||
77 | 1 | $this->data['settings']['external_id'] = $externalId; |
|
78 | |||
79 | 1 | return $this; |
|
80 | } |
||
81 | |||
82 | /** |
||
83 | * @param bool $isSandbox |
||
84 | * |
||
85 | * @return self |
||
86 | */ |
||
87 | 3 | public function setSandboxMode($isSandbox = true) |
|
88 | { |
||
89 | 3 | if (true === $isSandbox) { |
|
90 | 3 | $this->data['settings']['mode'] = 'sandbox'; |
|
91 | } else { |
||
92 | unset($this->data['settings']['mode']); |
||
93 | } |
||
94 | |||
95 | 3 | return $this; |
|
96 | } |
||
97 | |||
98 | /** |
||
99 | * @param float $amount |
||
100 | * @param string $currency |
||
101 | * @return $this |
||
102 | */ |
||
103 | 2 | public function setPurchase($amount, $currency) |
|
104 | { |
||
105 | 2 | $this->data['purchase']['checkout']['amount'] = $amount; |
|
106 | 2 | $this->data['purchase']['checkout']['currency'] = $currency; |
|
107 | |||
108 | 2 | return $this; |
|
109 | } |
||
110 | |||
111 | /** |
||
112 | * @return array |
||
113 | */ |
||
114 | 3 | public function toArray() |
|
118 | } |
||
119 |