From 84dcb10ff9453a3f1239f52305aecf81f9825be2 Mon Sep 17 00:00:00 2001 From: Charlie Zhang Date: Fri, 31 Dec 2021 20:43:42 -0500 Subject: [PATCH] Create method for fetching card limits --- package.json | 2 +- resources/cards.ts | 6 +++++- types/cards.ts | 22 ++++++++++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 43f53d88..2b2c513c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@highbeam/unit-node-sdk", - "version": "0.8.11", + "version": "0.8.12", "description": "", "main": "dist/unit.js", "types": "dist/unit.d.ts", diff --git a/resources/cards.ts b/resources/cards.ts index ba73061b..5de28c69 100644 --- a/resources/cards.ts +++ b/resources/cards.ts @@ -1,4 +1,4 @@ -import { Card, CreateDebitCardRequest, ReplaceCardRequest } from "../types/cards" +import { Card, CardLimits, CreateDebitCardRequest, ReplaceCardRequest } from "../types/cards" import { Include, UnitConfig, UnitResponse } from "../types/common" import { Customer } from "../types/customer" import { Account } from "../types/account" @@ -73,6 +73,10 @@ export class Cards extends BaseResource { return this.httpGet & Include>("", { params: parameters }) } + + public async limits(id: string) : Promise> { + return this.httpGet>(`/${id}/limits`) + } } export interface CardListParams { diff --git a/types/cards.ts b/types/cards.ts index 48d2dd84..60e688c1 100644 --- a/types/cards.ts +++ b/types/cards.ts @@ -519,4 +519,26 @@ export interface ReplaceCardRequest { shippingAddress?: Address } +export interface CardLimits { + type: "limits" + attributes: { + limits: { + dailyWithdrawal: number + dailyPurchase: number + monthlyWithdrawal: number + monthlyPurchase: number + } + dailyTotals: { + withdrawals: number + deposits: number + purchases: number + } + monthlyTotals: { + withdrawals: number + deposits: number + purchases: number + } + } +} +