@qonto/embed-sdk 0.63.0 → 0.64.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/beneficiaries/client/beneficiaries.client.d.ts.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/payment-links/client/payment-links.client.d.ts +95 -0
- package/dist/payment-links/client/payment-links.client.d.ts.map +1 -0
- package/dist/payment-links/client/payment-links.client.test.d.ts +2 -0
- package/dist/payment-links/client/payment-links.client.test.d.ts.map +1 -0
- package/dist/payment-links/index.d.ts +27 -6
- package/dist/payment-links/index.d.ts.map +1 -1
- package/dist/payment-links/index.server.d.ts +35 -0
- package/dist/payment-links/index.server.d.ts.map +1 -0
- package/dist/payment-links/server/payment-links.server.d.ts +50 -0
- package/dist/payment-links/server/payment-links.server.d.ts.map +1 -0
- package/dist/payment-links/server/payment-links.server.test.d.ts +2 -0
- package/dist/payment-links/server/payment-links.server.test.d.ts.map +1 -0
- package/dist/payment-links/shared/currency.validation.d.ts.map +1 -0
- package/dist/payment-links/shared/payment-links.shared.test.d.ts +2 -0
- package/dist/payment-links/shared/payment-links.shared.test.d.ts.map +1 -0
- package/dist/payment-links/{payment-links.types.d.ts → shared/payment-links.types.d.ts} +2 -2
- package/dist/payment-links/shared/payment-links.types.d.ts.map +1 -0
- package/dist/payment-links/{validation → shared}/payment-links.validate.d.ts +1 -1
- package/dist/payment-links/shared/payment-links.validate.d.ts.map +1 -0
- package/dist/payment-links/shared/unit.validation.d.ts.map +1 -0
- package/dist/server/beneficiaries/client/beneficiaries.client.d.ts.map +1 -1
- package/dist/server/payment-links/client/payment-links.client.d.ts +95 -0
- package/dist/server/payment-links/client/payment-links.client.d.ts.map +1 -0
- package/dist/server/payment-links/client/payment-links.client.test.d.ts +2 -0
- package/dist/server/payment-links/client/payment-links.client.test.d.ts.map +1 -0
- package/dist/server/payment-links/index.d.ts +27 -6
- package/dist/server/payment-links/index.d.ts.map +1 -1
- package/dist/server/payment-links/index.server.d.ts +35 -0
- package/dist/server/payment-links/index.server.d.ts.map +1 -0
- package/dist/server/payment-links/server/payment-links.server.d.ts +50 -0
- package/dist/server/payment-links/server/payment-links.server.d.ts.map +1 -0
- package/dist/server/payment-links/server/payment-links.server.test.d.ts +2 -0
- package/dist/server/payment-links/server/payment-links.server.test.d.ts.map +1 -0
- package/dist/server/payment-links/shared/currency.validation.d.ts.map +1 -0
- package/dist/server/payment-links/shared/payment-links.shared.test.d.ts +2 -0
- package/dist/server/payment-links/shared/payment-links.shared.test.d.ts.map +1 -0
- package/dist/server/payment-links/{payment-links.types.d.ts → shared/payment-links.types.d.ts} +2 -2
- package/dist/server/payment-links/shared/payment-links.types.d.ts.map +1 -0
- package/dist/server/payment-links/{validation → shared}/payment-links.validate.d.ts +1 -1
- package/dist/server/payment-links/shared/payment-links.validate.d.ts.map +1 -0
- package/dist/server/payment-links/shared/unit.validation.d.ts.map +1 -0
- package/dist/server/types/types.public-api.d.ts +1 -1
- package/dist/server/types/types.public-api.d.ts.map +1 -1
- package/dist/server/validation/operation-settings-validation.d.ts +2 -1
- package/dist/server/validation/operation-settings-validation.d.ts.map +1 -1
- package/dist/src/auth-links/shared/auth-links.api.js +1 -1
- package/dist/src/beneficiaries/client/beneficiaries.client.js +1 -1
- package/dist/src/cards/client/cards.client.js +1 -1
- package/dist/src/payment-links/client/payment-links.client.js +1 -0
- package/dist/src/payment-links/index.js +1 -1
- package/dist/src/payment-links/shared/payment-links.validate.js +1 -0
- package/dist/types/types.public-api.d.ts +1 -1
- package/dist/types/types.public-api.d.ts.map +1 -1
- package/dist/validation/operation-settings-validation.d.ts +2 -1
- package/dist/validation/operation-settings-validation.d.ts.map +1 -1
- package/package.json +5 -1
- package/dist/payment-links/payment-links.d.ts +0 -58
- package/dist/payment-links/payment-links.d.ts.map +0 -1
- package/dist/payment-links/payment-links.public-api.d.ts +0 -5
- package/dist/payment-links/payment-links.public-api.d.ts.map +0 -1
- package/dist/payment-links/payment-links.test.d.ts +0 -2
- package/dist/payment-links/payment-links.test.d.ts.map +0 -1
- package/dist/payment-links/payment-links.types.d.ts.map +0 -1
- package/dist/payment-links/validation/currency.validation.d.ts.map +0 -1
- package/dist/payment-links/validation/payment-links.validate.d.ts.map +0 -1
- package/dist/payment-links/validation/unit.validation.d.ts.map +0 -1
- package/dist/server/payment-links/payment-links.d.ts +0 -58
- package/dist/server/payment-links/payment-links.d.ts.map +0 -1
- package/dist/server/payment-links/payment-links.public-api.d.ts +0 -5
- package/dist/server/payment-links/payment-links.public-api.d.ts.map +0 -1
- package/dist/server/payment-links/payment-links.test.d.ts +0 -2
- package/dist/server/payment-links/payment-links.test.d.ts.map +0 -1
- package/dist/server/payment-links/payment-links.types.d.ts.map +0 -1
- package/dist/server/payment-links/validation/currency.validation.d.ts.map +0 -1
- package/dist/server/payment-links/validation/payment-links.validate.d.ts.map +0 -1
- package/dist/server/payment-links/validation/unit.validation.d.ts.map +0 -1
- package/dist/src/auth-links/auth-links.js +0 -1
- package/dist/src/payment-links/payment-links.js +0 -1
- package/dist/src/payment-links/payment-links.public-api.js +0 -1
- package/dist/src/payment-links/validation/payment-links.validate.js +0 -1
- /package/dist/payment-links/{validation → shared}/currency.validation.d.ts +0 -0
- /package/dist/payment-links/{validation → shared}/unit.validation.d.ts +0 -0
- /package/dist/server/payment-links/{validation → shared}/currency.validation.d.ts +0 -0
- /package/dist/server/payment-links/{validation → shared}/unit.validation.d.ts +0 -0
- /package/dist/src/payment-links/{validation → shared}/currency.validation.js +0 -0
- /package/dist/src/payment-links/{payment-links.types.js → shared/payment-links.types.js} +0 -0
- /package/dist/src/payment-links/{validation → shared}/unit.validation.js +0 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { ClientOperationSettings } from '@validation/operation-settings-validation';
|
|
2
|
+
import type { CreatePaymentLinkSettings, PaymentLinkParams } from '../shared/payment-links.types';
|
|
3
|
+
/**
|
|
4
|
+
* Generates the URL for initiating a payment link creation flow with specified items.
|
|
5
|
+
*
|
|
6
|
+
* **Client-side only** - Uses proxy-based authentication.
|
|
7
|
+
* For server-side operations, import from `'@qonto/embed-sdk/server/payment-links'`.
|
|
8
|
+
*
|
|
9
|
+
* @param params - An object containing:
|
|
10
|
+
* - `paymentLinkSettings`: An object containing:
|
|
11
|
+
* - `items`: An array of items to be included in the payment link. Each item must conform to the Item type and will be validated.
|
|
12
|
+
* - `callbackUrl`: Required callback URL to redirect to after payment link creation.
|
|
13
|
+
* - `operationSettings`: An object with operation-level settings such as
|
|
14
|
+
* `proxyEndpointDescriptor` (preferred) or `proxyRequestFunction` (at least one required).
|
|
15
|
+
* @returns Promise resolving to the full URL as a string, which can be used to launch the payment link creation flow in an iframe or browser.
|
|
16
|
+
* @throws `InvalidParametersError` If neither `proxyEndpointDescriptor` nor
|
|
17
|
+
* `proxyRequestFunction` is provided, or if the provided items array is invalid, or if callbackUrl is missing or invalid.
|
|
18
|
+
* @throws `AuthenticationError` If authentication fails (e.g., invalid or missing access token).
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```
|
|
22
|
+
* // Preferred: Using proxyEndpointDescriptor
|
|
23
|
+
* const url = await paymentLinks.getPaymentLinkCreationFlowUrl({
|
|
24
|
+
* paymentLinkSettings: {
|
|
25
|
+
* items: [{ id: '1', title: 'Item 1', type: 'service', quantity: 1, measureUnit: 'unit', unitPrice: { currency: 'EUR', value: '10' }, vatRate: '20' }],
|
|
26
|
+
* callbackUrl: 'https://example.com/callback',
|
|
27
|
+
* },
|
|
28
|
+
* operationSettings: { proxyEndpointDescriptor }
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```
|
|
34
|
+
* // Alternative: Using proxyRequestFunction
|
|
35
|
+
* const url = await paymentLinks.getPaymentLinkCreationFlowUrl({
|
|
36
|
+
* paymentLinkSettings: {
|
|
37
|
+
* items: [{ id: '1', title: 'Item 1', type: 'service', quantity: 1, measureUnit: 'unit', unitPrice: { currency: 'EUR', value: '10' }, vatRate: '20' }],
|
|
38
|
+
* callbackUrl: 'https://example.com/callback',
|
|
39
|
+
* },
|
|
40
|
+
* operationSettings: {
|
|
41
|
+
* proxyRequestFunction: async (encodedCall) => {
|
|
42
|
+
* // Implement your proxy logic here
|
|
43
|
+
* },
|
|
44
|
+
* }
|
|
45
|
+
* });
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare const getPaymentLinkCreationFlowUrl: ({ paymentLinkSettings, operationSettings, }: PaymentLinkParams<CreatePaymentLinkSettings, ClientOperationSettings>) => Promise<string>;
|
|
49
|
+
/**
|
|
50
|
+
* Redirects to the payment link creation flow with specified items.
|
|
51
|
+
*
|
|
52
|
+
* **Client-side only** - Uses proxy-based authentication and browser redirect.
|
|
53
|
+
* This function is not available in server-side imports.
|
|
54
|
+
*
|
|
55
|
+
* @param params - An object containing:
|
|
56
|
+
* - `paymentLinkSettings`: An object containing:
|
|
57
|
+
* - `items`: An array of items to be included in the payment link. Each item must conform to the Item type and will be validated.
|
|
58
|
+
* - `callbackUrl`: Required callback URL to redirect to after payment link creation.
|
|
59
|
+
* - `operationSettings`: An object with operation-level settings such as
|
|
60
|
+
* `proxyEndpointDescriptor` (preferred) or `proxyRequestFunction` (at least one required).
|
|
61
|
+
* @returns This function redirects the browser to the payment link creation flow. Due to the redirect, the returned promise will not resolve.
|
|
62
|
+
* @throws `InvalidParametersError` If neither `proxyEndpointDescriptor` nor
|
|
63
|
+
* `proxyRequestFunction` is provided, or if the provided items array is invalid, or if callbackUrl is missing or invalid.
|
|
64
|
+
* @throws `AuthenticationError` If authentication fails (e.g., invalid or missing access token).
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```
|
|
68
|
+
* // Preferred: Using proxyEndpointDescriptor
|
|
69
|
+
* await paymentLinks.redirectToPaymentLinkCreationFlow({
|
|
70
|
+
* paymentLinkSettings: {
|
|
71
|
+
* items: [{ id: '1', title: 'Item 1', type: 'service', quantity: 1, measureUnit: 'unit', unitPrice: { currency: 'EUR', value: '10' }, vatRate: '20' }],
|
|
72
|
+
* callbackUrl: 'https://example.com/callback',
|
|
73
|
+
* },
|
|
74
|
+
* operationSettings: { proxyEndpointDescriptor }
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```
|
|
80
|
+
* // Alternative: Using proxyRequestFunction
|
|
81
|
+
* await paymentLinks.redirectToPaymentLinkCreationFlow({
|
|
82
|
+
* paymentLinkSettings: {
|
|
83
|
+
* items: [{ id: '1', title: 'Item 1', type: 'service', quantity: 1, measureUnit: 'unit', unitPrice: { currency: 'EUR', value: '10' }, vatRate: '20' }],
|
|
84
|
+
* callbackUrl: 'https://example.com/callback',
|
|
85
|
+
* },
|
|
86
|
+
* operationSettings: {
|
|
87
|
+
* proxyRequestFunction: async (encodedCall) => {
|
|
88
|
+
* // Implement your proxy logic here
|
|
89
|
+
* },
|
|
90
|
+
* }
|
|
91
|
+
* });
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export declare const redirectToPaymentLinkCreationFlow: ({ paymentLinkSettings, operationSettings, }: PaymentLinkParams<CreatePaymentLinkSettings, ClientOperationSettings>) => Promise<void>;
|
|
95
|
+
//# sourceMappingURL=payment-links.client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-links.client.d.ts","sourceRoot":"","sources":["../../../src/payment-links/client/payment-links.client.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAGzF,OAAO,KAAK,EACV,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AAMvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,eAAO,MAAM,6BAA6B,GAAU,6CAGjD,iBAAiB,CAClB,yBAAyB,EACzB,uBAAuB,CACxB,KAAG,OAAO,CAAC,MAAM,CA6BjB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,eAAO,MAAM,iCAAiC,GAAU,6CAGrD,iBAAiB,CAClB,yBAAyB,EACzB,uBAAuB,CACxB,KAAG,OAAO,CAAC,IAAI,CAMf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-links.client.test.d.ts","sourceRoot":"","sources":["../../../src/payment-links/client/payment-links.client.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,13 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The paymentLinks namespace contains all the functions related to
|
|
3
|
-
* operations such as starting the payment link creation flow.
|
|
2
|
+
* The paymentLinks namespace contains all the client-side functions related to payment link
|
|
3
|
+
* operations such as starting the payment link creation flow.
|
|
4
|
+
*
|
|
5
|
+
* **Client-side only** - This namespace uses proxy-based authentication
|
|
6
|
+
* (`proxyEndpointDescriptor` (preferred), or `proxyRequestFunction`).
|
|
7
|
+
*
|
|
8
|
+
* For server-side operations using access token, import from
|
|
9
|
+
* `'@qonto/embed-sdk/server/payment-links'`.
|
|
10
|
+
*
|
|
11
|
+
* It can be accessed like this:
|
|
4
12
|
* ```ts
|
|
5
|
-
* import { paymentLinks } from '@qonto/embed-sdk/
|
|
6
|
-
*
|
|
7
|
-
*
|
|
13
|
+
* import { paymentLinks } from '@qonto/embed-sdk/payment-links';
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* Then, the paymentLinks object contains the functions to perform payment link operations:
|
|
17
|
+
* ```ts
|
|
18
|
+
* // Preferred: Using proxyEndpointDescriptor
|
|
19
|
+
* const url = await paymentLinks.getPaymentLinkCreationFlowUrl({
|
|
20
|
+
* paymentLinkSettings: {
|
|
21
|
+
* items: [{ id: '1', title: 'Item 1', type: 'service', quantity: 1, measureUnit: 'unit', unitPrice: { currency: 'EUR', value: '10' }, vatRate: '20' }],
|
|
22
|
+
* callbackUrl: 'https://example.com/callback',
|
|
23
|
+
* },
|
|
24
|
+
* operationSettings: { proxyEndpointDescriptor }
|
|
25
|
+
* });
|
|
8
26
|
* ```
|
|
9
27
|
*/
|
|
10
28
|
export declare const paymentLinks: {
|
|
11
|
-
getPaymentLinkCreationFlowUrl: ({ paymentLinkSettings, operationSettings, }: import("
|
|
29
|
+
getPaymentLinkCreationFlowUrl: ({ paymentLinkSettings, operationSettings, }: import(".").PaymentLinkParams<import(".").CreatePaymentLinkSettings, import("@validation/operation-settings-validation").ClientOperationSettings>) => Promise<string>;
|
|
30
|
+
redirectToPaymentLinkCreationFlow: ({ paymentLinkSettings, operationSettings, }: import(".").PaymentLinkParams<import(".").CreatePaymentLinkSettings, import("@validation/operation-settings-validation").ClientOperationSettings>) => Promise<void>;
|
|
12
31
|
};
|
|
32
|
+
export type * from './shared/payment-links.types';
|
|
33
|
+
export type { ClientOperationSettings, ClientOperationSettingsWithUI, } from '@validation/operation-settings-validation';
|
|
13
34
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/payment-links/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/payment-links/index.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,YAAY;;;CAGxB,CAAC;AAGF,mBAAmB,8BAA8B,CAAC;AAClD,YAAY,EACV,uBAAuB,EACvB,6BAA6B,GAC9B,MAAM,2CAA2C,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The paymentLinks namespace contains all the server-side functions related to payment link operations.
|
|
3
|
+
* This version uses access token-based authentication and is designed for server environments.
|
|
4
|
+
*
|
|
5
|
+
* **Server-side only** - This namespace uses access token-based authentication.
|
|
6
|
+
*
|
|
7
|
+
* For client-side operations using proxy functions, import from `'@qonto/embed-sdk/payment-links'`.
|
|
8
|
+
*
|
|
9
|
+
* **Note:** The `redirectToPaymentLinkCreationFlow` function is not available in the server-side
|
|
10
|
+
* implementation as it requires browser-specific APIs (`window.location.href`).
|
|
11
|
+
*
|
|
12
|
+
* It can be accessed like this:
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { paymentLinks } from '@qonto/embed-sdk/server/payment-links';
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* Then, the paymentLinks object contains the functions to perform payment link operations:
|
|
18
|
+
* ```ts
|
|
19
|
+
* const url = await paymentLinks.getPaymentLinkCreationFlowUrl({
|
|
20
|
+
* paymentLinkSettings: {
|
|
21
|
+
* items: [{ id: '1', title: 'Item 1', type: 'service', quantity: 1, measureUnit: 'unit', unitPrice: { currency: 'EUR', value: '10' }, vatRate: '20' }],
|
|
22
|
+
* callbackUrl: 'https://example.com/callback',
|
|
23
|
+
* },
|
|
24
|
+
* operationSettings: {
|
|
25
|
+
* accessToken: 'your-access-token',
|
|
26
|
+
* }
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare const paymentLinks: {
|
|
31
|
+
getPaymentLinkCreationFlowUrl: ({ paymentLinkSettings, operationSettings, }: import(".").PaymentLinkParams<import(".").CreatePaymentLinkSettings, import("@validation/operation-settings-validation").ServerOperationSettings>) => Promise<string>;
|
|
32
|
+
};
|
|
33
|
+
export type * from './shared/payment-links.types';
|
|
34
|
+
export type { ServerOperationSettings } from '@validation/operation-settings-validation';
|
|
35
|
+
//# sourceMappingURL=index.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.server.d.ts","sourceRoot":"","sources":["../../src/payment-links/index.server.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,YAAY;;CAExB,CAAC;AAGF,mBAAmB,8BAA8B,CAAC;AAClD,YAAY,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ServerOperationSettings } from '@validation/operation-settings-validation';
|
|
2
|
+
import type { CreatePaymentLinkSettings, PaymentLinkParams } from '../shared/payment-links.types';
|
|
3
|
+
/**
|
|
4
|
+
* Generates the URL for initiating a payment link creation flow with specified items.
|
|
5
|
+
*
|
|
6
|
+
* **Server-side implementation** - Uses access token-based authentication.
|
|
7
|
+
* This implementation is designed for server environments where access tokens can be safely managed.
|
|
8
|
+
*
|
|
9
|
+
* For client-side operations using proxy functions, import from `'@qonto/embed-sdk/payment-links'`.
|
|
10
|
+
*
|
|
11
|
+
* @param params - An object containing:
|
|
12
|
+
* - `paymentLinkSettings`: An object containing:
|
|
13
|
+
* - `items`: An array of items to be included in the payment link. Each item must conform to the Item type and will be validated.
|
|
14
|
+
* - `callbackUrl`: Required callback URL to redirect to after payment link creation.
|
|
15
|
+
* - `operationSettings`: An object with operation-level settings such as
|
|
16
|
+
* `accessToken`, `stagingToken`, and other optional parameters.
|
|
17
|
+
* See {@link ServerOperationSettings}.
|
|
18
|
+
* @returns Promise resolving to the full URL as a string, which can be used to launch the payment link creation flow in an iframe or browser.
|
|
19
|
+
* @throws `InvalidParametersError` If the provided items array is invalid or if callbackUrl is missing or invalid.
|
|
20
|
+
* @throws `AuthenticationError` If authentication fails (e.g., invalid or missing access token).
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import { paymentLinks } from '@qonto/embed-sdk/server/payment-links';
|
|
25
|
+
*
|
|
26
|
+
* const url = await paymentLinks.getPaymentLinkCreationFlowUrl({
|
|
27
|
+
* paymentLinkSettings: {
|
|
28
|
+
* items: [
|
|
29
|
+
* {
|
|
30
|
+
* id: '1',
|
|
31
|
+
* title: 'Item 1',
|
|
32
|
+
* type: 'service',
|
|
33
|
+
* quantity: 1,
|
|
34
|
+
* measureUnit: 'unit',
|
|
35
|
+
* unitPrice: { currency: 'EUR', value: '10' },
|
|
36
|
+
* vatRate: '20'
|
|
37
|
+
* }
|
|
38
|
+
* ],
|
|
39
|
+
* callbackUrl: 'https://example.com/callback',
|
|
40
|
+
* },
|
|
41
|
+
* operationSettings: {
|
|
42
|
+
* accessToken: 'your-access-token',
|
|
43
|
+
* }
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @see For client-side implementation using proxyEndpointDescriptor, import from `@qonto/embed-sdk/payment-links`
|
|
48
|
+
*/
|
|
49
|
+
export declare const getPaymentLinkCreationFlowUrl: ({ paymentLinkSettings, operationSettings, }: PaymentLinkParams<CreatePaymentLinkSettings, ServerOperationSettings>) => Promise<string>;
|
|
50
|
+
//# sourceMappingURL=payment-links.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-links.server.d.ts","sourceRoot":"","sources":["../../../src/payment-links/server/payment-links.server.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAEzF,OAAO,KAAK,EACV,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AAMvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,eAAO,MAAM,6BAA6B,GAAU,6CAGjD,iBAAiB,CAClB,yBAAyB,EACzB,uBAAuB,CACxB,KAAG,OAAO,CAAC,MAAM,CAsBjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-links.server.test.d.ts","sourceRoot":"","sources":["../../../src/payment-links/server/payment-links.server.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currency.validation.d.ts","sourceRoot":"","sources":["../../../src/payment-links/shared/currency.validation.ts"],"names":[],"mappings":"AAsCA,eAAO,MAAM,gBAAgB,GAAI,UAAU,MAAM,SAMhD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-links.shared.test.d.ts","sourceRoot":"","sources":["../../../src/payment-links/shared/payment-links.shared.test.ts"],"names":[],"mappings":""}
|
|
@@ -17,9 +17,9 @@ export interface CreatePaymentLinkSettings {
|
|
|
17
17
|
items?: Item[];
|
|
18
18
|
callbackUrl?: string;
|
|
19
19
|
}
|
|
20
|
-
export interface PaymentLinkParams<T> {
|
|
20
|
+
export interface PaymentLinkParams<T, O = OperationSettings> {
|
|
21
21
|
paymentLinkSettings: T;
|
|
22
|
-
operationSettings?:
|
|
22
|
+
operationSettings?: O;
|
|
23
23
|
}
|
|
24
24
|
export declare const LINK_TYPES: {
|
|
25
25
|
GOOD: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-links.types.d.ts","sourceRoot":"","sources":["../../../src/payment-links/shared/payment-links.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAEnF,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,MAAM,CAAC,CAAC,GAAG,MAAM;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,CAAC,CAAC;CACV;AAED,MAAM,WAAW,yBAAyB;IACxC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,EAAE,CAAC,GAAG,iBAAiB;IACzD,mBAAmB,EAAE,CAAC,CAAC;IACvB,iBAAiB,CAAC,EAAE,CAAC,CAAC;CACvB;AAED,eAAO,MAAM,UAAU;;;CAGtB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CreatePaymentLinkSettings, type Item } from '
|
|
1
|
+
import { type CreatePaymentLinkSettings, type Item } from './payment-links.types';
|
|
2
2
|
export declare function validateItems(items: Item[] | undefined): never[] | undefined;
|
|
3
3
|
export declare const validateType: (type: string) => void;
|
|
4
4
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-links.validate.d.ts","sourceRoot":"","sources":["../../../src/payment-links/shared/payment-links.validate.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,IAAI,EAEV,MAAM,uBAAuB,CAAC;AAgB/B,wBAAgB,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,SAAS,uBAqCtD;AAED,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,SAOxC,CAAC;AAEF;;GAEG;AACH,wBAAgB,qCAAqC,CACnD,mBAAmB,EAAE,yBAAyB,GAAG,SAAS,GACzD,MAAM,CAaR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unit.validation.d.ts","sourceRoot":"","sources":["../../../src/payment-links/shared/unit.validation.ts"],"names":[],"mappings":"AAgDA,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,SAMxC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beneficiaries.client.d.ts","sourceRoot":"","sources":["../../../../src/beneficiaries/client/beneficiaries.client.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,6BAA6B,EAGnC,MAAM,2CAA2C,CAAC;AAWnD,OAAO,KAAK,EACV,WAAW,EAEX,6BAA6B,EAC7B,wBAAwB,EACxB,cAAc,EACf,MAAM,+BAA+B,CAAC;AAQvC;;;;GAIG;AACH,MAAM,WAAW,uBAAuB,CAAC,CAAC;IACxC,mBAAmB,CAAC,EAAE,CAAC,CAAC;IACxB,iBAAiB,CAAC,EAAE,uBAAuB,CAAC;CAC7C;AAED;;GAEG;AACH,MAAM,WAAW,6BAA6B,CAAC,CAAC;IAC9C,mBAAmB,CAAC,EAAE,CAAC,CAAC;IACxB,iBAAiB,CAAC,EAAE,6BAA6B,CAAC;CACnD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,gBAAgB,CACpC,sBAAsB,CAAC,EAAE,uBAAuB,CAAC,KAAK,CAAC,GACtD,OAAO,CAAC,wBAAwB,CAAC,
|
|
1
|
+
{"version":3,"file":"beneficiaries.client.d.ts","sourceRoot":"","sources":["../../../../src/beneficiaries/client/beneficiaries.client.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,6BAA6B,EAGnC,MAAM,2CAA2C,CAAC;AAWnD,OAAO,KAAK,EACV,WAAW,EAEX,6BAA6B,EAC7B,wBAAwB,EACxB,cAAc,EACf,MAAM,+BAA+B,CAAC;AAQvC;;;;GAIG;AACH,MAAM,WAAW,uBAAuB,CAAC,CAAC;IACxC,mBAAmB,CAAC,EAAE,CAAC,CAAC;IACxB,iBAAiB,CAAC,EAAE,uBAAuB,CAAC;CAC7C;AAED;;GAEG;AACH,MAAM,WAAW,6BAA6B,CAAC,CAAC;IAC9C,mBAAmB,CAAC,EAAE,CAAC,CAAC;IACxB,iBAAiB,CAAC,EAAE,6BAA6B,CAAC;CACnD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,gBAAgB,CACpC,sBAAsB,CAAC,EAAE,uBAAuB,CAAC,KAAK,CAAC,GACtD,OAAO,CAAC,wBAAwB,CAAC,CAkCnC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,cAAc,CAAC,EACnC,mBAAmB,EACnB,iBAAiB,GAClB,EAAE,uBAAuB,CAAC;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAuB3E;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,cAAc,CAAC,EACnC,mBAAmB,EACnB,iBAAiB,GAClB,EAAE,uBAAuB,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAyBhE;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,mBAAmB,EACnB,iBAAiB,GAClB,EAAE,uBAAuB,CAAC,6BAA6B,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CA+B/E;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,mBAAmB,EACnB,iBAAiB,GAClB,EAAE,6BAA6B,CAAC;IAC/B,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAwB1B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,oBAAoB,CAAC,EACzC,mBAAmB,EACnB,iBAAiB,GAClB,EAAE,uBAAuB,CAAC;IAAE,cAAc,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,GAAG,OAAO,CAChE,WAAW,EAAE,CACd,CAuBA"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { ClientOperationSettings } from '@validation/operation-settings-validation';
|
|
2
|
+
import type { CreatePaymentLinkSettings, PaymentLinkParams } from '../shared/payment-links.types';
|
|
3
|
+
/**
|
|
4
|
+
* Generates the URL for initiating a payment link creation flow with specified items.
|
|
5
|
+
*
|
|
6
|
+
* **Client-side only** - Uses proxy-based authentication.
|
|
7
|
+
* For server-side operations, import from `'@qonto/embed-sdk/server/payment-links'`.
|
|
8
|
+
*
|
|
9
|
+
* @param params - An object containing:
|
|
10
|
+
* - `paymentLinkSettings`: An object containing:
|
|
11
|
+
* - `items`: An array of items to be included in the payment link. Each item must conform to the Item type and will be validated.
|
|
12
|
+
* - `callbackUrl`: Required callback URL to redirect to after payment link creation.
|
|
13
|
+
* - `operationSettings`: An object with operation-level settings such as
|
|
14
|
+
* `proxyEndpointDescriptor` (preferred) or `proxyRequestFunction` (at least one required).
|
|
15
|
+
* @returns Promise resolving to the full URL as a string, which can be used to launch the payment link creation flow in an iframe or browser.
|
|
16
|
+
* @throws `InvalidParametersError` If neither `proxyEndpointDescriptor` nor
|
|
17
|
+
* `proxyRequestFunction` is provided, or if the provided items array is invalid, or if callbackUrl is missing or invalid.
|
|
18
|
+
* @throws `AuthenticationError` If authentication fails (e.g., invalid or missing access token).
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```
|
|
22
|
+
* // Preferred: Using proxyEndpointDescriptor
|
|
23
|
+
* const url = await paymentLinks.getPaymentLinkCreationFlowUrl({
|
|
24
|
+
* paymentLinkSettings: {
|
|
25
|
+
* items: [{ id: '1', title: 'Item 1', type: 'service', quantity: 1, measureUnit: 'unit', unitPrice: { currency: 'EUR', value: '10' }, vatRate: '20' }],
|
|
26
|
+
* callbackUrl: 'https://example.com/callback',
|
|
27
|
+
* },
|
|
28
|
+
* operationSettings: { proxyEndpointDescriptor }
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```
|
|
34
|
+
* // Alternative: Using proxyRequestFunction
|
|
35
|
+
* const url = await paymentLinks.getPaymentLinkCreationFlowUrl({
|
|
36
|
+
* paymentLinkSettings: {
|
|
37
|
+
* items: [{ id: '1', title: 'Item 1', type: 'service', quantity: 1, measureUnit: 'unit', unitPrice: { currency: 'EUR', value: '10' }, vatRate: '20' }],
|
|
38
|
+
* callbackUrl: 'https://example.com/callback',
|
|
39
|
+
* },
|
|
40
|
+
* operationSettings: {
|
|
41
|
+
* proxyRequestFunction: async (encodedCall) => {
|
|
42
|
+
* // Implement your proxy logic here
|
|
43
|
+
* },
|
|
44
|
+
* }
|
|
45
|
+
* });
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare const getPaymentLinkCreationFlowUrl: ({ paymentLinkSettings, operationSettings, }: PaymentLinkParams<CreatePaymentLinkSettings, ClientOperationSettings>) => Promise<string>;
|
|
49
|
+
/**
|
|
50
|
+
* Redirects to the payment link creation flow with specified items.
|
|
51
|
+
*
|
|
52
|
+
* **Client-side only** - Uses proxy-based authentication and browser redirect.
|
|
53
|
+
* This function is not available in server-side imports.
|
|
54
|
+
*
|
|
55
|
+
* @param params - An object containing:
|
|
56
|
+
* - `paymentLinkSettings`: An object containing:
|
|
57
|
+
* - `items`: An array of items to be included in the payment link. Each item must conform to the Item type and will be validated.
|
|
58
|
+
* - `callbackUrl`: Required callback URL to redirect to after payment link creation.
|
|
59
|
+
* - `operationSettings`: An object with operation-level settings such as
|
|
60
|
+
* `proxyEndpointDescriptor` (preferred) or `proxyRequestFunction` (at least one required).
|
|
61
|
+
* @returns This function redirects the browser to the payment link creation flow. Due to the redirect, the returned promise will not resolve.
|
|
62
|
+
* @throws `InvalidParametersError` If neither `proxyEndpointDescriptor` nor
|
|
63
|
+
* `proxyRequestFunction` is provided, or if the provided items array is invalid, or if callbackUrl is missing or invalid.
|
|
64
|
+
* @throws `AuthenticationError` If authentication fails (e.g., invalid or missing access token).
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```
|
|
68
|
+
* // Preferred: Using proxyEndpointDescriptor
|
|
69
|
+
* await paymentLinks.redirectToPaymentLinkCreationFlow({
|
|
70
|
+
* paymentLinkSettings: {
|
|
71
|
+
* items: [{ id: '1', title: 'Item 1', type: 'service', quantity: 1, measureUnit: 'unit', unitPrice: { currency: 'EUR', value: '10' }, vatRate: '20' }],
|
|
72
|
+
* callbackUrl: 'https://example.com/callback',
|
|
73
|
+
* },
|
|
74
|
+
* operationSettings: { proxyEndpointDescriptor }
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```
|
|
80
|
+
* // Alternative: Using proxyRequestFunction
|
|
81
|
+
* await paymentLinks.redirectToPaymentLinkCreationFlow({
|
|
82
|
+
* paymentLinkSettings: {
|
|
83
|
+
* items: [{ id: '1', title: 'Item 1', type: 'service', quantity: 1, measureUnit: 'unit', unitPrice: { currency: 'EUR', value: '10' }, vatRate: '20' }],
|
|
84
|
+
* callbackUrl: 'https://example.com/callback',
|
|
85
|
+
* },
|
|
86
|
+
* operationSettings: {
|
|
87
|
+
* proxyRequestFunction: async (encodedCall) => {
|
|
88
|
+
* // Implement your proxy logic here
|
|
89
|
+
* },
|
|
90
|
+
* }
|
|
91
|
+
* });
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export declare const redirectToPaymentLinkCreationFlow: ({ paymentLinkSettings, operationSettings, }: PaymentLinkParams<CreatePaymentLinkSettings, ClientOperationSettings>) => Promise<void>;
|
|
95
|
+
//# sourceMappingURL=payment-links.client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-links.client.d.ts","sourceRoot":"","sources":["../../../../src/payment-links/client/payment-links.client.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAGzF,OAAO,KAAK,EACV,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AAMvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,eAAO,MAAM,6BAA6B,GAAU,6CAGjD,iBAAiB,CAClB,yBAAyB,EACzB,uBAAuB,CACxB,KAAG,OAAO,CAAC,MAAM,CA6BjB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,eAAO,MAAM,iCAAiC,GAAU,6CAGrD,iBAAiB,CAClB,yBAAyB,EACzB,uBAAuB,CACxB,KAAG,OAAO,CAAC,IAAI,CAMf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-links.client.test.d.ts","sourceRoot":"","sources":["../../../../src/payment-links/client/payment-links.client.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,13 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The paymentLinks namespace contains all the functions related to
|
|
3
|
-
* operations such as starting the payment link creation flow.
|
|
2
|
+
* The paymentLinks namespace contains all the client-side functions related to payment link
|
|
3
|
+
* operations such as starting the payment link creation flow.
|
|
4
|
+
*
|
|
5
|
+
* **Client-side only** - This namespace uses proxy-based authentication
|
|
6
|
+
* (`proxyEndpointDescriptor` (preferred), or `proxyRequestFunction`).
|
|
7
|
+
*
|
|
8
|
+
* For server-side operations using access token, import from
|
|
9
|
+
* `'@qonto/embed-sdk/server/payment-links'`.
|
|
10
|
+
*
|
|
11
|
+
* It can be accessed like this:
|
|
4
12
|
* ```ts
|
|
5
|
-
* import { paymentLinks } from '@qonto/embed-sdk/
|
|
6
|
-
*
|
|
7
|
-
*
|
|
13
|
+
* import { paymentLinks } from '@qonto/embed-sdk/payment-links';
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* Then, the paymentLinks object contains the functions to perform payment link operations:
|
|
17
|
+
* ```ts
|
|
18
|
+
* // Preferred: Using proxyEndpointDescriptor
|
|
19
|
+
* const url = await paymentLinks.getPaymentLinkCreationFlowUrl({
|
|
20
|
+
* paymentLinkSettings: {
|
|
21
|
+
* items: [{ id: '1', title: 'Item 1', type: 'service', quantity: 1, measureUnit: 'unit', unitPrice: { currency: 'EUR', value: '10' }, vatRate: '20' }],
|
|
22
|
+
* callbackUrl: 'https://example.com/callback',
|
|
23
|
+
* },
|
|
24
|
+
* operationSettings: { proxyEndpointDescriptor }
|
|
25
|
+
* });
|
|
8
26
|
* ```
|
|
9
27
|
*/
|
|
10
28
|
export declare const paymentLinks: {
|
|
11
|
-
getPaymentLinkCreationFlowUrl: ({ paymentLinkSettings, operationSettings, }: import("
|
|
29
|
+
getPaymentLinkCreationFlowUrl: ({ paymentLinkSettings, operationSettings, }: import(".").PaymentLinkParams<import(".").CreatePaymentLinkSettings, import("@validation/operation-settings-validation").ClientOperationSettings>) => Promise<string>;
|
|
30
|
+
redirectToPaymentLinkCreationFlow: ({ paymentLinkSettings, operationSettings, }: import(".").PaymentLinkParams<import(".").CreatePaymentLinkSettings, import("@validation/operation-settings-validation").ClientOperationSettings>) => Promise<void>;
|
|
12
31
|
};
|
|
32
|
+
export type * from './shared/payment-links.types';
|
|
33
|
+
export type { ClientOperationSettings, ClientOperationSettingsWithUI, } from '@validation/operation-settings-validation';
|
|
13
34
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/payment-links/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/payment-links/index.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,YAAY;;;CAGxB,CAAC;AAGF,mBAAmB,8BAA8B,CAAC;AAClD,YAAY,EACV,uBAAuB,EACvB,6BAA6B,GAC9B,MAAM,2CAA2C,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The paymentLinks namespace contains all the server-side functions related to payment link operations.
|
|
3
|
+
* This version uses access token-based authentication and is designed for server environments.
|
|
4
|
+
*
|
|
5
|
+
* **Server-side only** - This namespace uses access token-based authentication.
|
|
6
|
+
*
|
|
7
|
+
* For client-side operations using proxy functions, import from `'@qonto/embed-sdk/payment-links'`.
|
|
8
|
+
*
|
|
9
|
+
* **Note:** The `redirectToPaymentLinkCreationFlow` function is not available in the server-side
|
|
10
|
+
* implementation as it requires browser-specific APIs (`window.location.href`).
|
|
11
|
+
*
|
|
12
|
+
* It can be accessed like this:
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { paymentLinks } from '@qonto/embed-sdk/server/payment-links';
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* Then, the paymentLinks object contains the functions to perform payment link operations:
|
|
18
|
+
* ```ts
|
|
19
|
+
* const url = await paymentLinks.getPaymentLinkCreationFlowUrl({
|
|
20
|
+
* paymentLinkSettings: {
|
|
21
|
+
* items: [{ id: '1', title: 'Item 1', type: 'service', quantity: 1, measureUnit: 'unit', unitPrice: { currency: 'EUR', value: '10' }, vatRate: '20' }],
|
|
22
|
+
* callbackUrl: 'https://example.com/callback',
|
|
23
|
+
* },
|
|
24
|
+
* operationSettings: {
|
|
25
|
+
* accessToken: 'your-access-token',
|
|
26
|
+
* }
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare const paymentLinks: {
|
|
31
|
+
getPaymentLinkCreationFlowUrl: ({ paymentLinkSettings, operationSettings, }: import(".").PaymentLinkParams<import(".").CreatePaymentLinkSettings, import("@validation/operation-settings-validation").ServerOperationSettings>) => Promise<string>;
|
|
32
|
+
};
|
|
33
|
+
export type * from './shared/payment-links.types';
|
|
34
|
+
export type { ServerOperationSettings } from '@validation/operation-settings-validation';
|
|
35
|
+
//# sourceMappingURL=index.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.server.d.ts","sourceRoot":"","sources":["../../../src/payment-links/index.server.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,YAAY;;CAExB,CAAC;AAGF,mBAAmB,8BAA8B,CAAC;AAClD,YAAY,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ServerOperationSettings } from '@validation/operation-settings-validation';
|
|
2
|
+
import type { CreatePaymentLinkSettings, PaymentLinkParams } from '../shared/payment-links.types';
|
|
3
|
+
/**
|
|
4
|
+
* Generates the URL for initiating a payment link creation flow with specified items.
|
|
5
|
+
*
|
|
6
|
+
* **Server-side implementation** - Uses access token-based authentication.
|
|
7
|
+
* This implementation is designed for server environments where access tokens can be safely managed.
|
|
8
|
+
*
|
|
9
|
+
* For client-side operations using proxy functions, import from `'@qonto/embed-sdk/payment-links'`.
|
|
10
|
+
*
|
|
11
|
+
* @param params - An object containing:
|
|
12
|
+
* - `paymentLinkSettings`: An object containing:
|
|
13
|
+
* - `items`: An array of items to be included in the payment link. Each item must conform to the Item type and will be validated.
|
|
14
|
+
* - `callbackUrl`: Required callback URL to redirect to after payment link creation.
|
|
15
|
+
* - `operationSettings`: An object with operation-level settings such as
|
|
16
|
+
* `accessToken`, `stagingToken`, and other optional parameters.
|
|
17
|
+
* See {@link ServerOperationSettings}.
|
|
18
|
+
* @returns Promise resolving to the full URL as a string, which can be used to launch the payment link creation flow in an iframe or browser.
|
|
19
|
+
* @throws `InvalidParametersError` If the provided items array is invalid or if callbackUrl is missing or invalid.
|
|
20
|
+
* @throws `AuthenticationError` If authentication fails (e.g., invalid or missing access token).
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import { paymentLinks } from '@qonto/embed-sdk/server/payment-links';
|
|
25
|
+
*
|
|
26
|
+
* const url = await paymentLinks.getPaymentLinkCreationFlowUrl({
|
|
27
|
+
* paymentLinkSettings: {
|
|
28
|
+
* items: [
|
|
29
|
+
* {
|
|
30
|
+
* id: '1',
|
|
31
|
+
* title: 'Item 1',
|
|
32
|
+
* type: 'service',
|
|
33
|
+
* quantity: 1,
|
|
34
|
+
* measureUnit: 'unit',
|
|
35
|
+
* unitPrice: { currency: 'EUR', value: '10' },
|
|
36
|
+
* vatRate: '20'
|
|
37
|
+
* }
|
|
38
|
+
* ],
|
|
39
|
+
* callbackUrl: 'https://example.com/callback',
|
|
40
|
+
* },
|
|
41
|
+
* operationSettings: {
|
|
42
|
+
* accessToken: 'your-access-token',
|
|
43
|
+
* }
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @see For client-side implementation using proxyEndpointDescriptor, import from `@qonto/embed-sdk/payment-links`
|
|
48
|
+
*/
|
|
49
|
+
export declare const getPaymentLinkCreationFlowUrl: ({ paymentLinkSettings, operationSettings, }: PaymentLinkParams<CreatePaymentLinkSettings, ServerOperationSettings>) => Promise<string>;
|
|
50
|
+
//# sourceMappingURL=payment-links.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-links.server.d.ts","sourceRoot":"","sources":["../../../../src/payment-links/server/payment-links.server.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAEzF,OAAO,KAAK,EACV,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AAMvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,eAAO,MAAM,6BAA6B,GAAU,6CAGjD,iBAAiB,CAClB,yBAAyB,EACzB,uBAAuB,CACxB,KAAG,OAAO,CAAC,MAAM,CAsBjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-links.server.test.d.ts","sourceRoot":"","sources":["../../../../src/payment-links/server/payment-links.server.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currency.validation.d.ts","sourceRoot":"","sources":["../../../../src/payment-links/shared/currency.validation.ts"],"names":[],"mappings":"AAsCA,eAAO,MAAM,gBAAgB,GAAI,UAAU,MAAM,SAMhD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-links.shared.test.d.ts","sourceRoot":"","sources":["../../../../src/payment-links/shared/payment-links.shared.test.ts"],"names":[],"mappings":""}
|
package/dist/server/payment-links/{payment-links.types.d.ts → shared/payment-links.types.d.ts}
RENAMED
|
@@ -17,9 +17,9 @@ export interface CreatePaymentLinkSettings {
|
|
|
17
17
|
items?: Item[];
|
|
18
18
|
callbackUrl?: string;
|
|
19
19
|
}
|
|
20
|
-
export interface PaymentLinkParams<T> {
|
|
20
|
+
export interface PaymentLinkParams<T, O = OperationSettings> {
|
|
21
21
|
paymentLinkSettings: T;
|
|
22
|
-
operationSettings?:
|
|
22
|
+
operationSettings?: O;
|
|
23
23
|
}
|
|
24
24
|
export declare const LINK_TYPES: {
|
|
25
25
|
GOOD: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-links.types.d.ts","sourceRoot":"","sources":["../../../../src/payment-links/shared/payment-links.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAEnF,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,MAAM,CAAC,CAAC,GAAG,MAAM;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,CAAC,CAAC;CACV;AAED,MAAM,WAAW,yBAAyB;IACxC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,EAAE,CAAC,GAAG,iBAAiB;IACzD,mBAAmB,EAAE,CAAC,CAAC;IACvB,iBAAiB,CAAC,EAAE,CAAC,CAAC;CACvB;AAED,eAAO,MAAM,UAAU;;;CAGtB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CreatePaymentLinkSettings, type Item } from '
|
|
1
|
+
import { type CreatePaymentLinkSettings, type Item } from './payment-links.types';
|
|
2
2
|
export declare function validateItems(items: Item[] | undefined): never[] | undefined;
|
|
3
3
|
export declare const validateType: (type: string) => void;
|
|
4
4
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-links.validate.d.ts","sourceRoot":"","sources":["../../../../src/payment-links/shared/payment-links.validate.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,IAAI,EAEV,MAAM,uBAAuB,CAAC;AAgB/B,wBAAgB,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,SAAS,uBAqCtD;AAED,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,SAOxC,CAAC;AAEF;;GAEG;AACH,wBAAgB,qCAAqC,CACnD,mBAAmB,EAAE,yBAAyB,GAAG,SAAS,GACzD,MAAM,CAaR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unit.validation.d.ts","sourceRoot":"","sources":["../../../../src/payment-links/shared/unit.validation.ts"],"names":[],"mappings":"AAgDA,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,SAMxC,CAAC"}
|