Skip to content
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

Trial_end not working #131

Open
adrianlungu opened this issue Apr 6, 2020 · 5 comments
Open

Trial_end not working #131

adrianlungu opened this issue Apr 6, 2020 · 5 comments

Comments

@adrianlungu
Copy link

Hello,

I saw that trial_end was implemented a little while ago, but while testing an implementation using it, it seems that it's always null ?

curl --request POST \
  --url http://127.0.0.1:8420/v1/subscriptions \
  --header 'authorization: Basic c2tfYXBpXzEyM2V1Og==' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data customer=cus_JGbKYYzEL5G0lr \
  --data 'items[0][plan]=plan_id_cc' \
  --data trial_end=1590969600 \
  --data 'items[0][quantity]=1'

Running this sends back the following for some reason:

  "trial_end": null,
  "trial_period_days": null,
  "trial_start": null

The same request works fine with Stripe.

Am I doing something wrong or missing something here ?

Thanks!

@adrienverge
Copy link
Owner

Hello,

I think it was forget by the author in commit 55ca7a4. Could you try pull request #132 (fetch code and test) and report if it solved the problem?

Thanks!

@adrianlungu
Copy link
Author

Hello,

Thank you for the quick reply!

It might be a bigger change than that, I'll try to look into it.

Basically, when trial_end is in the future, the status switches to trialing. I'm not sure if that was covered in that previous PR.

@adrienverge
Copy link
Owner

OK, got it! I merged #132 because it seemed a move in the right direction anyway. Feel free to look into the trialing problem if you want, and propose a better change.

@adrianlungu
Copy link
Author

Hey, thanks for merging it!

There seems to be an issue somewhere as I'm getting the following:

localstripe_1  | Error handling request
localstripe_1  | Traceback (most recent call last):
localstripe_1  |   File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 418, in start
localstripe_1  |     resp = await task
localstripe_1  |   File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 458, in _handle
localstripe_1  |     resp = await handler(request)
localstripe_1  |   File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl
localstripe_1  |     return await handler(request)
localstripe_1  |   File "/usr/local/lib/python3.8/site-packages/localstripe/server.py", line 56, in error_middleware
localstripe_1  |     return await handler(request)
localstripe_1  |   File "/usr/local/lib/python3.8/site-packages/localstripe/server.py", line 192, in auth_middleware
localstripe_1  |     return await handler(request)
localstripe_1  |   File "/usr/local/lib/python3.8/site-packages/localstripe/server.py", line 204, in f
localstripe_1  |     return json_response(cls._api_create(**data)._export(expand=expand))
localstripe_1  |   File "/usr/local/lib/python3.8/site-packages/localstripe/resources.py", line 240, in _export
localstripe_1  |     do_expand(path, obj)
localstripe_1  |   File "/usr/local/lib/python3.8/site-packages/localstripe/resources.py", line 237, in do_expand
localstripe_1  |     do_expand(path, obj[k])
localstripe_1  |   File "/usr/local/lib/python3.8/site-packages/localstripe/resources.py", line 232, in do_expand
localstripe_1  |     if type(obj[k]) is str:
localstripe_1  | TypeError: 'NoneType' object is not subscriptable
localstripe_1  | ::ffff:172.19.0.5 [05/May/2020:08:26:20 +0000] "POST /v1/subscriptions HTTP/1.1" 500 244 "-" "Stripe/v1 GoBindings/69.3.0"

With the backend reporting

(response status: 500, body sample: '500 Internal Server Error\n\nServer got itself in trouble'): invalid character 'I' after top-level value

I'll try to investigate more to see what's actually happening as I'm not sure if it's from the AddExpand or the actual trial code.

@RachelYoung94
Copy link

Did anyone find a solution to this as i'm having the same issue

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

No branches or pull requests

3 participants