Skip to content

Commit a2a9ef3

Browse files
committed
TaxID: Correctly set country for non 'eu_vat' taxIDs
'au_abn' and 'nz_gst' are numbers with only digits, they don't contain their country code. We can only guess the country from 'eu_vat' taxIDs, so let's adapt the code to better handle AU and NZ taxIDs number. See [the Stripe documentation] for the exact format of these two taxIDs number. [the Stripe documentation]: https://docs.stripe.com/billing/customer/tax-ids
1 parent 825150b commit a2a9ef3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

localstripe/resources.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -3276,7 +3276,10 @@ def __init__(self, country=None, customer=None, type=None, value=None,
32763276
assert type in ('eu_vat', 'nz_gst', 'au_abn')
32773277
assert _type(value) is str and len(value) > 10
32783278
if country is None:
3279-
country = value[0:2]
3279+
if type == 'eu_vat':
3280+
country = value[0:2]
3281+
else:
3282+
country = type[0:2].upper()
32803283
assert _type(country) is str
32813284
except AssertionError:
32823285
raise UserError(400, 'Bad request')

0 commit comments

Comments
 (0)