예제 #1
0
 public function store2(Request $request)
 {
     $payment = new payment();
     $payment->payMethod = Input::get('payment');
     $payment->save();
     $data = $request->session()->get('items');
     return view('pages.checkout4', compact('data'));
 }
예제 #2
0
 private function saveOrder($result)
 {
     $payment = new Payments();
     $payment['payment_id'] = $result->id;
     $payment['state'] = $result->state;
     $payment['intent'] = $result->intent;
     $payment['cart'] = $result->cart;
     $payment['user_id'] = Auth::user()->id;
     $payment->save();
     $payer = new Payers();
     $payer['payer_id'] = $result->payer->payer_info->payer_id;
     $payer['payment_id'] = $result->id;
     $payer['email'] = $result->payer->payer_info->email;
     $payer['first_name'] = $result->payer->payer_info->first_name;
     $payer['last_name'] = $result->payer->payer_info->last_name;
     $payer['recipient_name'] = $result->payer->payer_info->shipping_address->recipient_name;
     $payer['line1'] = $result->payer->payer_info->shipping_address->line1;
     $payer['city'] = $result->payer->payer_info->shipping_address->city;
     $payer['state'] = $result->payer->payer_info->shipping_address->state;
     $payer['postal_code'] = $result->payer->payer_info->shipping_address->postal_code;
     $payer['phone'] = $result->payer->payer_info->phone;
     $payer->save();
     foreach ($result->transactions[0]->item_list->items as $item) {
         $transaction = new Transactions();
         $transaction['payment_id'] = $result->id;
         $transaction['book_id'] = $item->sku;
         $transaction['price'] = $item->price;
         $transaction['currency'] = $item->currency;
         $transaction['quantity'] = $item->quantity;
         $transaction['description'] = $item->description;
         $transaction->save();
         $book = Book::find($item->sku);
         $book['active'] = 0;
         $book->save();
     }
 }