@djust-b2b/djust-front-sdk 2.0.0 → 2.1.1
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/lib/index.d.ts +21 -15
- package/lib/interfaces/models/attribute.d.ts +12 -2
- package/lib/interfaces/models/common.d.ts +11 -0
- package/lib/interfaces/models/custom-field.d.ts +4 -0
- package/lib/interfaces/models/customer-account.d.ts +1 -0
- package/lib/interfaces/models/offer.d.ts +9 -0
- package/lib/interfaces/models/payment.d.ts +2 -0
- package/lib/services/attributes/definitions.d.ts +27 -0
- package/lib/services/attributes/definitions.js +2 -0
- package/lib/services/attributes/index.d.ts +32 -0
- package/lib/services/attributes/index.js +49 -0
- package/lib/services/auth/definitions.d.ts +39 -0
- package/lib/services/auth/definitions.requests.d.ts +4 -0
- package/lib/services/auth/index.d.ts +58 -3
- package/lib/services/auth/index.js +72 -2
- package/lib/services/cart/index.js +1 -0
- package/lib/services/custom-field/definitions.d.ts +6 -0
- package/lib/services/custom-field/index.d.ts +38 -1
- package/lib/services/custom-field/index.js +48 -2
- package/lib/services/customer-account/definitions.d.ts +15 -2
- package/lib/services/customer-account/index.d.ts +47 -5
- package/lib/services/customer-account/index.js +68 -5
- package/lib/services/customer-user/definitions.d.ts +2 -0
- package/lib/services/customer-user/index.d.ts +1 -1
- package/lib/services/customer-user/index.js +4 -1
- package/lib/services/incident/definitions.d.ts +14 -0
- package/lib/services/incident/index.d.ts +40 -1
- package/lib/services/incident/index.js +56 -0
- package/lib/services/logistic-order/definitions.d.ts +15 -4
- package/lib/services/logistic-order/index.d.ts +19 -10
- package/lib/services/logistic-order/index.js +40 -17
- package/lib/services/navigation-category/definitions.d.ts +7 -0
- package/lib/services/navigation-category/index.d.ts +33 -1
- package/lib/services/navigation-category/index.js +40 -0
- package/lib/services/offer-inventories/index.js +3 -3
- package/lib/services/offer-prices/definitions.d.ts +23 -0
- package/lib/services/offer-prices/definitions.js +2 -0
- package/lib/services/offer-prices/index.d.ts +35 -0
- package/lib/services/offer-prices/index.js +52 -0
- package/lib/services/payment/definitions.d.ts +61 -0
- package/lib/services/payment/definitions.js +2 -0
- package/lib/services/payment/index.d.ts +132 -0
- package/lib/services/payment/index.js +195 -0
- package/lib/services/product/definitions.d.ts +5 -0
- package/lib/services/product/index.d.ts +6 -29
- package/lib/services/product/index.js +8 -42
- package/lib/services/product-variant/definitions.d.ts +27 -0
- package/lib/services/product-variant/index.d.ts +30 -1
- package/lib/services/product-variant/index.js +40 -0
- package/package.json +1 -1
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { BrowserInfo } from "../../interfaces/models/common";
|
|
2
|
+
import { PaymentReferenceType } from "../../interfaces/models/payment";
|
|
3
|
+
/**
|
|
4
|
+
* Request parameters type definitions
|
|
5
|
+
*/
|
|
6
|
+
export interface GetCommercialOrdersParameters {
|
|
7
|
+
locale: string;
|
|
8
|
+
nbPreviewLines?: number;
|
|
9
|
+
page?: number;
|
|
10
|
+
size?: number;
|
|
11
|
+
sort?: string[];
|
|
12
|
+
connectedUserOnly?: boolean;
|
|
13
|
+
customerAccountIds?: string[];
|
|
14
|
+
isValidated?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface InitPaymentRequest {
|
|
17
|
+
bankTransfer?: boolean;
|
|
18
|
+
browserInfo: BrowserInfo;
|
|
19
|
+
commercialOrder?: boolean;
|
|
20
|
+
countryCode: string;
|
|
21
|
+
customerUserIP: string;
|
|
22
|
+
paymentMethodData: object;
|
|
23
|
+
reference: string;
|
|
24
|
+
referenceType?: PaymentReferenceType;
|
|
25
|
+
returnPath: string;
|
|
26
|
+
storePaymentMethod?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface InitPaymentResponse {
|
|
29
|
+
action: {
|
|
30
|
+
type: string;
|
|
31
|
+
beneficiary: string;
|
|
32
|
+
bic: string;
|
|
33
|
+
iban: string;
|
|
34
|
+
paymentMethodType: string;
|
|
35
|
+
totalAmountCurrency: string;
|
|
36
|
+
totalAmountValue: number;
|
|
37
|
+
url: string;
|
|
38
|
+
};
|
|
39
|
+
pspReference: string;
|
|
40
|
+
resultCode: string;
|
|
41
|
+
}
|
|
42
|
+
export interface AddPaymentDetailsRequest {
|
|
43
|
+
details: string;
|
|
44
|
+
}
|
|
45
|
+
export interface AddPaymentDetailsResponse {
|
|
46
|
+
pspReference: string;
|
|
47
|
+
resultCode: string;
|
|
48
|
+
}
|
|
49
|
+
export interface GetPaymentMethodsRequest {
|
|
50
|
+
reference: string;
|
|
51
|
+
countryCode?: string;
|
|
52
|
+
referenceType?: PaymentReferenceType;
|
|
53
|
+
locale?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface GetPaymentMethodsResponse {
|
|
56
|
+
adyenPaymentMethods: string;
|
|
57
|
+
enableCreditCardStorage: boolean;
|
|
58
|
+
}
|
|
59
|
+
export interface DeleteStoredPaymentMethodByIdRequest {
|
|
60
|
+
storedPaymentMethodId: string;
|
|
61
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { AddPaymentDetailsRequest, AddPaymentDetailsResponse, DeleteStoredPaymentMethodByIdRequest, GetPaymentMethodsRequest, GetPaymentMethodsResponse, InitPaymentRequest, InitPaymentResponse } from "./definitions";
|
|
2
|
+
/**
|
|
3
|
+
* 💳 Initializes a payment transaction.
|
|
4
|
+
*
|
|
5
|
+
* This endpoint initializes a payment transaction.
|
|
6
|
+
* It supports:
|
|
7
|
+
* - Card authorizations with or without 3D Secure (3DS).
|
|
8
|
+
* - 3DS authentication flows, including redirection steps if required.
|
|
9
|
+
* - Bank transfer payment initialization using virtual IBAN feature.
|
|
10
|
+
*
|
|
11
|
+
* The response indicates the result of the transaction attempt and may contain an action
|
|
12
|
+
* (such as a redirection or bank transfer instructions) that must be followed to complete the payment.
|
|
13
|
+
*
|
|
14
|
+
* 🛠 **Endpoint**: `POST /v1/shop/payments` [PAY-101]
|
|
15
|
+
*
|
|
16
|
+
* | Parameter | Type | Required | Description |
|
|
17
|
+
* |---------------------|---------------------|----------|------------------------------------------------|
|
|
18
|
+
* | `bankTransfer` | `BankTransfer` | ✅ | Bank transfer configuration. |
|
|
19
|
+
* | `browserInfo` | `BrowserInfo` | ✅ | Browser information for 3DS authentication. |
|
|
20
|
+
* | `commercialOrder` | `CommercialOrder` | ❌ | Commercial order details. |
|
|
21
|
+
* | `countryCode` | `string` | ✅ | Country code for payment processing. |
|
|
22
|
+
* | `customerUserIP` | `string` | ✅ | Customer's IP address. |
|
|
23
|
+
* | `paymentMethodData` | `PaymentMethodData` | ✅ | Payment method configuration. |
|
|
24
|
+
* | `reference` | `string` | ✅ | Payment reference identifier. |
|
|
25
|
+
* | `referenceType` | `string` | ❌ | Type of reference. |
|
|
26
|
+
* | `returnPath` | `string` | ✅ | Return URL after payment completion. |
|
|
27
|
+
* | `storePaymentMethod`| `boolean` | ❌ | Whether to store the payment method. |
|
|
28
|
+
*
|
|
29
|
+
* 📤 **Returns**:
|
|
30
|
+
* A `Promise` resolving to an `InitPaymentResponse` containing the payment initialization result.
|
|
31
|
+
*
|
|
32
|
+
* 🛠 **Example usage**:
|
|
33
|
+
* ```ts
|
|
34
|
+
* const response = await initPayment({
|
|
35
|
+
* bankTransfer: false,
|
|
36
|
+
* browserInfo: {
|
|
37
|
+
* acceptHeader: "......",
|
|
38
|
+
* colorDepth: 24,
|
|
39
|
+
* javaEnabled: true,
|
|
40
|
+
* javaScriptEnabled: true,
|
|
41
|
+
* language: "en-US",
|
|
42
|
+
* screenHeight: 1080,
|
|
43
|
+
* screenWidth: 1920,
|
|
44
|
+
* timeZoneOffset: 0,
|
|
45
|
+
* userAgent: "......",
|
|
46
|
+
* },
|
|
47
|
+
* commercialOrder: false,
|
|
48
|
+
* countryCode: "FR",
|
|
49
|
+
* customerUserIP: "127.0.0.1",
|
|
50
|
+
* paymentMethodData: {
|
|
51
|
+
* description: "......",
|
|
52
|
+
* },
|
|
53
|
+
* reference: "......",
|
|
54
|
+
* referenceType: "......",
|
|
55
|
+
* returnPath: "......",
|
|
56
|
+
* storePaymentMethod: true,
|
|
57
|
+
* });
|
|
58
|
+
* console.log(response);
|
|
59
|
+
*
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @param {InitPaymentRequest} params - The parameters for the payment initialization
|
|
63
|
+
* @throws {Error} If required parameters are missing
|
|
64
|
+
* @returns {Promise<InitPaymentResponse>} A promise resolving to the payment initialization response
|
|
65
|
+
*/
|
|
66
|
+
export declare function initPayment({ bankTransfer, browserInfo, commercialOrder, countryCode, customerUserIP, paymentMethodData, reference, referenceType, returnPath, storePaymentMethod, }: InitPaymentRequest): Promise<InitPaymentResponse>;
|
|
67
|
+
/**
|
|
68
|
+
* 💳 Adds payment details.
|
|
69
|
+
*
|
|
70
|
+
* This function adds additional details to an existing payment transaction.
|
|
71
|
+
* The `details` parameter is mandatory and validated before the request is executed.
|
|
72
|
+
*
|
|
73
|
+
* 🛠 **Endpoint**: `POST /v1/shop/payments/details` [PAY-102]
|
|
74
|
+
*
|
|
75
|
+
* | Parameter | Type | Required | Description |
|
|
76
|
+
* |-----------|----------|----------|--------------------------------|
|
|
77
|
+
* | `details` | `object` | ✅ | The payment details to add. |
|
|
78
|
+
*
|
|
79
|
+
* 📤 **Returns**:
|
|
80
|
+
* A `Promise` resolving to an `AddPaymentDetailsResponse` containing the result of adding payment details.
|
|
81
|
+
*
|
|
82
|
+
* @param {AddPaymentDetailsRequest} params - The parameters for adding payment details
|
|
83
|
+
* @throws {Error} If `details` is missing
|
|
84
|
+
* @returns {Promise<AddPaymentDetailsResponse>} A promise resolving to the response containing the result
|
|
85
|
+
*/
|
|
86
|
+
export declare function addPaymentDetails({ details, }: AddPaymentDetailsRequest): Promise<AddPaymentDetailsResponse>;
|
|
87
|
+
/**
|
|
88
|
+
* 💳 Gets available payment methods.
|
|
89
|
+
*
|
|
90
|
+
* This endpoint retrieves the available payment methods based on the country, locale, amount, and currency.
|
|
91
|
+
* It provides a list of payment methods that can be used for checkout based on the merchant's Adyen configuration.
|
|
92
|
+
* The `reference` parameter is mandatory and validated before the request is executed.
|
|
93
|
+
*
|
|
94
|
+
* 🛠 **Endpoint**: `GET /v1/shop/payments/methods` [PAY-501]
|
|
95
|
+
*
|
|
96
|
+
* | Parameter | Type | Required | Description |
|
|
97
|
+
* |----------------|----------|----------|------------------------------------------------|
|
|
98
|
+
* | `reference` | `string` | ✅ | The payment reference identifier. |
|
|
99
|
+
* | `countryCode` | `string` | ❌ | The country code for payment method filtering.|
|
|
100
|
+
* | `referenceType`| `string` | ❌ | The type of reference. |
|
|
101
|
+
* | `locale` | `string` | ❌ | The locale for payment method localization. |
|
|
102
|
+
*
|
|
103
|
+
* 📤 **Returns**:
|
|
104
|
+
* A `Promise` resolving to a `GetPaymentMethodsResponse` containing the available payment methods.
|
|
105
|
+
*
|
|
106
|
+
* @param {GetPaymentMethodsRequest} params - The parameters for retrieving payment methods
|
|
107
|
+
* @throws {Error} If `reference` is missing
|
|
108
|
+
* @returns {Promise<GetPaymentMethodsResponse>} A promise resolving to the response containing available payment methods
|
|
109
|
+
*/
|
|
110
|
+
export declare function getPaymentMethods({ reference, countryCode, referenceType, locale, }: GetPaymentMethodsRequest): Promise<GetPaymentMethodsResponse>;
|
|
111
|
+
/**
|
|
112
|
+
* 💳 Deletes a stored payment method.
|
|
113
|
+
*
|
|
114
|
+
* This endpoint deletes a stored payment method (e.g., saved card) associated with the current shopper.
|
|
115
|
+
* It is intended for use on the storefront. If the specified ID does not exist or does not belong
|
|
116
|
+
* to the authenticated user, a 404 will be returned.
|
|
117
|
+
* The `storedPaymentMethodId` parameter is mandatory and validated before the request is executed.
|
|
118
|
+
*
|
|
119
|
+
* 🛠 **Endpoint**: `DELETE /v1/shop/payments/stored-payment-methods/{storedPaymentMethodId}` [PAY-300]
|
|
120
|
+
*
|
|
121
|
+
* | Parameter | Type | Required | Description |
|
|
122
|
+
* |------------------------|----------|----------|------------------------------------------------|
|
|
123
|
+
* | `storedPaymentMethodId`| `string` | ✅ | The ID of the stored payment method to delete.|
|
|
124
|
+
*
|
|
125
|
+
* 📤 **Returns**:
|
|
126
|
+
* A `Promise` resolving to `void` when the stored payment method is successfully deleted.
|
|
127
|
+
*
|
|
128
|
+
* @param {DeleteStoredPaymentMethodByIdRequest} params - The parameters for deleting the stored payment method
|
|
129
|
+
* @throws {Error} If `storedPaymentMethodId` is missing
|
|
130
|
+
* @returns {Promise<void>} A promise resolving when the stored payment method is successfully deleted
|
|
131
|
+
*/
|
|
132
|
+
export declare function deleteStoredPaymentMethodById({ storedPaymentMethodId, }: DeleteStoredPaymentMethodByIdRequest): Promise<void>;
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initPayment = initPayment;
|
|
4
|
+
exports.addPaymentDetails = addPaymentDetails;
|
|
5
|
+
exports.getPaymentMethods = getPaymentMethods;
|
|
6
|
+
exports.deleteStoredPaymentMethodById = deleteStoredPaymentMethodById;
|
|
7
|
+
const parameters_validation_1 = require("../../helpers/parameters-validation");
|
|
8
|
+
const fetch_instance_1 = require("../../settings/fetch-instance");
|
|
9
|
+
/**
|
|
10
|
+
* 💳 Initializes a payment transaction.
|
|
11
|
+
*
|
|
12
|
+
* This endpoint initializes a payment transaction.
|
|
13
|
+
* It supports:
|
|
14
|
+
* - Card authorizations with or without 3D Secure (3DS).
|
|
15
|
+
* - 3DS authentication flows, including redirection steps if required.
|
|
16
|
+
* - Bank transfer payment initialization using virtual IBAN feature.
|
|
17
|
+
*
|
|
18
|
+
* The response indicates the result of the transaction attempt and may contain an action
|
|
19
|
+
* (such as a redirection or bank transfer instructions) that must be followed to complete the payment.
|
|
20
|
+
*
|
|
21
|
+
* 🛠 **Endpoint**: `POST /v1/shop/payments` [PAY-101]
|
|
22
|
+
*
|
|
23
|
+
* | Parameter | Type | Required | Description |
|
|
24
|
+
* |---------------------|---------------------|----------|------------------------------------------------|
|
|
25
|
+
* | `bankTransfer` | `BankTransfer` | ✅ | Bank transfer configuration. |
|
|
26
|
+
* | `browserInfo` | `BrowserInfo` | ✅ | Browser information for 3DS authentication. |
|
|
27
|
+
* | `commercialOrder` | `CommercialOrder` | ❌ | Commercial order details. |
|
|
28
|
+
* | `countryCode` | `string` | ✅ | Country code for payment processing. |
|
|
29
|
+
* | `customerUserIP` | `string` | ✅ | Customer's IP address. |
|
|
30
|
+
* | `paymentMethodData` | `PaymentMethodData` | ✅ | Payment method configuration. |
|
|
31
|
+
* | `reference` | `string` | ✅ | Payment reference identifier. |
|
|
32
|
+
* | `referenceType` | `string` | ❌ | Type of reference. |
|
|
33
|
+
* | `returnPath` | `string` | ✅ | Return URL after payment completion. |
|
|
34
|
+
* | `storePaymentMethod`| `boolean` | ❌ | Whether to store the payment method. |
|
|
35
|
+
*
|
|
36
|
+
* 📤 **Returns**:
|
|
37
|
+
* A `Promise` resolving to an `InitPaymentResponse` containing the payment initialization result.
|
|
38
|
+
*
|
|
39
|
+
* 🛠 **Example usage**:
|
|
40
|
+
* ```ts
|
|
41
|
+
* const response = await initPayment({
|
|
42
|
+
* bankTransfer: false,
|
|
43
|
+
* browserInfo: {
|
|
44
|
+
* acceptHeader: "......",
|
|
45
|
+
* colorDepth: 24,
|
|
46
|
+
* javaEnabled: true,
|
|
47
|
+
* javaScriptEnabled: true,
|
|
48
|
+
* language: "en-US",
|
|
49
|
+
* screenHeight: 1080,
|
|
50
|
+
* screenWidth: 1920,
|
|
51
|
+
* timeZoneOffset: 0,
|
|
52
|
+
* userAgent: "......",
|
|
53
|
+
* },
|
|
54
|
+
* commercialOrder: false,
|
|
55
|
+
* countryCode: "FR",
|
|
56
|
+
* customerUserIP: "127.0.0.1",
|
|
57
|
+
* paymentMethodData: {
|
|
58
|
+
* description: "......",
|
|
59
|
+
* },
|
|
60
|
+
* reference: "......",
|
|
61
|
+
* referenceType: "......",
|
|
62
|
+
* returnPath: "......",
|
|
63
|
+
* storePaymentMethod: true,
|
|
64
|
+
* });
|
|
65
|
+
* console.log(response);
|
|
66
|
+
*
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* @param {InitPaymentRequest} params - The parameters for the payment initialization
|
|
70
|
+
* @throws {Error} If required parameters are missing
|
|
71
|
+
* @returns {Promise<InitPaymentResponse>} A promise resolving to the payment initialization response
|
|
72
|
+
*/
|
|
73
|
+
async function initPayment({ bankTransfer, browserInfo, commercialOrder, countryCode, customerUserIP, paymentMethodData, reference, referenceType, returnPath, storePaymentMethod, }) {
|
|
74
|
+
(0, parameters_validation_1.required)({
|
|
75
|
+
bankTransfer,
|
|
76
|
+
browserInfo,
|
|
77
|
+
countryCode,
|
|
78
|
+
customerUserIP,
|
|
79
|
+
paymentMethodData,
|
|
80
|
+
reference,
|
|
81
|
+
returnPath,
|
|
82
|
+
});
|
|
83
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
84
|
+
method: "POST",
|
|
85
|
+
path: `/v1/shop/payments`,
|
|
86
|
+
body: JSON.stringify({
|
|
87
|
+
bankTransfer,
|
|
88
|
+
browserInfo,
|
|
89
|
+
commercialOrder,
|
|
90
|
+
countryCode,
|
|
91
|
+
customerUserIP,
|
|
92
|
+
paymentMethodData,
|
|
93
|
+
reference,
|
|
94
|
+
referenceType,
|
|
95
|
+
returnPath,
|
|
96
|
+
storePaymentMethod,
|
|
97
|
+
}),
|
|
98
|
+
});
|
|
99
|
+
return data;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* 💳 Adds payment details.
|
|
103
|
+
*
|
|
104
|
+
* This function adds additional details to an existing payment transaction.
|
|
105
|
+
* The `details` parameter is mandatory and validated before the request is executed.
|
|
106
|
+
*
|
|
107
|
+
* 🛠 **Endpoint**: `POST /v1/shop/payments/details` [PAY-102]
|
|
108
|
+
*
|
|
109
|
+
* | Parameter | Type | Required | Description |
|
|
110
|
+
* |-----------|----------|----------|--------------------------------|
|
|
111
|
+
* | `details` | `object` | ✅ | The payment details to add. |
|
|
112
|
+
*
|
|
113
|
+
* 📤 **Returns**:
|
|
114
|
+
* A `Promise` resolving to an `AddPaymentDetailsResponse` containing the result of adding payment details.
|
|
115
|
+
*
|
|
116
|
+
* @param {AddPaymentDetailsRequest} params - The parameters for adding payment details
|
|
117
|
+
* @throws {Error} If `details` is missing
|
|
118
|
+
* @returns {Promise<AddPaymentDetailsResponse>} A promise resolving to the response containing the result
|
|
119
|
+
*/
|
|
120
|
+
async function addPaymentDetails({ details, }) {
|
|
121
|
+
(0, parameters_validation_1.required)({ details });
|
|
122
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
123
|
+
method: "POST",
|
|
124
|
+
path: `/v1/shop/payments/details`,
|
|
125
|
+
body: JSON.stringify({
|
|
126
|
+
details,
|
|
127
|
+
}),
|
|
128
|
+
});
|
|
129
|
+
return data;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* 💳 Gets available payment methods.
|
|
133
|
+
*
|
|
134
|
+
* This endpoint retrieves the available payment methods based on the country, locale, amount, and currency.
|
|
135
|
+
* It provides a list of payment methods that can be used for checkout based on the merchant's Adyen configuration.
|
|
136
|
+
* The `reference` parameter is mandatory and validated before the request is executed.
|
|
137
|
+
*
|
|
138
|
+
* 🛠 **Endpoint**: `GET /v1/shop/payments/methods` [PAY-501]
|
|
139
|
+
*
|
|
140
|
+
* | Parameter | Type | Required | Description |
|
|
141
|
+
* |----------------|----------|----------|------------------------------------------------|
|
|
142
|
+
* | `reference` | `string` | ✅ | The payment reference identifier. |
|
|
143
|
+
* | `countryCode` | `string` | ❌ | The country code for payment method filtering.|
|
|
144
|
+
* | `referenceType`| `string` | ❌ | The type of reference. |
|
|
145
|
+
* | `locale` | `string` | ❌ | The locale for payment method localization. |
|
|
146
|
+
*
|
|
147
|
+
* 📤 **Returns**:
|
|
148
|
+
* A `Promise` resolving to a `GetPaymentMethodsResponse` containing the available payment methods.
|
|
149
|
+
*
|
|
150
|
+
* @param {GetPaymentMethodsRequest} params - The parameters for retrieving payment methods
|
|
151
|
+
* @throws {Error} If `reference` is missing
|
|
152
|
+
* @returns {Promise<GetPaymentMethodsResponse>} A promise resolving to the response containing available payment methods
|
|
153
|
+
*/
|
|
154
|
+
async function getPaymentMethods({ reference, countryCode, referenceType, locale, }) {
|
|
155
|
+
(0, parameters_validation_1.required)({ reference });
|
|
156
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
157
|
+
method: "GET",
|
|
158
|
+
path: `/v1/shop/payments/methods`,
|
|
159
|
+
params: {
|
|
160
|
+
reference,
|
|
161
|
+
countryCode,
|
|
162
|
+
referenceType,
|
|
163
|
+
locale,
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
return data;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* 💳 Deletes a stored payment method.
|
|
170
|
+
*
|
|
171
|
+
* This endpoint deletes a stored payment method (e.g., saved card) associated with the current shopper.
|
|
172
|
+
* It is intended for use on the storefront. If the specified ID does not exist or does not belong
|
|
173
|
+
* to the authenticated user, a 404 will be returned.
|
|
174
|
+
* The `storedPaymentMethodId` parameter is mandatory and validated before the request is executed.
|
|
175
|
+
*
|
|
176
|
+
* 🛠 **Endpoint**: `DELETE /v1/shop/payments/stored-payment-methods/{storedPaymentMethodId}` [PAY-300]
|
|
177
|
+
*
|
|
178
|
+
* | Parameter | Type | Required | Description |
|
|
179
|
+
* |------------------------|----------|----------|------------------------------------------------|
|
|
180
|
+
* | `storedPaymentMethodId`| `string` | ✅ | The ID of the stored payment method to delete.|
|
|
181
|
+
*
|
|
182
|
+
* 📤 **Returns**:
|
|
183
|
+
* A `Promise` resolving to `void` when the stored payment method is successfully deleted.
|
|
184
|
+
*
|
|
185
|
+
* @param {DeleteStoredPaymentMethodByIdRequest} params - The parameters for deleting the stored payment method
|
|
186
|
+
* @throws {Error} If `storedPaymentMethodId` is missing
|
|
187
|
+
* @returns {Promise<void>} A promise resolving when the stored payment method is successfully deleted
|
|
188
|
+
*/
|
|
189
|
+
async function deleteStoredPaymentMethodById({ storedPaymentMethodId, }) {
|
|
190
|
+
(0, parameters_validation_1.required)({ storedPaymentMethodId });
|
|
191
|
+
await (0, fetch_instance_1.enhancedFetch)({
|
|
192
|
+
method: "DELETE",
|
|
193
|
+
path: `/v1/shop/payments/stored-payment-methods/${storedPaymentMethodId}`,
|
|
194
|
+
});
|
|
195
|
+
}
|
|
@@ -36,6 +36,9 @@ export interface GetProductsListParameters {
|
|
|
36
36
|
customFields?: string[];
|
|
37
37
|
offerUpdatedTime?: string;
|
|
38
38
|
productUpdatedTime?: string;
|
|
39
|
+
withFacets?: string;
|
|
40
|
+
priceMin?: number;
|
|
41
|
+
priceMax?: number;
|
|
39
42
|
};
|
|
40
43
|
pageable?: PageableParameters;
|
|
41
44
|
}
|
|
@@ -57,6 +60,7 @@ export interface GetProductOffersParameters {
|
|
|
57
60
|
productIdType: string;
|
|
58
61
|
locale?: string;
|
|
59
62
|
currency?: string;
|
|
63
|
+
withoutPrice?: boolean;
|
|
60
64
|
}
|
|
61
65
|
export interface GetProductVariantsListParameters {
|
|
62
66
|
productSku: string;
|
|
@@ -83,6 +87,7 @@ export interface GetProductVariantOffersParameters {
|
|
|
83
87
|
productIdentifier: string;
|
|
84
88
|
productIdType: string;
|
|
85
89
|
currency?: string;
|
|
90
|
+
withoutPrice?: boolean;
|
|
86
91
|
}
|
|
87
92
|
export interface GetRelatedProductsParameters {
|
|
88
93
|
productIdentifier: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateProductReviewParameters, CreateProductReviewResponse, GetProductOffersParameters, GetProductOffersResponse, GetProductParameters, GetProductReviewsParameters, GetProductReviewsResponse, GetProductStatReviewsParameters, GetProductStatReviewsResponse, GetProductVariantAttributesParameters, GetProductVariantAttributesResponse, GetProductVariantOffersParameters, GetProductVariantOffersResponse, GetProductVariantSuppliersParameters, GetProductVariantSuppliersResponse,
|
|
1
|
+
import { CreateProductReviewParameters, CreateProductReviewResponse, GetProductOffersParameters, GetProductOffersResponse, GetProductParameters, GetProductReviewsParameters, GetProductReviewsResponse, GetProductStatReviewsParameters, GetProductStatReviewsResponse, GetProductVariantAttributesParameters, GetProductVariantAttributesResponse, GetProductVariantOffersParameters, GetProductVariantOffersResponse, GetProductVariantSuppliersParameters, GetProductVariantSuppliersResponse, GetProductsListParameters, GetProductsListResponse, GetRelatedProductsParameters, AutoCompleteSearchProductsParameters, SearchProductsResponse, UpdateProductReviewParameters, UpdateProductReviewResponse, GetProductPaginatedOffersParameters, GetProductPaginatedOffersResponse, GetRelatedProductsResponse } from "./definitions";
|
|
2
2
|
/**
|
|
3
3
|
* 📄 Search products with a text expression for search and autocomplete.
|
|
4
4
|
*
|
|
@@ -57,32 +57,6 @@ export declare function autoCompleteSearchProducts({ input, locale, currency, pa
|
|
|
57
57
|
* ```
|
|
58
58
|
*/
|
|
59
59
|
export declare function getProductsList({ locale, filters, pageable, }: GetProductsListParameters): Promise<GetProductsListResponse>;
|
|
60
|
-
/**
|
|
61
|
-
* 📄 Fetches product variants by product SKU.
|
|
62
|
-
*
|
|
63
|
-
* 🛠 **Endpoint**: `GET /v1/shop/product-variants`
|
|
64
|
-
*
|
|
65
|
-
* | Parameter | Type | Required | Description |
|
|
66
|
-
* |-----------------|--------------|----------|--------------------------------------------|
|
|
67
|
-
* | `productSku` | `string` | ✅ | The SKU of the product. |
|
|
68
|
-
* | `locale` | `string` | ❌ | The locale for product variants. |
|
|
69
|
-
* | `pageable.page` | `number` | ❌ | The page number to fetch (0-based index). |
|
|
70
|
-
* | `pageable.size` | `number` | ❌ | The number of items per page. |
|
|
71
|
-
*
|
|
72
|
-
* 📤 **Returns**:
|
|
73
|
-
* A `Promise` resolving to a `GetProductVariantsListResponse` containing the product variants.
|
|
74
|
-
*
|
|
75
|
-
* 🛠 **Example usage**:
|
|
76
|
-
* ```typescript
|
|
77
|
-
* const variants = await getProductVariantsList({
|
|
78
|
-
* productSku: 'sku123',
|
|
79
|
-
* locale: 'en-US',
|
|
80
|
-
* pageable: { page: 0, size: 10 },
|
|
81
|
-
* });
|
|
82
|
-
* console.log(variants);
|
|
83
|
-
* ```
|
|
84
|
-
*/
|
|
85
|
-
export declare function getProductVariantsList({ productSku, locale, pageable, }: GetProductVariantsListParameters): Promise<GetProductVariantsListResponse>;
|
|
86
60
|
/**
|
|
87
61
|
* 📄 Fetches offers for a specific product variant.
|
|
88
62
|
*
|
|
@@ -132,7 +106,7 @@ export declare function getProductVariantsList({ productSku, locale, pageable, }
|
|
|
132
106
|
* }
|
|
133
107
|
* ```
|
|
134
108
|
*/
|
|
135
|
-
export declare function getProductVariantOffers({ productIdentifier, productIdType, currency, }: GetProductVariantOffersParameters): Promise<GetProductVariantOffersResponse>;
|
|
109
|
+
export declare function getProductVariantOffers({ productIdentifier, productIdType, currency, withoutPrice, }: GetProductVariantOffersParameters): Promise<GetProductVariantOffersResponse>;
|
|
136
110
|
/**
|
|
137
111
|
* 📄 Fetches suppliers associated with a product variant.
|
|
138
112
|
*
|
|
@@ -186,6 +160,8 @@ export declare function getProductVariantSuppliers({ productVariantId, }: GetPro
|
|
|
186
160
|
*/
|
|
187
161
|
export declare function getProduct({ productIdentifier, productIdType, locale, }: GetProductParameters): Promise<GetProductsListResponse>;
|
|
188
162
|
/**
|
|
163
|
+
* @deprecated
|
|
164
|
+
*
|
|
189
165
|
* 📄 Fetches product offers by SKU, ID, or external ID.
|
|
190
166
|
*
|
|
191
167
|
* 🛠 **Endpoint**: `GET /v1/shop/products/{productIdentifier}/offers`
|
|
@@ -208,8 +184,9 @@ export declare function getProduct({ productIdentifier, productIdType, locale, }
|
|
|
208
184
|
* });
|
|
209
185
|
* console.log(offers);
|
|
210
186
|
* ```
|
|
187
|
+
* SWAGGER [PRODUCT-502]
|
|
211
188
|
*/
|
|
212
|
-
export declare function getProductOffers({ productIdentifier, productIdType, locale, currency, }: GetProductOffersParameters): Promise<GetProductOffersResponse>;
|
|
189
|
+
export declare function getProductOffers({ productIdentifier, productIdType, locale, currency, withoutPrice, }: GetProductOffersParameters): Promise<GetProductOffersResponse>;
|
|
213
190
|
/**
|
|
214
191
|
* 📄 Fetches related products for a specific product.
|
|
215
192
|
*
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.autoCompleteSearchProducts = autoCompleteSearchProducts;
|
|
4
4
|
exports.getProductsList = getProductsList;
|
|
5
|
-
exports.getProductVariantsList = getProductVariantsList;
|
|
6
5
|
exports.getProductVariantOffers = getProductVariantOffers;
|
|
7
6
|
exports.getProductVariantSuppliers = getProductVariantSuppliers;
|
|
8
7
|
exports.getProduct = getProduct;
|
|
@@ -60,6 +59,7 @@ async function autoCompleteSearchProducts({ input, locale, currency, pageable, a
|
|
|
60
59
|
productTags,
|
|
61
60
|
page: pageable === null || pageable === void 0 ? void 0 : pageable.page,
|
|
62
61
|
size: pageable === null || pageable === void 0 ? void 0 : pageable.size,
|
|
62
|
+
sort: pageable === null || pageable === void 0 ? void 0 : pageable.sort,
|
|
63
63
|
},
|
|
64
64
|
});
|
|
65
65
|
return data;
|
|
@@ -104,45 +104,6 @@ async function getProductsList({ locale, filters, pageable, }) {
|
|
|
104
104
|
});
|
|
105
105
|
return data;
|
|
106
106
|
}
|
|
107
|
-
/**
|
|
108
|
-
* 📄 Fetches product variants by product SKU.
|
|
109
|
-
*
|
|
110
|
-
* 🛠 **Endpoint**: `GET /v1/shop/product-variants`
|
|
111
|
-
*
|
|
112
|
-
* | Parameter | Type | Required | Description |
|
|
113
|
-
* |-----------------|--------------|----------|--------------------------------------------|
|
|
114
|
-
* | `productSku` | `string` | ✅ | The SKU of the product. |
|
|
115
|
-
* | `locale` | `string` | ❌ | The locale for product variants. |
|
|
116
|
-
* | `pageable.page` | `number` | ❌ | The page number to fetch (0-based index). |
|
|
117
|
-
* | `pageable.size` | `number` | ❌ | The number of items per page. |
|
|
118
|
-
*
|
|
119
|
-
* 📤 **Returns**:
|
|
120
|
-
* A `Promise` resolving to a `GetProductVariantsListResponse` containing the product variants.
|
|
121
|
-
*
|
|
122
|
-
* 🛠 **Example usage**:
|
|
123
|
-
* ```typescript
|
|
124
|
-
* const variants = await getProductVariantsList({
|
|
125
|
-
* productSku: 'sku123',
|
|
126
|
-
* locale: 'en-US',
|
|
127
|
-
* pageable: { page: 0, size: 10 },
|
|
128
|
-
* });
|
|
129
|
-
* console.log(variants);
|
|
130
|
-
* ```
|
|
131
|
-
*/
|
|
132
|
-
async function getProductVariantsList({ productSku, locale, pageable, }) {
|
|
133
|
-
(0, parameters_validation_1.required)({ productSku });
|
|
134
|
-
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
135
|
-
method: "GET",
|
|
136
|
-
path: `/v1/shop/product-variants`,
|
|
137
|
-
params: {
|
|
138
|
-
productSku,
|
|
139
|
-
locale,
|
|
140
|
-
page: pageable === null || pageable === void 0 ? void 0 : pageable.page,
|
|
141
|
-
size: pageable === null || pageable === void 0 ? void 0 : pageable.size,
|
|
142
|
-
},
|
|
143
|
-
});
|
|
144
|
-
return data;
|
|
145
|
-
}
|
|
146
107
|
/**
|
|
147
108
|
* 📄 Fetches offers for a specific product variant.
|
|
148
109
|
*
|
|
@@ -192,7 +153,7 @@ async function getProductVariantsList({ productSku, locale, pageable, }) {
|
|
|
192
153
|
* }
|
|
193
154
|
* ```
|
|
194
155
|
*/
|
|
195
|
-
async function getProductVariantOffers({ productIdentifier, productIdType, currency, }) {
|
|
156
|
+
async function getProductVariantOffers({ productIdentifier, productIdType, currency, withoutPrice, }) {
|
|
196
157
|
(0, parameters_validation_1.required)({ productIdentifier, productIdType });
|
|
197
158
|
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
198
159
|
method: "GET",
|
|
@@ -200,6 +161,7 @@ async function getProductVariantOffers({ productIdentifier, productIdType, curre
|
|
|
200
161
|
params: {
|
|
201
162
|
productIdType,
|
|
202
163
|
currency,
|
|
164
|
+
withoutPrice,
|
|
203
165
|
},
|
|
204
166
|
});
|
|
205
167
|
return data;
|
|
@@ -275,6 +237,8 @@ async function getProduct({ productIdentifier, productIdType, locale, }) {
|
|
|
275
237
|
return data;
|
|
276
238
|
}
|
|
277
239
|
/**
|
|
240
|
+
* @deprecated
|
|
241
|
+
*
|
|
278
242
|
* 📄 Fetches product offers by SKU, ID, or external ID.
|
|
279
243
|
*
|
|
280
244
|
* 🛠 **Endpoint**: `GET /v1/shop/products/{productIdentifier}/offers`
|
|
@@ -297,8 +261,9 @@ async function getProduct({ productIdentifier, productIdType, locale, }) {
|
|
|
297
261
|
* });
|
|
298
262
|
* console.log(offers);
|
|
299
263
|
* ```
|
|
264
|
+
* SWAGGER [PRODUCT-502]
|
|
300
265
|
*/
|
|
301
|
-
async function getProductOffers({ productIdentifier, productIdType, locale, currency, }) {
|
|
266
|
+
async function getProductOffers({ productIdentifier, productIdType, locale, currency, withoutPrice, }) {
|
|
302
267
|
(0, parameters_validation_1.required)({ productIdentifier, productIdType });
|
|
303
268
|
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
304
269
|
method: "GET",
|
|
@@ -307,6 +272,7 @@ async function getProductOffers({ productIdentifier, productIdType, locale, curr
|
|
|
307
272
|
productIdType,
|
|
308
273
|
locale,
|
|
309
274
|
currency,
|
|
275
|
+
withoutPrice,
|
|
310
276
|
},
|
|
311
277
|
});
|
|
312
278
|
return data;
|
|
@@ -141,4 +141,31 @@ export interface GetProductPaginatedOffersResponse {
|
|
|
141
141
|
totalElements: number;
|
|
142
142
|
totalPages: number;
|
|
143
143
|
}
|
|
144
|
+
export interface GetProductVariantParameters {
|
|
145
|
+
productVariantId: string;
|
|
146
|
+
locale?: string;
|
|
147
|
+
}
|
|
148
|
+
export interface ProductVariantPictureUrl {
|
|
149
|
+
formatType: string;
|
|
150
|
+
heightInPx: number;
|
|
151
|
+
sizeType: string;
|
|
152
|
+
url: string;
|
|
153
|
+
widthInPx: number;
|
|
154
|
+
}
|
|
155
|
+
export interface ProductVariantPicture {
|
|
156
|
+
isMain: boolean;
|
|
157
|
+
urls: ProductVariantPictureUrl[];
|
|
158
|
+
}
|
|
159
|
+
export interface GetProductVariantResponse {
|
|
160
|
+
description: string;
|
|
161
|
+
ean: string;
|
|
162
|
+
externalId: string;
|
|
163
|
+
id: string;
|
|
164
|
+
name: string;
|
|
165
|
+
productExternalId: string;
|
|
166
|
+
skuProduct: string;
|
|
167
|
+
skuVariant: string;
|
|
168
|
+
status: string;
|
|
169
|
+
variantPictures: ProductVariantPicture[];
|
|
170
|
+
}
|
|
144
171
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GetProductVariantAttributesParameters, GetProductVariantAttributesResponse, GetProductVariantSuppliersParameters, GetProductVariantSuppliersResponse, GetProductVariantsListParameters, GetProductVariantsListResponse } from "./definitions";
|
|
1
|
+
import { GetProductVariantAttributesParameters, GetProductVariantAttributesResponse, GetProductVariantParameters, GetProductVariantResponse, GetProductVariantSuppliersParameters, GetProductVariantSuppliersResponse, GetProductVariantsListParameters, GetProductVariantsListResponse } from "./definitions";
|
|
2
2
|
/**
|
|
3
3
|
* 📄 Fetches a paginated list of product variants.
|
|
4
4
|
*
|
|
@@ -91,3 +91,32 @@ export declare function getProductVariantSuppliers({ productVariantId, }: GetPro
|
|
|
91
91
|
* @returns {Promise<GetProductVariantAttributesResponse>} A promise resolving to the product variant attributes response.
|
|
92
92
|
*/
|
|
93
93
|
export declare function getProductVariantAttributes({ productIdentifier, productIdType, locale, }: GetProductVariantAttributesParameters): Promise<GetProductVariantAttributesResponse>;
|
|
94
|
+
/**
|
|
95
|
+
* 📄 Fetches details of a specific product variant.
|
|
96
|
+
*
|
|
97
|
+
* This function retrieves detailed information about a product variant identified by its ID.
|
|
98
|
+
*
|
|
99
|
+
* 🛠 **Endpoint**: `GET /v1/shop/product-variants/{productVariantId}`
|
|
100
|
+
*
|
|
101
|
+
* | Parameter | Type | Required | Description |
|
|
102
|
+
* |---------------------|--------------|----------|-------------------------------------------------|
|
|
103
|
+
* | `productVariantId` | `string` | ✅ | The ID of the product variant to fetch. |
|
|
104
|
+
* | `locale` | `string` | ❌ | The locale for localized data (e.g., `en-US`). |
|
|
105
|
+
*
|
|
106
|
+
* 📤 **Returns**:
|
|
107
|
+
* A `Promise` resolving to a `GetProductVariantResponse` object, containing the product variant details.
|
|
108
|
+
*
|
|
109
|
+
* 🛠 **Example usage**:
|
|
110
|
+
* ```typescript
|
|
111
|
+
* const variant = await getProductVariant({
|
|
112
|
+
* productVariantId: 'variant123',
|
|
113
|
+
* locale: 'fr-FR',
|
|
114
|
+
* });
|
|
115
|
+
* console.log(variant);
|
|
116
|
+
* ```
|
|
117
|
+
*
|
|
118
|
+
* @param {GetProductVariantParameters} params - The parameters for fetching the product variant.
|
|
119
|
+
* @throws {Error} If `productVariantId` is missing.
|
|
120
|
+
* @returns {Promise<GetProductVariantResponse>} A promise resolving to the product variant response.
|
|
121
|
+
*/
|
|
122
|
+
export declare function getProductVariant({ productVariantId, locale, }: GetProductVariantParameters): Promise<GetProductVariantResponse>;
|