isEnabled('cloud-pay')) { throw new AppException('插件未开启'); } $className = new \Yunshop\CloudPay\services\CloudPayService(); break; case self::PAY_STORE: $className = new StorePay(); break; case self::PAY_YUN_WEACHAT: case self::PAY_YUN_ALIPAY: if (!app('plugins')->isEnabled('yun-pay')) { throw new AppException('插件未开启'); } $className = new \Yunshop\YunPay\services\YunPayService(); break; case self::PAY_Huanxun_Quick: case self::PAY_Huanxun_Wx: if (!app('plugins')->isEnabled('huanxun')) { throw new AppException('插件未开启'); } $className = new \Yunshop\Huanxun\services\HuanxunPayService(); break; case self::PAY_EUP: if (!app('plugins')->isEnabled('eup-pay')) { throw new AppException('插件未开启'); } $className = new \Yunshop\EupPay\services\EupWithdrawService(); break; case self::PAY_REMITTANCE: $className = new RemittancePay(); break; case self::PAY_COD: $className = new CODPay(); break; case self::WFT_PAY: if (!app('plugins')->isEnabled('wft-pay')) { throw new AppException('插件未开启'); } $className = new \Yunshop\WftPay\services\WftPayService(); break; case self::WFT_ALIPAY: if (!app('plugins')->isEnabled('wft-alipay')) { throw new AppException('插件未开启'); } $className = new \Yunshop\WftAlipay\services\WftAlipayService(); break; case self::PAY_WE_CHAT_APP: if (!app('plugins')->isEnabled('app-set')) { throw new AppException('APP设置插件未开启'); } $className = new WeChatAppPay(); break; case self::PAY_PLD: if (!app('plugins')->isEnabled('pld-pay')) { throw new AppException('插件未开启'); } $className = new \Yunshop\PLdPay\services\PldWithdrawService(); break; case self::PAY_SEPARATE: \Log::debug('--------payFactory---------'); if (!app('plugins')->isEnabled('separate')) { throw new AppException('插件未开启'); } $className = new \Yunshop\Separate\Common\Services\SeparateAccountService(); break; case self::PAY_DIANBANG: if (!app('plugins')->isEnabled('dian-bang-scan')) { throw new AppException('插件未开启'); } $className = new \Yunshop\DianBangScan\services\DianBangScanService(); break; case self::YOP_PRO_WECHAT: case self::YOP_PRO_ALIPAY: if (!app('plugins')->isEnabled('yop-pro')) { throw new AppException('易宝专业版插件未开启'); } $className = new \Yunshop\YopPro\services\YopProPayService(); break; case self::YOP: case self::YOP_ALIPAY: if (!app('plugins')->isEnabled('yop-pay')) { throw new AppException('易宝插件未开启'); } $className = new \Yunshop\YopPay\services\YopPayService(); break; case self::PAY_Usdt: if (!app('plugins')->isEnabled('usdtpay')) { throw new AppException('Usdt插件未开启'); } $className = new \Yunshop\Usdtpay\services\UsdtpayService(); break; case self::PAY_WE_CHAT_APPLET: if (!app('plugins')->isEnabled('min-app')) { throw new AppException('小程序插件未开启'); } $className = new WeChatAppletPay(); break; case self::PAY_TEAM_DEPOSIT: if (!app('plugins')->isEnabled('team-rewards') && \Setting::get('team-rewards.is_open') != 1) { throw new AppException('插件未开启'); } $className = new \Yunshop\TeamRewards\common\services\DepositPayService(); break; case self:: PAY_WECHAT_JUEQI: if (!app('plugins')->isEnabled('jueqi-pay') && \Setting::get('plugin.jueqi_pay_set.switch') != 1) { throw new AppException('插件未开启'); } $className = new \Yunshop\JueqiPay\services\JueqiPayService(); break; case self::LCG_BALANCE: case self::LCG_BANK_CARD: if (!app('plugins')->isEnabled('dragon-deposit')) { throw new AppException('龙存管插件未开启'); } $className = new \Yunshop\DragonDeposit\services\LcgPayService(); break; //汇聚支付微信-分账 case self::PAY_ALI_SEPARATE_HJ: case self::PAY_SEPARATE_HJ: if (!app('plugins')->isEnabled('converge-alloc-funds') && \Setting::get( 'plugin.ConvergeAllocFunds_set' ) == false) { throw new AppException('商城未开启汇聚分账支付'); } $className = new \Yunshop\ConvergeAllocFunds\services\JoinPayService(); break; //汇聚支付支付宝-分账 case self::PAY_WECHAT_HJ: if (!app('plugins')->isEnabled('converge_pay') && \Setting::get( 'plugin.convergePay_set.wechat' ) == false) { throw new AppException('商城未开启汇聚支付插件中微信支付'); } $className = new \Yunshop\ConvergePay\services\WechatService(); break; case self::PAY_ALIPAY_HJ: if (!app('plugins')->isEnabled('converge_pay') && \Setting::get( 'plugin.convergePay_set.alipay' ) == false) { throw new AppException('商城未开启汇聚支付插件中微信支付'); } $className = new \Yunshop\ConvergePay\services\AlipayService(); break; case self::PAY_ALIPAY_FACE_HJ: case self::PAY_ALIPAY_SCAN_HJ: if (!app('plugins')->isEnabled('converge_pay') && \Setting::get( 'plugin.convergePay_set.wechat' ) == false) { throw new AppException('商城未开启汇聚支付插件中支付宝支付'); } $className = new \Yunshop\ConvergePay\services\AlipayScanService(); break; case self::PAY_WECHAT_FACE_HJ: case self::PAY_WECHAT_SCAN_HJ: if (!app('plugins')->isEnabled('converge_pay') && \Setting::get( 'plugin.convergePay_set.wechat' ) == false) { throw new AppException('商城未开启汇聚支付插件中微信支付'); } $className = new \Yunshop\ConvergePay\services\WechatScanService(); break; //微信扫码支付官方 case self:: WECHAT_FACE_PAY: case self:: WECHAT_SCAN_PAY: $className = new WechatScanPayService(); break; case self:: WECHAT_JSAPI_PAY: $className = new WechatJsapiPayService(); break; case self:: ALIPAY_FACE_PAY: case self:: ALIPAY_SCAN_PAY: $className = new AlipayScanPayService(); break; case self::ALIPAY_JSAPI_PAY: $className = new AlipayJsapiPayService(); break; case self::YOP_ALIPAY_SCAN: case self::YOP_WECHAT_FACE: case self::YOP_ALIPAY_FACE: case self::YOP_WECHAT_SCAN: if (!app('plugins')->isEnabled('yop-pay')) { throw new AppException('易宝插件未开启'); } $className = new \Yunshop\YopPay\services\YopScanPayService(); break; case self::PAY_WECHAT_TOUTIAO: if (!app('plugins')->isEnabled('toutiao-mini') && \Setting::get('plugin.toutiao-mini.wx_switch') != 1) { throw new AppException('商城未开启头条支付中微信支付'); } $className = new \Yunshop\ToutiaoMini\services\WechatService(); break; case self::PAY_ALIPAY_TOUTIAO: if (!app('plugins')->isEnabled('toutiao-mini') && \Setting::get( 'plugin.toutiao-mini.alipay_switch' ) != 1) { throw new AppException('商城未开启头条支付中支付宝支付'); } $className = new \Yunshop\ToutiaoMini\services\AlipayService(); break; case self::MEMBER_CARD_PAY: if (!app('plugins')->isEnabled('pet') && \Setting::get('plugin.pet.is_open_pet') != 1) { throw new AppException('商城未开启宠物医院支付中会员卡余额支付'); } $className = new \YunShop\Pet\services\MemberCardPayService(); break; case self::HK_SCAN_PAY: if (!app('plugins')->isEnabled('hk-pay')) { throw new AppException('商城未开启港版支付插件'); } $className = new \Yunshop\HkPay\services\HkScanPayService(); break; case self::PAY_PAL: if (!app('plugins')->isEnabled('pay-pal')) { throw new AppException('商城未开启PayPal插件'); } $className = new \Yunshop\PayPal\services\PayPalService(); break; case self::CONVERGE_QUICK_PAY: if (!app('plugins')->isEnabled('converge_pay') && \Setting::get( 'plugin.convergePay_set.quick_pay.is_open' ) != 1) { throw new AppException('商城未开启汇聚支付插件中快捷支付'); } $className = new \Yunshop\ConvergePay\services\QuickPayService(); break; case self::HK_SCAN_ALIPAY: if (!app('plugins')->isEnabled('hk-pay')) { throw new AppException('商城未开启港版支付插件'); } $className = new HkScanAliPayService(); break; case self::CONFIRM_PAY: $className = new \app\common\services\ConfirmPay(); break; case self::WECHAT_H5: $className = new \app\common\services\payment\WechatH5Pay(); break; case self::STORE_AGGREGATE_WECHAT: $className = new \Yunshop\StoreAggregatePay\services\WechatPayService(); break; case self::STORE_AGGREGATE_ALIPAY: $className = new \Yunshop\StoreAggregatePay\services\AlipayPayService(); break; case self::STORE_AGGREGATE_SCAN: $className = new \Yunshop\StoreAggregatePay\services\ScanPayService(); break; case self::WECHAT_NATIVE: $className = new \app\common\services\payment\WechatNativePay(); break; case self::DCM_SCAN_PAY: $className = new \Yunshop\DcmScanPay\services\ScanPayService(); break; case self::YEE_PAY: if (!app('plugins')->isEnabled('yee-pay')) { throw new AppException('商城未开启易宝代付插件'); } $className = new \Yunshop\YeePay\services\YeePayService(); break; case self::HIGH_LIGHT: if (!app('plugins')->isEnabled('high-light') || !\Yunshop\HighLight\services\SetService::getStatus()) { throw new AppException('商城未开启高灯提现插件'); } $className = new \Yunshop\HighLight\services\HighLightService(); break; case self::STORE_BALANCE_PAY: if (!app('plugins')->isEnabled('store-balance') || \Setting::get('plugin.store_balance.is_open') != 1) { throw new AppException('商城未开启门店余额插件'); } $className = new StoreBalancePay(); break; case self::WECHAT_MICRO_PAY: $className = new \app\common\services\payment\WechatPayCodePay(); break; case self::XFPAY_ALIPAY: if (!app('plugins')->isEnabled('xfpay') && \Setting::get( 'plugin.xfpay_set.xfpay.pay_type.alipay.enabled' ) == 0) { throw new AppException('商城未开启商云客聚合支付 或 插件中支付宝支付'); } $className = new \Yunshop\Xfpay\services\AlipayService; break; case self::XFPAY_WECHAT: if (!app('plugins')->isEnabled('xfpay') && \Setting::get( 'plugin.xfpay_set.xfpay.pay_type.wechat.enabled' ) == 0) { throw new AppException('商城未开启商云客聚合支付 或 插件中微信支付'); } $className = new \Yunshop\Xfpay\services\WechatService; break; case self::SANDPAY_ALIPAY: if (!app('plugins')->isEnabled('sandpay') && \Setting::get( 'sandpay.set.plugin_enable' ) && \Setting::get('sandpay.set.alipay.enable') == 0) { throw new AppException('杉德支付插件未开启 或 插件中微信支付未开启'); } $className = new \Yunshop\Sandpay\services\Alipay; break; case self::SANDPAY_WECHAT: if (!app('plugins')->isEnabled('sandpay') && \Setting::get( 'sandpay.set.plugin_enable' ) && \Setting::get('sandpay.set.wechat.enable') == 0) { throw new AppException('杉德支付插件未开启 或 插件中支付宝支付未开启'); } $className = new \Yunshop\Sandpay\services\WechatPay; break; case self::LAKALA_ALIPAY: if (!app('plugins')->isEnabled('lakala_pay') && \Setting::get( 'lakala_pay.set.plugin_enable' ) && \Setting::get('lakala_pay.set.alipay_enable') == 0) { throw new AppException('拉卡拉支付插件未开启 或 插件中支付宝支付未开启'); } $className = new \Yunshop\LaKaLaPay\services\Alipay; break; case self::LAKALA_WECHAT: if (!app('plugins')->isEnabled('lakala_pay') && \Setting::get( 'lakala_pay.set.plugin_enable' ) && \Setting::get('lakala_pay.set.wechat_enable') == 0) { throw new AppException('拉卡拉支付插件未开启 或 插件中微信支付未开启'); } $className = new \Yunshop\LaKaLaPay\services\WechatPay; break; case self::LESHUA_ALIPAY: if (!app('plugins')->isEnabled('leshua-pay') && \Setting::get( 'leshua-pay.set.plugin_enable' ) && \Setting::get('leshua-pay.set.alipay_enable') == 0) { throw new AppException('乐刷聚合支付插件未开启 或 插件中支付宝支付未开启'); } $className = new \Yunshop\LeshuaPay\services\Alipay; break; case self::LESHUA_WECHAT: if (!app('plugins')->isEnabled('leshua-pay') && \Setting::get( 'leshua-pay.set.plugin_enable' ) && \Setting::get('leshua-pay.set.wechat_enable') == 0) { throw new AppException('乐刷聚合支付插件未开启 或 插件中微信支付未开启'); } $className = new \Yunshop\LeshuaPay\services\WechatPay; break; case self::LESHUA_POS: if (!app('plugins')->isEnabled('leshua-pay') && \Setting::get( 'leshua-pay.set.plugin_enable' ) && \Setting::get('leshua-pay.set.pos_enable') == 0) { throw new AppException('乐刷聚合支付插件未开启 或 插件中商户扫码收款未开启'); } $className = new \Yunshop\LeshuaPay\services\PosPay; break; case self::WECHAT_TRADE_PAY: $className = new \app\common\services\WechatTradePay; break; case self::LSP_PAY: if (!app('plugins')->isEnabled('love-speed-pool')) { throw new AppException('商城未开启加速池插件'); } $className = new LSPPay(); break; case self::WORK_WITHDRAW_PAY: if (!app('plugins')->isEnabled( 'worker-withdraw' ) || !\Yunshop\WorkerWithdraw\services\SettingService::usable()) { throw new AppException('商城未开启好灵工插件'); } $className = new \Yunshop\WorkerWithdraw\services\WorkWithdrawService(); break; case self::CONVERGE_UNION_PAY: if (!app('plugins')->isEnabled('converge_pay') && \Setting::get( 'plugin.convergePay_set.converge_union_pay' ) != 1) { throw new AppException('商城未开启汇聚支付插件中汇聚云闪付支付'); } $className = new \Yunshop\ConvergePay\services\UnionPayService(); break; case self::CONVERGE_WECHAT_CARD_PAY: if (!app('plugins')->isEnabled('converge_pay') || !\Setting::get( 'plugin.convergePay_set.converge_pay_status' ) || !\Setting::get('plugin.convergePay_set.wechat.wechat_status') || !\Setting::get( 'plugin.convergePay_set.wechat.wechat_card_status' )) { throw new AppException('商城未开启汇聚支付插件中微信支付'); } $className = new \Yunshop\ConvergePay\services\WechatService(); break; case self::CONVERGE_ALIPAY_CARD_PAY: if (!app('plugins')->isEnabled('converge_pay') || !\Setting::get( 'plugin.convergePay_set.converge_pay_status' ) || !\Setting::get('plugin.convergePay_set.alipay.alipay_status') || !\Setting::get( 'plugin.convergePay_set.alipay.alipay_card_status' )) { throw new AppException('商城未开启汇聚支付插件中支付宝支付'); } $className = new \Yunshop\ConvergePay\services\AlipayService(); break; case self::CONVERGE_ALIPAY_H5_PAY: if (!app('plugins')->isEnabled('converge_pay') && \Setting::get( 'plugin.convergePay_set.converge_pay_status' ) != 1) { throw new AppException('商城未开启汇聚支付插件中汇聚云闪付支付'); } $className = new \Yunshop\ConvergePay\services\AlipayH5Service(); break; case self::SILVER_POINT_ALIPAY: if (!app('plugins')->isEnabled('silver-point-pay') && \Setting::get( 'silver-point-pay.set.plugin_enable' ) && \Setting::get('silver-point-pay.set.alipay_enable') == 0) { throw new AppException('银典支付插件未开启 或 插件中支付宝支付未开启'); } $className = new \Yunshop\SilverPointPay\services\Alipay(); break; case self::SILVER_POINT_WECHAT: if (!app('plugins')->isEnabled('silver-point-pay') && \Setting::get( 'silver-point-pay.set.plugin_enable' ) && \Setting::get('silver-point-pay.set.wechat_enable') == 0) { throw new AppException('银典支付插件未开启 或 插件中微信支付未开启'); } $className = new \Yunshop\SilverPointPay\services\WechatPay(); break; case self::SILVER_POINT_UNION: if (!app('plugins')->isEnabled('silver-point-pay') && \Setting::get( 'silver-point-pay.set.plugin_enable' ) && \Setting::get('silver-point-pay.set.union_enable') == 0) { throw new AppException('银典支付插件未开启 或 插件中银联快捷支付未开启'); } $className = new \Yunshop\SilverPointPay\services\UnionPay(); break; case self::CODE_SCIENCE_PAY_YU: if (!app('plugins')->isEnabled('code-science-pay') && \Setting::get( 'code-science-pay.set.plugin_enable' )) { throw new AppException('豫章行代金券支付插件未开启'); } $className = new \Yunshop\CodeSciencePay\services\YzxApp(); break; case self::EPLUS_WECHAT_PAY: if (!app('plugins')->isEnabled('eplus-pay') || !\Yunshop\EplusPay\services\SettingService::usable( 'wechat' )) { throw new AppException('智E+支付插件未开启'); } $className = new \Yunshop\EplusPay\services\EplusPay(); break; case self::EPLUS_MINI_PAY: if (!app('plugins')->isEnabled('eplus-pay') || !\Yunshop\EplusPay\services\SettingService::usable( 'mini' )) { throw new AppException('智E+支付插件未开启'); } $className = new \Yunshop\EplusPay\services\EplusPay(); break; case self::EPLUS_ALI_PAY: if (!app('plugins')->isEnabled('eplus-pay') || !\Yunshop\EplusPay\services\SettingService::usable( 'alipay' )) { throw new AppException('智E+支付插件未开启'); } $className = new \Yunshop\EplusPay\services\EplusPay(); break; case self::LSP_WALLET_PAY: if (!app('plugins')->isEnabled('love-speed-pool')) { throw new AppException('加速池未开启插件'); } $className = new \Yunshop\LoveSpeedPool\service\LSPWalletPay(); break; case self::JINEPAY: if (!app('plugins')->isEnabled('jinepay')) { throw new AppException('锦银E付未开启'); } $className = new \Yunshop\Jinepay\services\MobilePay(); break; case self::SILVER_POINT_PAYMENT: if (!app('plugins')->isEnabled('silver-point-pay')) { throw new AppException('银典支付未开启'); } $className = new \Yunshop\SilverPointPay\services\SilverPointPayment(); break; case self::AUTH_PAY: if (!app('plugins')->isEnabled('sub-auth-payment') || !\Setting::get( 'sub-auth-payment.set.plugin_enable' )) { throw new AppException('微信借权支付未开启'); } $className = new \Yunshop\SubAuthPayment\services\AuthPay(); break; case self::THIRD_PARTY_MINI_PAY: if (!app('plugins')->isEnabled('freelogin') || !\Setting::get( 'plugin.freelogin_set.status' )) { throw new AppException('APP免登录未开启'); } $className = new \Yunshop\Freelogin\common\service\ThirdPartyWechatPay(); break; default: $className = null; } \Log::debug('--------payFactory---------$className', print_r(get_class($className), 1)); return $className; } public static function pay($type, $data) { $pay = self::create($type); if ($type == self::PAY_CLOUD_ALIPAY) { $data['extra']['pay'] = 'cloud_alipay'; } $result = $pay->doPay($data, $type); switch ($type) { case self::PAY_WEACHAT: case self::PAY_CREDIT: if (is_bool($result)) { $result = (array)$result; } $trade = \Setting::get('shop.trade'); $redirect = ''; if (!is_null($trade) && isset($trade['redirect_url']) && !empty($trade['redirect_url'])) { $redirect = $trade['redirect_url']; } $result['redirect'] = $redirect; } return $result; } }