-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: adding salesforce oauth sandbox support for closed testing (#3778
) * chore: adding salesforce oauth sandbox support for closed testing * chore: adding test log * fix: throw error for empty secret * fix: processor last test-case * chore: add logical changes for passing test-cases * fix: adding dynamic destination name for rETL connection * fix: adding test case * fix: remove log --------- Co-authored-by: Sai Sankeerth <[email protected]>
- Loading branch information
1 parent
f3046f0
commit 6d9976c
Showing
10 changed files
with
399 additions
and
11 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
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
34 changes: 34 additions & 0 deletions
34
src/v0/destinations/salesforce_oauth_sandbox/networkHandler.js
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,34 @@ | ||
const { proxyRequest, prepareProxyRequest } = require('../../../adapters/network'); | ||
const { processAxiosResponse } = require('../../../adapters/utils/networkUtils'); | ||
const { OAUTH } = require('../salesforce/config'); | ||
const { salesforceResponseHandler } = require('../salesforce/utils'); | ||
|
||
const responseHandler = (responseParams) => { | ||
const { destinationResponse, destType, rudderJobMetadata } = responseParams; | ||
const message = `Request for destination: ${destType} Processed Successfully`; | ||
|
||
salesforceResponseHandler( | ||
destinationResponse, | ||
'during Salesforce Response Handling', | ||
rudderJobMetadata?.destInfo?.authKey, | ||
OAUTH, | ||
); | ||
|
||
// else successfully return status as 200, message and original destination response | ||
return { | ||
status: 200, | ||
message, | ||
destinationResponse, | ||
}; | ||
}; | ||
|
||
function networkHandler() { | ||
this.responseHandler = responseHandler; | ||
this.proxy = proxyRequest; | ||
this.prepareProxy = prepareProxyRequest; | ||
this.processAxiosResponse = processAxiosResponse; | ||
} | ||
|
||
module.exports = { | ||
networkHandler, | ||
}; |
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 |
---|---|---|
|
@@ -1373,7 +1373,7 @@ export const data = [ | |
}, | ||
{ | ||
name: 'salesforce', | ||
description: 'Test 10', | ||
description: 'Test 11', | ||
feature: 'processor', | ||
module: 'destination', | ||
version: 'v0', | ||
|
@@ -1389,9 +1389,9 @@ export const data = [ | |
sandbox: true, | ||
}, | ||
DestinationDefinition: { | ||
DisplayName: 'Salesforce', | ||
DisplayName: 'Salesforce Sandbox', | ||
ID: '1T96GHZ0YZ1qQSLULHCoJkow9KC', | ||
Name: 'SALESFORCE', | ||
Name: 'SALESFORCE_OAUTH_SANDBOX', | ||
}, | ||
Enabled: true, | ||
ID: '1ut7LcVW1QC56y2EoTNo7ZwBWSY', | ||
|
@@ -1412,7 +1412,7 @@ export const data = [ | |
externalId: [ | ||
{ | ||
id: 'a005g0000383kmUAAQ', | ||
type: 'SALESFORCE-custom_object__c', | ||
type: 'SALESFORCE_OAUTH_SANDBOX-custom_object__c', | ||
identifierType: 'Id', | ||
}, | ||
], | ||
|
@@ -1499,4 +1499,112 @@ export const data = [ | |
}, | ||
}, | ||
}, | ||
{ | ||
name: 'salesforce', | ||
description: 'Test 12 : Retry happens when no secret information is found', | ||
feature: 'processor', | ||
module: 'destination', | ||
version: 'v0', | ||
input: { | ||
request: { | ||
body: [ | ||
{ | ||
destination: { | ||
Config: { | ||
initialAccessToken: '7fiy1FKcO9sohsxq1v6J88sg', | ||
password: 'dummyPassword2', | ||
userName: '[email protected]', | ||
sandbox: true, | ||
}, | ||
DestinationDefinition: { | ||
DisplayName: 'Salesforce Sandbox', | ||
ID: '1T96GHZ0YZ1qQSLULHCoJkow9KC', | ||
Name: 'SALESFORCE_OAUTH_SANDBOX', | ||
}, | ||
Enabled: true, | ||
ID: '1ut7LcVW1QC56y2EoTNo7ZwBWSY', | ||
Name: 'Test SF', | ||
Transformations: [], | ||
}, | ||
metadata: { | ||
jobId: 1, | ||
}, | ||
message: { | ||
anonymousId: '1e7673da-9473-49c6-97f7-da848ecafa76', | ||
channel: 'web', | ||
context: { | ||
mappedToDestination: true, | ||
externalId: [ | ||
{ | ||
id: 'a005g0000383kmUAAQ', | ||
type: 'SALESFORCE_OAUTH_SANDBOX-custom_object__c', | ||
identifierType: 'Id', | ||
}, | ||
], | ||
app: { | ||
build: '1.0.0', | ||
name: 'RudderLabs JavaScript SDK', | ||
namespace: 'com.rudderlabs.javascript', | ||
version: '1.0.0', | ||
}, | ||
ip: '0.0.0.0', | ||
library: { | ||
name: 'RudderLabs JavaScript SDK', | ||
version: '1.0.0', | ||
}, | ||
locale: 'en-US', | ||
os: { | ||
name: '', | ||
version: '', | ||
}, | ||
screen: { | ||
density: 2, | ||
}, | ||
traits: { | ||
email: '[email protected]', | ||
firstname: 'john doe', | ||
Id: 'some-id', | ||
}, | ||
userAgent: | ||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36', | ||
}, | ||
integrations: { | ||
All: true, | ||
}, | ||
messageId: 'f19c35da-e9de-4c6e-b6e5-9e60cccc12c8', | ||
originalTimestamp: '2020-01-27T12:20:55.301Z', | ||
receivedAt: '2020-01-27T17:50:58.657+05:30', | ||
request_ip: '14.98.244.60', | ||
sentAt: '2020-01-27T12:20:56.849Z', | ||
timestamp: '2020-01-27T17:50:57.109+05:30', | ||
type: 'identify', | ||
userId: '1e7673da-9473-49c6-97f7-da848ecafa76', | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
output: { | ||
response: { | ||
status: 200, | ||
body: [ | ||
{ | ||
statusCode: 500, | ||
error: 'secret is undefined/null', | ||
metadata: { | ||
jobId: 1, | ||
}, | ||
statTags: { | ||
errorCategory: 'platform', | ||
errorType: 'oAuthSecret', | ||
destType: 'SALESFORCE', | ||
module: 'destination', | ||
implementation: 'native', | ||
feature: 'processor', | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
]; |
3 changes: 3 additions & 0 deletions
3
test/integrations/destinations/salesforce_oauth_sandbox/dataDelivery/data.ts
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,3 @@ | ||
import { testScenariosForV1API } from './oauth'; | ||
|
||
export const data = [...testScenariosForV1API]; |
Oops, something went wrong.