@dime-technology/dime-js-sdk 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +118 -30
- package/dist/index.cjs +732 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +289 -54
- package/dist/index.d.ts +289 -54
- package/dist/index.js +724 -50
- package/dist/index.js.map +1 -1
- package/package.json +9 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const DEFAULT_BASE_URL = "https://app.dimepayments.com";
|
|
2
|
-
declare const VERSION = "1.
|
|
2
|
+
declare const VERSION = "1.2.0";
|
|
3
3
|
interface ConfigOptions {
|
|
4
4
|
/** Sanctum personal access token (sent as Bearer). */
|
|
5
5
|
token: string;
|
|
@@ -28,7 +28,7 @@ declare class Config {
|
|
|
28
28
|
baseUri(): string;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
type Raw$
|
|
31
|
+
type Raw$w = Record<string, unknown>;
|
|
32
32
|
declare class Address {
|
|
33
33
|
readonly id?: number | undefined;
|
|
34
34
|
readonly recipient?: string | undefined;
|
|
@@ -39,14 +39,14 @@ declare class Address {
|
|
|
39
39
|
readonly state?: string | undefined;
|
|
40
40
|
readonly zip?: string | undefined;
|
|
41
41
|
constructor(id?: number | undefined, recipient?: string | undefined, lineOne?: string | undefined, lineTwo?: string | undefined, lineThree?: string | undefined, city?: string | undefined, state?: string | undefined, zip?: string | undefined);
|
|
42
|
-
static fromRaw(data: Raw$
|
|
42
|
+
static fromRaw(data: Raw$w): Address;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
type Raw$
|
|
45
|
+
type Raw$v = Record<string, unknown>;
|
|
46
46
|
declare class MessageResult {
|
|
47
47
|
readonly message?: string | undefined;
|
|
48
48
|
constructor(message?: string | undefined);
|
|
49
|
-
static fromRaw(data: Raw$
|
|
49
|
+
static fromRaw(data: Raw$v): MessageResult;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
type PageFetcher<T> = (cursor: string) => Promise<CursorPage<T>>;
|
|
@@ -66,7 +66,7 @@ declare class CursorPage<T> {
|
|
|
66
66
|
get length(): number;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
type Raw$
|
|
69
|
+
type Raw$u = Record<string, unknown>;
|
|
70
70
|
declare class Transport {
|
|
71
71
|
private readonly config;
|
|
72
72
|
private readonly fetchFn;
|
|
@@ -75,36 +75,38 @@ declare class Transport {
|
|
|
75
75
|
/**
|
|
76
76
|
* Execute a request and return the decoded JSON body.
|
|
77
77
|
*
|
|
78
|
-
* The Dime API
|
|
79
|
-
*
|
|
80
|
-
*
|
|
78
|
+
* The Dime API reads the same `{ data, filters }` envelope whether it arrives
|
|
79
|
+
* as a JSON body or as nested query parameters. The Fetch standard forbids a
|
|
80
|
+
* body on GET/HEAD (undici throws), so for those methods the envelope is
|
|
81
|
+
* serialised into the query string (`data[sid]=…&filters[status]=…`) and no
|
|
82
|
+
* body is sent; every other method sends the envelope as a JSON body.
|
|
81
83
|
*/
|
|
82
|
-
request(method: string, path: string, body?: Raw$
|
|
84
|
+
request(method: string, path: string, body?: Raw$u, query?: Record<string, string>): Promise<Raw$u>;
|
|
83
85
|
private attempt;
|
|
84
86
|
private sleep;
|
|
85
87
|
}
|
|
86
88
|
|
|
87
|
-
type Raw$
|
|
89
|
+
type Raw$t = Record<string, unknown>;
|
|
88
90
|
declare abstract class AbstractResource {
|
|
89
91
|
protected readonly transport: Transport;
|
|
90
92
|
constructor(transport: Transport);
|
|
91
93
|
/**
|
|
92
94
|
* Build the standard Dime request envelope, dropping null/undefined values.
|
|
93
95
|
*/
|
|
94
|
-
protected envelope(data?: Raw$
|
|
95
|
-
protected paginate<T>(method: string, path: string, body: Raw$
|
|
96
|
+
protected envelope(data?: Raw$t, filters?: Raw$t): Raw$t;
|
|
97
|
+
protected paginate<T>(method: string, path: string, body: Raw$t, map: (item: Raw$t) => T, query?: Record<string, string>): Promise<CursorPage<T>>;
|
|
96
98
|
}
|
|
97
99
|
|
|
98
|
-
type Raw$
|
|
100
|
+
type Raw$s = Record<string, unknown>;
|
|
99
101
|
declare class Addresses extends AbstractResource {
|
|
100
102
|
list(sid: string, uuid: string): Promise<CursorPage<Address>>;
|
|
101
103
|
show(sid: string, uuid: string, addressId: number | string): Promise<Address>;
|
|
102
|
-
create(sid: string, uuid: string, attributes: Raw$
|
|
103
|
-
update(sid: string, uuid: string, addressId: number | string, attributes: Raw$
|
|
104
|
+
create(sid: string, uuid: string, attributes: Raw$s): Promise<Address>;
|
|
105
|
+
update(sid: string, uuid: string, addressId: number | string, attributes: Raw$s): Promise<Address>;
|
|
104
106
|
delete(sid: string, uuid: string, addressId: number | string): Promise<MessageResult>;
|
|
105
107
|
}
|
|
106
108
|
|
|
107
|
-
type Raw$
|
|
109
|
+
type Raw$r = Record<string, unknown>;
|
|
108
110
|
declare class Customer {
|
|
109
111
|
readonly uuid?: string | undefined;
|
|
110
112
|
readonly firstName?: string | undefined;
|
|
@@ -119,19 +121,19 @@ declare class Customer {
|
|
|
119
121
|
readonly zip?: string | undefined;
|
|
120
122
|
readonly country?: string | undefined;
|
|
121
123
|
constructor(uuid?: string | undefined, firstName?: string | undefined, lastName?: string | undefined, phone?: string | undefined, email?: string | undefined, addr1?: string | undefined, addr2?: string | undefined, addr3?: string | undefined, city?: string | undefined, state?: string | undefined, zip?: string | undefined, country?: string | undefined);
|
|
122
|
-
static fromRaw(data: Raw$
|
|
124
|
+
static fromRaw(data: Raw$r): Customer;
|
|
123
125
|
}
|
|
124
126
|
|
|
125
|
-
type Raw$
|
|
127
|
+
type Raw$q = Record<string, unknown>;
|
|
126
128
|
declare class Customers extends AbstractResource {
|
|
127
|
-
list(sid: string, filters?: Raw$
|
|
128
|
-
show(sid: string, filters: Raw$
|
|
129
|
-
create(sid: string, attributes: Raw$
|
|
130
|
-
update(sid: string, filters: Raw$
|
|
131
|
-
delete(sid: string, filters: Raw$
|
|
129
|
+
list(sid: string, filters?: Raw$q): Promise<CursorPage<Customer>>;
|
|
130
|
+
show(sid: string, filters: Raw$q): Promise<Customer>;
|
|
131
|
+
create(sid: string, attributes: Raw$q): Promise<Customer>;
|
|
132
|
+
update(sid: string, filters: Raw$q, attributes: Raw$q): Promise<Customer>;
|
|
133
|
+
delete(sid: string, filters: Raw$q): Promise<MessageResult>;
|
|
132
134
|
}
|
|
133
135
|
|
|
134
|
-
type Raw$
|
|
136
|
+
type Raw$p = Record<string, unknown>;
|
|
135
137
|
declare class Deposit {
|
|
136
138
|
readonly transactionDate?: string | undefined;
|
|
137
139
|
readonly fundDate?: string | undefined;
|
|
@@ -143,10 +145,10 @@ declare class Deposit {
|
|
|
143
145
|
readonly sweepId?: string | undefined;
|
|
144
146
|
readonly type?: string | undefined;
|
|
145
147
|
constructor(transactionDate?: string | undefined, fundDate?: string | undefined, transactionInfoId?: string | undefined, transactionId?: string | undefined, transactionDetailAccount?: string | undefined, authorizationAmount?: string | undefined, netAmount?: string | undefined, sweepId?: string | undefined, type?: string | undefined);
|
|
146
|
-
static fromRaw(data: Raw$
|
|
148
|
+
static fromRaw(data: Raw$p): Deposit;
|
|
147
149
|
}
|
|
148
150
|
|
|
149
|
-
type Raw$
|
|
151
|
+
type Raw$o = Record<string, unknown>;
|
|
150
152
|
declare class TransactionAddress {
|
|
151
153
|
readonly firstName?: string | undefined;
|
|
152
154
|
readonly lastName?: string | undefined;
|
|
@@ -156,10 +158,10 @@ declare class TransactionAddress {
|
|
|
156
158
|
readonly state?: string | undefined;
|
|
157
159
|
readonly zip?: string | undefined;
|
|
158
160
|
constructor(firstName?: string | undefined, lastName?: string | undefined, addr1?: string | undefined, addr2?: string | undefined, city?: string | undefined, state?: string | undefined, zip?: string | undefined);
|
|
159
|
-
static fromRaw(data: Raw$
|
|
161
|
+
static fromRaw(data: Raw$o): TransactionAddress;
|
|
160
162
|
}
|
|
161
163
|
|
|
162
|
-
type Raw$
|
|
164
|
+
type Raw$n = Record<string, unknown>;
|
|
163
165
|
declare class Transaction {
|
|
164
166
|
readonly transactionType?: string | undefined;
|
|
165
167
|
readonly transactionStatus?: string | undefined;
|
|
@@ -182,10 +184,10 @@ declare class Transaction {
|
|
|
182
184
|
readonly billingAddress: TransactionAddress;
|
|
183
185
|
readonly shippingAddress: TransactionAddress;
|
|
184
186
|
constructor(transactionType?: string | undefined, transactionStatus?: string | undefined, transactionStatusDescription?: string | undefined, transactionNumber?: string | undefined, transactionDate?: string | undefined, fundDate?: string | undefined, settleDate?: string | undefined, amount?: string | undefined, description?: string | undefined, statusCode?: string | undefined, statusText?: string | undefined, email?: string | undefined, phone?: string | undefined, customerUuid?: string | undefined, multiUseToken?: string | undefined, pending?: boolean, transactionInfoId?: string | undefined, parentTransactionInfoId?: string | undefined, billingAddress?: TransactionAddress, shippingAddress?: TransactionAddress);
|
|
185
|
-
static fromRaw(data: Raw$
|
|
187
|
+
static fromRaw(data: Raw$n): Transaction;
|
|
186
188
|
}
|
|
187
189
|
|
|
188
|
-
type Raw$
|
|
190
|
+
type Raw$m = Record<string, unknown>;
|
|
189
191
|
declare class DepositWithTransactions {
|
|
190
192
|
readonly sid?: string | undefined;
|
|
191
193
|
readonly transactionInfoId?: string | undefined;
|
|
@@ -197,33 +199,214 @@ declare class DepositWithTransactions {
|
|
|
197
199
|
readonly transTotal?: string | undefined;
|
|
198
200
|
readonly transactions: Transaction[];
|
|
199
201
|
constructor(sid?: string | undefined, transactionInfoId?: string | undefined, transactionId?: string | undefined, transactionDate?: string | undefined, fundDate?: string | undefined, type?: string | undefined, countOfTransactions?: number | undefined, transTotal?: string | undefined, transactions?: Transaction[]);
|
|
200
|
-
static fromRaw(data: Raw$
|
|
202
|
+
static fromRaw(data: Raw$m): DepositWithTransactions;
|
|
201
203
|
}
|
|
202
204
|
|
|
203
|
-
type Raw$
|
|
205
|
+
type Raw$l = Record<string, unknown>;
|
|
204
206
|
declare class DepositGroup {
|
|
205
207
|
readonly sid?: string | undefined;
|
|
206
208
|
readonly count?: number | undefined;
|
|
207
209
|
readonly deposits: DepositWithTransactions[];
|
|
208
210
|
constructor(sid?: string | undefined, count?: number | undefined, deposits?: DepositWithTransactions[]);
|
|
209
|
-
static fromRaw(data: Raw$
|
|
211
|
+
static fromRaw(data: Raw$l): DepositGroup;
|
|
210
212
|
}
|
|
211
213
|
|
|
212
|
-
type Raw$
|
|
214
|
+
type Raw$k = Record<string, unknown>;
|
|
213
215
|
declare class Deposits extends AbstractResource {
|
|
214
|
-
list(sid: string, filters?: Raw$
|
|
215
|
-
listWithTransactions(sid: string, filters: Raw$
|
|
216
|
-
show(sid: string, identifier: Raw$
|
|
216
|
+
list(sid: string, filters?: Raw$k): Promise<CursorPage<Deposit>>;
|
|
217
|
+
listWithTransactions(sid: string, filters: Raw$k): Promise<DepositGroup>;
|
|
218
|
+
show(sid: string, identifier: Raw$k): Promise<DepositWithTransactions>;
|
|
217
219
|
}
|
|
218
220
|
|
|
219
|
-
type Raw$
|
|
221
|
+
type Raw$j = Record<string, unknown>;
|
|
222
|
+
declare class InvoiceCustomer {
|
|
223
|
+
readonly id?: number | undefined;
|
|
224
|
+
readonly name?: string | undefined;
|
|
225
|
+
readonly email?: string | undefined;
|
|
226
|
+
constructor(id?: number | undefined, name?: string | undefined, email?: string | undefined);
|
|
227
|
+
static fromRaw(data: Raw$j): InvoiceCustomer;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
type Raw$i = Record<string, unknown>;
|
|
231
|
+
declare class InvoiceEvent {
|
|
232
|
+
readonly type?: string | undefined;
|
|
233
|
+
readonly label?: string | undefined;
|
|
234
|
+
readonly description?: string | undefined;
|
|
235
|
+
readonly createdAt?: string | undefined;
|
|
236
|
+
constructor(type?: string | undefined, label?: string | undefined, description?: string | undefined, createdAt?: string | undefined);
|
|
237
|
+
static fromRaw(data: Raw$i): InvoiceEvent;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
type Raw$h = Record<string, unknown>;
|
|
241
|
+
declare class InvoiceLineItem {
|
|
242
|
+
readonly id?: number | undefined;
|
|
243
|
+
readonly itemId?: number | undefined;
|
|
244
|
+
readonly name?: string | undefined;
|
|
245
|
+
readonly description?: string | undefined;
|
|
246
|
+
readonly quantity?: string | undefined;
|
|
247
|
+
readonly unitPrice?: string | undefined;
|
|
248
|
+
readonly amount?: string | undefined;
|
|
249
|
+
constructor(id?: number | undefined, itemId?: number | undefined, name?: string | undefined, description?: string | undefined, quantity?: string | undefined, unitPrice?: string | undefined, amount?: string | undefined);
|
|
250
|
+
static fromRaw(data: Raw$h): InvoiceLineItem;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
type Raw$g = Record<string, unknown>;
|
|
254
|
+
declare class InvoicePayment {
|
|
255
|
+
readonly amount?: string | undefined;
|
|
256
|
+
readonly paidAt?: string | undefined;
|
|
257
|
+
readonly method?: string | undefined;
|
|
258
|
+
readonly transactionId?: string | undefined;
|
|
259
|
+
constructor(amount?: string | undefined, paidAt?: string | undefined, method?: string | undefined, transactionId?: string | undefined);
|
|
260
|
+
static fromRaw(data: Raw$g): InvoicePayment;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
type Raw$f = Record<string, unknown>;
|
|
264
|
+
declare class Invoice {
|
|
265
|
+
readonly id?: number | undefined;
|
|
266
|
+
readonly invoiceNumber?: string | undefined;
|
|
267
|
+
readonly status?: string | undefined;
|
|
268
|
+
readonly token?: string | undefined;
|
|
269
|
+
readonly paymentTerms?: string | undefined;
|
|
270
|
+
readonly issueDate?: string | undefined;
|
|
271
|
+
readonly dueDate?: string | undefined;
|
|
272
|
+
readonly isOverdue: boolean;
|
|
273
|
+
readonly subtotal?: string | undefined;
|
|
274
|
+
readonly total?: string | undefined;
|
|
275
|
+
readonly amountPaid?: string | undefined;
|
|
276
|
+
readonly balance?: string | undefined;
|
|
277
|
+
readonly allowPartialPayment: boolean;
|
|
278
|
+
readonly thankYouNote?: string | undefined;
|
|
279
|
+
readonly customerName?: string | undefined;
|
|
280
|
+
readonly customerEmail?: string | undefined;
|
|
281
|
+
readonly publicUrl?: string | undefined;
|
|
282
|
+
readonly customer: InvoiceCustomer;
|
|
283
|
+
readonly items: InvoiceLineItem[];
|
|
284
|
+
readonly payments: InvoicePayment[];
|
|
285
|
+
readonly events: InvoiceEvent[];
|
|
286
|
+
constructor(id?: number | undefined, invoiceNumber?: string | undefined, status?: string | undefined, token?: string | undefined, paymentTerms?: string | undefined, issueDate?: string | undefined, dueDate?: string | undefined, isOverdue?: boolean, subtotal?: string | undefined, total?: string | undefined, amountPaid?: string | undefined, balance?: string | undefined, allowPartialPayment?: boolean, thankYouNote?: string | undefined, customerName?: string | undefined, customerEmail?: string | undefined, publicUrl?: string | undefined, customer?: InvoiceCustomer, items?: InvoiceLineItem[], payments?: InvoicePayment[], events?: InvoiceEvent[]);
|
|
287
|
+
static fromRaw(data: Raw$f): Invoice;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
type Raw$e = Record<string, unknown>;
|
|
291
|
+
declare class InvoiceItem {
|
|
292
|
+
readonly id?: number | undefined;
|
|
293
|
+
readonly name?: string | undefined;
|
|
294
|
+
readonly description?: string | undefined;
|
|
295
|
+
readonly price?: string | undefined;
|
|
296
|
+
readonly taxDeductible: boolean;
|
|
297
|
+
constructor(id?: number | undefined, name?: string | undefined, description?: string | undefined, price?: string | undefined, taxDeductible?: boolean);
|
|
298
|
+
static fromRaw(data: Raw$e): InvoiceItem;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
type Raw$d = Record<string, unknown>;
|
|
302
|
+
declare class InvoiceLink {
|
|
303
|
+
readonly publicUrl?: string | undefined;
|
|
304
|
+
readonly token?: string | undefined;
|
|
305
|
+
constructor(publicUrl?: string | undefined, token?: string | undefined);
|
|
306
|
+
static fromRaw(data: Raw$d): InvoiceLink;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
type Raw$c = Record<string, unknown>;
|
|
310
|
+
/**
|
|
311
|
+
* Invoice endpoints.
|
|
312
|
+
*
|
|
313
|
+
* Identify the customer with `customer_uuid` — the same identifier the customer,
|
|
314
|
+
* payment-method and address endpoints use, and the only one `Customer` exposes.
|
|
315
|
+
* `customer_id` remains accepted for integrations written against the original
|
|
316
|
+
* contract; supply exactly one.
|
|
317
|
+
*
|
|
318
|
+
* Line-item mutations return the refreshed invoice so the caller sees
|
|
319
|
+
* recalculated totals rather than a detached fragment.
|
|
320
|
+
*/
|
|
321
|
+
declare class Invoices extends AbstractResource {
|
|
322
|
+
/**
|
|
323
|
+
* List invoices for a merchant.
|
|
324
|
+
*
|
|
325
|
+
* @param filters `status` — draft | sent | paid | partial | void | overdue
|
|
326
|
+
*/
|
|
327
|
+
list(sid: string, filters?: Raw$c): Promise<CursorPage<Invoice>>;
|
|
328
|
+
show(sid: string, invoiceId: number | string): Promise<Invoice>;
|
|
329
|
+
/**
|
|
330
|
+
* Create a draft invoice with its line items. Every line must reference a
|
|
331
|
+
* Merchant `item_id`; the line name and unit price are snapshotted.
|
|
332
|
+
*
|
|
333
|
+
* @param attributes
|
|
334
|
+
* `customer_uuid` (or `customer_id`), `customer_name`, `customer_email`,
|
|
335
|
+
* `payment_terms` (`due_on_receipt` | `net_15` | `net_30` | `net_60`) and
|
|
336
|
+
* `lines` are required. `lines[]` takes `item_id`, `name`, `quantity`,
|
|
337
|
+
* `unit_price` and optional `description`. Optional: `invoice_number`,
|
|
338
|
+
* `issue_date` (Y-m-d, defaults to today — `due_date` is derived from
|
|
339
|
+
* `payment_terms`), `thank_you_note`, `allow_partial_payment`,
|
|
340
|
+
* `reminder_settings`.
|
|
341
|
+
*/
|
|
342
|
+
create(sid: string, attributes: Raw$c): Promise<Invoice>;
|
|
343
|
+
/**
|
|
344
|
+
* Update a draft invoice. Only drafts can be edited, and passing `lines`
|
|
345
|
+
* replaces the existing line items.
|
|
346
|
+
*
|
|
347
|
+
* @param attributes same shape as {@link Invoices.create}
|
|
348
|
+
*/
|
|
349
|
+
update(sid: string, invoiceId: number | string, attributes: Raw$c): Promise<Invoice>;
|
|
350
|
+
delete(sid: string, invoiceId: number | string): Promise<MessageResult>;
|
|
351
|
+
/** Email the invoice to the customer and advance it to Sent. */
|
|
352
|
+
send(sid: string, invoiceId: number | string): Promise<Invoice>;
|
|
353
|
+
/** Activate a draft invoice for payment without emailing it. */
|
|
354
|
+
markSent(sid: string, invoiceId: number | string): Promise<Invoice>;
|
|
355
|
+
void(sid: string, invoiceId: number | string): Promise<Invoice>;
|
|
356
|
+
/** Clone any invoice into a new draft with a freshly allocated number. */
|
|
357
|
+
duplicate(sid: string, invoiceId: number | string): Promise<Invoice>;
|
|
358
|
+
/**
|
|
359
|
+
* Record a merchant-initiated (MOTO) card or ACH payment against an open
|
|
360
|
+
* invoice.
|
|
361
|
+
*
|
|
362
|
+
* @param attributes
|
|
363
|
+
* `payment_type` is required and is `cc` or `ach`. For a card, pass a stored
|
|
364
|
+
* `token` or raw `cardholder_name` / `card_number` / `expiration_date` (m/Y)
|
|
365
|
+
* plus optional `cvv`; for ACH, pass `routing_number` / `account_number` /
|
|
366
|
+
* `account_type` (Checking | Savings) / `account_name`. Omit `amount` to pay
|
|
367
|
+
* the full balance — partial amounts require the invoice to allow them.
|
|
368
|
+
* Optional: `memo`, `billing_address`.
|
|
369
|
+
*/
|
|
370
|
+
pay(sid: string, invoiceId: number | string, attributes: Raw$c): Promise<Invoice>;
|
|
371
|
+
/** Get the public pay link (and token) for an invoice. */
|
|
372
|
+
getLink(sid: string, invoiceId: number | string): Promise<InvoiceLink>;
|
|
373
|
+
/**
|
|
374
|
+
* Append a single line item to a draft invoice.
|
|
375
|
+
*
|
|
376
|
+
* @param attributes `item_id`, `name`, `quantity` and `unit_price` are
|
|
377
|
+
* required; `description` is optional.
|
|
378
|
+
*/
|
|
379
|
+
addLineItem(sid: string, invoiceId: number | string, attributes: Raw$c): Promise<Invoice>;
|
|
380
|
+
/**
|
|
381
|
+
* Update a single line item on a draft invoice.
|
|
382
|
+
*
|
|
383
|
+
* @param attributes any of `item_id`, `name`, `description`, `quantity`,
|
|
384
|
+
* `unit_price`
|
|
385
|
+
*/
|
|
386
|
+
updateLineItem(sid: string, invoiceId: number | string, lineItemId: number | string, attributes: Raw$c): Promise<Invoice>;
|
|
387
|
+
/** Remove a single line item from a draft invoice. */
|
|
388
|
+
deleteLineItem(sid: string, invoiceId: number | string, lineItemId: number | string): Promise<Invoice>;
|
|
389
|
+
/** List the Merchant's items (funds/designations) available as invoice line items. */
|
|
390
|
+
listItems(sid: string): Promise<InvoiceItem[]>;
|
|
391
|
+
/**
|
|
392
|
+
* Create an invoicing-only item (fund/designation) for the Merchant. The item
|
|
393
|
+
* is hidden from public giving pages and can be referenced as a line's
|
|
394
|
+
* `item_id`.
|
|
395
|
+
*
|
|
396
|
+
* @param attributes `name` is required; `description`, `price` and
|
|
397
|
+
* `tax_deductible` are optional.
|
|
398
|
+
*/
|
|
399
|
+
createItem(sid: string, attributes: Raw$c): Promise<InvoiceItem>;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
type Raw$b = Record<string, unknown>;
|
|
220
403
|
declare class FormLink {
|
|
221
404
|
readonly link?: string | undefined;
|
|
222
405
|
constructor(link?: string | undefined);
|
|
223
|
-
static fromRaw(data: Raw$
|
|
406
|
+
static fromRaw(data: Raw$b): FormLink;
|
|
224
407
|
}
|
|
225
408
|
|
|
226
|
-
type Raw$
|
|
409
|
+
type Raw$a = Record<string, unknown>;
|
|
227
410
|
declare class Merchant {
|
|
228
411
|
readonly name?: string | undefined;
|
|
229
412
|
readonly sid?: string | undefined;
|
|
@@ -247,19 +430,19 @@ declare class Merchant {
|
|
|
247
430
|
readonly primaryEmail?: string | undefined;
|
|
248
431
|
readonly primaryName?: string | undefined;
|
|
249
432
|
constructor(name?: string | undefined, sid?: string | undefined, mcc?: string | undefined, slug?: string | undefined, pubApiKey?: string | undefined, processorMid?: string | undefined, active?: boolean, activeAt?: string | undefined, gPay?: boolean, aPay?: boolean, pciCompliance?: boolean, website?: string | undefined, addr1?: string | undefined, addr2?: string | undefined, city?: string | undefined, state?: string | undefined, zip?: string | undefined, phone?: string | undefined, primaryPhone?: string | undefined, primaryEmail?: string | undefined, primaryName?: string | undefined);
|
|
250
|
-
static fromRaw(data: Raw$
|
|
433
|
+
static fromRaw(data: Raw$a): Merchant;
|
|
251
434
|
}
|
|
252
435
|
|
|
253
|
-
type Raw$
|
|
436
|
+
type Raw$9 = Record<string, unknown>;
|
|
254
437
|
declare class Merchants extends AbstractResource {
|
|
255
|
-
list(filters?: Raw$
|
|
438
|
+
list(filters?: Raw$9): Promise<CursorPage<Merchant>>;
|
|
256
439
|
show(sid: string): Promise<Merchant>;
|
|
257
|
-
create(attributes: Raw$
|
|
258
|
-
update(sid: string, attributes: Raw$
|
|
440
|
+
create(attributes: Raw$9): Promise<Merchant>;
|
|
441
|
+
update(sid: string, attributes: Raw$9): Promise<Merchant>;
|
|
259
442
|
getFormLink(sid: string): Promise<FormLink>;
|
|
260
443
|
}
|
|
261
444
|
|
|
262
|
-
type Raw$
|
|
445
|
+
type Raw$8 = Record<string, unknown>;
|
|
263
446
|
declare class PaymentMethod {
|
|
264
447
|
readonly id?: number | undefined;
|
|
265
448
|
readonly type?: string | undefined;
|
|
@@ -287,18 +470,68 @@ declare class PaymentMethod {
|
|
|
287
470
|
readonly state?: string | undefined;
|
|
288
471
|
readonly zip?: string | undefined;
|
|
289
472
|
constructor(id?: number | undefined, type?: string | undefined, token?: string | undefined, firstName?: string | undefined, lastName?: string | undefined, ccNameOnCard?: string | undefined, ccLastFour?: string | undefined, ccExpirationDate?: string | undefined, ccBrand?: string | undefined, achBankAccountName?: string | undefined, achRoutingNumber?: string | undefined, achAccountNumber?: string | undefined, achOwnershipType?: string | undefined, achAccountType?: string | undefined, achBankName?: string | undefined, status?: string | undefined, statusDate?: string | undefined, enabled?: boolean, isDefault?: boolean, addr1?: string | undefined, addr2?: string | undefined, addr3?: string | undefined, city?: string | undefined, state?: string | undefined, zip?: string | undefined);
|
|
290
|
-
static fromRaw(data: Raw$
|
|
473
|
+
static fromRaw(data: Raw$8): PaymentMethod;
|
|
291
474
|
}
|
|
292
475
|
|
|
293
|
-
type Raw$
|
|
476
|
+
type Raw$7 = Record<string, unknown>;
|
|
294
477
|
declare class PaymentMethods extends AbstractResource {
|
|
295
|
-
list(sid: string, filters: Raw$
|
|
296
|
-
show(sid: string, paymentMethodId: number | string, filters: Raw$
|
|
297
|
-
create(sid: string, attributes: Raw$
|
|
298
|
-
update(sid: string, attributes: Raw$
|
|
478
|
+
list(sid: string, filters: Raw$7): Promise<CursorPage<PaymentMethod>>;
|
|
479
|
+
show(sid: string, paymentMethodId: number | string, filters: Raw$7): Promise<PaymentMethod>;
|
|
480
|
+
create(sid: string, attributes: Raw$7): Promise<PaymentMethod>;
|
|
481
|
+
update(sid: string, attributes: Raw$7): Promise<PaymentMethod>;
|
|
299
482
|
delete(sid: string, paymentMethodId: number | string, uuid: string): Promise<MessageResult>;
|
|
300
483
|
}
|
|
301
484
|
|
|
485
|
+
type Raw$6 = Record<string, unknown>;
|
|
486
|
+
declare class RecurringInvoice {
|
|
487
|
+
readonly id?: number | undefined;
|
|
488
|
+
readonly status?: string | undefined;
|
|
489
|
+
readonly recurrenceSchedule?: string | undefined;
|
|
490
|
+
readonly paymentTerms?: string | undefined;
|
|
491
|
+
readonly startDate?: string | undefined;
|
|
492
|
+
readonly endDate?: string | undefined;
|
|
493
|
+
readonly nextRunDate?: string | undefined;
|
|
494
|
+
readonly lastRunDate?: string | undefined;
|
|
495
|
+
readonly customerName?: string | undefined;
|
|
496
|
+
readonly thankYouNote?: string | undefined;
|
|
497
|
+
readonly customer: InvoiceCustomer;
|
|
498
|
+
readonly items: InvoiceLineItem[];
|
|
499
|
+
readonly upcomingRunDates: string[];
|
|
500
|
+
readonly invoices: Invoice[];
|
|
501
|
+
constructor(id?: number | undefined, status?: string | undefined, recurrenceSchedule?: string | undefined, paymentTerms?: string | undefined, startDate?: string | undefined, endDate?: string | undefined, nextRunDate?: string | undefined, lastRunDate?: string | undefined, customerName?: string | undefined, thankYouNote?: string | undefined, customer?: InvoiceCustomer, items?: InvoiceLineItem[], upcomingRunDates?: string[], invoices?: Invoice[]);
|
|
502
|
+
static fromRaw(data: Raw$6): RecurringInvoice;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
type Raw$5 = Record<string, unknown>;
|
|
506
|
+
/**
|
|
507
|
+
* Recurring-invoice templates, which generate and send an invoice on a schedule.
|
|
508
|
+
*
|
|
509
|
+
* Identify the customer with `customer_uuid`; `customer_id` remains accepted.
|
|
510
|
+
*/
|
|
511
|
+
declare class RecurringInvoices extends AbstractResource {
|
|
512
|
+
/**
|
|
513
|
+
* List recurring-invoice templates.
|
|
514
|
+
*
|
|
515
|
+
* @param filters `status` — Active | Paused | Cancelled | Completed
|
|
516
|
+
*/
|
|
517
|
+
list(sid: string, filters?: Raw$5): Promise<CursorPage<RecurringInvoice>>;
|
|
518
|
+
show(sid: string, recurringInvoiceId: number | string): Promise<RecurringInvoice>;
|
|
519
|
+
/**
|
|
520
|
+
* Create a recurring-invoice template. When `recurring_start_date` is today the
|
|
521
|
+
* first invoice is generated and sent immediately.
|
|
522
|
+
*
|
|
523
|
+
* @param attributes
|
|
524
|
+
* `customer_uuid` (or `customer_id`), `payment_terms` (`due_on_receipt` |
|
|
525
|
+
* `net_15` | `net_30` | `net_60`), `recurring_frequency` (`Weekly` |
|
|
526
|
+
* `Biweekly` | `FirstFifteenth` | `Monthly` | `Yearly`),
|
|
527
|
+
* `recurring_start_date` (Y-m-d) and `lines` are required. Optional:
|
|
528
|
+
* `recurring_end_date` (Y-m-d, on or after the start date),
|
|
529
|
+
* `thank_you_note`.
|
|
530
|
+
*/
|
|
531
|
+
create(sid: string, attributes: Raw$5): Promise<RecurringInvoice>;
|
|
532
|
+
cancel(sid: string, recurringInvoiceId: number | string): Promise<RecurringInvoice>;
|
|
533
|
+
}
|
|
534
|
+
|
|
302
535
|
type Raw$4 = Record<string, unknown>;
|
|
303
536
|
declare class RecurringPaymentMethod {
|
|
304
537
|
readonly id?: number | undefined;
|
|
@@ -391,6 +624,8 @@ declare class Client {
|
|
|
391
624
|
readonly addresses: Addresses;
|
|
392
625
|
readonly deposits: Deposits;
|
|
393
626
|
readonly recurringPayments: RecurringPayments;
|
|
627
|
+
readonly invoices: Invoices;
|
|
628
|
+
readonly recurringInvoices: RecurringInvoices;
|
|
394
629
|
private readonly _config;
|
|
395
630
|
constructor(token: string | Config, baseUrl?: string);
|
|
396
631
|
config(): Config;
|
|
@@ -435,4 +670,4 @@ declare class ServerException extends DimeException {
|
|
|
435
670
|
declare class ConnectionException extends DimeException {
|
|
436
671
|
}
|
|
437
672
|
|
|
438
|
-
export { Address, ApiException, AuthenticationException, Client, Config, ConnectionException, CursorPage, Customer, DEFAULT_BASE_URL, Deposit, DepositGroup, DepositWithTransactions, DimeException, FormLink, Merchant, MessageResult, NotFoundException, PaymentMethod, PermissionDeniedException, RateLimitException, RecurringPayment, RecurringPaymentMethod, ServerException, TokenizeResult, Transaction, TransactionAddress, VERSION, ValidationException };
|
|
673
|
+
export { Address, ApiException, AuthenticationException, Client, Config, ConnectionException, CursorPage, Customer, DEFAULT_BASE_URL, Deposit, DepositGroup, DepositWithTransactions, DimeException, FormLink, Invoice, InvoiceCustomer, InvoiceEvent, InvoiceItem, InvoiceLineItem, InvoiceLink, InvoicePayment, Merchant, MessageResult, NotFoundException, PaymentMethod, PermissionDeniedException, RateLimitException, RecurringInvoice, RecurringPayment, RecurringPaymentMethod, ServerException, TokenizeResult, Transaction, TransactionAddress, VERSION, ValidationException };
|