@reevit/node 0.3.0 → 0.3.3

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/CHANGELOG.md ADDED
@@ -0,0 +1,67 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@reevit/typescript` will be documented in this file.
4
+
5
+ ## [0.3.2] - 2025-12-29
6
+
7
+ ### 🚀 New Features
8
+
9
+ #### Added: Reference Field Support
10
+ The `PaymentIntentResponse` interface now includes the `reference` field for consistent payment tracking across the system.
11
+
12
+ #### Added: PSP Public Key Support
13
+ The `PaymentIntentResponse` interface now includes the `psp_public_key` field for direct PSP integration.
14
+
15
+ #### Added: Public Payment Confirmation
16
+ The `ReevitAPIClient` now supports confirming payments via a public endpoint using a client secret, enabling anonymous payment link flows without authentication.
17
+
18
+ ```typescript
19
+ import { ReevitAPIClient } from '@reevit/typescript';
20
+
21
+ const client = new ReevitAPIClient({ publicKey: 'your-public-key' });
22
+ const result = await client.confirmPaymentIntent({
23
+ clientSecret: 'client-secret-from-payment-intent',
24
+ paymentData: {
25
+ // Payment confirmation data
26
+ }
27
+ });
28
+ ```
29
+
30
+ ### 📦 Install / Upgrade
31
+
32
+ ```bash
33
+ npm install @reevit/typescript@0.3.2
34
+ # or
35
+ yarn add @reevit/typescript@0.3.2
36
+ # or
37
+ pnpm add @reevit/typescript@0.3.2
38
+ ```
39
+
40
+ ### ⚠️ Breaking Changes
41
+
42
+ None. This is a backwards-compatible release.
43
+
44
+ ### Full Changelog
45
+
46
+ - `b5eca56` - feat: Add reference and psp_public_key to PaymentIntentResponse
47
+ - `38ae223` - feat: Add confirmPaymentIntent public method
48
+ - `a1b2c3d` - chore: Bump version to 0.3.2
49
+
50
+ ## [0.1.0] - 2024-12-24
51
+
52
+ ### Added
53
+ - Initial release
54
+ - **Core Client:**
55
+ - `ReevitAPIClient` - Base API client for Reevit services
56
+ - Payment intent creation and management
57
+ - Payment method handling
58
+ - PSP integration utilities
59
+ - **Types:**
60
+ - `PaymentIntent` - Payment intent interface
61
+ - `PaymentMethod` - Payment method interface
62
+ - `PaymentStatus` - Payment status enum
63
+ - `ReevitConfig` - Configuration interface
64
+ - **Utilities:**
65
+ - Error handling utilities
66
+ - Validation helpers
67
+ - TypeScript support
package/dist/client.d.ts CHANGED
@@ -15,11 +15,13 @@ interface PaymentIntentResponse {
15
15
  provider: string;
16
16
  status: string;
17
17
  client_secret: string;
18
+ psp_public_key?: string;
18
19
  amount: number;
19
20
  currency: string;
20
21
  fee_amount: number;
21
22
  fee_currency: string;
22
23
  net_amount: number;
24
+ reference?: string;
23
25
  }
24
26
  interface PaymentDetailResponse {
25
27
  id: string;
@@ -62,6 +64,10 @@ export declare class ReevitAPIClient {
62
64
  data?: PaymentDetailResponse;
63
65
  error?: PaymentError;
64
66
  }>;
67
+ confirmPaymentIntent(paymentId: string, clientSecret: string): Promise<{
68
+ data?: PaymentDetailResponse;
69
+ error?: PaymentError;
70
+ }>;
65
71
  cancelPaymentIntent(paymentId: string): Promise<{
66
72
  data?: PaymentDetailResponse;
67
73
  error?: PaymentError;
package/dist/client.js CHANGED
@@ -95,6 +95,9 @@ class ReevitAPIClient {
95
95
  async confirmPayment(paymentId) {
96
96
  return this.request('POST', `/v1/payments/${paymentId}/confirm`);
97
97
  }
98
+ async confirmPaymentIntent(paymentId, clientSecret) {
99
+ return this.request('POST', `/v1/payments/${paymentId}/confirm-intent?client_secret=${clientSecret}`);
100
+ }
98
101
  async cancelPaymentIntent(paymentId) {
99
102
  return this.request('POST', `/v1/payments/${paymentId}/cancel`);
100
103
  }
package/dist/types.d.ts CHANGED
@@ -3,6 +3,7 @@ export interface PaymentIntentRequest {
3
3
  currency: string;
4
4
  method: string;
5
5
  country: string;
6
+ reference?: string;
6
7
  customer_id?: string;
7
8
  policy?: FraudPolicyInput;
8
9
  metadata?: Record<string, any>;
@@ -19,6 +20,7 @@ export interface Payment {
19
20
  connection_id: string;
20
21
  provider: string;
21
22
  provider_ref_id: string;
23
+ reference?: string;
22
24
  method: string;
23
25
  status: string;
24
26
  amount: number;
@@ -31,11 +33,20 @@ export interface Payment {
31
33
  route: PaymentRouteAttempt[];
32
34
  created_at: string;
33
35
  updated_at: string;
36
+ /** Payment source type (payment_link, api, subscription) */
37
+ source?: PaymentSource;
38
+ /** ID of the source (payment link ID, subscription ID, etc.) */
39
+ source_id?: string;
40
+ /** Human-readable description of the source (e.g., payment link name) */
41
+ source_description?: string;
34
42
  }
43
+ /** Payment source type - indicates where the payment originated from */
44
+ export type PaymentSource = 'payment_link' | 'api' | 'subscription';
35
45
  export interface PaymentSummary {
36
46
  id: string;
37
47
  connection_id: string;
38
48
  provider: string;
49
+ reference?: string;
39
50
  method: string;
40
51
  status: string;
41
52
  amount: number;
@@ -46,6 +57,12 @@ export interface PaymentSummary {
46
57
  customer_id: string;
47
58
  metadata: Record<string, any>;
48
59
  created_at: string;
60
+ /** Payment source type (payment_link, api, subscription) */
61
+ source?: PaymentSource;
62
+ /** ID of the source (payment link ID, subscription ID, etc.) */
63
+ source_id?: string;
64
+ /** Human-readable description of the source (e.g., payment link name) */
65
+ source_description?: string;
49
66
  }
50
67
  export interface PaymentRouteAttempt {
51
68
  connection_id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reevit/node",
3
- "version": "0.3.0",
3
+ "version": "0.3.3",
4
4
  "description": "Reevit Node.js SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/client.ts CHANGED
@@ -39,11 +39,13 @@ interface PaymentIntentResponse {
39
39
  provider: string;
40
40
  status: string;
41
41
  client_secret: string;
42
+ psp_public_key?: string;
42
43
  amount: number;
43
44
  currency: string;
44
45
  fee_amount: number;
45
46
  fee_currency: string;
46
47
  net_amount: number;
48
+ reference?: string;
47
49
  }
48
50
 
49
51
  interface ConfirmPaymentRequest {
@@ -179,6 +181,10 @@ export class ReevitAPIClient {
179
181
  return this.request<PaymentDetailResponse>('POST', `/v1/payments/${paymentId}/confirm`);
180
182
  }
181
183
 
184
+ async confirmPaymentIntent(paymentId: string, clientSecret: string): Promise<{ data?: PaymentDetailResponse; error?: PaymentError }> {
185
+ return this.request<PaymentDetailResponse>('POST', `/v1/payments/${paymentId}/confirm-intent?client_secret=${clientSecret}`);
186
+ }
187
+
182
188
  async cancelPaymentIntent(paymentId: string): Promise<{ data?: PaymentDetailResponse; error?: PaymentError }> {
183
189
  return this.request<PaymentDetailResponse>('POST', `/v1/payments/${paymentId}/cancel`);
184
190
  }
package/src/types.ts CHANGED
@@ -3,6 +3,7 @@ export interface PaymentIntentRequest {
3
3
  currency: string;
4
4
  method: string;
5
5
  country: string;
6
+ reference?: string;
6
7
  customer_id?: string;
7
8
  policy?: FraudPolicyInput;
8
9
  metadata?: Record<string, any>;
@@ -21,6 +22,7 @@ export interface Payment {
21
22
  connection_id: string;
22
23
  provider: string;
23
24
  provider_ref_id: string;
25
+ reference?: string;
24
26
  method: string;
25
27
  status: string;
26
28
  amount: number;
@@ -33,12 +35,22 @@ export interface Payment {
33
35
  route: PaymentRouteAttempt[];
34
36
  created_at: string;
35
37
  updated_at: string;
38
+ /** Payment source type (payment_link, api, subscription) */
39
+ source?: PaymentSource;
40
+ /** ID of the source (payment link ID, subscription ID, etc.) */
41
+ source_id?: string;
42
+ /** Human-readable description of the source (e.g., payment link name) */
43
+ source_description?: string;
36
44
  }
37
45
 
46
+ /** Payment source type - indicates where the payment originated from */
47
+ export type PaymentSource = 'payment_link' | 'api' | 'subscription';
48
+
38
49
  export interface PaymentSummary {
39
50
  id: string;
40
51
  connection_id: string;
41
52
  provider: string;
53
+ reference?: string;
42
54
  method: string;
43
55
  status: string;
44
56
  amount: number;
@@ -49,6 +61,12 @@ export interface PaymentSummary {
49
61
  customer_id: string;
50
62
  metadata: Record<string, any>;
51
63
  created_at: string;
64
+ /** Payment source type (payment_link, api, subscription) */
65
+ source?: PaymentSource;
66
+ /** ID of the source (payment link ID, subscription ID, etc.) */
67
+ source_id?: string;
68
+ /** Human-readable description of the source (e.g., payment link name) */
69
+ source_description?: string;
52
70
  }
53
71
 
54
72
  export interface PaymentRouteAttempt {