@@ -171,7 +171,7 @@ private function reportsSign($parameters)
171
171
* @return array ответ сервера Ypmn
172
172
* @throws PaymentException
173
173
*/
174
- private function sendGetRequest (string $ api, ? string $ emptyResponseMessage = null , bool $ curlException = true ): array
174
+ private function sendGetRequest (string $ api ): array
175
175
{
176
176
$ curl = curl_init ();
177
177
$ date = (new DateTime ())->format (DateTimeInterface::ATOM );
@@ -241,14 +241,6 @@ private function sendGetRequest(string $api, ?string $emptyResponseMessage = nul
241
241
}
242
242
}
243
243
244
- if ($ curlException && mb_strlen ($ err ) > 0 ) {
245
- throw new PaymentException ($ err );
246
- }
247
-
248
- if ($ emptyResponseMessage !== null && ($ response == null || strlen ($ response ) === 0 )) {
249
- throw new PaymentException ($ emptyResponseMessage );
250
- }
251
-
252
244
return ['response ' => $ response , 'error ' => $ err ];
253
245
}
254
246
@@ -374,7 +366,17 @@ public function sendRefundRequest(RefundInterface $refund): array
374
366
/** @inheritdoc */
375
367
public function sendStatusRequest (string $ merchantPaymentReference ): array
376
368
{
377
- return $ this ->sendGetRequest (self ::STATUS_API . '/ ' . $ merchantPaymentReference , 'Вы можете попробовать другой способ оплаты, либо свяжитесь с продавцом. ' );
369
+ $ responseData = $ this ->sendGetRequest (self ::STATUS_API . '/ ' . $ merchantPaymentReference );
370
+
371
+ if (mb_strlen ($ responseData ['error ' ]) > 0 ) {
372
+ throw new PaymentException ($ responseData ['error ' ]);
373
+ }
374
+
375
+ if ($ responseData ['response ' ] == null || strlen ($ responseData ['response ' ]) === 0 ) {
376
+ throw new PaymentException ('Вы можете попробовать другой способ оплаты, либо свяжитесь с продавцом. ' );
377
+ }
378
+
379
+ return $ responseData ;
378
380
}
379
381
380
382
/** @inheritdoc */
@@ -398,7 +400,7 @@ public function sendPayoutCreateRequest(PayoutInterface $payout)
398
400
/** @inheritdoc */
399
401
public function sendReportChartRequest (array $ params ): array
400
402
{
401
- return $ this ->sendGetRequest (self ::REPORT_CHART_API . '/? ' . http_build_query ($ params ), null , false );
403
+ return $ this ->sendGetRequest (self ::REPORT_CHART_API . '/? ' . http_build_query ($ params ));
402
404
}
403
405
404
406
/** @inheritdoc */
@@ -415,13 +417,13 @@ public function sendReportChartUpdateRequest(array $params): array
415
417
416
418
$ params = array_merge ($ getParams , $ params );
417
419
418
- return $ this ->sendGetRequest (self ::REPORT_CHART_API . '/? ' . http_build_query ($ params ), null , false );
420
+ return $ this ->sendGetRequest (self ::REPORT_CHART_API . '/? ' . http_build_query ($ params ));
419
421
}
420
422
421
423
/** @inheritdoc */
422
424
public function sendReportGeneralRequest (array $ params ): array
423
425
{
424
- return $ this ->sendGetRequest (self ::REPORT_GENERAL_API . '/? ' . http_build_query ($ params ), null , false );
426
+ return $ this ->sendGetRequest (self ::REPORT_GENERAL_API . '/? ' . http_build_query ($ params ));
425
427
}
426
428
427
429
/**
0 commit comments