Open Alexander01998 opened 1 month ago
Hi @Alexander01998 ๐
Thanks for raising this issue, there is definitely something we'll investigate further on the SDK side as we would not expect to be seeing a ValueError here.
However, unfortunately Nicaragua
is not actually one of our currently supported countries which is why the value option does not exist within the SDK.
I'm going to keep this issue open and come back with updates while we work at making this error case more clear and better handled all around.
We've now released v0.2.0 with some changes around enums prevents this error at the SDK level ๐
Hey @mikeymike, thanks for the update, but there still seems to be a mismatch between which countries the SDK thinks are supported and which countries the API thinks are supported.
For example, I just found out that BL
(Saint Barthรฉlemy) is listed in the CountryCode
enum, but requesting a price preview for it returns an error. The error message includes a list of supported countries that differs greatly from the CountryCode
enum:
address.country_code must be one of the following: \"AD\", \"AE\", \"AF\", \"AG\", \"AI\", \"AL\", \"AM\", \"AN\",
\"AO\", \"AR\", \"AS\", \"AT\", \"AU\", \"AW\", \"AX\", \"AZ\", \"BA\", \"BB\", \"BD\", \"BE\", \"BF\", \"BG\", \"BH\",
\"BI\", \"BJ\", \"BM\", \"BN\", \"BO\", \"BQ\", \"BR\", \"BS\", \"BT\", \"BV\", \"BW\", \"BY\", \"BZ\", \"CA\", \"CC\",
\"CF\", \"CG\", \"CH\", \"CI\", \"CK\", \"CL\", \"CM\", \"CN\", \"CO\", \"CR\", \"CU\", \"CV\", \"CW\", \"CX\", \"CY\",
\"CZ\", \"DE\", \"DJ\", \"DK\", \"DM\", \"DO\", \"DZ\", \"EC\", \"EE\", \"EG\", \"EH\", \"ER\", \"ES\", \"ET\", \"FI\",
\"FJ\", \"FK\", \"FM\", \"FO\", \"FR\", \"GA\", \"GB\", \"GD\", \"GE\", \"GF\", \"GG\", \"GH\", \"GI\", \"GL\", \"GM\",
\"GN\", \"GP\", \"GQ\", \"GR\", \"GS\", \"GT\", \"GU\", \"GW\", \"GY\", \"HK\", \"HM\", \"HN\", \"HR\", \"HT\", \"HU\",
\"ID\", \"IE\", \"IL\", \"IM\", \"IN\", \"IO\", \"IQ\", \"IR\", \"IS\", \"IT\", \"JE\", \"JM\", \"JO\", \"JP\", \"KE\",
\"KG\", \"KH\", \"KI\", \"KM\", \"KN\", \"KP\", \"KR\", \"KW\", \"KY\", \"KZ\", \"LA\", \"LB\", \"LC\", \"LI\", \"LK\",
\"LR\", \"LS\", \"LT\", \"LU\", \"LV\", \"LY\", \"MA\", \"MC\", \"MD\", \"ME\", \"MF\", \"MG\", \"MH\", \"MK\", \"ML\",
\"MM\", \"MN\", \"MO\", \"MP\", \"MQ\", \"MR\", \"MS\", \"MT\", \"MU\", \"MV\", \"MW\", \"MX\", \"MY\", \"MZ\", \"NA\",
\"NC\", \"NE\", \"NF\", \"NG\", \"NI\", \"NL\", \"NO\", \"NP\", \"NR\", \"NU\", \"NZ\", \"OM\", \"PA\", \"PE\", \"PF\",
\"PG\", \"PH\", \"PK\", \"PL\", \"PM\", \"PN\", \"PR\", \"PS\", \"PT\", \"PW\", \"PY\", \"QA\", \"RE\", \"RO\", \"RS\",
\"RU\", \"RW\", \"SA\", \"SB\", \"SC\", \"SD\", \"SE\", \"SG\", \"SH\", \"SI\", \"SJ\", \"SK\", \"SL\", \"SM\", \"SN\",
\"SO\", \"SR\", \"ST\", \"SV\", \"SY\", \"SZ\", \"TC\", \"TD\", \"TF\", \"TG\", \"TH\", \"TJ\", \"TK\", \"TL\", \"TM\",
\"TN\", \"TO\", \"TR\", \"TT\", \"TV\", \"TW\", \"TZ\", \"UA\", \"UG\", \"UM\", \"US\", \"UY\", \"UZ\", \"VA\", \"VC\",
\"VE\", \"VG\", \"VI\", \"VN\", \"VU\", \"WF\", \"WS\", \"YE\", \"YT\", \"ZA\", \"ZM\", \"ZW\"
As you can see, RU
and NI
are included in this list, even though they aren't supposed to be supported countries, and BL
is missing even though it's supposed to be supported. (There may be other differences that I haven't noticed yet.)
It seems like this might be a bug on the API side where it's using an outdated country list. If the API is maintained by a different team at Paddle, could you please let them know about this bug? It's really frustrating to find all these edge cases where a country works on one side but not the other.
Update: Country code AN
, listed in the API response, also doesn't work and is not even a valid ISO 3166-1 alpha-2 country code anymore. According to Wikipedia, it was dissolved into five separate territories in 2010. https://en.wikipedia.org/wiki/ISO_3166-2:AN
Update 2: Country codes SX
(Sint Maarten) and XK
(Kosovo) are also listed in the CountryCode
enum but not supported by the API.
Hey @Alexander01998 thanks for the extra details around this and the specific examples is great ๐
I'll make sure this is raised with the relevant people here and get some clarity on the behaviour. I'll update here as things progress.
Hey @mikeymike, thanks for the follow-up on this issue and for escalating it with the team! ๐
By the way, I noticed that v0.2.0 isn't available on PyPi yet. It still shows 0.1.3 as the latest version. Is the new release supposed to be available there?
Hey @mikeymike, thanks for the follow-up on this issue and for escalating it with the team! ๐
By the way, I noticed that v0.2.0 isn't available on PyPi yet. It still shows 0.1.3 as the latest version. Is the new release supposed to be available there?
Hey @Alexander01998, thanks for flagging this, we have just released v0.2.1 on PyPi, there was an issue with one of the pipelines that was suppose to publish to PyPi.
Describe the bug
If you request a price preview for a
customer_ip_address
located in Nicaragua, aValueError
is thrown with the message'NI' is not a valid CountryCode
. I can't share the IP address for privacy reasons, but the same bug also occurs if you manually try to construct theAddressPreview
object with acountry_code
ofNI
.Steps to reproduce
Run this:
You will get the following error:
Or, if you have an IP address from Nicaragua to test with:
And then you get this error:
Expected behavior
NI
should be an accepted country code inpaddle_billing.Entities.Shared.AddressPreview
, because it's possible for Paddle's servers to respond with an address object that has the country codeNI
.Alternatively, it should not be possible for Paddle's servers to respond with an address that has a country code of
NI
. (Though I'd recommend the former solution, since Nicaragua obviously is a valid country.)Code snippets
Python version
Python 3.12
SDK version
paddle-python-sdk==0.1.3
API version
Paddle Version 1 (default)
Additional context
Update: The same problem happens with Russia (RU).