mozilla-payments-clientdeprecated

Modal window JS client for mozilla/payments

Usage no npm install needed!

<script type="module">
  import mozillaPaymentsClient from 'https://cdn.skypack.dev/mozilla-payments-client';
</script>

README

Build Status npm version devDependency Status

Sauce Test Status

Note: Sauce Labs tests are only run on PRs from the main repo or commits to master.

Payments Client

This is a JS client for making payments via mozilla payments.

Installation

npm install --save mozilla-payments-client

Development

You can run a lightweight server to host the bundled payments client which is useful for testing as a script on another site (such as the payments example site). This serves a distribution bundle but also re-builds the bundle any time a file changes.

Start the server like this:

grunt serve

Proxying with Charles

The example site uses a bundled version of the client library by default so one way to try out your edits on the example site is to re-route bundle requests to your locally served source code bundle using Charles Proxy.

To do this import the charles rewrite config (see the Charles directory) into the rewrite panel.

Manually swapping in a development bundle

Without Charles, you can run this command each time you change some code to keep the payments example site up to date:

grunt build && cp dist/payments-client.js /path/to/payments-example/public/lib/js/

Natually, you'd release and bump the example's client dependency to make your changes final.

Tests

To run the tests locally run: grunt test. This will run the unit tests against Firefox.

Cross-browser testing

The tests are run only on Firefox when a PR is submitted. When that code is landed on master, Travis will run the tests on Sauce Labs.

Running Sauce Labs on a PR [Team Only]

If you're a member of the payments team and you want to get Sauce Labs coverage for a PR - push the branch to the main mozilla/payments-client repo and make a PR from that.

Running the tests on SauceLabs locally

First Sign-up for a Sauce Labs 'Open Sauce' account to get your keys.

Then you'll need to export the SauceLabs username and access key as env vars:

export SAUCE_USERNAME=<YOUR_OPEN_SAUCE_USERNAME>
export SAUCE_ACCESS_KEY=<YOUR_ACCESS_KEY>

Then you should find you can run: grunt karma:sauce and run all the tests on SauceLabs.

Cutting a release

With all the changes you want already landed in master - here's the steps for cutting a new release:

  • Bump the version in package.json.
  • Commit it to master
  • Go to the releases page on github and hit "Draft a new release"
  • Use <VERSION> for both the tag and the release title. (The tag shouldn't already exist)
  • Add what's changed.
  • Hit "publish release" and the current rev of master will be tagged and the package will be pushed to npm automatically.