@bcc-code/payment-client 1.0.7 → 1.1.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 CHANGED
@@ -66,6 +66,14 @@ const status = await client.getPayment(payment.paymentId)
66
66
 
67
67
  // Get receipt
68
68
  const receipt = await client.getReceipt(payment.paymentId)
69
+
70
+ // Discover available payment methods for a specific context
71
+ const paymentMethods = await client.getPaymentMethods({
72
+ currency: 'EUR',
73
+ amount: 100,
74
+ churchId: 'your-church-uuid',
75
+ isCompany: false
76
+ })
69
77
  ```
70
78
 
71
79
  ## Vue Components Usage
package/dist/index.d.mts CHANGED
@@ -1,3 +1,13 @@
1
+ /** Company details required for Tripletex invoice creation. */
2
+ interface InvoiceRecipientRequest {
3
+ companyName: string;
4
+ address: string;
5
+ postalCode: string;
6
+ city: string;
7
+ country: string;
8
+ vatNumber: string;
9
+ email: string;
10
+ }
1
11
  interface CreatePaymentRequest {
2
12
  payerId?: string;
3
13
  amount: number;
@@ -9,6 +19,10 @@ interface CreatePaymentRequest {
9
19
  paymentMethodDetails?: Record<string, unknown>;
10
20
  person?: PersonInfoRequest;
11
21
  lineItems?: LineItemRequest[];
22
+ /** Whether to create a Tripletex invoice when payment succeeds. */
23
+ invoiceRequested?: boolean;
24
+ /** Required when invoiceRequested is true. */
25
+ invoiceRecipient?: InvoiceRecipientRequest;
12
26
  }
13
27
  interface PersonInfoRequest {
14
28
  payerUid: string;
@@ -49,6 +63,8 @@ interface PaymentResponse {
49
63
  createdAt: string;
50
64
  updatedAt: string;
51
65
  lineItems?: LineItemResponse[];
66
+ invoiceRequested?: boolean;
67
+ tripletexInvoiceId?: string | null;
52
68
  }
53
69
  interface LineItemResponse {
54
70
  id: string;
@@ -87,6 +103,9 @@ interface PaymentReceiptResponse {
87
103
  taxAmount?: number;
88
104
  discountAmount?: number;
89
105
  amountFormatted?: string;
106
+ productName?: string;
107
+ invoiceRequested?: boolean;
108
+ tripletexInvoiceId?: string | null;
90
109
  }
91
110
  interface PaymentSucceededNotification {
92
111
  paymentId: string;
@@ -96,6 +115,13 @@ interface PaymentSucceededNotification {
96
115
  status: string;
97
116
  timestamp: string;
98
117
  }
118
+ interface GetPaymentMethodsOptions {
119
+ provider?: string;
120
+ currency?: string;
121
+ amount?: number;
122
+ churchId?: string;
123
+ isCompany?: boolean;
124
+ }
99
125
 
100
126
  interface PaymentClientOptions {
101
127
  baseUrl: string;
@@ -114,6 +140,7 @@ declare class PaymentClient {
114
140
  getPayment(paymentId: string): Promise<PaymentResponse | null>;
115
141
  getReceipt(paymentId: string): Promise<PaymentReceiptResponse | null>;
116
142
  getTotalAmountByPrefix(prefix: string): Promise<number>;
143
+ getPaymentMethods(options?: GetPaymentMethodsOptions): Promise<unknown>;
117
144
  }
118
145
 
119
146
  interface StripePaymentProps {
@@ -139,4 +166,4 @@ interface AdyenPaymentProps {
139
166
  onCancel?: () => void;
140
167
  }
141
168
 
142
- export { type AdyenPaymentProps, type CreatePaymentRequest, type CreatePaymentResponse, type LineItemRequest, type LineItemResponse, PaymentClient, type PaymentClientOptions, type PaymentReceiptResponse, type PaymentResponse, type PaymentSucceededNotification, type PersonInfoRequest, type StripePaymentProps };
169
+ export { type AdyenPaymentProps, type CreatePaymentRequest, type CreatePaymentResponse, type GetPaymentMethodsOptions, type InvoiceRecipientRequest, type LineItemRequest, type LineItemResponse, PaymentClient, type PaymentClientOptions, type PaymentReceiptResponse, type PaymentResponse, type PaymentSucceededNotification, type PersonInfoRequest, type StripePaymentProps };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,13 @@
1
+ /** Company details required for Tripletex invoice creation. */
2
+ interface InvoiceRecipientRequest {
3
+ companyName: string;
4
+ address: string;
5
+ postalCode: string;
6
+ city: string;
7
+ country: string;
8
+ vatNumber: string;
9
+ email: string;
10
+ }
1
11
  interface CreatePaymentRequest {
2
12
  payerId?: string;
3
13
  amount: number;
@@ -9,6 +19,10 @@ interface CreatePaymentRequest {
9
19
  paymentMethodDetails?: Record<string, unknown>;
10
20
  person?: PersonInfoRequest;
11
21
  lineItems?: LineItemRequest[];
22
+ /** Whether to create a Tripletex invoice when payment succeeds. */
23
+ invoiceRequested?: boolean;
24
+ /** Required when invoiceRequested is true. */
25
+ invoiceRecipient?: InvoiceRecipientRequest;
12
26
  }
13
27
  interface PersonInfoRequest {
14
28
  payerUid: string;
@@ -49,6 +63,8 @@ interface PaymentResponse {
49
63
  createdAt: string;
50
64
  updatedAt: string;
51
65
  lineItems?: LineItemResponse[];
66
+ invoiceRequested?: boolean;
67
+ tripletexInvoiceId?: string | null;
52
68
  }
53
69
  interface LineItemResponse {
54
70
  id: string;
@@ -87,6 +103,9 @@ interface PaymentReceiptResponse {
87
103
  taxAmount?: number;
88
104
  discountAmount?: number;
89
105
  amountFormatted?: string;
106
+ productName?: string;
107
+ invoiceRequested?: boolean;
108
+ tripletexInvoiceId?: string | null;
90
109
  }
91
110
  interface PaymentSucceededNotification {
92
111
  paymentId: string;
@@ -96,6 +115,13 @@ interface PaymentSucceededNotification {
96
115
  status: string;
97
116
  timestamp: string;
98
117
  }
118
+ interface GetPaymentMethodsOptions {
119
+ provider?: string;
120
+ currency?: string;
121
+ amount?: number;
122
+ churchId?: string;
123
+ isCompany?: boolean;
124
+ }
99
125
 
100
126
  interface PaymentClientOptions {
101
127
  baseUrl: string;
@@ -114,6 +140,7 @@ declare class PaymentClient {
114
140
  getPayment(paymentId: string): Promise<PaymentResponse | null>;
115
141
  getReceipt(paymentId: string): Promise<PaymentReceiptResponse | null>;
116
142
  getTotalAmountByPrefix(prefix: string): Promise<number>;
143
+ getPaymentMethods(options?: GetPaymentMethodsOptions): Promise<unknown>;
117
144
  }
118
145
 
119
146
  interface StripePaymentProps {
@@ -139,4 +166,4 @@ interface AdyenPaymentProps {
139
166
  onCancel?: () => void;
140
167
  }
141
168
 
142
- export { type AdyenPaymentProps, type CreatePaymentRequest, type CreatePaymentResponse, type LineItemRequest, type LineItemResponse, PaymentClient, type PaymentClientOptions, type PaymentReceiptResponse, type PaymentResponse, type PaymentSucceededNotification, type PersonInfoRequest, type StripePaymentProps };
169
+ export { type AdyenPaymentProps, type CreatePaymentRequest, type CreatePaymentResponse, type GetPaymentMethodsOptions, type InvoiceRecipientRequest, type LineItemRequest, type LineItemResponse, PaymentClient, type PaymentClientOptions, type PaymentReceiptResponse, type PaymentResponse, type PaymentSucceededNotification, type PersonInfoRequest, type StripePaymentProps };
package/dist/index.js CHANGED
@@ -131,6 +131,36 @@ var PaymentClient = class {
131
131
  }
132
132
  return await response.json();
133
133
  }
134
+ async getPaymentMethods(options = {}) {
135
+ const token = await this.getAuthToken();
136
+ const params = new URLSearchParams();
137
+ if (options.provider) params.set("provider", options.provider);
138
+ if (options.currency) params.set("currency", options.currency);
139
+ if (options.amount != null) params.set("amount", options.amount.toString());
140
+ if (options.churchId) params.set("churchId", options.churchId);
141
+ if (options.isCompany != null) params.set("isCompany", options.isCompany.toString());
142
+ const controller = new AbortController();
143
+ if (this.timeout) {
144
+ setTimeout(() => controller.abort(), this.timeout);
145
+ }
146
+ const response = await fetch(
147
+ `${this.baseUrl}/api/v1/configuration/payment-methods?${params.toString()}`,
148
+ {
149
+ headers: {
150
+ "Authorization": `Bearer ${token}`,
151
+ "X-Tenant-ID": this.tenantId
152
+ },
153
+ signal: controller.signal
154
+ }
155
+ );
156
+ if (!response.ok) {
157
+ const errorText = await response.text();
158
+ throw new Error(
159
+ `Payment API request failed: ${response.status} ${response.statusText}. ${errorText}`
160
+ );
161
+ }
162
+ return await response.json();
163
+ }
134
164
  };
135
165
  // Annotate the CommonJS export names for ESM import in node:
136
166
  0 && (module.exports = {
package/dist/index.mjs CHANGED
@@ -105,6 +105,36 @@ var PaymentClient = class {
105
105
  }
106
106
  return await response.json();
107
107
  }
108
+ async getPaymentMethods(options = {}) {
109
+ const token = await this.getAuthToken();
110
+ const params = new URLSearchParams();
111
+ if (options.provider) params.set("provider", options.provider);
112
+ if (options.currency) params.set("currency", options.currency);
113
+ if (options.amount != null) params.set("amount", options.amount.toString());
114
+ if (options.churchId) params.set("churchId", options.churchId);
115
+ if (options.isCompany != null) params.set("isCompany", options.isCompany.toString());
116
+ const controller = new AbortController();
117
+ if (this.timeout) {
118
+ setTimeout(() => controller.abort(), this.timeout);
119
+ }
120
+ const response = await fetch(
121
+ `${this.baseUrl}/api/v1/configuration/payment-methods?${params.toString()}`,
122
+ {
123
+ headers: {
124
+ "Authorization": `Bearer ${token}`,
125
+ "X-Tenant-ID": this.tenantId
126
+ },
127
+ signal: controller.signal
128
+ }
129
+ );
130
+ if (!response.ok) {
131
+ const errorText = await response.text();
132
+ throw new Error(
133
+ `Payment API request failed: ${response.status} ${response.statusText}. ${errorText}`
134
+ );
135
+ }
136
+ return await response.json();
137
+ }
108
138
  };
109
139
  export {
110
140
  PaymentClient
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bcc-code/payment-client",
3
- "version": "1.0.7",
3
+ "version": "1.1.0",
4
4
  "description": "Client SDK for BCC Payment Orchestrator API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",