Skip to content

Commit

Permalink
Update buy_me_a_coffee.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroenvermunt authored Feb 21, 2024
1 parent f039db1 commit cb53745
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions examples/buy_me_a_coffee.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def two_decimals(cls, v):
class BuyMeACoffee(ApiSDK):

base_url = 'https://api.mollie.com/v2'
authorization = 'Bearer test_hhPcGuBTrpgezB7UcuKhVnUVBe66yD'
authorization = 'Bearer test_hhPcGuBTrpgezB7UcuKhVnUVBe66yD' # replace with your own test token

headers = {
'Content-Type': 'application/json'
Expand All @@ -43,17 +43,19 @@ class BuyMeACoffee(ApiSDK):
'description': 'Buy me a coffee',
},
},

# As an alternative to pydantic, we can define the request like so
'buy_me_another_coffee': {
'method': 'POST',
'endpoint': '/payment-links',
'body': {
'amount': {
'currency': 'EUR',
'value': '{amount}'
'value': '{amount}' # notice that we have no validation, and the user must use the current formatting accepted by Mollie
},
'description': 'Buy me a coffee',
},
}
},
}

return_type = return_types.JSON
Expand Down Expand Up @@ -99,7 +101,7 @@ async def buy_me_a_coffee():
print(link_custom_coffee.result())

# another_coffee = await bmac.another_coffee('10.00')
# # uncomment to see error
# # uncomment to see error due to using the wrong input format
# another_coffee = await bmac.another_coffee(10)
# another_coffee = await bmac.another_coffee('10')

Expand Down

0 comments on commit cb53745

Please sign in to comment.