setPayService($type); return $this->pay_service->notify(1, $type, $request); } /** * 异步回调 * @param $type支付类型:支付宝,微信 * @param Request $request */ public function notify($type, Request $request) { $this->setPayService($type); return $this->pay_service->notify(0, $type, $request); } /** * 银行卡支付异步回调 * @param Request $request * @return string */ public function bankCardNotify(Request $request){ $type = 'tr_bank2'; $this->setPayService($type); $appid = $request->get('token');//这个和短信的模板有关 $card = $this->getCard($appid); if (is_null($card)) { return '渠道参数异常'; } if (method_exists($this->pay_service, 'cardNotify')) { return $this->pay_service->cardNotify(0, $type, $request, $card); } else { return '系统异常'; } } /** * @return array */ private function cardConfig():array{ return [ 1 => 'FeilvbinCard', 2 => 'KshCard', 3 => 'AiJICard', ]; } /** * @param $app_id * @return BaseCard|null */ private function getCard($app_id): ?BaseCard { $card = null; $configArr = $this->cardConfig(); if (isset($configArr[$app_id])) { $namespace = '\\App\\ServicePay\TransCard\\'; $clazz = $namespace . $configArr[$app_id]; $card = new $clazz(); } return $card; } }