1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @link https://github.com/phpviet/omnipay-onepay |
4
|
|
|
* |
5
|
|
|
* @copyright (c) PHP Viet |
6
|
|
|
* @license [MIT](https://opensource.org/licenses/MIT) |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace Omnipay\OnePay\Concerns; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* @author Vuong Minh <[email protected]> |
13
|
|
|
* @since 1.0.0 |
14
|
|
|
*/ |
15
|
|
|
trait Parameters |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* Trả về giá trị merchant id do OnePay cấp. |
19
|
|
|
* |
20
|
|
|
* @return null|string |
21
|
|
|
*/ |
22
|
|
|
public function getVpcMerchant(): ?string |
23
|
|
|
{ |
24
|
|
|
return $this->getParameter('vpc_Merchant'); |
|
|
|
|
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Thiết lập giá trị merchant id. |
29
|
|
|
* |
30
|
|
|
* @param null|string $merchant |
31
|
|
|
* @return $this |
32
|
|
|
*/ |
33
|
|
|
public function setVpcMerchant(?string $merchant) |
34
|
|
|
{ |
35
|
|
|
return $this->setParameter('vpc_Merchant', $merchant); |
|
|
|
|
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Trả về giá trị access code do OnePay cấp. |
40
|
|
|
* |
41
|
|
|
* @return null|string |
42
|
|
|
*/ |
43
|
|
|
public function getVpcAccessCode(): ?string |
44
|
|
|
{ |
45
|
|
|
return $this->getParameter('vpc_AccessCode'); |
|
|
|
|
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Thiết lập giá trị access code. |
50
|
|
|
* |
51
|
|
|
* @param null|string $code |
52
|
|
|
* @return $this |
53
|
|
|
*/ |
54
|
|
|
public function setVpcAccessCode(?string $code) |
55
|
|
|
{ |
56
|
|
|
return $this->setParameter('vpc_AccessCode', $code); |
|
|
|
|
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Trả về giá trị hash key do OnePay cấp. |
61
|
|
|
* |
62
|
|
|
* @return null|string |
63
|
|
|
*/ |
64
|
|
|
public function getVpcHashKey(): ?string |
65
|
|
|
{ |
66
|
|
|
return $this->getParameter('vpc_HashKey'); |
|
|
|
|
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* Thiết lập giá trị hash key dùng để tạo chữ ký dữ liệu (secure hash). |
71
|
|
|
* |
72
|
|
|
* @param null|string $key |
73
|
|
|
* @return $this |
74
|
|
|
*/ |
75
|
|
|
public function setVpcHashKey(?string $key) |
76
|
|
|
{ |
77
|
|
|
return $this->setParameter('vpc_HashKey', $key); |
|
|
|
|
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* Trả về giá trị user do OnePay cấp. |
82
|
|
|
* |
83
|
|
|
* @return null|string |
84
|
|
|
*/ |
85
|
|
|
public function getVpcUser(): ?string |
86
|
|
|
{ |
87
|
|
|
return $this->getParameter('vpc_User'); |
|
|
|
|
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Thiết lập giá trị user. |
92
|
|
|
* |
93
|
|
|
* @param null|string $user |
94
|
|
|
* @return $this |
95
|
|
|
*/ |
96
|
|
|
public function setVpcUser(?string $user) |
97
|
|
|
{ |
98
|
|
|
return $this->setParameter('vpc_User', $user); |
|
|
|
|
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* Trả về giá trị password do OnePay cấp. |
103
|
|
|
* |
104
|
|
|
* @return null|string |
105
|
|
|
*/ |
106
|
|
|
public function getVpcPassword(): ?string |
107
|
|
|
{ |
108
|
|
|
return $this->getParameter('vpc_Password'); |
|
|
|
|
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* Thiết lập giá trị password. |
113
|
|
|
* |
114
|
|
|
* @param null|string $password |
115
|
|
|
* @return $this |
116
|
|
|
*/ |
117
|
|
|
public function setVpcPassword(?string $password) |
118
|
|
|
{ |
119
|
|
|
return $this->setParameter('vpc_Password', $password); |
|
|
|
|
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* Trả về giá trị version hiện tại. |
124
|
|
|
* |
125
|
|
|
* @return null|string |
126
|
|
|
*/ |
127
|
|
|
public function getVpcVersion(): ?string |
128
|
|
|
{ |
129
|
|
|
return $this->getParameter('vpc_Version'); |
|
|
|
|
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* Thiết lập giá trị version muốn sử dụng. |
134
|
|
|
* |
135
|
|
|
* @param null|string $version |
136
|
|
|
* @return $this |
137
|
|
|
*/ |
138
|
|
|
public function setVpcVersion(?string $version) |
139
|
|
|
{ |
140
|
|
|
return $this->setParameter('vpc_Version', $version); |
|
|
|
|
141
|
|
|
} |
142
|
|
|
} |
143
|
|
|
|
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.