Interface OrderService

  • All Known Implementing Classes:
    OrderServiceImpl

    public interface OrderService
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean addAttachment​(java.lang.String orderId, Attachment attachment)
      Adds attachment to the last timeline.
      boolean addAttachment​(java.lang.String orderId, java.lang.String orderTimelineStep, Attachment attachment)
      Adds attachment to the last timeline.
      boolean approve​(java.lang.String orderId)
      Approves order.
      java.util.Map<java.lang.String,​java.lang.Object> calculateItemsTotalBruttoAmount​(java.lang.String orderId)
      Calculates total gross amount for order.
      java.util.Map<java.lang.String,​java.lang.Object> calculatePayoutAmount​(java.lang.String orderId)
      Calculates payout amount for order.
      java.util.Map<java.lang.String,​java.lang.Object> calculateServiceFeeBruttoAmount​(java.lang.String orderId)
      Calculates service fee for order.
      java.util.Map<java.lang.String,​java.lang.Object> calculateTaxAmountPrice​(java.lang.String orderId)
      Calculates tax amount for order.
      java.util.Map<java.lang.String,​java.lang.Object> calculateTotalPrice​(java.lang.String orderId)
      Sums prices of commerce items.
      boolean canAddAttachment​(java.lang.String orderId)
      Checks if current user can add an Attachment.
      boolean canCancel​(java.lang.String orderId)
      Checks if order is cancelable.
      boolean cancel​(java.lang.String orderId)
      Cancels an order.
      boolean canChangeStatus​(java.lang.String orderId)
      Checks if current user can change the status of given order.
      boolean changeAddress​(java.lang.String orderId, java.util.LinkedHashMap<java.lang.String,​java.lang.Object> params)
      Changes shipping address of the order.
      boolean changePaymentMethod​(java.lang.String orderId, java.util.LinkedHashMap<java.lang.String,​java.lang.String> pmParams)
      Changes payment method for the order's payment intent.
      boolean complete​(java.lang.String orderId)
      Complete order.
      Attachment createInvoiceBuyerToVendor​(java.lang.String orderId)
      This method make an invoice from buyer to vendor
      java.util.Optional<Order> createOrder​(Order order)
      This method creates a database entity.
      java.util.Optional<Order> createOrder​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> orderAsMap)
      This method creates a database entity.
      java.util.List<OrderDTO> createOrdersFromShoppingCart​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> params)
      Create list of orders from shopping cart.
      boolean deliver​(java.lang.String orderId)
      Deliver order.
      CommerceItemRepository getCommerceItemRepository()  
      java.lang.String getInvoiceTemplate​(java.lang.String orderId)
      This method makes the process of compiling the invoice template
      OrderTimeLineBean getLastOrderTimelineBean​(java.lang.String orderId)
      This method returns bean.
      OrderDTO getOrder​(java.lang.String orderId)
      Gets order by id.
      java.util.LinkedHashSet<OrderDTO> getOrders​(java.lang.String requestJson)
      This method does search requests and returns data as list.
      java.util.List<OrderDTO> getOrdersFromLoggedUser()
      Retrieves orders of current user.
      org.springframework.data.domain.Page<Order> getOrdersPaged​(java.lang.String requestJson)
      This method does search requests and returns data as pages.
      java.util.List<OrderTimeLineBean> getOrderTimeLine​(java.lang.String orderId)
      This method returns beans as list.
      java.util.Deque<java.util.Map<java.lang.String,​java.lang.Object>> getPaginationFilter​(java.lang.String requestJson)
      This method does calculation for a pages based on the request.
      OrderRepository getRepository()  
      java.util.Set<Address> getShippingAddresses()
      Get saved shipping addresses.
      boolean isUserParticipatesInOrder​(java.lang.String orderId, boolean asVendor)
      This method checks is database entity belong to other database entity.
      OrderDTO mapOrder​(Order order)
      Maps an Order object to an OrderDTO object.
      boolean mustAddAttachments​(java.lang.String orderId)
      Checks if attachments must be added on the current step but currently absent.
      java.lang.String obtain3DSecureLink​(java.lang.String orderId)
      Obtains a payment authorization link;
      java.util.List<OrderDTO> orderCheckout()
      Checkout the orders for the given shopping cart id.
      PaymentStatus pay​(java.lang.String orderId)
      Commits payment for the order.
      java.lang.String payout​(java.lang.String orderId)
      Commits payout.
      boolean prepareItemsToShipment​(java.util.List<CommerceItem> items)
      This method does reserve for the items which are paid already.
      boolean removeAttachment​(java.lang.String orderId, java.lang.String attachmentName)
      Removes attachment from the last timeline.
      boolean removeAttachment​(java.lang.String orderId, java.lang.String orderTimelineStep, java.lang.String attachmentName)
      Removes attachment from the last timeline.
      boolean removeCommerceItemFromOrder​(java.lang.String orderId, java.lang.String commerceItemId)
      This method removes relationship between database entities.
      void removeOrder​(java.lang.String orderId)
      This method removes database entities.
      void removeOrdersByIds​(java.util.ArrayList<java.lang.String> orderIds)
      This method removes a list of database entities.
      Order saveOrder​(Order order)
      This method saves a database entity.
      Order saveOrder​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> orderAsMap)
      This method save an updates of database entity.
      void sendOrderConfirmationEmail​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> emailData)
      Sends a success email for the order.
      boolean ship​(java.lang.String orderId)
      Ships order.
    • Method Detail

      • getPaginationFilter

        java.util.Deque<java.util.Map<java.lang.String,​java.lang.Object>> getPaginationFilter​(java.lang.String requestJson)
        This method does calculation for a pages based on the request.
        Parameters:
        requestJson - JSON-object of request contains an instructions for search queries
        Returns:
        map-representation of data
      • getOrders

        java.util.LinkedHashSet<OrderDTO> getOrders​(java.lang.String requestJson)
        This method does search requests and returns data as list.
        Parameters:
        requestJson - search request
        Returns:
        data transport entities as list
      • getOrdersPaged

        org.springframework.data.domain.Page<Order> getOrdersPaged​(java.lang.String requestJson)
        This method does search requests and returns data as pages.
        Parameters:
        requestJson - JSON-object of request contains an instructions for search queries
        Returns:
        database entities separated to pages
      • createOrder

        java.util.Optional<Order> createOrder​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> orderAsMap)
        This method creates a database entity.
        Parameters:
        orderAsMap - map-representation of database entity
        Returns:
        database entity
      • createOrder

        java.util.Optional<Order> createOrder​(Order order)
        This method creates a database entity.
        Parameters:
        order - map-representation of database entity
        Returns:
        database entity
      • saveOrder

        Order saveOrder​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> orderAsMap)
        This method save an updates of database entity.
        Parameters:
        orderAsMap - map-representation of database entity
        Returns:
        saved instance of database entity
      • saveOrder

        Order saveOrder​(Order order)
        This method saves a database entity.
        Parameters:
        order - database entity
        Returns:
        saved instance of database entity
      • getOrdersFromLoggedUser

        java.util.List<OrderDTO> getOrdersFromLoggedUser()
        Retrieves orders of current user.
        Returns:
        order
      • getOrder

        OrderDTO getOrder​(java.lang.String orderId)
        Gets order by id.
        Parameters:
        orderId - identification for filter and return data
        Returns:
        order DTO
      • getOrderTimeLine

        java.util.List<OrderTimeLineBean> getOrderTimeLine​(java.lang.String orderId)
        This method returns beans as list.
        Parameters:
        orderId - identification for database entity which related beans list be returned
        Returns:
        beans as list
      • createOrdersFromShoppingCart

        java.util.List<OrderDTO> createOrdersFromShoppingCart​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> params)
        Create list of orders from shopping cart. Orders include CommerceItem-s grouped by Seller. So for items CommerceItem1 (with Seller1), CommerceItem2 (with Seller1) and CommerceItem3 (with Seller2) will be created 2 Orders - with [CommerceItem1, CommerceItem2] and [CommerceItem3] respectively.
        Parameters:
        params - params, including key-values: shippingAddress - id or Address fields as a map paymentMethod - id or PaymentMethod fields as a map
        Returns:
        list of Order DTOs
      • orderCheckout

        java.util.List<OrderDTO> orderCheckout()
        Checkout the orders for the given shopping cart id.
        Returns:
        the list of OrderDTOs representing the checked out orders
      • sendOrderConfirmationEmail

        void sendOrderConfirmationEmail​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> emailData)
        Sends a success email for the order.

        This method sends a success email for the order specified by the given email message.

        Parameters:
        emailData - the email message object containing the details of the success email
      • removeOrder

        void removeOrder​(java.lang.String orderId)
        This method removes database entities.
        Parameters:
        orderId - identification for database entity which will be removed
      • removeOrdersByIds

        void removeOrdersByIds​(java.util.ArrayList<java.lang.String> orderIds)
        This method removes a list of database entities.
        Parameters:
        orderIds - the list of database entities which will be removed
      • removeCommerceItemFromOrder

        boolean removeCommerceItemFromOrder​(java.lang.String orderId,
                                            java.lang.String commerceItemId)
        This method removes relationship between database entities.
        Parameters:
        orderId - identification for database entity which will be removed
        commerceItemId - identification for database entity which will be updated
        Returns:
        the status of the action, whether it was successful or not
      • isUserParticipatesInOrder

        boolean isUserParticipatesInOrder​(java.lang.String orderId,
                                          boolean asVendor)
        This method checks is database entity belong to other database entity.
        Parameters:
        orderId - identification for database entity which will be checked
        asVendor - true - for checking as vendor, false - if as buyer
        Returns:
        value as boolean
      • getLastOrderTimelineBean

        OrderTimeLineBean getLastOrderTimelineBean​(java.lang.String orderId)
        This method returns bean.
        Parameters:
        orderId - identification for database entity which found last bean and returned
        Returns:
        bean
      • approve

        boolean approve​(java.lang.String orderId)
        Approves order.
        Parameters:
        orderId - order id
        Returns:
        true on success
      • pay

        PaymentStatus pay​(java.lang.String orderId)
        Commits payment for the order.
        Parameters:
        orderId - order id
        Returns:
        status of the payment
      • obtain3DSecureLink

        java.lang.String obtain3DSecureLink​(java.lang.String orderId)
        Obtains a payment authorization link;
        Parameters:
        orderId - order id
        Returns:
        the link
      • ship

        boolean ship​(java.lang.String orderId)
        Ships order.
        Parameters:
        orderId - order id
        Returns:
        true on success
      • deliver

        boolean deliver​(java.lang.String orderId)
        Deliver order.
        Parameters:
        orderId - order id
        Returns:
        true on success
      • payout

        java.lang.String payout​(java.lang.String orderId)
        Commits payout.
        Parameters:
        orderId - order id
        Returns:
        status of the payout
      • complete

        boolean complete​(java.lang.String orderId)
        Complete order.
        Parameters:
        orderId - order id
        Returns:
        true on success
      • cancel

        boolean cancel​(java.lang.String orderId)
        Cancels an order.
        Parameters:
        orderId - order id
        Returns:
        true on success
      • addAttachment

        boolean addAttachment​(java.lang.String orderId,
                              Attachment attachment)
        Adds attachment to the last timeline.
        Parameters:
        orderId - id of the order
        attachment - attachment
        Returns:
        success or not
      • removeAttachment

        boolean removeAttachment​(java.lang.String orderId,
                                 java.lang.String attachmentName)
        Removes attachment from the last timeline.
        Parameters:
        orderId - id of the order
        attachmentName - attachment name
        Returns:
        success or not
      • addAttachment

        boolean addAttachment​(java.lang.String orderId,
                              java.lang.String orderTimelineStep,
                              Attachment attachment)
        Adds attachment to the last timeline.
        Parameters:
        orderId - id of the order
        orderTimelineStep - step of the timeline
        attachment - attachment
        Returns:
        success or not
      • removeAttachment

        boolean removeAttachment​(java.lang.String orderId,
                                 java.lang.String orderTimelineStep,
                                 java.lang.String attachmentName)
        Removes attachment from the last timeline.
        Parameters:
        orderId - id of the order
        orderTimelineStep - step of the timeline
        attachmentName - attachment name
        Returns:
        success or not
      • getShippingAddresses

        java.util.Set<Address> getShippingAddresses()
        Get saved shipping addresses.
        Returns:
        addresses set
      • canCancel

        boolean canCancel​(java.lang.String orderId)
        Checks if order is cancelable.
        Parameters:
        orderId - id of the order
        Returns:
        true if order status could be changed to OrderStatus.CANCELED or OrderStatus.DENIED
      • canAddAttachment

        boolean canAddAttachment​(java.lang.String orderId)
        Checks if current user can add an Attachment.
        Parameters:
        orderId - order ID
        Returns:
        true if the user has rights to add an attachment to the order.
      • changeAddress

        boolean changeAddress​(java.lang.String orderId,
                              java.util.LinkedHashMap<java.lang.String,​java.lang.Object> params)
        Changes shipping address of the order.
        Parameters:
        orderId - order id
        params - params of address
        Returns:
        true if successful
      • changePaymentMethod

        boolean changePaymentMethod​(java.lang.String orderId,
                                    java.util.LinkedHashMap<java.lang.String,​java.lang.String> pmParams)
        Changes payment method for the order's payment intent.
        Parameters:
        orderId - order id
        pmParams - params of a new payment intent
        Returns:
        true if successful
      • createInvoiceBuyerToVendor

        Attachment createInvoiceBuyerToVendor​(java.lang.String orderId)
        This method make an invoice from buyer to vendor
        Parameters:
        orderId - order
        Returns:
        value as attachment
      • canChangeStatus

        boolean canChangeStatus​(java.lang.String orderId)
        Checks if current user can change the status of given order.
        Parameters:
        orderId - order
        Returns:
        true if user can change the status
      • mustAddAttachments

        boolean mustAddAttachments​(java.lang.String orderId)
        Checks if attachments must be added on the current step but currently absent.
        Parameters:
        orderId - order
        Returns:
        true if attachments must be added
      • prepareItemsToShipment

        boolean prepareItemsToShipment​(java.util.List<CommerceItem> items)
        This method does reserve for the items which are paid already.
        Parameters:
        items - commerce items which will be reserved
        Returns:
        true if it successful
      • getInvoiceTemplate

        java.lang.String getInvoiceTemplate​(java.lang.String orderId)
        This method makes the process of compiling the invoice template
        Parameters:
        orderId - order
        Returns:
        compiled invoice template as a string
      • calculateTotalPrice

        java.util.Map<java.lang.String,​java.lang.Object> calculateTotalPrice​(java.lang.String orderId)
        Sums prices of commerce items.
        Parameters:
        orderId - order identifier
        Returns:
        items total amount as map-property
      • calculateTaxAmountPrice

        java.util.Map<java.lang.String,​java.lang.Object> calculateTaxAmountPrice​(java.lang.String orderId)
        Calculates tax amount for order.
        Parameters:
        orderId - order identifier
        Returns:
        tax amount as map-property
      • calculateItemsTotalBruttoAmount

        java.util.Map<java.lang.String,​java.lang.Object> calculateItemsTotalBruttoAmount​(java.lang.String orderId)
        Calculates total gross amount for order.
        Parameters:
        orderId - order identifier
        Returns:
        order gross amount as map-property
      • calculateServiceFeeBruttoAmount

        java.util.Map<java.lang.String,​java.lang.Object> calculateServiceFeeBruttoAmount​(java.lang.String orderId)
        Calculates service fee for order.
        Parameters:
        orderId - order identifier
        Returns:
        service fee amount as map-property
      • calculatePayoutAmount

        java.util.Map<java.lang.String,​java.lang.Object> calculatePayoutAmount​(java.lang.String orderId)
        Calculates payout amount for order.
        Parameters:
        orderId - order identifier
        Returns:
        payout amount as map-property
      • mapOrder

        OrderDTO mapOrder​(Order order)
        Maps an Order object to an OrderDTO object.
        Parameters:
        order - the Order object to be mapped
        Returns:
        the mapped OrderDTO object