50 lines
1009 B
PHP
50 lines
1009 B
PHP
<?php
|
|
|
|
namespace crmeb\services\payTool;
|
|
|
|
abstract class PayTool
|
|
{
|
|
|
|
public $config;
|
|
public $error = ['success' => false];
|
|
const Scrcu = 'scrcu';
|
|
|
|
const ClassMap = [
|
|
self::Scrcu => Scrcu::class,
|
|
];
|
|
|
|
/**
|
|
* @param $name
|
|
* @param $params
|
|
* @return mixed|Scrcu
|
|
* @throws \Exception
|
|
*/
|
|
public static function instance($name, $params = [])
|
|
{
|
|
$class = self::ClassMap[$name];
|
|
if (class_exists($class)) {
|
|
return new $class($params);
|
|
}
|
|
throw new \Exception('支付方式未开通', 500);
|
|
}
|
|
|
|
public function getError()
|
|
{
|
|
return $this->error;
|
|
}
|
|
|
|
public abstract function pay($order);
|
|
|
|
public abstract function query($orderNo);
|
|
|
|
public abstract function callback($request = null);
|
|
|
|
public abstract function success();
|
|
|
|
public abstract function refund($order);
|
|
|
|
public abstract function refundQuery($refundOrder);
|
|
|
|
public abstract function transfer($withdraw);
|
|
|
|
} |