@diviswap/sdk 1.8.1 → 1.9.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/dist/cli/index.js +7 -3
- package/dist/cli/templates/nextjs-app/api-route.ts.hbs +8 -52
- package/dist/cli/templates/nextjs-app/types.ts.hbs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +38 -44
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -44
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.mts +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/{wallet-Ca1U51kT.d.mts → wallet-Cohx6L51.d.mts} +11 -23
- package/dist/{wallet-Ca1U51kT.d.ts → wallet-Cohx6L51.d.ts} +11 -23
- package/package.json +1 -1
- package/src/cli/templates/nextjs-app/api-route.ts.hbs +8 -52
- package/src/cli/templates/nextjs-app/types.ts.hbs +1 -1
package/dist/react/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import { U as User, T as Transaction, P as Payee, D as Diviswap, d as Address, e as CreateAddressRequest, g as ChainName, l as WalletTrackingConfig, W as WalletConnection, k as EthereumWallet, i as WalletTracker } from '../wallet-
|
|
2
|
+
import { U as User, T as Transaction, P as Payee, D as Diviswap, d as Address, e as CreateAddressRequest, g as ChainName, l as WalletTrackingConfig, W as WalletConnection, k as EthereumWallet, i as WalletTracker } from '../wallet-Cohx6L51.mjs';
|
|
3
3
|
|
|
4
4
|
interface DiviswapContextValue {
|
|
5
5
|
user: User | null;
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import { U as User, T as Transaction, P as Payee, D as Diviswap, d as Address, e as CreateAddressRequest, g as ChainName, l as WalletTrackingConfig, W as WalletConnection, k as EthereumWallet, i as WalletTracker } from '../wallet-
|
|
2
|
+
import { U as User, T as Transaction, P as Payee, D as Diviswap, d as Address, e as CreateAddressRequest, g as ChainName, l as WalletTrackingConfig, W as WalletConnection, k as EthereumWallet, i as WalletTracker } from '../wallet-Cohx6L51.js';
|
|
3
3
|
|
|
4
4
|
interface DiviswapContextValue {
|
|
5
5
|
user: User | null;
|
|
@@ -124,16 +124,10 @@ interface Payee {
|
|
|
124
124
|
}
|
|
125
125
|
interface CreatePayeeRequest {
|
|
126
126
|
nickname: string;
|
|
127
|
-
accountNumber
|
|
128
|
-
routingNumber
|
|
129
|
-
accountType: 'checking' | 'savings'
|
|
127
|
+
accountNumber: string;
|
|
128
|
+
routingNumber: string;
|
|
129
|
+
accountType: 'checking' | 'savings';
|
|
130
130
|
setAsDefault?: boolean;
|
|
131
|
-
debitCard?: {
|
|
132
|
-
number: string;
|
|
133
|
-
expirationMonth: string;
|
|
134
|
-
expirationYear: string;
|
|
135
|
-
cvv: string;
|
|
136
|
-
};
|
|
137
131
|
}
|
|
138
132
|
interface Transaction {
|
|
139
133
|
id: string;
|
|
@@ -505,12 +499,19 @@ interface VerifyPayeeRequest {
|
|
|
505
499
|
declare class PayeesModule {
|
|
506
500
|
private client;
|
|
507
501
|
constructor(client: UnifiedApiClient);
|
|
502
|
+
/**
|
|
503
|
+
* Validate ABA routing number checksum
|
|
504
|
+
*/
|
|
505
|
+
private validateRoutingNumber;
|
|
506
|
+
/**
|
|
507
|
+
* Validate account number format
|
|
508
|
+
*/
|
|
509
|
+
private validateAccountNumber;
|
|
508
510
|
/**
|
|
509
511
|
* Create a new payee (bank account)
|
|
510
512
|
*
|
|
511
513
|
* @example
|
|
512
514
|
* ```typescript
|
|
513
|
-
* // Bank account
|
|
514
515
|
* const bankAccount = await diviswap.payees.create({
|
|
515
516
|
* nickname: 'My Checking',
|
|
516
517
|
* accountNumber: '123456789',
|
|
@@ -518,19 +519,6 @@ declare class PayeesModule {
|
|
|
518
519
|
* accountType: 'checking',
|
|
519
520
|
* setAsDefault: true
|
|
520
521
|
* });
|
|
521
|
-
*
|
|
522
|
-
* // Debit card
|
|
523
|
-
* const debitCard = await diviswap.payees.create({
|
|
524
|
-
* nickname: 'My Debit Card',
|
|
525
|
-
* accountType: 'debit_card',
|
|
526
|
-
* debitCard: {
|
|
527
|
-
* number: '4111111111111111',
|
|
528
|
-
* expirationMonth: '12',
|
|
529
|
-
* expirationYear: '2025',
|
|
530
|
-
* cvv: '123'
|
|
531
|
-
* },
|
|
532
|
-
* setAsDefault: false
|
|
533
|
-
* });
|
|
534
522
|
* ```
|
|
535
523
|
*/
|
|
536
524
|
create(data: CreatePayeeRequest): Promise<Payee>;
|
|
@@ -124,16 +124,10 @@ interface Payee {
|
|
|
124
124
|
}
|
|
125
125
|
interface CreatePayeeRequest {
|
|
126
126
|
nickname: string;
|
|
127
|
-
accountNumber
|
|
128
|
-
routingNumber
|
|
129
|
-
accountType: 'checking' | 'savings'
|
|
127
|
+
accountNumber: string;
|
|
128
|
+
routingNumber: string;
|
|
129
|
+
accountType: 'checking' | 'savings';
|
|
130
130
|
setAsDefault?: boolean;
|
|
131
|
-
debitCard?: {
|
|
132
|
-
number: string;
|
|
133
|
-
expirationMonth: string;
|
|
134
|
-
expirationYear: string;
|
|
135
|
-
cvv: string;
|
|
136
|
-
};
|
|
137
131
|
}
|
|
138
132
|
interface Transaction {
|
|
139
133
|
id: string;
|
|
@@ -505,12 +499,19 @@ interface VerifyPayeeRequest {
|
|
|
505
499
|
declare class PayeesModule {
|
|
506
500
|
private client;
|
|
507
501
|
constructor(client: UnifiedApiClient);
|
|
502
|
+
/**
|
|
503
|
+
* Validate ABA routing number checksum
|
|
504
|
+
*/
|
|
505
|
+
private validateRoutingNumber;
|
|
506
|
+
/**
|
|
507
|
+
* Validate account number format
|
|
508
|
+
*/
|
|
509
|
+
private validateAccountNumber;
|
|
508
510
|
/**
|
|
509
511
|
* Create a new payee (bank account)
|
|
510
512
|
*
|
|
511
513
|
* @example
|
|
512
514
|
* ```typescript
|
|
513
|
-
* // Bank account
|
|
514
515
|
* const bankAccount = await diviswap.payees.create({
|
|
515
516
|
* nickname: 'My Checking',
|
|
516
517
|
* accountNumber: '123456789',
|
|
@@ -518,19 +519,6 @@ declare class PayeesModule {
|
|
|
518
519
|
* accountType: 'checking',
|
|
519
520
|
* setAsDefault: true
|
|
520
521
|
* });
|
|
521
|
-
*
|
|
522
|
-
* // Debit card
|
|
523
|
-
* const debitCard = await diviswap.payees.create({
|
|
524
|
-
* nickname: 'My Debit Card',
|
|
525
|
-
* accountType: 'debit_card',
|
|
526
|
-
* debitCard: {
|
|
527
|
-
* number: '4111111111111111',
|
|
528
|
-
* expirationMonth: '12',
|
|
529
|
-
* expirationYear: '2025',
|
|
530
|
-
* cvv: '123'
|
|
531
|
-
* },
|
|
532
|
-
* setAsDefault: false
|
|
533
|
-
* });
|
|
534
522
|
* ```
|
|
535
523
|
*/
|
|
536
524
|
create(data: CreatePayeeRequest): Promise<Payee>;
|
package/package.json
CHANGED
|
@@ -133,58 +133,14 @@ const postHandlers: Record<string, ActionHandler> = {
|
|
|
133
133
|
// Set customer context before API calls
|
|
134
134
|
setCustomerContext(diviswap, params);
|
|
135
135
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
setAsDefault: params.setAsDefault || false
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
const payee = await diviswap.payees.create(debitCardPayload);
|
|
148
|
-
return NextResponse.json(payee);
|
|
149
|
-
}
|
|
150
|
-
// Handle legacy flat structure for debit cards
|
|
151
|
-
else if (params.accountType === 'debit_card' || params.payeeType === 'debit') {
|
|
152
|
-
// Parse expiry date if needed
|
|
153
|
-
let expirationMonth = params.expirationMonth;
|
|
154
|
-
let expirationYear = params.expirationYear;
|
|
155
|
-
|
|
156
|
-
// If expiry is in MM/YY format in routingNumber field
|
|
157
|
-
if (params.routingNumber && params.routingNumber.includes('/')) {
|
|
158
|
-
const expiryParts = params.routingNumber.split('/');
|
|
159
|
-
expirationMonth = expiryParts[0];
|
|
160
|
-
expirationYear = expiryParts[1] ? `20${expiryParts[1]}` : '2025';
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const debitCardPayload = {
|
|
164
|
-
nickname: params.nickname,
|
|
165
|
-
accountType: 'debit_card' as const,
|
|
166
|
-
debitCard: {
|
|
167
|
-
number: params.accountNumber?.replace(/\s+/g, '') || '', // Remove spaces
|
|
168
|
-
expirationMonth: expirationMonth || '12',
|
|
169
|
-
expirationYear: expirationYear || '2025',
|
|
170
|
-
cvv: params.cvv || '123'
|
|
171
|
-
},
|
|
172
|
-
setAsDefault: params.setAsDefault || false
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
const payee = await diviswap.payees.create(debitCardPayload);
|
|
176
|
-
return NextResponse.json(payee);
|
|
177
|
-
} else {
|
|
178
|
-
// Bank account structure
|
|
179
|
-
const payee = await diviswap.payees.create({
|
|
180
|
-
nickname: params.nickname,
|
|
181
|
-
accountNumber: params.accountNumber,
|
|
182
|
-
routingNumber: params.routingNumber,
|
|
183
|
-
accountType: params.accountType || 'checking',
|
|
184
|
-
setAsDefault: params.setAsDefault || false
|
|
185
|
-
});
|
|
186
|
-
return NextResponse.json(payee);
|
|
187
|
-
}
|
|
136
|
+
const payee = await diviswap.payees.create({
|
|
137
|
+
nickname: params.nickname,
|
|
138
|
+
accountNumber: params.accountNumber,
|
|
139
|
+
routingNumber: params.routingNumber,
|
|
140
|
+
accountType: params.accountType || 'checking',
|
|
141
|
+
setAsDefault: params.setAsDefault || false
|
|
142
|
+
});
|
|
143
|
+
return NextResponse.json(payee);
|
|
188
144
|
},
|
|
189
145
|
|
|
190
146
|
{{#if (includes features "fees")}}
|
|
@@ -49,7 +49,7 @@ export interface TransactionFees {
|
|
|
49
49
|
|
|
50
50
|
export interface PaymentMethod {
|
|
51
51
|
id: string;
|
|
52
|
-
type: 'bank_account' | '
|
|
52
|
+
type: 'bank_account' | 'wire_transfer';
|
|
53
53
|
last4?: string;
|
|
54
54
|
bankName?: string;
|
|
55
55
|
isDefault?: boolean;
|