예제 #1
0
파일: order.py 프로젝트: USGS-EROS/espa-api
    def generate_ee_testing_order(self, user_id, partial=False):
        ee_order = mock_lta.get_available_orders_partial(partial)

        # Have to emulate a bunch of load_ee_orders

        for eeorder, email_addr, contactid in ee_order:
            order_id = Order.generate_ee_order_id(email_addr, eeorder)
            scene_info = ee_order[eeorder, email_addr, contactid]

            user = User.find(user_id)
            ts = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')

            order_dict = {'orderid': order_id,
                          'user_id': user.id,
                          'order_type': 'level2_ondemand',
                          'status': 'ordered',
                          'note': 'EarthExplorer order id: {}'.format(eeorder),
                          'ee_order_id': eeorder,
                          'order_source': 'ee',
                          'order_date': ts,
                          'priority': 'normal',
                          'email': user.email,
                          'product_options': 'include_sr: true',
                          'product_opts': Order.get_default_ee_options(scene_info)}

            order = Order.create(order_dict)
            self.production_provider.load_ee_scenes(scene_info, order.id)

        return order.id
예제 #2
0
    def generate_ee_testing_order(self, user_id, partial=False):
        ee_order = mock_lta.get_available_orders_partial(partial)

        # Have to emulate a bunch of load_ee_orders

        for eeorder, email_addr, contactid in ee_order:
            order_id = Order.generate_ee_order_id(email_addr, eeorder)
            scene_info = ee_order[eeorder, email_addr, contactid]

            user = User.find(user_id)
            ts = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')

            order_dict = {
                'orderid': order_id,
                'user_id': user.id,
                'order_type': 'level2_ondemand',
                'status': 'ordered',
                'note': 'EarthExplorer order id: {}'.format(eeorder),
                'ee_order_id': eeorder,
                'order_source': 'ee',
                'order_date': ts,
                'priority': 'normal',
                'email': user.email,
                'product_options': 'include_sr: true',
                'product_opts': Order.get_default_ee_options(scene_info)
            }

            order = Order.create(order_dict)
            self.production_provider.load_ee_scenes(scene_info, order.id)

        return order.id
예제 #3
0
    def place_order(self, new_order, user):
        """
        Build an order dictionary to be place into the system

        :param new_order: dictionary representation of the order received
        :param user: user information associated with the order
        :return: orderid to be used for tracking
        """
        ts = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')

        order_dict = {
            'orderid': Order.generate_order_id(user.email),
            'user_id': user.id,
            'order_type': 'level2_ondemand',
            'status': 'ordered',
            'product_opts': new_order,
            'ee_order_id': '',
            'order_source': 'espa',
            'order_date': ts,
            'priority': 'normal',
            'note': new_order.get('note', None),
            'email': user.email,
            'product_options': ''
        }

        result = Order.create(order_dict)
        return result
예제 #4
0
    def place_order(self, new_order, user):
        """
        Build an order dictionary to be place into the system

        :param new_order: dictionary representation of the order received
        :param user: user information associated with the order
        :return: orderid to be used for tracking
        """
        ts = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')

        order_dict = {'orderid': Order.generate_order_id(user.email),
                      'user_id': user.id,
                      'order_type': 'level2_ondemand',
                      'status': 'ordered',
                      'product_opts': new_order,
                      'ee_order_id': '',
                      'order_source': 'espa',
                      'order_date': ts,
                      'priority': 'normal',
                      'note': new_order.get('note', None),
                      'email': user.email,
                      'product_options': ''}

        result = Order.create(order_dict)
        return result.orderid