@lyxa.ai/core 1.4.110 → 1.4.112
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/libraries/mongo/models/providers/custom-coupon.model.d.ts +2 -0
- package/dist/libraries/mongo/models/providers/custom-coupon.model.js +6 -0
- package/dist/libraries/mongo/models/providers/custom-coupon.model.js.map +1 -1
- package/dist/libraries/mongo/models/providers/individual-store-coupon.model.d.ts +3 -1
- package/dist/libraries/mongo/models/providers/individual-store-coupon.model.js +6 -0
- package/dist/libraries/mongo/models/providers/individual-store-coupon.model.js.map +1 -1
- package/dist/libraries/mongo/models/providers/individual-user-coupon.model.d.ts +2 -0
- package/dist/libraries/mongo/models/providers/individual-user-coupon.model.js +6 -0
- package/dist/libraries/mongo/models/providers/individual-user-coupon.model.js.map +1 -1
- package/dist/libraries/mongo/models/providers/shops-categories-coupon.model.d.ts +2 -0
- package/dist/libraries/mongo/models/providers/shops-categories-coupon.model.js +6 -0
- package/dist/libraries/mongo/models/providers/shops-categories-coupon.model.js.map +1 -1
- package/dist/types/README.md +1 -1
- package/dist/types/package.json +1 -1
- package/dist/utilities/currency.d.ts +1 -1
- package/dist/utilities/currency.js +3 -3
- package/dist/utilities/currency.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,9 +3,11 @@ import { CouponType, ItemType } from '../../../../utilities/enum';
|
|
|
3
3
|
import { BaseCoupon } from '../base/base-coupon.model';
|
|
4
4
|
import { Shop } from '../shop.model';
|
|
5
5
|
import { User } from '../user.model';
|
|
6
|
+
import { Vendor } from '../vendor.model';
|
|
6
7
|
export declare class CustomCoupon extends BaseCoupon {
|
|
7
8
|
couponType: CouponType.CUSTOM_COUPON;
|
|
8
9
|
influencer: Ref<User>;
|
|
9
10
|
itemTypes?: ItemType[];
|
|
10
11
|
shops?: Ref<Shop>[];
|
|
12
|
+
vendors?: Ref<Vendor>[];
|
|
11
13
|
}
|
|
@@ -15,11 +15,13 @@ const enum_1 = require("../../../../utilities/enum");
|
|
|
15
15
|
const base_coupon_model_1 = require("../base/base-coupon.model");
|
|
16
16
|
const shop_model_1 = require("../shop.model");
|
|
17
17
|
const user_model_1 = require("../user.model");
|
|
18
|
+
const vendor_model_1 = require("../vendor.model");
|
|
18
19
|
class CustomCoupon extends base_coupon_model_1.BaseCoupon {
|
|
19
20
|
couponType = enum_1.CouponType.CUSTOM_COUPON;
|
|
20
21
|
influencer;
|
|
21
22
|
itemTypes;
|
|
22
23
|
shops;
|
|
24
|
+
vendors;
|
|
23
25
|
}
|
|
24
26
|
exports.CustomCoupon = CustomCoupon;
|
|
25
27
|
__decorate([
|
|
@@ -34,4 +36,8 @@ __decorate([
|
|
|
34
36
|
(0, typegoose_1.prop)({ ref: () => shop_model_1.Shop, default: [] }),
|
|
35
37
|
__metadata("design:type", Array)
|
|
36
38
|
], CustomCoupon.prototype, "shops", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, typegoose_1.prop)({ ref: () => vendor_model_1.Vendor, default: [] }),
|
|
41
|
+
__metadata("design:type", Array)
|
|
42
|
+
], CustomCoupon.prototype, "vendors", void 0);
|
|
37
43
|
//# sourceMappingURL=custom-coupon.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-coupon.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/custom-coupon.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,qDAAkE;AAClE,iEAAuD;AACvD,8CAAqC;AACrC,8CAAqC;
|
|
1
|
+
{"version":3,"file":"custom-coupon.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/custom-coupon.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,qDAAkE;AAClE,iEAAuD;AACvD,8CAAqC;AACrC,8CAAqC;AACrC,kDAAyC;AAEzC,MAAa,YAAa,SAAQ,8BAAU;IACpC,UAAU,GAAG,iBAAU,CAAC,aAAsB,CAAC;IAG/C,UAAU,CAAa;IAGvB,SAAS,CAAc;IAGvB,KAAK,CAAe;IAGpB,OAAO,CAAiB;CAC/B;AAdD,oCAcC;AAVO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;gDACZ;AAGvB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,eAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;+CACxB;AAGvB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;2CACZ;AAGpB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,qBAAM,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;6CACV","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { CouponType, ItemType } from '../../../../utilities/enum';\nimport { BaseCoupon } from '../base/base-coupon.model';\nimport { Shop } from '../shop.model';\nimport { User } from '../user.model';\nimport { Vendor } from '../vendor.model';\n\nexport class CustomCoupon extends BaseCoupon {\n\tpublic couponType = CouponType.CUSTOM_COUPON as const;\n\n\t@prop({ required: true, ref: () => User })\n\tpublic influencer!: Ref<User>;\n\n\t@prop({ type: [String], enum: ItemType, default: [] })\n\tpublic itemTypes?: ItemType[];\n\n\t@prop({ ref: () => Shop, default: [] })\n\tpublic shops?: Ref<Shop>[];\n\n\t@prop({ ref: () => Vendor, default: [] })\n\tpublic vendors?: Ref<Vendor>[];\n}\n"]}
|
|
@@ -2,9 +2,11 @@ import { Ref } from '@typegoose/typegoose';
|
|
|
2
2
|
import { CouponType } from '../../../../utilities/enum';
|
|
3
3
|
import { Shop } from '../shop.model';
|
|
4
4
|
import { BaseCoupon } from '../base/base-coupon.model';
|
|
5
|
+
import { Vendor } from '../vendor.model';
|
|
5
6
|
export declare class IndividualStoreCoupon extends BaseCoupon {
|
|
6
7
|
couponType: CouponType.INDIVIDUAL_STORE;
|
|
7
|
-
shop
|
|
8
|
+
shop?: Ref<Shop>;
|
|
9
|
+
vendor?: Ref<Vendor>;
|
|
8
10
|
isShopCoverExpenses?: boolean;
|
|
9
11
|
firstOrderOnly?: boolean;
|
|
10
12
|
}
|
|
@@ -14,9 +14,11 @@ const typegoose_1 = require("@typegoose/typegoose");
|
|
|
14
14
|
const enum_1 = require("../../../../utilities/enum");
|
|
15
15
|
const shop_model_1 = require("../shop.model");
|
|
16
16
|
const base_coupon_model_1 = require("../base/base-coupon.model");
|
|
17
|
+
const vendor_model_1 = require("../vendor.model");
|
|
17
18
|
class IndividualStoreCoupon extends base_coupon_model_1.BaseCoupon {
|
|
18
19
|
couponType = enum_1.CouponType.INDIVIDUAL_STORE;
|
|
19
20
|
shop;
|
|
21
|
+
vendor;
|
|
20
22
|
isShopCoverExpenses;
|
|
21
23
|
firstOrderOnly;
|
|
22
24
|
}
|
|
@@ -25,6 +27,10 @@ __decorate([
|
|
|
25
27
|
(0, typegoose_1.prop)({ ref: () => shop_model_1.Shop }),
|
|
26
28
|
__metadata("design:type", Object)
|
|
27
29
|
], IndividualStoreCoupon.prototype, "shop", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, typegoose_1.prop)({ ref: () => vendor_model_1.Vendor }),
|
|
32
|
+
__metadata("design:type", Object)
|
|
33
|
+
], IndividualStoreCoupon.prototype, "vendor", void 0);
|
|
28
34
|
__decorate([
|
|
29
35
|
(0, typegoose_1.prop)({ type: Boolean, default: true }),
|
|
30
36
|
__metadata("design:type", Boolean)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"individual-store-coupon.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/individual-store-coupon.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,qDAAkE;AAClE,8CAAqC;AACrC,iEAAuD;
|
|
1
|
+
{"version":3,"file":"individual-store-coupon.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/individual-store-coupon.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,qDAAkE;AAClE,8CAAqC;AACrC,iEAAuD;AACvD,kDAAyC;AAEzC,MAAa,qBAAsB,SAAQ,8BAAU;IAC7C,UAAU,GAAG,iBAAU,CAAC,gBAAyB,CAAC;IAGlD,IAAI,CAAa;IAGjB,MAAM,CAAe;IAGrB,mBAAmB,CAAW;IAG9B,cAAc,CAAW;CAChC;AAdD,sDAcC;AAVO;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;mDACF;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,qBAAM,EAAE,CAAC;;qDACA;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;kEACF;AAG9B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;6DACR","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { CouponType, ItemType } from '../../../../utilities/enum';\nimport { Shop } from '../shop.model';\nimport { BaseCoupon } from '../base/base-coupon.model';\nimport { Vendor } from '../vendor.model';\n\nexport class IndividualStoreCoupon extends BaseCoupon {\n\tpublic couponType = CouponType.INDIVIDUAL_STORE as const;\n\n\t@prop({ ref: () => Shop })\n\tpublic shop?: Ref<Shop>;\n\n\t@prop({ ref: () => Vendor })\n\tpublic vendor?: Ref<Vendor>;\n\n\t@prop({ type: Boolean, default: true })\n\tpublic isShopCoverExpenses?: boolean;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic firstOrderOnly?: boolean;\n}\n"]}
|
|
@@ -3,9 +3,11 @@ import { CouponType, ItemType } from '../../../../utilities/enum';
|
|
|
3
3
|
import { BaseCoupon } from '../base/base-coupon.model';
|
|
4
4
|
import { Shop } from '../shop.model';
|
|
5
5
|
import { User } from '../user.model';
|
|
6
|
+
import { Vendor } from '../vendor.model';
|
|
6
7
|
export declare class IndividualUserCoupon extends BaseCoupon {
|
|
7
8
|
couponType: CouponType.INDIVIDUAL_USER;
|
|
8
9
|
users: Ref<User>[];
|
|
9
10
|
itemTypes?: ItemType[];
|
|
10
11
|
shops?: Ref<Shop>[];
|
|
12
|
+
vendors?: Ref<Vendor>[];
|
|
11
13
|
}
|
|
@@ -15,11 +15,13 @@ const enum_1 = require("../../../../utilities/enum");
|
|
|
15
15
|
const base_coupon_model_1 = require("../base/base-coupon.model");
|
|
16
16
|
const shop_model_1 = require("../shop.model");
|
|
17
17
|
const user_model_1 = require("../user.model");
|
|
18
|
+
const vendor_model_1 = require("../vendor.model");
|
|
18
19
|
class IndividualUserCoupon extends base_coupon_model_1.BaseCoupon {
|
|
19
20
|
couponType = enum_1.CouponType.INDIVIDUAL_USER;
|
|
20
21
|
users;
|
|
21
22
|
itemTypes;
|
|
22
23
|
shops;
|
|
24
|
+
vendors;
|
|
23
25
|
}
|
|
24
26
|
exports.IndividualUserCoupon = IndividualUserCoupon;
|
|
25
27
|
__decorate([
|
|
@@ -34,4 +36,8 @@ __decorate([
|
|
|
34
36
|
(0, typegoose_1.prop)({ ref: () => shop_model_1.Shop, default: [] }),
|
|
35
37
|
__metadata("design:type", Array)
|
|
36
38
|
], IndividualUserCoupon.prototype, "shops", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, typegoose_1.prop)({ ref: () => vendor_model_1.Vendor, default: [] }),
|
|
41
|
+
__metadata("design:type", Array)
|
|
42
|
+
], IndividualUserCoupon.prototype, "vendors", void 0);
|
|
37
43
|
//# sourceMappingURL=individual-user-coupon.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"individual-user-coupon.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/individual-user-coupon.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,qDAAkE;AAClE,iEAAuD;AACvD,8CAAqC;AACrC,8CAAqC;
|
|
1
|
+
{"version":3,"file":"individual-user-coupon.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/individual-user-coupon.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,qDAAkE;AAClE,iEAAuD;AACvD,8CAAqC;AACrC,8CAAqC;AACrC,kDAAyC;AAEzC,MAAa,oBAAqB,SAAQ,8BAAU;IAC5C,UAAU,GAAG,iBAAU,CAAC,eAAwB,CAAC;IAGjD,KAAK,CAAe;IAGpB,SAAS,CAAc;IAGvB,KAAK,CAAe;IAGpB,OAAO,CAAiB;CAC/B;AAdD,oDAcC;AAVO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;mDACf;AAGpB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,eAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;uDACxB;AAGvB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;mDACZ;AAGpB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,qBAAM,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;qDACV","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { CouponType, ItemType } from '../../../../utilities/enum';\nimport { BaseCoupon } from '../base/base-coupon.model';\nimport { Shop } from '../shop.model';\nimport { User } from '../user.model';\nimport { Vendor } from '../vendor.model';\n\nexport class IndividualUserCoupon extends BaseCoupon {\n\tpublic couponType = CouponType.INDIVIDUAL_USER as const;\n\n\t@prop({ required: true, ref: () => User })\n\tpublic users!: Ref<User>[];\n\n\t@prop({ type: [String], enum: ItemType, default: [] })\n\tpublic itemTypes?: ItemType[];\n\n\t@prop({ ref: () => Shop, default: [] })\n\tpublic shops?: Ref<Shop>[];\n\n\t@prop({ ref: () => Vendor, default: [] })\n\tpublic vendors?: Ref<Vendor>[];\n}\n"]}
|
|
@@ -2,10 +2,12 @@ import { Ref } from '@typegoose/typegoose';
|
|
|
2
2
|
import { CouponType, ItemType } from '../../../../utilities/enum';
|
|
3
3
|
import { Shop } from '../shop.model';
|
|
4
4
|
import { BaseCoupon } from '../base/base-coupon.model';
|
|
5
|
+
import { Vendor } from '../vendor.model';
|
|
5
6
|
export declare class ShopsCategoriesCoupon extends BaseCoupon {
|
|
6
7
|
couponType: CouponType.SHOPS_CATEGORIES;
|
|
7
8
|
itemTypes?: ItemType[];
|
|
8
9
|
shops?: Ref<Shop>[];
|
|
10
|
+
vendors?: Ref<Vendor>[];
|
|
9
11
|
isShopCoverExpenses?: boolean;
|
|
10
12
|
firstOrderOnly?: boolean;
|
|
11
13
|
}
|
|
@@ -14,10 +14,12 @@ const typegoose_1 = require("@typegoose/typegoose");
|
|
|
14
14
|
const enum_1 = require("../../../../utilities/enum");
|
|
15
15
|
const shop_model_1 = require("../shop.model");
|
|
16
16
|
const base_coupon_model_1 = require("../base/base-coupon.model");
|
|
17
|
+
const vendor_model_1 = require("../vendor.model");
|
|
17
18
|
class ShopsCategoriesCoupon extends base_coupon_model_1.BaseCoupon {
|
|
18
19
|
couponType = enum_1.CouponType.SHOPS_CATEGORIES;
|
|
19
20
|
itemTypes;
|
|
20
21
|
shops;
|
|
22
|
+
vendors;
|
|
21
23
|
isShopCoverExpenses;
|
|
22
24
|
firstOrderOnly;
|
|
23
25
|
}
|
|
@@ -30,6 +32,10 @@ __decorate([
|
|
|
30
32
|
(0, typegoose_1.prop)({ ref: () => shop_model_1.Shop }),
|
|
31
33
|
__metadata("design:type", Array)
|
|
32
34
|
], ShopsCategoriesCoupon.prototype, "shops", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, typegoose_1.prop)({ ref: () => vendor_model_1.Vendor, default: [] }),
|
|
37
|
+
__metadata("design:type", Array)
|
|
38
|
+
], ShopsCategoriesCoupon.prototype, "vendors", void 0);
|
|
33
39
|
__decorate([
|
|
34
40
|
(0, typegoose_1.prop)({ type: Boolean, default: false }),
|
|
35
41
|
__metadata("design:type", Boolean)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shops-categories-coupon.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/shops-categories-coupon.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,qDAAkE;AAClE,8CAAqC;AACrC,iEAAuD;
|
|
1
|
+
{"version":3,"file":"shops-categories-coupon.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/shops-categories-coupon.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,qDAAkE;AAClE,8CAAqC;AACrC,iEAAuD;AACvD,kDAAyC;AAEzC,MAAa,qBAAsB,SAAQ,8BAAU;IAC7C,UAAU,GAAG,iBAAU,CAAC,gBAAyB,CAAC;IAGlD,SAAS,CAAc;IAGvB,KAAK,CAAe;IAGpB,OAAO,CAAiB;IAGxB,mBAAmB,CAAW;IAG9B,cAAc,CAAW;CAChC;AAjBD,sDAiBC;AAbO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,eAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;wDACxB;AAGvB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;oDACC;AAGpB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,qBAAM,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;sDACV;AAGxB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;kEACH;AAG9B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;6DACR","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { CouponType, ItemType } from '../../../../utilities/enum';\nimport { Shop } from '../shop.model';\nimport { BaseCoupon } from '../base/base-coupon.model';\nimport { Vendor } from '../vendor.model';\n\nexport class ShopsCategoriesCoupon extends BaseCoupon {\n\tpublic couponType = CouponType.SHOPS_CATEGORIES as const;\n\n\t@prop({ type: [String], enum: ItemType, default: [] })\n\tpublic itemTypes?: ItemType[];\n\n\t@prop({ ref: () => Shop })\n\tpublic shops?: Ref<Shop>[];\n\n\t@prop({ ref: () => Vendor, default: [] })\n\tpublic vendors?: Ref<Vendor>[];\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isShopCoverExpenses?: boolean;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic firstOrderOnly?: boolean;\n}\n"]}
|
package/dist/types/README.md
CHANGED
package/dist/types/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const getExchangeRate: () => Promise<number>;
|
|
2
2
|
export declare const convertToBase: (amount: number) => Promise<number>;
|
|
3
3
|
export declare const convertToSecondary: (amount: number) => Promise<number>;
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const convertToSecondaryWithExchangeRate: (amount: number, exchangeRate: number) => number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.convertToSecondaryWithExchangeRate = exports.convertToSecondary = exports.convertToBase = exports.getExchangeRate = void 0;
|
|
4
4
|
const __1 = require("..");
|
|
5
5
|
const shared_1 = require("./shared");
|
|
6
6
|
const DEFAULT_EXCHANGE_RATE = 0;
|
|
@@ -26,11 +26,11 @@ const convertToSecondary = async (amount) => {
|
|
|
26
26
|
return (0, shared_1.roundSecondaryCurrency)(amount * exchangeRate);
|
|
27
27
|
};
|
|
28
28
|
exports.convertToSecondary = convertToSecondary;
|
|
29
|
-
const
|
|
29
|
+
const convertToSecondaryWithExchangeRate = (amount, exchangeRate) => {
|
|
30
30
|
if (typeof amount !== 'number' || isNaN(amount)) {
|
|
31
31
|
return 0;
|
|
32
32
|
}
|
|
33
33
|
return (0, shared_1.roundSecondaryCurrency)(amount * exchangeRate);
|
|
34
34
|
};
|
|
35
|
-
exports.
|
|
35
|
+
exports.convertToSecondaryWithExchangeRate = convertToSecondaryWithExchangeRate;
|
|
36
36
|
//# sourceMappingURL=currency.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"currency.js","sourceRoot":"/","sources":["utilities/currency.ts"],"names":[],"mappings":";;;AAAA,0BAAkC;AAElC,qCAAqE;AAErE,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEzB,MAAM,eAAe,GAAG,KAAK,IAAqB,EAAE;IAC1D,MAAM,QAAQ,GAAG,CAAC,MAAM,IAAA,gBAAY,GAAE,CAAC,wBAAwB,EAAE,CAAC,WAAW,EAAE,CAAY,CAAC;IAC5F,MAAM,eAAe,GAAG,QAAQ,CAAC,eAAe,CAAC;IACjD,OAAO,eAAe,EAAE,YAAY,IAAI,qBAAqB,CAAC;AAC/D,CAAC,CAAC;AAJW,QAAA,eAAe,mBAI1B;AAEK,MAAM,aAAa,GAAG,KAAK,EAAE,MAAc,EAAmB,EAAE;IACtE,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QACjD,OAAO,CAAC,CAAC;IACV,CAAC;IAED,MAAM,YAAY,GAAG,MAAM,IAAA,uBAAe,GAAE,CAAC;IAC7C,OAAO,IAAA,0BAAiB,EAAC,MAAM,GAAG,YAAY,CAAC,CAAC;AACjD,CAAC,CAAC;AAPW,QAAA,aAAa,iBAOxB;AAEK,MAAM,kBAAkB,GAAG,KAAK,EAAE,MAAc,EAAmB,EAAE;IAC3E,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QACjD,OAAO,CAAC,CAAC;IACV,CAAC;IAED,MAAM,YAAY,GAAG,MAAM,IAAA,uBAAe,GAAE,CAAC;IAC7C,OAAO,IAAA,+BAAsB,EAAC,MAAM,GAAG,YAAY,CAAC,CAAC;AACtD,CAAC,CAAC;AAPW,QAAA,kBAAkB,sBAO7B;AAEK,MAAM,
|
|
1
|
+
{"version":3,"file":"currency.js","sourceRoot":"/","sources":["utilities/currency.ts"],"names":[],"mappings":";;;AAAA,0BAAkC;AAElC,qCAAqE;AAErE,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEzB,MAAM,eAAe,GAAG,KAAK,IAAqB,EAAE;IAC1D,MAAM,QAAQ,GAAG,CAAC,MAAM,IAAA,gBAAY,GAAE,CAAC,wBAAwB,EAAE,CAAC,WAAW,EAAE,CAAY,CAAC;IAC5F,MAAM,eAAe,GAAG,QAAQ,CAAC,eAAe,CAAC;IACjD,OAAO,eAAe,EAAE,YAAY,IAAI,qBAAqB,CAAC;AAC/D,CAAC,CAAC;AAJW,QAAA,eAAe,mBAI1B;AAEK,MAAM,aAAa,GAAG,KAAK,EAAE,MAAc,EAAmB,EAAE;IACtE,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QACjD,OAAO,CAAC,CAAC;IACV,CAAC;IAED,MAAM,YAAY,GAAG,MAAM,IAAA,uBAAe,GAAE,CAAC;IAC7C,OAAO,IAAA,0BAAiB,EAAC,MAAM,GAAG,YAAY,CAAC,CAAC;AACjD,CAAC,CAAC;AAPW,QAAA,aAAa,iBAOxB;AAEK,MAAM,kBAAkB,GAAG,KAAK,EAAE,MAAc,EAAmB,EAAE;IAC3E,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QACjD,OAAO,CAAC,CAAC;IACV,CAAC;IAED,MAAM,YAAY,GAAG,MAAM,IAAA,uBAAe,GAAE,CAAC;IAC7C,OAAO,IAAA,+BAAsB,EAAC,MAAM,GAAG,YAAY,CAAC,CAAC;AACtD,CAAC,CAAC;AAPW,QAAA,kBAAkB,sBAO7B;AAEK,MAAM,kCAAkC,GAAG,CAAC,MAAc,EAAE,YAAoB,EAAU,EAAE;IAClG,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QACjD,OAAO,CAAC,CAAC;IACV,CAAC;IAED,OAAO,IAAA,+BAAsB,EAAC,MAAM,GAAG,YAAY,CAAC,CAAC;AACtD,CAAC,CAAC;AANW,QAAA,kCAAkC,sCAM7C","sourcesContent":["import { getLibraries } from '..';\nimport { Setting } from '../libraries/mongo/models';\nimport { roundBaseCurrency, roundSecondaryCurrency } from './shared';\n\nconst DEFAULT_EXCHANGE_RATE = 0;\n\nexport const getExchangeRate = async (): Promise<number> => {\n\tconst settings = (await getLibraries().getCachedSettingsService().getSettings()) as Setting;\n\tconst currencySetting = settings.currencySetting;\n\treturn currencySetting?.exchangeRate || DEFAULT_EXCHANGE_RATE;\n};\n\nexport const convertToBase = async (amount: number): Promise<number> => {\n\tif (typeof amount !== 'number' || isNaN(amount)) {\n\t\treturn 0;\n\t}\n\n\tconst exchangeRate = await getExchangeRate();\n\treturn roundBaseCurrency(amount / exchangeRate);\n};\n\nexport const convertToSecondary = async (amount: number): Promise<number> => {\n\tif (typeof amount !== 'number' || isNaN(amount)) {\n\t\treturn 0;\n\t}\n\n\tconst exchangeRate = await getExchangeRate();\n\treturn roundSecondaryCurrency(amount * exchangeRate);\n};\n\nexport const convertToSecondaryWithExchangeRate = (amount: number, exchangeRate: number): number => {\n\tif (typeof amount !== 'number' || isNaN(amount)) {\n\t\treturn 0;\n\t}\n\n\treturn roundSecondaryCurrency(amount * exchangeRate);\n};"]}
|