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

@atomixdesign/nodepay-core

v0.12.0

Published

Nodepay core module.

Downloads

684

Readme

Build Status npm (scoped) GitHub issues

Nodepay

A payment gateway abstraction layer written in Typescript, taking inspiration from Omnipay & Active Merchant

Getting Started

The API follows the Strategy Pattern, where each gateway connector provides its own way to fulfill an API (addCustomer, updateCustomer, charge, etc).

import { Context } from '@atomixdesign/nodepay'
import { Strategy, Config, Customer, CreditCard } from '@atomixdesign/nodepay-ezidebit'

const config = new Config({
  // Add your own values obtained from the gateway here ->
  clientId: ...,
    digitalKey: ...,
    publicKey: ...,
    apiRoot: ...,
    nonPCIApiRoot: ...,
})
const ezidebitStrategy = new Strategy(config)
const gateway = new Context(ezidebitStrategy)

const creditCard = new CreditCard({
    /* CAUTION: When using card details this way,
	/* you need to make sure that your program meets PCI requirements.
	/* Find out more: https://bit.ly/2PvyxGM */
	cardNumber: ...,
    expiryDateMonth: ...,
    public expiryDateYear: ...,
    public CCV: ...,
    public cardHolderName: ...,
})

const customer = new Customer({
    customerId: ...,        // Generate for use with your own system
    contractStartDate: ..., // yyyy-MM-dd, see Ezidebit: https://bit.ly/3ibuZWo
    lastName: ...,
    ...
})

// Add customer
gateway.addCustomer(customer, creditCard /*, bankAccount */)

const onceOffCharge = new Charge({
  orderNumber: ...,
    amountInCents: ...,
    customerName: ...,
})

// Once-off charge. This doesn't need customer info.
gateway.charge(onceOffCharge, creditCard)

Reference

See https://nodepay.netlify.app/#/

Tooling

This is the base monorepo for @atomixdesign/nodepay projects. The following npm scripts are available. Whenever possible, the scripts are designed to run standalone from inside a package, or from the project root with the same or similar configuration. For example, yarn build && yarn test

yarn build

Builds each dependency, with precedence to nodepay-core

yarn test

Runs full tests (unit and api integration) asynchronously against each api. Env vars must be configured.

yarn reset

Removes all build artifacts and all dependencies. Effectively resets the monorepo to clean slate.

yarn clean

Clean compiled outputs + artifacts.

  • yarn clean:deps

    Remove node_modules at top-level and in all nodepay packages.

  • yarn clean:artifacts

    Clean build artifacts and dependencies, but leave compiled outputs (build files and caches).

  • yarn clean:build

    Clean compiled outputs.

yarn cli

In-built cli, with starter template for gateway connector (needs update).

Usage: yarn cli <command> [options]

Commands:
  nodepay-cli adapter:create  Create an adapter for a payment gateway
                                                                   [aliases: c]

Options:
  --version  Show version number                                      [boolean]
  --help     Show help                                                [boolean]

yarn docs

Generate and aggregate documentation for all packages.

yarn lint

Run lint for each package.

yarn publish:dev

Publish packages locally. For use with sinopia, verdaccio or a local repo.