1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ByTIC\Omnipay\PlatiOnline\Traits; |
4
|
|
|
|
5
|
|
|
use Omnipay\Common\Message\AbstractRequest as CommonAbstractRequest; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Trait HasSecurityParamsTrait |
9
|
|
|
* @package ByTIC\Omnipay\PlatiOnline\Traits |
10
|
|
|
*/ |
11
|
|
|
trait HasSecurityParamsTrait |
12
|
|
|
{ |
13
|
|
|
protected $aesKey = null; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* @return mixed |
17
|
|
|
*/ |
18
|
|
|
public function getPublicKey() |
19
|
|
|
{ |
20
|
|
|
return $this->getParameter('publicKey'); |
|
|
|
|
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @param $value |
25
|
|
|
* @return static |
26
|
|
|
*/ |
27
|
|
|
public function setPublicKey($value) |
28
|
|
|
{ |
29
|
|
|
return $this->setParameter('publicKey', $value); |
|
|
|
|
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @return mixed |
34
|
|
|
*/ |
35
|
|
|
public function getPrivateKey() |
36
|
|
|
{ |
37
|
|
|
return $this->getParameter('privateKey'); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @param $value |
42
|
|
|
* @return static |
43
|
|
|
*/ |
44
|
|
|
public function setPrivateKey($value) |
45
|
|
|
{ |
46
|
|
|
return $this->setParameter('privateKey', $value); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
// INFO f_website |
50
|
|
|
// * if you ARE USING the same PlatiOnline account for multiple websites |
51
|
|
|
// - go to https://merchants.plationline.ro, in Settings tab, POS/Website button, click Add a new POS/website and add your websites |
52
|
|
|
// - after we approve your websites, please use Website/POS value for $f_request['f_website'] |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @return mixed |
56
|
|
|
*/ |
57
|
|
|
public function getWebsite() |
58
|
|
|
{ |
59
|
|
|
return $this->getParameter('website'); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @param $value |
64
|
|
|
* @return static |
65
|
|
|
*/ |
66
|
|
|
public function setWebsite($value) |
67
|
|
|
{ |
68
|
|
|
return $this->setParameter('website', $value); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @return mixed |
73
|
|
|
*/ |
74
|
|
|
public function getLoginId() |
75
|
|
|
{ |
76
|
|
|
return $this->getParameter('loginId'); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @param $value |
81
|
|
|
* @return static |
82
|
|
|
*/ |
83
|
|
|
public function setLoginId($value) |
84
|
|
|
{ |
85
|
|
|
return $this->setParameter('loginId', $value); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @return mixed |
90
|
|
|
*/ |
91
|
|
|
public function getInitialVector() |
92
|
|
|
{ |
93
|
|
|
return $this->getParameter('initialVector'); |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @param $value |
98
|
|
|
* @return static |
99
|
|
|
*/ |
100
|
|
|
public function setInitialVectorItsn($value) |
101
|
|
|
{ |
102
|
|
|
return $this->setParameter('initialVectorItsn', $value); |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* @return mixed |
107
|
|
|
*/ |
108
|
|
|
public function getInitialVectorItsn() |
109
|
|
|
{ |
110
|
|
|
return $this->getParameter('initialVectorItsn'); |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* @param $value |
115
|
|
|
* @return static |
116
|
|
|
*/ |
117
|
|
|
public function setInitialVector($value) |
118
|
|
|
{ |
119
|
|
|
return $this->setParameter('initialVector', $value); |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* @return false|string|null |
124
|
|
|
*/ |
125
|
|
|
public function getAesKey() |
126
|
|
|
{ |
127
|
|
|
if ($this->aesKey === null) { |
128
|
|
|
$this->aesKey = substr(hash('sha256', uniqid(), 0), 0, 32); |
129
|
|
|
} |
130
|
|
|
return $this->aesKey; |
131
|
|
|
} |
132
|
|
|
} |
133
|
|
|
|