@bcc-code/payment-client 1.0.8 → 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
@@ -115,6 +115,13 @@ interface PaymentSucceededNotification {
115
115
  status: string;
116
116
  timestamp: string;
117
117
  }
118
+ interface GetPaymentMethodsOptions {
119
+ provider?: string;
120
+ currency?: string;
121
+ amount?: number;
122
+ churchId?: string;
123
+ isCompany?: boolean;
124
+ }
118
125
 
119
126
  interface PaymentClientOptions {
120
127
  baseUrl: string;
@@ -133,6 +140,7 @@ declare class PaymentClient {
133
140
  getPayment(paymentId: string): Promise<PaymentResponse | null>;
134
141
  getReceipt(paymentId: string): Promise<PaymentReceiptResponse | null>;
135
142
  getTotalAmountByPrefix(prefix: string): Promise<number>;
143
+ getPaymentMethods(options?: GetPaymentMethodsOptions): Promise<unknown>;
136
144
  }
137
145
 
138
146
  interface StripePaymentProps {
@@ -158,4 +166,4 @@ interface AdyenPaymentProps {
158
166
  onCancel?: () => void;
159
167
  }
160
168
 
161
- export { type AdyenPaymentProps, type CreatePaymentRequest, type CreatePaymentResponse, type InvoiceRecipientRequest, 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
@@ -115,6 +115,13 @@ interface PaymentSucceededNotification {
115
115
  status: string;
116
116
  timestamp: string;
117
117
  }
118
+ interface GetPaymentMethodsOptions {
119
+ provider?: string;
120
+ currency?: string;
121
+ amount?: number;
122
+ churchId?: string;
123
+ isCompany?: boolean;
124
+ }
118
125
 
119
126
  interface PaymentClientOptions {
120
127
  baseUrl: string;
@@ -133,6 +140,7 @@ declare class PaymentClient {
133
140
  getPayment(paymentId: string): Promise<PaymentResponse | null>;
134
141
  getReceipt(paymentId: string): Promise<PaymentReceiptResponse | null>;
135
142
  getTotalAmountByPrefix(prefix: string): Promise<number>;
143
+ getPaymentMethods(options?: GetPaymentMethodsOptions): Promise<unknown>;
136
144
  }
137
145
 
138
146
  interface StripePaymentProps {
@@ -158,4 +166,4 @@ interface AdyenPaymentProps {
158
166
  onCancel?: () => void;
159
167
  }
160
168
 
161
- export { type AdyenPaymentProps, type CreatePaymentRequest, type CreatePaymentResponse, type InvoiceRecipientRequest, 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.8",
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",