Erick Engelhardt
This project demonstrates the use of a payment service with two different adapters: one for a legacy payment system and another for Stripe. It uses TypeScript for static typing and Jest for testing.
This repository is the example code for the article TypeScript Adapter Pattern.
src/: Contains the project source code.services/: Contains the payment service.adapters/: Contains adapters for different payment providers.vendor/: Contains payment SDK simulations.
__tests__/: Contains tests for the project.
- Node.js
- npm
-
Clone the repository:
git clone <REPOSITORY_URL> cd typescript-boilerplate
-
Install dependencies:
npm install
npm run build: Compiles the TypeScript project to JavaScript.npm start: Starts the project in development mode with automatic reloading.npm test: Runs tests using Jest.
To start the project in development mode, use:
npm startThis will run the index.ts file and simulate payments using the configured adapters.
To run the tests, use:
npm testThis will run all tests defined in the project using Jest.
This project is private and does not have a public license.