public function generate(OrderInterface $order) { $pdf = new BaseDocument(); $pdf->AddPage(); $pdf->setAddress($order->getShippingAddress()); return $pdf->Output(null, 'S'); }
/** * {@inheritdoc} */ public function process(OrderInterface $order) { if ($order->getShippingState() === ShipmentInterface::STATE_SHIPPED && !$order->isTrackingMail()) { $this->trackingMailer->sendMail($order); $order->setTrackingMail(true); } }
public function process(OrderInterface $order) { $payment = $order->getPayment(); if ($payment->getMethod()->getGateway() === 'paypal_express_checkout') { $details = $payment->getDetails(); $details['PAYMENTREQUEST_0_AMT'] = (string) ($order->getTotal() / 100); $payment->setDetails($details); } }
protected function isTargetCountry(OrderInterface $order, $country) { $address = $order->getShippingAddress(); if ($address) { return $address && $address->getCountryCode() === $country; } else { return $this->countryResolver->resolveCode() === $country; } }
public function sendMail(OrderInterface $order) { $body = $this->render($this->template, ['order' => $order, 'translationDomain' => $this->translationDomain]); $message = $this->createMessage(); $message->addFrom($this->from); $message->setSubject($this->getTranslator()->trans($this->subject, [], $this->translationDomain)); $message->addTo($order->getCustomerEmail()); $message->setBody($body, 'text/html'); $this->send($message); }
public function transfer(OrderInterface $from, OrderInterface $to) { foreach ($from->getItems() as $item) { if ($item instanceof OrderItemInterface) { $product = $item->getProduct(); $quantity = $item->getQuantity(); if ($product) { $this->addItem($product, $quantity, $to); } } } }
private function getShippingAdjustment(OrderInterface $order) { /** @var AdjustmentInterface $adjustment */ foreach ($order->getAdjustments() as $adjustment) { if ($adjustment->getType() === \Sylius\Component\Core\Model\AdjustmentInterface::SHIPPING_ADJUSTMENT) { return $adjustment; } } $adjustment = $this->adjustmentFactory->createNew(); $adjustment->setType(\Sylius\Component\Core\Model\AdjustmentInterface::SHIPPING_ADJUSTMENT); $order->addAdjustment($adjustment); return $adjustment; }
public function provide(OrderInterface $order) { $user = $order->getUser(); $address = $order->getShippingAddress(); if ($user instanceof UserInterface) { if ($address === null) { /** @var AddressInterface $address */ $address = $this->addressFactory->createNew(); $order->setShippingAddress($address); } $lastOrder = $this->orderProvider->getLastOrder($user); if ($lastOrder !== null) { $lastOrderAddress = $this->orderProvider->getLastOrder($user)->getShippingAddress(); if ($lastOrderAddress) { $this->setAddress($address, $lastOrderAddress); } } } }
public function process(OrderInterface $order) { $order->setCheckoutState(OrderCheckoutStates::STATE_COMPLETED); $order->setShippingState(ShipmentInterface::STATE_PENDING); $order->setPaymentState(PaymentInterface::STATE_PENDING); $order->setState(OrderInterface::STATE_CONFIRMED); $order->setOrderedAt(new \DateTime()); $this->confirmMailer->sendMail($order); $this->cartProvider->abandonCart(); }
public function process(OrderInterface $order) { $order->setCheckoutState(OrderCheckoutStates::STATE_CART); $order->setUser($this->getUser()); if ($order->getNumber() === null) { $order->setNumber($this->generateNumber()); } if ($order->getToken() === null) { $order->setToken($this->tokenGenerator->generate(40)); } }
public function process(OrderInterface $order) { $order->setCheckoutState(OrderCheckoutStates::STATE_ADDRESSED); $this->orderShipmentProcessor->process($order); }
public function process(OrderInterface $order) { $order->setCheckoutState(OrderCheckoutStates::STATE_PAYMENT_SELECTED); $order->getPayment()->setCurrencyCode('EUR'); $order->getPayment()->setAmount($order->getTotal()); }
public function generateName(OrderInterface $order, $options = []) { return sprintf('billing-%s.pdf', $order->getNumber()); }
protected function configureAdjustmentAmount(AdjustmentInterface $adjustment, OrderInterface $subject, array $configuration) { $adjustment->setAmount(-$subject->getShippingTotal()); }