Demo entry 6508400

java method

   

Submitted by tangoRainbow on May 30, 2017 at 21:40
Language: Java. Code size: 641 Bytes.

    @Override
    public Order createOrder(ShippingInformation shippingInformation) {
        Customer customer = sessionManager.getCustomer();
        Order order = orderManager.createOrder(customer.getCart().getItems(), shippingInformation);

        // if the customer is a registered customer, add the order to orderhistory
        if (customer instanceof RegisteredCustomer) {
            RegisteredCustomer registeredCustomer = (RegisteredCustomer) customer;
            registeredCustomer.getOrders().add(order);
            accountManager.updateOrderHistory(registeredCustomer, order);
        }
        return order;
   

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).