@gofynd/fdk-client-javascript 1.0.4 → 1.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/README.md +19 -0
- package/index.d.ts +4 -1
- package/index.js +19 -3
- package/package.json +13 -4
- package/partner.d.ts +4 -0
- package/partner.js +7 -0
- package/sdk/application/ApplicationAPIClient.js +2 -4
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +6 -1
- package/sdk/application/Catalog/CatalogApplicationClient.js +11 -2
- package/sdk/application/Catalog/CatalogApplicationModel.js +4 -2
- package/sdk/application/Catalog/CatalogApplicationValidator.js +2 -0
- package/sdk/application/Content/ContentApplicationModel.js +0 -5
- package/sdk/application/Lead/LeadApplicationModel.js +1 -0
- package/sdk/application/Order/OrderApplicationClient.d.ts +0 -15
- package/sdk/application/Order/OrderApplicationClient.js +0 -68
- package/sdk/application/Order/OrderApplicationModel.d.ts +0 -17
- package/sdk/application/Order/OrderApplicationModel.js +0 -111
- package/sdk/application/Order/OrderApplicationValidator.d.ts +0 -1
- package/sdk/application/Order/OrderApplicationValidator.js +0 -7
- package/sdk/common/AxiosHelper.js +1 -1
- package/sdk/common/BaseOAuthClient.d.ts +17 -0
- package/sdk/common/BaseOAuthClient.js +67 -0
- package/sdk/common/Constant.d.ts +0 -18
- package/sdk/common/Constant.js +0 -22
- package/sdk/common/RequestSigner.js +0 -5
- package/sdk/partner/OAuthClient.d.ts +14 -0
- package/sdk/partner/OAuthClient.js +112 -0
- package/sdk/{APIClient.d.ts → partner/PartnerAPIClient.d.ts} +2 -1
- package/sdk/{APIClient.js → partner/PartnerAPIClient.js} +13 -6
- package/sdk/{Client.d.ts → partner/PartnerClient.d.ts} +2 -2
- package/sdk/{Client.js → partner/PartnerClient.js} +2 -2
- package/sdk/partner/PartnerConfig.d.ts +30 -0
- package/sdk/partner/PartnerConfig.js +39 -0
- package/sdk/partner/index.d.ts +3 -0
- package/sdk/partner/index.js +5 -0
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -0
- package/sdk/platform/Billing/BillingPlatformClient.js +134 -0
- package/sdk/platform/Billing/BillingPlatformModel.d.ts +4 -0
- package/sdk/platform/Billing/BillingPlatformModel.js +44 -0
- package/sdk/platform/Billing/BillingPlatformValidator.d.ts +2 -0
- package/sdk/platform/Billing/BillingPlatformValidator.js +14 -0
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +29 -0
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +181 -0
- package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +3 -0
- package/sdk/platform/Cart/CartPlatformApplicationValidator.js +17 -0
- package/sdk/platform/Cart/CartPlatformModel.d.ts +4 -0
- package/sdk/platform/Cart/CartPlatformModel.js +37 -0
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +3 -1
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +5 -0
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +1 -0
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +1 -1
- package/sdk/platform/Catalog/CatalogPlatformClient.js +1 -1
- package/sdk/platform/Catalog/CatalogPlatformModel.js +1 -5
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +0 -183
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +0 -417
- package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +0 -10
- package/sdk/platform/Communication/CommunicationPlatformClient.js +0 -26
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +4 -0
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +0 -22
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +0 -56
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +22 -1
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +123 -2
- package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +2 -0
- package/sdk/platform/Content/ContentPlatformApplicationValidator.js +12 -0
- package/sdk/platform/Content/ContentPlatformModel.js +0 -5
- package/sdk/platform/Discount/DiscountPlatformClient.d.ts +2 -2
- package/sdk/platform/Discount/DiscountPlatformClient.js +1 -1
- package/sdk/platform/Discount/DiscountPlatformModel.d.ts +1 -0
- package/sdk/platform/Discount/DiscountPlatformModel.js +15 -0
- package/sdk/platform/Discount/DiscountPlatformValidator.js +1 -1
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +1 -1
- package/sdk/platform/Lead/LeadPlatformModel.js +1 -0
- package/sdk/platform/OAuthClient.js +3 -9
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +1 -47
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +5 -201
- package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +1 -3
- package/sdk/platform/Order/OrderPlatformApplicationValidator.js +1 -26
- package/sdk/platform/Order/OrderPlatformClient.d.ts +51 -183
- package/sdk/platform/Order/OrderPlatformClient.js +243 -931
- package/sdk/platform/Order/OrderPlatformModel.d.ts +4 -20
- package/sdk/platform/Order/OrderPlatformModel.js +38 -182
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +3 -12
- package/sdk/platform/Order/OrderPlatformValidator.js +19 -95
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +24 -10
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +111 -44
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.d.ts +2 -1
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +13 -5
- package/sdk/platform/Payment/PaymentPlatformModel.d.ts +2 -0
- package/sdk/platform/Payment/PaymentPlatformModel.js +12 -0
- package/sdk/platform/PlatformApplicationClient.d.ts +16 -41
- package/sdk/platform/PlatformApplicationClient.js +17 -45
- package/sdk/platform/PlatformClient.d.ts +124 -263
- package/sdk/platform/PlatformClient.js +148 -315
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +14 -16
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +63 -77
- package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.d.ts +1 -1
- package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.js +7 -8
- package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +11 -0
- package/sdk/platform/Share/SharePlatformApplicationClient.js +61 -0
- package/sdk/platform/Share/SharePlatformApplicationValidator.d.ts +1 -0
- package/sdk/platform/Share/SharePlatformApplicationValidator.js +6 -0
- package/sdk/platform/Share/SharePlatformModel.d.ts +2 -0
- package/sdk/platform/Share/SharePlatformModel.js +11 -0
- package/sdk/platform/index.d.ts +0 -1
- package/sdk/platform/index.js +0 -2
- package/sdk/Config.d.ts +0 -9
- package/sdk/Config.js +0 -17
- package/sdk/constructUrl.d.ts +0 -5
- package/sdk/constructUrl.js +0 -13
- package/sdk/index.d.ts +0 -3
- package/sdk/index.js +0 -5
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +0 -109
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +0 -558
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.d.ts +0 -11
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.js +0 -56
- package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +0 -88
- package/sdk/platform/Analytics/AnalyticsPlatformClient.js +0 -361
- package/sdk/platform/Analytics/AnalyticsPlatformModel.d.ts +0 -23
- package/sdk/platform/Analytics/AnalyticsPlatformModel.js +0 -169
- package/sdk/platform/Analytics/AnalyticsPlatformValidator.d.ts +0 -7
- package/sdk/platform/Analytics/AnalyticsPlatformValidator.js +0 -38
|
@@ -311,6 +311,17 @@ declare class Content {
|
|
|
311
311
|
applicationId: string;
|
|
312
312
|
pageSize?: number;
|
|
313
313
|
}): Paginator;
|
|
314
|
+
/**
|
|
315
|
+
* @param {Object} arg - Arg object.
|
|
316
|
+
* @param {string} arg.slug - A short, human-readable, URL-friendly
|
|
317
|
+
* identifier of a blog page. You can get slug value of a blog from `getBlogs` API.
|
|
318
|
+
* @returns {Promise<BlogSchema>} - Success response
|
|
319
|
+
* @summary: Get blog by slug
|
|
320
|
+
* @description: Use this API to retrieve the components of a blog, such as title, slug, feature image, content, schedule, publish status, author, etc.
|
|
321
|
+
*/
|
|
322
|
+
getBlogBySlug({ slug }?: {
|
|
323
|
+
slug: string;
|
|
324
|
+
}): Promise<BlogSchema>;
|
|
314
325
|
/**
|
|
315
326
|
* @param {Object} arg - Arg object.
|
|
316
327
|
* @param {number} [arg.pageNo] - The page number to navigate through the
|
|
@@ -512,7 +523,7 @@ declare class Content {
|
|
|
512
523
|
* @param {string} arg.slug - A short, human-readable, URL-friendly
|
|
513
524
|
* identifier of a page. You can get slug value of a page from `getPages` API.
|
|
514
525
|
* @returns {Promise<PageSchema>} - Success response
|
|
515
|
-
* @summary: Get
|
|
526
|
+
* @summary: Get page by slug
|
|
516
527
|
* @description: Use this API to retrieve the components of a page, such as its title, seo, publish status, feature image, tags, schedule, etc.
|
|
517
528
|
*/
|
|
518
529
|
getPageBySlug({ slug }?: {
|
|
@@ -826,6 +837,16 @@ declare class Content {
|
|
|
826
837
|
pathId: string;
|
|
827
838
|
body: PathMappingSchema;
|
|
828
839
|
}): Promise<PathMappingSchema>;
|
|
840
|
+
/**
|
|
841
|
+
* @param {Object} arg - Arg object.
|
|
842
|
+
* @param {SeoComponent} arg.body
|
|
843
|
+
* @returns {Promise<SeoSchema>} - Success response
|
|
844
|
+
* @summary: Update SEO of application
|
|
845
|
+
* @description: Use this API to edit the SEO details of an application. This includes the sitemap, robot.txt, custom meta tags, etc.
|
|
846
|
+
*/
|
|
847
|
+
updateSEOConfiguration({ body }?: {
|
|
848
|
+
body: SeoComponent;
|
|
849
|
+
}): Promise<SeoSchema>;
|
|
829
850
|
/**
|
|
830
851
|
* @param {Object} arg - Arg object.
|
|
831
852
|
* @param {string} arg.id - ID allotted to the slideshow.
|
|
@@ -114,7 +114,7 @@ class Content {
|
|
|
114
114
|
const response = await PlatformAPIClient.execute(
|
|
115
115
|
this.config,
|
|
116
116
|
"post",
|
|
117
|
-
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/faq/category/${categoryId}/
|
|
117
|
+
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/faq/category/${categoryId}/faq`,
|
|
118
118
|
query_params,
|
|
119
119
|
body
|
|
120
120
|
);
|
|
@@ -1760,6 +1760,66 @@ class Content {
|
|
|
1760
1760
|
return paginator;
|
|
1761
1761
|
}
|
|
1762
1762
|
|
|
1763
|
+
/**
|
|
1764
|
+
* @param {Object} arg - Arg object.
|
|
1765
|
+
* @param {string} arg.slug - A short, human-readable, URL-friendly
|
|
1766
|
+
* identifier of a blog page. You can get slug value of a blog from `getBlogs` API.
|
|
1767
|
+
* @returns {Promise<BlogSchema>} - Success response
|
|
1768
|
+
* @summary: Get blog by slug
|
|
1769
|
+
* @description: Use this API to retrieve the components of a blog, such as title, slug, feature image, content, schedule, publish status, author, etc.
|
|
1770
|
+
*/
|
|
1771
|
+
async getBlogBySlug({ slug } = {}) {
|
|
1772
|
+
const { error } = ContentValidator.getBlogBySlug().validate(
|
|
1773
|
+
{
|
|
1774
|
+
slug,
|
|
1775
|
+
},
|
|
1776
|
+
{ abortEarly: false, allowUnknown: true }
|
|
1777
|
+
);
|
|
1778
|
+
if (error) {
|
|
1779
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1783
|
+
const { error: warrning } = ContentValidator.getBlogBySlug().validate(
|
|
1784
|
+
{
|
|
1785
|
+
slug,
|
|
1786
|
+
},
|
|
1787
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1788
|
+
);
|
|
1789
|
+
if (warrning) {
|
|
1790
|
+
Logger({
|
|
1791
|
+
level: "WARN",
|
|
1792
|
+
message: "Parameter Validation warrnings for getBlogBySlug",
|
|
1793
|
+
});
|
|
1794
|
+
Logger({ level: "WARN", message: warrning });
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
const query_params = {};
|
|
1798
|
+
|
|
1799
|
+
const response = await PlatformAPIClient.execute(
|
|
1800
|
+
this.config,
|
|
1801
|
+
"get",
|
|
1802
|
+
`/service/platform/content/v2.0/company/${this.config.companyId}/application/${this.applicationId}/blogs/${slug}`,
|
|
1803
|
+
query_params,
|
|
1804
|
+
undefined
|
|
1805
|
+
);
|
|
1806
|
+
|
|
1807
|
+
const { error: res_error } = ContentModel.BlogSchema().validate(response, {
|
|
1808
|
+
abortEarly: false,
|
|
1809
|
+
allowUnknown: false,
|
|
1810
|
+
});
|
|
1811
|
+
|
|
1812
|
+
if (res_error) {
|
|
1813
|
+
Logger({
|
|
1814
|
+
level: "WARN",
|
|
1815
|
+
message: "Response Validation Warnnings for getBlogBySlug",
|
|
1816
|
+
});
|
|
1817
|
+
Logger({ level: "WARN", message: res_error });
|
|
1818
|
+
}
|
|
1819
|
+
|
|
1820
|
+
return response;
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1763
1823
|
/**
|
|
1764
1824
|
* @param {Object} arg - Arg object.
|
|
1765
1825
|
* @param {number} [arg.pageNo] - The page number to navigate through the
|
|
@@ -2683,7 +2743,7 @@ class Content {
|
|
|
2683
2743
|
* @param {string} arg.slug - A short, human-readable, URL-friendly
|
|
2684
2744
|
* identifier of a page. You can get slug value of a page from `getPages` API.
|
|
2685
2745
|
* @returns {Promise<PageSchema>} - Success response
|
|
2686
|
-
* @summary: Get
|
|
2746
|
+
* @summary: Get page by slug
|
|
2687
2747
|
* @description: Use this API to retrieve the components of a page, such as its title, seo, publish status, feature image, tags, schedule, etc.
|
|
2688
2748
|
*/
|
|
2689
2749
|
async getPageBySlug({ slug } = {}) {
|
|
@@ -4326,6 +4386,67 @@ class Content {
|
|
|
4326
4386
|
return response;
|
|
4327
4387
|
}
|
|
4328
4388
|
|
|
4389
|
+
/**
|
|
4390
|
+
* @param {Object} arg - Arg object.
|
|
4391
|
+
* @param {SeoComponent} arg.body
|
|
4392
|
+
* @returns {Promise<SeoSchema>} - Success response
|
|
4393
|
+
* @summary: Update SEO of application
|
|
4394
|
+
* @description: Use this API to edit the SEO details of an application. This includes the sitemap, robot.txt, custom meta tags, etc.
|
|
4395
|
+
*/
|
|
4396
|
+
async updateSEOConfiguration({ body } = {}) {
|
|
4397
|
+
const { error } = ContentValidator.updateSEOConfiguration().validate(
|
|
4398
|
+
{
|
|
4399
|
+
body,
|
|
4400
|
+
},
|
|
4401
|
+
{ abortEarly: false, allowUnknown: true }
|
|
4402
|
+
);
|
|
4403
|
+
if (error) {
|
|
4404
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
4405
|
+
}
|
|
4406
|
+
|
|
4407
|
+
// Showing warrnings if extra unknown parameters are found
|
|
4408
|
+
const {
|
|
4409
|
+
error: warrning,
|
|
4410
|
+
} = ContentValidator.updateSEOConfiguration().validate(
|
|
4411
|
+
{
|
|
4412
|
+
body,
|
|
4413
|
+
},
|
|
4414
|
+
{ abortEarly: false, allowUnknown: false }
|
|
4415
|
+
);
|
|
4416
|
+
if (warrning) {
|
|
4417
|
+
Logger({
|
|
4418
|
+
level: "WARN",
|
|
4419
|
+
message: "Parameter Validation warrnings for updateSEOConfiguration",
|
|
4420
|
+
});
|
|
4421
|
+
Logger({ level: "WARN", message: warrning });
|
|
4422
|
+
}
|
|
4423
|
+
|
|
4424
|
+
const query_params = {};
|
|
4425
|
+
|
|
4426
|
+
const response = await PlatformAPIClient.execute(
|
|
4427
|
+
this.config,
|
|
4428
|
+
"post",
|
|
4429
|
+
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/seo`,
|
|
4430
|
+
query_params,
|
|
4431
|
+
body
|
|
4432
|
+
);
|
|
4433
|
+
|
|
4434
|
+
const { error: res_error } = ContentModel.SeoSchema().validate(response, {
|
|
4435
|
+
abortEarly: false,
|
|
4436
|
+
allowUnknown: false,
|
|
4437
|
+
});
|
|
4438
|
+
|
|
4439
|
+
if (res_error) {
|
|
4440
|
+
Logger({
|
|
4441
|
+
level: "WARN",
|
|
4442
|
+
message: "Response Validation Warnnings for updateSEOConfiguration",
|
|
4443
|
+
});
|
|
4444
|
+
Logger({ level: "WARN", message: res_error });
|
|
4445
|
+
}
|
|
4446
|
+
|
|
4447
|
+
return response;
|
|
4448
|
+
}
|
|
4449
|
+
|
|
4329
4450
|
/**
|
|
4330
4451
|
* @param {Object} arg - Arg object.
|
|
4331
4452
|
* @param {string} arg.id - ID allotted to the slideshow.
|
|
@@ -28,6 +28,7 @@ declare class ContentValidator {
|
|
|
28
28
|
static generateSEOTitle(): any;
|
|
29
29
|
static getAnnouncementById(): any;
|
|
30
30
|
static getAnnouncementsList(): any;
|
|
31
|
+
static getBlogBySlug(): any;
|
|
31
32
|
static getBlogs(): any;
|
|
32
33
|
static getComponentById(): any;
|
|
33
34
|
static getDataLoaders(): any;
|
|
@@ -66,6 +67,7 @@ declare class ContentValidator {
|
|
|
66
67
|
static updatePage(): any;
|
|
67
68
|
static updatePagePreview(): any;
|
|
68
69
|
static updatePathRedirectionRules(): any;
|
|
70
|
+
static updateSEOConfiguration(): any;
|
|
69
71
|
static updateSlideshow(): any;
|
|
70
72
|
static updateSupportInformation(): any;
|
|
71
73
|
}
|
|
@@ -174,6 +174,12 @@ class ContentValidator {
|
|
|
174
174
|
}).required();
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
static getBlogBySlug() {
|
|
178
|
+
return Joi.object({
|
|
179
|
+
slug: Joi.string().allow("").required(),
|
|
180
|
+
}).required();
|
|
181
|
+
}
|
|
182
|
+
|
|
177
183
|
static getBlogs() {
|
|
178
184
|
return Joi.object({
|
|
179
185
|
pageNo: Joi.number(),
|
|
@@ -406,6 +412,12 @@ class ContentValidator {
|
|
|
406
412
|
}).required();
|
|
407
413
|
}
|
|
408
414
|
|
|
415
|
+
static updateSEOConfiguration() {
|
|
416
|
+
return Joi.object({
|
|
417
|
+
body: ContentModel.SeoComponent().required(),
|
|
418
|
+
}).required();
|
|
419
|
+
}
|
|
420
|
+
|
|
409
421
|
static updateSlideshow() {
|
|
410
422
|
return Joi.object({
|
|
411
423
|
id: Joi.string().allow("").required(),
|
|
@@ -347,7 +347,6 @@ class ContentModel {
|
|
|
347
347
|
static Detail() {
|
|
348
348
|
return Joi.object({
|
|
349
349
|
description: Joi.string().allow(""),
|
|
350
|
-
image_url: Joi.string().allow(""),
|
|
351
350
|
title: Joi.string().allow(""),
|
|
352
351
|
});
|
|
353
352
|
}
|
|
@@ -912,10 +911,6 @@ class ContentModel {
|
|
|
912
911
|
|
|
913
912
|
"product",
|
|
914
913
|
|
|
915
|
-
"product-reviews",
|
|
916
|
-
|
|
917
|
-
"add-product-review",
|
|
918
|
-
|
|
919
914
|
"product-request",
|
|
920
915
|
|
|
921
916
|
"products",
|
|
@@ -128,13 +128,13 @@ declare class Discount {
|
|
|
128
128
|
/**
|
|
129
129
|
* @param {Object} arg - Arg object.
|
|
130
130
|
* @param {string} [arg.discount] - Discount
|
|
131
|
-
* @param {
|
|
131
|
+
* @param {FileJobRequest} arg.body
|
|
132
132
|
* @returns {Promise<FileJobResponse>} - Success response
|
|
133
133
|
* @summary: Validate File.
|
|
134
134
|
* @description: Validate File.
|
|
135
135
|
*/
|
|
136
136
|
validateDiscountFile({ body, discount }?: {
|
|
137
137
|
discount?: string;
|
|
138
|
-
body:
|
|
138
|
+
body: FileJobRequest;
|
|
139
139
|
}): Promise<FileJobResponse>;
|
|
140
140
|
}
|
|
@@ -705,7 +705,7 @@ class Discount {
|
|
|
705
705
|
/**
|
|
706
706
|
* @param {Object} arg - Arg object.
|
|
707
707
|
* @param {string} [arg.discount] - Discount
|
|
708
|
-
* @param {
|
|
708
|
+
* @param {FileJobRequest} arg.body
|
|
709
709
|
* @returns {Promise<FileJobResponse>} - Success response
|
|
710
710
|
* @summary: Validate File.
|
|
711
711
|
* @description: Validate File.
|
|
@@ -71,6 +71,21 @@ class DiscountModel {
|
|
|
71
71
|
store_ids: Joi.array().items(Joi.number()),
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
|
+
static FileJobRequest() {
|
|
75
|
+
return Joi.object({
|
|
76
|
+
app_ids: Joi.array().items(Joi.string().allow("")),
|
|
77
|
+
brand_ids: Joi.array().items(Joi.number()),
|
|
78
|
+
discount_level: Joi.string().allow(""),
|
|
79
|
+
discount_type: Joi.string().allow(""),
|
|
80
|
+
file_path: Joi.string().allow(""),
|
|
81
|
+
is_active: Joi.boolean().required(),
|
|
82
|
+
job_type: Joi.string().allow(""),
|
|
83
|
+
meta: Joi.any(),
|
|
84
|
+
name: Joi.string().allow("").required(),
|
|
85
|
+
store_ids: Joi.array().items(Joi.number()),
|
|
86
|
+
validity: DiscountModel.ValidityObject().required(),
|
|
87
|
+
});
|
|
88
|
+
}
|
|
74
89
|
static FileJobResponse() {
|
|
75
90
|
return Joi.object({
|
|
76
91
|
body: Joi.any(),
|
|
@@ -3,6 +3,7 @@ const { fdkAxios } = require("../common/AxiosHelper");
|
|
|
3
3
|
const { sign } = require("../common/RequestSigner");
|
|
4
4
|
const { FDKTokenIssueError, FDKOAuthCodeError } = require("../common/FDKError");
|
|
5
5
|
const { Logger } = require("../common/Logger");
|
|
6
|
+
const { btoa } = require("isomorphic-base64");
|
|
6
7
|
|
|
7
8
|
const refreshTokenRequestCache = {};
|
|
8
9
|
class OAuthClient {
|
|
@@ -158,11 +159,7 @@ class OAuthClient {
|
|
|
158
159
|
} else if (grant_type === "authorization_code") {
|
|
159
160
|
reqData = { ...reqData, code };
|
|
160
161
|
}
|
|
161
|
-
|
|
162
|
-
const token = Buffer.from(
|
|
163
|
-
`${this.config.apiKey}:${this.config.apiSecret}`,
|
|
164
|
-
"utf8"
|
|
165
|
-
).toString("base64");
|
|
162
|
+
const token = btoa(`${this.config.apiKey}:${this.config.apiSecret}`);
|
|
166
163
|
let url = `${this.config.domain}/service/panel/authentication/v1.0/company/${this.config.companyId}/oauth/token`;
|
|
167
164
|
const rawRequest = {
|
|
168
165
|
method: "post",
|
|
@@ -201,10 +198,7 @@ class OAuthClient {
|
|
|
201
198
|
scope: scopes,
|
|
202
199
|
code: code,
|
|
203
200
|
};
|
|
204
|
-
const token =
|
|
205
|
-
`${this.config.apiKey}:${this.config.apiSecret}`,
|
|
206
|
-
"utf8"
|
|
207
|
-
).toString("base64");
|
|
201
|
+
const token = btoa(`${this.config.apiKey}:${this.config.apiSecret}`);
|
|
208
202
|
const rawRequest = {
|
|
209
203
|
method: "post",
|
|
210
204
|
url: url,
|
|
@@ -3,52 +3,6 @@ declare class Order {
|
|
|
3
3
|
constructor(config: any, applicationId: any);
|
|
4
4
|
config: any;
|
|
5
5
|
applicationId: any;
|
|
6
|
-
/**
|
|
7
|
-
* @param {Object} arg - Arg object.
|
|
8
|
-
* @param {string} arg.orderId -
|
|
9
|
-
* @returns {Promise<ShipmentDetailsResponse>} - Success response
|
|
10
|
-
* @summary:
|
|
11
|
-
* @description:
|
|
12
|
-
*/
|
|
13
|
-
getAppOrderShipmentDetails({ orderId }?: {
|
|
14
|
-
orderId: string;
|
|
15
|
-
}): Promise<ShipmentDetailsResponse>;
|
|
16
|
-
/**
|
|
17
|
-
* @param {Object} arg - Arg object.
|
|
18
|
-
* @param {string} [arg.lane] -
|
|
19
|
-
* @param {string} [arg.searchType] -
|
|
20
|
-
* @param {string} [arg.searchId] -
|
|
21
|
-
* @param {string} [arg.fromDate] -
|
|
22
|
-
* @param {string} [arg.toDate] -
|
|
23
|
-
* @param {string} [arg.dpIds] -
|
|
24
|
-
* @param {string} [arg.orderingCompanyId] -
|
|
25
|
-
* @param {string} [arg.stores] -
|
|
26
|
-
* @param {string} [arg.salesChannel] -
|
|
27
|
-
* @param {string} [arg.requestByExt] -
|
|
28
|
-
* @param {number} [arg.pageNo] -
|
|
29
|
-
* @param {number} [arg.pageSize] -
|
|
30
|
-
* @param {string} [arg.customerId] -
|
|
31
|
-
* @param {boolean} [arg.isPrioritySort] -
|
|
32
|
-
* @returns {Promise<ShipmentInternalPlatformViewResponse>} - Success response
|
|
33
|
-
* @summary:
|
|
34
|
-
* @description:
|
|
35
|
-
*/
|
|
36
|
-
getApplicationShipments({ lane, searchType, searchId, fromDate, toDate, dpIds, orderingCompanyId, stores, salesChannel, requestByExt, pageNo, pageSize, customerId, isPrioritySort, }?: {
|
|
37
|
-
lane?: string;
|
|
38
|
-
searchType?: string;
|
|
39
|
-
searchId?: string;
|
|
40
|
-
fromDate?: string;
|
|
41
|
-
toDate?: string;
|
|
42
|
-
dpIds?: string;
|
|
43
|
-
orderingCompanyId?: string;
|
|
44
|
-
stores?: string;
|
|
45
|
-
salesChannel?: string;
|
|
46
|
-
requestByExt?: string;
|
|
47
|
-
pageNo?: number;
|
|
48
|
-
pageSize?: number;
|
|
49
|
-
customerId?: string;
|
|
50
|
-
isPrioritySort?: boolean;
|
|
51
|
-
}): Promise<ShipmentInternalPlatformViewResponse>;
|
|
52
6
|
/**
|
|
53
7
|
* @param {Object} arg - Arg object.
|
|
54
8
|
* @param {string} arg.shipmentId -
|
|
@@ -56,7 +10,7 @@ declare class Order {
|
|
|
56
10
|
* @summary: Track shipment
|
|
57
11
|
* @description: Track Shipment by shipment id, for application based on application Id
|
|
58
12
|
*/
|
|
59
|
-
|
|
13
|
+
trackShipmentPlatform({ shipmentId }?: {
|
|
60
14
|
shipmentId: string;
|
|
61
15
|
}): Promise<PlatformShipmentTrack>;
|
|
62
16
|
}
|
|
@@ -12,202 +12,6 @@ class Order {
|
|
|
12
12
|
this.applicationId = applicationId;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
/**
|
|
16
|
-
* @param {Object} arg - Arg object.
|
|
17
|
-
* @param {string} arg.orderId -
|
|
18
|
-
* @returns {Promise<ShipmentDetailsResponse>} - Success response
|
|
19
|
-
* @summary:
|
|
20
|
-
* @description:
|
|
21
|
-
*/
|
|
22
|
-
async getAppOrderShipmentDetails({ orderId } = {}) {
|
|
23
|
-
const { error } = OrderValidator.getAppOrderShipmentDetails().validate(
|
|
24
|
-
{
|
|
25
|
-
orderId,
|
|
26
|
-
},
|
|
27
|
-
{ abortEarly: false, allowUnknown: true }
|
|
28
|
-
);
|
|
29
|
-
if (error) {
|
|
30
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Showing warrnings if extra unknown parameters are found
|
|
34
|
-
const {
|
|
35
|
-
error: warrning,
|
|
36
|
-
} = OrderValidator.getAppOrderShipmentDetails().validate(
|
|
37
|
-
{
|
|
38
|
-
orderId,
|
|
39
|
-
},
|
|
40
|
-
{ abortEarly: false, allowUnknown: false }
|
|
41
|
-
);
|
|
42
|
-
if (warrning) {
|
|
43
|
-
Logger({
|
|
44
|
-
level: "WARN",
|
|
45
|
-
message:
|
|
46
|
-
"Parameter Validation warrnings for getAppOrderShipmentDetails",
|
|
47
|
-
});
|
|
48
|
-
Logger({ level: "WARN", message: warrning });
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const query_params = {};
|
|
52
|
-
query_params["order_id"] = orderId;
|
|
53
|
-
|
|
54
|
-
const response = await PlatformAPIClient.execute(
|
|
55
|
-
this.config,
|
|
56
|
-
"get",
|
|
57
|
-
`/service/platform/orders/v1.0/company/${this.config.companyId}/application/${this.applicationId}/order-details`,
|
|
58
|
-
query_params,
|
|
59
|
-
undefined
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
const {
|
|
63
|
-
error: res_error,
|
|
64
|
-
} = OrderModel.ShipmentDetailsResponse().validate(response, {
|
|
65
|
-
abortEarly: false,
|
|
66
|
-
allowUnknown: false,
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
if (res_error) {
|
|
70
|
-
Logger({
|
|
71
|
-
level: "WARN",
|
|
72
|
-
message: "Response Validation Warnnings for getAppOrderShipmentDetails",
|
|
73
|
-
});
|
|
74
|
-
Logger({ level: "WARN", message: res_error });
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return response;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* @param {Object} arg - Arg object.
|
|
82
|
-
* @param {string} [arg.lane] -
|
|
83
|
-
* @param {string} [arg.searchType] -
|
|
84
|
-
* @param {string} [arg.searchId] -
|
|
85
|
-
* @param {string} [arg.fromDate] -
|
|
86
|
-
* @param {string} [arg.toDate] -
|
|
87
|
-
* @param {string} [arg.dpIds] -
|
|
88
|
-
* @param {string} [arg.orderingCompanyId] -
|
|
89
|
-
* @param {string} [arg.stores] -
|
|
90
|
-
* @param {string} [arg.salesChannel] -
|
|
91
|
-
* @param {string} [arg.requestByExt] -
|
|
92
|
-
* @param {number} [arg.pageNo] -
|
|
93
|
-
* @param {number} [arg.pageSize] -
|
|
94
|
-
* @param {string} [arg.customerId] -
|
|
95
|
-
* @param {boolean} [arg.isPrioritySort] -
|
|
96
|
-
* @returns {Promise<ShipmentInternalPlatformViewResponse>} - Success response
|
|
97
|
-
* @summary:
|
|
98
|
-
* @description:
|
|
99
|
-
*/
|
|
100
|
-
async getApplicationShipments({
|
|
101
|
-
lane,
|
|
102
|
-
searchType,
|
|
103
|
-
searchId,
|
|
104
|
-
fromDate,
|
|
105
|
-
toDate,
|
|
106
|
-
dpIds,
|
|
107
|
-
orderingCompanyId,
|
|
108
|
-
stores,
|
|
109
|
-
salesChannel,
|
|
110
|
-
requestByExt,
|
|
111
|
-
pageNo,
|
|
112
|
-
pageSize,
|
|
113
|
-
customerId,
|
|
114
|
-
isPrioritySort,
|
|
115
|
-
} = {}) {
|
|
116
|
-
const { error } = OrderValidator.getApplicationShipments().validate(
|
|
117
|
-
{
|
|
118
|
-
lane,
|
|
119
|
-
searchType,
|
|
120
|
-
searchId,
|
|
121
|
-
fromDate,
|
|
122
|
-
toDate,
|
|
123
|
-
dpIds,
|
|
124
|
-
orderingCompanyId,
|
|
125
|
-
stores,
|
|
126
|
-
salesChannel,
|
|
127
|
-
requestByExt,
|
|
128
|
-
pageNo,
|
|
129
|
-
pageSize,
|
|
130
|
-
customerId,
|
|
131
|
-
isPrioritySort,
|
|
132
|
-
},
|
|
133
|
-
{ abortEarly: false, allowUnknown: true }
|
|
134
|
-
);
|
|
135
|
-
if (error) {
|
|
136
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// Showing warrnings if extra unknown parameters are found
|
|
140
|
-
const {
|
|
141
|
-
error: warrning,
|
|
142
|
-
} = OrderValidator.getApplicationShipments().validate(
|
|
143
|
-
{
|
|
144
|
-
lane,
|
|
145
|
-
searchType,
|
|
146
|
-
searchId,
|
|
147
|
-
fromDate,
|
|
148
|
-
toDate,
|
|
149
|
-
dpIds,
|
|
150
|
-
orderingCompanyId,
|
|
151
|
-
stores,
|
|
152
|
-
salesChannel,
|
|
153
|
-
requestByExt,
|
|
154
|
-
pageNo,
|
|
155
|
-
pageSize,
|
|
156
|
-
customerId,
|
|
157
|
-
isPrioritySort,
|
|
158
|
-
},
|
|
159
|
-
{ abortEarly: false, allowUnknown: false }
|
|
160
|
-
);
|
|
161
|
-
if (warrning) {
|
|
162
|
-
Logger({
|
|
163
|
-
level: "WARN",
|
|
164
|
-
message: "Parameter Validation warrnings for getApplicationShipments",
|
|
165
|
-
});
|
|
166
|
-
Logger({ level: "WARN", message: warrning });
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
const query_params = {};
|
|
170
|
-
query_params["lane"] = lane;
|
|
171
|
-
query_params["search_type"] = searchType;
|
|
172
|
-
query_params["search_id"] = searchId;
|
|
173
|
-
query_params["from_date"] = fromDate;
|
|
174
|
-
query_params["to_date"] = toDate;
|
|
175
|
-
query_params["dp_ids"] = dpIds;
|
|
176
|
-
query_params["ordering_company_id"] = orderingCompanyId;
|
|
177
|
-
query_params["stores"] = stores;
|
|
178
|
-
query_params["sales_channel"] = salesChannel;
|
|
179
|
-
query_params["request_by_ext"] = requestByExt;
|
|
180
|
-
query_params["page_no"] = pageNo;
|
|
181
|
-
query_params["page_size"] = pageSize;
|
|
182
|
-
query_params["customer_id"] = customerId;
|
|
183
|
-
query_params["is_priority_sort"] = isPrioritySort;
|
|
184
|
-
|
|
185
|
-
const response = await PlatformAPIClient.execute(
|
|
186
|
-
this.config,
|
|
187
|
-
"get",
|
|
188
|
-
`/service/platform/orders/v1.0/company/${this.config.companyId}/application/${this.applicationId}/shipments/`,
|
|
189
|
-
query_params,
|
|
190
|
-
undefined
|
|
191
|
-
);
|
|
192
|
-
|
|
193
|
-
const {
|
|
194
|
-
error: res_error,
|
|
195
|
-
} = OrderModel.ShipmentInternalPlatformViewResponse().validate(response, {
|
|
196
|
-
abortEarly: false,
|
|
197
|
-
allowUnknown: false,
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
if (res_error) {
|
|
201
|
-
Logger({
|
|
202
|
-
level: "WARN",
|
|
203
|
-
message: "Response Validation Warnnings for getApplicationShipments",
|
|
204
|
-
});
|
|
205
|
-
Logger({ level: "WARN", message: res_error });
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
return response;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
15
|
/**
|
|
212
16
|
* @param {Object} arg - Arg object.
|
|
213
17
|
* @param {string} arg.shipmentId -
|
|
@@ -215,8 +19,8 @@ class Order {
|
|
|
215
19
|
* @summary: Track shipment
|
|
216
20
|
* @description: Track Shipment by shipment id, for application based on application Id
|
|
217
21
|
*/
|
|
218
|
-
async
|
|
219
|
-
const { error } = OrderValidator.
|
|
22
|
+
async trackShipmentPlatform({ shipmentId } = {}) {
|
|
23
|
+
const { error } = OrderValidator.trackShipmentPlatform().validate(
|
|
220
24
|
{
|
|
221
25
|
shipmentId,
|
|
222
26
|
},
|
|
@@ -227,7 +31,7 @@ class Order {
|
|
|
227
31
|
}
|
|
228
32
|
|
|
229
33
|
// Showing warrnings if extra unknown parameters are found
|
|
230
|
-
const { error: warrning } = OrderValidator.
|
|
34
|
+
const { error: warrning } = OrderValidator.trackShipmentPlatform().validate(
|
|
231
35
|
{
|
|
232
36
|
shipmentId,
|
|
233
37
|
},
|
|
@@ -236,7 +40,7 @@ class Order {
|
|
|
236
40
|
if (warrning) {
|
|
237
41
|
Logger({
|
|
238
42
|
level: "WARN",
|
|
239
|
-
message: "Parameter Validation warrnings for
|
|
43
|
+
message: "Parameter Validation warrnings for trackShipmentPlatform",
|
|
240
44
|
});
|
|
241
45
|
Logger({ level: "WARN", message: warrning });
|
|
242
46
|
}
|
|
@@ -261,7 +65,7 @@ class Order {
|
|
|
261
65
|
if (res_error) {
|
|
262
66
|
Logger({
|
|
263
67
|
level: "WARN",
|
|
264
|
-
message: "Response Validation Warnnings for
|
|
68
|
+
message: "Response Validation Warnnings for trackShipmentPlatform",
|
|
265
69
|
});
|
|
266
70
|
Logger({ level: "WARN", message: res_error });
|
|
267
71
|
}
|