@@ -24,10 +24,10 @@ class Saman extends AdapterAbstract implements AdapterInterface
2424 protected $ reverseSupport = true ;
2525
2626 /**
27- * @return array
28- * @throws Exception
27+ * @return string
28+ * @throws \Tartan\Larapay\Adapter\ Exception
2929 */
30- protected function requestToken ()
30+ protected function requestToken (): string
3131 {
3232 Log::debug (__METHOD__ );
3333
@@ -74,7 +74,7 @@ protected function requestToken()
7474 }
7575 }
7676
77- public function generateForm ()
77+ public function generateForm (): string
7878 {
7979 Log::debug (__METHOD__ );
8080
@@ -85,7 +85,7 @@ public function generateForm()
8585 }
8686 }
8787
88- protected function generateFormWithoutToken ()
88+ protected function generateFormWithoutToken (): string
8989 {
9090 Log::debug (__METHOD__ , $ this ->getParameters ());
9191
@@ -107,7 +107,7 @@ protected function generateFormWithoutToken()
107107 ]);
108108 }
109109
110- protected function generateFormWithToken ()
110+ protected function generateFormWithToken (): string
111111 {
112112 Log::debug (__METHOD__ , $ this ->getParameters ());
113113 $ this ->checkRequiredParameters ([
@@ -133,7 +133,12 @@ protected function generateFormWithToken()
133133 ]);
134134 }
135135
136- protected function verifyTransaction ()
136+ /**
137+ * @return bool
138+ * @throws Exception
139+ * @throws \Tartan\Larapay\Adapter\Exception
140+ */
141+ protected function verifyTransaction (): bool
137142 {
138143 if ($ this ->getTransaction ()->checkForVerify () == false ) {
139144 throw new Exception ('larapay::larapay.could_not_verify_payment ' );
@@ -144,7 +149,8 @@ protected function verifyTransaction()
144149 'RefNum ' ,
145150 'ResNum ' ,
146151 'merchant_id ' ,
147- 'TRACENO ' ,
152+ 'TraceNo ' ,
153+ 'SecurePan '
148154 ]);
149155
150156 if ($ this ->State != 'OK ' ) {
@@ -160,8 +166,10 @@ protected function verifyTransaction()
160166 if (isset ($ response )) {
161167 Log::info ('VerifyTransaction response ' , ['response ' => $ response ]);
162168
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()
165173
166174 return true ;
167175 } else {
@@ -176,7 +184,12 @@ protected function verifyTransaction()
176184 }
177185 }
178186
179- protected function reverseTransaction ()
187+ /**
188+ * @return bool
189+ * @throws Exception
190+ * @throws \Tartan\Larapay\Adapter\Exception
191+ */
192+ protected function reverseTransaction (): bool
180193 {
181194 if ($ this ->reverseSupport == false || $ this ->getTransaction ()->checkForReverse () == false ) {
182195 throw new Exception ('larapay::larapay.could_not_reverse_payment ' );
@@ -240,6 +253,10 @@ public function canContinueWithCallbackParameters(): bool
240253 return false ;
241254 }
242255
256+ /**
257+ * @return string
258+ * @throws \Tartan\Larapay\Adapter\Exception
259+ */
243260 public function getGatewayReferenceId (): string
244261 {
245262 $ this ->checkRequiredParameters ([
@@ -249,7 +266,12 @@ public function getGatewayReferenceId(): string
249266 return $ this ->RefNum ;
250267 }
251268
252- protected function getWSDL ($ type = null )
269+ /**
270+ * @param string $type
271+ *
272+ * @return string
273+ */
274+ protected function getWSDL ($ type = null ): string
253275 {
254276 if (config ('larapay.mode ' ) == 'production ' ) {
255277 switch (strtoupper ($ type )) {
0 commit comments