@@ -35,21 +35,25 @@ public function checkWalletBalance(): JsonResponse|array
35
35
'mo ' => $ this ->getCellNumber (),
36
36
'hi ' => $ this ->getParameters ('host_id ' ),
37
37
'walet ' => 5 ,
38
- 'htran ' => $ this ->getWalletChargeTransactionId (),
38
+ 'htran ' => $ this ->getWalletTransactionId (),
39
39
'hop ' => AsanpardakhtStatusEnum::WalletBalanceHop->value ,
40
40
'htime ' => time (),
41
41
'hkey ' => $ this ->getParameters ('api_key ' ),
42
42
]);
43
43
44
- $ hostRequestSign = $ this ->signRequest ($ hostRequest );
45
- $ rawResponse = $ this ->sendInfoToAp ($ hostRequest , $ hostRequestSign , self ::POST_METHOD , $ this ->getUrl ());
44
+ $ rawResponse = $ this ->sendInfoToAp (
45
+ $ hostRequest ,
46
+ $ this ->signRequest ($ hostRequest ),
47
+ self ::POST_METHOD ,
48
+ $ this ->getUrl ()
49
+ );
46
50
$ responseJson = json_decode ($ rawResponse ['hresp ' ], false , 512 , JSON_THROW_ON_ERROR );
47
51
48
52
if ($ responseJson ->st !== 1100 ) {
49
53
$ credit = 0 ;
50
54
51
55
if (property_exists ($ responseJson , 'wball ' )) {
52
- $ credit = $ responseJson ->wball / 10 ;
56
+ $ credit = $ responseJson ->wball / 10 ; // this API returns fucking RIAL!!!
53
57
}
54
58
55
59
return self ::generalResponse (
@@ -95,7 +99,7 @@ public function getBalanceWalletError(\Exception $exception): JsonResponse
95
99
{
96
100
if (method_exists ($ exception , 'getResponse ' ) && ! empty ($ exception ->getResponse ())) {
97
101
$ errorJson = json_decode ($ exception ->getResponse ()->getBody ()->getContents ());
98
- $ errorMsg = $ errorJson != null && property_exists (
102
+ $ errorMsg = ! is_null ( $ errorJson ) && property_exists (
99
103
$ errorJson ,
100
104
'description '
101
105
) ? $ errorJson ->description : $ exception ->getMessage ();
@@ -126,7 +130,7 @@ public function payByWallet(): JsonResponse|array
126
130
'mo ' => $ this ->getCellNumber (),
127
131
'hi ' => $ this ->getParameters ('host_id ' ),
128
132
'walet ' => 5 ,
129
- 'htran ' => $ this ->getTransaction ()-> getWalletTransactionId (),
133
+ 'htran ' => $ this ->getWalletTransactionId (),
130
134
'hop ' => AsanpardakhtStatusEnum::PayByWalletHop->value ,
131
135
'htime ' => time (),
132
136
'stime ' => time (),
@@ -189,7 +193,7 @@ public function reverseWalletPaymentResult(): mixed
189
193
'mo ' => $ this ->getCellNumber (),
190
194
'hi ' => $ this ->getParameters ('host_id ' ),
191
195
'walet ' => 5 ,
192
- 'htran ' => $ this ->getTransaction ()-> getWalletTransactionId (),
196
+ 'htran ' => $ this ->getWalletTransactionId (),
193
197
'hop ' => AsanpardakhtStatusEnum::ReverseRequestHop->value ,
194
198
'htime ' => $ time ,
195
199
'stime ' => $ time ,
@@ -232,7 +236,7 @@ public function walletCharge(): JsonResponse|array
232
236
'mo ' => $ this ->getCellNumber (),
233
237
'hi ' => $ this ->getParameters ('host_id ' ),
234
238
'walet ' => 5 ,
235
- 'htran ' => $ this ->getWalletChargeTransactionId (),
239
+ 'htran ' => $ this ->getWalletTransactionId (),
236
240
'hop ' => AsanpardakhtStatusEnum::ChargeWallet->value ,
237
241
'htime ' => time (),
238
242
'stime ' => time (),
@@ -400,9 +404,4 @@ public function refundWalletPaymentResult(): mixed
400
404
401
405
return $ result ;
402
406
}
403
-
404
- private function getWalletChargeTransactionId (): int
405
- {
406
- return 900000000000 + time ();
407
- }
408
407
}
0 commit comments