Example #1
0
    def validate(self):
        try:
            for key in ["price", "monthly_price", "yearly_price"]:
                if key in self.extra:
                    self.new_extra[key] = pricing.validate_price_data(self.extra[key])
        except (exception.GringottsException) as e:
            LOG.warning(e.format_message())
            raise e

        return json.dumps(self.new_extra)
Example #2
0
    def validate(self):
        try:
            for key in ['price', 'monthly_price', 'yearly_price']:
                if key in self.unit_price:

                    # transform order to dict
                    self.unit_price[key] = self.unit_price[key].as_dict()
                    new_seg = []
                    for seg in self.unit_price[key]['segmented']:
                        new_seg.append(seg.as_dict())
                    self.unit_price[key]['segmented'] = new_seg

                    self.new_unit_price[key] = pricing.validate_price_data(
                        self.unit_price[key])
        except (exception.GringottsException) as e:
            LOG.warning(e.format_message())
            raise e

        return self.new_unit_price
Example #3
0
    def validate(self):
        try:
            for key in ['price', 'monthly_price', 'yearly_price']:
                if key in self.unit_price:

                    # transform order to dict
                    self.unit_price[key] = self.unit_price[key].as_dict()
                    new_seg = []
                    for seg in self.unit_price[key]['segmented']:
                        new_seg.append(seg.as_dict())
                    self.unit_price[key]['segmented'] = new_seg

                    self.new_unit_price[key] = pricing.validate_price_data(
                        self.unit_price[key])
        except (exception.GringottsException) as e:
            LOG.warning(e.format_message())
            raise e

        return self.new_unit_price