@zohoim/client-sdk 1.0.0-replyAreaPoc9 → 1.0.0-whatsAppPricing.2
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/es/application/services/index.js +3 -1
- package/es/application/services/subscription/SubscriptionService.js +36 -0
- package/es/application/services/subscription/index.js +2 -0
- package/es/application/services/whatsAppPricing/WhatsAppPricingService.js +21 -0
- package/es/application/services/whatsAppPricing/index.js +2 -0
- package/es/core/constants/ModuleNames.js +3 -1
- package/es/core/constants/ModuleTypes.js +5 -0
- package/es/core/constants/index.js +2 -1
- package/es/domain/dto/index.js +3 -1
- package/es/domain/dto/subscription/buyAddOnPackageRequest.js +18 -0
- package/es/domain/dto/subscription/getAddOnPackagesRequest.js +15 -0
- package/es/domain/dto/subscription/getLicenseDetailsRequest.js +7 -0
- package/es/domain/dto/subscription/index.js +5 -0
- package/es/domain/dto/subscription/modifyAddOnPackageRequest.js +18 -0
- package/es/domain/dto/whatsAppPricing/calculatePricingRequest.js +14 -0
- package/es/domain/dto/whatsAppPricing/index.js +2 -0
- package/es/domain/entities/AddOnPackage/AddOnPackage.js +34 -0
- package/es/domain/entities/AddOnPackage/index.js +2 -0
- package/es/domain/entities/LicenseDetails/LicenseDetails.js +23 -0
- package/es/domain/entities/LicenseDetails/index.js +2 -0
- package/es/domain/entities/WhatsAppPricingResult/WhatsAppPricingResult.js +24 -0
- package/es/domain/entities/WhatsAppPricingResult/index.js +2 -0
- package/es/domain/entities/index.js +4 -1
- package/es/domain/enum/index.js +2 -1
- package/es/domain/enum/session/SessionReplyStatus.js +4 -1
- package/es/domain/enum/subscription/AddOnSubscriptionStatus.js +7 -0
- package/es/domain/enum/subscription/index.js +2 -0
- package/es/domain/interfaces/repositories/index.js +3 -1
- package/es/domain/interfaces/repositories/subscription/ISubscriptionRepository.js +35 -0
- package/es/domain/interfaces/repositories/subscription/index.js +2 -0
- package/es/domain/interfaces/repositories/whatsAppPricing/IWhatsAppPricingRepository.js +17 -0
- package/es/domain/interfaces/repositories/whatsAppPricing/index.js +2 -0
- package/es/domain/schema/index.js +3 -1
- package/es/domain/schema/subscription/AddOnPackageSchema.js +33 -0
- package/es/domain/schema/subscription/AddOnSubscriptionSchema.js +29 -0
- package/es/domain/schema/subscription/LicenseDetailsSchema.js +11 -0
- package/es/domain/schema/subscription/index.js +4 -0
- package/es/domain/schema/whatsAppPricing/PricingCategorySchema.js +11 -0
- package/es/domain/schema/whatsAppPricing/WhatsAppPricingResultSchema.js +21 -0
- package/es/domain/schema/whatsAppPricing/index.js +3 -0
- package/es/frameworks/managers/ModuleFactory.js +62 -24
- package/es/frameworks/managers/ModuleManager.js +20 -4
- package/es/frameworks/sdk/IMSDK.js +19 -9
- package/es/frameworks/sdk/subscription/SubscriptionSDK.js +29 -0
- package/es/frameworks/sdk/subscription/index.js +2 -0
- package/es/frameworks/sdk/whatsAppPricing/WhatsAppPricingSDK.js +27 -0
- package/es/frameworks/sdk/whatsAppPricing/index.js +2 -0
- package/es/infrastructure/adapters/index.js +3 -1
- package/es/infrastructure/adapters/subscription/AddOnPackageAdapter.js +25 -0
- package/es/infrastructure/adapters/subscription/LicenseDetailsAdapter.js +20 -0
- package/es/infrastructure/adapters/subscription/index.js +3 -0
- package/es/infrastructure/adapters/whatsAppPricing/WhatsAppPricingResultAdapter.js +22 -0
- package/es/infrastructure/adapters/whatsAppPricing/index.js +2 -0
- package/es/infrastructure/api/BaseAPI.js +2 -2
- package/es/infrastructure/api/index.js +3 -1
- package/es/infrastructure/api/registry/createPublicBaseUrl.js +4 -0
- package/es/infrastructure/api/registry/getRegistryConfig.js +5 -1
- package/es/infrastructure/api/registry/subscription/constructSubscriptionEndPoint.js +10 -0
- package/es/infrastructure/api/registry/subscription/index.js +3 -0
- package/es/infrastructure/api/registry/subscription/subscriptionAPIRegistry.js +28 -0
- package/es/infrastructure/api/registry/whatsAppPricing/constructWhatsAppPricingEndPoint.js +5 -0
- package/es/infrastructure/api/registry/whatsAppPricing/index.js +2 -0
- package/es/infrastructure/api/registry/whatsAppPricing/whatsAppPricingAPIRegistry.js +13 -0
- package/es/infrastructure/api/subscription/SubscriptionAPI.js +44 -0
- package/es/infrastructure/api/subscription/index.js +2 -0
- package/es/infrastructure/api/whatsAppPricing/WhatsAppPricingAPI.js +14 -0
- package/es/infrastructure/api/whatsAppPricing/index.js +2 -0
- package/es/infrastructure/repositories/index.js +3 -1
- package/es/infrastructure/repositories/subscription/SubscriptionRepository.js +82 -0
- package/es/infrastructure/repositories/subscription/index.js +2 -0
- package/es/infrastructure/repositories/whatsAppPricing/WhatsAppPricingRepository.js +50 -0
- package/es/infrastructure/repositories/whatsAppPricing/index.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { ISubscriptionRepository } from '../../../domain/interfaces/repositories';
|
|
2
|
+
import { AddOnPackageAdapter, LicenseDetailsAdapter } from '../../adapters';
|
|
3
|
+
import { SubscriptionAPI } from '../../api';
|
|
4
|
+
import { ResponseTypes } from '../../../core/constants';
|
|
5
|
+
export default class SubscriptionRepository extends ISubscriptionRepository {
|
|
6
|
+
constructor() {
|
|
7
|
+
let {
|
|
8
|
+
subscriptionAPI,
|
|
9
|
+
addOnPackageAdapter,
|
|
10
|
+
licenseDetailsAdapter
|
|
11
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
12
|
+
super();
|
|
13
|
+
this.defaultAPI = new SubscriptionAPI();
|
|
14
|
+
this.customAPI = subscriptionAPI;
|
|
15
|
+
this.subscriptionAPI = this.createAPIProxy(this.customAPI, this.defaultAPI);
|
|
16
|
+
this.addOnPackageAdapter = addOnPackageAdapter || new AddOnPackageAdapter();
|
|
17
|
+
this.licenseDetailsAdapter = licenseDetailsAdapter || new LicenseDetailsAdapter();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async invokeAPI(_ref) {
|
|
21
|
+
let {
|
|
22
|
+
operation,
|
|
23
|
+
request,
|
|
24
|
+
adapter,
|
|
25
|
+
responseType
|
|
26
|
+
} = _ref;
|
|
27
|
+
return this.executeAPICall({
|
|
28
|
+
operation,
|
|
29
|
+
request,
|
|
30
|
+
apiProxy: this.subscriptionAPI,
|
|
31
|
+
customAPI: this.customAPI,
|
|
32
|
+
adapter,
|
|
33
|
+
responseType
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async getAddOnPackages(request) {
|
|
38
|
+
return this.invokeAPI({
|
|
39
|
+
operation: 'getAddOnPackages',
|
|
40
|
+
request,
|
|
41
|
+
adapter: this.addOnPackageAdapter,
|
|
42
|
+
responseType: ResponseTypes.LIST
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async getLicenseDetails(request) {
|
|
47
|
+
return this.invokeAPI({
|
|
48
|
+
operation: 'getLicenseDetails',
|
|
49
|
+
request,
|
|
50
|
+
adapter: this.licenseDetailsAdapter,
|
|
51
|
+
responseType: ResponseTypes.SINGLE
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async buyAddOnPackage(request) {
|
|
56
|
+
return this.invokeAPI({
|
|
57
|
+
operation: 'buyAddOnPackage',
|
|
58
|
+
request,
|
|
59
|
+
adapter: this.addOnPackageAdapter,
|
|
60
|
+
responseType: ResponseTypes.SINGLE
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async modifyAddOnPackage(request) {
|
|
65
|
+
return this.invokeAPI({
|
|
66
|
+
operation: 'modifyAddOnPackage',
|
|
67
|
+
request,
|
|
68
|
+
adapter: this.addOnPackageAdapter,
|
|
69
|
+
responseType: ResponseTypes.SINGLE
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
toJSON() {
|
|
74
|
+
return {
|
|
75
|
+
getAddOnPackages: this.getAddOnPackages.bind(this),
|
|
76
|
+
getLicenseDetails: this.getLicenseDetails.bind(this),
|
|
77
|
+
buyAddOnPackage: this.buyAddOnPackage.bind(this),
|
|
78
|
+
modifyAddOnPackage: this.modifyAddOnPackage.bind(this)
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import IWhatsAppPricingRepository from '../../../domain/interfaces/repositories/whatsAppPricing/IWhatsAppPricingRepository';
|
|
2
|
+
import { WhatsAppPricingResultAdapter } from '../../adapters';
|
|
3
|
+
import { WhatsAppPricingAPI } from '../../api';
|
|
4
|
+
import { ResponseTypes } from '../../../core/constants';
|
|
5
|
+
export default class WhatsAppPricingRepository extends IWhatsAppPricingRepository {
|
|
6
|
+
constructor() {
|
|
7
|
+
let {
|
|
8
|
+
whatsAppPricingAPI,
|
|
9
|
+
whatsAppPricingResultAdapter
|
|
10
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
11
|
+
super();
|
|
12
|
+
this.defaultAPI = new WhatsAppPricingAPI();
|
|
13
|
+
this.customAPI = whatsAppPricingAPI;
|
|
14
|
+
this.whatsAppPricingAPI = this.createAPIProxy(this.customAPI, this.defaultAPI);
|
|
15
|
+
this.whatsAppPricingResultAdapter = whatsAppPricingResultAdapter || new WhatsAppPricingResultAdapter();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async invokeAPI(_ref) {
|
|
19
|
+
let {
|
|
20
|
+
operation,
|
|
21
|
+
request,
|
|
22
|
+
adapter,
|
|
23
|
+
responseType
|
|
24
|
+
} = _ref;
|
|
25
|
+
return this.executeAPICall({
|
|
26
|
+
operation,
|
|
27
|
+
request,
|
|
28
|
+
apiProxy: this.whatsAppPricingAPI,
|
|
29
|
+
customAPI: this.customAPI,
|
|
30
|
+
adapter,
|
|
31
|
+
responseType
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async calculatePricing(request) {
|
|
36
|
+
return this.invokeAPI({
|
|
37
|
+
operation: 'calculatePricing',
|
|
38
|
+
request,
|
|
39
|
+
adapter: this.whatsAppPricingResultAdapter,
|
|
40
|
+
responseType: ResponseTypes.SINGLE
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
toJSON() {
|
|
45
|
+
return {
|
|
46
|
+
calculatePricing: this.calculatePricing.bind(this)
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
}
|