0.1.23 • Published 2 years ago

@apiobuild/penny v0.1.23

Weekly downloads
34
License
ISC
Repository
github
Last release
2 years ago

Penny

Penny keeps penny in your wallet.

It's a js library for order calculation. It runs business logic, order validation checks and order submission flow.

It's designed to be imported with chopin static store page to run order calculations.

Getting Start

The library is written in babel7, cross compile into JS for publishing and serving.

Run And Test Locally

# will watch test
npm run test:watch
# will compile into js
npm run dev

# use npm link to test w/ chopin
npm link

Module Structures

Core business logic contains four components of the order:

  • Shipping Configuration
    • zip code validation against address
    • shipping options/price
    • free shipping threshold (free shipping over $xx)
  • Discount Configuration
    • SubtotalThresholdPercentDiscount: x% off over $xx
    • SubtotalThresholdDollarDiscount: $x off over $xx
  • Tax Configuration
    • tax rate (assume 0 when null)
  • Amounts Calculation
    • calculate subtotal based on items
    • calculate discount based on subtotal
    • calculate shipping based on subtotal - discount
    • calculate tax based on subtotal - discount + shipping
    • calculate total based on subtotal - discount + shipping + tax
  • Item Quantity Updates (check max_qty)
  • Order Validation
    • must purchase items
    • must have email
    • if zipcode validation enabled, address must be in zipcode validation
      • if zipcode validation enabled, must have address
    • if not qualify for free shipping and has shipping options, must select one
  • Order Submission
    • perform order validation
    • generate order payload
    • make post request to order submission api
    • enabled email confirmation if enabled
    • if paid with paypal
      • additional update

Release

To release a new version. On develop, run:

npm version xxx -m ""
git push && git push --tags
version=`node -p "require('./package.json').version"`
gren release --data-source commits -t v$version -d

Hosting

We publish to npm and all npm public packages are served on: https://www.jsdelivr.com/package/npm/@apiobuild/penny

0.1.23

2 years ago

0.1.22

3 years ago

0.1.20

3 years ago

0.1.18

3 years ago

0.1.19

3 years ago

0.1.16

3 years ago

0.1.17

3 years ago

0.1.15

3 years ago

0.1.14

3 years ago

0.1.13

3 years ago

0.1.12

3 years ago

0.1.10

3 years ago

0.1.11

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.2

3 years ago

0.1.3

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.45

3 years ago

0.0.45-3

3 years ago

0.0.45-2

3 years ago

0.0.45-1

3 years ago

0.0.45-0

3 years ago

0.0.44

3 years ago

0.0.43

4 years ago

0.0.42

4 years ago

0.0.41

4 years ago

0.0.40

4 years ago

0.0.37

4 years ago

0.0.39

4 years ago

0.0.36

4 years ago

0.0.35

4 years ago

0.0.34

4 years ago

0.0.30

4 years ago

0.0.31

4 years ago

0.0.32

4 years ago

0.0.33

4 years ago

0.0.29

4 years ago

0.0.28

4 years ago

0.0.25

4 years ago

0.0.26

4 years ago

0.0.27

4 years ago

0.0.24

4 years ago

0.0.23

4 years ago

0.0.22

4 years ago

0.0.19

4 years ago

0.0.16

4 years ago

0.0.18

4 years ago

0.0.15

4 years ago

0.0.14

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.0

4 years ago