-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: adjust and shopify changes with expanded test cases
- Loading branch information
1 parent
b674611
commit d01f411
Showing
7 changed files
with
700 additions
and
612 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const { processEvent: processV0Event } = require('../../v0/sources/adjust/transform'); | ||
const { CommonUtils } = require('../../util/common'); | ||
|
||
const convertV2ToV0 = (sourceEvent) => { | ||
const v0Event = JSON.parse(sourceEvent.request.body); | ||
if (sourceEvent.request.query_parameters) { | ||
v0Event.query_parameters = sourceEvent.request.query_parameters; | ||
} | ||
return v0Event; | ||
}; | ||
|
||
const process = (requests) => { | ||
const requestsArray = CommonUtils.toArray(requests); | ||
const v0Events = requestsArray.map(convertV2ToV0); | ||
return v0Events.map(processV0Event); | ||
}; | ||
|
||
module.exports = { process }; |
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,19 @@ | ||
const { process: processV1 } = require('../../v1/sources/shopify/transform'); | ||
|
||
const convertV2ToV1 = (inputRequest) => { | ||
const { body: bodyString, query_parameters: qParams } = inputRequest.request; | ||
const requestBody = JSON.parse(bodyString); | ||
|
||
if (qParams) { | ||
requestBody.query_parameters = qParams; | ||
} | ||
|
||
return { | ||
event: requestBody, | ||
source: inputRequest.source, | ||
}; | ||
}; | ||
|
||
const process = async (inputEvent) => processV1(convertV2ToV1(inputEvent)); | ||
|
||
module.exports = { process }; |
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
Oops, something went wrong.