-
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 #69 from Giveth/migrating-from-autopilot-to-ortto
Migrating from Autopilot to Ortto
- Loading branch information
Showing
13 changed files
with
302 additions
and
22 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,32 @@ | ||
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
Oops, something went wrong.