config = $config; } /** 发起支付,返回渲染数据 * ['mode'=>'demo','channel'=>?,'simulate'=>url,'config_missing'=>bool] * ['mode'=>'redirect','channel'=>'alipay','url'=>?] * ['mode'=>'qrcode','channel'=>'wechat','qr'=>?] */ abstract public function pay(array $order): array; /** 验证异步通知,成功返回订单号,否则返回 null */ abstract public function verifyNotify(array $data): ?string; protected function isDemo(): bool { return ($this->config['mode'] ?? 'demo') === 'demo'; } protected function money($v): string { return number_format((float) $v, 2, '.', ''); } }