Compare commits

...

11 Commits

Author SHA1 Message Date
standardci 600ff1d62b chore(release): publish new version
- @standardnotes/api-gateway@1.7.1
 - @standardnotes/auth-server@1.12.1
 - @standardnotes/files-server@1.5.29
 - @standardnotes/scheduler-server@1.10.1
 - @standardnotes/syncing-server@1.6.31
2022-07-27 11:14:05 +00:00
Karol Sójko 094dc192a9 chore(deps): upgrade npm-check-updates 2022-07-27 13:12:25 +02:00
standardci 939bf30138 chore(release): publish new version
- @standardnotes/api-gateway@1.7.0
2022-07-26 13:00:56 +00:00
Karol Sójko d203ce188a feat(api-gateway): add limited discount offer purchased to analytics report 2022-07-26 14:59:23 +02:00
standardci 268fed19f9 chore(release): publish new version
- @standardnotes/analytics@1.9.0
 - @standardnotes/api-gateway@1.6.30
 - @standardnotes/auth-server@1.12.0
 - @standardnotes/domain-events-infra@1.7.28
 - @standardnotes/domain-events@2.51.0
 - @standardnotes/event-store@1.1.27
 - @standardnotes/files-server@1.5.28
 - @standardnotes/scheduler-server@1.10.0
 - @standardnotes/syncing-server@1.6.30
2022-07-26 11:54:06 +00:00
Karol Sójko 04bf414de4 feat(scheduler): enable discount applying and withdraw for everyone 2022-07-26 13:52:34 +02:00
Karol Sójko 28e1c65631 feat(domain-events): add discount code to subscription purchased event 2022-07-26 13:52:34 +02:00
Karol Sójko e936ac4ce1 feat(auth): add analytics for purchased subscription with a limited discount offer 2022-07-26 13:52:34 +02:00
Karol Sójko 13201e7a9e feat(analytics): add limited discount offer purchased activity 2022-07-26 13:52:34 +02:00
standardci 9740b28764 chore(release): publish new version
- @standardnotes/scheduler-server@1.9.2
2022-07-26 10:37:12 +00:00
Karol Sójko 1fa94efa02 fix(scheduler): change the discount code to an absolute discount 2022-07-26 12:35:16 +02:00
30 changed files with 169 additions and 67 deletions
Generated
+10 -10
View File
@@ -122,7 +122,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
["eslint-config-prettier", "virtual:8859b278716fedf3e7458b5628625f7e35678c418626878559a0b816445001b7e24c55546f4677ba4c20b521aa0cf52cc33ac07deff171e383ada6eeab69933f#npm:8.5.0"],\
["ini", "npm:3.0.0"],\
["newrelic", "npm:8.14.1"],\
["npm-check-updates", "npm:15.3.3"],\
["npm-check-updates", "npm:16.0.1"],\
["prettier", "npm:2.7.1"],\
["ts-node", "virtual:c0eab07e71af57f5501e97e7ca7a2a4f4965035bd2455ad124a8b09fa55780657c55fe3df41019fa6c2c44487c897668c842a0939e380b3c1f13b3756d128543#npm:10.8.2"],\
["typescript", "patch:typescript@npm%3A4.7.4#~builtin<compat/typescript>::version=4.7.4&hash=7ad353"]\
@@ -2538,7 +2538,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
["jsonwebtoken", "npm:8.5.1"],\
["newrelic", "npm:8.14.1"],\
["nodemon", "npm:2.0.19"],\
["npm-check-updates", "npm:15.3.3"],\
["npm-check-updates", "npm:16.0.1"],\
["prettyjson", "npm:1.2.5"],\
["reflect-metadata", "npm:0.1.13"],\
["ts-jest", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:28.0.5"],\
@@ -2606,7 +2606,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
["mysql2", "npm:2.3.3"],\
["newrelic", "npm:8.14.1"],\
["nodemon", "npm:2.0.19"],\
["npm-check-updates", "npm:15.3.3"],\
["npm-check-updates", "npm:16.0.1"],\
["otplib", "npm:12.0.1"],\
["prettyjson", "npm:1.2.5"],\
["reflect-metadata", "npm:0.1.13"],\
@@ -2790,7 +2790,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
["jsonwebtoken", "npm:8.5.1"],\
["newrelic", "npm:8.14.1"],\
["nodemon", "npm:2.0.19"],\
["npm-check-updates", "npm:15.3.3"],\
["npm-check-updates", "npm:16.0.1"],\
["prettyjson", "npm:1.2.5"],\
["reflect-metadata", "npm:0.1.13"],\
["ts-jest", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:28.0.5"],\
@@ -2882,7 +2882,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
["jest", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:28.1.2"],\
["mysql2", "npm:2.3.3"],\
["newrelic", "npm:8.14.1"],\
["npm-check-updates", "npm:15.3.3"],\
["npm-check-updates", "npm:16.0.1"],\
["reflect-metadata", "npm:0.1.13"],\
["ts-jest", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:28.0.5"],\
["typeorm", "virtual:31b5a94a105c89c9294c3d524a7f8929fe63ee5a2efadf21951ca4c0cfd2ecf02e8f4ef5a066bbda091f1e3a56e57c6749069a080618c96b22e51131a330fc4a#npm:0.3.7"],\
@@ -2928,7 +2928,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
["eslint-config-prettier", "virtual:8859b278716fedf3e7458b5628625f7e35678c418626878559a0b816445001b7e24c55546f4677ba4c20b521aa0cf52cc33ac07deff171e383ada6eeab69933f#npm:8.5.0"],\
["ini", "npm:3.0.0"],\
["newrelic", "npm:8.14.1"],\
["npm-check-updates", "npm:15.3.3"],\
["npm-check-updates", "npm:16.0.1"],\
["prettier", "npm:2.7.1"],\
["ts-node", "virtual:c0eab07e71af57f5501e97e7ca7a2a4f4965035bd2455ad124a8b09fa55780657c55fe3df41019fa6c2c44487c897668c842a0939e380b3c1f13b3756d128543#npm:10.8.2"],\
["typescript", "patch:typescript@npm%3A4.7.4#~builtin<compat/typescript>::version=4.7.4&hash=7ad353"]\
@@ -3035,7 +3035,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
["mysql2", "npm:2.3.3"],\
["newrelic", "npm:8.14.1"],\
["nodemon", "npm:2.0.19"],\
["npm-check-updates", "npm:15.3.3"],\
["npm-check-updates", "npm:16.0.1"],\
["prettyjson", "npm:1.2.5"],\
["reflect-metadata", "npm:0.1.13"],\
["ts-jest", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:28.0.5"],\
@@ -9776,10 +9776,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
}]\
]],\
["npm-check-updates", [\
["npm:15.3.3", {\
"packageLocation": "./.yarn/cache/npm-check-updates-npm-15.3.3-146d2ff74b-3ee33fe369.zip/node_modules/npm-check-updates/",\
["npm:16.0.1", {\
"packageLocation": "./.yarn/cache/npm-check-updates-npm-16.0.1-fd143fcd27-1e747421f3.zip/node_modules/npm-check-updates/",\
"packageDependencies": [\
["npm-check-updates", "npm:15.3.3"],\
["npm-check-updates", "npm:16.0.1"],\
["chalk", "npm:5.0.1"],\
["cli-table", "npm:0.3.11"],\
["commander", "npm:9.3.0"],\
+1 -1
View File
@@ -58,7 +58,7 @@
"eslint": "^8.17.0",
"eslint-config-prettier": "^8.5.0",
"ini": "^3.0.0",
"npm-check-updates": "^15.3.3",
"npm-check-updates": "^16.0.1",
"prettier": "^2.7.1",
"ts-node": "^10.8.1",
"typescript": "^4.7.4"
+6
View File
@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [1.9.0](https://github.com/standardnotes/server/compare/@standardnotes/analytics@1.8.3...@standardnotes/analytics@1.9.0) (2022-07-26)
### Features
* **analytics:** add limited discount offer purchased activity ([13201e7](https://github.com/standardnotes/server/commit/13201e7a9ec875796f527b2c500cf631345c36dd))
## [1.8.3](https://github.com/standardnotes/server/compare/@standardnotes/analytics@1.8.2...@standardnotes/analytics@1.8.3) (2022-07-15)
### Bug Fixes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/analytics",
"version": "1.8.3",
"version": "1.9.0",
"engines": {
"node": ">=14.0.0 <17.0.0"
},
@@ -3,4 +3,5 @@ export enum AnalyticsActivity {
Login = 'login',
EmailUnbackedUpData = 'email-unbacked-up-data',
EmailBackup = 'email-backup',
LimitedDiscountOfferPurchased = 'limited-discount-offer-purchased',
}
+14
View File
@@ -3,6 +3,20 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.7.1](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.7.0...@standardnotes/api-gateway@1.7.1) (2022-07-27)
**Note:** Version bump only for package @standardnotes/api-gateway
# [1.7.0](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.6.30...@standardnotes/api-gateway@1.7.0) (2022-07-26)
### Features
* **api-gateway:** add limited discount offer purchased to analytics report ([d203ce1](https://github.com/standardnotes/api-gateway/commit/d203ce188af4f775e01bc1752d4c6d84fc5f1675))
## [1.6.30](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.6.29...@standardnotes/api-gateway@1.6.30) (2022-07-26)
**Note:** Version bump only for package @standardnotes/api-gateway
## [1.6.29](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.6.28...@standardnotes/api-gateway@1.6.29) (2022-07-25)
**Note:** Version bump only for package @standardnotes/api-gateway
+8
View File
@@ -46,6 +46,14 @@ const requestReport = async (
Period.Yesterday,
),
},
{
name: AnalyticsActivity.LimitedDiscountOfferPurchased,
retention: 0,
totalCount: await analyticsStore.calculateActivityTotalCount(
AnalyticsActivity.LimitedDiscountOfferPurchased,
Period.Yesterday,
),
},
],
},
}
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/api-gateway",
"version": "1.6.29",
"version": "1.7.1",
"engines": {
"node": ">=16.0.0 <17.0.0"
},
@@ -57,7 +57,7 @@
"eslint-plugin-prettier": "^4.0.0",
"jest": "^28.1.2",
"nodemon": "^2.0.19",
"npm-check-updates": "^15.3.3",
"npm-check-updates": "^16.0.1",
"ts-jest": "^28.0.5"
}
}
+10
View File
@@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.12.1](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.12.0...@standardnotes/auth-server@1.12.1) (2022-07-27)
**Note:** Version bump only for package @standardnotes/auth-server
# [1.12.0](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.11.31...@standardnotes/auth-server@1.12.0) (2022-07-26)
### Features
* **auth:** add analytics for purchased subscription with a limited discount offer ([e936ac4](https://github.com/standardnotes/server/commit/e936ac4ce18fa43e47a50462c44f63a9ba1c1aa4))
## [1.11.31](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.11.30...@standardnotes/auth-server@1.11.31) (2022-07-25)
### Bug Fixes
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/auth-server",
"version": "1.11.31",
"version": "1.12.1",
"engines": {
"node": ">=16.0.0 <17.0.0"
},
@@ -82,7 +82,7 @@
"eslint-plugin-prettier": "^4.0.0",
"jest": "^28.1.2",
"nodemon": "^2.0.19",
"npm-check-updates": "^15.3.3",
"npm-check-updates": "^16.0.1",
"ts-jest": "^28.0.5"
}
}
@@ -16,6 +16,8 @@ import { OfflineUserSubscriptionRepositoryInterface } from '../Subscription/Offl
import { OfflineUserSubscription } from '../Subscription/OfflineUserSubscription'
import { SubscriptionSettingServiceInterface } from '../Setting/SubscriptionSettingServiceInterface'
import { UserSubscriptionType } from '../Subscription/UserSubscriptionType'
import { AnalyticsStoreInterface, Period } from '@standardnotes/analytics'
import { AnalyticsEntity } from '../Analytics/AnalyticsEntity'
describe('SubscriptionPurchasedEventHandler', () => {
let userRepository: UserRepositoryInterface
@@ -29,6 +31,7 @@ describe('SubscriptionPurchasedEventHandler', () => {
let event: SubscriptionPurchasedEvent
let subscriptionExpiresAt: number
let subscriptionSettingService: SubscriptionSettingServiceInterface
let analyticsStore: AnalyticsStoreInterface
let timestamp: number
const createHandler = () =>
@@ -38,6 +41,7 @@ describe('SubscriptionPurchasedEventHandler', () => {
offlineUserSubscriptionRepository,
roleService,
subscriptionSettingService,
analyticsStore,
logger,
)
@@ -83,11 +87,15 @@ describe('SubscriptionPurchasedEventHandler', () => {
subscriptionExpiresAt,
timestamp: dayjs.utc().valueOf(),
offline: false,
discountCode: null,
}
subscriptionSettingService = {} as jest.Mocked<SubscriptionSettingServiceInterface>
subscriptionSettingService.applyDefaultSubscriptionSettingsForSubscription = jest.fn()
analyticsStore = {} as jest.Mocked<AnalyticsStoreInterface>
analyticsStore.markActivity = jest.fn()
logger = {} as jest.Mocked<Logger>
logger.info = jest.fn()
logger.warn = jest.fn()
@@ -134,6 +142,28 @@ describe('SubscriptionPurchasedEventHandler', () => {
})
})
it('should update analytics on limited discount offer purchasing', async () => {
const analyticsEntity = { id: 3 } as jest.Mocked<AnalyticsEntity>
user = {
uuid: '123',
email: 'test@test.com',
roles: Promise.resolve([
{
name: RoleName.CoreUser,
},
]),
analyticsEntity: Promise.resolve(analyticsEntity),
} as jest.Mocked<User>
userRepository.findOneByEmail = jest.fn().mockReturnValue(user)
event.payload.discountCode = 'limited-10'
await createHandler().handle(event)
expect(analyticsStore.markActivity).toHaveBeenCalledWith(['limited-discount-offer-purchased'], 3, [Period.Today])
})
it('should create an offline subscription', async () => {
event.payload.offline = true
@@ -13,6 +13,7 @@ import { OfflineUserSubscription } from '../Subscription/OfflineUserSubscription
import { OfflineUserSubscriptionRepositoryInterface } from '../Subscription/OfflineUserSubscriptionRepositoryInterface'
import { UserSubscriptionType } from '../Subscription/UserSubscriptionType'
import { SubscriptionSettingServiceInterface } from '../Setting/SubscriptionSettingServiceInterface'
import { AnalyticsActivity, AnalyticsStoreInterface, Period } from '@standardnotes/analytics'
@injectable()
export class SubscriptionPurchasedEventHandler implements DomainEventHandlerInterface {
@@ -23,6 +24,7 @@ export class SubscriptionPurchasedEventHandler implements DomainEventHandlerInte
private offlineUserSubscriptionRepository: OfflineUserSubscriptionRepositoryInterface,
@inject(TYPES.RoleService) private roleService: RoleServiceInterface,
@inject(TYPES.SubscriptionSettingService) private subscriptionSettingService: SubscriptionSettingServiceInterface,
@inject(TYPES.AnalyticsStore) private analyticsStore: AnalyticsStoreInterface,
@inject(TYPES.Logger) private logger: Logger,
) {}
@@ -62,6 +64,16 @@ export class SubscriptionPurchasedEventHandler implements DomainEventHandlerInte
userSubscription,
event.payload.subscriptionName,
)
const limitedDiscountPurchased = event.payload.discountCode === 'limited-10'
if (limitedDiscountPurchased) {
const analyticsEntity = await user.analyticsEntity
if (analyticsEntity) {
await this.analyticsStore.markActivity([AnalyticsActivity.LimitedDiscountOfferPurchased], analyticsEntity.id, [
Period.Today,
])
}
}
}
private async addUserRole(user: User, subscriptionName: SubscriptionName): Promise<void> {
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.7.28](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.7.27...@standardnotes/domain-events-infra@1.7.28) (2022-07-26)
**Note:** Version bump only for package @standardnotes/domain-events-infra
## [1.7.27](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.7.26...@standardnotes/domain-events-infra@1.7.27) (2022-07-25)
**Note:** Version bump only for package @standardnotes/domain-events-infra
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/domain-events-infra",
"version": "1.7.27",
"version": "1.7.28",
"engines": {
"node": ">=16.0.0 <17.0.0"
},
+6
View File
@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.51.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.50.2...@standardnotes/domain-events@2.51.0) (2022-07-26)
### Features
* **domain-events:** add discount code to subscription purchased event ([28e1c65](https://github.com/standardnotes/server/commit/28e1c656312ae9a7c4afec1aa65bb104f788b8b6))
## [2.50.2](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.50.1...@standardnotes/domain-events@2.50.2) (2022-07-25)
**Note:** Version bump only for package @standardnotes/domain-events
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/domain-events",
"version": "2.50.2",
"version": "2.51.0",
"engines": {
"node": ">=16.0.0 <17.0.0"
},
@@ -7,4 +7,5 @@ export interface SubscriptionPurchasedEventPayload {
subscriptionExpiresAt: number
timestamp: number
offline: boolean
discountCode: string | null
}
+4
View File
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.27](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.1.26...@standardnotes/event-store@1.1.27) (2022-07-26)
**Note:** Version bump only for package @standardnotes/event-store
## [1.1.26](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.1.25...@standardnotes/event-store@1.1.26) (2022-07-25)
**Note:** Version bump only for package @standardnotes/event-store
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/event-store",
"version": "1.1.26",
"version": "1.1.27",
"description": "Event Store Service",
"private": true,
"main": "dist/src/index.js",
+8
View File
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.5.29](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.5.28...@standardnotes/files-server@1.5.29) (2022-07-27)
**Note:** Version bump only for package @standardnotes/files-server
## [1.5.28](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.5.27...@standardnotes/files-server@1.5.28) (2022-07-26)
**Note:** Version bump only for package @standardnotes/files-server
## [1.5.27](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.5.26...@standardnotes/files-server@1.5.27) (2022-07-25)
**Note:** Version bump only for package @standardnotes/files-server
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/files-server",
"version": "1.5.27",
"version": "1.5.29",
"engines": {
"node": ">=16.0.0 <17.0.0"
},
@@ -69,7 +69,7 @@
"eslint-plugin-prettier": "^4.0.0",
"jest": "^28.1.2",
"nodemon": "^2.0.19",
"npm-check-updates": "^15.3.3",
"npm-check-updates": "^16.0.1",
"ts-jest": "^28.0.5",
"uuid": "^8.3.2"
}
+16
View File
@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.10.1](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.10.0...@standardnotes/scheduler-server@1.10.1) (2022-07-27)
**Note:** Version bump only for package @standardnotes/scheduler-server
# [1.10.0](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.9.2...@standardnotes/scheduler-server@1.10.0) (2022-07-26)
### Features
* **scheduler:** enable discount applying and withdraw for everyone ([04bf414](https://github.com/standardnotes/server/commit/04bf414de41ecba255b068fd8e72bc569ace9ed1))
## [1.9.2](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.9.1...@standardnotes/scheduler-server@1.9.2) (2022-07-26)
### Bug Fixes
* **scheduler:** change the discount code to an absolute discount ([1fa94ef](https://github.com/standardnotes/server/commit/1fa94efa02f169ee25d11e9403ab3368b696cc33))
## [1.9.1](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.9.0...@standardnotes/scheduler-server@1.9.1) (2022-07-26)
### Bug Fixes
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/scheduler-server",
"version": "1.9.1",
"version": "1.10.1",
"engines": {
"node": ">=16.0.0 <17.0.0"
},
@@ -50,7 +50,7 @@
"@typescript-eslint/eslint-plugin": "^5.29.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^28.1.2",
"npm-check-updates": "^15.3.3",
"npm-check-updates": "^16.0.1",
"ts-jest": "^28.0.5"
}
}
@@ -205,24 +205,11 @@ describe('JobDoneInterpreter', () => {
expect(domainEventFactory.createDiscountApplyRequestedEvent).toHaveBeenCalledWith({
userEmail: 'test@standardnotes.com',
discountCode: 'econ-10',
discountCode: 'limited-10',
})
expect(domainEventPublisher.publish).toHaveBeenCalled()
})
it('should not request discount apply if email is not internal', async () => {
jobRepository.findOneByUuid = jest.fn().mockReturnValue({
name: JobName.APPLY_SUBSCRIPTION_DISCOUNT,
userIdentifier: 'test@test.com',
userIdentifierType: 'email',
} as jest.Mocked<Job>)
await createInterpreter().interpret('1-2-3')
expect(domainEventFactory.createDiscountApplyRequestedEvent).not.toHaveBeenCalled()
expect(domainEventPublisher.publish).not.toHaveBeenCalled()
})
it('should not request discount apply if email is missing', async () => {
jobRepository.findOneByUuid = jest.fn().mockReturnValue({
name: JobName.APPLY_SUBSCRIPTION_DISCOUNT,
@@ -247,24 +234,11 @@ describe('JobDoneInterpreter', () => {
expect(domainEventFactory.createDiscountWithdrawRequestedEvent).toHaveBeenCalledWith({
userEmail: 'test@standardnotes.com',
discountCode: 'econ-10',
discountCode: 'limited-10',
})
expect(domainEventPublisher.publish).toHaveBeenCalled()
})
it('should not request discount withdraw if email is not internal', async () => {
jobRepository.findOneByUuid = jest.fn().mockReturnValue({
name: JobName.WITHDRAW_SUBSCRIPTION_DISCOUNT,
userIdentifier: 'test@test.com',
userIdentifierType: 'email',
} as jest.Mocked<Job>)
await createInterpreter().interpret('1-2-3')
expect(domainEventFactory.createDiscountWithdrawRequestedEvent).not.toHaveBeenCalled()
expect(domainEventPublisher.publish).not.toHaveBeenCalled()
})
it('should not request discount withdraw if email is missing', async () => {
jobRepository.findOneByUuid = jest.fn().mockReturnValue({
name: JobName.WITHDRAW_SUBSCRIPTION_DISCOUNT,
@@ -56,12 +56,12 @@ export class JobDoneInterpreter implements JobDoneInterpreterInterface {
}
return
case JobName.APPLY_SUBSCRIPTION_DISCOUNT:
if (job.userIdentifierType === 'email' && job.userIdentifier.includes('@standardnotes.com')) {
if (job.userIdentifierType === 'email') {
await this.requestDiscountApply(job)
}
return
case JobName.WITHDRAW_SUBSCRIPTION_DISCOUNT:
if (job.userIdentifierType === 'email' && job.userIdentifier.includes('@standardnotes.com')) {
if (job.userIdentifierType === 'email') {
await this.requestDiscountWithdraw(job)
}
return
@@ -116,7 +116,7 @@ export class JobDoneInterpreter implements JobDoneInterpreterInterface {
await this.domainEventPublisher.publish(
this.domainEventFactory.createDiscountApplyRequestedEvent({
userEmail: job.userIdentifier,
discountCode: 'econ-10',
discountCode: 'limited-10',
}),
)
}
@@ -127,7 +127,7 @@ export class JobDoneInterpreter implements JobDoneInterpreterInterface {
await this.domainEventPublisher.publish(
this.domainEventFactory.createDiscountWithdrawRequestedEvent({
userEmail: job.userIdentifier,
discountCode: 'econ-10',
discountCode: 'limited-10',
}),
)
}
+8
View File
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.6.31](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.6.30...@standardnotes/syncing-server@1.6.31) (2022-07-27)
**Note:** Version bump only for package @standardnotes/syncing-server
## [1.6.30](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.6.29...@standardnotes/syncing-server@1.6.30) (2022-07-26)
**Note:** Version bump only for package @standardnotes/syncing-server
## [1.6.29](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.6.28...@standardnotes/syncing-server@1.6.29) (2022-07-25)
**Note:** Version bump only for package @standardnotes/syncing-server
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/syncing-server",
"version": "1.6.29",
"version": "1.6.31",
"engines": {
"node": ">=16.0.0 <17.0.0"
},
@@ -71,7 +71,7 @@
"eslint": "^8.14.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^28.1.2",
"npm-check-updates": "^15.3.3",
"npm-check-updates": "^16.0.1",
"ts-jest": "^28.0.5"
}
}
+10 -10
View File
@@ -1797,7 +1797,7 @@ __metadata:
jsonwebtoken: 8.5.1
newrelic: ^8.14.1
nodemon: ^2.0.19
npm-check-updates: ^15.3.3
npm-check-updates: ^16.0.1
prettyjson: ^1.2.5
reflect-metadata: 0.1.13
ts-jest: ^28.0.5
@@ -1866,7 +1866,7 @@ __metadata:
mysql2: ^2.3.3
newrelic: ^8.14.1
nodemon: ^2.0.19
npm-check-updates: ^15.3.3
npm-check-updates: ^16.0.1
otplib: 12.0.1
prettyjson: ^1.2.5
reflect-metadata: 0.1.13
@@ -2047,7 +2047,7 @@ __metadata:
jsonwebtoken: ^8.5.1
newrelic: ^8.14.1
nodemon: ^2.0.19
npm-check-updates: ^15.3.3
npm-check-updates: ^16.0.1
prettyjson: ^1.2.5
reflect-metadata: ^0.1.13
ts-jest: ^28.0.5
@@ -2132,7 +2132,7 @@ __metadata:
jest: ^28.1.2
mysql2: ^2.3.3
newrelic: ^8.14.1
npm-check-updates: ^15.3.3
npm-check-updates: ^16.0.1
reflect-metadata: ^0.1.13
ts-jest: ^28.0.5
typeorm: ^0.3.6
@@ -2174,7 +2174,7 @@ __metadata:
eslint-config-prettier: ^8.5.0
ini: ^3.0.0
newrelic: ^8.14.1
npm-check-updates: ^15.3.3
npm-check-updates: ^16.0.1
prettier: ^2.7.1
ts-node: ^10.8.1
typescript: ^4.7.4
@@ -2272,7 +2272,7 @@ __metadata:
mysql2: ^2.3.3
newrelic: ^8.14.1
nodemon: ^2.0.19
npm-check-updates: ^15.3.3
npm-check-updates: ^16.0.1
prettyjson: ^1.2.5
reflect-metadata: 0.1.13
ts-jest: ^28.0.5
@@ -7838,9 +7838,9 @@ __metadata:
languageName: node
linkType: hard
"npm-check-updates@npm:^15.3.3":
version: 15.3.3
resolution: "npm-check-updates@npm:15.3.3"
"npm-check-updates@npm:^16.0.1":
version: 16.0.1
resolution: "npm-check-updates@npm:16.0.1"
dependencies:
chalk: ^5.0.1
cli-table: ^0.3.11
@@ -7872,7 +7872,7 @@ __metadata:
bin:
ncu: build/src/bin/cli.js
npm-check-updates: build/src/bin/cli.js
checksum: 3ee33fe369961d9548cdfde50085540e432a45a1166df4c1e6bacd5c25d36761efd156f6f358d1a51dd10db09d030106f87edec4d4a16637e35c09549a919cd5
checksum: 1e747421f3d34055183037335437db91cd300448dccaad305925499719d4d34e6c1adfa3ce35a178f209106a40dcd57da088d9125dab2bd125ae54f5ae1c131c
languageName: node
linkType: hard