Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove getSignupAssessment method #79

Merged
merged 2 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,6 @@ try {
}
```


### Getting a Mobile Signup

This method allows you to retrieve the latest assessment for a given signup event, returning a signup assessment, containing the risk assessment and supporting evidence:

```js
try {
const signupAssessment = await incogniaApi.getSignupAssessment(signupId)
} catch (error) {
console.log(error.message)
}
```

### Registering a Mobile Login

This method registers a new mobile login for the given installation and account, returning a transaction assessment, containing the risk assessment and supporting evidence.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@incognia/api",
"author": "Incognia (https://us.incognia.com)",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"author": "Incognia (https://us.incognia.com)",
"author": "Incognia (https://incognia.com)",

"repository": "https://github.com/inloco/incognia-node",
"version": "4.5.1",
"version": "5.0.0",
"license": "MIT",
"type": "module",
"main": "dist/index.cjs.js",
Expand Down
11 changes: 0 additions & 11 deletions src/incogniaApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,6 @@ export class IncogniaApi {
/*
** Resources
*/
async getSignupAssessment(signupId: string): Promise<SignupResponse> {
if (!signupId) {
throw new IncogniaError('No signupId provided')
}

return this.resourceRequest({
url: `${apiEndpoints.SIGNUPS}/${signupId}`,
method: Method.Get
})
}

async registerSignup(props: RegisterSignupProps): Promise<SignupResponse> {
const { installationId } = props || {}
if (!installationId) {
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// Generated by genversion.
export const version = '4.5.1'
export const version = '5.0.0'
40 changes: 10 additions & 30 deletions test/incogniaApi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,30 +75,6 @@ describe('API', () => {
})
})

it('gets signup assessment', async () => {
const apiResponse = {
id: '5e76a7ca-577c-4f47-a752-9e1e0cee9e49',
request_id: '8afc84a7-f1d4-488d-bd69-36d9a37168b7',
risk_assessment: 'low_risk'
}

const expectedResponse = {
id: '5e76a7ca-577c-4f47-a752-9e1e0cee9e49',
requestId: '8afc84a7-f1d4-488d-bd69-36d9a37168b7',
riskAssessment: 'low_risk'
}

nock(BASE_ENDPOINT_URL)
.get(`/v2/onboarding/signups/${apiResponse.id}`)
.reply(200, apiResponse)

const signupAssessment = await incogniaApi.getSignupAssessment(
apiResponse.id
)

expect(signupAssessment).toEqual(expectedResponse)
})

it('registers signup', async () => {
const apiResponse = {
id: '5e76a7ca-577c-4f47-a752-9e1e0cee9e49',
Expand Down Expand Up @@ -366,25 +342,29 @@ describe('API', () => {

describe('when calling the api ', () => {
it('calls access token endpoint only at the first time', async () => {
const signupId = '123'
const accessTokenEndpointFirstCall = nock(BASE_ENDPOINT_URL)
.post('/v2/token')
.reply(200, accessTokenExample)
const signupEndpointGet = nock(BASE_ENDPOINT_URL)
const signupEndpointRegister = nock(BASE_ENDPOINT_URL)
.persist()
.get(`/v2/onboarding/signups/${signupId}`)
.post(`/v2/onboarding/signups`)
.reply(200)
const accessTokenEndpointSecondCall = nock(BASE_ENDPOINT_URL)
.post('/v2/token')
.reply(200, accessTokenExample)

const payload = {
installationId: 'installation_id',
policyId: 'policy_id'
}

//call resource for the first time
await incogniaApi.getSignupAssessment(signupId)
await incogniaApi.registerSignup(payload)
expect(accessTokenEndpointFirstCall.isDone()).toBeTruthy()
expect(signupEndpointGet.isDone()).toBeTruthy()
expect(signupEndpointRegister.isDone()).toBeTruthy()

//call resource for the second time
await incogniaApi.getSignupAssessment(signupId)
await incogniaApi.registerSignup(payload)
expect(accessTokenEndpointSecondCall.isDone()).toBeFalsy()
})
})
Expand Down
Loading