Skip to content

Got an unexpected keyword argument 'total_price_cents_usd' to method create_order #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jkelso662 opened this issue Mar 30, 2021 · 2 comments · Fixed by #24
Closed
Assignees

Comments

@jkelso662
Copy link

Hi there.

I received the following error when using the example python code from docs. I am using the test API keys as the 'ApiClient' and have been able to create orders sucessfully by mass_g. However, when using the create order by price, I am receiving argument errors.

total_price_cents_usd = 500 # Pass in the total price in cents of US dollars (i.e. 5 dollars)
patch.orders.create_order(total_price_cents_usd=total_price_cents_usd)

Results in

ApiTypeError: Got an unexpected keyword argument 'total_price_cents_usd' to method create_order

On looking at the orders_api.py I see there is no total_price_cents_usd, just price_cents_usd. Changing the param label to this results in the following error.

total_price_cents_usd = 500 # Pass in the total price in cents of US dollars (i.e. 5 dollars)
patch.orders.create_order(price_cents_usd=total_price_cents_usd)

Results in...

ApiException: (422)
Reason: Unprocessable Entity
HTTP response headers: HTTPHeaderDict({'Server': 'nginx/1.17.8', 'Date': 'Tue, 30 Mar 2021 09:57:35 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'X-Frame-Options': 'SAMEORIGIN', 'X-XSS-Protection': '1; mode=block', 'X-Content-Type-Options': 'nosniff', 'X-Download-Options': 'noopen', 'X-Permitted-Cross-Domain-Policies': 'none', 'Referrer-Policy': 'strict-origin-when-cross-origin', 'Vary': 'Accept, Origin', 'Cache-Control': 'no-cache', 'X-Request-Id': '961cb0a64cba5d3835a9b28336dd3455', 'X-Runtime': '0.026914', 'Strict-Transport-Security': 'max-age=15724800; includeSubDomains', 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Credentials': 'true', 'Access-Control-Allow-Methods': 'GET, PUT, POST, DELETE, PATCH, OPTIONS', 'Access-Control-Allow-Headers': 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization'})
HTTP response body: {"data":null,"error":{"code":422,"message":" must only contain one of: mass_g, total_price_cents_usd"},"meta":null,"success":false}

Thanks in advance.

@pcothenet
Copy link
Contributor

Hi Josh,

Thanks for bringing this up to our attention. We'll be looking at this very shortly!

@pcothenet
Copy link
Contributor

@jkelso662 this is fixed in 1.5.2. Thanks for reporting and looking forward to learn more about what you're building!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants