# @stockpile/greendot-sdk

> Stockpile package for greendot sdk

Latest version **1.131.0** (published 2024-04-09) · ISC license · 0 weekly downloads

## Install

```sh
npm install @stockpile/greendot-sdk
pnpm add @stockpile/greendot-sdk
yarn add @stockpile/greendot-sdk
bun add @stockpile/greendot-sdk
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.131.0 |
| Published | 2024-04-09 |
| First published | 2024-03-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 52.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | ram-sp |

## Links

- npm: https://www.npmjs.com/package/@stockpile/greendot-sdk
- npm.io page: https://npm.io/package/@stockpile/greendot-sdk

## Dependencies (1)

- [ec-key](https://npm.io/package/ec-key.md) ^0.0.4

## Recent versions

- 1.131.0 (latest) — 2024-04-09
- 1.130.0 — 2024-04-04
- 1.129.0 — 2024-04-04
- 1.128.0 — 2024-04-04
- 1.127.0 — 2024-04-04
- 1.126.0 — 2024-04-01
- 1.125.0 — 2024-04-01
- 1.121.0 — 2024-03-27
- 1.120.0 — 2024-03-27
- 1.115.0 — 2024-03-27
- 1.113.0 — 2024-03-27
- 1.112.0 — 2024-03-26
- 1.111.0 — 2024-03-26
- 1.110.0 — 2024-03-26
- 1.109.0 — 2024-03-26
- … 27 more at https://npm.io/package/@stockpile/greendot-sdk/versions

## README

## Greendot SDK Package


## How to use

## Method 1 (recommended)
```ts
import { getClients } from "@stockpile/greendot-sdk";

const config = {
  baseUrl: "https://aws-bass.greendot.com/baas/v1",
	username: "your-username",
	password: "your-password",
	programCode: "my-company-program-code",
	timeoutMs: 3000,
	envType: "PIE",
	spkiPublicKey: "public-key-for-encryption",
};
const clients = getClients(config);
// Ideally, store the clients object globally and initialize once on server start...
const {  baseClient,  cardClient,  accountClient,  purseClient,  transactionClient,  userClient } = clients;
// 2. use the client are per requirement
const transactions = await transactionClient.getTransactions({accountId: "123"});
```

## Method 2
In method 1, we initialized all clients, we can initialize only the required client
```ts
import { GreendotBaseClient, GreendotTransactionClient } from "@stockpile/greendot-sdk";

const baseClient = new GreendotBaseClient(config);
const transactionClient = new GreendotTransactionClient({ baseClient })
```

## DOCUMENTATION

### Account Client
1. `searchAccounts`: Search Accounts by mobile, date-of-birth, email or ssn
2. `getAccountDetails`: Get details of account like accountNumber, routingNumber, accountStatus and user, Information about user includes name, last 4 digit of identity and kyc statuses
3. `getLinkedAccounts`: Returns minimal information about linked accounts
	- for parent accountId - returns parent-child link for all children
	- for child accountId - returns one parent-child link
4. `getLinkedAccountsInfo`: Returns information about linked accounts in detail same as getAccountDetails
	- for parent accountId - returns parent-child link for all children
	- for child accountId - returns one parent-child link

### Card Client
1. `getCards`: Get all cards for a given greendot accountIdentifier
2. `getCard`: Get card details for given accountId and cardId(paymentInstrumentIdentifier)
3. `setPin`: Set PIN for physical card ?
4. `getCardDeliveryStatus`: Returns the delivery status of physical card
5. `pauseCard`: Pause card to block all card actions
6. `unpauseCard`: Unpause an paused card
7. `replaceCard`: Replace card when the current card is stolen, lost, damaged or fraud transaction.
8. `getReplaceCardEligibility`: Check if a card can be replaced
9. `activateCard`: Activate a physical card
10. `validateCardCvv`: Validate Card CVV ?
		
### Enrollment Client
1. `getAccountDetailsWithCards`: Returns account details like routing number, account number along with account users and their details as well as their purses and cards(payment instruments)

### Purse Client
1. `getPurses`: Returns all purses of a greendot account

### Transaction Client
1. `getTransactions`: Returns transactions for an account, this function has many filters to choose from like 
 	- startDate: string;
  - endDate?: string
  - limit?: number
  - purseIdentifier?: string
  - transactionType?: TransactionType
  - transactionStatus?: TransactionStatus

2. `getPaginatedTransactions`: Returns transactions for an account, and following filters
	- limit: number;
  - offset?: number
  - purseIdentifier?: string

### User Client
1. `getAccountUsers`: Returns list of users for an account along with their details
2. `validateUserSsn`: Validate account`s user SSN ?

---
_Source: https://npm.io/package/@stockpile/greendot-sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
