turf-common 1.3.1-beta.8 → 1.3.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/build/interface/api/get-collection.interface.d.ts +1 -4
- package/build/jest.config.d.ts +3 -0
- package/build/jest.config.js +10 -0
- package/build/src/@enums/socket-io.d.ts +1 -0
- package/build/src/@enums/socket-io.js +17 -0
- package/build/src/@types/socket-io.d.ts +1 -0
- package/build/src/@types/socket-io.js +17 -0
- package/build/src/enums/availability-view.enum.d.ts +4 -0
- package/build/src/enums/availability-view.enum.js +8 -0
- package/build/src/enums/booking-details-status.enum.d.ts +4 -0
- package/build/src/enums/booking-details-status.enum.js +8 -0
- package/build/src/enums/booking-fetch-filter.enum.d.ts +5 -0
- package/build/src/enums/booking-fetch-filter.enum.js +9 -0
- package/build/src/enums/booking-history-operation-type.enum.d.ts +12 -0
- package/build/src/enums/booking-history-operation-type.enum.js +20 -0
- package/build/src/enums/bookings-status.enum.d.ts +5 -0
- package/build/src/enums/bookings-status.enum.js +9 -0
- package/build/src/enums/configuration-description.enum.d.ts +5 -0
- package/build/src/enums/configuration-description.enum.js +9 -0
- package/build/src/enums/configuration-key.enum.d.ts +10 -0
- package/build/src/enums/configuration-key.enum.js +29 -0
- package/build/src/enums/configuration-text.enum.d.ts +5 -0
- package/build/src/enums/configuration-text.enum.js +9 -0
- package/build/src/enums/cron-jobs-name.enum.d.ts +5 -0
- package/build/src/enums/cron-jobs-name.enum.js +9 -0
- package/build/src/enums/cron-jobs-status.enum.d.ts +5 -0
- package/build/src/enums/cron-jobs-status.enum.js +9 -0
- package/build/src/enums/environment.enum.d.ts +5 -0
- package/build/src/enums/environment.enum.js +9 -0
- package/build/src/enums/faqs-status.enum.d.ts +3 -0
- package/build/src/enums/faqs-status.enum.js +7 -0
- package/build/src/enums/modification-discount-policy.enum.d.ts +5 -0
- package/build/src/enums/modification-discount-policy.enum.js +9 -0
- package/build/src/enums/organization-status.enum.d.ts +15 -0
- package/build/src/enums/organization-status.enum.js +31 -0
- package/build/src/enums/organization-type.enum.d.ts +5 -0
- package/build/src/enums/organization-type.enum.js +9 -0
- package/build/src/enums/payment-mode.enum.d.ts +4 -0
- package/build/src/enums/payment-mode.enum.js +8 -0
- package/build/src/enums/pitch-operation.enum.d.ts +5 -0
- package/build/src/enums/pitch-operation.enum.js +9 -0
- package/build/src/enums/pitch-sports.enum.d.ts +7 -0
- package/build/src/enums/pitch-sports.enum.js +11 -0
- package/build/src/enums/pitch-status.enum.d.ts +12 -0
- package/build/src/enums/pitch-status.enum.js +13 -0
- package/build/src/enums/pricing-plan-status.enum.d.ts +4 -0
- package/build/src/enums/pricing-plan-status.enum.js +8 -0
- package/build/src/enums/registration-status-enum.d.ts +12 -0
- package/build/src/enums/registration-status-enum.js +16 -0
- package/build/src/enums/socket-io-booking-operation.enum.d.ts +6 -0
- package/build/src/enums/socket-io-booking-operation.enum.js +10 -0
- package/build/src/enums/subscription-status.enum.d.ts +23 -0
- package/build/src/enums/subscription-status.enum.js +40 -0
- package/build/src/enums/timezone.enum.d.ts +3 -0
- package/build/src/enums/timezone.enum.js +7 -0
- package/build/src/enums/transaction-type.enum.d.ts +7 -0
- package/build/src/enums/transaction-type.enum.js +11 -0
- package/build/src/enums/user-status.enum.d.ts +11 -0
- package/build/src/enums/user-status.enum.js +15 -0
- package/build/src/enums/valid-coupon-type.enum.d.ts +6 -0
- package/build/src/enums/valid-coupon-type.enum.js +10 -0
- package/build/src/enums/valid-type.enum.d.ts +6 -0
- package/build/src/enums/valid-type.enum.js +10 -0
- package/build/src/exceptions/app-badrequest.exception.d.ts +4 -0
- package/build/src/exceptions/app-badrequest.exception.js +28 -0
- package/build/src/interface/api/activate-subscription.interface.d.ts +10 -0
- package/build/src/interface/api/activate-subscription.interface.js +2 -0
- package/build/src/interface/api/booking-availablity-by-pitch.interface.d.ts +39 -0
- package/build/src/interface/api/booking-availablity-by-pitch.interface.js +2 -0
- package/build/src/interface/api/cancellation-charges.interface.d.ts +17 -0
- package/build/src/interface/api/cancellation-charges.interface.js +2 -0
- package/build/src/interface/api/create-bank-details.interface.d.ts +22 -0
- package/build/src/interface/api/create-bank-details.interface.js +2 -0
- package/build/src/interface/api/create-cancellation-policy.interface.d.ts +12 -0
- package/build/src/interface/api/create-cancellation-policy.interface.js +2 -0
- package/build/src/interface/api/create-coupon.interface.d.ts +11 -0
- package/build/src/interface/api/create-coupon.interface.js +2 -0
- package/build/src/interface/api/create-faqs.interface.d.ts +15 -0
- package/build/src/interface/api/create-faqs.interface.js +2 -0
- package/build/src/interface/api/create-organization.interface.d.ts +21 -0
- package/build/src/interface/api/create-organization.interface.js +2 -0
- package/build/src/interface/api/create-pricing-plan.interface.d.ts +16 -0
- package/build/src/interface/api/create-pricing-plan.interface.js +2 -0
- package/build/src/interface/api/create-recurring-slot-booking.interface.d.ts +29 -0
- package/build/src/interface/api/create-recurring-slot-booking.interface.js +2 -0
- package/build/src/interface/api/create-registration-interface.d.ts +13 -0
- package/build/src/interface/api/create-registration-interface.js +2 -0
- package/build/src/interface/api/create-registration-transaction-output.interface.d.ts +2 -0
- package/build/src/interface/api/create-registration-transaction-output.interface.js +2 -0
- package/build/src/interface/api/create-subscription.interface.d.ts +18 -0
- package/build/src/interface/api/create-subscription.interface.js +2 -0
- package/build/src/interface/api/create-turf.interface.d.ts +13 -0
- package/build/src/interface/api/create-turf.interface.js +2 -0
- package/build/src/interface/api/create-user.interface.d.ts +10 -0
- package/build/src/interface/api/create-user.interface.js +2 -0
- package/build/src/interface/api/delete-bank-details-by-id.interface.d.ts +6 -0
- package/build/src/interface/api/delete-bank-details-by-id.interface.js +2 -0
- package/build/src/interface/api/delete-booking-by-codes.interface.d.ts +7 -0
- package/build/src/interface/api/delete-booking-by-codes.interface.js +2 -0
- package/build/src/interface/api/delete-booking-info.interface.d.ts +3 -0
- package/build/src/interface/api/delete-booking-info.interface.js +2 -0
- package/build/src/interface/api/delete-pricing-plan.interface.d.ts +6 -0
- package/build/src/interface/api/delete-pricing-plan.interface.js +2 -0
- package/build/src/interface/api/get-all-booking-of-turf.interface.d.ts +23 -0
- package/build/src/interface/api/get-all-booking-of-turf.interface.js +2 -0
- package/build/src/interface/api/get-availability-by-turf.interface.d.ts +29 -0
- package/build/src/interface/api/get-availability-by-turf.interface.js +2 -0
- package/build/src/interface/api/get-bank-detail-by-id.interface.d.ts +6 -0
- package/build/src/interface/api/get-bank-detail-by-id.interface.js +2 -0
- package/build/src/interface/api/get-bank-detail-entities.interface.d.ts +6 -0
- package/build/src/interface/api/get-bank-detail-entities.interface.js +2 -0
- package/build/src/interface/api/get-booking-by-organization-id.interface.d.ts +30 -0
- package/build/src/interface/api/get-booking-by-organization-id.interface.js +2 -0
- package/build/src/interface/api/get-booking-customers.interface.d.ts +3 -0
- package/build/src/interface/api/get-booking-customers.interface.js +2 -0
- package/build/src/interface/api/get-booking-details-by-id.interface.d.ts +4 -0
- package/build/src/interface/api/get-booking-details-by-id.interface.js +2 -0
- package/build/src/interface/api/get-booking-history.interface.d.ts +4 -0
- package/build/src/interface/api/get-booking-history.interface.js +2 -0
- package/build/src/interface/api/get-booking-info.interface.d.ts +11 -0
- package/build/src/interface/api/get-booking-info.interface.js +2 -0
- package/build/src/interface/api/get-cancellation-policy-entity-by-org-id.interface.d.ts +15 -0
- package/build/src/interface/api/get-cancellation-policy-entity-by-org-id.interface.js +2 -0
- package/build/src/interface/api/get-cancelled-booking.interface.d.ts +7 -0
- package/build/src/interface/api/get-cancelled-booking.interface.js +2 -0
- package/build/src/interface/api/get-collection.interface.d.ts +24 -0
- package/build/src/interface/api/get-collection.interface.js +2 -0
- package/build/src/interface/api/get-configuration.interface.d.ts +4 -0
- package/build/src/interface/api/get-configuration.interface.js +2 -0
- package/build/src/interface/api/get-cron-job-by-date-range-name-status.interface.d.ts +12 -0
- package/build/src/interface/api/get-cron-job-by-date-range-name-status.interface.js +2 -0
- package/build/src/interface/api/get-current-subscription.interface.d.ts +18 -0
- package/build/src/interface/api/get-current-subscription.interface.js +2 -0
- package/build/src/interface/api/get-organization-by-orgid.interface.d.ts +15 -0
- package/build/src/interface/api/get-organization-by-orgid.interface.js +2 -0
- package/build/src/interface/api/get-price-by-organization-response.interface.d.ts +6 -0
- package/build/src/interface/api/get-price-by-organization-response.interface.js +2 -0
- package/build/src/interface/api/get-price-entity.interface.d.ts +10 -0
- package/build/src/interface/api/get-price-entity.interface.js +2 -0
- package/build/src/interface/api/get-price-query.interface.d.ts +10 -0
- package/build/src/interface/api/get-price-query.interface.js +2 -0
- package/build/src/interface/api/get-pricing-plan-by-date-response.interface.d.ts +23 -0
- package/build/src/interface/api/get-pricing-plan-by-date-response.interface.js +2 -0
- package/build/src/interface/api/get-pricing-plan-by-id.interface.d.ts +3 -0
- package/build/src/interface/api/get-pricing-plan-by-id.interface.js +2 -0
- package/build/src/interface/api/get-pricing-plan-entities.interface.d.ts +3 -0
- package/build/src/interface/api/get-pricing-plan-entities.interface.js +2 -0
- package/build/src/interface/api/get-registration-by-id.types.d.ts +20 -0
- package/build/src/interface/api/get-registration-by-id.types.js +2 -0
- package/build/src/interface/api/get-registration-entities.interface.d.ts +30 -0
- package/build/src/interface/api/get-registration-entities.interface.js +2 -0
- package/build/src/interface/api/get-sports.interface.d.ts +4 -0
- package/build/src/interface/api/get-sports.interface.js +2 -0
- package/build/src/interface/api/get-subscription-by-org-id.interface.d.ts +6 -0
- package/build/src/interface/api/get-subscription-by-org-id.interface.js +2 -0
- package/build/src/interface/api/get-subscription-entities.interface.d.ts +8 -0
- package/build/src/interface/api/get-subscription-entities.interface.js +2 -0
- package/build/src/interface/api/get-tournament.interface.d.ts +4 -0
- package/build/src/interface/api/get-tournament.interface.js +2 -0
- package/build/src/interface/api/get-turf-by-organization.interface.d.ts +6 -0
- package/build/src/interface/api/get-turf-by-organization.interface.js +2 -0
- package/build/src/interface/api/get-turf-entity-response.interface.d.ts +10 -0
- package/build/src/interface/api/get-turf-entity-response.interface.js +2 -0
- package/build/src/interface/api/index.d.ts +78 -0
- package/build/src/interface/api/index.js +96 -0
- package/build/src/interface/api/list-of-coupons.interface.d.ts +14 -0
- package/build/src/interface/api/list-of-coupons.interface.js +2 -0
- package/build/src/interface/api/login-response.interface.d.ts +22 -0
- package/build/src/interface/api/login-response.interface.js +2 -0
- package/build/src/interface/api/manual-trigger-cron-job.interface.d.ts +5 -0
- package/build/src/interface/api/manual-trigger-cron-job.interface.js +2 -0
- package/build/src/interface/api/one-slot-booking.interface.d.ts +24 -0
- package/build/src/interface/api/one-slot-booking.interface.js +2 -0
- package/build/src/interface/api/renew-subscription.interface.d.ts +19 -0
- package/build/src/interface/api/renew-subscription.interface.js +2 -0
- package/build/src/interface/api/set-price.interface.d.ts +6 -0
- package/build/src/interface/api/set-price.interface.js +2 -0
- package/build/src/interface/api/setup-registration.interface.d.ts +5 -0
- package/build/src/interface/api/setup-registration.interface.js +2 -0
- package/build/src/interface/api/staff-member-list.interface.d.ts +9 -0
- package/build/src/interface/api/staff-member-list.interface.js +2 -0
- package/build/src/interface/api/update-bank-detail.interface.d.ts +17 -0
- package/build/src/interface/api/update-bank-detail.interface.js +2 -0
- package/build/src/interface/api/update-booking-by-code-response.interface.d.ts +7 -0
- package/build/src/interface/api/update-booking-by-code-response.interface.js +2 -0
- package/build/src/interface/api/update-configuration.interface.d.ts +10 -0
- package/build/src/interface/api/update-configuration.interface.js +2 -0
- package/build/src/interface/api/update-coupon.interface.d.ts +9 -0
- package/build/src/interface/api/update-coupon.interface.js +2 -0
- package/build/src/interface/api/update-faqs-steps.interface.d.ts +11 -0
- package/build/src/interface/api/update-faqs-steps.interface.js +2 -0
- package/build/src/interface/api/update-faqs.interface.d.ts +6 -0
- package/build/src/interface/api/update-faqs.interface.js +2 -0
- package/build/src/interface/api/update-organization.interface.d.ts +21 -0
- package/build/src/interface/api/update-organization.interface.js +2 -0
- package/build/src/interface/api/update-pricing-plan-by-id.interface.d.ts +20 -0
- package/build/src/interface/api/update-pricing-plan-by-id.interface.js +2 -0
- package/build/src/interface/api/update-recurring-booking.interface.d.ts +52 -0
- package/build/src/interface/api/update-recurring-booking.interface.js +2 -0
- package/build/src/interface/api/update-registration-entities.interface.d.ts +8 -0
- package/build/src/interface/api/update-registration-entities.interface.js +2 -0
- package/build/src/interface/api/update-sports-interface.d.ts +3 -0
- package/build/src/interface/api/update-sports-interface.js +2 -0
- package/build/src/interface/api/update-staff-member.interface.d.ts +16 -0
- package/build/src/interface/api/update-staff-member.interface.js +2 -0
- package/build/src/interface/api/update-subscription.interface.d.ts +23 -0
- package/build/src/interface/api/update-subscription.interface.js +2 -0
- package/build/src/interface/api/update-turf-details.interface.d.ts +20 -0
- package/build/src/interface/api/update-turf-details.interface.js +2 -0
- package/build/src/interface/api/update-turf-transaction-output.d.ts +3 -0
- package/build/src/interface/api/update-turf-transaction-output.js +2 -0
- package/build/src/interface/api/upgrade-renew-subscription.interface.d.ts +10 -0
- package/build/src/interface/api/upgrade-renew-subscription.interface.js +2 -0
- package/build/src/interface/api/upgrade-subscription.interface.d.ts +21 -0
- package/build/src/interface/api/upgrade-subscription.interface.js +2 -0
- package/build/src/interface/api/userentity-without-password.interface.d.ts +5 -0
- package/build/src/interface/api/userentity-without-password.interface.js +2 -0
- package/build/src/interface/api/utils.d.ts +18 -0
- package/build/src/interface/api/utils.js +48 -0
- package/build/src/interface/billing-cycle-dto.interface.d.ts +8 -0
- package/build/src/interface/billing-cycle-dto.interface.js +2 -0
- package/build/src/interface/billing-cycle.interface.d.ts +7 -0
- package/build/src/interface/billing-cycle.interface.js +2 -0
- package/build/src/interface/booking-details-with-code.interface.d.ts +34 -0
- package/build/src/interface/booking-details-with-code.interface.js +2 -0
- package/build/src/interface/controller.interface.d.ts +6 -0
- package/build/src/interface/controller.interface.js +2 -0
- package/build/src/interface/convert-to-midnight-time.interface.d.ts +5 -0
- package/build/src/interface/convert-to-midnight-time.interface.js +2 -0
- package/build/src/interface/date-formatter.interface.d.ts +4 -0
- package/build/src/interface/date-formatter.interface.js +2 -0
- package/build/src/interface/dto/delete-booking-by-codes-dto.interface.d.ts +7 -0
- package/build/src/interface/dto/delete-booking-by-codes-dto.interface.js +2 -0
- package/build/src/interface/dto/update-booking-by-code-dto.interface.d.ts +13 -0
- package/build/src/interface/dto/update-booking-by-code-dto.interface.js +2 -0
- package/build/src/interface/entity/bank-details-entity.interface.d.ts +12 -0
- package/build/src/interface/entity/bank-details-entity.interface.js +2 -0
- package/build/src/interface/entity/booking-cancellation-entity.interface.d.ts +32 -0
- package/build/src/interface/entity/booking-cancellation-entity.interface.js +2 -0
- package/build/src/interface/entity/booking-customer-entity.interface.d.ts +8 -0
- package/build/src/interface/entity/booking-customer-entity.interface.js +2 -0
- package/build/src/interface/entity/booking-details-entity.interface.d.ts +29 -0
- package/build/src/interface/entity/booking-details-entity.interface.js +2 -0
- package/build/src/interface/entity/booking-history-entity.interface.d.ts +35 -0
- package/build/src/interface/entity/booking-history-entity.interface.js +2 -0
- package/build/src/interface/entity/booking-payment-history-entity.interface.d.ts +13 -0
- package/build/src/interface/entity/booking-payment-history-entity.interface.js +2 -0
- package/build/src/interface/entity/bookings-entity.interface.d.ts +6 -0
- package/build/src/interface/entity/bookings-entity.interface.js +2 -0
- package/build/src/interface/entity/cancellation-policy-entity.interface.d.ts +8 -0
- package/build/src/interface/entity/cancellation-policy-entity.interface.js +2 -0
- package/build/src/interface/entity/configurations-entity.interface.d.ts +9 -0
- package/build/src/interface/entity/configurations-entity.interface.js +2 -0
- package/build/src/interface/entity/coupon.entity.interface.d.ts +10 -0
- package/build/src/interface/entity/coupon.entity.interface.js +2 -0
- package/build/src/interface/entity/cron-jobs-entity.interface.d.ts +12 -0
- package/build/src/interface/entity/cron-jobs-entity.interface.js +2 -0
- package/build/src/interface/entity/entity-audit-column.interface.d.ts +12 -0
- package/build/src/interface/entity/entity-audit-column.interface.js +9 -0
- package/build/src/interface/entity/faqs-entity.interface.d.ts +10 -0
- package/build/src/interface/entity/faqs-entity.interface.js +2 -0
- package/build/src/interface/entity/index.d.ts +23 -0
- package/build/src/interface/entity/index.js +39 -0
- package/build/src/interface/entity/organization-entity.interface.d.ts +24 -0
- package/build/src/interface/entity/organization-entity.interface.js +2 -0
- package/build/src/interface/entity/pitch-entity.interface.d.ts +9 -0
- package/build/src/interface/entity/pitch-entity.interface.js +2 -0
- package/build/src/interface/entity/price-entity.interface.d.ts +5 -0
- package/build/src/interface/entity/price-entity.interface.js +2 -0
- package/build/src/interface/entity/pricing-plan-entity.interface.d.ts +16 -0
- package/build/src/interface/entity/pricing-plan-entity.interface.js +2 -0
- package/build/src/interface/entity/registration-entity.interface.d.ts +12 -0
- package/build/src/interface/entity/registration-entity.interface.js +2 -0
- package/build/src/interface/entity/sports-entity.interface.d.ts +6 -0
- package/build/src/interface/entity/sports-entity.interface.js +2 -0
- package/build/src/interface/entity/subscription-entity.interface.d.ts +26 -0
- package/build/src/interface/entity/subscription-entity.interface.js +2 -0
- package/build/src/interface/entity/subscription-pitch-mapping.interface.d.ts +8 -0
- package/build/src/interface/entity/subscription-pitch-mapping.interface.js +2 -0
- package/build/src/interface/entity/turf-entity.interface.d.ts +17 -0
- package/build/src/interface/entity/turf-entity.interface.js +2 -0
- package/build/src/interface/entity/user-entity.interface.d.ts +24 -0
- package/build/src/interface/entity/user-entity.interface.js +2 -0
- package/build/src/interface/formate-date-and-time.interface.d.ts +6 -0
- package/build/src/interface/formate-date-and-time.interface.js +2 -0
- package/build/src/interface/get-booking-by-id.interface.d.ts +56 -0
- package/build/src/interface/get-booking-by-id.interface.js +2 -0
- package/build/src/interface/get-booking-codes-per-thirty-min.interface.d.ts +4 -0
- package/build/src/interface/get-booking-codes-per-thirty-min.interface.js +2 -0
- package/build/src/interface/get-pricing-plan-by-date-response.interface.d.ts +23 -0
- package/build/src/interface/get-pricing-plan-by-date-response.interface.js +2 -0
- package/build/src/interface/get-turf-entity.interface.d.ts +34 -0
- package/build/src/interface/get-turf-entity.interface.js +2 -0
- package/build/src/interface/key-value.interface.d.ts +3 -0
- package/build/src/interface/key-value.interface.js +2 -0
- package/build/src/interface/model/booking-details-model.interface.d.ts +5 -0
- package/build/src/interface/model/booking-details-model.interface.js +2 -0
- package/build/src/interface/model/booking-entity-model.interface.d.ts +8 -0
- package/build/src/interface/model/booking-entity-model.interface.js +2 -0
- package/build/src/interface/model/cancellation-policy-model.interface.d.ts +4 -0
- package/build/src/interface/model/cancellation-policy-model.interface.js +2 -0
- package/build/src/interface/model/charge-model.interface.d.ts +13 -0
- package/build/src/interface/model/charge-model.interface.js +2 -0
- package/build/src/interface/model/configuration-model.interface.d.ts +4 -0
- package/build/src/interface/model/configuration-model.interface.js +2 -0
- package/build/src/interface/model/index.d.ts +10 -0
- package/build/src/interface/model/index.js +26 -0
- package/build/src/interface/model/price-model.interface.d.ts +3 -0
- package/build/src/interface/model/price-model.interface.js +2 -0
- package/build/src/interface/model/pricing-plan-entity-model.interface.d.ts +13 -0
- package/build/src/interface/model/pricing-plan-entity-model.interface.js +2 -0
- package/build/src/interface/model/pricing-plan-model.interface.d.ts +15 -0
- package/build/src/interface/model/pricing-plan-model.interface.js +2 -0
- package/build/src/interface/model/turf-model.interface.d.ts +7 -0
- package/build/src/interface/model/turf-model.interface.js +2 -0
- package/build/src/interface/model/user-model.interface.d.ts +3 -0
- package/build/src/interface/model/user-model.interface.js +2 -0
- package/build/src/interface/modify-entity.interface.d.ts +5 -0
- package/build/src/interface/modify-entity.interface.js +2 -0
- package/build/src/interface/modify-turf.interface.d.ts +7 -0
- package/build/src/interface/modify-turf.interface.js +2 -0
- package/build/src/interface/modify.interface.d.ts +1 -0
- package/build/src/interface/modify.interface.js +2 -0
- package/build/src/interface/ng-date-structure.interface.d.ts +5 -0
- package/build/src/interface/ng-date-structure.interface.js +2 -0
- package/build/src/interface/pitch-slab-dto.interface.d.ts +8 -0
- package/build/src/interface/pitch-slab-dto.interface.js +2 -0
- package/build/src/interface/pitch-slab.interface.d.ts +5 -0
- package/build/src/interface/pitch-slab.interface.js +2 -0
- package/build/src/interface/pricing-plan.interface.d.ts +15 -0
- package/build/src/interface/pricing-plan.interface.js +2 -0
- package/build/src/interface/socket-io-bookings.interface.d.ts +12 -0
- package/build/src/interface/socket-io-bookings.interface.js +2 -0
- package/build/src/interface/time-formatter.interface.d.ts +4 -0
- package/build/src/interface/time-formatter.interface.js +2 -0
- package/build/src/interface/ui/booking-data.interface.d.ts +6 -0
- package/build/src/interface/ui/booking-data.interface.js +2 -0
- package/build/src/interface/ui/upgrade-subscription-data.interface.d.ts +15 -0
- package/build/src/interface/ui/upgrade-subscription-data.interface.js +2 -0
- package/build/src/interface/upload-multer-file.interface.d.ts +9 -0
- package/build/src/interface/upload-multer-file.interface.js +2 -0
- package/build/src/interface/user-info-dto.interface.d.ts +16 -0
- package/build/src/interface/user-info-dto.interface.js +2 -0
- package/build/src/interface/without-token-registration-entity.types.d.ts +3 -0
- package/build/src/interface/without-token-registration-entity.types.js +2 -0
- package/build/src/models/billing-cycle-model.d.ts +11 -0
- package/build/src/models/billing-cycle-model.js +27 -0
- package/build/src/models/booking-code-model.d.ts +139 -0
- package/build/src/models/booking-code-model.js +624 -0
- package/build/src/models/charge-model.d.ts +34 -0
- package/build/src/models/charge-model.js +275 -0
- package/build/src/models/entity/booking-details-model.d.ts +41 -0
- package/build/src/models/entity/booking-details-model.js +69 -0
- package/build/src/models/entity/booking-entity-model.d.ts +21 -0
- package/build/src/models/entity/booking-entity-model.js +47 -0
- package/build/src/models/entity/booking-payment-history-model.d.ts +20 -0
- package/build/src/models/entity/booking-payment-history-model.js +36 -0
- package/build/src/models/entity/cancellation-policy-model.d.ts +18 -0
- package/build/src/models/entity/cancellation-policy-model.js +32 -0
- package/build/src/models/entity/configuration-model.d.ts +17 -0
- package/build/src/models/entity/configuration-model.js +17 -0
- package/build/src/models/entity/index.d.ts +10 -0
- package/build/src/models/entity/index.js +26 -0
- package/build/src/models/entity/price-model.d.ts +11 -0
- package/build/src/models/entity/price-model.js +15 -0
- package/build/src/models/entity/pricing-plan-entity-model.d.ts +47 -0
- package/build/src/models/entity/pricing-plan-entity-model.js +128 -0
- package/build/src/models/entity/subscription-model.d.ts +44 -0
- package/build/src/models/entity/subscription-model.js +154 -0
- package/build/src/models/entity/turf-model.d.ts +36 -0
- package/build/src/models/entity/turf-model.js +116 -0
- package/build/src/models/entity/user-model.d.ts +32 -0
- package/build/src/models/entity/user-model.js +19 -0
- package/build/src/models/pitch-slab-model.d.ts +9 -0
- package/build/src/models/pitch-slab-model.js +21 -0
- package/build/src/models/pricing-plan-model.d.ts +27 -0
- package/build/src/models/pricing-plan-model.js +89 -0
- package/build/src/models/subscribed-pricing-plan-model.d.ts +37 -0
- package/build/src/models/subscribed-pricing-plan-model.js +122 -0
- package/build/src/models/time-slot-model.d.ts +19 -0
- package/build/src/models/time-slot-model.js +98 -0
- package/build/src/models/turf-availability-model.d.ts +57 -0
- package/build/src/models/turf-availability-model.js +239 -0
- package/build/src/types/app-badrequest-exception.type.d.ts +4 -0
- package/build/src/types/app-badrequest-exception.type.js +2 -0
- package/build/src/types/booking-modification.type.d.ts +6 -0
- package/build/src/types/booking-modification.type.js +2 -0
- package/build/src/types/bookingdetails-with-booking.type.d.ts +9 -0
- package/build/src/types/bookingdetails-with-booking.type.js +2 -0
- package/build/src/types/date-wise-payment-history-data.types.d.ts +9 -0
- package/build/src/types/date-wise-payment-history-data.types.js +2 -0
- package/build/src/utils/constant.d.ts +5 -0
- package/build/src/utils/constant.js +8 -0
- package/build/src/utils/date-util.d.ts +56 -0
- package/build/src/utils/date-util.js +157 -0
- package/build/src/utils/math-util.d.ts +14 -0
- package/build/src/utils/math-util.js +39 -0
- package/build/src/utils/string-utils.d.ts +31 -0
- package/build/src/utils/string-utils.js +82 -0
- package/build/tests/unit/charges/across-dates/across-dates-booking-TURF-476.spec.d.ts +1 -0
- package/build/tests/unit/charges/across-dates/across-dates-booking-TURF-476.spec.js +114 -0
- package/build/tests/unit/charges/across-dates/across-dates-booking-without-discount-TURF-476.e2e-spec.d.ts +1 -0
- package/build/tests/unit/charges/across-dates/across-dates-booking-without-discount-TURF-476.e2e-spec.js +114 -0
- package/build/tests/unit/charges/across-dates/across-dates-discount-TURF-476.spec.d.ts +1 -0
- package/build/tests/unit/charges/across-dates/across-dates-discount-TURF-476.spec.js +114 -0
- package/build/tests/unit/charges/across-dates/across-dates-extend-remove-TURF-476.spec.d.ts +1 -0
- package/build/tests/unit/charges/across-dates/across-dates-extend-remove-TURF-476.spec.js +114 -0
- package/build/tests/unit/charges/discount-conditional/basic-amount-half-amount-paid.spec.d.ts +1 -0
- package/build/tests/unit/charges/discount-conditional/basic-amount-half-amount-paid.spec.js +221 -0
- package/build/tests/unit/charges/discount-conditional/basic-amount-paid-refund-amount-paid-cancellation-not-present.spec.d.ts +1 -0
- package/build/tests/unit/charges/discount-conditional/basic-amount-paid-refund-amount-paid-cancellation-not-present.spec.js +518 -0
- package/build/tests/unit/charges/discount-conditional/basic-amount-paid-refund-amount-paid.spec.d.ts +1 -0
- package/build/tests/unit/charges/discount-conditional/basic-amount-paid-refund-amount-paid.spec.js +470 -0
- package/build/tests/unit/charges/discount-conditional/basic-amount-paid.spec.d.ts +1 -0
- package/build/tests/unit/charges/discount-conditional/basic-amount-paid.spec.js +263 -0
- package/build/tests/unit/charges/discount-conditional/basic.-amount-not-paid.spec.d.ts +1 -0
- package/build/tests/unit/charges/discount-conditional/basic.-amount-not-paid.spec.js +223 -0
- package/build/tests/unit/charges/discount-conditional/decimal-discount.spec.d.ts +1 -0
- package/build/tests/unit/charges/discount-conditional/decimal-discount.spec.js +509 -0
- package/build/tests/unit/charges/per-hour-unit/phu-basic-amount-not-paid-TURF-486.spec.d.ts +1 -0
- package/build/tests/unit/charges/per-hour-unit/phu-basic-amount-not-paid-TURF-486.spec.js +148 -0
- package/build/tests/utils/models/booking-entity-test.d.ts +9 -0
- package/build/tests/utils/models/booking-entity-test.js +28 -0
- package/package.json +6 -2
- /package/build/{@enum.d.ts → src/@enum.d.ts} +0 -0
- /package/build/{@enum.js → src/@enum.js} +0 -0
- /package/build/{@model.d.ts → src/@model.d.ts} +0 -0
- /package/build/{@model.js → src/@model.js} +0 -0
- /package/build/{@type.d.ts → src/@type.d.ts} +0 -0
- /package/build/{@type.js → src/@type.js} +0 -0
- /package/build/{@utils.d.ts → src/@utils.d.ts} +0 -0
- /package/build/{@utils.js → src/@utils.js} +0 -0
- /package/build/{index.d.ts → src/index.d.ts} +0 -0
- /package/build/{index.js → src/index.js} +0 -0
|
@@ -0,0 +1,624 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.BookingCode = void 0;
|
|
15
|
+
var time_slot_model_1 = require("./time-slot-model");
|
|
16
|
+
var charge_model_1 = require("./charge-model");
|
|
17
|
+
var app_badrequest_exception_1 = require("../exceptions/app-badrequest.exception");
|
|
18
|
+
var date_util_1 = require("../utils/date-util");
|
|
19
|
+
var date_fns_1 = require("date-fns");
|
|
20
|
+
var _utils_1 = require("../@utils");
|
|
21
|
+
var BookingCode = /** @class */ (function () {
|
|
22
|
+
function BookingCode(code, cost) {
|
|
23
|
+
if (cost === void 0) { cost = "-1"; }
|
|
24
|
+
// this.id = turfid;
|
|
25
|
+
if (code.length === 18)
|
|
26
|
+
this.code = code + "00";
|
|
27
|
+
else
|
|
28
|
+
this.code = code;
|
|
29
|
+
this.cost = cost;
|
|
30
|
+
this.parse();
|
|
31
|
+
}
|
|
32
|
+
BookingCode.prototype.parse = function () {
|
|
33
|
+
var regexp = /(\d{4})(\d{6})(\d{8})(\d{2})/g;
|
|
34
|
+
var matches = regexp.exec(this.code);
|
|
35
|
+
if (!matches) {
|
|
36
|
+
throw new Error("Booking slot ".concat(this.code, " is invalid"));
|
|
37
|
+
}
|
|
38
|
+
this.turfId = matches[1];
|
|
39
|
+
this.dateCode = matches[2];
|
|
40
|
+
this.slot = matches[3];
|
|
41
|
+
this.fromTimeCode = matches[3].slice(0, 4);
|
|
42
|
+
this.toTimeCode = matches[3].slice(4, 8);
|
|
43
|
+
this.pitchCode = matches[4];
|
|
44
|
+
this.pitchNumber = Number(matches[4]);
|
|
45
|
+
return this;
|
|
46
|
+
};
|
|
47
|
+
BookingCode.prototype.getBookingTimeInMinutes = function () {
|
|
48
|
+
//from HHMM to HHMM
|
|
49
|
+
var fromHours = parseInt(this.fromTimeCode.slice(0, 2));
|
|
50
|
+
var fromMinutes = parseInt(this.fromTimeCode.slice(2, 4));
|
|
51
|
+
var toHours = parseInt(this.toTimeCode.slice(0, 2));
|
|
52
|
+
var toMinutes = parseInt(this.toTimeCode.slice(2, 4));
|
|
53
|
+
return toHours * 60 + toMinutes - (fromHours * 60 + fromMinutes);
|
|
54
|
+
};
|
|
55
|
+
BookingCode.prototype.getPitchNo = function () {
|
|
56
|
+
return parseInt(this.pitchCode);
|
|
57
|
+
};
|
|
58
|
+
BookingCode.prototype.getHalfHourTimeCodes = function () {
|
|
59
|
+
return new time_slot_model_1.TimeSlot(this.fromTimeCode, this.toTimeCode).getHalfHourTimeCodes();
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
*
|
|
63
|
+
* @returns {Array<string>} - List of half hour time slot codes between start time & end time inclusive
|
|
64
|
+
* @example fromTime: 0000; toTime: 0130
|
|
65
|
+
* // returns ['00000030','00300100','01000130']
|
|
66
|
+
*/
|
|
67
|
+
BookingCode.prototype.getHalfHourTimeRangeCodes = function () {
|
|
68
|
+
var halfHourCodes = this.getHalfHourTimeCodes();
|
|
69
|
+
var halfHourRangeCodes = [];
|
|
70
|
+
for (var index = 0; index < halfHourCodes.length - 1; index++) {
|
|
71
|
+
halfHourRangeCodes.push(halfHourCodes[index] + halfHourCodes[index + 1]);
|
|
72
|
+
}
|
|
73
|
+
return halfHourRangeCodes;
|
|
74
|
+
};
|
|
75
|
+
BookingCode.prototype.getValidDate = function () {
|
|
76
|
+
// Date format: YYMMDD
|
|
77
|
+
function getDate(dateString) {
|
|
78
|
+
var separators = ["\\.", "\\-", "\\/"];
|
|
79
|
+
var stringBits = dateString.split(new RegExp(separators.join("|"), "g"));
|
|
80
|
+
var intBits = stringBits.map(function (bit) { return parseInt(bit); });
|
|
81
|
+
return new Date(intBits[0], intBits[1] - 1, intBits[2]);
|
|
82
|
+
}
|
|
83
|
+
return getDate("20".concat(this.dateCode.slice(0, 2), ".").concat(this.dateCode.slice(2, 4), ".").concat(this.dateCode.slice(4, 6)));
|
|
84
|
+
};
|
|
85
|
+
BookingCode.prototype.getDateCode = function () {
|
|
86
|
+
var date = this.getValidDate();
|
|
87
|
+
return "".concat(date.getFullYear() % 2000).concat((date.getMonth() + 1)
|
|
88
|
+
.toString()
|
|
89
|
+
.padStart(2, "0")).concat(date.getDate().toString().padStart(2, "0"));
|
|
90
|
+
};
|
|
91
|
+
BookingCode.prototype.getWeekday = function () {
|
|
92
|
+
var dateObj = new Date(2000 + parseInt(this.dateCode.slice(0, 2)), // Year
|
|
93
|
+
parseInt(this.dateCode.toString().slice(2, 4)) - 1, // Month (0-indexed)
|
|
94
|
+
parseInt(this.dateCode.toString().slice(4, 6)) // Day
|
|
95
|
+
);
|
|
96
|
+
return dateObj.getDay() === 0 ? 7 : dateObj.getDay();
|
|
97
|
+
// return weekday;
|
|
98
|
+
};
|
|
99
|
+
BookingCode.prototype.getMonthCode = function () {
|
|
100
|
+
return this.dateCode.slice(0, 4);
|
|
101
|
+
};
|
|
102
|
+
BookingCode.prototype.getDateWithFromTimeCode = function () {
|
|
103
|
+
return "".concat(this.dateCode).concat(this.fromTimeCode);
|
|
104
|
+
};
|
|
105
|
+
BookingCode.prototype.getCodeWithoutTurfCode = function () {
|
|
106
|
+
return "".concat(this.dateCode).concat(this.slot).concat(this.pitchCode);
|
|
107
|
+
};
|
|
108
|
+
BookingCode.sortByCode = function (bookingCodes) {
|
|
109
|
+
bookingCodes.sort(function (_a, _b) {
|
|
110
|
+
var code1 = _a.code;
|
|
111
|
+
var code2 = _b.code;
|
|
112
|
+
return code1 < code2 ? -1 : code1 > code2 ? 1 : 0;
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
// code: TTTTYYMMDDFHFMTHTMPP;
|
|
116
|
+
BookingCode.getOneSlotBookingCode = function (turfId, bookingDate, fhfm, thtm, pitchCode) {
|
|
117
|
+
var code = turfId + bookingDate + fhfm + thtm + pitchCode;
|
|
118
|
+
return code;
|
|
119
|
+
};
|
|
120
|
+
BookingCode.getDiscountedCost = function (couponCode, totalCost, validationApply, totalBookingHours) {
|
|
121
|
+
if (validationApply === void 0) { validationApply = true; }
|
|
122
|
+
var discount = 0;
|
|
123
|
+
var discountedCost = 0;
|
|
124
|
+
if (couponCode) {
|
|
125
|
+
var code = _utils_1.stringUtil.getCouponDetails(couponCode).code;
|
|
126
|
+
var value = _utils_1.stringUtil.getCouponDetails(couponCode).value;
|
|
127
|
+
if (validationApply && !code && !value) {
|
|
128
|
+
throw new app_badrequest_exception_1.AppBadRequestException({
|
|
129
|
+
key: "couponCode",
|
|
130
|
+
message: ["Coupon with code ".concat(couponCode, " is wrong ")],
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
if (code === "P" || code === "PHP") {
|
|
134
|
+
var percentDiscount = parseFloat(couponCode);
|
|
135
|
+
if (validationApply) {
|
|
136
|
+
if (percentDiscount > 90) {
|
|
137
|
+
throw new app_badrequest_exception_1.AppBadRequestException({
|
|
138
|
+
key: "couponCode",
|
|
139
|
+
message: ["Discount should not be more than 90P"],
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
discount = totalCost * (percentDiscount / 100);
|
|
144
|
+
}
|
|
145
|
+
else if (code === "U") {
|
|
146
|
+
discount = parseFloat(couponCode);
|
|
147
|
+
}
|
|
148
|
+
else if (code === "PHU") {
|
|
149
|
+
if (totalBookingHours === undefined) {
|
|
150
|
+
throw new app_badrequest_exception_1.AppBadRequestException({
|
|
151
|
+
key: "totalBookingHours",
|
|
152
|
+
message: [
|
|
153
|
+
"Total Booking Hours is mandatory to calculate per hour unit",
|
|
154
|
+
],
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
discount = parseFloat(couponCode) * totalBookingHours;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
discountedCost = totalCost - discount;
|
|
161
|
+
return Math.round(discountedCost);
|
|
162
|
+
};
|
|
163
|
+
BookingCode.getDiscountAmount = function (couponCode, totalCost) {
|
|
164
|
+
return charge_model_1.ChargesModel.getDiscountAmount(couponCode, totalCost, true);
|
|
165
|
+
};
|
|
166
|
+
//-----------------
|
|
167
|
+
BookingCode.isValidDate = function (date) {
|
|
168
|
+
// Date format: YYMMDD
|
|
169
|
+
function isDate(dateString) {
|
|
170
|
+
var separators = ["\\.", "\\-", "\\/"];
|
|
171
|
+
var stringBits = dateString.split(new RegExp(separators.join("|"), "g"));
|
|
172
|
+
var intBits = stringBits.map(function (bit) { return parseInt(bit); });
|
|
173
|
+
var parsedDate = new Date(intBits[0], intBits[1] - 1, intBits[2]);
|
|
174
|
+
return (parsedDate.getFullYear() === intBits[0] &&
|
|
175
|
+
parsedDate.getMonth() + 1 === intBits[1] &&
|
|
176
|
+
parsedDate.getDate() === intBits[2]);
|
|
177
|
+
}
|
|
178
|
+
return isDate("20".concat(date.slice(0, 2), ".").concat(date.slice(2, 4), ".").concat(date.slice(4, 6)));
|
|
179
|
+
};
|
|
180
|
+
BookingCode.parseDateCode = function (dateCode) {
|
|
181
|
+
// Date format: YYMMDD
|
|
182
|
+
function getDate(dateString) {
|
|
183
|
+
var separators = ["\\.", "\\-", "\\/"];
|
|
184
|
+
var stringBits = dateString.split(new RegExp(separators.join("|"), "g"));
|
|
185
|
+
var intBits = stringBits.map(function (bit) { return parseInt(bit); });
|
|
186
|
+
return new Date(intBits[0], intBits[1] - 1, intBits[2]);
|
|
187
|
+
}
|
|
188
|
+
return getDate("20".concat(dateCode.slice(0, 2), ".").concat(dateCode.slice(2, 4), ".").concat(dateCode.slice(4, 6)));
|
|
189
|
+
};
|
|
190
|
+
//------------------
|
|
191
|
+
BookingCode.getWeekday = function (dateCode) {
|
|
192
|
+
var dateObj = new Date(2000 + parseInt(dateCode.toString().slice(0, 2)), // Year
|
|
193
|
+
parseInt(dateCode.toString().slice(2, 4)) - 1, // Month (0-indexed)
|
|
194
|
+
parseInt(dateCode.toString().slice(4, 6)) // Day
|
|
195
|
+
);
|
|
196
|
+
var weekday = dateObj.getDay();
|
|
197
|
+
return weekday === 0 ? 7 : weekday;
|
|
198
|
+
};
|
|
199
|
+
//---------------------
|
|
200
|
+
BookingCode.convertToDate = function (str) {
|
|
201
|
+
var year = parseInt(20 + str.slice(0, 2));
|
|
202
|
+
var month = parseInt(str.slice(2, 4)) - 1;
|
|
203
|
+
var day = parseInt(str.slice(4, 6));
|
|
204
|
+
var date = new Date(Date.UTC(year, month, day, 0, 0, 0));
|
|
205
|
+
return date;
|
|
206
|
+
};
|
|
207
|
+
//---------------------
|
|
208
|
+
BookingCode.previousDateChecker = function (fromDate, index, errorKey) {
|
|
209
|
+
var slotDate = this.convertToDate(fromDate.toString());
|
|
210
|
+
var currentDateObj = new Date();
|
|
211
|
+
var parsedDate = this.dateFormat([slotDate]);
|
|
212
|
+
var currentDate = this.dateFormat([currentDateObj]);
|
|
213
|
+
if (parsedDate < currentDate) {
|
|
214
|
+
throw new app_badrequest_exception_1.AppBadRequestException({
|
|
215
|
+
key: errorKey !== null && errorKey !== void 0 ? errorKey : "slot.".concat(index),
|
|
216
|
+
message: ["date must be present Date or future Date"],
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
else if (parsedDate === currentDate) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
//---------------------
|
|
224
|
+
BookingCode.previousTimeChecker = function (fromTime, fromDate, index) {
|
|
225
|
+
var now = new Date();
|
|
226
|
+
this.convertToDate(fromDate.toString());
|
|
227
|
+
var delayInBooking = 15;
|
|
228
|
+
if (this.convertToDate(fromDate.toString()) > now) {
|
|
229
|
+
return; //do nothing if fromDate is in future
|
|
230
|
+
}
|
|
231
|
+
else if (this.convertToDate(fromDate.toString()) <= now) {
|
|
232
|
+
now.setMinutes(now.getMinutes() - delayInBooking); // 15minutes buffer for late bookings
|
|
233
|
+
var options = {
|
|
234
|
+
timeZone: "Asia/Kolkata",
|
|
235
|
+
};
|
|
236
|
+
var timeFormat = new Intl.DateTimeFormat("en-US", __assign(__assign({}, options), { hour: "2-digit", minute: "2-digit", hour12: false }));
|
|
237
|
+
var currentTimeObj = timeFormat.format(now).replace(/:/g, "");
|
|
238
|
+
if (fromTime < currentTimeObj) {
|
|
239
|
+
throw new app_badrequest_exception_1.AppBadRequestException({
|
|
240
|
+
key: "slot.".concat(index),
|
|
241
|
+
message: ["Booking time should be in future"],
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
//---------------------
|
|
247
|
+
BookingCode.getDateCodesByWeek = function (fromDate, toDate, selectedWeekday) {
|
|
248
|
+
return BookingCode.dateFormat(BookingCode.getDatesByWeek(fromDate, toDate, selectedWeekday));
|
|
249
|
+
};
|
|
250
|
+
BookingCode.getDatesByWeek = function (fromDate, toDate, selectedWeekday) {
|
|
251
|
+
if (!BookingCode.isValidDate(fromDate.toString()) ||
|
|
252
|
+
!BookingCode.isValidDate(toDate.toString())) {
|
|
253
|
+
throw new app_badrequest_exception_1.AppBadRequestException({
|
|
254
|
+
key: "Date",
|
|
255
|
+
message: ["Invalid Date"],
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
if (selectedWeekday < 0 || selectedWeekday > 7) {
|
|
259
|
+
throw new app_badrequest_exception_1.AppBadRequestException({
|
|
260
|
+
key: "weekday",
|
|
261
|
+
message: ["weekday should be between 1-7"],
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
var startDate = BookingCode.convertToDate(fromDate.toString());
|
|
265
|
+
var endDate = BookingCode.convertToDate(toDate.toString());
|
|
266
|
+
var currentDate = startDate;
|
|
267
|
+
var dates = [];
|
|
268
|
+
while (currentDate <= endDate) {
|
|
269
|
+
var weekday = currentDate.getDay();
|
|
270
|
+
if (weekday === selectedWeekday % 7) {
|
|
271
|
+
dates.push(new Date(currentDate.getTime()));
|
|
272
|
+
currentDate.setDate(currentDate.getDate() + 7);
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
currentDate.setDate(currentDate.getDate() + 1);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return dates;
|
|
279
|
+
};
|
|
280
|
+
//--------------------
|
|
281
|
+
BookingCode.isValidTimeRange = function (timeSlot) {
|
|
282
|
+
var timeformat = /^(([01]\d|2[0-3])([0-5]\d|60)|2400|0000)$/;
|
|
283
|
+
var isValidTime = timeformat.test(timeSlot) && parseInt(timeSlot, 10) <= 2400;
|
|
284
|
+
return isValidTime;
|
|
285
|
+
};
|
|
286
|
+
//---------------------
|
|
287
|
+
BookingCode.dateFormat = function (dates) {
|
|
288
|
+
var codes = [];
|
|
289
|
+
for (var _i = 0, dates_1 = dates; _i < dates_1.length; _i++) {
|
|
290
|
+
var date = dates_1[_i];
|
|
291
|
+
var dateYear = date.getFullYear() % 2000;
|
|
292
|
+
var dateMonth = date.getMonth() + 1;
|
|
293
|
+
var dateDay = date.getDate();
|
|
294
|
+
var dateFormat = dateYear.toString() +
|
|
295
|
+
dateMonth.toString().padStart(2, "0") +
|
|
296
|
+
dateDay.toString().padStart(2, "0");
|
|
297
|
+
codes.push(dateFormat);
|
|
298
|
+
}
|
|
299
|
+
return codes;
|
|
300
|
+
};
|
|
301
|
+
BookingCode.getDateCode = function (date) {
|
|
302
|
+
return "".concat(date.getFullYear() % 2000).concat((date.getMonth() + 1)
|
|
303
|
+
.toString()
|
|
304
|
+
.padStart(2, "0")).concat(date.getDate().toString().padStart(2, "0"));
|
|
305
|
+
};
|
|
306
|
+
/**
|
|
307
|
+
* Returns list of month codes (YYMM) in the Date range inclusive
|
|
308
|
+
* @param {Date} from - Start Date
|
|
309
|
+
* @param {Date} to - End Date
|
|
310
|
+
* @return {Array<Number>} - The array of month codes (YYMM)
|
|
311
|
+
*/
|
|
312
|
+
BookingCode.getMonthCodesRange = function (from, to) {
|
|
313
|
+
from = new Date(from.getTime());
|
|
314
|
+
to = new Date(to.getTime());
|
|
315
|
+
var monthCodes = [];
|
|
316
|
+
while (from < to) {
|
|
317
|
+
var fromDateCode = BookingCode.getDateCode(from);
|
|
318
|
+
monthCodes.push(parseInt("".concat(fromDateCode.slice(0, 4))));
|
|
319
|
+
from.setMonth(from.getMonth() + 1);
|
|
320
|
+
}
|
|
321
|
+
var toDateCode = BookingCode.getDateCode(to);
|
|
322
|
+
if (!monthCodes.includes(parseInt("".concat(toDateCode.slice(0, 4))))) {
|
|
323
|
+
monthCodes.push(parseInt("".concat(toDateCode.slice(0, 4))));
|
|
324
|
+
}
|
|
325
|
+
return monthCodes;
|
|
326
|
+
};
|
|
327
|
+
BookingCode.getNMonthCodes = function (n) {
|
|
328
|
+
var now = new Date();
|
|
329
|
+
var future = new Date(now.getTime());
|
|
330
|
+
future.setMonth(now.getMonth() + n);
|
|
331
|
+
return BookingCode.getMonthCodesRange(now, future);
|
|
332
|
+
};
|
|
333
|
+
BookingCode.getCodes = function (fromDate, toDate, weekday, turfId, from, to) {
|
|
334
|
+
// const {fromDate, toDate, weekday, turfId, from, to} = bookingSlot
|
|
335
|
+
var dates = this.getDateCodesByWeek(fromDate, toDate, weekday);
|
|
336
|
+
// TTTTYYMMDDFFFFTTTT
|
|
337
|
+
var codes = [];
|
|
338
|
+
for (var _i = 0, dates_2 = dates; _i < dates_2.length; _i++) {
|
|
339
|
+
var date = dates_2[_i];
|
|
340
|
+
codes.push("".concat(turfId.toString().padStart(4, "0")).concat(date).concat(from).concat(to));
|
|
341
|
+
}
|
|
342
|
+
return codes;
|
|
343
|
+
};
|
|
344
|
+
//To check fromDate and toDate present in weekDays and return dateCode
|
|
345
|
+
BookingCode.getNextDayDateCode = function (dateCode) {
|
|
346
|
+
var nextDate = BookingCode.parseDateCode(dateCode.toString());
|
|
347
|
+
nextDate.setDate(nextDate.getDate() + 1);
|
|
348
|
+
return parseInt(BookingCode.getDateCode(nextDate));
|
|
349
|
+
};
|
|
350
|
+
BookingCode.prototype.getUtcDateWithTime = function (dateCodeWithTime) {
|
|
351
|
+
// const dateCodeWithTime = '2305131200';
|
|
352
|
+
var year = parseInt(dateCodeWithTime.slice(0, 2)) + 2000;
|
|
353
|
+
var month = parseInt(dateCodeWithTime.slice(2, 4)) - 1;
|
|
354
|
+
var day = parseInt(dateCodeWithTime.slice(4, 6));
|
|
355
|
+
var hours = parseInt(dateCodeWithTime.slice(6, 8));
|
|
356
|
+
var minutes = parseInt(dateCodeWithTime.slice(8, 10));
|
|
357
|
+
return new Date(Date.UTC(year, month, day, hours, minutes));
|
|
358
|
+
};
|
|
359
|
+
BookingCode.getUtcDateWithTime = function (dateCodeWithTime) {
|
|
360
|
+
// const dateCodeWithTime = '2305131200';
|
|
361
|
+
var year = parseInt(dateCodeWithTime.slice(0, 2)) + 2000;
|
|
362
|
+
var month = parseInt(dateCodeWithTime.slice(2, 4)) - 1;
|
|
363
|
+
var day = parseInt(dateCodeWithTime.slice(4, 6));
|
|
364
|
+
var hours = parseInt(dateCodeWithTime.slice(6, 8));
|
|
365
|
+
var minutes = parseInt(dateCodeWithTime.slice(8, 10));
|
|
366
|
+
return new Date(Date.UTC(year, month, day, hours, minutes));
|
|
367
|
+
};
|
|
368
|
+
BookingCode.prototype.getNoOfHoursDifference = function () {
|
|
369
|
+
var bookingDate = BookingCode.getUtcDateWithTime(this.getDateWithFromTimeCode());
|
|
370
|
+
var date = BookingCode.getIndianTimeZoneDate();
|
|
371
|
+
var timeDifferenceMs = bookingDate.getTime() - date.getTime();
|
|
372
|
+
return timeDifferenceMs / (1000 * 60 * 60);
|
|
373
|
+
};
|
|
374
|
+
BookingCode.getBookingCodesPerThirtyMinutes = function (from, to, bookingDate) {
|
|
375
|
+
var bookingCodePerThirtyMinutes = [];
|
|
376
|
+
while (from < to) {
|
|
377
|
+
var lastDigit = from.slice(2, 4);
|
|
378
|
+
if (lastDigit == "00") {
|
|
379
|
+
var code = "".concat(from).concat((Number(from) + 30)
|
|
380
|
+
.toString()
|
|
381
|
+
.padStart(4, "0"));
|
|
382
|
+
bookingCodePerThirtyMinutes.push({
|
|
383
|
+
slotCodePerThirtyMinute: code,
|
|
384
|
+
bookingDate: bookingDate,
|
|
385
|
+
});
|
|
386
|
+
from = (Number(from) + 30).toString().padStart(4, "0");
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
var code = "".concat(from).concat((Number(from) + 70)
|
|
390
|
+
.toString()
|
|
391
|
+
.padStart(4, "0"));
|
|
392
|
+
bookingCodePerThirtyMinutes.push({
|
|
393
|
+
slotCodePerThirtyMinute: code,
|
|
394
|
+
bookingDate: bookingDate,
|
|
395
|
+
});
|
|
396
|
+
from = (Number(from) + 70).toString().padStart(4, "0");
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
return bookingCodePerThirtyMinutes;
|
|
400
|
+
};
|
|
401
|
+
BookingCode.getCostPerThirtyMinutes = function (bookingCodePerThirtyMinutesPerSlot, pricePerThirtyMinutesData) {
|
|
402
|
+
var cost = [];
|
|
403
|
+
bookingCodePerThirtyMinutesPerSlot.forEach(function (slot) {
|
|
404
|
+
var weekDay = BookingCode.getWeekday(Number(slot.bookingDate));
|
|
405
|
+
var month = slot.bookingDate.slice(0, 4);
|
|
406
|
+
var monthWeekday = "".concat(month).concat(weekDay);
|
|
407
|
+
var price = pricePerThirtyMinutesData[monthWeekday][slot.slotCodePerThirtyMinute];
|
|
408
|
+
cost.push(price.toString());
|
|
409
|
+
});
|
|
410
|
+
return cost.join(",");
|
|
411
|
+
};
|
|
412
|
+
BookingCode.padBookingCode = function (bookingCodeWithoutTurfCode) {
|
|
413
|
+
return bookingCodeWithoutTurfCode.padStart(20, "0");
|
|
414
|
+
};
|
|
415
|
+
BookingCode.getInstance = function (turfId, bookingCodeWithoutTurfCode) {
|
|
416
|
+
return new BookingCode("".concat(turfId.toString().padStart(4, "0")).concat(bookingCodeWithoutTurfCode));
|
|
417
|
+
};
|
|
418
|
+
BookingCode.prototype.getCost = function () {
|
|
419
|
+
return this.cost
|
|
420
|
+
.split(",")
|
|
421
|
+
.map(function (a) { return parseInt(a); })
|
|
422
|
+
.reduce(function (a, b) { return a + b; }, 0);
|
|
423
|
+
};
|
|
424
|
+
BookingCode.prototype.getTimeslot = function () {
|
|
425
|
+
return new time_slot_model_1.TimeSlot(this.fromTimeCode, this.toTimeCode);
|
|
426
|
+
};
|
|
427
|
+
BookingCode.getIndianTimeZoneDate = function (bookingBufferOffsetHour) {
|
|
428
|
+
var now = new Date();
|
|
429
|
+
var utcOffsetMinutes = 330; // Indian Standard Time (IST) offset is UTC+05:30
|
|
430
|
+
var indianTimeMillis = now.getTime() +
|
|
431
|
+
utcOffsetMinutes * 60 * 1000 +
|
|
432
|
+
(bookingBufferOffsetHour || 0) * 60 * 60 * 1000;
|
|
433
|
+
return new Date(indianTimeMillis);
|
|
434
|
+
};
|
|
435
|
+
//--------------------------------------------------------------
|
|
436
|
+
BookingCode.prototype.getInstanceByPitchNo = function (newPitchNo) {
|
|
437
|
+
return new BookingCode("".concat(this.code.slice(0, -2)).concat(newPitchNo.toString().padStart(2, "0")), this.cost);
|
|
438
|
+
};
|
|
439
|
+
BookingCode.prototype.getDateFromTimeCode = function () {
|
|
440
|
+
return parseInt("".concat(this.dateCode).concat(this.fromTimeCode));
|
|
441
|
+
};
|
|
442
|
+
BookingCode.prototype.getPreviousBookingSlotCode = function () {
|
|
443
|
+
var prevousBookingCode = this.getPreviousBookingCode();
|
|
444
|
+
return "".concat(prevousBookingCode.dateCode).concat(prevousBookingCode
|
|
445
|
+
.getTimeslot()
|
|
446
|
+
.getCode());
|
|
447
|
+
};
|
|
448
|
+
BookingCode.prototype.getPreviousBookingCode = function () {
|
|
449
|
+
if (this.fromTimeCode === "0000") {
|
|
450
|
+
// Add previous day
|
|
451
|
+
var previousDateCode = date_util_1.dateUtilService.addNDaysToDateCode(this.dateCode, -1);
|
|
452
|
+
// return `${previousDateCode}23302400`;
|
|
453
|
+
return new BookingCode("".concat(this.code.slice(0, 4)).concat(previousDateCode, "23302400").concat(this.code.slice(-2)));
|
|
454
|
+
}
|
|
455
|
+
else {
|
|
456
|
+
var previousTimeSlotCode = this.getPreviousTimeSlotCode();
|
|
457
|
+
return new BookingCode("".concat(this.code.slice(0, 4)).concat(this.dateCode).concat(previousTimeSlotCode).concat(this.fromTimeCode).concat(this.code.slice(-2)));
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
BookingCode.prototype.getPreviousTimeSlotCode = function (isHour) {
|
|
461
|
+
if (isHour === void 0) { isHour = false; }
|
|
462
|
+
return this.getOffsetTimeSlotCode(this.fromTimeCode, isHour, false);
|
|
463
|
+
};
|
|
464
|
+
BookingCode.prototype.getNextBookingSlotCode = function () {
|
|
465
|
+
var nextBookingCode = this.getNextBookingCode();
|
|
466
|
+
return "".concat(nextBookingCode.dateCode).concat(nextBookingCode
|
|
467
|
+
.getTimeslot()
|
|
468
|
+
.getCode());
|
|
469
|
+
};
|
|
470
|
+
BookingCode.prototype.getNextTimeSlotCode = function (isHour) {
|
|
471
|
+
if (isHour === void 0) { isHour = false; }
|
|
472
|
+
return this.getOffsetTimeSlotCode(this.toTimeCode, isHour, true);
|
|
473
|
+
};
|
|
474
|
+
BookingCode.prototype.getNextBookingCode = function () {
|
|
475
|
+
var toTimeSlotCode = this.toTimeCode;
|
|
476
|
+
if (this.toTimeCode === "2400") {
|
|
477
|
+
// Add next day
|
|
478
|
+
var nextDateCode = date_util_1.dateUtilService.addNDaysToDateCode(this.dateCode, 1);
|
|
479
|
+
// return `${nextDateCode}00000030`;
|
|
480
|
+
return new BookingCode("".concat(this.code.slice(0, 4)).concat(nextDateCode, "00000030").concat(this.code.slice(-2)));
|
|
481
|
+
}
|
|
482
|
+
else {
|
|
483
|
+
var nextTimeSlotCode = this.getNextTimeSlotCode();
|
|
484
|
+
return new BookingCode("".concat(this.code.slice(0, 4)).concat(this.dateCode).concat(toTimeSlotCode).concat(nextTimeSlotCode).concat(this.code.slice(-2)));
|
|
485
|
+
}
|
|
486
|
+
};
|
|
487
|
+
BookingCode.prototype.getOffsetTimeSlotCode = function (timeCode, isHour, isNext) {
|
|
488
|
+
if (isHour === void 0) { isHour = false; }
|
|
489
|
+
if (isNext === void 0) { isNext = true; }
|
|
490
|
+
var minutes = parseInt(timeCode.slice(0, 2)) * 60 +
|
|
491
|
+
parseInt(timeCode.slice(2, 4)) +
|
|
492
|
+
(isNext ? 1 : -1) * (isHour ? 60 : 30);
|
|
493
|
+
return "".concat(Math.floor(minutes / 60)
|
|
494
|
+
.toString()
|
|
495
|
+
.padStart(2, "0")).concat((minutes % 60).toString().padStart(2, "0"));
|
|
496
|
+
};
|
|
497
|
+
BookingCode.prototype.isInPast = function () {
|
|
498
|
+
var pastBookingCode = "".concat(this.dateCode).concat(this.getTimeslot().getCode());
|
|
499
|
+
var currentTime = new Date().getTime();
|
|
500
|
+
return (new Date(parseInt("20".concat(pastBookingCode.slice(0, 2))), parseInt(pastBookingCode.slice(2, 4)) - 1, parseInt(pastBookingCode.slice(4, 6)), parseInt(pastBookingCode.slice(6, 8)), parseInt(pastBookingCode.slice(8, 10))).getTime() < currentTime);
|
|
501
|
+
};
|
|
502
|
+
BookingCode.prototype.formatDateAndTime = function (formateDateAndTime) {
|
|
503
|
+
var dateFormat = formateDateAndTime.dateFormat, timeFormat = formateDateAndTime.timeFormat, separator = formateDateAndTime.separator, timeSeparator = formateDateAndTime.timeSeparator;
|
|
504
|
+
this.toTimeCode = date_util_1.dateUtilService
|
|
505
|
+
.handle2400HourInDateCode("".concat(this.dateCode).concat(this.toTimeCode))
|
|
506
|
+
.slice(-4);
|
|
507
|
+
var formattedDate = BookingCode.dateFormatter({
|
|
508
|
+
dateFormat: dateFormat,
|
|
509
|
+
dateCode: this.dateCode,
|
|
510
|
+
});
|
|
511
|
+
var formattedFromTime = BookingCode.timeFormatter({
|
|
512
|
+
timeFormat: timeFormat,
|
|
513
|
+
timeCode: this.fromTimeCode,
|
|
514
|
+
});
|
|
515
|
+
var formattedToTime = BookingCode.timeFormatter({
|
|
516
|
+
timeFormat: timeFormat,
|
|
517
|
+
timeCode: this.toTimeCode,
|
|
518
|
+
});
|
|
519
|
+
return "".concat(formattedDate).concat(separator).concat(formattedFromTime).concat(timeSeparator).concat(formattedToTime);
|
|
520
|
+
};
|
|
521
|
+
BookingCode.timeFormatter = function (timeFormatter) {
|
|
522
|
+
var parsedFromTime = (0, date_fns_1.parse)(timeFormatter.timeCode, "HHmm", new Date());
|
|
523
|
+
return (0, date_fns_1.format)(parsedFromTime, timeFormatter.timeFormat);
|
|
524
|
+
};
|
|
525
|
+
BookingCode.dateFormatter = function (dateFormatter) {
|
|
526
|
+
var dateFormat = dateFormatter.dateFormat, dateCode = dateFormatter.dateCode;
|
|
527
|
+
return (0, date_fns_1.format)(BookingCode.convertToDate(dateCode), dateFormat);
|
|
528
|
+
};
|
|
529
|
+
/**
|
|
530
|
+
* Calculates the total time difference between two date codes.
|
|
531
|
+
* @param unit - Optional. Specifies the unit of time for the result. Valid values are "minute" or "hr". Defaults to "minute" if not provided.
|
|
532
|
+
* @returns The total time difference in the specified unit (minutes or hours) between the "from" and "to" date codes.
|
|
533
|
+
*/
|
|
534
|
+
BookingCode.prototype.getTotalTime = function (unit) {
|
|
535
|
+
if (unit === void 0) { unit = "minute"; }
|
|
536
|
+
return date_util_1.dateUtilService.calculateDateDifference(this.getAcrossDateCodes().fromDateCode, this.getAcrossDateCodes().toDateCode, unit);
|
|
537
|
+
};
|
|
538
|
+
/**
|
|
539
|
+
* Gets the date codes across a time range.
|
|
540
|
+
*
|
|
541
|
+
* @returns An object containing the date codes for the from and to time.
|
|
542
|
+
* @description
|
|
543
|
+
* The `fromDateCode` is generated by combining the current instance's `dateCode` and `fromTimeCode`.
|
|
544
|
+
* The `toDateCode` is generated based on the `fromTimeCode` and `toTimeCode`. If `fromTimeCode` is greater
|
|
545
|
+
* than `toTimeCode`, it adds one day to the current instance's `dateCode`.
|
|
546
|
+
*/
|
|
547
|
+
BookingCode.prototype.getAcrossDateCodes = function () {
|
|
548
|
+
var fromDateCode = "".concat(this.dateCode).concat(this.fromTimeCode);
|
|
549
|
+
var toDateCode = "".concat(this.fromTimeCode > this.toTimeCode
|
|
550
|
+
? date_util_1.dateUtilService.addNDaysToDateCode(this.dateCode, 1)
|
|
551
|
+
: this.dateCode).concat(this.toTimeCode);
|
|
552
|
+
return { fromDateCode: fromDateCode, toDateCode: toDateCode };
|
|
553
|
+
};
|
|
554
|
+
BookingCode.getTotalTimeByBookingCodes = function (bookingCodes) {
|
|
555
|
+
var totalBookingHours = 0;
|
|
556
|
+
bookingCodes.forEach(function (bookingCode) {
|
|
557
|
+
totalBookingHours += new BookingCode(bookingCode.code).getTotalTime("hr");
|
|
558
|
+
});
|
|
559
|
+
return totalBookingHours;
|
|
560
|
+
};
|
|
561
|
+
/**
|
|
562
|
+
* Retrieves booking codes for a booking scenario that may span across different days.
|
|
563
|
+
* If the booking spans multiple days, two codes are generated for each day; otherwise, a single code is used.
|
|
564
|
+
*
|
|
565
|
+
* @returns {string[]} An array containing the booking codes.
|
|
566
|
+
*/
|
|
567
|
+
BookingCode.prototype.getBookingCodesByAcrossDateBookingCode = function () {
|
|
568
|
+
var bookingCodes = [];
|
|
569
|
+
// Check if the booking spans across different days
|
|
570
|
+
if (this.fromTimeCode > this.toTimeCode) {
|
|
571
|
+
var firstDayCode = "".concat(this.turfId).concat(this.dateCode).concat(this.fromTimeCode, "2400").concat(this.pitchCode);
|
|
572
|
+
var secondDayCode = "".concat(this.turfId).concat(date_util_1.dateUtilService.addNDaysToDateCode(this.dateCode, 1), "0000").concat(this.toTimeCode).concat(this.pitchCode);
|
|
573
|
+
bookingCodes.push(firstDayCode);
|
|
574
|
+
bookingCodes.push(secondDayCode);
|
|
575
|
+
}
|
|
576
|
+
else {
|
|
577
|
+
bookingCodes.push(this.code);
|
|
578
|
+
}
|
|
579
|
+
return bookingCodes;
|
|
580
|
+
};
|
|
581
|
+
/**
|
|
582
|
+
* Converts booking codes obtained using `getBookingCodesByAcrossDateBookingCode` into an array of BookingCode models.
|
|
583
|
+
*
|
|
584
|
+
* @returns {BookingCode[]} An array containing BookingCode models.
|
|
585
|
+
*/
|
|
586
|
+
BookingCode.prototype.getBookingCodeModelsByAcrossDateBookingCode = function () {
|
|
587
|
+
var bookingCodes = this.getBookingCodesByAcrossDateBookingCode();
|
|
588
|
+
var bookingCodeModels = [];
|
|
589
|
+
bookingCodes.forEach(function (code) {
|
|
590
|
+
bookingCodeModels.push(new BookingCode(code));
|
|
591
|
+
});
|
|
592
|
+
return bookingCodeModels;
|
|
593
|
+
};
|
|
594
|
+
/**
|
|
595
|
+
* @param {BookingCode} nextBookingCode - The booking code to check for adjacency.
|
|
596
|
+
* @returns {boolean} True if the codes are adjacent, false otherwise.
|
|
597
|
+
*
|
|
598
|
+
* @description
|
|
599
|
+
* Two booking codes are considered adjacent if the current booking code ends at the end of the day (`2400`)
|
|
600
|
+
* and the next booking code starts at the beginning of the day (`0000`) on the following day.
|
|
601
|
+
* Additionally, the pitch number and turf ID must match between the two codes.
|
|
602
|
+
*/
|
|
603
|
+
BookingCode.prototype.isAdjacentBookingCode = function (nextBookingCode) {
|
|
604
|
+
return (this.toTimeCode === _utils_1.END_OF_DAY_TIME_CODE &&
|
|
605
|
+
nextBookingCode.fromTimeCode === _utils_1.START_OF_DAY_TIME_CODE &&
|
|
606
|
+
date_util_1.dateUtilService.addNDaysToDateCode(this.dateCode, 1) ===
|
|
607
|
+
nextBookingCode.dateCode &&
|
|
608
|
+
this.pitchNumber === nextBookingCode.pitchNumber &&
|
|
609
|
+
this.turfId === nextBookingCode.turfId);
|
|
610
|
+
};
|
|
611
|
+
/**
|
|
612
|
+
* Extracts the numeric part of a bookingCode, excluding a predefined deleted slot separator.
|
|
613
|
+
*
|
|
614
|
+
* @param {string} bookingCode - The input bookingCode to extract from.
|
|
615
|
+
* @returns {string} The numeric part of the bookingCode.
|
|
616
|
+
*/
|
|
617
|
+
BookingCode.extractBookingCodeByDeletedSlotSeparator = function (bookingCode) {
|
|
618
|
+
return bookingCode.startsWith(_utils_1.DELETED_SLOT_SEPARATOR)
|
|
619
|
+
? bookingCode.slice(_utils_1.DELETED_SLOT_SEPARATOR.length)
|
|
620
|
+
: bookingCode;
|
|
621
|
+
};
|
|
622
|
+
return BookingCode;
|
|
623
|
+
}());
|
|
624
|
+
exports.BookingCode = BookingCode;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { IBookingModification } from "../types/booking-modification.type";
|
|
2
|
+
import { ModificationDiscountPolicy } from "../enums/modification-discount-policy.enum";
|
|
3
|
+
import { IChargeModel } from "../interface/model/charge-model.interface";
|
|
4
|
+
export declare class ChargesModel implements IChargeModel {
|
|
5
|
+
initialBookingGrossAmount: number;
|
|
6
|
+
additionalBookingGrossAmount: number;
|
|
7
|
+
cancelledBookingGrossAmount: number;
|
|
8
|
+
totalCancellationCharges: number;
|
|
9
|
+
refundPayable: number;
|
|
10
|
+
netTotal: number;
|
|
11
|
+
amountPaid: number;
|
|
12
|
+
amountPayable: number;
|
|
13
|
+
totalRefundedAmount: number;
|
|
14
|
+
totalBookingHours: number;
|
|
15
|
+
couponCode: string;
|
|
16
|
+
discountPolicy: ModificationDiscountPolicy;
|
|
17
|
+
constructor(initialGrossAmount: number, paidAmount: number, couponCode: string, totalBookingHours: number, discountPolicy: ModificationDiscountPolicy);
|
|
18
|
+
getGrossAmount(): number;
|
|
19
|
+
getNetAmount(): number;
|
|
20
|
+
getDiscountAmount(): number;
|
|
21
|
+
getPayableRefundAmount(): number;
|
|
22
|
+
static getDiscountAmount(couponCode: string, totalCost: number, validationApply?: boolean, totalBookingHours?: number): number;
|
|
23
|
+
setValues(values?: Partial<ChargesModel>): ChargesModel;
|
|
24
|
+
modify(bookingModification: IBookingModification): ChargesModel | null;
|
|
25
|
+
private modifyExtend;
|
|
26
|
+
private modifyReduce;
|
|
27
|
+
private modifyMove;
|
|
28
|
+
clone(): ChargesModel;
|
|
29
|
+
private modifyDelete;
|
|
30
|
+
static getInstance(chargeData: IChargeModel, discountPolicy?: ModificationDiscountPolicy): ChargesModel;
|
|
31
|
+
getTotalAmount(): number;
|
|
32
|
+
getPaymentStatus(): "Refund" | "Paid" | "Pending";
|
|
33
|
+
getTotalNetAmount(): number;
|
|
34
|
+
}
|