Skip to content

Commit 4eaf366

Browse files
committed
fixed other errors handling & version
1 parent dda5d92 commit 4eaf366

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/Classes/Api/PaynetApi.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ private function execute(string $action, array $data): array {
6767
throw new PayneteasyException($error_message, [ 'response' => $error_code ]);
6868

6969
if (empty($response))
70-
throw new PayneteasyException('Host response is empty', [ 'response' => $response ]);
70+
throw new PayneteasyException('Card processing response is empty', [ 'response' => $response ]);
7171

7272
parse_str($response, $result);
7373
foreach ($result as $k => $v)
7474
$result[$k] = rtrim($v);
7575

76-
if ($result['type'] == 'validation-error')
77-
throw new PayneteasyException("Payneteasy reports error: {$result['error-message']}", [ 'response' => $response ]);
76+
if (preg_match('/error/', $result['type']))
77+
throw new PayneteasyException("Card processing reports error: {$result['error-message']}", [ 'response' => $response ]);
7878

7979
return $result;
8080
}

wc-payneteasy.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Requires PHP: 7.4
1111
*
1212
* @package Payneteasy
13-
* @version 1.0.0
13+
* @version 1.0.3
1414
*/
1515

1616
if (!defined('ABSPATH')) exit; # Exit if accessed directly
@@ -66,7 +66,7 @@ private function init_payment_settings(): array {
6666
$s[$k] = in_array($k, ['sandbox', 'require_ssn'])
6767
? ($this->get_option($k) == 'yes')
6868
: $this->get_option($k);
69-
69+
7070
if (property_exists($this, $k))
7171
$this->$k = $s[$k];
7272
}

0 commit comments

Comments
 (0)