@@ -24,10 +24,10 @@ class Saman extends AdapterAbstract implements AdapterInterface
24
24
protected $ reverseSupport = true ;
25
25
26
26
/**
27
- * @return array
28
- * @throws Exception
27
+ * @return string
28
+ * @throws \Tartan\Larapay\Adapter\ Exception
29
29
*/
30
- protected function requestToken ()
30
+ protected function requestToken (): string
31
31
{
32
32
Log::debug (__METHOD__ );
33
33
@@ -74,7 +74,7 @@ protected function requestToken()
74
74
}
75
75
}
76
76
77
- public function generateForm ()
77
+ public function generateForm (): string
78
78
{
79
79
Log::debug (__METHOD__ );
80
80
@@ -85,7 +85,7 @@ public function generateForm()
85
85
}
86
86
}
87
87
88
- protected function generateFormWithoutToken ()
88
+ protected function generateFormWithoutToken (): string
89
89
{
90
90
Log::debug (__METHOD__ , $ this ->getParameters ());
91
91
@@ -107,7 +107,7 @@ protected function generateFormWithoutToken()
107
107
]);
108
108
}
109
109
110
- protected function generateFormWithToken ()
110
+ protected function generateFormWithToken (): string
111
111
{
112
112
Log::debug (__METHOD__ , $ this ->getParameters ());
113
113
$ this ->checkRequiredParameters ([
@@ -133,7 +133,12 @@ protected function generateFormWithToken()
133
133
]);
134
134
}
135
135
136
- protected function verifyTransaction ()
136
+ /**
137
+ * @return bool
138
+ * @throws Exception
139
+ * @throws \Tartan\Larapay\Adapter\Exception
140
+ */
141
+ protected function verifyTransaction (): bool
137
142
{
138
143
if ($ this ->getTransaction ()->checkForVerify () == false ) {
139
144
throw new Exception ('larapay::larapay.could_not_verify_payment ' );
@@ -144,7 +149,8 @@ protected function verifyTransaction()
144
149
'RefNum ' ,
145
150
'ResNum ' ,
146
151
'merchant_id ' ,
147
- 'TRACENO ' ,
152
+ 'TraceNo ' ,
153
+ 'SecurePan '
148
154
]);
149
155
150
156
if ($ this ->State != 'OK ' ) {
@@ -160,8 +166,10 @@ protected function verifyTransaction()
160
166
if (isset ($ response )) {
161
167
Log::info ('VerifyTransaction response ' , ['response ' => $ response ]);
162
168
163
- if ($ response == $ this ->getTransaction ()->getPayableAmount ()) { // check by transaction amount
164
- $ this ->getTransaction ()->setVerified ();
169
+ if ($ response == $ this ->getTransaction ()->getPayableAmount ()) {
170
+ // double check the amount by transaction amount
171
+ $ this ->getTransaction ()->setCardNumber ($ this ->SecurePan , false ); // no save()
172
+ $ this ->getTransaction ()->setVerified (); // with save()
165
173
166
174
return true ;
167
175
} else {
@@ -176,7 +184,12 @@ protected function verifyTransaction()
176
184
}
177
185
}
178
186
179
- protected function reverseTransaction ()
187
+ /**
188
+ * @return bool
189
+ * @throws Exception
190
+ * @throws \Tartan\Larapay\Adapter\Exception
191
+ */
192
+ protected function reverseTransaction (): bool
180
193
{
181
194
if ($ this ->reverseSupport == false || $ this ->getTransaction ()->checkForReverse () == false ) {
182
195
throw new Exception ('larapay::larapay.could_not_reverse_payment ' );
@@ -240,6 +253,10 @@ public function canContinueWithCallbackParameters(): bool
240
253
return false ;
241
254
}
242
255
256
+ /**
257
+ * @return string
258
+ * @throws \Tartan\Larapay\Adapter\Exception
259
+ */
243
260
public function getGatewayReferenceId (): string
244
261
{
245
262
$ this ->checkRequiredParameters ([
@@ -249,7 +266,12 @@ public function getGatewayReferenceId(): string
249
266
return $ this ->RefNum ;
250
267
}
251
268
252
- protected function getWSDL ($ type = null )
269
+ /**
270
+ * @param string $type
271
+ *
272
+ * @return string
273
+ */
274
+ protected function getWSDL ($ type = null ): string
253
275
{
254
276
if (config ('larapay.mode ' ) == 'production ' ) {
255
277
switch (strtoupper ($ type )) {
0 commit comments