def create_order(user, plan_pricing, ip_address, organization, renew=False): order = Order(user=user, plan=plan_pricing.plan, pricing=plan_pricing.pricing, created=user.date_joined, amount=plan_pricing.price, tax=app_settings.TAX, currency=app_settings.CURRENCY) order.full_clean() order.save() payment = Payment(organization=organization, order=order, currency=order.currency, total=order.total(), tax=order.tax_total(), customer_ip_address=ip_address, is_renewal=renew) payment.full_clean() payment.save() return payment
def test_amount_taxed_23(self): o = Order() o.amount = Decimal(123) o.tax = Decimal(23) self.assertEqual(o.total(), Decimal('151.29'))
def test_amount_taxed_0(self): o = Order() o.amount = Decimal(123) o.tax = Decimal(0) self.assertEqual(o.total(), Decimal('123'))
def test_amount_taxed_none(self): o = Order() o.amount = Decimal(123) o.tax = None self.assertEqual(o.total(), Decimal("123"))