Skip to content

Commit

Permalink
Merge pull request #91 from inloco/release/5.2.0
Browse files Browse the repository at this point in the history
[5.2.0] chore(version): bump version to 5.2.0
  • Loading branch information
marcelscr committed Aug 5, 2024
2 parents ec4c9cc + cdf93dc commit d116f2b
Show file tree
Hide file tree
Showing 6 changed files with 288 additions and 46 deletions.
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ yarn add @incognia/api
Require the package:

CommonJS modules:

```js
const { IncogniaApi } = require('@incognia/api')
```

Or ES modules:

```js
import { IncogniaApi } from "@incognia/api";
import { IncogniaApi } from '@incognia/api'
```

Instantiate with your clientId and clientSecret:
Expand All @@ -45,7 +47,7 @@ const incogniaApi = new IncogniaApi({

### Registering a Mobile Signup

This method registers a new mobile signup for the given installation and address, returning a signup assessment, containing the risk assessment and supporting evidence:
This method registers a new mobile signup for the given installation (or request token) and address, returning a signup assessment, containing the risk assessment and supporting evidence:

```js
try {
Expand All @@ -72,12 +74,12 @@ try {

### Registering a Web Signup

This method registers a new web signup for the given session token, returning a signup assessment, containing the risk assessment and supporting evidence:
This method registers a new web signup for the given session token (or request token), returning a signup assessment, containing the risk assessment and supporting evidence:

```js
try {
const signup = await incogniaApi.registerWebSignup({
sessionToken: 'session_token',
sessionToken: 'session_token'
})
} catch (error) {
console.log(error.message)
Expand All @@ -86,7 +88,7 @@ try {

### 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.
This method registers a new mobile login for the given installation (or request token) and account, returning a transaction assessment, containing the risk assessment and supporting evidence.

```js
try {
Expand All @@ -102,23 +104,22 @@ try {

### Registering a Web Login

This method registers a new web login for the given session token and account, returning a transaction assessment, containing the risk assessment and supporting evidence.
This method registers a new web login for the given session token (or request token) and account, returning a transaction assessment, containing the risk assessment and supporting evidence.

```js
try {
const login = await incogniaApi.registerWebLogin({
sessionToken: 'session_token',
accountId: 'account_id',
accountId: 'account_id'
})
} catch (error) {
console.log(error.message)
}
```


### Registering a Payment

This method registers a new payment for the given installation and account, returning a transaction assessment, containing the risk assessment and supporting evidence.
This method registers a new payment for the given installation (or request token) and account, returning a transaction assessment, containing the risk assessment and supporting evidence.

```js
try {
Expand Down Expand Up @@ -155,7 +156,7 @@ try {

### Registering a Web Payment

This method registers a new web payment for the given session token and account, returning a transaction assessment, containing the risk assessment and supporting evidence.
This method registers a new web payment for the given session token (or request token) and account, returning a transaction assessment, containing the risk assessment and supporting evidence.

```js
try {
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://incognia.com)",
"repository": "https://github.com/inloco/incognia-node",
"version": "5.1.0",
"version": "5.2.0",
"license": "MIT",
"type": "module",
"main": "dist/index.cjs",
Expand Down
51 changes: 32 additions & 19 deletions src/incogniaApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ export class IncogniaApi {
** Resources
*/
async registerSignup(props: RegisterSignupProps): Promise<SignupResponse> {
const { installationId } = props || {}
if (!installationId) {
throw new IncogniaError('No installationId provided')
const { installationId, requestToken } = props || {}
if (!installationId && !requestToken) {
throw new IncogniaError('No installationId or requestToken provided')
}

return this.#registerBaseSignup(props)
Expand All @@ -86,18 +86,21 @@ export class IncogniaApi {
async registerWebSignup(
props: RegisterWebSignupProps
): Promise<WebSignupResponse> {
const { sessionToken } = props || {}
if (!sessionToken) {
throw new IncogniaError('No sessionToken provided')
const { sessionToken, requestToken } = props || {}
if (!sessionToken && !requestToken) {
throw new IncogniaError('No sessionToken or requestToken provided')
}

return this.#registerBaseSignup(props)
}

async registerLogin(props: RegisterLoginProps): Promise<TransactionResponse> {
const { installationId, accountId } = props || {}
if (!installationId || !accountId) {
throw new IncogniaError('No installationId or accountId provided')
const { installationId, requestToken, accountId } = props || {}
if (!installationId && !requestToken) {
throw new IncogniaError('No installationId or requestToken provided')
}
if (!accountId) {
throw new IncogniaError('No accountId provided')
}

return this.#registerTransaction({ ...props, type: TransactionType.Login })
Expand All @@ -106,19 +109,26 @@ export class IncogniaApi {
async registerWebLogin(
props: RegisterWebLoginProps
): Promise<WebTransactionResponse> {
const { sessionToken, accountId } = props || {}
if (!sessionToken || !accountId) {
throw new IncogniaError('No sessionToken or accountId provided')
const { sessionToken, requestToken, accountId } = props || {}
if (!sessionToken && !requestToken) {
throw new IncogniaError('No sessionToken or requestToken provided')
}
if (!accountId) {
throw new IncogniaError('No accountId provided')
}

return this.#registerTransaction({ ...props, type: TransactionType.Login })
}

async registerPayment(
props: RegisterPaymentProps
): Promise<TransactionResponse> {
const { installationId, accountId } = props || {}
if (!installationId || !accountId) {
throw new IncogniaError('No installationId or accountId provided')
const { installationId, requestToken, accountId } = props || {}
if (!installationId && !requestToken) {
throw new IncogniaError('No installationId or requestToken provided')
}
if (!accountId) {
throw new IncogniaError('No accountId provided')
}

return this.#registerTransaction({
Expand All @@ -130,17 +140,20 @@ export class IncogniaApi {
async registerWebPayment(
props: RegisterWebPaymentProps
): Promise<WebTransactionResponse> {
const { sessionToken, accountId } = props || {}
if (!sessionToken || !accountId) {
throw new IncogniaError('No sessionToken or accountId provided')
const { sessionToken, requestToken, accountId } = props || {}
if (!sessionToken && !requestToken) {
throw new IncogniaError('No sessionToken or requestToken provided')
}
if (!accountId) {
throw new IncogniaError('No accountId provided')
}

return this.#registerTransaction({
...props,
type: TransactionType.Payment
})
}


async registerFeedback(
bodyParams: RegisterFeedbackBodyProps,
queryParams?: RegisterFeedbackParamsProps
Expand Down
15 changes: 9 additions & 6 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,22 @@ export enum TransactionAddressType {
}

export type RegisterSignupBaseProps = {
requestToken?: string
accountId?: string
policyId?: string
[x: string]: any
}

export type RegisterSignupProps = RegisterSignupBaseProps & {
installationId: string
installationId?: string
addressCoordinates?: AddressCoordinates
addressLine?: string
structuredAddress?: StructuredAddress
externalId?: string
}

export type RegisterWebSignupProps = RegisterSignupBaseProps & {
sessionToken: string
sessionToken?: string
}

export type SignupBaseResponse = {
Expand All @@ -48,12 +49,13 @@ export type WebSignupEvidenceSummary = WebEvidenceSummary

type RegisterLoginBaseProps = {
accountId: string
requestToken?: string
policyId?: string
[x: string]: any
}

export type RegisterLoginProps = RegisterLoginBaseProps & {
installationId: string
installationId?: string
relatedAccountId?: string
location?: TransactionLocation
paymentMethodIdentifier?: string
Expand All @@ -62,11 +64,12 @@ export type RegisterLoginProps = RegisterLoginBaseProps & {
}

export type RegisterWebLoginProps = RegisterLoginBaseProps & {
sessionToken: string
sessionToken?: string
}

export type RegisterPaymentBaseProps = {
accountId: string
requestToken?: string
policyId?: string
externalId?: string
addresses?: Array<TransactionAddress>
Expand All @@ -77,12 +80,12 @@ export type RegisterPaymentBaseProps = {
}

export type RegisterPaymentProps = RegisterPaymentBaseProps & {
installationId: string
installationId?: string
relatedAccountId?: string
}

export type RegisterWebPaymentProps = RegisterPaymentBaseProps & {
sessionToken: string
sessionToken?: string
}

export type TransactionBaseResponse = {
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 = '5.1.0'
export const version = '5.2.0'
Loading

0 comments on commit d116f2b

Please sign in to comment.