You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
717 B
PHP
36 lines
717 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Helper\OmiPay;
|
|
|
|
class Result
|
|
{
|
|
private $data;
|
|
|
|
public function __construct($data)
|
|
{
|
|
$this->data = $data;
|
|
}
|
|
|
|
public function isSuccess() {
|
|
return $this->data['return_code'] == 'SUCCESS';
|
|
}
|
|
|
|
public function get($key) {
|
|
return $this->data[$key] ?? null;
|
|
}
|
|
|
|
public function toArray()
|
|
{
|
|
$data = [];
|
|
if ($this->isSuccess()) {
|
|
$data['is_success'] = true;
|
|
$data['pay_url'] = $this->get('casherUrl');
|
|
} else {
|
|
$data['error_code'] = $this->get('returnCode');
|
|
$data['error_msg'] = $this->get('returnMsg');
|
|
}
|
|
return $data;
|
|
}
|
|
} |