public function getThankyou(Request $request) { $data = $request->all(); /* if(isset($data['paymentId'])){ $shopping_cart = $this->cart->getByPaypalPaymentId($data['paymentId']); if($shopping_cart){ $customer = $this->customer->getById($shopping_cart->customer_id); $this->dispatch(new CreateOrderFromCart($customer, $shopping_cart, $shopping_cart->remarks, $this->order, $this->cart)); } } */ $payment_kind_id = config('shop.default_payment_kind_id'); if (isset($data['payment_kind_id'])) { if (isset(config('shop.payment_kind_slugs')[intval($data['payment_kind_id'])])) { $payment_kind_id = intval($data['payment_kind_id']); } } $payment_kind = config('shop.payment_kind_slugs')[$payment_kind_id]; return view('website.feedback.thankyou')->with(['bodyClass' => 'feedback', 'browserTitle' => trans('shop.thank_you_for_your_order'), 'pageContent' => markdown_settings('thank_you_text_' . $payment_kind)]); }
public function getThankyou(Request $request) { $data = $request->all(); session()->forget('cart.token'); if (isset($data['paymentId']) && isset($data['PayerID'])) { $payment = Payment::get($data['paymentId'], $this->_api_context); $execution = new PaymentExecution(); $execution->setPayerId($data['PayerID']); $result = $payment->execute($execution, $this->_api_context); } return view('website.feedback.thankyou')->with(['bodyClass' => 'feedback', 'browserTitle' => trans('shop.thank_you_for_your_order'), 'pageContent' => markdown_settings('thank_you_text_paypal')]); }
public function handle(MandrillMail $mailer, OrderRepository $repository, CountryRepository $country) { $payment_kind_slugs = config('shop.payment_kind_slugs'); $payment_kind_slug = $payment_kind_slugs[$this->order->payment_kind_id]; $countries = $country->getList(); $template = email_template('order_confirmation', config('app.locale')); $subject = str_replace('{order-number}', $this->order->order_number, $template['subject']); $body = markdown_text($template['body']); $body = str_replace('{name}', $this->order->invoice_first_name . ' ' . $this->order->invoice_last_name, $body); $body = str_replace('{order-number}', $this->order->order_number, $body); $order_details = ''; $total = 0; if ($this->order->order_products) { foreach ($this->order->order_products as $order_product) { $complete_price = $order_product->quantity * $order_product->price_brut; $total += $complete_price; $order_details .= $order_product->quantity . " x " . $order_product->product_collection . " // " . $order_product->product_variant . " // " . $order_product->product_color . "\r" . trans('order.single_price') . ": " . convert_from_cents($order_product->price_brut) . " € // " . trans("shop.complete_price") . ": " . convert_from_cents($complete_price) . " €<hr>"; } } $order_details .= trans('shop.price_sum') . ": " . convert_from_cents($total) . " €<hr>"; $order_details .= trans('shop.shipping_costs') . ": " . convert_from_cents(config('shop.default_shipping_cost')) . " €<hr>"; $order_details .= "<strong>" . trans('shop.total') . ": " . convert_from_cents(config('shop.default_shipping_cost') + $total) . " €</strong><hr><br><br>"; $order_details .= trans('checkout.remarks') . ":<br>" . nl2br($this->order->remarks) . "<br><br>"; if ($this->mode == 'self') { if ($this->order->paypal_transaction_id) { $order_details .= $this->order->paypal_transaction_id . "<br>"; } if ($this->order->stripe_token_id) { $order_details .= $this->order->stripe_token_id . "<br>"; } } $order_details .= trans('order.order_number') . ": " . $this->order->order_number . "<br>"; $order_details .= trans('shop.payment_kind') . ": " . $this->order->payment_kind->name . "<br><br>"; $body .= $order_details; $email_description = str_replace('{total}', convert_from_cents(config('shop.default_shipping_cost') + $total) . ' €', $this->order->payment_kind->email_description); $email_description = str_replace('{order-number}', $this->order->order_number, $email_description); $payment_details = $email_description . "<br><br>"; if ($payment_kind_slug == 'prepayment') { $payment_details .= markdown_settings('bank_account') . "<br><br>"; } $body .= $payment_details; $account_details = trans('shop.invoice_address') . ":<br>" . $this->order->invoice_first_name . " " . $this->order->invoice_last_name . "<br>"; $account_details .= $this->order->invoice_street . "<br>" . $this->order->invoice_zip . " " . $this->order->invoice_city . "<br>"; $account_details .= $countries[$this->order->invoice_country_id] . "<br><br>"; $account_details .= trans('shop.shipping_address') . ":<br>" . $this->order->shipping_first_name . " " . $this->order->shipping_last_name . "<br>"; $account_details .= $this->order->shipping_street . "<br>" . $this->order->shipping_zip . " " . $this->order->shipping_city . "<br>"; $account_details .= $countries[$this->order->shipping_country_id] . "<br><br>"; $body .= $account_details; if ($this->mode != 'self') { $legal = ""; $legal .= "<br><br><div class='small'><em>" . trans('order.right_of_withdrawal_note') . "</em><br>"; $legal .= markdown_settings('right_of_withdrawal'); $legal .= "<br><em>" . trans('order.end_of_right_of_withdrawal_note') . "</em></div><br><br>"; $body .= $legal; /* $terms = ""; $terms .= "<br><br><div class='small'>"; $terms .= markdown_settings('terms'); $terms .= "</div><br><br>"; $body .= $terms; */ } $html_content = $body; $to_emails = [$this->order->invoice_email]; if ($this->mode == 'self') { $to_emails = explode(',', settings('order_email_addresses')); } foreach ($to_emails as $to_email) { $message = ['subject' => $subject, 'inline_css' => true, 'merge' => true, 'merge_language' => 'handlebars', 'preserve_recipients' => false, 'global_merge_vars' => array(['name' => 'maincontent', 'content' => $html_content])]; $message['to'] = [['email' => $to_email, 'type' => 'to']]; $mandrill_responses = MandrillMail::messages()->sendTemplate('order-confirmation', '', $message); } }