This is the server that handles payments.
This project uses Storybook to show each screen without requiring a full stack.
You can view the Storybook built from the most recent main at http://mozilla.github.io/fxa/fxa-payments-server/
In local development, yarn storybook
should start a Storybook server at http://localhost:6006 with hot module replacement to reflect live changes.
On Mac OS, yarn test
may trigger an EMFILE
error. In this case, to get tests running, you may need to brew install watchman
. (If the watchman postinstall step fails, follow the instructions here to change /usr/local
ownership from root to your user account.)
Create the following file: server/config/secrets.json
. It will not be tracked in Git.
Use the following as a template, and fill in your own values:
{
"stripe": {
"apiKey": "pk_test_123"
},
"paypal": {
"clientId": "sb"
}
}
apiKey
should be a test Stripe Publishable KeyclientId
should be a sandbox PayPal client ID. For local testing, the default value of "sb" should be sufficient.
This package uses Jest to test both the frontend and server. By default yarn test
will run all yarn test scripts:
yarn test:frontend
will test the React App frontend undersrc/
yarn test:server
will test the Express server underserver/
Test specific tests with the following commands:
# Test frontend tests for the component AlertBar
yarn test:frontend AlertBar
# Grep frontend tests for "renders as expected"
yarn test:frontend -t "renders as expected"
# Test server tests for the file server/lib/csp
yarn test:server server/lib/csp
# Grep server tests for "logs raw events"
yarn test:server -t "logs raw events"
Note that prior to testing you may need to create a build of the React App. You can do this by running yarn build
.
Refer to Jest's CLI documentation for more advanced test configuration.
MPL-2.0