def __init__(self, item): self.name = item.value.get("Name", FormField()) self.quantity = item.value.get("Quantity", FormField()) self.price = item.value.get("Price", FormField()) self.total_price = item.value.get("TotalPrice", FormField())
def __init__(self, form): self.receipt_type = form.fields.get("ReceiptType", FormField()) self.merchant_name = form.fields.get("MerchantName", FormField()) self.merchant_address = form.fields.get("MerchantAddress", FormField()) self.merchant_phone_number = form.fields.get("MerchantPhoneNumber", FormField()) self.receipt_items = self.convert_to_receipt_item( form.fields.get("Items", FormField())) self.subtotal = form.fields.get("Subtotal", FormField()) self.tax = form.fields.get("Tax", FormField()) self.tip = form.fields.get("Tip", FormField()) self.total = form.fields.get("Total", FormField()) self.transaction_date = form.fields.get("TransactionDate", FormField()) self.transaction_time = form.fields.get("TransactionTime", FormField())