@dime-technology/dime-js-sdk 1.0.0 → 1.3.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 +160 -30
- package/dist/index.cjs +791 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +344 -54
- package/dist/index.d.ts +344 -54
- package/dist/index.js +782 -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.3.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$x = 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$x): Address;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
type Raw$
|
|
45
|
+
type Raw$w = 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$w): 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$v = 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$v, query?: Record<string, string>): Promise<Raw$v>;
|
|
83
85
|
private attempt;
|
|
84
86
|
private sleep;
|
|
85
87
|
}
|
|
86
88
|
|
|
87
|
-
type Raw$
|
|
89
|
+
type Raw$u = 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$u, filters?: Raw$u): Raw$u;
|
|
97
|
+
protected paginate<T>(method: string, path: string, body: Raw$u, map: (item: Raw$u) => T, query?: Record<string, string>): Promise<CursorPage<T>>;
|
|
96
98
|
}
|
|
97
99
|
|
|
98
|
-
type Raw$
|
|
100
|
+
type Raw$t = 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$t): Promise<Address>;
|
|
105
|
+
update(sid: string, uuid: string, addressId: number | string, attributes: Raw$t): Promise<Address>;
|
|
104
106
|
delete(sid: string, uuid: string, addressId: number | string): Promise<MessageResult>;
|
|
105
107
|
}
|
|
106
108
|
|
|
107
|
-
type Raw$
|
|
109
|
+
type Raw$s = 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$s): Customer;
|
|
123
125
|
}
|
|
124
126
|
|
|
125
|
-
type Raw$
|
|
127
|
+
type Raw$r = 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$r): Promise<CursorPage<Customer>>;
|
|
130
|
+
show(sid: string, filters: Raw$r): Promise<Customer>;
|
|
131
|
+
create(sid: string, attributes: Raw$r): Promise<Customer>;
|
|
132
|
+
update(sid: string, filters: Raw$r, attributes: Raw$r): Promise<Customer>;
|
|
133
|
+
delete(sid: string, filters: Raw$r): Promise<MessageResult>;
|
|
132
134
|
}
|
|
133
135
|
|
|
134
|
-
type Raw$
|
|
136
|
+
type Raw$q = 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$q): Deposit;
|
|
147
149
|
}
|
|
148
150
|
|
|
149
|
-
type Raw$
|
|
151
|
+
type Raw$p = 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$p): TransactionAddress;
|
|
160
162
|
}
|
|
161
163
|
|
|
162
|
-
type Raw$
|
|
164
|
+
type Raw$o = 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$o): Transaction;
|
|
186
188
|
}
|
|
187
189
|
|
|
188
|
-
type Raw$
|
|
190
|
+
type Raw$n = Record<string, unknown>;
|
|
189
191
|
declare class DepositWithTransactions {
|
|
190
192
|
readonly sid?: string | undefined;
|
|
191
193
|
readonly transactionInfoId?: string | undefined;
|
|
@@ -197,33 +199,265 @@ 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$n): DepositWithTransactions;
|
|
201
203
|
}
|
|
202
204
|
|
|
203
|
-
type Raw$
|
|
205
|
+
type Raw$m = 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$m): DepositGroup;
|
|
210
212
|
}
|
|
211
213
|
|
|
212
|
-
type Raw$
|
|
214
|
+
type Raw$l = 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$l): Promise<CursorPage<Deposit>>;
|
|
217
|
+
listWithTransactions(sid: string, filters: Raw$l): Promise<DepositGroup>;
|
|
218
|
+
show(sid: string, identifier: Raw$l): Promise<DepositWithTransactions>;
|
|
217
219
|
}
|
|
218
220
|
|
|
219
|
-
type Raw$
|
|
221
|
+
type Raw$k = Record<string, unknown>;
|
|
222
|
+
/**
|
|
223
|
+
* The processing fee a cover-fee invoice adds on top of what the customer pays,
|
|
224
|
+
* quoted for both payment methods.
|
|
225
|
+
*
|
|
226
|
+
* Present on an {@link Invoice} only when `coverFeeRequired` is true. The fee is
|
|
227
|
+
* NOT a line item and is NOT part of the invoice's `total`: the merchant is owed
|
|
228
|
+
* `total`, and the customer is charged `total` plus this fee. Card and ACH rates
|
|
229
|
+
* differ, so the amount depends on how the customer chooses to pay — `ccTotal` is
|
|
230
|
+
* the higher of the two and what the invoice and its emails lead with.
|
|
231
|
+
*
|
|
232
|
+
* `basis` names what the quote was computed against — currently always `balance`,
|
|
233
|
+
* the amount still outstanding. Paying a partial amount re-quotes the fee against
|
|
234
|
+
* that amount, so treat these as a quote for settling in full today rather than a
|
|
235
|
+
* fixed charge.
|
|
236
|
+
*
|
|
237
|
+
* Monetary values are kept as strings to avoid float rounding.
|
|
238
|
+
*/
|
|
239
|
+
declare class CoverFeeQuote {
|
|
240
|
+
readonly basis?: string | undefined;
|
|
241
|
+
readonly base?: string | undefined;
|
|
242
|
+
readonly ccFee?: string | undefined;
|
|
243
|
+
readonly ccTotal?: string | undefined;
|
|
244
|
+
readonly achFee?: string | undefined;
|
|
245
|
+
readonly achTotal?: string | undefined;
|
|
246
|
+
constructor(basis?: string | undefined, base?: string | undefined, ccFee?: string | undefined, ccTotal?: string | undefined, achFee?: string | undefined, achTotal?: string | undefined);
|
|
247
|
+
static fromRaw(data: Raw$k): CoverFeeQuote;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
type Raw$j = Record<string, unknown>;
|
|
251
|
+
declare class InvoiceCustomer {
|
|
252
|
+
readonly id?: number | undefined;
|
|
253
|
+
readonly name?: string | undefined;
|
|
254
|
+
readonly email?: string | undefined;
|
|
255
|
+
constructor(id?: number | undefined, name?: string | undefined, email?: string | undefined);
|
|
256
|
+
static fromRaw(data: Raw$j): InvoiceCustomer;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
type Raw$i = Record<string, unknown>;
|
|
260
|
+
declare class InvoiceEvent {
|
|
261
|
+
readonly type?: string | undefined;
|
|
262
|
+
readonly label?: string | undefined;
|
|
263
|
+
readonly description?: string | undefined;
|
|
264
|
+
readonly createdAt?: string | undefined;
|
|
265
|
+
constructor(type?: string | undefined, label?: string | undefined, description?: string | undefined, createdAt?: string | undefined);
|
|
266
|
+
static fromRaw(data: Raw$i): InvoiceEvent;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
type Raw$h = Record<string, unknown>;
|
|
270
|
+
declare class InvoiceLineItem {
|
|
271
|
+
readonly id?: number | undefined;
|
|
272
|
+
readonly itemId?: number | undefined;
|
|
273
|
+
readonly name?: string | undefined;
|
|
274
|
+
readonly description?: string | undefined;
|
|
275
|
+
readonly quantity?: string | undefined;
|
|
276
|
+
readonly unitPrice?: string | undefined;
|
|
277
|
+
readonly amount?: string | undefined;
|
|
278
|
+
constructor(id?: number | undefined, itemId?: number | undefined, name?: string | undefined, description?: string | undefined, quantity?: string | undefined, unitPrice?: string | undefined, amount?: string | undefined);
|
|
279
|
+
static fromRaw(data: Raw$h): InvoiceLineItem;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
type Raw$g = Record<string, unknown>;
|
|
283
|
+
/**
|
|
284
|
+
* A payment recorded against an invoice.
|
|
285
|
+
*
|
|
286
|
+
* `amount` is what was credited to the invoice; `coverFee` is the processing fee
|
|
287
|
+
* charged on top of it, so `amount + coverFee` is what the customer actually paid.
|
|
288
|
+
* It is zero unless the invoice required the customer to cover fees.
|
|
289
|
+
*/
|
|
290
|
+
declare class InvoicePayment {
|
|
291
|
+
readonly amount?: string | undefined;
|
|
292
|
+
readonly paidAt?: string | undefined;
|
|
293
|
+
readonly method?: string | undefined;
|
|
294
|
+
readonly transactionId?: string | undefined;
|
|
295
|
+
readonly coverFee?: string | undefined;
|
|
296
|
+
constructor(amount?: string | undefined, paidAt?: string | undefined, method?: string | undefined, transactionId?: string | undefined, coverFee?: string | undefined);
|
|
297
|
+
static fromRaw(data: Raw$g): InvoicePayment;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
type Raw$f = Record<string, unknown>;
|
|
301
|
+
declare class Invoice {
|
|
302
|
+
readonly id?: number | undefined;
|
|
303
|
+
readonly invoiceNumber?: string | undefined;
|
|
304
|
+
readonly status?: string | undefined;
|
|
305
|
+
readonly token?: string | undefined;
|
|
306
|
+
readonly paymentTerms?: string | undefined;
|
|
307
|
+
readonly issueDate?: string | undefined;
|
|
308
|
+
readonly dueDate?: string | undefined;
|
|
309
|
+
readonly isOverdue: boolean;
|
|
310
|
+
readonly subtotal?: string | undefined;
|
|
311
|
+
readonly total?: string | undefined;
|
|
312
|
+
readonly amountPaid?: string | undefined;
|
|
313
|
+
readonly balance?: string | undefined;
|
|
314
|
+
readonly allowPartialPayment: boolean;
|
|
315
|
+
readonly thankYouNote?: string | undefined;
|
|
316
|
+
readonly customerName?: string | undefined;
|
|
317
|
+
readonly customerEmail?: string | undefined;
|
|
318
|
+
readonly publicUrl?: string | undefined;
|
|
319
|
+
readonly customer: InvoiceCustomer;
|
|
320
|
+
readonly items: InvoiceLineItem[];
|
|
321
|
+
readonly payments: InvoicePayment[];
|
|
322
|
+
readonly events: InvoiceEvent[];
|
|
323
|
+
readonly coverFeeRequired: boolean;
|
|
324
|
+
readonly coverFeeQuote?: CoverFeeQuote | undefined;
|
|
325
|
+
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[], coverFeeRequired?: boolean, coverFeeQuote?: CoverFeeQuote | undefined);
|
|
326
|
+
static fromRaw(data: Raw$f): Invoice;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
type Raw$e = Record<string, unknown>;
|
|
330
|
+
declare class InvoiceItem {
|
|
331
|
+
readonly id?: number | undefined;
|
|
332
|
+
readonly name?: string | undefined;
|
|
333
|
+
readonly description?: string | undefined;
|
|
334
|
+
readonly price?: string | undefined;
|
|
335
|
+
readonly taxDeductible: boolean;
|
|
336
|
+
constructor(id?: number | undefined, name?: string | undefined, description?: string | undefined, price?: string | undefined, taxDeductible?: boolean);
|
|
337
|
+
static fromRaw(data: Raw$e): InvoiceItem;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
type Raw$d = Record<string, unknown>;
|
|
341
|
+
declare class InvoiceLink {
|
|
342
|
+
readonly publicUrl?: string | undefined;
|
|
343
|
+
readonly token?: string | undefined;
|
|
344
|
+
constructor(publicUrl?: string | undefined, token?: string | undefined);
|
|
345
|
+
static fromRaw(data: Raw$d): InvoiceLink;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
type Raw$c = Record<string, unknown>;
|
|
349
|
+
/**
|
|
350
|
+
* Invoice endpoints.
|
|
351
|
+
*
|
|
352
|
+
* Identify the customer with `customer_uuid` — the same identifier the customer,
|
|
353
|
+
* payment-method and address endpoints use, and the only one `Customer` exposes.
|
|
354
|
+
* `customer_id` remains accepted for integrations written against the original
|
|
355
|
+
* contract; supply exactly one.
|
|
356
|
+
*
|
|
357
|
+
* Line-item mutations return the refreshed invoice so the caller sees
|
|
358
|
+
* recalculated totals rather than a detached fragment.
|
|
359
|
+
*/
|
|
360
|
+
declare class Invoices extends AbstractResource {
|
|
361
|
+
/**
|
|
362
|
+
* List invoices for a merchant.
|
|
363
|
+
*
|
|
364
|
+
* @param filters `status` — draft | sent | paid | partial | void | overdue
|
|
365
|
+
*/
|
|
366
|
+
list(sid: string, filters?: Raw$c): Promise<CursorPage<Invoice>>;
|
|
367
|
+
show(sid: string, invoiceId: number | string): Promise<Invoice>;
|
|
368
|
+
/**
|
|
369
|
+
* Create a draft invoice with its line items. Every line must reference a
|
|
370
|
+
* Merchant `item_id`; the line name and unit price are snapshotted.
|
|
371
|
+
*
|
|
372
|
+
* @param attributes
|
|
373
|
+
* `customer_uuid` (or `customer_id`), `customer_name`, `customer_email`,
|
|
374
|
+
* `payment_terms` (`due_on_receipt` | `net_15` | `net_30` | `net_60`) and
|
|
375
|
+
* `lines` are required. `lines[]` takes `item_id`, `name`, `quantity`,
|
|
376
|
+
* `unit_price` and optional `description`. Optional: `invoice_number`,
|
|
377
|
+
* `issue_date` (Y-m-d, defaults to today — `due_date` is derived from
|
|
378
|
+
* `payment_terms`), `thank_you_note`, `allow_partial_payment`,
|
|
379
|
+
* `cover_fee_required`, `reminder_settings`.
|
|
380
|
+
*
|
|
381
|
+
* Set `cover_fee_required` to make the customer pay the processing fee. The
|
|
382
|
+
* fee is added on top of the invoice at payment time rather than becoming a
|
|
383
|
+
* line item, so `total` stays the amount owed to the merchant — read
|
|
384
|
+
* `invoice.coverFeeQuote` for what the customer will actually be charged.
|
|
385
|
+
* Omitting the field inherits the merchant's invoice setting.
|
|
386
|
+
*/
|
|
387
|
+
create(sid: string, attributes: Raw$c): Promise<Invoice>;
|
|
388
|
+
/**
|
|
389
|
+
* Update a draft invoice. Only drafts can be edited, and passing `lines`
|
|
390
|
+
* replaces the existing line items.
|
|
391
|
+
*
|
|
392
|
+
* @param attributes same shape as {@link Invoices.create}
|
|
393
|
+
*/
|
|
394
|
+
update(sid: string, invoiceId: number | string, attributes: Raw$c): Promise<Invoice>;
|
|
395
|
+
delete(sid: string, invoiceId: number | string): Promise<MessageResult>;
|
|
396
|
+
/** Email the invoice to the customer and advance it to Sent. */
|
|
397
|
+
send(sid: string, invoiceId: number | string): Promise<Invoice>;
|
|
398
|
+
/** Activate a draft invoice for payment without emailing it. */
|
|
399
|
+
markSent(sid: string, invoiceId: number | string): Promise<Invoice>;
|
|
400
|
+
void(sid: string, invoiceId: number | string): Promise<Invoice>;
|
|
401
|
+
/** Clone any invoice into a new draft with a freshly allocated number. */
|
|
402
|
+
duplicate(sid: string, invoiceId: number | string): Promise<Invoice>;
|
|
403
|
+
/**
|
|
404
|
+
* Record a merchant-initiated (MOTO) card or ACH payment against an open
|
|
405
|
+
* invoice.
|
|
406
|
+
*
|
|
407
|
+
* @param attributes
|
|
408
|
+
* `payment_type` is required and is `cc` or `ach`. For a card, pass a stored
|
|
409
|
+
* `token` or raw `cardholder_name` / `card_number` / `expiration_date` (m/Y)
|
|
410
|
+
* plus optional `cvv`; for ACH, pass `routing_number` / `account_number` /
|
|
411
|
+
* `account_type` (Checking | Savings) / `account_name`. Omit `amount` to pay
|
|
412
|
+
* the full balance — partial amounts require the invoice to allow them.
|
|
413
|
+
* Optional: `memo`, `billing_address`.
|
|
414
|
+
*
|
|
415
|
+
* On a cover-fee invoice the processing fee for `payment_type` is charged on
|
|
416
|
+
* top of `amount`, so the card or bank account is debited more than the
|
|
417
|
+
* invoice is credited. The fee lands as `coverFee` on the matching entry in
|
|
418
|
+
* `invoice.payments`. Card and ACH rates differ, so the same `amount` settles
|
|
419
|
+
* differently per `payment_type`.
|
|
420
|
+
*/
|
|
421
|
+
pay(sid: string, invoiceId: number | string, attributes: Raw$c): Promise<Invoice>;
|
|
422
|
+
/** Get the public pay link (and token) for an invoice. */
|
|
423
|
+
getLink(sid: string, invoiceId: number | string): Promise<InvoiceLink>;
|
|
424
|
+
/**
|
|
425
|
+
* Append a single line item to a draft invoice.
|
|
426
|
+
*
|
|
427
|
+
* @param attributes `item_id`, `name`, `quantity` and `unit_price` are
|
|
428
|
+
* required; `description` is optional.
|
|
429
|
+
*/
|
|
430
|
+
addLineItem(sid: string, invoiceId: number | string, attributes: Raw$c): Promise<Invoice>;
|
|
431
|
+
/**
|
|
432
|
+
* Update a single line item on a draft invoice.
|
|
433
|
+
*
|
|
434
|
+
* @param attributes any of `item_id`, `name`, `description`, `quantity`,
|
|
435
|
+
* `unit_price`
|
|
436
|
+
*/
|
|
437
|
+
updateLineItem(sid: string, invoiceId: number | string, lineItemId: number | string, attributes: Raw$c): Promise<Invoice>;
|
|
438
|
+
/** Remove a single line item from a draft invoice. */
|
|
439
|
+
deleteLineItem(sid: string, invoiceId: number | string, lineItemId: number | string): Promise<Invoice>;
|
|
440
|
+
/** List the Merchant's items (funds/designations) available as invoice line items. */
|
|
441
|
+
listItems(sid: string): Promise<InvoiceItem[]>;
|
|
442
|
+
/**
|
|
443
|
+
* Create an invoicing-only item (fund/designation) for the Merchant. The item
|
|
444
|
+
* is hidden from public giving pages and can be referenced as a line's
|
|
445
|
+
* `item_id`.
|
|
446
|
+
*
|
|
447
|
+
* @param attributes `name` is required; `description`, `price` and
|
|
448
|
+
* `tax_deductible` are optional.
|
|
449
|
+
*/
|
|
450
|
+
createItem(sid: string, attributes: Raw$c): Promise<InvoiceItem>;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
type Raw$b = Record<string, unknown>;
|
|
220
454
|
declare class FormLink {
|
|
221
455
|
readonly link?: string | undefined;
|
|
222
456
|
constructor(link?: string | undefined);
|
|
223
|
-
static fromRaw(data: Raw$
|
|
457
|
+
static fromRaw(data: Raw$b): FormLink;
|
|
224
458
|
}
|
|
225
459
|
|
|
226
|
-
type Raw$
|
|
460
|
+
type Raw$a = Record<string, unknown>;
|
|
227
461
|
declare class Merchant {
|
|
228
462
|
readonly name?: string | undefined;
|
|
229
463
|
readonly sid?: string | undefined;
|
|
@@ -247,19 +481,19 @@ declare class Merchant {
|
|
|
247
481
|
readonly primaryEmail?: string | undefined;
|
|
248
482
|
readonly primaryName?: string | undefined;
|
|
249
483
|
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$
|
|
484
|
+
static fromRaw(data: Raw$a): Merchant;
|
|
251
485
|
}
|
|
252
486
|
|
|
253
|
-
type Raw$
|
|
487
|
+
type Raw$9 = Record<string, unknown>;
|
|
254
488
|
declare class Merchants extends AbstractResource {
|
|
255
|
-
list(filters?: Raw$
|
|
489
|
+
list(filters?: Raw$9): Promise<CursorPage<Merchant>>;
|
|
256
490
|
show(sid: string): Promise<Merchant>;
|
|
257
|
-
create(attributes: Raw$
|
|
258
|
-
update(sid: string, attributes: Raw$
|
|
491
|
+
create(attributes: Raw$9): Promise<Merchant>;
|
|
492
|
+
update(sid: string, attributes: Raw$9): Promise<Merchant>;
|
|
259
493
|
getFormLink(sid: string): Promise<FormLink>;
|
|
260
494
|
}
|
|
261
495
|
|
|
262
|
-
type Raw$
|
|
496
|
+
type Raw$8 = Record<string, unknown>;
|
|
263
497
|
declare class PaymentMethod {
|
|
264
498
|
readonly id?: number | undefined;
|
|
265
499
|
readonly type?: string | undefined;
|
|
@@ -287,18 +521,72 @@ declare class PaymentMethod {
|
|
|
287
521
|
readonly state?: string | undefined;
|
|
288
522
|
readonly zip?: string | undefined;
|
|
289
523
|
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$
|
|
524
|
+
static fromRaw(data: Raw$8): PaymentMethod;
|
|
291
525
|
}
|
|
292
526
|
|
|
293
|
-
type Raw$
|
|
527
|
+
type Raw$7 = Record<string, unknown>;
|
|
294
528
|
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$
|
|
529
|
+
list(sid: string, filters: Raw$7): Promise<CursorPage<PaymentMethod>>;
|
|
530
|
+
show(sid: string, paymentMethodId: number | string, filters: Raw$7): Promise<PaymentMethod>;
|
|
531
|
+
create(sid: string, attributes: Raw$7): Promise<PaymentMethod>;
|
|
532
|
+
update(sid: string, attributes: Raw$7): Promise<PaymentMethod>;
|
|
299
533
|
delete(sid: string, paymentMethodId: number | string, uuid: string): Promise<MessageResult>;
|
|
300
534
|
}
|
|
301
535
|
|
|
536
|
+
type Raw$6 = Record<string, unknown>;
|
|
537
|
+
declare class RecurringInvoice {
|
|
538
|
+
readonly id?: number | undefined;
|
|
539
|
+
readonly status?: string | undefined;
|
|
540
|
+
readonly recurrenceSchedule?: string | undefined;
|
|
541
|
+
readonly paymentTerms?: string | undefined;
|
|
542
|
+
readonly startDate?: string | undefined;
|
|
543
|
+
readonly endDate?: string | undefined;
|
|
544
|
+
readonly nextRunDate?: string | undefined;
|
|
545
|
+
readonly lastRunDate?: string | undefined;
|
|
546
|
+
readonly customerName?: string | undefined;
|
|
547
|
+
readonly thankYouNote?: string | undefined;
|
|
548
|
+
readonly customer: InvoiceCustomer;
|
|
549
|
+
readonly items: InvoiceLineItem[];
|
|
550
|
+
readonly upcomingRunDates: string[];
|
|
551
|
+
readonly invoices: Invoice[];
|
|
552
|
+
readonly coverFeeRequired: boolean;
|
|
553
|
+
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[], coverFeeRequired?: boolean);
|
|
554
|
+
static fromRaw(data: Raw$6): RecurringInvoice;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
type Raw$5 = Record<string, unknown>;
|
|
558
|
+
/**
|
|
559
|
+
* Recurring-invoice templates, which generate and send an invoice on a schedule.
|
|
560
|
+
*
|
|
561
|
+
* Identify the customer with `customer_uuid`; `customer_id` remains accepted.
|
|
562
|
+
*/
|
|
563
|
+
declare class RecurringInvoices extends AbstractResource {
|
|
564
|
+
/**
|
|
565
|
+
* List recurring-invoice templates.
|
|
566
|
+
*
|
|
567
|
+
* @param filters `status` — Active | Paused | Cancelled | Completed
|
|
568
|
+
*/
|
|
569
|
+
list(sid: string, filters?: Raw$5): Promise<CursorPage<RecurringInvoice>>;
|
|
570
|
+
show(sid: string, recurringInvoiceId: number | string): Promise<RecurringInvoice>;
|
|
571
|
+
/**
|
|
572
|
+
* Create a recurring-invoice template. When `recurring_start_date` is today the
|
|
573
|
+
* first invoice is generated and sent immediately.
|
|
574
|
+
*
|
|
575
|
+
* @param attributes
|
|
576
|
+
* `customer_uuid` (or `customer_id`), `payment_terms` (`due_on_receipt` |
|
|
577
|
+
* `net_15` | `net_30` | `net_60`), `recurring_frequency` (`Weekly` |
|
|
578
|
+
* `Biweekly` | `FirstFifteenth` | `Monthly` | `Yearly`),
|
|
579
|
+
* `recurring_start_date` (Y-m-d) and `lines` are required. Optional:
|
|
580
|
+
* `recurring_end_date` (Y-m-d, on or after the start date),
|
|
581
|
+
* `thank_you_note`.
|
|
582
|
+
*
|
|
583
|
+
* `cover_fee_required` makes the customer cover the processing fee on every
|
|
584
|
+
* invoice this template generates.
|
|
585
|
+
*/
|
|
586
|
+
create(sid: string, attributes: Raw$5): Promise<RecurringInvoice>;
|
|
587
|
+
cancel(sid: string, recurringInvoiceId: number | string): Promise<RecurringInvoice>;
|
|
588
|
+
}
|
|
589
|
+
|
|
302
590
|
type Raw$4 = Record<string, unknown>;
|
|
303
591
|
declare class RecurringPaymentMethod {
|
|
304
592
|
readonly id?: number | undefined;
|
|
@@ -391,6 +679,8 @@ declare class Client {
|
|
|
391
679
|
readonly addresses: Addresses;
|
|
392
680
|
readonly deposits: Deposits;
|
|
393
681
|
readonly recurringPayments: RecurringPayments;
|
|
682
|
+
readonly invoices: Invoices;
|
|
683
|
+
readonly recurringInvoices: RecurringInvoices;
|
|
394
684
|
private readonly _config;
|
|
395
685
|
constructor(token: string | Config, baseUrl?: string);
|
|
396
686
|
config(): Config;
|
|
@@ -435,4 +725,4 @@ declare class ServerException extends DimeException {
|
|
|
435
725
|
declare class ConnectionException extends DimeException {
|
|
436
726
|
}
|
|
437
727
|
|
|
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 };
|
|
728
|
+
export { Address, ApiException, AuthenticationException, Client, Config, ConnectionException, CoverFeeQuote, 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 };
|