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.
payment/app/Helper/Efps/Result.php

52 lines
1.0 KiB
PHTML

2 years ago
<?php
declare(strict_types=1);
namespace App\Helper\Efps;
class Result
{
private $data;
public function __construct($data)
{
$this->data = $data;
}
public function isSuccess()
{
return $this->data['returnCode'] == '0000';
}
1 year ago
public function get($key, $default = null)
2 years ago
{
1 year ago
return $this->data[$key] ?? $default;
}
public function getCode()
{
return $this->data['returnCode'];
2 years ago
}
2 years ago
public function getMessage()
2 years ago
{
2 years ago
return $this->data['returnMsg'];
}
1 year ago
public function getData(array $fields = null)
2 years ago
{
1 year ago
$returnData = [];
if (is_array($fields)) {
foreach ($fields as $field) {
$returnData[$field] = $this->data[$field] ?? null;
}
} else {
$returnData = $this->data;
}
unset($returnData['returnCode']);
unset($returnData['returnMsg']);
unset($returnData['nonceStr']);
unset($returnData['customerCode']);
return $returnData;
2 years ago
}
}