Commit Graph

492 Commits

Author SHA1 Message Date
Fabien 'egg' O'Carroll
d1cd0fe80e Caught & handled 'resource_already_exists' errors (#185)
refs https://github.com/TryGhost/Ghost/issues/12065

This protects us against multiple instances of the members-api being
started simultaneously and race conditions where inbetween the initial
"GET" of a plan which returns empty, and the "POST" of a plan to create
it, another instance has already created it.
2020-07-21 13:40:49 +02:00
Fabien O'Carroll
8c73c4a42b Published new versions
- @tryghost/members-api@0.24.2
2020-07-21 12:03:41 +02:00
Fabien 'egg' O'Carroll
9f1b9d6156 Used mode to determine flow for checkout session (#184)
no-issue

This fixes a problem when subscribing to a Plan (Price) with a default
trial period. We also add logging to add a little more information about
which flow we're entering.

Subscriptions that are started with a trial have a `setup_intent`
present on the Checkout Session object, which was incorrectly causing us
to determine that we are in a "setup" flow and attempt to update a
customers card details.

We now use the `mode` property of the Checkout Session to determine
whether we are handling a new Subscription, or if we are in a "setup"
flow and should update the Customer's card details.
2020-07-21 12:03:16 +02:00
Fabien O'Carroll
9dc22b2bb2 Published new versions
- @tryghost/magic-link@0.4.11
 - @tryghost/members-api@0.24.1
 - @tryghost/members-ssr@0.8.3
2020-07-21 12:02:36 +02:00
Fabien O'Carroll
c30ffba75a Revert "Used mode to determine flow for checkout session (#184)"
no-issue

Reverting so that changesets can be released independently

This reverts commit d41e5f3b55.
2020-07-21 12:01:07 +02:00
Fabien 'egg' O'Carroll
d41e5f3b55 Used mode to determine flow for checkout session (#184)
no-issue

This fixes a problem when subscribing to a Plan (Price) with a default
trial period. We also add logging to add a little more information about
which flow we're entering.

Subscriptions that are started with a trial have a `setup_intent`
present on the Checkout Session object, which was incorrectly causing us
to determine that we are in a "setup" flow and attempt to update a
customers card details.

We now use the `mode` property of the Checkout Session to determine
whether we are handling a new Subscription, or if we are in a "setup"
flow and should update the Customer's card details.
2020-07-21 11:50:10 +02:00
Renovate Bot
f94f1bc107 Update dependency @types/node to v12.12.51 2020-07-20 22:51:48 +00:00
Fabien 'egg' O'Carroll
400dba62a9 Added cleanup on startup for old webhooks (#181)
refs https://github.com/TryGhost/Ghost/issues/12061

Due to a bug in Ghost webhooks are now created with a trailing "/" which
meant that the previous webhooks to that (without a slash) was never
removed.

This results in users receiving emails from stripe about failed webhook
delivery, which is not good at all.

This fix lists out the webhooks and finds (if present) the webhook which
matches the current URL, minus the trailing slash. If found it will then
attempt to delete that webhook thus stopping the emails from Stripe.

I've added a note to remove this code as it should only ever need to run
once, and can be removed for the Ghost release after these changes.
2020-07-20 17:54:22 +02:00
Renovate Bot
cd2a8511c8 Update dependency @types/node to v12.12.50 2020-07-10 17:06:24 +00:00
renovate[bot]
adf66ce1ae Pin dependency @types/stripe to 7.13.24 (#176)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-07-10 16:37:24 +02:00
renovate[bot]
0687210bfc Update dependency ghost-ignition to v4 (#108)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-07-10 16:36:33 +02:00
Renovate Bot
be854f4c59 Update dependency @types/node to v12.12.49 2020-07-10 14:04:19 +00:00
Fabien O'Carroll
f2a8387bdb Published new versions
- @tryghost/members-api@0.24.0
2020-07-09 17:36:06 +02:00
Fabien 'egg' O'Carroll
ac923af0f7 Refactored webhook creation (#175)
no-issue

* Refactored model dependencies
  This groups all of the model depenencies into a single models object,
  and renames the models with more concise identifiers

* Fixed spacing
* Added webhook support to metadata
* Refactored stripe configure to have better logging
* Refactored webhook creation to reuse existing webhook
* Installed @types/stripe
2020-07-09 16:40:48 +02:00
Rish
68dbfb707d Published new versions
- @tryghost/members-api@0.23.2
2020-07-08 21:50:30 +05:30
Rish
1acf7d40be 🐛 Fixed incorrect payload creation for magic link token
no issue

- The extra payload added to magic link token included `name`, `labels` and `oldEmail`
- Refactor in commit [here](bf63ffe424 (diff-9f9ef757543bb9a90baba0d3bea76a83L157-R169)) changed the `body` variable assignment causing the payload objection creation to not include the extra data from request body
- Updates `body` to `req.body` to use correct data from request
2020-07-08 21:48:12 +05:30
Nazar Gargol
5b909735fd Published new versions
- @tryghost/magic-link@0.4.10
 - @tryghost/members-api@0.23.1
 - @tryghost/members-csv@0.2.1
 - @tryghost/members-ssr@0.8.2
2020-07-08 20:23:05 +12:00
Nazar Gargol
d28d336660 Added package usage examples to README 2020-07-08 20:09:44 +12:00
Nazar Gargol
86ff376c99 Reworked unparse test to use less dependencies 2020-07-08 20:09:21 +12:00
Nazar Gargol
4c21bb9d65 Added basic test coverage for JSON to CSV serialization
no issue
2020-07-08 19:40:48 +12:00
Nazar Gargol
7f25548be5 Removed unneeded test suite
no issue

- This is a leftover from initial project scaffolding
2020-07-08 19:40:10 +12:00
Nazar Gargol
3a97d39d72 Substituted csv-parser with papaparse as CSV parsing package
refs 5c46786ebc

- This is continuation of work removing csv-parser as main CSV handling library with more suitable papaparse library
- Referenced commit introduced papaparse as a library to serialize JSON to CSV, this changeset takes it a step further and replaces CSV to JSON seriazliation logic
2020-07-08 19:39:37 +12:00
Renovate Bot
587c95b0d0 Update dependency @types/node to v12.12.48 2020-07-06 22:13:49 +00:00
Nazar Gargol
6b24cb8a9d Published new versions
- @tryghost/members-csv@0.2.0
2020-07-02 14:58:12 +12:00
Nazar Gargol
fd982fef73 Added mapping support to CSV parser
no issue

- When processing CSV files `parse` function now allows for the client to specify "mapping" parameter in format of a hash as follows:
{ destination_property_name: 'source_column_name'}
e.g.:
{
  name: 'weird_name_column',
  email: 'email_column'
}
- It is done so to allow for the end user to provide exact mapping of the fields to be transformed into JSON.
2020-07-02 14:53:56 +12:00
Nazar Gargol
bf0e890751 Published new versions
- @tryghost/members-csv@0.1.2
2020-06-19 19:52:52 +12:00
Nazar Gargol
afa20f7472 Fixed module paths
refs 6d3b080b30
2020-06-19 19:52:21 +12:00
Nazar Gargol
6d3b080b30 Published new versions
- @tryghost/members-csv@0.1.1
2020-06-19 19:50:39 +12:00
Nazar Gargol
93ab8ae946 Moved modules into lib folder
no issue

- This fixes a problem where files are skiped form the @tryghost/members-csv package
- Also this follows the file structure convention with other packages
2020-06-19 19:49:39 +12:00
Nazar Gargol
53993358ae Published new versions
- @tryghost/members-csv@0.1.0
2020-06-19 19:35:55 +12:00
Nazar Gargol
5c47d725cb Fixed tests and added fixtures from Ghost repo 2020-06-19 19:33:43 +12:00
Nazar Gargol
320d1f7653 Exposed parsed/unparsed methods through package API 2020-06-19 19:33:43 +12:00
Nazar Gargol
0b54b187bd Added dependent CSV parsing packages 2020-06-19 19:33:43 +12:00
Nazar Gargol
5c46786ebc Colocated readCSV util with members input serializer
refs 8185b42d9e5fd9e9051f08ce3395a648ec02f3a4

- Allows to move files and keep the history in one go.
- 'csv-parser' will be upgraded to 'papaparse' lib in a new package
2020-06-19 19:33:43 +12:00
Nazar Gargol
08600f05c7 Extracted members csv input serialization logic into separate module
refs 772ec13ac49a1d80877bb7b0f90ad57899f868dd

- This is prep work for extraction into members repository.
2020-06-19 19:33:43 +12:00
Nazar Gargol
c5c20d5efb Extracted members csv serialization logic into separate module
no issue

- This is prep work for extraction into members repository.
2020-06-19 19:33:43 +12:00
Nazar Gargol
ca2ab5bbce Initialized members-csv package 2020-06-19 18:54:48 +12:00
Fabien O'Carroll
1b51ed7a5d Published new versions
- @tryghost/members-api@0.23.0
2020-06-18 18:03:46 +02:00
Fabien 'egg' O'Carroll
ae9870993a Added hasActiveStripeSubscriptions method (#169)
no-issue

This can be used by Ghost to determine if the Stripe keys can be deleted
2020-06-18 18:01:04 +02:00
Hannah Wolfe
aa0b02b75e Published new versions
- @tryghost/members-api@0.22.0
2020-06-12 17:11:14 +01:00
Hannah Wolfe
ebaf9538b6 Adding INR currency support
- We have many customers asking for INR as there are special rules in Stripe for this currency
- As well as a desire for local-selling
- Meaning it's not valid to use e.g. USD instead
2020-06-12 08:58:49 +01:00
Nazar Gargol
7872355962 Published new versions
- @tryghost/members-api@0.21.0
2020-06-12 15:36:07 +12:00
Nazar Gargol
d83525b54b Added stripe customer fetching method to member's API
no issue

- This method is needed to be able to validate if customer exist in configured Stripe account before attempting to link one with local member.
2020-06-12 15:35:16 +12:00
Rish
a136e5f839 Published new versions
- @tryghost/magic-link@0.4.9
 - @tryghost/members-api@0.20.1
 - @tryghost/members-ssr@0.8.1
2020-06-10 16:32:14 +05:30
Rish
11e2732d50 Handled error for stripe checkout rejection
refs https://github.com/TryGhost/members.js/issues/38

- In case of incomplete Stripe setup like Account name, checkout session creation fails and throws error, which was not being handled and 200 returned after long timeout
- This change catches the error and returns correct status along with message for clients to handle it downstream
2020-06-10 16:29:48 +05:30
Renovate Bot
ec81ccfbeb Update dependency @types/node to v12.12.47 2020-06-09 22:59:06 +00:00
Renovate Bot
7fbe60c104 Update dependency @types/node to v12.12.46 2020-06-09 18:18:20 +00:00
Renovate Bot
4761601219 Update dependency @types/node to v12.12.45 2020-06-08 20:22:23 +00:00
Renovate Bot
937584f290 Update dependency @types/node to v12.12.44 2020-06-04 23:18:43 +00:00
Kevin Ansfield
88146dc3a3 Published new versions
- @tryghost/magic-link@0.4.8
 - @tryghost/members-api@0.20.0
 - @tryghost/members-ssr@0.8.0
2020-06-04 13:27:14 +01:00