rerobe-js-orm 2.7.20 → 2.7.22

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.
@@ -1,6 +1,7 @@
1
1
  export default class ReRobeProductHelpers {
2
2
  static calculateProductionFee(commission: number): number;
3
3
  static calculateFulfillmentFee(commission: number): number;
4
+ static commissionFixer(commisssion: any): string;
4
5
  static buildReRobeEarnings(arrayLike: CompleteProduct | CompleteProduct[]): number[];
5
6
  static materialCompJoinedString(materialComposition?: MaterialComposition): string;
6
7
  static measurementsJoinedString(measurementsObj?: Measurements): string;
@@ -20,6 +20,19 @@ class ReRobeProductHelpers {
20
20
  }
21
21
  return 0;
22
22
  }
23
+ static commissionFixer(commisssion) {
24
+ let fix = String(commisssion);
25
+ if (fix.includes(',')) {
26
+ fix = fix.replace(',', '.');
27
+ }
28
+ if (Number.isNaN(Number(fix)) || !fix) {
29
+ return '0.5';
30
+ }
31
+ while (!(Math.abs(Number(fix)) * 100 >= 0 && Math.abs(Number(fix)) * 100 <= 100)) {
32
+ fix = String(Math.abs(Number(fix)) / 10);
33
+ }
34
+ return String(Math.abs(Number(fix)));
35
+ }
23
36
  static buildReRobeEarnings(arrayLike) {
24
37
  const products = Array.isArray(arrayLike) ? arrayLike : [arrayLike];
25
38
  return products.reduce((acc, cur) => {
@@ -78,12 +78,12 @@ class SellerLedgerTransaction extends Base_1.default {
78
78
  {
79
79
  facet: true,
80
80
  name: 'amount',
81
- type: 'number',
81
+ type: 'float',
82
82
  },
83
83
  {
84
84
  facet: true,
85
85
  name: 'balance',
86
- type: 'number',
86
+ type: 'float',
87
87
  },
88
88
  {
89
89
  facet: true,
@@ -143,7 +143,7 @@ class SellerLedgerTransaction extends Base_1.default {
143
143
  {
144
144
  facet: true,
145
145
  name: 'productCommission',
146
- type: 'number',
146
+ type: 'float',
147
147
  },
148
148
  ],
149
149
  name: 'dev_sellerLedgerTransactions_20221026',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "2.7.20",
3
+ "version": "2.7.22",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",