npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ms-taxes

v1.0.5

Published

Tax Microservice

Downloads

3

Readme

:toc: macro :toc-title: :toclevels: 99

ms-taxes image:https://travis-ci.com/Groupe-Atallah/ms-taxes.svg?token=y5pe7uGwsidVcw4pszW1&branch=v1["Build Status", link="https://travis-ci.com/Groupe-Atallah/ms-taxes"]

http://ac9c6f8e39fc311e7933702bb3bd0e5d-153786183.us-west-2.elb.amazonaws.com/docs/swagger[api reference] | https://todo[monitoring]

QA: https://rpm.newrelic.com/accounts/1410690/applications/72100340[monitoring]

toc::[]

About

The ms-taxes microservice is responsible for maintaining tax rates and applying trivial rules. For example some Canadian provinces work with a single sales tax that combines federal and provincial rates called the "Harmonized Sales Tax" or HST. ms-taxes takes care of this. However more involved rules like Quebec's compound taxation pre January 1 2013 are not handled. This is probably a missing feature. Refer to the first TODO below.

Features

  • Return the taxation rates for a given country and region (AKA sub-division).
  • Handle Canadian HST rules

Examples

❯ http "http://ac9c6f8e39fc311e7933702bb3bd0e5d-153786183.us-west-2.elb.amazonaws.com/rates?country=ca&region=qc"
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 97
Date: Mon, 25 Sep 2017 03:01:12 GMT
content-type: application/json; charset=utf-8

{
    "combinatedRate": 0.14975,
    "rates": [
        {
            "amount": 0.05,
            "name": "gst"
        },
        {
            "amount": 0.09975,
            "name": "pst"
        }
    ]
}
❯ http "http://ac9c6f8e39fc311e7933702bb3bd0e5d-153786183.us-west-2.elb.amazonaws.com/rates?country=ca&region=on"
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 62
Date: Mon, 25 Sep 2017 03:00:33 GMT
content-type: application/json; charset=utf-8

{
    "combinatedRate": 0.13,
    "rates": [
        {
            "amount": 0.13,
            "name": "hst"
        }
    ]
}

Design Principals

Although SSENSE does not collect sales tax in every country (or even every region in countries that it does collect federal tax), the client does not need to know this. The client need only provide a well formed country and region combination, and ms-taxes will return tax rates data. As SSENSE ceases to/begins to collect taxes in varying regions or countries, the client should not have to change.

TODOs

These are TODOs for the next engineering squad that works on this microservice.

. The current model only returns rates but does not handle applying them to a price. This means it falls onto the caller to know how to apply tax rates. In the above example about Quebec compound sales tax, the client would need to know this! It is currently envisioned that a parent aggregation layer (e.g. ag-fees) will sit in front of ms-taxes and ms-duties and coordinate their correct usage. Perhaps this layer could contain the knowledge of how to apply tax rates. Otherwise the API interface of ms-taxes must be significantly refactored to:

.. require the client price param .. calculate the amount to pay for each applicable tax rate

. Validate the tax rates of some countries since it is inconsistent between the database and HQM service result. It includes: Australia, China, Puerto Rico and Russia. Some comments can be found in TestData.ts.

. The quality of this micro-service is draft level, having gone through only a partial sprint of work from engineers unfamiliar with the conventions used in this project. We think another few days of refinement is necessary, and feel uncomfortable not being explicit about this.

. Get the test coverage higher.