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

I can choose a storage subscription price #1869

Closed
gobengo opened this issue Sep 8, 2022 · 1 comment · Fixed by #1878
Closed

I can choose a storage subscription price #1869

gobengo opened this issue Sep 8, 2022 · 1 comment · Fixed by #1878
Assignees

Comments

@gobengo
Copy link
Contributor

gobengo commented Sep 8, 2022

Motivation:

@gobengo
Copy link
Contributor Author

gobengo commented Sep 8, 2022

PUT /user/payment will support

{
  "method": { "id": "pm_..." },
  "subscription": {
    "storage": { "price": "price_id_..." }
  }
}

@gobengo gobengo linked a pull request Sep 10, 2022 that will close this issue
12 tasks
gobengo added a commit that referenced this issue Sep 20, 2022
Motivation:
* #1869 
* kinda like https://trunkbaseddevelopment.com/ but not in 'main', use
this branch instead. commit early and often and we can figure out
together how to keep the ci checks passing

Parts
* [x] implement api contract stubbed in `userPaymentPut`
[added test
here](8bfd82e#diff-0313c9c004c693d94c846d722a7ea9695c4c40867f3666b2f3706850d47f40eaR138)
    ```
    const desiredPaymentSettings = {
      method: { id: `pm_${randomString()}` },
subscription: { storage: { price: `price_test_${randomString()}` } }
    }
    ```
* [x] @cmunns ensure /account/payment page can write the pricing tier to
the PUT /account/payment api
* [x] @gobengo add quick hack where GET
/account/payment?mockSubscription=true will include a mock subscription
with storage price - this should unblock frontend fetching/rendering it
for dev/testing
[added
here](e121a6b#diff-0313c9c004c693d94c846d722a7ea9695c4c40867f3666b2f3706850d47f40eaR76)
    Opt-in to getting a realistic paymentSettings.subscription:
    * Request `GET /user/payment?mockSubscription=true`
    * Response
        ```
        {
subscription: { storage: { price:
'price_mock_userPaymentGet_mockSubscription' } }
        }
        ```
* [x] create use case object `saveStorageSubscription` and use from
`userPaymentPut`
* [x] can `saveStorageSubscription` with services backed by stripe.com
APIs
* [x] @cmunns ensure /account/payment page can read the pricing tier
from the GET /account/payment?mockSubscription=true api
* [x] can `getStorageSubscription(customer)`
* [x] `getStorageSubscription(customer) called from api userPaymentGet`
* [x] test for a new user choosing a paid tier for first time
* [x] test for upgrading from one paid tier to another
* [x] test for downgrading from one paid tier to another
* [x] test for downgrading from one paid tier to a free tier

Co-authored-by: Adam Munns <adam@whetinteractive.com>
Co-authored-by: Yusef Napora <yusef@napora.org>
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