Commit 54a3c96 1 parent e4ea32e commit 54a3c96 Copy full SHA for 54a3c96
File tree 2 files changed +8
-5
lines changed
donation-api/src/donation_api
2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -45,9 +45,12 @@ class Constants:
45
45
stripe_maximum_amount : int = int (os .getenv ("STRIPE_MAXIMUM_AMOUNT" ) or "999999" )
46
46
47
47
def __post_init__ (self ):
48
- self .alllowed_currencies = (
49
- os .getenv ("ALLOWED_CURRENCIES" ) or "USD|EUR|CHF"
50
- ).split ("|" )
48
+ self .alllowed_currencies = [
49
+ currency .upper ()
50
+ for currency in (os .getenv ("ALLOWED_CURRENCIES" ) or "USD|EUR|CHF" ).split (
51
+ "|"
52
+ )
53
+ ]
51
54
52
55
self .stripe_webhook_testing_ips = os .getenv (
53
56
"STRIPE_WEBHOOK_TESTING_IPS" , ""
Original file line number Diff line number Diff line change @@ -181,13 +181,13 @@ async def check_config():
181
181
)
182
182
async def create_payment_intent (pi_payload : PaymentIntentRequest ):
183
183
"""API endpoint to receive Book addition requests and add to database"""
184
- if not re .match (r"[a-z ]{3}" , pi_payload .currency .lower ()):
184
+ if not re .match (r"[A-Z ]{3}" , pi_payload .currency .upper ()):
185
185
logger .error ("Currency doesnt look like a currency" )
186
186
raise HTTPException (
187
187
status_code = HTTPStatus .BAD_REQUEST ,
188
188
detail = "Currency doesnt look like a currency" ,
189
189
)
190
- if pi_payload .currency not in conf .alllowed_currencies :
190
+ if pi_payload .currency . upper () not in conf .alllowed_currencies :
191
191
raise HTTPException (
192
192
status_code = HTTPStatus .BAD_REQUEST ,
193
193
detail = "Currency not supported" ,
You can’t perform that action at this time.
0 commit comments