Пример #1
0
 def build_price_from_td_element(self, td):
     price_a = td.find('a')
     
     price_pattern = r'\$(?P<dollars>[0-9.]+)'
     price_string = price_a.text
     
     price_match = re.match(price_pattern, price_string)
     price = PriceEstimate()
     price.total_amount = float(price_match.group('dollars'))
     
     return price
Пример #2
0
 def create_price_from_pcs_price_estimate_doc(self, json_price_obj):
     price = PriceEstimate()
     price.available_balance = json_price_obj['available_balance'][0]
     price.available_credit = json_price_obj['available_credit'][0]
     price.applied_credit = json_price_obj['applied_credit'][0]
     price.distance = json_price_obj['distance'][0]
     price.hourly_rate = json_price_obj['hourly_rate'][0]
     price.daily_rate = json_price_obj['daily_rate'][0]
     price.time_amount = json_price_obj['time_amount'][0]
     price.distance_amount = json_price_obj['distance_amount'][0]
     price.tax_amount = json_price_obj['tax_amount'][0]
     price.fee_amount = json_price_obj['fee_amount'][0]
     price.total_amount = json_price_obj['total_amount'][0]
     price.amount_due = json_price_obj['amount_due'][0]
     
     return price