Commit Graph

204 Commits

Author SHA1 Message Date
Fabien O'Carroll
1fb969ad36 Refactored to improve logging and error handling
* Installed stripe@7.4.0

refs #38

We were relying on stripe being installed in Ghost, this moves the dep
to the correct package.

* Created exponentialBackoff wrapper for stripe api

refs #38

https://stripe.com/docs/testing#rate-limits The stripe docs suggest to
use exponential backoff when recieving a rate limit error. This wrapper
will wrap stripe api calls, and retry them after 1s,2s,4s,8s,16s until
eventually failing. This gives a total of 5 retries over 31s.

* Added wrappers around the stripe api calls

refs #38

* Ensured all calls to stripe api go via exp backoff

refs #38

* Scaffolding out the error handling for stripe api

* Forwarding all errors

* Refactored stripe api into modules

* Ensured the ready promise object is not replaced

* Added logging setup

- Sets up common logger structure with custom logger passed through

* Ensure logger is kept in module state

* Renamed updateLogger to setLogger

* Removed `logger` param and exposed setLogger method

* Ensured different ids used for test mode

* Ensure setLogger works for prototype methods

* Removed reconfigureSettings method

* Updated payment processer service to keep static ready promise

* Added eventemitter to member api instance to handle errors

* Moved logging of errors to http level
2019-07-17 18:20:13 +08:00
Fabien O'Carroll
bd5d2a664b Published new versions
- @tryghost/members-ssr@0.2.1
2019-07-17 18:07:35 +08:00
Fabien O'Carroll
21123d4061 Fixed getMemberDataFromSession usage of membersApi
no-issue

Since we allow the membersApi to be a thunk - we must wrap all
references to it in a call to get
2019-07-17 18:05:38 +08:00
Fabien O'Carroll
5a4efd2eec Published new versions
- @tryghost/members-ssr@0.2.0
2019-07-17 15:07:16 +08:00
Fabien O'Carroll
942187f48e Added support for passing thunk for membersApi
no-issue

This is to allow support for consumers to dynamically update their
membersApi instance, for example when configuration changes, and not
have to replace the instance of members-ssr
2019-07-17 15:06:20 +08:00
Fabien O'Carroll
192f27b5bd Published new versions
- @tryghost/members-auth-pages@1.1.0
 - @tryghost/members-browser-auth@0.2.0
 - @tryghost/members-theme-bindings@0.2.3
2019-07-09 18:45:57 +08:00
Fabien O'Carroll
474c495331 Stopped browser-auth editing src of auth-pages frame
refs #36

This removes the behaviour of forcing the `src` property to change when
opening the auth pages and insteads posts a message "asking" the auth
pages to update the location hash.
2019-07-09 18:44:53 +08:00
Fabien O'Carroll
550ea70c9c Allowed auth-pages to update location from message
refs #36

This will allow the members-browser-auth library to post messages to the
auth-pages iframe, asking it to update the location from inside the
frame.
2019-07-09 18:44:53 +08:00
Fabien O'Carroll
f89677b1ce Published new versions
- @tryghost/members-auth-pages@1.0.0
2019-07-09 15:49:47 +08:00
Fabien O'Carroll
54560050c6 Updated auth-pages to use new members static url (#35)
refs https://github.com/TryGhost/Ghost/issues/10886

Since updating the static pages, the auth pages would be broken, this
updates them to correctly parse and load the static urls.
2019-07-09 15:49:05 +08:00
Fabien O'Carroll
20c60e4de3 Published new versions
- @tryghost/members-api@0.2.0
 - @tryghost/members-browser-auth@0.1.3
 - @tryghost/members-gateway-api@0.1.4
 - @tryghost/members-theme-bindings@0.2.2
2019-07-09 15:39:16 +08:00
Fabien O'Carroll
34f7b2c7d6 Updated members-api to export a router instance
no-issue

This was the original design, to make it easy to incorporate into
another application, but the URL structure in Ghost did not allow for
it, we've since learnt that the URL structure _should_ be how it is
here, so we can export a router with both the auth endpoints and the
static files for the gateway
2019-07-09 15:23:11 +08:00
Renovate Bot
584d725e12 Update dependency eslint-plugin-ghost to v0.4.0 2019-07-08 02:24:52 +00:00
Renovate Bot
44e37f3ed5 Update dependency browserify to v16.3.0 2019-07-08 01:25:08 +00:00
Renovate Bot
cc096d5c84 Update dependency eslint-plugin-ghost to v0.3.0 2019-07-01 01:28:27 +00:00
Fabien O'Carroll
3475975519 Published new versions
- @tryghost/members-theme-bindings@0.2.1
2019-06-25 14:58:43 +07:00
Fabien O'Carroll
99a8ae197e Fixed createSession call on signedin event
no-issue

This was missing the ssrUrl property.
2019-06-25 14:52:42 +07:00
Fabien O'Carroll
f220ee10c7 Published new versions
- @tryghost/members-api@0.1.2
 - @tryghost/members-auth-pages@0.2.2
 - @tryghost/members-browser-auth@0.1.2
 - @tryghost/members-gateway-api@0.1.3
 - @tryghost/members-gateway-protocol@0.1.2
 - @tryghost/members-theme-bindings@0.2.0
2019-06-25 14:22:42 +07:00
Fabien O'Carroll
979af9f234 Removed hardcoded url values
no-issue

This gives greater flexibility in the application which handles the urls
for this, allowing the urls to be changed and configured in only one
codebase.
2019-06-25 14:18:07 +07:00
Renovate Bot
ca998d0529 Update dependency jsdom to v15.1.1 2019-06-03 01:27:16 +00:00
Renovate Bot
32a13bf561 Update dependency jsdom to v15.1.0 2019-05-13 02:30:08 +00:00
Renovate Bot
d582e03743 Update dependency grunt to v1.0.4 2019-05-13 01:28:42 +00:00
Fabien O'Carroll
8728a677c5 Published new versions
- @tryghost/members-auth-pages@0.2.1
2019-05-08 11:47:13 +02:00
Fabien O'Carroll
1ae43a9ce0 Added blank.js to root of auth-pages
no-issue

This is so we have a valid js file for node require resolution
2019-05-08 11:45:33 +02:00
Fabien O'Carroll
497934bb6a Renamed app.js back to index.js
no-issue

Preact was having issues when the entrypoint wasn't named index.js
2019-05-08 11:43:13 +02:00
Fabien O'Carroll
fddc13bca1 Published new versions
- @tryghost/members-auth-pages@0.2.0
2019-05-07 18:09:44 +02:00
Fabien O'Carroll
00ed51f157 Added blank index.js file
no-issue

This is to ensure that node can correctly resolve the module
2019-05-07 18:08:37 +02:00
Fabien O'Carroll
4633ea06e4 Published new versions
- @tryghost/members-api@0.1.1
 - @tryghost/members-auth-pages@0.1.2
2019-05-07 17:40:25 +02:00
Fabien O'Carroll
9507aeb10f Published new versions
- @tryghost/members-auth-pages@0.1.1
2019-05-07 17:36:02 +02:00
Fabien O'Carroll
ac847dbecd Added default test dir and eslintrc
no-issue
2019-05-07 17:35:17 +02:00
Fabien O'Carroll
986791d091 Added package.json and deps for members-api
no-issue
2019-05-07 17:35:17 +02:00
Fabien O'Carroll
9e65199f14 Updated require paths for local modules
no-issue
2019-05-07 17:35:17 +02:00
Fabien O'Carroll
7ec3f61e71 Refactored directory structure
no-issue

This is to better fit the index.js, lib model
2019-05-07 17:35:17 +02:00
Fabien O'Carroll
7b6e73e093 Refactored lib/members to remove unused router
no-issue

Also exposes the getPublicKeys method
2019-05-07 17:35:17 +02:00
Fabien O'Carroll
2c9130a244 Removed serving of auth pages from lib/members
no-issue
2019-05-07 17:35:17 +02:00
Fabien O'Carroll
bf156b0b79 Removed auth pages from lib/members
no-issue

These have been moved to https://github.com:TryGhost/Members
2019-05-07 17:35:17 +02:00
Zimo
5101735f9d Updated members payment failed copy and style
no-issue
2019-05-07 17:35:17 +02:00
Fabien O'Carroll
79f31b7323 Updated token generation to use plans on member
no-issue

This is to remove duplication of logic, that now lives solely in the
getMember method
2019-05-07 17:35:17 +02:00
Fabien O'Carroll
239237f402 Updated getMember to return plans
no-issue

Plans are distinct from subscriptions, as in theory a subscription could
have many plans. These moves the construction of the plans array into
the getMember function so that every consumer has access to the same
data.
2019-05-07 17:35:17 +02:00
Rish
618f7e35cc Updated signup flow to handle invalid payments
no issue
2019-05-07 17:35:17 +02:00
Fabien O'Carroll
371a0698a6 Fixed bug with deleting members after config change 2019-05-07 17:35:17 +02:00
Fabien O'Carroll
c1a85e8bc3 Updated members auth pages to use gateway-protocol (#10695)
no-issue

This swaps out a hand copied library with the published one on npm
2019-05-07 17:35:17 +02:00
Zimo
9e53c6332a Added close event on member pages background click 2019-05-07 17:35:17 +02:00
Peter Zimon
540977fcb8 Members refine buttons (#10692)
* Members: disabled signup button during signup

* Members: disabled non-Stripe signup button during signup

* Members: added check to Log in button logged in state
2019-05-07 17:35:17 +02:00
Zimo
d63127bcdc Updated mobile styles for members upgrade screen 2019-05-07 17:35:17 +02:00
Fabien O'Carroll
ac9daac9f2 Fixed subscription issue with null coupons
no-issue

Coupons were being sent as null to the api, so we support non required fields
2019-05-07 17:35:17 +02:00
Fabien O'Carroll
6e37c50ce7 Added default disabled state of false to FormInput
no-issue
2019-05-07 17:35:17 +02:00
Fabien O'Carroll
43d65d0709 Removed unused onClick handler in StripeSubscribePage
no-issue
2019-05-07 17:35:17 +02:00
Fabien O'Carroll
c1c13379c7 Added coupon support to StripeSubscribePage
no-issue

Only shows the (disabled) input when a coupon is available
2019-05-07 17:35:17 +02:00
Fabien O'Carroll
9a5abbbde2 Cleaned up render{Subscribe,Upgrade}Page
no-issue

- ensured promises are returned
- removed unused prop
2019-05-07 17:35:17 +02:00