@spytecgps/nova-orm 0.0.224 → 0.0.225
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/entities/acumaticaAmazonProduct.js +46 -0
- package/dist/entities/acumaticaImeiIccidData.js +91 -0
- package/dist/entities/acumaticaOrderShipmentDetails.js +61 -0
- package/dist/entities/acumaticaShipment.js +31 -0
- package/dist/entities/acumaticaShipmentAmazon.js +26 -0
- package/dist/entities/aempToken.js +47 -0
- package/dist/entities/alert.js +129 -0
- package/dist/entities/alertMigration.js +115 -0
- package/dist/entities/alertMigrationBatch.js +21 -0
- package/dist/entities/alertTimeWindowConfiguration.js +61 -0
- package/dist/entities/alertType.js +83 -0
- package/dist/entities/appFeatureType.js +36 -0
- package/dist/entities/assetCategory.js +32 -0
- package/dist/entities/billing.js +108 -0
- package/dist/entities/billingCustomerBraintree.js +62 -0
- package/dist/entities/billingDeviceHistory.js +61 -0
- package/dist/entities/billingHubspotPaymentLog.js +256 -0
- package/dist/entities/billingKlarnaCustomer.js +76 -0
- package/dist/entities/billingKlarnaOrder.js +114 -0
- package/dist/entities/billingStatusHistoryBraintree.js +63 -0
- package/dist/entities/billingSubscriptionBraintree.js +229 -0
- package/dist/entities/blacklist.js +51 -0
- package/dist/entities/blacklistType.js +31 -0
- package/dist/entities/boundary.js +119 -0
- package/dist/entities/boundaryEvent.js +105 -0
- package/dist/entities/cellTower.js +66 -0
- package/dist/entities/client.js +153 -0
- package/dist/entities/clientAppFeature.js +47 -0
- package/dist/entities/clientConfiguration.js +47 -0
- package/dist/entities/clientDeviceSetting.js +90 -0
- package/dist/entities/clientType.js +36 -0
- package/dist/entities/country.js +90 -0
- package/dist/entities/customerAttribute.js +52 -0
- package/dist/entities/dataSourceType.js +31 -0
- package/dist/entities/deactivation.js +83 -0
- package/dist/entities/deactivationReason.js +40 -0
- package/dist/entities/device.js +160 -0
- package/dist/entities/deviceAlertConfiguration.js +71 -0
- package/dist/entities/deviceBehavior.js +147 -0
- package/dist/entities/deviceCustomConfiguration.js +67 -0
- package/dist/entities/deviceHistory.js +46 -0
- package/dist/entities/deviceModelListener.js +46 -0
- package/dist/entities/devicePairing.js +67 -0
- package/dist/entities/devicePromotion.js +104 -0
- package/dist/entities/deviceReplacement.js +57 -0
- package/dist/entities/deviceTask.js +44 -0
- package/dist/entities/deviceType.js +149 -0
- package/dist/entities/deviceTypeEvent.js +32 -0
- package/dist/entities/deviceTypeFeature.js +32 -0
- package/dist/entities/deviceTypeFirmware.js +117 -0
- package/dist/entities/entityTag.js +48 -0
- package/dist/entities/entityType.js +31 -0
- package/dist/entities/event.js +36 -0
- package/dist/entities/feature.js +36 -0
- package/dist/entities/firmwareAutoUpgradeBlacklist.js +35 -0
- package/dist/entities/firmwareUpgradeTask.js +105 -0
- package/dist/entities/iccidStatus.js +49 -0
- package/dist/entities/imeiIccidCarrier.js +125 -0
- package/dist/entities/imeiIccidHistory.js +43 -0
- package/dist/entities/index.js +99 -0
- package/dist/entities/industry.js +46 -0
- package/dist/entities/latestPosition.js +100 -0
- package/dist/entities/latestPositionMigration.js +96 -0
- package/dist/entities/latestPositionMigrationBatch.js +21 -0
- package/dist/entities/magento2Gps.js +256 -0
- package/dist/entities/magento2Plan.js +41 -0
- package/dist/entities/mobileNetwork.js +51 -0
- package/dist/entities/notificationRecipient.js +100 -0
- package/dist/entities/organization.js +46 -0
- package/dist/entities/plan.js +86 -0
- package/dist/entities/position.js +102 -0
- package/dist/entities/positionMigration.js +96 -0
- package/dist/entities/positionMigrationBatch.js +21 -0
- package/dist/entities/promotion.js +134 -0
- package/dist/entities/securityRole.js +41 -0
- package/dist/entities/serviceProvider.js +41 -0
- package/dist/entities/serviceProviderProduct.js +61 -0
- package/dist/entities/serviceProviderProductNetwork.js +31 -0
- package/dist/entities/serviceProviderProductType.js +31 -0
- package/dist/entities/sim.js +92 -0
- package/dist/entities/task.js +146 -0
- package/dist/entities/taskSchedule.js +141 -0
- package/dist/entities/trip.js +127 -0
- package/dist/entities/tripCompletionStatus.js +36 -0
- package/dist/entities/tripPosition.js +26 -0
- package/dist/entities/user.js +196 -0
- package/dist/entities/userActivation.js +52 -0
- package/dist/entities/userActivationDevice.js +164 -0
- package/dist/entities/userActivationEvent.js +61 -0
- package/dist/entities/userActivationMetric.js +208 -0
- package/dist/entities/userAlertComplain.js +78 -0
- package/dist/entities/userAlertConfiguration.js +109 -0
- package/dist/entities/userAppFeedback.js +52 -0
- package/dist/entities/userAppIncident.js +176 -0
- package/dist/entities/userConfiguration.js +109 -0
- package/dist/entities/userDataDeletionRequest.js +56 -0
- package/dist/entities/userDeviceBehaviorTask.js +80 -0
- package/dist/entities/userInvitation.js +89 -0
- package/dist/entities/userRatingRequest.js +75 -0
- package/dist/entities/userRegistrationAttempt.js +177 -0
- package/dist/entities/userSecurityRole.js +33 -0
- package/dist/index.js +1 -2
- package/dist/migration/1684483704434-addLowerCaseIndex.js +16 -0
- package/dist/novaDataSource.js +110 -0
- package/dist/repositories/acumatica/getAcumaticaImeiIccidData.js +35 -0
- package/dist/repositories/acumatica/getAcumaticaShipmentDetails.js +50 -0
- package/dist/repositories/acumatica/getLastAcumaticaShipmentDetails.js +27 -0
- package/dist/repositories/acumatica/index.js +52 -0
- package/dist/repositories/aempToken/createAempToken.js +26 -0
- package/dist/repositories/aempToken/deleteAempTokens.js +30 -0
- package/dist/repositories/aempToken/getAempTokens.js +27 -0
- package/dist/repositories/aempToken/index.js +53 -0
- package/dist/repositories/alertTypes/getAlertTypes.js +13 -0
- package/dist/repositories/alertTypes/index.js +18 -0
- package/dist/repositories/alerts/createAlert.js +94 -0
- package/dist/repositories/alerts/createUserAlertComplain.js +26 -0
- package/dist/repositories/alerts/getAlertsReportByClient.js +65 -0
- package/dist/repositories/alerts/getAlertsReportByUser.js +127 -0
- package/dist/repositories/alerts/index.js +104 -0
- package/dist/repositories/appFeatures/createAppFeatureType.js +15 -0
- package/dist/repositories/appFeatures/createClientAppFeature.js +15 -0
- package/dist/repositories/appFeatures/getClientAppFeatures.js +39 -0
- package/dist/repositories/appFeatures/index.js +57 -0
- package/dist/repositories/assetCategories/getAssetCategories.js +8 -0
- package/dist/repositories/assetCategories/index.js +16 -0
- package/dist/repositories/baseRepository.js +9 -0
- package/dist/repositories/billing/createBilling.js +37 -0
- package/dist/repositories/billing/createBillingDeviceHistory.js +30 -0
- package/dist/repositories/billing/createBillingHubspotPaymentLog.js +61 -0
- package/dist/repositories/billing/createBillingStatusHistoryBraintree.js +32 -0
- package/dist/repositories/billing/getBillingCustomerBraintreeById.js +18 -0
- package/dist/repositories/billing/getBillingKlarnaOrderByImei.js +18 -0
- package/dist/repositories/billing/getBillingSubscriptionBraintreeByImei.js +18 -0
- package/dist/repositories/billing/getBillingSubscriptionsBraintree.js +25 -0
- package/dist/repositories/billing/getBillings.js +42 -0
- package/dist/repositories/billing/getCanceledImeis.js +84 -0
- package/dist/repositories/billing/getCanceledImeisMatchingMagentoData.js +100 -0
- package/dist/repositories/billing/getChurnStatusByClientId.js +27 -0
- package/dist/repositories/billing/getClientIdFromBraintreeCustomer.js +20 -0
- package/dist/repositories/billing/getMagentoPlan.js +21 -0
- package/dist/repositories/billing/getUserByBraintreeCustomerId.js +22 -0
- package/dist/repositories/billing/index.js +353 -0
- package/dist/repositories/billing/updateBilling.js +43 -0
- package/dist/repositories/billing/updateBillingCustomerBraintree.js +37 -0
- package/dist/repositories/billing/upsertBillingCustomerBraintree.js +39 -0
- package/dist/repositories/billing/upsertBillingKlarnaCustomer.js +52 -0
- package/dist/repositories/billing/upsertBillingKlarnaOrder.js +58 -0
- package/dist/repositories/billing/upsertBillingSubscriptionBraintree.js +20 -0
- package/dist/repositories/blacklist/getBlacklists.js +19 -0
- package/dist/repositories/blacklist/index.js +19 -0
- package/dist/repositories/boundaries/createBoundary.js +52 -0
- package/dist/repositories/boundaries/deleteBoundary.js +23 -0
- package/dist/repositories/boundaries/getBoundariesByClientId.js +17 -0
- package/dist/repositories/boundaries/getBoundariesIdsByClientId.js +19 -0
- package/dist/repositories/boundaries/getBoundariesReport.js +141 -0
- package/dist/repositories/boundaries/getBoundaryById.js +14 -0
- package/dist/repositories/boundaries/index.js +178 -0
- package/dist/repositories/boundaries/processBoundaryEvent.js +211 -0
- package/dist/repositories/boundaries/updateBoundary.js +53 -0
- package/dist/repositories/boundaries/upsertBoundaryEvent.js +23 -0
- package/dist/repositories/clients/createClient.js +35 -0
- package/dist/repositories/clients/createClientConfiguration.js +18 -0
- package/dist/repositories/clients/createCustomerAttribute.js +16 -0
- package/dist/repositories/clients/deleteClientAndConfiguration.js +25 -0
- package/dist/repositories/clients/getClient.js +32 -0
- package/dist/repositories/clients/getClientConfiguration.js +14 -0
- package/dist/repositories/clients/getClients.js +26 -0
- package/dist/repositories/clients/getCustomerAttribute.js +14 -0
- package/dist/repositories/clients/index.js +192 -0
- package/dist/repositories/clients/updateClient.js +52 -0
- package/dist/repositories/clients/updateClientConfiguration.js +31 -0
- package/dist/repositories/clients/updateCustomerAttribute.js +27 -0
- package/dist/repositories/countries/getCountries.js +14 -0
- package/dist/repositories/countries/getCountry.js +23 -0
- package/dist/repositories/countries/index.js +33 -0
- package/dist/repositories/deactivations/createDeactivation.js +16 -0
- package/dist/repositories/deactivations/getDeactivationReasons.js +24 -0
- package/dist/repositories/deactivations/getLatestDeactivationByImei.js +19 -0
- package/dist/repositories/deactivations/index.js +58 -0
- package/dist/repositories/deviceBehaviors/createDeviceBehaviorTask.js +48 -0
- package/dist/repositories/deviceBehaviors/getDeviceBehaviorTasks.js +40 -0
- package/dist/repositories/deviceBehaviors/getDeviceBehaviors.js +41 -0
- package/dist/repositories/deviceBehaviors/getDeviceBehaviorsByIds.js +16 -0
- package/dist/repositories/deviceBehaviors/getDevicesLastBehaviorTask.js +42 -0
- package/dist/repositories/deviceBehaviors/getLatestDeviceBehaviorTasks.js +40 -0
- package/dist/repositories/deviceBehaviors/index.js +147 -0
- package/dist/repositories/deviceBehaviors/updateDeviceBehaviorTask.js +27 -0
- package/dist/repositories/deviceBehaviors/upsertDeviceBehavior.js +20 -0
- package/dist/repositories/devicePairings/createDevicePairing.js +21 -0
- package/dist/repositories/devicePairings/deleteDevicePairing.js +16 -0
- package/dist/repositories/devicePairings/getDevicePairings.js +36 -0
- package/dist/repositories/devicePairings/getDevicePairingsByImei.js +20 -0
- package/dist/repositories/devicePairings/index.js +90 -0
- package/dist/repositories/devicePairings/updateDevicePairing.js +32 -0
- package/dist/repositories/devices/createClientDeviceSetting.js +25 -0
- package/dist/repositories/devices/createDevice.js +30 -0
- package/dist/repositories/devices/createDeviceReplacement.js +34 -0
- package/dist/repositories/devices/createDeviceType.js +15 -0
- package/dist/repositories/devices/deleteDevice.js +16 -0
- package/dist/repositories/devices/generateDeviceIdentifierKey.js +18 -0
- package/dist/repositories/devices/getCanceledDevicesWithActiveSimCards.js +40 -0
- package/dist/repositories/devices/getCarrierStatusUpdatedBefore.js +40 -0
- package/dist/repositories/devices/getClientDeviceSetting.js +20 -0
- package/dist/repositories/devices/getClientDeviceSettings.js +17 -0
- package/dist/repositories/devices/getDevice.js +33 -0
- package/dist/repositories/devices/getDeviceCustomConfig.js +37 -0
- package/dist/repositories/devices/getDeviceTypeByImei.js +18 -0
- package/dist/repositories/devices/getDeviceTypes.js +30 -0
- package/dist/repositories/devices/getDeviceTypesModelsOrderedByDeviceCount.js +27 -0
- package/dist/repositories/devices/getDeviceWithUsersInfo.js +59 -0
- package/dist/repositories/devices/getDevices.js +46 -0
- package/dist/repositories/devices/getFilteredImeisWithStatus.js +20 -0
- package/dist/repositories/devices/getIccidStatus.js +17 -0
- package/dist/repositories/devices/getImeiIccidCarrier.js +23 -0
- package/dist/repositories/devices/getImeiIccidCarriers.js +17 -0
- package/dist/repositories/devices/index.js +464 -0
- package/dist/repositories/devices/updateClientDeviceSetting.js +38 -0
- package/dist/repositories/devices/updateDevice.js +56 -0
- package/dist/repositories/devices/updateDeviceType.js +43 -0
- package/dist/repositories/devices/updateIccidStatus.js +28 -0
- package/dist/repositories/devices/updateImeiIccidCarrier.js +43 -0
- package/dist/repositories/devices/upsertIccidStatus.js +36 -0
- package/dist/repositories/firmwares/createDeviceFirmware.js +37 -0
- package/dist/repositories/firmwares/createFirmwareAutoUpgradeBlacklist.js +16 -0
- package/dist/repositories/firmwares/createFirmwareUpgradeTask.js +36 -0
- package/dist/repositories/firmwares/getDeviceFirmwares.js +21 -0
- package/dist/repositories/firmwares/getFirmwareAutoUpgradeBlacklist.js +23 -0
- package/dist/repositories/firmwares/getFirmwareUpgradeTasks.js +105 -0
- package/dist/repositories/firmwares/getFirmwareUpgradeTasksCount.js +56 -0
- package/dist/repositories/firmwares/index.js +194 -0
- package/dist/repositories/firmwares/updateDeviceFirmware.js +41 -0
- package/dist/repositories/firmwares/updateFirmwareUpgradeTasks.js +37 -0
- package/dist/repositories/index.js +31 -0
- package/dist/repositories/notificationRecipients/createNotificationRecipient.js +37 -0
- package/dist/repositories/notificationRecipients/deleteNotificationRecipients.js +26 -0
- package/dist/repositories/notificationRecipients/deleteNotificationRecipientsByEmailOrPhone.js +28 -0
- package/dist/repositories/notificationRecipients/getNotificationRecipients.js +16 -0
- package/dist/repositories/notificationRecipients/index.js +131 -0
- package/dist/repositories/notificationRecipients/updateNotificationRecipient.js +37 -0
- package/dist/repositories/notificationRecipients/updateUsersNotificationsUnsubscribedInfoStatus.js +98 -0
- package/dist/repositories/notificationRecipients/updateUsersNotificationsUnsuscribedStatus.js +35 -0
- package/dist/repositories/positions/createPosition.js +100 -0
- package/dist/repositories/positions/getLatestPositionByImei.js +26 -0
- package/dist/repositories/positions/getPositionsByImei.js +23 -0
- package/dist/repositories/positions/getPositionsReportByClient.js +87 -0
- package/dist/repositories/positions/index.js +101 -0
- package/dist/repositories/positions/upsertLatestPosition.js +41 -0
- package/dist/repositories/security/createUserRole.js +30 -0
- package/dist/repositories/security/getAllRoles.js +8 -0
- package/dist/repositories/security/getUserRoles.js +15 -0
- package/dist/repositories/security/getUserRolesByClientId.js +17 -0
- package/dist/repositories/security/index.js +111 -0
- package/dist/repositories/security/removeUserRoles.js +21 -0
- package/dist/repositories/security/updateUserRole.js +27 -0
- package/dist/repositories/security/userIsAdminOrOwner.js +20 -0
- package/dist/repositories/security/userIsInRole.js +18 -0
- package/dist/repositories/tasks/addTaskScheduleDevices.js +37 -0
- package/dist/repositories/tasks/completeTask.js +25 -0
- package/dist/repositories/tasks/createTask.js +22 -0
- package/dist/repositories/tasks/createTaskSchedule.js +33 -0
- package/dist/repositories/tasks/deleteTask.js +22 -0
- package/dist/repositories/tasks/deleteTaskSchedule.js +22 -0
- package/dist/repositories/tasks/deleteTaskScheduleDevices.js +17 -0
- package/dist/repositories/tasks/getDeviceTasks.js +28 -0
- package/dist/repositories/tasks/getTaskSchedule.js +31 -0
- package/dist/repositories/tasks/getTaskSchedules.js +75 -0
- package/dist/repositories/tasks/getTaskSchedulesCount.js +23 -0
- package/dist/repositories/tasks/getTasks.js +29 -0
- package/dist/repositories/tasks/getTasksCount.js +20 -0
- package/dist/repositories/tasks/index.js +441 -0
- package/dist/repositories/tasks/setTaskAsPastDue.js +23 -0
- package/dist/repositories/tasks/setTaskScheduleDevices.js +43 -0
- package/dist/repositories/tasks/updateTask.js +21 -0
- package/dist/repositories/tasks/updateTaskSchedule.js +35 -0
- package/dist/repositories/trips/createTrip.js +29 -0
- package/dist/repositories/trips/getTripById.js +15 -0
- package/dist/repositories/trips/getTrips.js +65 -0
- package/dist/repositories/trips/index.js +69 -0
- package/dist/repositories/trips/updateTripEndValues.js +36 -0
- package/dist/repositories/trips/upsertTrip.js +31 -0
- package/dist/repositories/userActivations/createUserActivation.js +26 -0
- package/dist/repositories/userActivations/createUserActivationDevice.js +35 -0
- package/dist/repositories/userActivations/createUserActivationEvent.js +34 -0
- package/dist/repositories/userActivations/createUserActivationMetric.js +28 -0
- package/dist/repositories/userActivations/deleteUserActivation.js +22 -0
- package/dist/repositories/userActivations/getLastActivationDevice.js +26 -0
- package/dist/repositories/userActivations/getUserActivationDevices.js +24 -0
- package/dist/repositories/userActivations/getUserActivationDevicesByClientId.js +26 -0
- package/dist/repositories/userActivations/getUserActivationMetrics.js +24 -0
- package/dist/repositories/userActivations/getUserActivations.js +29 -0
- package/dist/repositories/userActivations/index.js +229 -0
- package/dist/repositories/userActivations/updateUserActivationDevice.js +39 -0
- package/dist/repositories/userActivations/updateUserActivationMetrics.js +61 -0
- package/dist/repositories/userAppFeedback/createUserAppFeedback.js +26 -0
- package/dist/repositories/userAppFeedback/index.js +23 -0
- package/dist/repositories/userAppIncidents/getUserAppIncidents.js +28 -0
- package/dist/repositories/userAppIncidents/index.js +63 -0
- package/dist/repositories/userAppIncidents/upsertUserAppIncident.js +53 -0
- package/dist/repositories/userConfigurations/bulkCreateUserAlertConfigurations.js +46 -0
- package/dist/repositories/userConfigurations/createDeviceAlertTimeWindows.js +36 -0
- package/dist/repositories/userConfigurations/createUserAlertTimeWindows.js +33 -0
- package/dist/repositories/userConfigurations/createUserConfiguration.js +34 -0
- package/dist/repositories/userConfigurations/deleteDeviceAlertTimeWindows.js +17 -0
- package/dist/repositories/userConfigurations/deleteUserAlertConfigurations.js +24 -0
- package/dist/repositories/userConfigurations/deleteUserAlertTimeWindows.js +17 -0
- package/dist/repositories/userConfigurations/deleteUserConfiguration.js +23 -0
- package/dist/repositories/userConfigurations/getDeviceAlertTimeWindows.js +43 -0
- package/dist/repositories/userConfigurations/getUserAlertConfigurations.js +25 -0
- package/dist/repositories/userConfigurations/getUserAlertTimeWindows.js +35 -0
- package/dist/repositories/userConfigurations/getUserConfigurations.js +31 -0
- package/dist/repositories/userConfigurations/index.js +298 -0
- package/dist/repositories/userConfigurations/updateDeviceAlertTimeWindows.js +29 -0
- package/dist/repositories/userConfigurations/updateUserAlertConfigurations.js +46 -0
- package/dist/repositories/userConfigurations/updateUserAlertTimeWindows.js +28 -0
- package/dist/repositories/userConfigurations/updateUserConfiguration.js +49 -0
- package/dist/repositories/userDataDeletionRequests/createUserDataDeletionRequest.js +28 -0
- package/dist/repositories/userDataDeletionRequests/getUserDataDeletionRequest.js +29 -0
- package/dist/repositories/userDataDeletionRequests/index.js +66 -0
- package/dist/repositories/userDataDeletionRequests/removeUserDataDeletionRequest.js +17 -0
- package/dist/repositories/userDataDeletionRequests/updateUserDataDeletionRequest.js +38 -0
- package/dist/repositories/userInvitations/createUserInvitation.js +43 -0
- package/dist/repositories/userInvitations/getUserInvitationById.js +22 -0
- package/dist/repositories/userInvitations/getUserInvitations.js +31 -0
- package/dist/repositories/userInvitations/index.js +82 -0
- package/dist/repositories/userInvitations/updateUserInvitation.js +50 -0
- package/dist/repositories/userRatingRequests/createUserRatingRequest.js +34 -0
- package/dist/repositories/userRatingRequests/getUserRatingRequests.js +23 -0
- package/dist/repositories/userRatingRequests/index.js +41 -0
- package/dist/repositories/userRegistrationAttempts/createUserRegistrationAttempt.js +40 -0
- package/dist/repositories/userRegistrationAttempts/getUserRegistrationAttempts.js +29 -0
- package/dist/repositories/userRegistrationAttempts/index.js +70 -0
- package/dist/repositories/userRegistrationAttempts/updateUserRegistrationAttempt.js +40 -0
- package/dist/repositories/users/createUser.js +47 -0
- package/dist/repositories/users/deleteAccount.js +98 -0
- package/dist/repositories/users/deleteUser.js +22 -0
- package/dist/repositories/users/getUserById.js +22 -0
- package/dist/repositories/users/getUserData.js +66 -0
- package/dist/repositories/users/getUsers.js +49 -0
- package/dist/repositories/users/getUsersConfigurationByImei.js +29 -0
- package/dist/repositories/users/getUsersIdByPhoneAndCountryCode.js +21 -0
- package/dist/repositories/users/getUsersWithRoles.js +32 -0
- package/dist/repositories/users/index.js +195 -0
- package/dist/repositories/users/updateUser.js +109 -0
- package/dist/subscribers/allEntitiesSubscriber.js +52 -0
- package/dist/subscribers/index.js +2 -0
- package/dist/types/acumatica.js +1 -0
- package/dist/types/aempToken.js +1 -0
- package/dist/types/alert.js +1 -0
- package/dist/types/alertTypes.js +1 -0
- package/dist/types/appFeatures.js +1 -0
- package/dist/types/billing.js +1 -0
- package/dist/types/blacklist.js +1 -0
- package/dist/types/boundaries.js +1 -0
- package/dist/types/clients.js +1 -0
- package/dist/types/common.js +1 -0
- package/dist/types/countries.js +1 -0
- package/dist/types/deactivations.js +1 -0
- package/dist/types/deviceBehaviors.js +1 -0
- package/dist/types/devicePairings.js +1 -0
- package/dist/types/devices.js +1 -0
- package/dist/types/enums.js +74 -0
- package/dist/types/firmwares.js +17 -0
- package/dist/types/index.js +30 -0
- package/dist/types/logger.js +9 -0
- package/dist/types/notificationRecipients.js +1 -0
- package/dist/types/position.js +1 -0
- package/dist/types/security.js +1 -0
- package/dist/types/tasks.js +1 -0
- package/dist/types/trip.js +29 -0
- package/dist/types/user.js +1 -0
- package/dist/types/userActivations.js +1 -0
- package/dist/types/userAppFeedback.js +1 -0
- package/dist/types/userAppIncidents.js +1 -0
- package/dist/types/userConfigurations.js +1 -0
- package/dist/types/userDataDeletionRequests.js +1 -0
- package/dist/types/userInvitations.js +1 -0
- package/dist/types/userRatingRequests.js +1 -0
- package/dist/types/userRegistrationAttempts.js +1 -0
- package/dist/utils/anyAttributeHasValue.js +20 -0
- package/dist/utils/anyAttributeIsNull.js +12 -0
- package/dist/utils/boolToNumberTransformer.js +23 -0
- package/dist/utils/consoleLogger.js +42 -0
- package/dist/utils/filterTools.js +299 -0
- package/dist/utils/mapRawEntityToEntity.js +12 -0
- package/dist/utils/queryLogger.js +48 -0
- package/dist/utils/randomizer.js +39 -0
- package/dist/utils/stringToDateTransformer.js +16 -0
- package/dist/utils/uuidHelpers.js +30 -0
- package/package.json +10 -8
- package/dist/index.js.LICENSE.txt +0 -41
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import { NovaDataSource } from '../../novaDataSource';
|
|
2
|
+
import { BaseRepository } from '../baseRepository';
|
|
3
|
+
import { createBilling } from './createBilling';
|
|
4
|
+
import { createBillingDeviceHistory } from './createBillingDeviceHistory';
|
|
5
|
+
import { createBillingHubspotPaymentLog } from './createBillingHubspotPaymentLog';
|
|
6
|
+
import { createBillingStatusHistoryBraintree } from './createBillingStatusHistoryBraintree';
|
|
7
|
+
import { getBillingCustomerBraintreeById } from './getBillingCustomerBraintreeById';
|
|
8
|
+
import { getBillingKlarnaOrderByImei } from './getBillingKlarnaOrderByImei';
|
|
9
|
+
import { getBillings } from './getBillings';
|
|
10
|
+
import { getBillingSubscriptionsBraintreeByImei } from './getBillingSubscriptionBraintreeByImei';
|
|
11
|
+
import { getBillingSubscriptionsBraintree } from './getBillingSubscriptionsBraintree';
|
|
12
|
+
import { getCanceledImeis } from './getCanceledImeis';
|
|
13
|
+
import { getCanceledImeisMatchingMagentoData } from './getCanceledImeisMatchingMagentoData';
|
|
14
|
+
import { getChurnStatusByClientId } from './getChurnStatusByClientId';
|
|
15
|
+
import { getClientIdFromBraintreeCustomer } from './getClientIdFromBraintreeCustomer';
|
|
16
|
+
import { getMagentoPlan } from './getMagentoPlan';
|
|
17
|
+
import { getUserByBraintreeCustomerId } from './getUserByBraintreeCustomerId';
|
|
18
|
+
import { updateBilling } from './updateBilling';
|
|
19
|
+
import { updateBillingCustomerBraintree } from './updateBillingCustomerBraintree';
|
|
20
|
+
import { upsertBillingCustomerBraintree } from './upsertBillingCustomerBraintree';
|
|
21
|
+
import { upsertBillingKlarnaCustomer } from './upsertBillingKlarnaCustomer';
|
|
22
|
+
import { upsertBillingKlarnaOrder } from './upsertBillingKlarnaOrder';
|
|
23
|
+
import { upsertBillingSubscriptionBraintree } from './upsertBillingSubscriptionBraintree';
|
|
24
|
+
export class BillingRepository extends BaseRepository {
|
|
25
|
+
/**
|
|
26
|
+
* Get billings
|
|
27
|
+
* @param {GetBillingsParams} params containing information to get billings
|
|
28
|
+
* One of the following filters is required:
|
|
29
|
+
* - filters.imei: The billing imei
|
|
30
|
+
* - filters.clientId: The billing clientId
|
|
31
|
+
* - filters.subscriptionId: The billing subscriptionId
|
|
32
|
+
* @returns The billings information
|
|
33
|
+
*/
|
|
34
|
+
async getBillings(params) {
|
|
35
|
+
this.logger.trace(params, 'BillingRepository::getBillings started with params');
|
|
36
|
+
const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger);
|
|
37
|
+
const result = await getBillings(novaDataSource, params, this.logger);
|
|
38
|
+
this.logger.trace(result, 'BillingRepository::getBillings result');
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Create billing
|
|
43
|
+
* @param {CreateBillingParams} params containing information to create billing
|
|
44
|
+
* One of the following parameters is required:
|
|
45
|
+
* - params.id: The billing id
|
|
46
|
+
* - params.deviceId: The billing deviceId
|
|
47
|
+
* - params.clientId: The billing clientId
|
|
48
|
+
* - params.subscriptionId: The billing subscriptionId
|
|
49
|
+
* - params.imei: The billing imei
|
|
50
|
+
* - params.planId: The billing planId
|
|
51
|
+
* - params.platform: The billing platform
|
|
52
|
+
* - params.status: The billing status
|
|
53
|
+
* - params.subscriptionValue: The billing subscriptionValue
|
|
54
|
+
* - params.subscriptionPeriodMonths: The billing subscriptionPeriodMonths
|
|
55
|
+
* - params.subscriptionValueMonthly: The billing subscriptionValueMonthly
|
|
56
|
+
* @returns The created billing information
|
|
57
|
+
*/
|
|
58
|
+
async createBilling(params) {
|
|
59
|
+
this.logger.trace(params, 'BillingRepository::createBilling started with params');
|
|
60
|
+
const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger);
|
|
61
|
+
const result = await createBilling(novaDataSource, params, this.logger);
|
|
62
|
+
this.logger.trace(result, 'BillingRepository::createBilling result');
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Update billing
|
|
67
|
+
* @param {UpdateBillingParams} params containing information to update billing
|
|
68
|
+
* - params.filters.imei: The billing imei
|
|
69
|
+
* One of the following parameters is required:
|
|
70
|
+
* - params.values.deviceId: The billing deviceId
|
|
71
|
+
* - params.values.clientId: The billing clientId
|
|
72
|
+
* - params.values.subscriptionId: The billing subscriptionId
|
|
73
|
+
* - params.values.planId: The billing planId
|
|
74
|
+
* - params.values.platform: The billing platform
|
|
75
|
+
* - params.values.status: The billing status
|
|
76
|
+
* - params.values.subscriptionValue: The billing subscriptionValue
|
|
77
|
+
* - params.values.subscriptionPeriodMonths: The billing subscriptionPeriodMonths
|
|
78
|
+
* - params.values.subscriptionValueMonthly: The billing subscriptionValueMonthly
|
|
79
|
+
* Whether the billing was updated or not
|
|
80
|
+
*/
|
|
81
|
+
async updateBilling(params) {
|
|
82
|
+
this.logger.trace(params, 'BillingRepository::updateBilling started with params');
|
|
83
|
+
const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger);
|
|
84
|
+
const result = await updateBilling(novaDataSource, params, this.logger);
|
|
85
|
+
this.logger.trace({ result }, 'BillingRepository::updateBilling result');
|
|
86
|
+
return result;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Get clientId from braintree customer
|
|
90
|
+
* @param {GetClientIdFromBraintreeCustomerParams} params containing information to get clientId from braintree customer
|
|
91
|
+
* - params.filters.customerId: The braintree customer id
|
|
92
|
+
* @returns The clientId
|
|
93
|
+
*/
|
|
94
|
+
async getClientIdFromBraintreeCustomer(params) {
|
|
95
|
+
this.logger.trace(params, 'BillingRepository::getClientIdFromBraintreeCustomer started with params');
|
|
96
|
+
const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger);
|
|
97
|
+
const result = await getClientIdFromBraintreeCustomer(novaDataSource, params, this.logger);
|
|
98
|
+
this.logger.trace({ result }, 'BillingRepository::getClientIdFromBraintreeCustomer result');
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Get billing customer braintree by id
|
|
103
|
+
* @param {GetBillingCustomerBraintreeByIdParams} params containing information to get billing customer braintree by id
|
|
104
|
+
* - params.filters.id: The billing customer braintree id
|
|
105
|
+
* @returns The billing customer braintree information
|
|
106
|
+
*/
|
|
107
|
+
async getBillingCustomerBraintreeById(params) {
|
|
108
|
+
this.logger.trace(params, 'BillingRepository::getBillingCustomerBraintreeById started with params');
|
|
109
|
+
const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger);
|
|
110
|
+
const result = await getBillingCustomerBraintreeById(novaDataSource, params, this.logger);
|
|
111
|
+
this.logger.trace(result, 'BillingRepository::getBillingCustomerBraintreeById result');
|
|
112
|
+
return result;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Update billing customer braintree
|
|
116
|
+
* @param {UpdateBillingCustomerBraintreeParams} params containing information to update billing customer braintree
|
|
117
|
+
* - params.filters.id: The billing customer braintree id
|
|
118
|
+
* One of the following parameters is required:
|
|
119
|
+
* - params.values.firstName: The billing customer braintree firstName
|
|
120
|
+
* - params.values.lastName: The billing customer braintree lastName
|
|
121
|
+
* - params.values.company: The billing customer braintree company
|
|
122
|
+
* - params.values.email: The billing customer braintree email
|
|
123
|
+
* - params.values.phone: The billing customer braintree phone
|
|
124
|
+
* - params.values.churnStatus: The billing customer braintree churnStatus
|
|
125
|
+
* @returns Whether the billing customer braintree was updated or not
|
|
126
|
+
*/
|
|
127
|
+
async updateBillingCustomerBraintree(params) {
|
|
128
|
+
this.logger.trace(params, 'BillingRepository::updateBillingCustomerBraintree started with params');
|
|
129
|
+
const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger);
|
|
130
|
+
const result = await updateBillingCustomerBraintree(novaDataSource, params, this.logger);
|
|
131
|
+
this.logger.trace({ result }, 'BillingRepository::updateBillingCustomerBraintree result');
|
|
132
|
+
return result;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Upsert billing customer braintree
|
|
136
|
+
* @param {UpsertBillingCustomerBraintreeParams} params containing information to upsert billing customer braintree
|
|
137
|
+
* If the billing customer braintree exists, it will be updated, otherwise it will be created.
|
|
138
|
+
* - params.id: The billing customer braintree id
|
|
139
|
+
* One of the following parameters is required:
|
|
140
|
+
* - params.firstName: The billing customer braintree firstName
|
|
141
|
+
* - params.lastName: The billing customer braintree lastName
|
|
142
|
+
* - params.company: The billing customer braintree company
|
|
143
|
+
* - params.email: The billing customer braintree email
|
|
144
|
+
* - params.phone: The billing customer braintree phone
|
|
145
|
+
* @returns The upserted billing customer braintree information
|
|
146
|
+
*/
|
|
147
|
+
async upsertBillingCustomerBraintree(params) {
|
|
148
|
+
this.logger.trace(params, 'BillingRepository::upsertBillingCustomerBraintree started with params');
|
|
149
|
+
const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger);
|
|
150
|
+
const result = await upsertBillingCustomerBraintree(novaDataSource, params, this.logger);
|
|
151
|
+
this.logger.trace(result, 'BillingRepository::upsertBillingCustomerBraintree result');
|
|
152
|
+
return result;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Create billing status history braintree
|
|
156
|
+
* @param {CreateBillingStatusHistoryBraintreeParams} params containing information to create billing status history braintree
|
|
157
|
+
* - params.subscriptionId: The subscriptionId, required
|
|
158
|
+
* - params.subscriptionHistories: The subscriptionHistories to create. At least one is required.
|
|
159
|
+
* @returns The created billing status history braintree information
|
|
160
|
+
*/
|
|
161
|
+
async createBillingStatusHistoryBraintree(params) {
|
|
162
|
+
this.logger.trace(params, 'BillingRepository::createBillingStatusHistoryBraintree started with params');
|
|
163
|
+
const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger);
|
|
164
|
+
const result = await createBillingStatusHistoryBraintree(novaDataSource, params, this.logger);
|
|
165
|
+
this.logger.trace(result, 'BillingRepository::createBillingStatusHistoryBraintree result');
|
|
166
|
+
return result;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Create billing device history
|
|
170
|
+
* @param {CreateBillingDeviceHistoryParams} params containing information to create billing device history
|
|
171
|
+
* One of the following parameters is required:
|
|
172
|
+
* - params.id: The billing device history id
|
|
173
|
+
* - params.deviceId: The deviceId
|
|
174
|
+
* - params.clientId: The clientId
|
|
175
|
+
* - params.subscriptionId: The subscriptionId
|
|
176
|
+
* - params.imei: The imei
|
|
177
|
+
* - params.planId: The planId
|
|
178
|
+
* - params.platform: The platform
|
|
179
|
+
* - params.status: The status
|
|
180
|
+
* @returns The created billing device history information
|
|
181
|
+
*/
|
|
182
|
+
async createBillingDeviceHistory(params) {
|
|
183
|
+
this.logger.trace(params, 'BillingRepository::createBillingDeviceHistory started with params');
|
|
184
|
+
const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger);
|
|
185
|
+
const result = await createBillingDeviceHistory(novaDataSource, params, this.logger);
|
|
186
|
+
this.logger.trace(result, 'BillingRepository::createBillingDeviceHistory result');
|
|
187
|
+
return result;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Get user by braintree customer id
|
|
191
|
+
* @param {GetUserByBraintreeCustomerIdParams} params containing information to get user by braintree customer id
|
|
192
|
+
* - params.filters.customerId: The braintree customer id
|
|
193
|
+
* @returns The user information
|
|
194
|
+
*/
|
|
195
|
+
async getUserByBraintreeCustomerId(params) {
|
|
196
|
+
this.logger.trace(params, 'BillingRepository::getUserByBraintreeCustomerId started with params');
|
|
197
|
+
const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger);
|
|
198
|
+
const result = await getUserByBraintreeCustomerId(novaDataSource, params, this.logger);
|
|
199
|
+
this.logger.trace(result, 'BillingRepository::getUserByBraintreeCustomerId result');
|
|
200
|
+
return result;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Get billing braintree subscriptions
|
|
204
|
+
* @param {GetBillingSubscriptionsBraintreeParams} params containing information to get billing braintree subscriptions
|
|
205
|
+
* - params.filters.subscriptionId: The braintree subscription id
|
|
206
|
+
* - params.filters.clientId: The clientId
|
|
207
|
+
* @returns The billing braintree subscriptions corresponding to the provided filters
|
|
208
|
+
*/
|
|
209
|
+
async getBillingSubscriptionsBraintree(params) {
|
|
210
|
+
this.logger.trace(params, 'BillingRepository::getBillingSubscriptionsBraintree started with params');
|
|
211
|
+
const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger);
|
|
212
|
+
const result = await getBillingSubscriptionsBraintree(novaDataSource, params, this.logger);
|
|
213
|
+
this.logger.trace(result, 'BillingRepository::getBillingSubscriptionsBraintree result');
|
|
214
|
+
return result;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Get churn status by clientId
|
|
218
|
+
* @param {GetChurnStatusByClientIdParams} params containing information to get billing braintree subscriptions
|
|
219
|
+
* - params.filters.clientId: The clientId
|
|
220
|
+
* @returns The churn status list for all subscriptions for the provided clientId
|
|
221
|
+
*/
|
|
222
|
+
async getChurnStatusByClientId(params) {
|
|
223
|
+
this.logger.trace(params, 'BillingRepository::getChurnStatusByClientId started with params');
|
|
224
|
+
const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger);
|
|
225
|
+
const result = await getChurnStatusByClientId(novaDataSource, params, this.logger);
|
|
226
|
+
this.logger.trace(result, 'BillingRepository::getChurnStatusByClientId result');
|
|
227
|
+
return result;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Upsert billing subscription braintree
|
|
231
|
+
* @param {UpsertBillingSubscriptionBraintreeParams} params containing information to upsert billing braintree subscription
|
|
232
|
+
* @returns Whether the billing braintree subscription was upserted
|
|
233
|
+
*/
|
|
234
|
+
async upsertBillingSubscriptionBraintree(params) {
|
|
235
|
+
this.logger.trace(params, 'BillingRepository::upsertBillingSubscriptionBraintree started with params');
|
|
236
|
+
const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger);
|
|
237
|
+
const result = await upsertBillingSubscriptionBraintree(novaDataSource, params, this.logger);
|
|
238
|
+
this.logger.trace({ result }, 'BillingRepository::upsertBillingSubscriptionBraintree result');
|
|
239
|
+
return result;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Get canceled imei
|
|
243
|
+
* @param {GetCanceledImeisParams} params containing information to get canceled imeis
|
|
244
|
+
* - params.filters.minCancellationDate: The min cancellation date
|
|
245
|
+
* - params.filters.maxCancellationDate: The max cancellation date
|
|
246
|
+
* - params.filters.canceledIn: which canceled status to check by ('carrier', 'device' or 'both')
|
|
247
|
+
* - params.filters.excludeB2B: whether to exclude devices from B2B clients
|
|
248
|
+
* - params.filters.excludeTest: whether to exclude devices from test clients
|
|
249
|
+
* - params.pagingOptions.pageSize: max elements to return
|
|
250
|
+
* @returns The list of canceled imeis
|
|
251
|
+
*/
|
|
252
|
+
async getCanceledImeis(params) {
|
|
253
|
+
this.logger.trace(params, 'BillingRepository::getCanceledImeis started with params');
|
|
254
|
+
const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger);
|
|
255
|
+
const result = await getCanceledImeis(novaDataSource, params, this.logger);
|
|
256
|
+
this.logger.trace(result, 'BillingRepository::getCanceledImeis result');
|
|
257
|
+
return result;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Get canceled imei matching magento data
|
|
261
|
+
* @param {GetCanceledImeisParams} params containing information to get canceled imeis matching magento data
|
|
262
|
+
* - params.filters.minCancellationDate: The min cancellation date
|
|
263
|
+
* - params.filters.maxCancellationDate: The max cancellation date
|
|
264
|
+
* - params.filters.canceledIn: which canceled status to check by ('carrier', 'device' or 'both')
|
|
265
|
+
* - params.filters.excludeB2B: whether to exclude devices from B2B clients
|
|
266
|
+
* - params.filters.excludeTest: whether to exclude devices from test clients
|
|
267
|
+
* - params.pagingOptions.pageSize: max elements to return
|
|
268
|
+
* @returns The list of canceled imeis
|
|
269
|
+
*/
|
|
270
|
+
async getCanceledImeisMatchingMagentoData(params) {
|
|
271
|
+
this.logger.trace(params, 'BillingRepository::getCanceledImeis started with params');
|
|
272
|
+
const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger);
|
|
273
|
+
const result = await getCanceledImeisMatchingMagentoData(novaDataSource, params, this.logger);
|
|
274
|
+
this.logger.trace(result, 'BillingRepository::getCanceledImeisMatchingMagentoData result');
|
|
275
|
+
return result;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Get magento plan
|
|
279
|
+
* @param {GetMagentoPlanParams} params containing information to get magento plan
|
|
280
|
+
* - params.filters.annual: Whether the plan is annual
|
|
281
|
+
* - params.filters.code: The plan code
|
|
282
|
+
* @returns The magento plan
|
|
283
|
+
*/
|
|
284
|
+
async getMagentoPlan(params) {
|
|
285
|
+
this.logger.trace(params, 'BillingRepository::getMagentoPlan started with params');
|
|
286
|
+
const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger);
|
|
287
|
+
const result = await getMagentoPlan(novaDataSource, params, this.logger);
|
|
288
|
+
this.logger.trace(result, 'BillingRepository::getMagentoPlan result');
|
|
289
|
+
return result;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Create billing hubspot payment log
|
|
293
|
+
* @param {CreateBillingHubspotPaymentLogParams} params containing information to create billing hubspot payment log
|
|
294
|
+
* @returns The created billing hubspot payment log information
|
|
295
|
+
*/
|
|
296
|
+
async createBillingHubspotPaymentLog(params) {
|
|
297
|
+
this.logger.trace(params, 'BillingRepository::createBillingHubspotPaymentLog started with params');
|
|
298
|
+
const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger);
|
|
299
|
+
const result = await createBillingHubspotPaymentLog(novaDataSource, params, this.logger);
|
|
300
|
+
this.logger.trace(result, 'BillingRepository::createBillingHubspotPaymentLog result');
|
|
301
|
+
return result;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Upsert billing klarna customer
|
|
305
|
+
* @param {UpsertBillingKlarnaCustomerParams} params containing information to upsert billing klarna customer
|
|
306
|
+
* @returns The upserted billing klarna customer information
|
|
307
|
+
*/
|
|
308
|
+
async upsertBillingKlarnaCustomer(params) {
|
|
309
|
+
this.logger.trace(params, 'BillingRepository::upsertBillingKlarnaCustomer started with params');
|
|
310
|
+
const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger);
|
|
311
|
+
const result = await upsertBillingKlarnaCustomer(novaDataSource, params, this.logger);
|
|
312
|
+
this.logger.trace(result, 'BillingRepository::upsertBillingKlarnaCustomer result');
|
|
313
|
+
return result;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Upsert billing klarna order
|
|
317
|
+
* @param {UpsertBillingKlarnaOrderParams} params containing information to upsert billing klarna order
|
|
318
|
+
* @returns The upserted billing klarna order information
|
|
319
|
+
*/
|
|
320
|
+
async upsertBillingKlarnaOrder(params) {
|
|
321
|
+
this.logger.trace(params, 'BillingRepository::upsertBillingKlarnaOrder started with params');
|
|
322
|
+
const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger);
|
|
323
|
+
const result = await upsertBillingKlarnaOrder(novaDataSource, params, this.logger);
|
|
324
|
+
this.logger.trace(result, 'BillingRepository::upsertBillingKlarnaOrder result');
|
|
325
|
+
return result;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Get billing subscription braintree by imei
|
|
329
|
+
* @param {BillingSubscriptionParams} params
|
|
330
|
+
* - imei: The imei of the device
|
|
331
|
+
* @returns {Promise<BillingSubscriptionBraintree>} The billing subscription braintree information
|
|
332
|
+
*/
|
|
333
|
+
async getBillingSubscriptionsBraintreeByImei(params) {
|
|
334
|
+
this.logger.trace(params, 'BillingRepository::getBillingSubscriptionsBraintreeByImei started with params');
|
|
335
|
+
const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger);
|
|
336
|
+
const result = await getBillingSubscriptionsBraintreeByImei(novaDataSource, params, this.logger);
|
|
337
|
+
this.logger.trace(result, 'BillingRepository::getBillingSubscriptionsBraintreeByImei result');
|
|
338
|
+
return result;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Get billing klarna order by imei
|
|
342
|
+
* @param {BillingSubscriptionParams} params
|
|
343
|
+
* - imei: The imei of the device
|
|
344
|
+
* @returns {Promise<BillingSubscriptionBraintree>} The billing klarna order information
|
|
345
|
+
*/
|
|
346
|
+
async getBillingKlarnaOrderByImei(params) {
|
|
347
|
+
this.logger.trace(params, 'BillingRepository::getBillingKlarnaOrderByImei started with params');
|
|
348
|
+
const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger);
|
|
349
|
+
const result = await getBillingKlarnaOrderByImei(novaDataSource, params, this.logger);
|
|
350
|
+
this.logger.trace(result, 'BillingRepository::getBillingKlarnaOrderByImei result');
|
|
351
|
+
return result;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Billing } from '../../entities';
|
|
2
|
+
export const updateBilling = async (novaDataSource, params, logger) => {
|
|
3
|
+
// clientId is required
|
|
4
|
+
if (!params?.filters?.imei) {
|
|
5
|
+
logger.warn({ params }, 'BillingRepository::updateBilling - missing required parameters');
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
// at least one field to update is required
|
|
9
|
+
if (!params?.values?.deviceId &&
|
|
10
|
+
!params?.values?.clientId &&
|
|
11
|
+
!params?.values?.subscriptionId &&
|
|
12
|
+
!params?.values?.planId &&
|
|
13
|
+
!params?.values?.platform &&
|
|
14
|
+
!params?.values?.status &&
|
|
15
|
+
!params?.values?.subscriptionValue &&
|
|
16
|
+
!params?.values?.subscriptionPeriodMonths &&
|
|
17
|
+
!params?.values?.subscriptionValueMonthly) {
|
|
18
|
+
logger.warn({ params }, 'BillingRepository::updateBilling - missing required parameters');
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
return novaDataSource.safeQuery(async (dataSource) => {
|
|
22
|
+
const billingRepository = dataSource.getRepository(Billing);
|
|
23
|
+
const now = new Date();
|
|
24
|
+
const result = await billingRepository
|
|
25
|
+
.createQueryBuilder()
|
|
26
|
+
.update(Billing)
|
|
27
|
+
.set({
|
|
28
|
+
deviceId: params.values.deviceId,
|
|
29
|
+
clientId: params.values.clientId,
|
|
30
|
+
subscriptionId: params.values.subscriptionId,
|
|
31
|
+
planId: params.values.planId,
|
|
32
|
+
platform: params.values.platform,
|
|
33
|
+
status: params.values.status,
|
|
34
|
+
subscriptionValue: params.values.subscriptionValue,
|
|
35
|
+
subscriptionPeriodMonths: params.values.subscriptionPeriodMonths,
|
|
36
|
+
subscriptionValueMonthly: params.values.subscriptionValueMonthly,
|
|
37
|
+
updatedAt: now,
|
|
38
|
+
})
|
|
39
|
+
.where('imei = :imei', { imei: params.filters.imei })
|
|
40
|
+
.execute();
|
|
41
|
+
return result.affected > 0;
|
|
42
|
+
}, 'BillingRepository::updateBilling');
|
|
43
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { BillingCustomerBraintree } from '../../entities';
|
|
2
|
+
export const updateBillingCustomerBraintree = async (novaDataSource, params, logger) => {
|
|
3
|
+
// clientId is required
|
|
4
|
+
if (!params?.filters?.id) {
|
|
5
|
+
logger.warn({ params }, 'BillingRepository::updateBillingCustomerBraintree - missing required parameters');
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
// at least one field to update is required
|
|
9
|
+
if (!params?.values?.firstName &&
|
|
10
|
+
!params?.values?.lastName &&
|
|
11
|
+
!params?.values?.company &&
|
|
12
|
+
!params?.values?.email &&
|
|
13
|
+
!params?.values?.phone &&
|
|
14
|
+
!params?.values?.churnStatus) {
|
|
15
|
+
logger.warn({ params }, 'BillingRepository::updateBillingCustomerBraintree - missing required parameters');
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
return novaDataSource.safeQuery(async (dataSource) => {
|
|
19
|
+
const billingCustomerBraintreeRepository = dataSource.getRepository(BillingCustomerBraintree);
|
|
20
|
+
const now = new Date();
|
|
21
|
+
const result = await billingCustomerBraintreeRepository
|
|
22
|
+
.createQueryBuilder()
|
|
23
|
+
.update(BillingCustomerBraintree)
|
|
24
|
+
.set({
|
|
25
|
+
firstName: params.values.firstName,
|
|
26
|
+
lastName: params.values.lastName,
|
|
27
|
+
company: params.values.company,
|
|
28
|
+
email: params.values.email,
|
|
29
|
+
phone: params.values.phone,
|
|
30
|
+
churnStatus: params.values.churnStatus,
|
|
31
|
+
updatedAt: now,
|
|
32
|
+
})
|
|
33
|
+
.where('id = :id', { id: params.filters.id })
|
|
34
|
+
.execute();
|
|
35
|
+
return result.affected > 0;
|
|
36
|
+
}, 'BillingRepository::updateBillingCustomerBraintree');
|
|
37
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { BillingCustomerBraintree } from '../../entities';
|
|
2
|
+
export const upsertBillingCustomerBraintree = async (novaDataSource, params, logger) => {
|
|
3
|
+
// id is required
|
|
4
|
+
if (!params?.id) {
|
|
5
|
+
logger.warn({ params }, 'BillingRepository::upsertBillingCustomerBraintree - missing required parameters');
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
// at least one field to update is required
|
|
9
|
+
if (!params?.firstName &&
|
|
10
|
+
!params?.lastName &&
|
|
11
|
+
!params?.company &&
|
|
12
|
+
!params?.email &&
|
|
13
|
+
!params?.phone) {
|
|
14
|
+
logger.warn({ params }, 'BillingRepository::upsertBillingCustomerBraintree - missing required parameters');
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return novaDataSource.safeQuery(async (dataSource) => {
|
|
18
|
+
const billingCustomerBraintreeRepository = dataSource.getRepository(BillingCustomerBraintree);
|
|
19
|
+
const existingBillingCustomerBraintree = await billingCustomerBraintreeRepository.findOne({
|
|
20
|
+
where: {
|
|
21
|
+
id: params.id,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
const now = new Date();
|
|
25
|
+
const billingCustomerBraintree = {
|
|
26
|
+
id: params.id,
|
|
27
|
+
firstName: params.firstName,
|
|
28
|
+
lastName: params.lastName,
|
|
29
|
+
company: params.company,
|
|
30
|
+
email: params.email,
|
|
31
|
+
phone: params.phone,
|
|
32
|
+
churnStatus: existingBillingCustomerBraintree?.churnStatus,
|
|
33
|
+
createdAt: existingBillingCustomerBraintree?.createdAt ?? now,
|
|
34
|
+
updatedAt: now,
|
|
35
|
+
};
|
|
36
|
+
const result = await billingCustomerBraintreeRepository.save(billingCustomerBraintree);
|
|
37
|
+
return result;
|
|
38
|
+
}, 'BillingRepository::upsertBillingCustomerBraintree');
|
|
39
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { BillingKlarnaCustomer } from '../../entities';
|
|
2
|
+
export const upsertBillingKlarnaCustomer = async (novaDataSource, params, logger) => {
|
|
3
|
+
// id is required
|
|
4
|
+
if (!params?.id) {
|
|
5
|
+
logger.warn({ params }, 'BillingRepository::upsertBillingKlarnaCustomer - missing required parameters');
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
// at least one field to update is required
|
|
9
|
+
if (!params?.firstName &&
|
|
10
|
+
!params?.lastName &&
|
|
11
|
+
!params?.billingEmail &&
|
|
12
|
+
!params?.shippingEmail &&
|
|
13
|
+
!params?.streetAddress &&
|
|
14
|
+
!params?.city &&
|
|
15
|
+
!params?.region &&
|
|
16
|
+
!params?.country &&
|
|
17
|
+
!params?.postalCode &&
|
|
18
|
+
!params?.phone &&
|
|
19
|
+
!params?.createdAt) {
|
|
20
|
+
logger.warn({ params }, 'BillingRepository::upsertBillingKlarnaCustomer - missing required parameters');
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
return novaDataSource.safeQuery(async (dataSource) => {
|
|
24
|
+
const billingKlarnaCustomerRepository = dataSource.getRepository(BillingKlarnaCustomer);
|
|
25
|
+
const now = new Date();
|
|
26
|
+
const billingKlarnaCustomer = {
|
|
27
|
+
id: params.id ? params.id : undefined,
|
|
28
|
+
firstName: params.firstName ? params.firstName : undefined,
|
|
29
|
+
lastName: params.lastName ? params.lastName : undefined,
|
|
30
|
+
billingEmail: params.billingEmail ? params.billingEmail : undefined,
|
|
31
|
+
shippingEmail: params.shippingEmail ? params.shippingEmail : undefined,
|
|
32
|
+
streetAddress: params.streetAddress ? params.streetAddress : undefined,
|
|
33
|
+
city: params.city ? params.city : undefined,
|
|
34
|
+
region: params.region ? params.region : undefined,
|
|
35
|
+
country: params.country ? params.country : undefined,
|
|
36
|
+
postalCode: params.postalCode ? params.postalCode : undefined,
|
|
37
|
+
phone: params.phone ? params.phone : undefined,
|
|
38
|
+
createdAt: params.createdAt ?? now,
|
|
39
|
+
};
|
|
40
|
+
const upsertResult = await billingKlarnaCustomerRepository.upsert(billingKlarnaCustomer, {
|
|
41
|
+
conflictPaths: ['id'],
|
|
42
|
+
});
|
|
43
|
+
const upsertedCustomer = upsertResult?.raw?.affectedRows > 0
|
|
44
|
+
? await billingKlarnaCustomerRepository.findOne({
|
|
45
|
+
where: {
|
|
46
|
+
id: params.id,
|
|
47
|
+
},
|
|
48
|
+
})
|
|
49
|
+
: null;
|
|
50
|
+
return upsertedCustomer;
|
|
51
|
+
}, 'BillingRepository::upsertBillingKlarnaCustomer');
|
|
52
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { BillingKlarnaOrder } from '../../entities';
|
|
2
|
+
export const upsertBillingKlarnaOrder = async (novaDataSource, params, logger) => {
|
|
3
|
+
// id is required
|
|
4
|
+
if (!params?.deviceId || !params?.klarnaCustomerId || !params?.orderId) {
|
|
5
|
+
logger.warn({ params }, 'BillingRepository::upsertBillingKlarnaOrder - missing required parameters');
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
// at least one field to update is required
|
|
9
|
+
if (!params?.planId &&
|
|
10
|
+
!params?.createdAt &&
|
|
11
|
+
!params?.subscriptionStart &&
|
|
12
|
+
!params?.subscriptionEnd &&
|
|
13
|
+
!params?.nextBillingDate &&
|
|
14
|
+
!params?.subscriptionValue &&
|
|
15
|
+
!params?.status &&
|
|
16
|
+
!params?.paymentType &&
|
|
17
|
+
!params?.discounts &&
|
|
18
|
+
!params?.addOns &&
|
|
19
|
+
!params?.nextBillingPeriodAmount &&
|
|
20
|
+
!params?.paymentMethodToken) {
|
|
21
|
+
logger.warn({ params }, 'BillingRepository::upsertBillingKlarnaOrder - missing required parameters');
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
return novaDataSource.safeQuery(async (dataSource) => {
|
|
25
|
+
const billingKlarnaOrderRepository = dataSource.getRepository(BillingKlarnaOrder);
|
|
26
|
+
const now = new Date();
|
|
27
|
+
const billingKlarnaOrder = {
|
|
28
|
+
deviceId: params.deviceId ? params.deviceId : undefined,
|
|
29
|
+
klarnaCustomerId: params.klarnaCustomerId ? params.klarnaCustomerId : undefined,
|
|
30
|
+
orderId: params.orderId ? params.orderId : undefined,
|
|
31
|
+
planId: params.planId ? params.planId : undefined,
|
|
32
|
+
createdAt: params.createdAt ?? now,
|
|
33
|
+
subscriptionStart: params.subscriptionStart ? params.subscriptionStart : undefined,
|
|
34
|
+
subscriptionEnd: params.subscriptionEnd ? params.subscriptionEnd : undefined,
|
|
35
|
+
nextBillingDate: params.nextBillingDate ? params.nextBillingDate : undefined,
|
|
36
|
+
subscriptionValue: params.subscriptionValue ? params.subscriptionValue : undefined,
|
|
37
|
+
status: params.status ? params.status : undefined,
|
|
38
|
+
paymentType: params.paymentType ? params.paymentType : undefined,
|
|
39
|
+
discounts: params.discounts ? params.discounts : undefined,
|
|
40
|
+
addOns: params.addOns ? params.addOns : undefined,
|
|
41
|
+
nextBillingPeriodAmount: params.nextBillingPeriodAmount
|
|
42
|
+
? params.nextBillingPeriodAmount
|
|
43
|
+
: undefined,
|
|
44
|
+
paymentMethodToken: params.paymentMethodToken ? params.paymentMethodToken : undefined,
|
|
45
|
+
};
|
|
46
|
+
const upsertResult = await billingKlarnaOrderRepository.upsert(billingKlarnaOrder, {
|
|
47
|
+
conflictPaths: ['deviceId'],
|
|
48
|
+
});
|
|
49
|
+
const insertedOrder = upsertResult?.raw?.affectedRows > 0
|
|
50
|
+
? await billingKlarnaOrderRepository.findOne({
|
|
51
|
+
where: {
|
|
52
|
+
deviceId: params.deviceId,
|
|
53
|
+
},
|
|
54
|
+
})
|
|
55
|
+
: null;
|
|
56
|
+
return insertedOrder;
|
|
57
|
+
}, 'BillingRepository::upsertBillingKlarnaOrder');
|
|
58
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BillingSubscriptionBraintree } from '../../entities';
|
|
2
|
+
export const upsertBillingSubscriptionBraintree = async (novaDataSource, params, logger) => {
|
|
3
|
+
// id is required
|
|
4
|
+
if (!params?.subscriptionId) {
|
|
5
|
+
logger.warn({ params }, 'BillingRepository::upsertBillingSubscriptionBraintree - missing required parameters');
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
return novaDataSource.safeQuery(async (dataSource) => {
|
|
9
|
+
const billingSubscriptionBraintreeRepository = dataSource.getRepository(BillingSubscriptionBraintree);
|
|
10
|
+
const now = new Date();
|
|
11
|
+
const billingSubscriptionBraintree = {
|
|
12
|
+
...params,
|
|
13
|
+
createdAt: params.createdAt ?? now,
|
|
14
|
+
};
|
|
15
|
+
const result = await billingSubscriptionBraintreeRepository.upsert(billingSubscriptionBraintree, {
|
|
16
|
+
conflictPaths: ['subscriptionId'],
|
|
17
|
+
});
|
|
18
|
+
return result?.raw?.affectedRows > 0;
|
|
19
|
+
}, 'BillingRepository::upsertBillingSubscriptionBraintree');
|
|
20
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Blacklist, BlacklistType } from '../../entities';
|
|
2
|
+
export const getBlacklists = async (novaDataSource, params, logger) => {
|
|
3
|
+
if (!params?.filters?.blacklistType && !params?.filters?.value) {
|
|
4
|
+
logger.warn({ params }, 'BlacklistRepository::getBlacklists - missing required parameters');
|
|
5
|
+
return [];
|
|
6
|
+
}
|
|
7
|
+
return novaDataSource.safeQuery(async (dataSource) => {
|
|
8
|
+
const blacklistRepository = dataSource.getRepository(Blacklist);
|
|
9
|
+
const queryBuilder = blacklistRepository
|
|
10
|
+
.createQueryBuilder('blacklist')
|
|
11
|
+
.innerJoin(BlacklistType, 'blacklistType', 'blacklistType.id = blacklist.blacklistTypeId')
|
|
12
|
+
.where('blacklist.blacklistTypeId = :blacklistType', {
|
|
13
|
+
blacklistType: params.filters.blacklistType,
|
|
14
|
+
})
|
|
15
|
+
.andWhere('LOWER(blacklist.value) = LOWER(:value)', { value: params.filters.value });
|
|
16
|
+
const result = await queryBuilder.getMany();
|
|
17
|
+
return result;
|
|
18
|
+
}, 'BlacklistRepository::getBlacklists');
|
|
19
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { NovaDataSource } from '../../novaDataSource';
|
|
2
|
+
import { BaseRepository } from '../baseRepository';
|
|
3
|
+
import { getBlacklists } from './getBlacklists';
|
|
4
|
+
export class BlacklistRepository extends BaseRepository {
|
|
5
|
+
/**
|
|
6
|
+
* Get blacklists
|
|
7
|
+
* @param {GetBlacklistsParams} params containing information to get blacklists
|
|
8
|
+
* - filters.blacklistType The blacklist type
|
|
9
|
+
* - filters.value The value
|
|
10
|
+
* @returns The blacklists information
|
|
11
|
+
*/
|
|
12
|
+
async getBlacklists(params) {
|
|
13
|
+
this.logger.trace(params, 'BlacklistRepository::getBlacklists started with params');
|
|
14
|
+
const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger);
|
|
15
|
+
const result = await getBlacklists(novaDataSource, params, this.logger);
|
|
16
|
+
this.logger.trace(result, 'BlacklistRepository::getBlacklists result');
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
}
|