@dime-technology/dime-js-sdk 1.2.0 → 1.3.1
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 +48 -1
- package/dist/index.cjs +68 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +96 -41
- package/dist/index.d.ts +96 -41
- package/dist/index.js +67 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -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.1";
|
|
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;
|
|
@@ -81,32 +81,32 @@ declare class Transport {
|
|
|
81
81
|
* serialised into the query string (`data[sid]=…&filters[status]=…`) and no
|
|
82
82
|
* body is sent; every other method sends the envelope as a JSON body.
|
|
83
83
|
*/
|
|
84
|
-
request(method: string, path: string, body?: Raw$
|
|
84
|
+
request(method: string, path: string, body?: Raw$v, query?: Record<string, string>): Promise<Raw$v>;
|
|
85
85
|
private attempt;
|
|
86
86
|
private sleep;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
type Raw$
|
|
89
|
+
type Raw$u = Record<string, unknown>;
|
|
90
90
|
declare abstract class AbstractResource {
|
|
91
91
|
protected readonly transport: Transport;
|
|
92
92
|
constructor(transport: Transport);
|
|
93
93
|
/**
|
|
94
94
|
* Build the standard Dime request envelope, dropping null/undefined values.
|
|
95
95
|
*/
|
|
96
|
-
protected envelope(data?: Raw$
|
|
97
|
-
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>>;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
type Raw$
|
|
100
|
+
type Raw$t = Record<string, unknown>;
|
|
101
101
|
declare class Addresses extends AbstractResource {
|
|
102
102
|
list(sid: string, uuid: string): Promise<CursorPage<Address>>;
|
|
103
103
|
show(sid: string, uuid: string, addressId: number | string): Promise<Address>;
|
|
104
|
-
create(sid: string, uuid: string, attributes: Raw$
|
|
105
|
-
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>;
|
|
106
106
|
delete(sid: string, uuid: string, addressId: number | string): Promise<MessageResult>;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
type Raw$
|
|
109
|
+
type Raw$s = Record<string, unknown>;
|
|
110
110
|
declare class Customer {
|
|
111
111
|
readonly uuid?: string | undefined;
|
|
112
112
|
readonly firstName?: string | undefined;
|
|
@@ -121,19 +121,19 @@ declare class Customer {
|
|
|
121
121
|
readonly zip?: string | undefined;
|
|
122
122
|
readonly country?: string | undefined;
|
|
123
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);
|
|
124
|
-
static fromRaw(data: Raw$
|
|
124
|
+
static fromRaw(data: Raw$s): Customer;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
type Raw$
|
|
127
|
+
type Raw$r = Record<string, unknown>;
|
|
128
128
|
declare class Customers extends AbstractResource {
|
|
129
|
-
list(sid: string, filters?: Raw$
|
|
130
|
-
show(sid: string, filters: Raw$
|
|
131
|
-
create(sid: string, attributes: Raw$
|
|
132
|
-
update(sid: string, filters: Raw$
|
|
133
|
-
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>;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
type Raw$
|
|
136
|
+
type Raw$q = Record<string, unknown>;
|
|
137
137
|
declare class Deposit {
|
|
138
138
|
readonly transactionDate?: string | undefined;
|
|
139
139
|
readonly fundDate?: string | undefined;
|
|
@@ -145,10 +145,10 @@ declare class Deposit {
|
|
|
145
145
|
readonly sweepId?: string | undefined;
|
|
146
146
|
readonly type?: string | undefined;
|
|
147
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);
|
|
148
|
-
static fromRaw(data: Raw$
|
|
148
|
+
static fromRaw(data: Raw$q): Deposit;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
type Raw$
|
|
151
|
+
type Raw$p = Record<string, unknown>;
|
|
152
152
|
declare class TransactionAddress {
|
|
153
153
|
readonly firstName?: string | undefined;
|
|
154
154
|
readonly lastName?: string | undefined;
|
|
@@ -158,10 +158,10 @@ declare class TransactionAddress {
|
|
|
158
158
|
readonly state?: string | undefined;
|
|
159
159
|
readonly zip?: string | undefined;
|
|
160
160
|
constructor(firstName?: string | undefined, lastName?: string | undefined, addr1?: string | undefined, addr2?: string | undefined, city?: string | undefined, state?: string | undefined, zip?: string | undefined);
|
|
161
|
-
static fromRaw(data: Raw$
|
|
161
|
+
static fromRaw(data: Raw$p): TransactionAddress;
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
type Raw$
|
|
164
|
+
type Raw$o = Record<string, unknown>;
|
|
165
165
|
declare class Transaction {
|
|
166
166
|
readonly transactionType?: string | undefined;
|
|
167
167
|
readonly transactionStatus?: string | undefined;
|
|
@@ -184,10 +184,10 @@ declare class Transaction {
|
|
|
184
184
|
readonly billingAddress: TransactionAddress;
|
|
185
185
|
readonly shippingAddress: TransactionAddress;
|
|
186
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);
|
|
187
|
-
static fromRaw(data: Raw$
|
|
187
|
+
static fromRaw(data: Raw$o): Transaction;
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
type Raw$
|
|
190
|
+
type Raw$n = Record<string, unknown>;
|
|
191
191
|
declare class DepositWithTransactions {
|
|
192
192
|
readonly sid?: string | undefined;
|
|
193
193
|
readonly transactionInfoId?: string | undefined;
|
|
@@ -199,23 +199,52 @@ declare class DepositWithTransactions {
|
|
|
199
199
|
readonly transTotal?: string | undefined;
|
|
200
200
|
readonly transactions: Transaction[];
|
|
201
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[]);
|
|
202
|
-
static fromRaw(data: Raw$
|
|
202
|
+
static fromRaw(data: Raw$n): DepositWithTransactions;
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
type Raw$
|
|
205
|
+
type Raw$m = Record<string, unknown>;
|
|
206
206
|
declare class DepositGroup {
|
|
207
207
|
readonly sid?: string | undefined;
|
|
208
208
|
readonly count?: number | undefined;
|
|
209
209
|
readonly deposits: DepositWithTransactions[];
|
|
210
210
|
constructor(sid?: string | undefined, count?: number | undefined, deposits?: DepositWithTransactions[]);
|
|
211
|
-
static fromRaw(data: Raw$
|
|
211
|
+
static fromRaw(data: Raw$m): DepositGroup;
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
type Raw$
|
|
214
|
+
type Raw$l = Record<string, unknown>;
|
|
215
215
|
declare class Deposits extends AbstractResource {
|
|
216
|
-
list(sid: string, filters?: Raw$
|
|
217
|
-
listWithTransactions(sid: string, filters: Raw$
|
|
218
|
-
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>;
|
|
219
|
+
}
|
|
220
|
+
|
|
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;
|
|
219
248
|
}
|
|
220
249
|
|
|
221
250
|
type Raw$j = Record<string, unknown>;
|
|
@@ -251,12 +280,20 @@ declare class InvoiceLineItem {
|
|
|
251
280
|
}
|
|
252
281
|
|
|
253
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
|
+
*/
|
|
254
290
|
declare class InvoicePayment {
|
|
255
291
|
readonly amount?: string | undefined;
|
|
256
292
|
readonly paidAt?: string | undefined;
|
|
257
293
|
readonly method?: string | undefined;
|
|
258
294
|
readonly transactionId?: string | undefined;
|
|
259
|
-
|
|
295
|
+
readonly coverFee?: string | undefined;
|
|
296
|
+
constructor(amount?: string | undefined, paidAt?: string | undefined, method?: string | undefined, transactionId?: string | undefined, coverFee?: string | undefined);
|
|
260
297
|
static fromRaw(data: Raw$g): InvoicePayment;
|
|
261
298
|
}
|
|
262
299
|
|
|
@@ -283,7 +320,9 @@ declare class Invoice {
|
|
|
283
320
|
readonly items: InvoiceLineItem[];
|
|
284
321
|
readonly payments: InvoicePayment[];
|
|
285
322
|
readonly events: InvoiceEvent[];
|
|
286
|
-
|
|
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);
|
|
287
326
|
static fromRaw(data: Raw$f): Invoice;
|
|
288
327
|
}
|
|
289
328
|
|
|
@@ -322,7 +361,7 @@ declare class Invoices extends AbstractResource {
|
|
|
322
361
|
/**
|
|
323
362
|
* List invoices for a merchant.
|
|
324
363
|
*
|
|
325
|
-
* @param filters `status` — draft | sent |
|
|
364
|
+
* @param filters `status` — draft | sent | viewed | partially_paid | paid | void | refunded | overdue | all
|
|
326
365
|
*/
|
|
327
366
|
list(sid: string, filters?: Raw$c): Promise<CursorPage<Invoice>>;
|
|
328
367
|
show(sid: string, invoiceId: number | string): Promise<Invoice>;
|
|
@@ -337,7 +376,13 @@ declare class Invoices extends AbstractResource {
|
|
|
337
376
|
* `unit_price` and optional `description`. Optional: `invoice_number`,
|
|
338
377
|
* `issue_date` (Y-m-d, defaults to today — `due_date` is derived from
|
|
339
378
|
* `payment_terms`), `thank_you_note`, `allow_partial_payment`,
|
|
340
|
-
* `reminder_settings`.
|
|
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.
|
|
341
386
|
*/
|
|
342
387
|
create(sid: string, attributes: Raw$c): Promise<Invoice>;
|
|
343
388
|
/**
|
|
@@ -366,6 +411,12 @@ declare class Invoices extends AbstractResource {
|
|
|
366
411
|
* `account_type` (Checking | Savings) / `account_name`. Omit `amount` to pay
|
|
367
412
|
* the full balance — partial amounts require the invoice to allow them.
|
|
368
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`.
|
|
369
420
|
*/
|
|
370
421
|
pay(sid: string, invoiceId: number | string, attributes: Raw$c): Promise<Invoice>;
|
|
371
422
|
/** Get the public pay link (and token) for an invoice. */
|
|
@@ -498,7 +549,8 @@ declare class RecurringInvoice {
|
|
|
498
549
|
readonly items: InvoiceLineItem[];
|
|
499
550
|
readonly upcomingRunDates: string[];
|
|
500
551
|
readonly invoices: Invoice[];
|
|
501
|
-
|
|
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);
|
|
502
554
|
static fromRaw(data: Raw$6): RecurringInvoice;
|
|
503
555
|
}
|
|
504
556
|
|
|
@@ -527,6 +579,9 @@ declare class RecurringInvoices extends AbstractResource {
|
|
|
527
579
|
* `recurring_start_date` (Y-m-d) and `lines` are required. Optional:
|
|
528
580
|
* `recurring_end_date` (Y-m-d, on or after the start date),
|
|
529
581
|
* `thank_you_note`.
|
|
582
|
+
*
|
|
583
|
+
* `cover_fee_required` makes the customer cover the processing fee on every
|
|
584
|
+
* invoice this template generates.
|
|
530
585
|
*/
|
|
531
586
|
create(sid: string, attributes: Raw$5): Promise<RecurringInvoice>;
|
|
532
587
|
cancel(sid: string, recurringInvoiceId: number | string): Promise<RecurringInvoice>;
|
|
@@ -670,4 +725,4 @@ declare class ServerException extends DimeException {
|
|
|
670
725
|
declare class ConnectionException extends DimeException {
|
|
671
726
|
}
|
|
672
727
|
|
|
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 };
|
|
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 };
|
package/dist/index.d.ts
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.1";
|
|
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;
|
|
@@ -81,32 +81,32 @@ declare class Transport {
|
|
|
81
81
|
* serialised into the query string (`data[sid]=…&filters[status]=…`) and no
|
|
82
82
|
* body is sent; every other method sends the envelope as a JSON body.
|
|
83
83
|
*/
|
|
84
|
-
request(method: string, path: string, body?: Raw$
|
|
84
|
+
request(method: string, path: string, body?: Raw$v, query?: Record<string, string>): Promise<Raw$v>;
|
|
85
85
|
private attempt;
|
|
86
86
|
private sleep;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
type Raw$
|
|
89
|
+
type Raw$u = Record<string, unknown>;
|
|
90
90
|
declare abstract class AbstractResource {
|
|
91
91
|
protected readonly transport: Transport;
|
|
92
92
|
constructor(transport: Transport);
|
|
93
93
|
/**
|
|
94
94
|
* Build the standard Dime request envelope, dropping null/undefined values.
|
|
95
95
|
*/
|
|
96
|
-
protected envelope(data?: Raw$
|
|
97
|
-
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>>;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
type Raw$
|
|
100
|
+
type Raw$t = Record<string, unknown>;
|
|
101
101
|
declare class Addresses extends AbstractResource {
|
|
102
102
|
list(sid: string, uuid: string): Promise<CursorPage<Address>>;
|
|
103
103
|
show(sid: string, uuid: string, addressId: number | string): Promise<Address>;
|
|
104
|
-
create(sid: string, uuid: string, attributes: Raw$
|
|
105
|
-
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>;
|
|
106
106
|
delete(sid: string, uuid: string, addressId: number | string): Promise<MessageResult>;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
type Raw$
|
|
109
|
+
type Raw$s = Record<string, unknown>;
|
|
110
110
|
declare class Customer {
|
|
111
111
|
readonly uuid?: string | undefined;
|
|
112
112
|
readonly firstName?: string | undefined;
|
|
@@ -121,19 +121,19 @@ declare class Customer {
|
|
|
121
121
|
readonly zip?: string | undefined;
|
|
122
122
|
readonly country?: string | undefined;
|
|
123
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);
|
|
124
|
-
static fromRaw(data: Raw$
|
|
124
|
+
static fromRaw(data: Raw$s): Customer;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
type Raw$
|
|
127
|
+
type Raw$r = Record<string, unknown>;
|
|
128
128
|
declare class Customers extends AbstractResource {
|
|
129
|
-
list(sid: string, filters?: Raw$
|
|
130
|
-
show(sid: string, filters: Raw$
|
|
131
|
-
create(sid: string, attributes: Raw$
|
|
132
|
-
update(sid: string, filters: Raw$
|
|
133
|
-
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>;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
type Raw$
|
|
136
|
+
type Raw$q = Record<string, unknown>;
|
|
137
137
|
declare class Deposit {
|
|
138
138
|
readonly transactionDate?: string | undefined;
|
|
139
139
|
readonly fundDate?: string | undefined;
|
|
@@ -145,10 +145,10 @@ declare class Deposit {
|
|
|
145
145
|
readonly sweepId?: string | undefined;
|
|
146
146
|
readonly type?: string | undefined;
|
|
147
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);
|
|
148
|
-
static fromRaw(data: Raw$
|
|
148
|
+
static fromRaw(data: Raw$q): Deposit;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
type Raw$
|
|
151
|
+
type Raw$p = Record<string, unknown>;
|
|
152
152
|
declare class TransactionAddress {
|
|
153
153
|
readonly firstName?: string | undefined;
|
|
154
154
|
readonly lastName?: string | undefined;
|
|
@@ -158,10 +158,10 @@ declare class TransactionAddress {
|
|
|
158
158
|
readonly state?: string | undefined;
|
|
159
159
|
readonly zip?: string | undefined;
|
|
160
160
|
constructor(firstName?: string | undefined, lastName?: string | undefined, addr1?: string | undefined, addr2?: string | undefined, city?: string | undefined, state?: string | undefined, zip?: string | undefined);
|
|
161
|
-
static fromRaw(data: Raw$
|
|
161
|
+
static fromRaw(data: Raw$p): TransactionAddress;
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
type Raw$
|
|
164
|
+
type Raw$o = Record<string, unknown>;
|
|
165
165
|
declare class Transaction {
|
|
166
166
|
readonly transactionType?: string | undefined;
|
|
167
167
|
readonly transactionStatus?: string | undefined;
|
|
@@ -184,10 +184,10 @@ declare class Transaction {
|
|
|
184
184
|
readonly billingAddress: TransactionAddress;
|
|
185
185
|
readonly shippingAddress: TransactionAddress;
|
|
186
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);
|
|
187
|
-
static fromRaw(data: Raw$
|
|
187
|
+
static fromRaw(data: Raw$o): Transaction;
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
type Raw$
|
|
190
|
+
type Raw$n = Record<string, unknown>;
|
|
191
191
|
declare class DepositWithTransactions {
|
|
192
192
|
readonly sid?: string | undefined;
|
|
193
193
|
readonly transactionInfoId?: string | undefined;
|
|
@@ -199,23 +199,52 @@ declare class DepositWithTransactions {
|
|
|
199
199
|
readonly transTotal?: string | undefined;
|
|
200
200
|
readonly transactions: Transaction[];
|
|
201
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[]);
|
|
202
|
-
static fromRaw(data: Raw$
|
|
202
|
+
static fromRaw(data: Raw$n): DepositWithTransactions;
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
type Raw$
|
|
205
|
+
type Raw$m = Record<string, unknown>;
|
|
206
206
|
declare class DepositGroup {
|
|
207
207
|
readonly sid?: string | undefined;
|
|
208
208
|
readonly count?: number | undefined;
|
|
209
209
|
readonly deposits: DepositWithTransactions[];
|
|
210
210
|
constructor(sid?: string | undefined, count?: number | undefined, deposits?: DepositWithTransactions[]);
|
|
211
|
-
static fromRaw(data: Raw$
|
|
211
|
+
static fromRaw(data: Raw$m): DepositGroup;
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
type Raw$
|
|
214
|
+
type Raw$l = Record<string, unknown>;
|
|
215
215
|
declare class Deposits extends AbstractResource {
|
|
216
|
-
list(sid: string, filters?: Raw$
|
|
217
|
-
listWithTransactions(sid: string, filters: Raw$
|
|
218
|
-
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>;
|
|
219
|
+
}
|
|
220
|
+
|
|
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;
|
|
219
248
|
}
|
|
220
249
|
|
|
221
250
|
type Raw$j = Record<string, unknown>;
|
|
@@ -251,12 +280,20 @@ declare class InvoiceLineItem {
|
|
|
251
280
|
}
|
|
252
281
|
|
|
253
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
|
+
*/
|
|
254
290
|
declare class InvoicePayment {
|
|
255
291
|
readonly amount?: string | undefined;
|
|
256
292
|
readonly paidAt?: string | undefined;
|
|
257
293
|
readonly method?: string | undefined;
|
|
258
294
|
readonly transactionId?: string | undefined;
|
|
259
|
-
|
|
295
|
+
readonly coverFee?: string | undefined;
|
|
296
|
+
constructor(amount?: string | undefined, paidAt?: string | undefined, method?: string | undefined, transactionId?: string | undefined, coverFee?: string | undefined);
|
|
260
297
|
static fromRaw(data: Raw$g): InvoicePayment;
|
|
261
298
|
}
|
|
262
299
|
|
|
@@ -283,7 +320,9 @@ declare class Invoice {
|
|
|
283
320
|
readonly items: InvoiceLineItem[];
|
|
284
321
|
readonly payments: InvoicePayment[];
|
|
285
322
|
readonly events: InvoiceEvent[];
|
|
286
|
-
|
|
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);
|
|
287
326
|
static fromRaw(data: Raw$f): Invoice;
|
|
288
327
|
}
|
|
289
328
|
|
|
@@ -322,7 +361,7 @@ declare class Invoices extends AbstractResource {
|
|
|
322
361
|
/**
|
|
323
362
|
* List invoices for a merchant.
|
|
324
363
|
*
|
|
325
|
-
* @param filters `status` — draft | sent |
|
|
364
|
+
* @param filters `status` — draft | sent | viewed | partially_paid | paid | void | refunded | overdue | all
|
|
326
365
|
*/
|
|
327
366
|
list(sid: string, filters?: Raw$c): Promise<CursorPage<Invoice>>;
|
|
328
367
|
show(sid: string, invoiceId: number | string): Promise<Invoice>;
|
|
@@ -337,7 +376,13 @@ declare class Invoices extends AbstractResource {
|
|
|
337
376
|
* `unit_price` and optional `description`. Optional: `invoice_number`,
|
|
338
377
|
* `issue_date` (Y-m-d, defaults to today — `due_date` is derived from
|
|
339
378
|
* `payment_terms`), `thank_you_note`, `allow_partial_payment`,
|
|
340
|
-
* `reminder_settings`.
|
|
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.
|
|
341
386
|
*/
|
|
342
387
|
create(sid: string, attributes: Raw$c): Promise<Invoice>;
|
|
343
388
|
/**
|
|
@@ -366,6 +411,12 @@ declare class Invoices extends AbstractResource {
|
|
|
366
411
|
* `account_type` (Checking | Savings) / `account_name`. Omit `amount` to pay
|
|
367
412
|
* the full balance — partial amounts require the invoice to allow them.
|
|
368
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`.
|
|
369
420
|
*/
|
|
370
421
|
pay(sid: string, invoiceId: number | string, attributes: Raw$c): Promise<Invoice>;
|
|
371
422
|
/** Get the public pay link (and token) for an invoice. */
|
|
@@ -498,7 +549,8 @@ declare class RecurringInvoice {
|
|
|
498
549
|
readonly items: InvoiceLineItem[];
|
|
499
550
|
readonly upcomingRunDates: string[];
|
|
500
551
|
readonly invoices: Invoice[];
|
|
501
|
-
|
|
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);
|
|
502
554
|
static fromRaw(data: Raw$6): RecurringInvoice;
|
|
503
555
|
}
|
|
504
556
|
|
|
@@ -527,6 +579,9 @@ declare class RecurringInvoices extends AbstractResource {
|
|
|
527
579
|
* `recurring_start_date` (Y-m-d) and `lines` are required. Optional:
|
|
528
580
|
* `recurring_end_date` (Y-m-d, on or after the start date),
|
|
529
581
|
* `thank_you_note`.
|
|
582
|
+
*
|
|
583
|
+
* `cover_fee_required` makes the customer cover the processing fee on every
|
|
584
|
+
* invoice this template generates.
|
|
530
585
|
*/
|
|
531
586
|
create(sid: string, attributes: Raw$5): Promise<RecurringInvoice>;
|
|
532
587
|
cancel(sid: string, recurringInvoiceId: number | string): Promise<RecurringInvoice>;
|
|
@@ -670,4 +725,4 @@ declare class ServerException extends DimeException {
|
|
|
670
725
|
declare class ConnectionException extends DimeException {
|
|
671
726
|
}
|
|
672
727
|
|
|
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 };
|
|
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 };
|