feat: new xboard

This commit is contained in:
xboard
2025-01-21 14:57:54 +08:00
parent de18cfe596
commit 0f43fff242
373 changed files with 17923 additions and 20264 deletions
+7 -6
View File
@@ -7,8 +7,9 @@ namespace App\Payments;
use App\Exceptions\ApiException;
use \Curl\Curl;
class MGate {
use App\Contracts\PaymentInterface;
class MGate implements PaymentInterface
{
private $config;
public function __construct($config)
@@ -16,7 +17,7 @@ class MGate {
$this->config = $config;
}
public function form()
public function form(): array
{
return [
'mgate_url' => [
@@ -42,7 +43,7 @@ class MGate {
];
}
public function pay($order)
public function pay($order): array
{
$params = [
'out_trade_no' => $order['trade_no'],
@@ -67,7 +68,7 @@ class MGate {
}
if ($curl->error) {
if (isset($result->errors)) {
$errors = (array)$result->errors;
$errors = (array) $result->errors;
throw new ApiException($errors[array_keys($errors)[0]][0]);
}
if (isset($result->message)) {
@@ -85,7 +86,7 @@ class MGate {
];
}
public function notify($params)
public function notify($params): array|bool
{
$sign = $params['sign'];
unset($params['sign']);