function it_adds_shipping_payment_and_addressing_info_to_an_order(AddressInterface $address, Collection $shipmentCollection, OrderInterface $order, OrderShipmentProcessorInterface $orderShipmentFactory, PaymentFactoryInterface $paymentFactory, PaymentInterface $payment, PaymentMethodInterface $paymentMethod, SharedStorageInterface $sharedStorage, ShipmentInterface $shipment, ShippingMethodInterface $shippingMethod, ObjectManager $objectManager)
 {
     $sharedStorage->get('order')->willReturn($order);
     $order->getCurrency()->willReturn('EUR');
     $order->getTotal()->willReturn(1234);
     $order->getShipments()->willReturn($shipmentCollection);
     $shipmentCollection->first()->willReturn($shipment);
     $paymentFactory->createWithAmountAndCurrency(1234, 'EUR')->willReturn($payment);
     $order->setBillingAddress($address)->shouldBeCalled();
     $order->setShippingAddress($address)->shouldBeCalled();
     $order->addPayment($payment)->shouldBeCalled();
     $payment->setMethod($paymentMethod)->shouldBeCalled();
     $shipment->setMethod($shippingMethod)->shouldBeCalled();
     $orderShipmentFactory->processOrderShipment($order)->shouldBeCalled();
     $objectManager->flush()->shouldBeCalled();
     $this->theCustomerChoseShippingToWithPayment($shippingMethod, $address, $paymentMethod);
 }
Beispiel #2
0
 /**
  * @Given /^the customer chose ("[^"]+" shipping method) with ("[^"]+" payment)$/
  */
 public function theCustomerChoseShippingWithPayment(ShippingMethodInterface $shippingMethod, PaymentMethodInterface $paymentMethod)
 {
     /** @var OrderInterface $order */
     $order = $this->sharedStorage->get('order');
     $this->orderShipmentFactory->processOrderShipment($order);
     $order->getShipments()->first()->setMethod($shippingMethod);
     $this->orderRecalculator->recalculate($order);
     $payment = $this->paymentFactory->createWithAmountAndCurrencyCode($order->getTotal(), $order->getCurrencyCode());
     $payment->setMethod($paymentMethod);
     $order->addPayment($payment);
     $this->objectManager->flush();
 }
Beispiel #3
0
 /**
  * @Given /^the customer chose ("[^"]+" shipping method) with ("[^"]+" payment)$/
  * @Given /^I chose ("[^"]+" shipping method) with ("[^"]+" payment)$/
  */
 public function theCustomerChoseShippingWithPayment(ShippingMethodInterface $shippingMethod, PaymentMethodInterface $paymentMethod)
 {
     /** @var OrderInterface $order */
     $order = $this->sharedStorage->get('order');
     $this->orderShipmentFactory->processOrderShipment($order);
     $order->getShipments()->first()->setMethod($shippingMethod);
     $this->applyTransitionOnOrderCheckout($order, OrderCheckoutTransitions::TRANSITION_SELECT_SHIPPING);
     $payment = $order->getLastPayment();
     $payment->setMethod($paymentMethod);
     $this->applyTransitionOnOrderCheckout($order, OrderCheckoutTransitions::TRANSITION_SELECT_PAYMENT);
     $this->applyTransitionOnOrderCheckout($order, OrderCheckoutTransitions::TRANSITION_COMPLETE);
     $this->objectManager->flush();
 }
 /**
  * @param GenericEvent $event
  */
 public function processOrderShipments(GenericEvent $event)
 {
     $this->orderShipmentProcessor->processOrderShipment($this->getOrder($event));
 }
 function it_calls_shipping_processor_on_order(OrderShipmentProcessorInterface $orderShipmentProcessor, GenericEvent $event, OrderInterface $order)
 {
     $event->getSubject()->willReturn($order);
     $orderShipmentProcessor->processOrderShipment($order)->shouldBeCalled();
     $this->processOrderShipments($event);
 }
 function it_runs_order_shipment_processor_and_payment_processor_to_control_order_shipments_and_payments(OrderInterface $order, OrderShipmentProcessorInterface $orderShipmentProcessor, PaymentProcessorInterface $paymentProcessor)
 {
     $orderShipmentProcessor->processOrderShipment($order)->shouldBeCalled();
     $paymentProcessor->processOrderPayments($order)->shouldBeCalled();
     $this->process($order);
 }
Beispiel #7
0
 /**
  * {@inheritdoc}
  */
 public function process(OrderInterface $order)
 {
     $this->orderShipmentProcessor->processOrderShipment($order);
     $this->paymentProcessor->processOrderPayments($order);
 }