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/OmiPay/Signer.php

23 lines
568 B
PHP

<?php
declare(strict_types=1);
namespace App\Helper\OmiPay;
class Signer
{
public static function sign($params) {
$mNumber = $params['m_number'] ?? '';
$mNumber = $mNumber ? $mNumber : Config::get('app_id');
$signString = $mNumber . '&'
. $params['timestamp'] . '&'
. $params['nonce_str'] . '&'
. Config::get('secret_key');
return strtoupper(md5($signString));
}
public static function verify($params) {
$sign = $params['sign'] ?? '';
return $sign == self::sign($params);
}
}