Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
  dist
  package.json
  README.md
Size: Mime:
  README.md

lib-billing-client

API for using and managing premium subscriptions with Doodle.

:warning: :boom: THIS MODULE IS STILL A WIP and should ONLY BE USED for local development and automated testing in staging, preproduction and devboxes for now. Please do not bundle this module in your production apps until it has been properly vetted.

Modules

This library exports both CommonJS and ES modules via rollup.

Usage

In order to use this client library, your application needs to expose the following environment variables:

  • SVC_BILLING_BASE_URL is the base url for service billing
  • MONOLITH_API_BASE_URL is the base url for all monolith API calls
  • SUPER_USER_EMAIL Needed for tasks that only a superuser can perform
  • SUPER_USER_PASSWORD Needed for tasks that only a superuser can perform
# Staging: https://ambassador-stg.kubernetes.doodle-test.com/billing/v1
# Preprod: https://ambassador.doodle-test.com/billing/v1
SVC_BILLING_BASE_URL=

# Staging: https://ambassador-stg.doodle-test.com
# Preprod: https://ambassador.doodle-test.com
MONOLITH_API_BASE_URL=

# Needed only for some client utilities; e.g., permanent deletion of mandators
SUPER_USER_EMAIL=
SUPER_USER_PASSWORD=

Example

import { getAllSubscriptionsForUser } from '@doodle/billing-client';

(async () => {
  try {
    const subscriptions = await getAllSubscriptionsForUser('myAccessToken');
    console.log(subscriptions);
  } catch (error) {
    // Handle error
  }
})();

Development

If you want to develop this library, then you can:

  1. Run yarn run watch (to put rollup into watch mode)

When you are done developing locally:

  1. Stop the watch process that started after running yarn run watch with CTRL + C

Linking

If you want to test your development version in a local project:

  1. Run yarn link in the root directory of this library
  2. Run yarn link @doodle/billing-client in the project where you are importing this library

When you are done linking the local version:

  1. Run yarn unlink in the root directory of this library
  2. Run yarn unlink @doodle/billing-client in the project where you were importing this library
  3. Reinstall the dependencies in the project where you were importing this with yarn install --force

Install

$ yarn add @doodle/billing-client

Plans

For your reference, below is a list of all the subscriptions plans we use at Doodle. You can fetch all of these plans via the .getAllDoodlePlans() method. Simmilaly, if you need to look up a plan based on its planId, you can look it up with .getDoodlePlanById(planId: Number)

planId internalName chargebeeName
1 Business 1000 annual USD business-1000-annual-usd
2 Business 1000 annual CHF business-1000-annual-chf
3 Business 1000 annual EUR business-1000-annual-eur
4 Business 500 annual USD business-500-annual-usd
5 Business 500 annual CHF business-500-annual-chf
6 Business 500 annual EUR business-500-annual-eur
7 Business 250 annual USD business-250-annual-usd
8 Business 250 annual CHF business-250-annual-chf
9 Business 250 annual EUR business-250-annual-eur
10 Business 100 annual CHF business-100-annual-chf
11 Business 100 annual USD business-100-annual-usd
12 Business 100 annual EUR business-100-annual-eur
13 Business 50 annual USD business-50-annual-usd
14 Business 50 annual CHF business-50-annual-chf
15 Business 50 annual EUR business-50-annual-eur
16 Business 20 annual CHF business-20-annual-chf
17 Business 20 annual USD business-20-annual-usd
18 Business 20 annual EUR business-20-annual-eur
19 Business 10 annual CHF business-10-annual-chf
20 Business 10 annual USD business-10-annual-usd
21 Business 10 annual EUR business-10-annual-eur
22 Business 5 annual CHF business-5-annual-chf
23 Business 5 annual USD business-5-annual-usd02
24 Business 5 annual EUR business-5-annual-eur
25 Business 1 annual CHF business-1-annual-CHF
26 Business 1 annual USD business-1-annual
27 Business 1 annual EUR business-1-annual-eur
33 Private annual CHF private-annual-chf
34 Private annual USD private-annual
39 Private annual EUR private-annual-eur
41 Special annual CHF special-annual-chf
42 Special annual EUR special-annual-eur
43 Special annual USD special-annual-usd
44 Business 1000 monthly USD business-1000-monthly-usd
45 Business 1000 monthly CHF business-1000-monthly-chf
46 Business 1000 monthly EUR business-1000-monthly-eur
47 Business 500 monthly USD business-500-monthly-usd
48 Business 500 monthly CHF business-500-monthly-chf
49 Business 500 monthly EUR business-500-monthly-eur
50 Business 250 monthly USD business-250-monthly-usd
51 Business 250 monthly CHF business-250-monthly-chf
52 Business 250 monthly EUR business-250-monthly-eur
53 Business 100 monthly USD business-100-monthly-usd
54 Business 100 monthly CHF business-100-monthly-chf
55 Business 100 monthly EUR business-100-monthly-eur
56 Business 50 monthly USD business-50-monthly-usd
57 Business 50 monthly CHF business-50-monthly-chf
58 Business 50 monthly EUR business-50-monthly-eur
59 Business 20 monthly USD business-20-monthly-usd
60 Business 20 monthly CHF business-20-monthly-chf

Publish

This module uses TagFlow :tm: to publish. This means you just need to create tags with a special syntax: pub.<VERSION>

Example via the terminal (requires the repo to be cloned locally):

$ git tag pub.X.X.X
$ git push origin pub.X.X.X

where X.X.X represents the version number you want to release.

:bulb: You can still publish this TagFlow-enabled module without needing the repo cloned locally, simply use GitHub releases to create the tag using the same syntax: pub.X.X.X


:rainbow: :hamburger: