-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from Giveth/staging
Release 2024-02-25 Email migration
- Loading branch information
Showing
14 changed files
with
247 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { logger } from '../../utils/logger'; | ||
import axios from 'axios'; | ||
import {OrttoAdapterInterface} from "./orttoAdapterInterface"; | ||
|
||
export class OrttoAdapter implements OrttoAdapterInterface{ | ||
async callOrttoActivity(data: any): Promise<void> { | ||
try { | ||
if (!data){ | ||
throw new Error('callOrttoActivity input data is empty') | ||
} | ||
const config = { | ||
method: 'post', | ||
maxBodyLength: Infinity, | ||
url: process.env.ORTTO_ACTIVITY_API, | ||
headers: { | ||
'X-Api-Key': process.env.ORTTO_API_KEY as string, | ||
'Content-Type': 'application/json' | ||
}, | ||
data | ||
}; | ||
data.activities.map((a: any) => logger.debug('orttoActivityCall', a)); | ||
await axios.request(config); | ||
} catch (e) { | ||
logger.error('orttoActivityCall error', { | ||
error: e, | ||
data | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import internal from "stream"; | ||
|
||
export interface OrttoAdapterInterface { | ||
callOrttoActivity (data: any): Promise<void> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { logger } from '../../utils/logger'; | ||
import axios from 'axios'; | ||
import {OrttoAdapterInterface} from "./orttoAdapterInterface"; | ||
|
||
|
||
export class OrttoMockAdapter implements OrttoAdapterInterface{ | ||
async callOrttoActivity(data: any): Promise<void> { | ||
logger.debug('OrttoMockAdapter has been called', data) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -355,8 +355,6 @@ function sendNotificationTestCases() { | |
sendEmail: true, | ||
sendSegment: true, | ||
segment: { | ||
analyticsUserId: 'givethId-255', | ||
anonymousId: 'givethId-255', | ||
payload: { | ||
title: 'Test verify and reject form emails', | ||
lastName: 'Ranjbar', | ||
|
@@ -1385,8 +1383,6 @@ function sendNotificationTestCases() { | |
projectLink, | ||
}, | ||
segment: { | ||
analyticsUserId: 'givethId-255', | ||
anonymousId: 'givethId-255', | ||
payload: { | ||
email: '[email protected]', | ||
title: 'How many photos is too many photos?', | ||
|
@@ -1428,8 +1424,6 @@ function sendNotificationTestCases() { | |
projectLink, | ||
}, | ||
segment: { | ||
analyticsUserId: 'givethId-255', | ||
anonymousId: 'givethId-255', | ||
payload: { | ||
email: '[email protected]', | ||
title: 'How many photos is too many photos?', | ||
|
@@ -1499,8 +1493,6 @@ function sendNotificationTestCases() { | |
projectLink, | ||
}, | ||
segment: { | ||
analyticsUserId: 'givethId-255', | ||
anonymousId: 'givethId-255', | ||
payload: { | ||
email: '[email protected]', | ||
title: 'How many photos is too many photos?', | ||
|
@@ -1542,8 +1534,6 @@ function sendNotificationTestCases() { | |
projectLink, | ||
}, | ||
segment: { | ||
analyticsUserId: 'givethId-255', | ||
anonymousId: 'givethId-255', | ||
payload: { | ||
email: '[email protected]', | ||
title: 'How many photos is too many photos?', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
export enum NOTIFICATIONS_EVENT_NAMES { | ||
DRAFTED_PROJECT_ACTIVATED = 'Draft published', | ||
PROJECT_LISTED = 'Project listed', | ||
PROJECT_UNLISTED = 'Project unlisted', | ||
PROJECT_UNLISTED_SUPPORTED = 'Project unlisted - Users who supported', | ||
PROJECT_LISTED_SUPPORTED = 'Project listed - Users who supported', | ||
PROJECT_EDITED = 'Project edited', | ||
PROJECT_BADGE_REVOKED = 'Project badge revoked', | ||
PROJECT_BADGE_REVOKE_REMINDER = 'Project badge revoke reminder', | ||
PROJECT_BADGE_REVOKE_WARNING = 'Project badge revoke warning', | ||
PROJECT_BADGE_REVOKE_LAST_WARNING = 'Project badge revoke last warning', | ||
PROJECT_BADGE_UP_FOR_REVOKING = 'Project badge up for revoking', | ||
PROJECT_BOOSTED = 'Project boosted', | ||
PROJECT_BOOSTED_BY_PROJECT_OWNER = 'Project boosted by project owner', | ||
PROJECT_VERIFIED = 'Project verified', | ||
PROJECT_VERIFIED_USERS_WHO_SUPPORT = 'Project verified - Users who supported', | ||
|
||
// https://github.com/Giveth/impact-graph/issues/624#issuecomment-1240364389 | ||
PROJECT_REJECTED = 'Project unverified', | ||
PROJECT_NOT_REVIEWED = 'Project not reviewed', | ||
PROJECT_UNVERIFIED = 'Project unverified', | ||
VERIFICATION_FORM_REJECTED = 'Form rejected', | ||
PROJECT_UNVERIFIED_USERS_WHO_SUPPORT = 'Project unverified - Users who supported', | ||
PROJECT_ACTIVATED = 'Project activated', | ||
PROJECT_ACTIVATED_USERS_WHO_SUPPORT = 'Project activated - Users who supported', | ||
PROJECT_DEACTIVATED = 'Project deactivated', | ||
PROJECT_DEACTIVATED_USERS_WHO_SUPPORT = 'Project deactivated - Users who supported', | ||
|
||
PROJECT_CANCELLED = 'Project cancelled', | ||
PROJECT_CANCELLED_USERS_WHO_SUPPORT = 'Project cancelled - Users who supported', | ||
MADE_DONATION = 'Made donation', | ||
DONATION_RECEIVED = 'Donation received', | ||
DONATION_GET_PRICE_FAILED = 'Donation get price failed', | ||
PROJECT_RECEIVED_HEART = 'project liked', | ||
PROJECT_UPDATE_ADDED_OWNER = 'Project update added - owner', | ||
PROJECT_CREATED = 'The project saved as draft', | ||
UPDATED_PROFILE = 'Updated profile', | ||
GET_DONATION_PRICE_FAILED = 'Get Donation Price Failed', | ||
VERIFICATION_FORM_GOT_DRAFT_BY_ADMIN = 'Verification form got draft by admin', | ||
RAW_HTML_BROADCAST = 'Raw HTML Broadcast', | ||
PROJECT_ADD_AN_UPDATE_USERS_WHO_SUPPORT = 'Project update added - Users who supported', | ||
|
||
// https://github.com/Giveth/impact-graph/issues/774#issuecomment-1542337083 | ||
PROJECT_HAS_RISEN_IN_THE_RANK = 'Your Project has risen in the rank', | ||
PROJECT_HAS_A_NEW_RANK = 'Your project has a new rank', | ||
YOUR_PROJECT_GOT_A_RANK = 'Your project got a rank', | ||
} | ||
|
||
export const ORTTO_EVENT_NAMES = { | ||
[NOTIFICATIONS_EVENT_NAMES.DONATION_RECEIVED]: 'testing-donation-received', | ||
[NOTIFICATIONS_EVENT_NAMES.DRAFTED_PROJECT_ACTIVATED]: 'project-created', | ||
[NOTIFICATIONS_EVENT_NAMES.PROJECT_LISTED]: 'project-listed', | ||
[NOTIFICATIONS_EVENT_NAMES.PROJECT_UNLISTED]: 'project-unlisted', | ||
[NOTIFICATIONS_EVENT_NAMES.PROJECT_CANCELLED]: 'project-deactivated', | ||
[NOTIFICATIONS_EVENT_NAMES.MADE_DONATION]: 'donation-made', | ||
[NOTIFICATIONS_EVENT_NAMES.PROJECT_UNVERIFIED]: 'project-verification', | ||
[NOTIFICATIONS_EVENT_NAMES.PROJECT_VERIFIED]: 'project-verification', | ||
[NOTIFICATIONS_EVENT_NAMES.PROJECT_BADGE_REVOKED]: 'project-verification', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.