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/Api.php

49 lines
1.7 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Helper\OmiPay;
use App\Helper\OmiPay\Request\GetExchangeRateRequest;
use App\Helper\OmiPay\Request\MakeJSAPIOrderRequest;
use App\Helper\OmiPay\Request\QueryRefundRequest;
use App\Helper\OmiPay\Request\RefundRequest;
class Api extends AbstractApi
{
public static function getExchangeRate($currency, $baseCurrency, $platform = 'WECHATPAY', $language = 'CHS') {
$request = new GetExchangeRateRequest();
$request->setCurrency($currency);
$request->setBaseCurrency($baseCurrency);
$request->setPlatform($platform);
$request->setLanguage($language);
return self::request($request);
}
public static function makeJSAPIOrder($orderName, $outOrderNo, $currency, $amount, $notifyUrl, $redirectUrl) {
$request = new MakeJSAPIOrderRequest();
$request->setOrderName($orderName);
$request->setCurrency($currency);
$request->setOutOrderNo($outOrderNo);
$request->setAmount($amount);
$request->setNotifyUrl($notifyUrl);
$request->setRedirectUrl($redirectUrl);
$request->setDirectPay(0);
$request->setShowPcPayUrl(0);
return self::request($request);
}
public static function refund($orderNo, $outRefundNo, $amount) {
$request = new RefundRequest();
$request->setOrderNo($orderNo);
$request->setOutRefundNo($outRefundNo);
$request->setAmount($amount);
return self::request($request);
}
public static function queryRefund($refundNo) {
$request = new QueryRefundRequest();
$request->setRefundNo($refundNo);
return self::request($request);
}
}