Use correct billingaddress
This commit is contained in:
parent
364f5599e6
commit
9aff248d31
1 changed files with 24 additions and 9 deletions
|
@ -199,7 +199,22 @@ def validate_vat_number(stripe_customer_id, billing_address_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def create_tax_id(stripe_customer_id, billing_address_id, type):
|
def create_tax_id(stripe_customer_id, billing_address_id, type,
|
||||||
|
is_user_ba=False):
|
||||||
|
if is_user_ba:
|
||||||
|
try:
|
||||||
|
billing_address = UserBillingAddress.objects.get(
|
||||||
|
id=billing_address_id)
|
||||||
|
except UserBillingAddress.DoesNotExist as dne:
|
||||||
|
billing_address = None
|
||||||
|
logger.debug(
|
||||||
|
"UserBillingAddress does not exist for %s" % billing_address_id)
|
||||||
|
except UserBillingAddress.MultipleObjectsReturned as mor:
|
||||||
|
logger.debug(
|
||||||
|
"Multiple UserBillingAddress exist for %s" % billing_address_id)
|
||||||
|
billing_address = UserBillingAddress.objects.filter(
|
||||||
|
id=billing_address_id).order_by('-id').first()
|
||||||
|
else:
|
||||||
try:
|
try:
|
||||||
billing_address = BillingAddress.objects.get(id=billing_address_id)
|
billing_address = BillingAddress.objects.get(id=billing_address_id)
|
||||||
except BillingAddress.DoesNotExist as dne:
|
except BillingAddress.DoesNotExist as dne:
|
||||||
|
|
Loading…
Reference in a new issue