예제 #1
0
 /**
  * @param Order $order
  *
  * @throws \InvalidArgumentException
  */
 private function trackOrder(Order $order)
 {
     Analytics::enableEcommerceTracking();
     Analytics::ecommerceAddTransaction($order->publicId(), config('app.name'), $order->totalPrice()->asFloat(), 0.0, 0.0);
     $order->orderItems->each(function (OrderItem $item) {
         Analytics::ecommerceAddItem($item->id, $item->name(), $item->sku(), $item->category()->name, $item->priceAsFloat(), 1);
     });
 }
예제 #2
0
 /**
  * @throws \InvalidArgumentException
  *
  * @return TelegramMessage
  */
 public function toTelegram()
 {
     $env = App::environment();
     return TelegramMessage::create()->content(sprintf("%s\n%s", "New Order in *{$env}* {$this->order->publicId()}", "Total {$this->order->totalPrice()->formatted()}"))->button("View new order #{$this->order->publicId()}", route('orders.show', [$this->order]));
 }