@spritz-finance/api-client 0.0.3 → 0.0.5
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/LICENCE +15 -0
- package/README.md +161 -21
- package/dist/spritz-api-client.d.ts +191 -19
- package/dist/spritz-api-client.js +97 -32
- package/dist/spritz-api-client.js.map +1 -1
- package/dist/spritz-api-client.mjs +97 -32
- package/dist/spritz-api-client.mjs.map +1 -1
- package/package.json +9 -5
package/LICENCE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023, Spritz Finance Inc.
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
CHANGED
|
@@ -28,8 +28,12 @@ const client = SpritzApiClient.initialize(Environment.Staging, 'YOUR_API_KEY_HER
|
|
|
28
28
|
|
|
29
29
|
## Bank Accounts
|
|
30
30
|
|
|
31
|
+
Spritz provides robust support for bank accounts, allowing you to easily manage and interact with a user's bank account. To leverage these capabilities, you can utilize our specific methods and functionalities designed for bank accounts.
|
|
32
|
+
|
|
31
33
|
### List user bank accounts
|
|
32
34
|
|
|
35
|
+
You can retrieve a comprehensive list of all bank accounts that have been linked to a user's account using this functionality.
|
|
36
|
+
|
|
33
37
|
```typescript
|
|
34
38
|
const bankAccounts = await client.bankAccounts.list()
|
|
35
39
|
```
|
|
@@ -40,33 +44,37 @@ The bank accounts endpoint returns a standard response comprising an array of al
|
|
|
40
44
|
|
|
41
45
|
```typescript
|
|
42
46
|
const bankAccounts = [{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
47
|
+
id: "62d17d3b377dab6c1342136e",
|
|
48
|
+
name: "Precious Savings",
|
|
49
|
+
type: "BankAccount",
|
|
50
|
+
bankAccountType: "USBankAccount",
|
|
51
|
+
bankAccountSubType: "Checking",
|
|
52
|
+
userId: "62d17d3b377dab6c1342136e",
|
|
53
|
+
accountNumber: "1234567",
|
|
54
|
+
bankAccountDetails: {
|
|
55
|
+
routingNumber: "00000123",
|
|
56
|
+
}
|
|
57
|
+
country: "US",
|
|
58
|
+
currency: "USD",
|
|
59
|
+
email: "bilbo@shiremail.net",
|
|
60
|
+
holder: "Bilbo Baggins",
|
|
61
|
+
institution: {
|
|
62
|
+
id: "62d27d4b277dab3c1342126e",
|
|
63
|
+
name: "Shire Bank",
|
|
64
|
+
logo: "https://tinyurl.com/shire-bank-logo",
|
|
65
|
+
},
|
|
66
|
+
ownedByUser: true,
|
|
67
|
+
createdAt: "2023-05-03T11:25:02.401Z",
|
|
64
68
|
}];
|
|
65
69
|
```
|
|
66
70
|
|
|
67
71
|
### Add US bank account
|
|
68
72
|
|
|
73
|
+
At present, you can only add US bank accounts to a user's account. To add a US bank account for the user, you can use the following.
|
|
74
|
+
|
|
69
75
|
```typescript
|
|
76
|
+
// Input arguments for creating a US bank account
|
|
77
|
+
|
|
70
78
|
export interface USBankAccountInput {
|
|
71
79
|
accountNumber: string
|
|
72
80
|
email: string
|
|
@@ -94,12 +102,144 @@ const bankAccounts = await client.bankAccounts.create(BankAccountType.USBankAcco
|
|
|
94
102
|
|
|
95
103
|
### Rename a bank account
|
|
96
104
|
|
|
105
|
+
You can conveniently change the display name of a bank account using the following endpoint. The first argument specifies the ID of the bank account, while the second argument represents the desired new name for the account.
|
|
106
|
+
|
|
97
107
|
```typescript
|
|
98
108
|
const updateAccount = await client.bankAccounts.rename('62d17d3b377dab6c1342136e', 'My new account')
|
|
99
109
|
```
|
|
100
110
|
|
|
101
111
|
### Delete a bank account
|
|
102
112
|
|
|
113
|
+
To remove a bank account from a user's account, you can use the following endpoint. You only need to specify the ID of the bank account that you want to delete as an argument.
|
|
114
|
+
|
|
103
115
|
```typescript
|
|
104
116
|
await client.bankAccounts.delete('62d17d3b377dab6c1342136e')
|
|
105
117
|
```
|
|
118
|
+
|
|
119
|
+
## Payment Requests
|
|
120
|
+
|
|
121
|
+
A payment request refers to the intent to initiate a payment to a specific account. Once a payment request is created, a blockchain transaction is required to fulfill it. After the blockchain transaction settles, the payment request is completed, and a fiat payment is issued to the designated account.
|
|
122
|
+
|
|
123
|
+
### Create a payment request
|
|
124
|
+
|
|
125
|
+
To initiate a payment request for a specific account, you can use the following functionality. The required inputs for creating a payment request include the ID of the account to be paid, the amount of the fiat payment in USD, and the network on which the blockchain transaction will settle.
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
import {PaymentNetwork} from '@spritz-finance/api-client';
|
|
129
|
+
|
|
130
|
+
const paymentRequest = await client.paymentRequest.create({
|
|
131
|
+
amount: 100,
|
|
132
|
+
accountId: account.id,
|
|
133
|
+
network: PaymentNetwork.Ethereum,
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
// Example response
|
|
137
|
+
|
|
138
|
+
{
|
|
139
|
+
id: '645399c8c1ac408007b12273',
|
|
140
|
+
userId: '63d12d3B577fab6c6382136e',
|
|
141
|
+
accountId: '6322445f10d3f4d19c4d72fe',
|
|
142
|
+
status: 'CREATED',
|
|
143
|
+
amount: 100,
|
|
144
|
+
feeAmount: 0,
|
|
145
|
+
amountDue: 100,
|
|
146
|
+
network: 'ethereum',
|
|
147
|
+
createdAt: '2023-05-04T11:40:56.488Z'
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Fulfil a payment request (EVM transactions)
|
|
152
|
+
|
|
153
|
+
After creating a payment request, you must issue a blockchain transaction to settle the payment request. For EVM compatible networks, this involves interacting with the SpritzPay smart contract (see: [SpritzPay deployments](https://docs.spritz.finance/docs/deployment-addresses)).
|
|
154
|
+
|
|
155
|
+
To obtain the data needed for the transaction, you can use the following endpoint.
|
|
156
|
+
|
|
157
|
+
```typescript
|
|
158
|
+
import {PaymentNetwork} from '@spritz-finance/api-client';
|
|
159
|
+
|
|
160
|
+
const paymentRequest = await client.paymentRequest.create({
|
|
161
|
+
amount: 100,
|
|
162
|
+
accountId: account.id,
|
|
163
|
+
network: PaymentNetwork.Ethereum,
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
const transactionData = await client.paymentRequest.getWeb3PaymentParams({
|
|
167
|
+
paymentRequest,
|
|
168
|
+
paymentTokenAddress: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // USDC on mainnet
|
|
169
|
+
})
|
|
170
|
+
|
|
171
|
+
// Example response
|
|
172
|
+
|
|
173
|
+
{
|
|
174
|
+
contractAddress: '0xbF7Abc15f00a8C2d6b13A952c58d12b7c194A8D0',
|
|
175
|
+
method: 'payWithToken',
|
|
176
|
+
calldata: '0xd71d9632000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000005f5e100000000000000000000000000000000000000000064539a31c1ac408007b12277',
|
|
177
|
+
value: null,
|
|
178
|
+
requiredTokenInput: '100000000',
|
|
179
|
+
suggestedGasLimit: '110000'
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
The contract address (to), calldata (data), and value are the primary components used to execute the blockchain transaction. You can use the `requiredTokenInput` to verify that the user's wallet has sufficient funds to complete the payment before initiating the transaction.
|
|
184
|
+
|
|
185
|
+
### Transaction fees
|
|
186
|
+
|
|
187
|
+
Transaction fees are applied once the monthly transaction volume exceeds $100. To determine the fee amount for a specific payment value, you can use the following endpoint.
|
|
188
|
+
|
|
189
|
+
```typescript
|
|
190
|
+
const fees = await client.paymentRequest.transactionPrice(101)
|
|
191
|
+
|
|
192
|
+
// Example response
|
|
193
|
+
0.01
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Payments
|
|
197
|
+
|
|
198
|
+
Payments represent a fiat payment that has been issued to the account. Once the status of the Payment Request has moved to `Confirmed` then the Payment will be created.
|
|
199
|
+
|
|
200
|
+
### Retrieve the payment for a payment request
|
|
201
|
+
|
|
202
|
+
```typescript
|
|
203
|
+
import {PaymentNetwork} from '@spritz-finance/api-client';
|
|
204
|
+
|
|
205
|
+
const paymentRequest = await client.paymentRequest.create({
|
|
206
|
+
amount: 100,
|
|
207
|
+
accountId: account.id,
|
|
208
|
+
network: PaymentNetwork.Ethereum,
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
const payment = await client.payment.getForPaymentRequest(paymentRequest.id);
|
|
212
|
+
|
|
213
|
+
// Example response
|
|
214
|
+
|
|
215
|
+
{
|
|
216
|
+
id: '6368e3a3ec516e9572bbd23b',
|
|
217
|
+
userId: '63d12d3B577fab6c6382136e',
|
|
218
|
+
status: 'PENDING',
|
|
219
|
+
accountId: '6322445f10d3f4d19c4d72fe',
|
|
220
|
+
amount: 100,
|
|
221
|
+
feeAmount: null,
|
|
222
|
+
createdAt: '2022-11-07T10:53:23.998Z'
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Retrieve all payments for an account
|
|
228
|
+
|
|
229
|
+
```typescript
|
|
230
|
+
const payments = await client.payment.listForAccount(account.id)
|
|
231
|
+
|
|
232
|
+
// Example response
|
|
233
|
+
|
|
234
|
+
;[
|
|
235
|
+
{
|
|
236
|
+
id: '6368e3a3ec516e9572bbd23b',
|
|
237
|
+
userId: '63d12d3B577fab6c6382136e',
|
|
238
|
+
status: 'PENDING',
|
|
239
|
+
accountId: '6322445f10d3f4d19c4d72fe',
|
|
240
|
+
amount: 100,
|
|
241
|
+
feeAmount: null,
|
|
242
|
+
createdAt: '2022-11-07T10:53:23.998Z',
|
|
243
|
+
},
|
|
244
|
+
]
|
|
245
|
+
```
|
|
@@ -6,21 +6,10 @@ declare enum Environment {
|
|
|
6
6
|
Production = "production"
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
declare class GraphClient {
|
|
14
|
-
client: AxiosInstance;
|
|
15
|
-
constructor(environment: Environment, apiKey: string);
|
|
16
|
-
query<Q = any, V = any>({ query, variables }: QueryParams<V>): Promise<Q>;
|
|
9
|
+
declare enum AccountProvider {
|
|
10
|
+
CHECKBOOK = "CHECKBOOK",
|
|
11
|
+
METHOD_FI = "METHOD_FI"
|
|
17
12
|
}
|
|
18
|
-
|
|
19
|
-
declare class AccountsService {
|
|
20
|
-
private client;
|
|
21
|
-
constructor(client: GraphClient);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
13
|
declare enum BankAccountSubType {
|
|
25
14
|
Business = "Business",
|
|
26
15
|
Checking = "Checking",
|
|
@@ -29,6 +18,16 @@ declare enum BankAccountSubType {
|
|
|
29
18
|
declare enum BankAccountType {
|
|
30
19
|
USBankAccount = "USBankAccount"
|
|
31
20
|
}
|
|
21
|
+
declare enum DirectPaymentStatus {
|
|
22
|
+
COMPLETED = "COMPLETED",
|
|
23
|
+
CONFIRMED = "CONFIRMED",
|
|
24
|
+
CREATED = "CREATED",
|
|
25
|
+
FAILED = "FAILED",
|
|
26
|
+
PENDING = "PENDING",
|
|
27
|
+
REFUNDED = "REFUNDED",
|
|
28
|
+
TRANSACTION_FAILED = "TRANSACTION_FAILED",
|
|
29
|
+
TRANSACTION_PENDING = "TRANSACTION_PENDING"
|
|
30
|
+
}
|
|
32
31
|
declare enum ModuleStatus {
|
|
33
32
|
ACTIVE = "ACTIVE",
|
|
34
33
|
FAILED = "FAILED",
|
|
@@ -42,6 +41,28 @@ declare enum PayableAccountType {
|
|
|
42
41
|
Bill = "Bill",
|
|
43
42
|
DebitCard = "DebitCard"
|
|
44
43
|
}
|
|
44
|
+
declare enum PaymentStatus {
|
|
45
|
+
CANCELLED = "CANCELLED",
|
|
46
|
+
COMPLETED = "COMPLETED",
|
|
47
|
+
FAILED = "FAILED",
|
|
48
|
+
INITIALIZED = "INITIALIZED",
|
|
49
|
+
PENDING = "PENDING",
|
|
50
|
+
REFUNDED = "REFUNDED",
|
|
51
|
+
REVERSAL_IN_PROGRESS = "REVERSAL_IN_PROGRESS",
|
|
52
|
+
REVERSED = "REVERSED",
|
|
53
|
+
SCHEDULED = "SCHEDULED",
|
|
54
|
+
SENT = "SENT"
|
|
55
|
+
}
|
|
56
|
+
interface CreateDirectPaymentInput {
|
|
57
|
+
accountId: string;
|
|
58
|
+
amount: number;
|
|
59
|
+
network?: string | null;
|
|
60
|
+
provider?: AccountProvider | null;
|
|
61
|
+
rewardsAmount?: number | null;
|
|
62
|
+
subscriptionId?: string | null;
|
|
63
|
+
testPayment?: boolean | null;
|
|
64
|
+
tokenAddress?: string | null;
|
|
65
|
+
}
|
|
45
66
|
interface USBankAccountInput {
|
|
46
67
|
accountNumber: string;
|
|
47
68
|
email: string;
|
|
@@ -130,6 +151,23 @@ interface RenameBankAccount_renamePayableAccount_BankAccount {
|
|
|
130
151
|
}
|
|
131
152
|
type RenameBankAccount_renamePayableAccount = RenameBankAccount_renamePayableAccount_Bill | RenameBankAccount_renamePayableAccount_BankAccount;
|
|
132
153
|
|
|
154
|
+
interface AccountPayments_paymentsForAccount {
|
|
155
|
+
__typename: 'Payment';
|
|
156
|
+
id: string;
|
|
157
|
+
userId: any;
|
|
158
|
+
status: PaymentStatus;
|
|
159
|
+
accountId: any | null;
|
|
160
|
+
amount: number | null;
|
|
161
|
+
feeAmount: number | null;
|
|
162
|
+
createdAt: any;
|
|
163
|
+
}
|
|
164
|
+
interface AccountPayments {
|
|
165
|
+
paymentsForAccount: AccountPayments_paymentsForAccount[];
|
|
166
|
+
}
|
|
167
|
+
interface AccountPaymentsVariables {
|
|
168
|
+
accountId: string;
|
|
169
|
+
}
|
|
170
|
+
|
|
133
171
|
interface BankAccountFragment_bankAccountDetails_CanadianBankAccountDetails {
|
|
134
172
|
__typename: 'CanadianBankAccountDetails';
|
|
135
173
|
}
|
|
@@ -181,6 +219,25 @@ interface CurrentUser {
|
|
|
181
219
|
me: CurrentUser_me;
|
|
182
220
|
}
|
|
183
221
|
|
|
222
|
+
interface GetSpritzPayParams_spritzPayParams {
|
|
223
|
+
__typename: 'PaymentParams';
|
|
224
|
+
contractAddress: string;
|
|
225
|
+
method: string;
|
|
226
|
+
calldata: string;
|
|
227
|
+
value: string | null;
|
|
228
|
+
requiredTokenInput: string;
|
|
229
|
+
suggestedGasLimit: string | null;
|
|
230
|
+
}
|
|
231
|
+
interface GetSpritzPayParams {
|
|
232
|
+
spritzPayParams: GetSpritzPayParams_spritzPayParams;
|
|
233
|
+
}
|
|
234
|
+
interface GetSpritzPayParamsVariables {
|
|
235
|
+
tokenAddress: string;
|
|
236
|
+
amount: number;
|
|
237
|
+
reference: string;
|
|
238
|
+
network: string;
|
|
239
|
+
}
|
|
240
|
+
|
|
184
241
|
interface PayableAccountFragment_Bill_institution {
|
|
185
242
|
__typename: 'BankAccountInstitution' | 'BillInstitution';
|
|
186
243
|
id: string;
|
|
@@ -236,6 +293,47 @@ interface PayableAccountFragment_BankAccount {
|
|
|
236
293
|
}
|
|
237
294
|
type PayableAccountFragment = PayableAccountFragment_Bill | PayableAccountFragment_BankAccount;
|
|
238
295
|
|
|
296
|
+
interface PaymentFragment {
|
|
297
|
+
__typename: 'Payment';
|
|
298
|
+
id: string;
|
|
299
|
+
userId: any;
|
|
300
|
+
status: PaymentStatus;
|
|
301
|
+
accountId: any | null;
|
|
302
|
+
amount: number | null;
|
|
303
|
+
feeAmount: number | null;
|
|
304
|
+
createdAt: any;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
interface PaymentRequestFragment {
|
|
308
|
+
__typename: 'DirectPayment';
|
|
309
|
+
id: string;
|
|
310
|
+
userId: any;
|
|
311
|
+
accountId: any;
|
|
312
|
+
status: DirectPaymentStatus;
|
|
313
|
+
amount: number;
|
|
314
|
+
feeAmount: number | null;
|
|
315
|
+
amountDue: number;
|
|
316
|
+
network: string;
|
|
317
|
+
createdAt: any;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
interface PaymentRequestPayment_paymentForPaymentRequest {
|
|
321
|
+
__typename: 'Payment';
|
|
322
|
+
id: string;
|
|
323
|
+
userId: any;
|
|
324
|
+
status: PaymentStatus;
|
|
325
|
+
accountId: any | null;
|
|
326
|
+
amount: number | null;
|
|
327
|
+
feeAmount: number | null;
|
|
328
|
+
createdAt: any;
|
|
329
|
+
}
|
|
330
|
+
interface PaymentRequestPayment {
|
|
331
|
+
paymentForPaymentRequest: PaymentRequestPayment_paymentForPaymentRequest | null;
|
|
332
|
+
}
|
|
333
|
+
interface PaymentRequestPaymentVariables {
|
|
334
|
+
paymentRequestId: string;
|
|
335
|
+
}
|
|
336
|
+
|
|
239
337
|
interface TokenBalanceFragment {
|
|
240
338
|
__typename: 'TokenBalance';
|
|
241
339
|
/**
|
|
@@ -259,6 +357,13 @@ interface TokenBalanceFragment {
|
|
|
259
357
|
tokenImageUrl: string;
|
|
260
358
|
}
|
|
261
359
|
|
|
360
|
+
interface TransactionPrice {
|
|
361
|
+
transactionPrice: number;
|
|
362
|
+
}
|
|
363
|
+
interface TransactionPriceVariables {
|
|
364
|
+
amount: number;
|
|
365
|
+
}
|
|
366
|
+
|
|
262
367
|
interface UserBankAccounts_userBankAccounts_bankAccountDetails_CanadianBankAccountDetails {
|
|
263
368
|
__typename: 'CanadianBankAccountDetails';
|
|
264
369
|
}
|
|
@@ -462,6 +567,16 @@ interface CreateUSBankAccountVariables {
|
|
|
462
567
|
createUSAccountInput: USBankAccountInput;
|
|
463
568
|
}
|
|
464
569
|
|
|
570
|
+
interface QueryParams<V = any> {
|
|
571
|
+
query: DocumentNode;
|
|
572
|
+
variables?: V;
|
|
573
|
+
}
|
|
574
|
+
declare class GraphClient {
|
|
575
|
+
client: AxiosInstance;
|
|
576
|
+
constructor(environment: Environment, apiKey: string, integrationKey?: string);
|
|
577
|
+
query<Q = any, V = any>({ query, variables }: QueryParams<V>): Promise<Q>;
|
|
578
|
+
}
|
|
579
|
+
|
|
465
580
|
type CreateInputMapping = {
|
|
466
581
|
[BankAccountType.USBankAccount]: USBankAccountInput;
|
|
467
582
|
};
|
|
@@ -472,7 +587,7 @@ type CreateMutationMapping = {
|
|
|
472
587
|
response: keyof CreateUSBankAccount;
|
|
473
588
|
};
|
|
474
589
|
};
|
|
475
|
-
declare class
|
|
590
|
+
declare class BankAccountService {
|
|
476
591
|
private client;
|
|
477
592
|
constructor(client: GraphClient);
|
|
478
593
|
list(): Promise<UserBankAccounts_userBankAccounts[]>;
|
|
@@ -481,6 +596,57 @@ declare class BankAccountsService {
|
|
|
481
596
|
create<T extends BankAccountType>(type: T, input: CreateInputMapping[T]): Promise<NonNullable<CreateMutationMapping[T]["query"][keyof CreateMutationMapping[T]["query"]]> | null>;
|
|
482
597
|
}
|
|
483
598
|
|
|
599
|
+
declare class PaymentService {
|
|
600
|
+
private client;
|
|
601
|
+
constructor(client: GraphClient);
|
|
602
|
+
listForAccount(accountId: string): Promise<AccountPayments_paymentsForAccount[]>;
|
|
603
|
+
getForPaymentRequest(paymentRequestId: string): Promise<PaymentRequestPayment_paymentForPaymentRequest | null>;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
interface CreatePaymentRequest_createDirectPayment {
|
|
607
|
+
__typename: 'DirectPayment';
|
|
608
|
+
id: string;
|
|
609
|
+
userId: any;
|
|
610
|
+
accountId: any;
|
|
611
|
+
status: DirectPaymentStatus;
|
|
612
|
+
amount: number;
|
|
613
|
+
feeAmount: number | null;
|
|
614
|
+
amountDue: number;
|
|
615
|
+
network: string;
|
|
616
|
+
createdAt: any;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
declare enum PaymentNetwork {
|
|
620
|
+
Ethereum = "ethereum",
|
|
621
|
+
Polygon = "polygon",
|
|
622
|
+
Optimism = "optimism",
|
|
623
|
+
Arbitrum = "arbitrum",
|
|
624
|
+
Binance = "binance-smart-chain",
|
|
625
|
+
Avalanche = "avalanche",
|
|
626
|
+
Bitcoin = "bitcoin",
|
|
627
|
+
BitcoinTestnet = "bitcoin-testnet",
|
|
628
|
+
Dash = "dash",
|
|
629
|
+
DashTestnet = "dash-testnet"
|
|
630
|
+
}
|
|
631
|
+
interface CreatePaymentRequestInput {
|
|
632
|
+
accountId: string;
|
|
633
|
+
amount: number;
|
|
634
|
+
network: PaymentNetwork;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
type PaymentRequest = CreatePaymentRequest_createDirectPayment;
|
|
638
|
+
type Web3PaymentParams = GetSpritzPayParams_spritzPayParams;
|
|
639
|
+
declare class PaymentRequestService {
|
|
640
|
+
private client;
|
|
641
|
+
constructor(client: GraphClient);
|
|
642
|
+
create(input: CreatePaymentRequestInput): Promise<CreatePaymentRequest_createDirectPayment>;
|
|
643
|
+
transactionPrice(paymentAmount: number): Promise<number>;
|
|
644
|
+
getWeb3PaymentParams(input: {
|
|
645
|
+
paymentRequest: PaymentRequest;
|
|
646
|
+
paymentTokenAddress: string;
|
|
647
|
+
}): Promise<Web3PaymentParams>;
|
|
648
|
+
}
|
|
649
|
+
|
|
484
650
|
declare class UserService {
|
|
485
651
|
private client;
|
|
486
652
|
constructor(client: GraphClient);
|
|
@@ -488,13 +654,19 @@ declare class UserService {
|
|
|
488
654
|
getUserVerification(): Promise<UserVerification_verification>;
|
|
489
655
|
}
|
|
490
656
|
|
|
657
|
+
type ClientParams = {
|
|
658
|
+
environment: Environment;
|
|
659
|
+
apiKey: string;
|
|
660
|
+
integrationKey?: string;
|
|
661
|
+
};
|
|
491
662
|
declare class SpritzApiClient {
|
|
492
663
|
private client;
|
|
493
|
-
accounts: AccountsService;
|
|
494
664
|
user: UserService;
|
|
495
|
-
|
|
496
|
-
|
|
665
|
+
bankAccount: BankAccountService;
|
|
666
|
+
paymentRequest: PaymentRequestService;
|
|
667
|
+
payment: PaymentService;
|
|
668
|
+
static initialize({ environment, apiKey, integrationKey }: ClientParams): SpritzApiClient;
|
|
497
669
|
private init;
|
|
498
670
|
}
|
|
499
671
|
|
|
500
|
-
export { BankAccountFragment, BankAccountFragment_bankAccountDetails, BankAccountFragment_bankAccountDetails_CanadianBankAccountDetails, BankAccountFragment_bankAccountDetails_USBankAccountDetails, BankAccountFragment_institution, BankAccountSubType, BankAccountType, CurrentUser, CurrentUser_me, Environment, ModuleStatus, PayableAccountFragment, PayableAccountFragment_BankAccount, PayableAccountFragment_BankAccount_bankAccountDetails, PayableAccountFragment_BankAccount_bankAccountDetails_CanadianBankAccountDetails, PayableAccountFragment_BankAccount_bankAccountDetails_USBankAccountDetails, PayableAccountFragment_BankAccount_institution, PayableAccountFragment_Bill, PayableAccountFragment_Bill_institution, PayableAccountType, SpritzApiClient, TokenBalanceFragment, USBankAccountInput, UserBankAccounts, UserBankAccounts_userBankAccounts, UserBankAccounts_userBankAccounts_bankAccountDetails, UserBankAccounts_userBankAccounts_bankAccountDetails_CanadianBankAccountDetails, UserBankAccounts_userBankAccounts_bankAccountDetails_USBankAccountDetails, UserBankAccounts_userBankAccounts_institution, UserFragment, UserPayableAccounts, UserPayableAccounts_payableAccounts, UserPayableAccounts_payableAccounts_BankAccount, UserPayableAccounts_payableAccounts_BankAccount_bankAccountDetails, UserPayableAccounts_payableAccounts_BankAccount_bankAccountDetails_CanadianBankAccountDetails, UserPayableAccounts_payableAccounts_BankAccount_bankAccountDetails_USBankAccountDetails, UserPayableAccounts_payableAccounts_BankAccount_institution, UserPayableAccounts_payableAccounts_Bill, UserPayableAccounts_payableAccounts_Bill_institution, UserVerification, UserVerification_verification, UserVerification_verification_identity, UserVerification_verification_identity_user, WalletTokenBalances, WalletTokenBalancesVariables, WalletTokenBalances_tokenBalances };
|
|
672
|
+
export { AccountPayments, AccountPaymentsVariables, AccountPayments_paymentsForAccount, AccountProvider, BankAccountFragment, BankAccountFragment_bankAccountDetails, BankAccountFragment_bankAccountDetails_CanadianBankAccountDetails, BankAccountFragment_bankAccountDetails_USBankAccountDetails, BankAccountFragment_institution, BankAccountSubType, BankAccountType, CreateDirectPaymentInput, CreatePaymentRequestInput, CurrentUser, CurrentUser_me, DirectPaymentStatus, Environment, GetSpritzPayParams, GetSpritzPayParamsVariables, GetSpritzPayParams_spritzPayParams, ModuleStatus, PayableAccountFragment, PayableAccountFragment_BankAccount, PayableAccountFragment_BankAccount_bankAccountDetails, PayableAccountFragment_BankAccount_bankAccountDetails_CanadianBankAccountDetails, PayableAccountFragment_BankAccount_bankAccountDetails_USBankAccountDetails, PayableAccountFragment_BankAccount_institution, PayableAccountFragment_Bill, PayableAccountFragment_Bill_institution, PayableAccountType, PaymentFragment, PaymentNetwork, PaymentRequestFragment, PaymentRequestPayment, PaymentRequestPaymentVariables, PaymentRequestPayment_paymentForPaymentRequest, PaymentStatus, SpritzApiClient, TokenBalanceFragment, TransactionPrice, TransactionPriceVariables, USBankAccountInput, UserBankAccounts, UserBankAccounts_userBankAccounts, UserBankAccounts_userBankAccounts_bankAccountDetails, UserBankAccounts_userBankAccounts_bankAccountDetails_CanadianBankAccountDetails, UserBankAccounts_userBankAccounts_bankAccountDetails_USBankAccountDetails, UserBankAccounts_userBankAccounts_institution, UserFragment, UserPayableAccounts, UserPayableAccounts_payableAccounts, UserPayableAccounts_payableAccounts_BankAccount, UserPayableAccounts_payableAccounts_BankAccount_bankAccountDetails, UserPayableAccounts_payableAccounts_BankAccount_bankAccountDetails_CanadianBankAccountDetails, UserPayableAccounts_payableAccounts_BankAccount_bankAccountDetails_USBankAccountDetails, UserPayableAccounts_payableAccounts_BankAccount_institution, UserPayableAccounts_payableAccounts_Bill, UserPayableAccounts_payableAccounts_Bill_institution, UserVerification, UserVerification_verification, UserVerification_verification_identity, UserVerification_verification_identity_user, WalletTokenBalances, WalletTokenBalancesVariables, WalletTokenBalances_tokenBalances };
|