From f54c82dcf9bc179a04dec63c124c0718ee0371e0 Mon Sep 17 00:00:00 2001 From: tokumeikoi Date: Sun, 16 May 2021 03:11:24 +0900 Subject: [PATCH] remove: old code --- app/Http/Controllers/User/OrderController.php | 153 ------------------ 1 file changed, 153 deletions(-) diff --git a/app/Http/Controllers/User/OrderController.php b/app/Http/Controllers/User/OrderController.php index e5d1f8ed..b9cf7cb7 100755 --- a/app/Http/Controllers/User/OrderController.php +++ b/app/Http/Controllers/User/OrderController.php @@ -243,157 +243,4 @@ class OrderController extends Controller 'data' => true ]); } - - private function alipayF2F($tradeNo, $totalAmount) - { - $gateway = Omnipay::create('Alipay_AopF2F'); - $gateway->setSignType('RSA2'); //RSA/RSA2 - $gateway->setAppId(config('v2board.alipay_appid')); - $gateway->setPrivateKey(config('v2board.alipay_privkey')); // 可以是路径,也可以是密钥内容 - $gateway->setAlipayPublicKey(config('v2board.alipay_pubkey')); // 可以是路径,也可以是密钥内容 - $gateway->setNotifyUrl(url('/api/v1/guest/order/alipayNotify')); - $request = $gateway->purchase(); - $request->setBizContent([ - 'subject' => config('v2board.app_name', 'V2Board') . ' - 订阅', - 'out_trade_no' => $tradeNo, - 'total_amount' => $totalAmount / 100 - ]); - /** @var \Omnipay\Alipay\Responses\AopTradePreCreateResponse $response */ - $response = $request->send(); - $result = $response->getAlipayResponse(); - if ($result['code'] !== '10000') { - abort(500, $result['sub_msg']); - } - // 获取收款二维码内容 - return $response->getQrCode(); - } - - private function stripeAlipay($order) - { - $currency = config('v2board.stripe_currency', 'hkd'); - $exchange = Helper::exchange('CNY', strtoupper($currency)); - if (!$exchange) { - abort(500, __('user.order.stripeAlipay.currency_convert_timeout')); - } - Stripe::setApiKey(config('v2board.stripe_sk_live')); - $source = Source::create([ - 'amount' => floor($order->total_amount * $exchange), - 'currency' => $currency, - 'type' => 'alipay', - 'statement_descriptor' => $order->trade_no, - 'metadata' => [ - 'user_id' => $order->user_id, - 'out_trade_no' => $order->trade_no, - 'identifier' => '' - ], - 'redirect' => [ - 'return_url' => config('v2board.app_url', env('APP_URL')) . '/#/order' - ] - ]); - if (!$source['redirect']['url']) { - abort(500, __('user.order.stripeAlipay.gateway_request_failed')); - } - return $source['redirect']['url']; - } - - private function stripeWepay($order) - { - $currency = config('v2board.stripe_currency', 'hkd'); - $exchange = Helper::exchange('CNY', strtoupper($currency)); - if (!$exchange) { - abort(500, __('user.order.stripeWepay.currency_convert_timeout')); - } - Stripe::setApiKey(config('v2board.stripe_sk_live')); - $source = Source::create([ - 'amount' => floor($order->total_amount * $exchange), - 'currency' => $currency, - 'type' => 'wechat', - 'metadata' => [ - 'user_id' => $order->user_id, - 'out_trade_no' => $order->trade_no, - 'identifier' => '' - ], - 'redirect' => [ - 'return_url' => config('v2board.app_url', env('APP_URL')) . '/#/order' - ] - ]); - if (!$source['wechat']['qr_code_url']) { - abort(500, __('user.order.stripeWepay.gateway_request_failed')); - } - return $source['wechat']['qr_code_url']; - } - - private function stripeCard($order, string $token) - { - $currency = config('v2board.stripe_currency', 'hkd'); - $exchange = Helper::exchange('CNY', strtoupper($currency)); - if (!$exchange) { - abort(500, __('user.order.stripeCard.currency_convert_timeout')); - } - Stripe::setApiKey(config('v2board.stripe_sk_live')); - try { - $charge = \Stripe\Charge::create([ - 'amount' => floor($order->total_amount * $exchange), - 'currency' => $currency, - 'source' => $token, - 'metadata' => [ - 'user_id' => $order->user_id, - 'out_trade_no' => $order->trade_no, - 'identifier' => '' - ] - ]); - } catch (\Exception $e) { - abort(500, __('user.order.stripeCard.was_problem')); - } - info($charge); - if (!$charge->paid) { - abort(500, __('user.order.stripeCard.deduction_failed')); - } - return $charge->paid; - } - - private function bitpayX($order) - { - $bitpayX = new BitpayX(config('v2board.bitpayx_appsecret')); - $params = [ - 'merchant_order_id' => $order->trade_no, - 'price_amount' => $order->total_amount / 100, - 'price_currency' => 'CNY', - 'title' => '支付单号:' . $order->trade_no, - 'description' => '充值:' . $order->total_amount / 100 . ' 元', - 'callback_url' => url('/api/v1/guest/order/bitpayXNotify'), - 'success_url' => config('v2board.app_url', env('APP_URL')) . '/#/order', - 'cancel_url' => config('v2board.app_url', env('APP_URL')) . '/#/order' - ]; - $strToSign = $bitpayX->prepareSignId($params['merchant_order_id']); - $params['token'] = $bitpayX->sign($strToSign); - $result = $bitpayX->mprequest($params); - // Log::info('bitpayXSubmit: ' . json_encode($result)); - return isset($result['payment_url']) ? $result['payment_url'] : false; - } - - private function mgate($order) - { - $mgate = new MGate(config('v2board.mgate_url'), config('v2board.mgate_app_id'), config('v2board.mgate_app_secret')); - $result = $mgate->pay([ - 'app_id' => config('v2board.mgate_app_id'), - 'out_trade_no' => $order->trade_no, - 'total_amount' => $order->total_amount, - 'notify_url' => url('/api/v1/guest/order/mgateNotify'), - 'return_url' => config('v2board.app_url', env('APP_URL')) . '/#/order' - ]); - return $result; - } - - private function epay($order) - { - $epay = new Epay(config('v2board.epay_url'), config('v2board.epay_pid'), config('v2board.epay_key')); - return $epay->pay([ - 'money' => $order->total_amount / 100, - 'name' => $order->trade_no, - 'notify_url' => url('/api/v1/guest/order/epayNotify'), - 'return_url' => config('v2board.app_url', env('APP_URL')) . '/#/order', - 'out_trade_no' => $order->trade_no - ]); - } }