def _process_donation_item(self, sale: Sale, description: str): don = MonetaryDonation() don.ctrlid = "{}:{}".format(self.CTRLID_PREFIX, sale.id) don.sale = sale don.amount = sale.total_paid_by_customer # TODO: Add earmark self.upsert(don)
def _process_donation(self, sale, checkout): don = MonetaryDonation() don.ctrlid = "{}:{}".format(self.CTRLID_PREFIX, checkout['checkout_id']) don.sale = Sale(id=sale.id) don.amount = sale.total_paid_by_customer if checkout['fee_payer'] == 'payer': don.amount -= sale.processing_fee self.upsert(don)
def _process_donation_item(self, sale, item, item_num): quantity = int(float(item['quantity'])) for n in range(1, quantity+1): don = MonetaryDonation() don.ctrlid = "{}:{}:{}".format(sale['ctrlid'], item_num, n) don.sale = Sale(id=sale['id']) don.amount = Decimal(item["gross_sales_money"]["amount"]) / Decimal(quantity * 100.0) self.upsert(don)
def _process_donation(self, sale, checkout, earmark=None): don = MonetaryDonation() don.ctrlid = "{}:{}".format(self.CTRLID_PREFIX, checkout['checkout_id']) don.sale = Sale(id=sale.id) don.amount = sale.total_paid_by_customer if checkout['fee_payer'] == 'payer': don.amount -= sale.processing_fee if earmark is not None: don.earmark = earmark self.upsert(don)
def _process_donation_item(self, sale, item, item_num): quantity = int(float(item['quantity'])) for n in range(1, quantity + 1): don = MonetaryDonation() don.ctrlid = "{}:{}:{}".format(sale['ctrlid'], item_num, n) don.sale = Sale(id=sale['id']) don.amount = Decimal( item["gross_sales_money"]["amount"]) / Decimal( quantity * 100.0) self.upsert(don)