11
11
class Billing extends TossPayments implements AttributeInterface
12
12
{
13
13
protected string $ uri ;
14
+
14
15
protected string $ customerKey ;
16
+
15
17
protected string $ cardNumber ;
18
+
16
19
protected string $ cardExpirationYear ;
20
+
17
21
protected string $ cardExpirationMonth ;
22
+
18
23
protected string $ customerIdentityNumber ;
24
+
19
25
protected string $ authKey ;
26
+
20
27
protected string $ billingKey ;
28
+
21
29
protected int $ amount ;
30
+
22
31
protected string $ orderName ;
32
+
23
33
protected string $ orderId ;
24
34
25
35
public function __construct ()
@@ -38,22 +48,16 @@ public function initializeUri(): static
38
48
return $ this ;
39
49
}
40
50
41
- /**
42
- * @param string|null $endpoint
43
- * @param bool $withUri
44
- * @return string
45
- */
46
51
public function createEndpoint (?string $ endpoint , bool $ withUri = true ): string
47
52
{
48
53
if ($ withUri ) {
49
- return $ this ->url . $ this ->uri . $ this ->start ($ endpoint );
54
+ return $ this ->url . $ this ->uri . $ this ->start ($ endpoint );
50
55
}
51
56
52
- return $ this ->url . $ this ->start ($ endpoint );
57
+ return $ this ->url . $ this ->start ($ endpoint );
53
58
}
54
59
55
60
/**
56
- * @param string $customerKey
57
61
* @return $this
58
62
*/
59
63
public function customerKey (string $ customerKey ): static
@@ -64,7 +68,6 @@ public function customerKey(string $customerKey): static
64
68
}
65
69
66
70
/**
67
- * @param string $cardNumber
68
71
* @return $this
69
72
*/
70
73
public function cardNumber (string $ cardNumber ): static
@@ -75,7 +78,6 @@ public function cardNumber(string $cardNumber): static
75
78
}
76
79
77
80
/**
78
- * @param string $cardExpirationYear
79
81
* @return $this
80
82
*/
81
83
public function cardExpirationYear (string $ cardExpirationYear ): static
@@ -86,7 +88,6 @@ public function cardExpirationYear(string $cardExpirationYear): static
86
88
}
87
89
88
90
/**
89
- * @param string $cardExpirationMonth
90
91
* @return $this
91
92
*/
92
93
public function cardExpirationMonth (string $ cardExpirationMonth ): static
@@ -97,7 +98,6 @@ public function cardExpirationMonth(string $cardExpirationMonth): static
97
98
}
98
99
99
100
/**
100
- * @param string $customerIdentityNumber
101
101
* @return $this
102
102
*/
103
103
public function customerIdentityNumber (string $ customerIdentityNumber )
@@ -107,20 +107,12 @@ public function customerIdentityNumber(string $customerIdentityNumber)
107
107
return $ this ;
108
108
}
109
109
110
- /**
111
- * @param string|null $cardPassword
112
- * @param string|null $customerName
113
- * @param string|null $customerEmail
114
- * @param Vbv|null $vbv
115
- * @return PromiseInterface|Response
116
- */
117
110
public function authorizationsCard (
118
111
?string $ cardPassword = null ,
119
112
?string $ customerName = null ,
120
113
?string $ customerEmail = null ,
121
- ?Vbv $ vbv = null
122
- ): PromiseInterface |Response
123
- {
114
+ ?Vbv $ vbv = null
115
+ ): PromiseInterface |Response {
124
116
$ parameters = [];
125
117
if ($ cardPassword ) {
126
118
$ parameters ['cardPassword ' ] = $ cardPassword ;
@@ -135,21 +127,18 @@ public function authorizationsCard(
135
127
}
136
128
137
129
if ($ vbv ) {
138
- $ parameters ['vbv ' ] = (array )$ vbv ;
130
+ $ parameters ['vbv ' ] = (array ) $ vbv ;
139
131
}
140
132
141
133
return $ this ->client ->post ($ this ->createEndpoint ('/authorizations/card ' ), [
142
- 'customerKey ' => $ this ->customerKey ,
143
- 'cardNumber ' => $ this ->cardNumber ,
144
- 'cardExpirationYear ' => $ this ->cardExpirationYear ,
145
- 'cardExpirationMonth ' => $ this ->cardExpirationMonth ,
146
- 'customerIdentityNumber ' => $ this ->customerIdentityNumber ,
147
- ] + $ parameters );
134
+ 'customerKey ' => $ this ->customerKey ,
135
+ 'cardNumber ' => $ this ->cardNumber ,
136
+ 'cardExpirationYear ' => $ this ->cardExpirationYear ,
137
+ 'cardExpirationMonth ' => $ this ->cardExpirationMonth ,
138
+ 'customerIdentityNumber ' => $ this ->customerIdentityNumber ,
139
+ ] + $ parameters );
148
140
}
149
141
150
- /**
151
- * @return PromiseInterface|Response
152
- */
153
142
public function authorizationsIssue (): PromiseInterface |Response
154
143
{
155
144
return $ this ->client ->post ($ this ->createEndpoint ('/authorizations/issue ' ), [
@@ -159,7 +148,6 @@ public function authorizationsIssue(): PromiseInterface|Response
159
148
}
160
149
161
150
/**
162
- * @param string $billingKey
163
151
* @return $this
164
152
*/
165
153
public function billingKey (string $ billingKey ): static
@@ -190,22 +178,13 @@ public function orderName(string $orderName): static
190
178
return $ this ;
191
179
}
192
180
193
- /**
194
- * @param string|null $customerEmail
195
- * @param string|null $customerName
196
- * @param string|null $customerMobilePhone
197
- * @param int|null $taxFreeAmount
198
- * @param int|null $cardInstallmentPlan
199
- * @return PromiseInterface|Response
200
- */
201
181
public function request (
202
182
?string $ customerEmail = null ,
203
183
?string $ customerName = null ,
204
184
?string $ customerMobilePhone = null ,
205
- ?int $ taxFreeAmount = null ,
206
- ?int $ cardInstallmentPlan = null
207
- ): PromiseInterface |Response
208
- {
185
+ ?int $ taxFreeAmount = null ,
186
+ ?int $ cardInstallmentPlan = null
187
+ ): PromiseInterface |Response {
209
188
$ parameters = [];
210
189
if ($ customerEmail ) {
211
190
$ parameters ['customerEmail ' ] = $ customerEmail ;
@@ -227,11 +206,11 @@ public function request(
227
206
$ parameters ['cardInstallmentPlan ' ] = $ cardInstallmentPlan ;
228
207
}
229
208
230
- return $ this ->client ->post ($ this ->createEndpoint ('/ ' . $ this ->billingKey ), [
231
- 'amount ' => $ this ->amount ,
232
- 'customerKey ' => $ this ->customerKey ,
233
- 'orderId ' => $ this ->orderId ,
234
- 'orderName ' => $ this ->orderName ,
235
- ] + $ parameters );
209
+ return $ this ->client ->post ($ this ->createEndpoint ('/ ' . $ this ->billingKey ), [
210
+ 'amount ' => $ this ->amount ,
211
+ 'customerKey ' => $ this ->customerKey ,
212
+ 'orderId ' => $ this ->orderId ,
213
+ 'orderName ' => $ this ->orderName ,
214
+ ] + $ parameters );
236
215
}
237
216
}
0 commit comments