public function confirm(Request $request) { $cart = $this->cartRepository->getCart(['cartItems.product']); $order = Order::find($request->get('id')); $gateway = \Omnipay::gateway('paypal'); $settings = $gateway->getDefaultParameters(); //dd($settings); $desc = ''; foreach ($cart->cartItems as $item) { $desc .= "> " . $item->product->title . "\r\n"; } $card = \Omnipay::creditCard($order->toArray()); $response = \Omnipay::purchase(['currency' => 'GBP', 'amount' => $order->total, 'returnUrl' => 'http://google.co.uk', 'cancelUrl' => 'http://google.co.uk', 'description' => $desc, 'transactionId' => $order->id, 'card' => $card])->send(); //dd($response); // $purchaseRequest = $this->omnipay->purchase($data); // // // Grab the parameters // $purchaseParameters = $purchaseRequest->getData(); // // // Add our additional parameters // $purchaseParameters['MC_paymentType'] = 'payment'; // // // Send off the request // $response = $purchaseRequest->sendData($purchaseParameters); // Check we got a redirect response if ($response->isRedirect()) { // If so redirect the user $response->redirect(); } else { // Broken data dd($response); throw new Exception(); } }
function doPaymnet() { $amount = 0; $return_url = ''; $cardInput = array('number' => Input::get('cc_number'), 'firstName' => Input::get('firstName'), 'lastName' => Input::get('lastName'), 'expiryMonth' => Input::get('expiryMonth'), 'expiryYear' => Input::get('expiryYear'), 'cvv' => Input::get('cvv')); $card = Omnipay::creditCard($cardInput); $response = Omnipay::purchase(['amount' => $amount, 'returnUrl' => $return_url, 'cancelUrl' => $cancel_url, 'card' => $cardInput]); }
|-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ Route::get('/', 'WelcomeController@index'); Route::get('home', 'HomeController@index'); Route::get('test', function () { //进行第三方支付网站跳转 \Omnipay::setGateway('Alipay_Bank'); $options = array('out_trade_no' => '2014010122390002', 'subject' => 'test', 'total_fee' => 0.03, 'price' => '0.01', 'quantity' => '2', 'defaultBank' => 'CCB'); $response = \Omnipay::purchase($options)->send(); //request->response $response->redirect(); //$redirectData = $response->getRedirectData(); //dd($redirectData); /** *正则匹配工具类测试 $regexTool = new \App\Repositories\RegexTool(); dump($regexTool->isEmail('*****@*****.**')); */ }); Route::get('/test2', function () { DB::listen(function ($sql, $bindings, $time) { dump($sql); }); $data = \App\Model\Tag::find(68262);