<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\PayCenter\Web\Controller; use Illuminate\Routing\Controller; use Illuminate\Support\Facades\Input; use Illuminate\Support\Facades\Log; use Illuminate\Support\Str; use ModStart\Core\Exception\BizException; use ModStart\Core\Input\InputPackage; use ModStart\Core\Input\Request; use ModStart\Core\Input\Response; use Module\PayCenter\Provider\PayCenterProvider; use Module\PayCenter\Type\PayType; use Module\PayCenter\Util\PayOrderUtil; use Module\PayCenter\Web\Support\PayAlipayWebNotify; use Payment\Client\Notify; use Payment\Config; class NotifyController extends Controller { public function index($ri8KE = '') { goto c6cFH; t07Xu: switch ($ri8KE) { case PayType::ALIPAY: goto ZxdVX; ZxdVX: PayOrderUtil::initAlipay(); goto Y_Hd8; Y_Hd8: if (!app('alipay.web')->verify()) { Log::info('PayCenter.Alipay.VerifyFailed - ' . json_encode(array('data' => Request::instance()->getContent()))); return 'fail'; } goto ESEhA; ESEhA: switch (Input::get('trade_status')) { case 'TRADE_SUCCESS': case 'TRADE_FINISHED': goto aXt8x; aXt8x: $MM40Z = $WZ8dY->getTrimString('out_trade_no'); goto I7w52; xSk9K: if ($Tbn6c['code']) { return 'fail'; } goto d5yhx; I7w52: $Bsa6u = $WZ8dY->getTrimString('trade_no'); goto fOfqv; R3B18: $Tbn6c = PayOrderUtil::handleOrderPay(PayType::ALIPAY, $MM40Z, array('payOrderId' => $Bsa6u)); goto xSk9K; d5yhx: return 'success'; goto TpXRh; fOfqv: Log::info('PayCenter.Alipay.VerifySuccess - ' . json_encode(array('out_trade_no' => $MM40Z, 'trade_no' => $Bsa6u), JSON_UNESCAPED_UNICODE)); goto R3B18; TpXRh: } goto RZ0py; RZ0py: return 'fail'; goto x4mqd; x4mqd: case PayType::WECHAT: case PayType::WECHAT_MOBILE: case PayType::WECHAT_H5: try { return PayOrderUtil::getWechatPayment()->handlePaidNotify(function ($vmVac, $C201h) use($ri8KE) { Log::info('PayCenter.' . $ri8KE . '.VerifySuccess - ' . json_encode($vmVac, JSON_UNESCAPED_UNICODE)); $Tbn6c = PayOrderUtil::handleOrderPay($ri8KE, $vmVac['out_trade_no'], array('payOrderId' => $vmVac['transaction_id'])); if ($Tbn6c['code']) { $C201h($Tbn6c['msg']); } return true; }); } catch (\Exception $ZemkG) { return $this->handleException($ZemkG); } case PayType::WECHAT_MINI_PROGRAM: try { return PayOrderUtil::getWechatMiniProgramPayment()->handlePaidNotify(function ($vmVac, $C201h) { Log::info('PayCenter.WechatMiniProgram.VerifySuccess - ' . json_encode($vmVac, JSON_UNESCAPED_UNICODE)); $Tbn6c = PayOrderUtil::handleOrderPay(PayType::WECHAT_MINI_PROGRAM, $vmVac['out_trade_no'], array('payOrderId' => $vmVac['transaction_id'])); if ($Tbn6c['code']) { $C201h($Tbn6c['msg']); } return true; }); } catch (\Exception $ZemkG) { return $this->handleException($ZemkG); } case PayType::ALIPAY_WEB: case PayType::ALIPAY_MOBILE: goto olNAA; AgzNL: $nV1c1 = Notify::run(Config::ALI_CHARGE, $akSp2, new PayAlipayWebNotify($ri8KE)); goto HVOls; s3wNh: $akSp2 = PayOrderUtil::alipayWebConfig($ri8KE); goto AgzNL; HVOls: Log::info('PayCenter.' . $ri8KE . '.NotifyResult - ' . json_encode($nV1c1, JSON_UNESCAPED_UNICODE)); goto v6zYE; olNAA: Log::info('PayCenter.' . $ri8KE . '.Notify - ' . json_encode($WZ8dY->all(), JSON_UNESCAPED_UNICODE)); goto s3wNh; v6zYE: return $nV1c1; goto w3gQR; w3gQR: default: goto ghnxh; jWAAV: return $oMd7I->onNotify($ri8KE, $WZ8dY->all()); goto XimZF; Ok1CI: BizException::throwsIfEmpty('PayTypeProviderEmpty - ' . $ri8KE, $oMd7I); goto OEeRh; OEeRh: Log::info('PayCenter.' . $ri8KE . '.Notify - ' . json_encode($WZ8dY->all(), JSON_UNESCAPED_UNICODE)); goto jWAAV; ghnxh: $oMd7I = PayCenterProvider::get($ri8KE); goto Ok1CI; XimZF: } goto zi43y; jerFC: Log::info('PayCenter.Notify - ' . json_encode($WZ8dY->all(), JSON_UNESCAPED_UNICODE)); goto t07Xu; c6cFH: $WZ8dY = InputPackage::buildFromInput(); goto jerFC; zi43y: } private function handleException(\Exception $ZemkG) { goto BMLaW; CYg6G: foreach ($FQ6UA as $kEhTf => $y2Ltn) { if (Str::contains($vmVac, $kEhTf)) { Log::info('PayCenter.NotifyController - ' . $y2Ltn); return Response::sendError('错误的请求'); } } goto c8Hfh; c8Hfh: throw $ZemkG; goto I80Io; BMLaW: $vmVac = $ZemkG->getMessage(); goto UIWFI; UIWFI: $FQ6UA = array('Invalid request XML' => 'InvalidXML', 'simplexml_load_string' => 'InvalidXML', 'Undefined index' => 'InvalidNotify'); goto CYg6G; I80Io: } }