sahab-utils 1.2.1 → 1.2.3

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.
@@ -146,6 +146,7 @@ export type Order = {
146
146
  };
147
147
  providerPhoneNumber?: string;
148
148
  providerLogoUrl?: string;
149
+ paymentGateway?: 'PAYLINK' | 'CHECKOUT';
149
150
  };
150
151
 
151
152
  // ! DO NOT PLACE ANY FIRESTORE REF IN THIS OBJECT TYPE
@@ -742,5 +743,28 @@ export type PaymentConfigs = {
742
743
  key: string;
743
744
  isActive: boolean;
744
745
  priority: number;
745
- };
746
+ }[];
747
+ };
748
+
749
+ export type Slot = {
750
+ id: string;
751
+ time: number;
752
+ selected: boolean;
753
+ reserved: boolean;
754
+ };
755
+
756
+ export type Statement = {
757
+ numberOfOrders: number;
758
+ completedOrders: number;
759
+ ratedOrders: number;
760
+ cancelledOrders: number;
761
+ cashOrders: number;
762
+ creditOrders: number;
763
+ applePayPayments: number;
764
+ expiredOrders: number;
765
+ confirmedOrders: number;
766
+ lateOrders: number;
767
+ ordersTotal: number;
768
+ orders: Order[];
769
+ statmentDate?: Date | string;
746
770
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sahab-utils",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "This package containts types and utils fuctions",
5
5
  "main": "index.ts",
6
6
  "scripts": {
package/ts/calcs.ts CHANGED
@@ -231,7 +231,7 @@ export function calculateDiscountAmount(order: Order) {
231
231
 
232
232
  if (sahabDiscounts.length) {
233
233
  sahabDiscounts.forEach((discount) => {
234
- if (discount.isPercentage) {
234
+ if (discount?.isPercentage) {
235
235
  discounts += (preventNaN(discount?.amount ?? 0) / 100) * (service?.price?.price ?? 0);
236
236
  } else {
237
237
  discounts += preventNaN(discount?.amount ?? 0);
@@ -253,7 +253,7 @@ export function getServiceTotal(providedService: ProvidedService | ProvidedAddon
253
253
 
254
254
  if (sahabDiscounts.length) {
255
255
  sahabDiscounts.forEach((discount) => {
256
- if (discount.isPercentage) {
256
+ if (discount?.isPercentage) {
257
257
  total -= (preventNaN(discount?.amount ?? 0) / 100) * (providedService?.price?.price ?? 0);
258
258
  } else {
259
259
  total -= preventNaN(discount?.amount ?? 0);