public function trackPackage($id) { $track = ShippingLabel::where('cart_id', $id)->first(); $check = \EasyPost\Tracker::retrieve($track->easypost_tracking); if ($check->status == 'delivered') { Shipping::where('cart_id', $id)->update(['shipped_status' => 'DELIVERED', 'tracking_number' => $check->updated_at]); return redirect()->route('salesmanager.index'); } Shipping::where('cart_id', $id)->update(['shipped_status' => 'SHIPPED', 'tracking_number' => $check->tracking_code]); return view('shipping.status', compact('check')); }
public function parseShipping() { $total = number_format(\Session::get('checkoutAmt') / 100, 2); $shipping = \App\Shipping::where('cart_id', \Session::get('cart_id'))->first(); $messageitems = []; $messageitems[] = ['title' => "\n"]; $messageitems[] = ['title' => "Ship To:"]; $messageitems[] = ['title' => "{$shipping->ship_f_name} {$shipping->ship_l_name}"]; $messageitems[] = ['title' => "{$shipping->ship_address1} {$shipping->ship_address2}"]; $messageitems[] = ['title' => "{$shipping->ship_city} {$shipping->ship_state} {$shipping->ship_zip}"]; $shippingmessage = ['fallback' => 'It is all broken, man', 'pretext' => "Total: \${$total}", 'color' => 'good', 'fields' => $messageitems]; return $shippingmessage; }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { // \App\Cart::where('customer_id', 'ChWvZc3Mm6GtY7EJCvKnr4XZqllJQZ8w033KRTVEUKOYj1kCR7')->get() // \Mail::send('emails.Newsale', array('cart' => $cart_id, 'customer' => \App\Shipping::where('cart_id', $cart_id)->first()), function($message){ // $checkoutAmt = \Session::get('checkoutAmt'); // $message->to(\App\Shipping::where('cart_id', \Session::get('cart_id'))->pluck('email'))->subject("Your Eternally Nocturnal Order"); // }); \Mail::send('emails.productshipped', array('cart' => \App\Cart::where('customer_id', 'AnVUUCPqtts5zelVNJS9i7hvs3YC4eju4ps5ydTP40SP3pbd23')->get(), 'customer' => \App\Shipping::where('id', 13)->first()), function ($message) { $message->to('*****@*****.**')->subject("Your Eternally Nocturnal Order"); }); return 'success'; // return $ship->buildLabel(); }
public function getShippingAddress() { return \App\Shipping::where('cart_id', $this->cart_id)->first(); }
public function makeCCPayment() { $customer = \App\Shipping::where('cart_id', \Session::get('cart_id'))->first(); return view('carts.payment', compact('customer')); }
public function completePayment(Request $request, SlackHandler $slacker) { // Set your secret key: remember to change this to your live secret key in production // See your keys here https://dashboard.stripe.com/account/apikeys Stripe::setApiKey(env('STRIPE_SK')); // Get the credit card details submitted by the form $token = $request->input('stripeToken'); // dd(\Session::get('cart_id')); if (!\Session::get('cart_id')) { return redirect()->route('alreadyPaid'); } if (\App\Shipping::where('cart_id', \Session::get('cart_id'))->pluck('payment_status') == 'Paid') { return redirect()->route('alreadyPaid'); } // $charge = 0; // $cart->checkoutPrice() // Create the charge on Stripe's servers - this will charge the user's card try { $charge = Charge::create(array("amount" => round($this->getCheckoutPrice()), "currency" => "usd", "source" => $token, "description" => \Session::get('cart_id'))); } catch (\Stripe\Error\Card $e) { // The card has been declined } $cart_id = \Session::get('cart_id'); $markPaid = \App\Shipping::where('cart_id', \Session::get('cart_id'))->first(); $markPaid->payment_status = 'Paid'; $markPaid->shipped_status = 'Not Shipped'; $markPaid->save(); $slacker->sendSaleMessage(); \App\Sale::create(array('customer_id' => $markPaid->email, 'cart_id' => \Session::get('cart_id'))); $purge = []; foreach (\App\Cart::where('customer_id', $cart_id)->get() as $purgeCarts) { $purge[] = $purgeCarts; $inventory = \App\Inventory::where('product_id', $purgeCarts->product_id)->pluck($purgeCarts->size); $newsize = $inventory - $purgeCarts->quantity; \DB::table('inventories')->where('product_id', $purgeCarts->product_id)->update(array($purgeCarts->size => $newsize)); } if (env('APP_ENV') == 'local') { \Mail::send('emails.productshipped', array('cart' => \App\Cart::where('customer_id', $cart_id)->get(), 'customer' => \App\Shipping::where('cart_id', $cart_id)->first()), function ($message) { $message->to(\App\Shipping::where('cart_id', \Session::get('cart_id'))->pluck('email'))->subject("Your Eternally Nocturnal Order"); }); } else { \Mail::send('emails.productshipped', array('cart' => \App\Cart::where('customer_id', $cart_id)->get(), 'customer' => \App\Shipping::where('cart_id', $cart_id)->first()), function ($message) { $message->to(\App\Shipping::where('cart_id', \Session::get('cart_id'))->pluck('email'))->subject("Your Eternally Nocturnal Order"); }); } \Session::forget('cart_id'); \Session::forget('checkoutAmt'); return redirect()->route('transSuccess'); }