Skip to content

Latest commit

 

History

History
1758 lines (1266 loc) · 28.4 KB

File metadata and controls

1758 lines (1266 loc) · 28.4 KB

Reference

Transactions

client.transactions.verify({ ...params }) -> Flagright.TransactionsVerifyResponse

📝 Description

POST Transactions

/transactions endpoint allows you to operate on the Transaction entity.

In order to pass the payload of a transaction to Flagright and verify the transaction, you will need to call this endpoint with the transaction payload. Not all fields are mandatory, you will only need to pass in the fields that you have and are relevant for your compliance setup.

Payload

Here are some of the most used payload fields explained (you can find the full payload schema below with 1 line descriptions):

  • type: Type of transaction (Ex: WITHDRAWAL, DEPOSIT, TRANSFER etc).
  • transactionId - Unique Identifier for the transaction.
  • timestamp - UNIX timestamp in milliseconds of when the transaction took place
  • transactionState - The state of the transaction, set to CREATED by default. More details here
  • originUserId - Unique identifier (if any) of the user who is sending the money. This user must be created within the Flagright system before using the create a consumer user or create a business user endpoint
  • destinationUserId - Unique identifier (if any) of the user who is receiving the money. This user must be created within the Flagright system before using the create a consumer user or create a business user endpoint
  • originAmountDetails - Details of the amount being sent from the origin
  • destinationAmountDetails - Details of the amount being received at the destination
  • originPaymentDetails - Payment details (if any) used at the origin (ex: CARD, IBAN, WALLET etc). You can click on the dropdown next to the field in the schema below to view all supported payment types.
  • destinationPaymentDetails - Payment details (if any) used at the destination (ex: CARD, IBAN, WALLET etc). You can click on the dropdown next to the field in the schema below to view all supported payment types.

🔌 Usage

await client.transactions.verify({
    validateOriginUserId: "true",
    validateDestinationUserId: "true",
    body: {
        type: "DEPOSIT",
        transactionId: "7b80a539eea6e78acbd6d458e5971482",
        timestamp: 1641654664000,
        originUserId: "8650a2611d0771cba03310f74bf6",
        destinationUserId: "9350a2611e0771cba03310f74bf6",
        originAmountDetails: {
            transactionAmount: 2000,
            transactionCurrency: "EUR",
            country: "DE"
        },
        destinationAmountDetails: {
            transactionAmount: 68351.34,
            transactionCurrency: "INR",
            country: "IN"
        },
        originPaymentDetails: {
            method: "CARD",
            cardFingerprint: "20ac00fed8ef913aefb17cfae1097cce",
            cardIssuedCountry: "TR",
            transactionReferenceField: "Deposit",
            3DsDone: true
        },
        destinationPaymentDetails: {
            method: "CARD",
            cardFingerprint: "20ac00fed8ef913aefb17cfae1097cce",
            cardIssuedCountry: "TR",
            transactionReferenceField: "Deposit",
            3DsDone: true
        },
        promotionCodeUsed: true,
        reference: "loan repayment",
        originDeviceData: {
            batteryLevel: 95,
            deviceLatitude: 13.0033,
            deviceLongitude: 76.1004,
            ipAddress: "10.23.191.2",
            deviceIdentifier: "3c49f915d04485e34caba",
            vpnUsed: false,
            operatingSystem: "Android 11.2",
            deviceMaker: "ASUS",
            deviceModel: "Zenphone M2 Pro Max",
            deviceYear: "2018",
            appVersion: "1.1.0"
        },
        destinationDeviceData: {
            batteryLevel: 95,
            deviceLatitude: 13.0033,
            deviceLongitude: 76.1004,
            ipAddress: "10.23.191.2",
            deviceIdentifier: "3c49f915d04485e34caba",
            vpnUsed: false,
            operatingSystem: "Android 11.2",
            deviceMaker: "ASUS",
            deviceModel: "Zenphone M2 Pro Max",
            deviceYear: "2018",
            appVersion: "1.1.0"
        },
        tags: [{
                key: "customKey",
                value: "customValue"
            }]
    }
});

⚙️ Parameters

request: Flagright.TransactionsVerifyRequest

requestOptions: Transactions.RequestOptions

client.transactions.get(transactionId) -> Flagright.TransactionWithRulesResult

📝 Description

GET Transactions

/transactions endpoint allows you to operate on the Transaction entity.

Calling GET /transactions/{transactionId} will return the entire transaction payload and rule execution results for the transaction with the corresponding transactionId

🔌 Usage

await client.transactions.get("transactionId");

⚙️ Parameters

transactionId: string — Unique Transaction Identifier

requestOptions: Transactions.RequestOptions

Batch

client.batch.verifyTransaction({ ...params }) -> Flagright.BatchResponse

🔌 Usage

await client.batch.verifyTransaction({
    validateOriginUserId: "true",
    validateDestinationUserId: "true",
    data: [
        {
            type: "type",
            transactionId: "transactionId",
            timestamp: 1.1,
        },
    ],
});

⚙️ Parameters

request: Flagright.TransactionBatchRequest

requestOptions: Batch.RequestOptions

client.batch.getTransactions(batchId, { ...params }) -> Flagright.BatchTransactionMonitoringResults

🔌 Usage

await client.batch.getTransactions("batchId", {
    pageSize: 1.1,
    page: 1.1,
});

⚙️ Parameters

batchId: string — Unique Batch Identifier

request: Flagright.BatchGetTransactionsRequest

requestOptions: Batch.RequestOptions

client.batch.createTransactionEvents({ ...params }) -> Flagright.BatchResponse

🔌 Usage

await client.batch.createTransactionEvents({
    data: [
        {
            transactionState: "CREATED",
            timestamp: 1.1,
            transactionId: "transactionId",
        },
    ],
});

⚙️ Parameters

request: Flagright.TransactionEventBatchRequest

requestOptions: Batch.RequestOptions

client.batch.getTransactionEvents(batchId, { ...params }) -> Flagright.BatchTransactionEventMonitoringResults

🔌 Usage

await client.batch.getTransactionEvents("batchId", {
    pageSize: 1.1,
    page: 1.1,
});

⚙️ Parameters

batchId: string — Unique Batch Identifier

request: Flagright.BatchGetTransactionEventsRequest

requestOptions: Batch.RequestOptions

client.batch.createConsumerUsers({ ...params }) -> Flagright.BatchResponse

🔌 Usage

await client.batch.createConsumerUsers({
    lockCraRiskLevel: "true",
    lockKycRiskLevel: "true",
    data: [
        {
            userId: "userId",
            createdTimestamp: 1.1,
        },
    ],
});

⚙️ Parameters

request: Flagright.UserBatchRequest

requestOptions: Batch.RequestOptions

client.batch.getConsumerUsers(batchId, { ...params }) -> Flagright.BatchConsumerUsersWithRulesResult

🔌 Usage

await client.batch.getConsumerUsers("batchId", {
    pageSize: 1.1,
    page: 1.1,
});

⚙️ Parameters

batchId: string — Unique Batch Identifier

request: Flagright.BatchGetConsumerUsersRequest

requestOptions: Batch.RequestOptions

client.batch.createBusinessUsers({ ...params }) -> Flagright.BatchResponse

🔌 Usage

await client.batch.createBusinessUsers({
    lockCraRiskLevel: "true",
    lockKycRiskLevel: "true",
    data: [
        {
            userId: "userId",
            createdTimestamp: 1.1,
            legalEntity: {
                companyGeneralDetails: {
                    legalName: "Ozkan Hazelnut Export JSC",
                    businessIndustry: ["Farming"],
                    mainProductsServicesSold: ["Hazelnut"],
                },
            },
        },
    ],
});

⚙️ Parameters

request: Flagright.BusinessBatchRequest

requestOptions: Batch.RequestOptions

client.batch.getBusinessUsers(batchId, { ...params }) -> Flagright.BatchBusinessUsersWithRulesResults

🔌 Usage

await client.batch.getBusinessUsers("batchId", {
    pageSize: 1.1,
    page: 1.1,
});

⚙️ Parameters

batchId: string — Unique Batch Identifier

request: Flagright.BatchGetBusinessUsersRequest

requestOptions: Batch.RequestOptions

client.batch.createConsumerUserEvents({ ...params }) -> Flagright.BatchResponse

🔌 Usage

await client.batch.createConsumerUserEvents({
    lockCraRiskLevel: "true",
    lockKycRiskLevel: "true",
    data: [
        {
            timestamp: 1.1,
            userId: "userId",
        },
    ],
});

⚙️ Parameters

request: Flagright.ConsumerUserEventBatchRequest

requestOptions: Batch.RequestOptions

client.batch.getConsumerUserEvents(batchId, { ...params }) -> Flagright.BatchConsumerUserEventsRulesResult

🔌 Usage

await client.batch.getConsumerUserEvents("batchId", {
    pageSize: 1.1,
    page: 1.1,
});

⚙️ Parameters

batchId: string — Unique Batch Identifier

request: Flagright.BatchGetConsumerUserEventsRequest

requestOptions: Batch.RequestOptions

client.batch.createBusinessUserEvents({ ...params }) -> Flagright.BatchResponse

🔌 Usage

await client.batch.createBusinessUserEvents({
    lockCraRiskLevel: "true",
    lockKycRiskLevel: "true",
    data: [
        {
            timestamp: 1.1,
            userId: "userId",
        },
    ],
});

⚙️ Parameters

request: Flagright.BusinessUserEventBatchRequest

requestOptions: Batch.RequestOptions

client.batch.getBusinessUserEvents(batchId, { ...params }) -> Flagright.BatchBusinessUserEventsWithRulesResult

🔌 Usage

await client.batch.getBusinessUserEvents("batchId", {
    pageSize: 1.1,
    page: 1.1,
});

⚙️ Parameters

batchId: string — Unique Batch Identifier

request: Flagright.BatchGetBusinessUserEventsRequest

requestOptions: Batch.RequestOptions

TransactionEvents

client.transactionEvents.create({ ...params }) -> Flagright.TransactionEventMonitoringResult

📝 Description

POST Transaction Events

/events/transaction endpoint allows you to operate on the Transaction Events entity.

Transaction events are created after the initial POST /transactions call (which creates a transaction) and are used to:

  • Update the STATE of the transaction, using the transactionState field and manage the Transaction Lifecycle
  • Update the transaction details, using the updatedTransactionAttributes field.

If you have neither of the above two use cases, you do not need to use transaction events.

Payload

Each transaction event needs three mandatory fields:

  • transactionState - STATE of the transaction -> value is set to CREATED after POST /transactions call
  • timestamp- the timestamp of when the event was created or occured in your system
  • transactionId - The ID of the transaction for which this event is generated.

In order to make individual events retrievable, you also need to pass in a unique eventId to the request body.

🔌 Usage

await client.transactionEvents.create({
    transactionState: "SUCCESSFUL",
    timestamp: 1752526580000,
    transactionId: "443dea26147a406b957d9ee3a1247b11",
    eventId: "aaeeb166147a406b957dd9147a406b957",
    eventDescription: "Transaction created",
    metaData: {
        batteryLevel: 76.3,
        deviceLatitude: 13.009711,
        deviceLongitude: 76.102898,
        ipAddress: "79.144.2.20",
        vpnUsed: true,
    },
});

⚙️ Parameters

request: Flagright.TransactionEvent

requestOptions: TransactionEvents.RequestOptions

client.transactionEvents.get(eventId) -> Flagright.TransactionEventWithRulesResult

📝 Description

GET Transaction Events

/events/transaction endpoint allows you to operate on the Transaction Events entity..

You can retrieve any transaction event you created using the POST Transaction Events call.

🔌 Usage

await client.transactionEvents.get("eventId");

⚙️ Parameters

eventId: string — Unique Transaction Identifier

requestOptions: TransactionEvents.RequestOptions

ConsumerUsers

client.consumerUsers.create({ ...params }) -> Flagright.ConsumerUsersCreateResponse

📝 Description

POST Consumer User

/consumer/user endpoint allows you to operate on the Consumer user entity.

In order to pass the payload of a User to Flagright and verify the User, you will need to call this endpoint with the User payload. Not all fields are mandatory, you will only need to pass in the fields that you have and are relevant for your compliance setup.

Payload

Each consumer user needs two mandatory fields:

  • userId - Unique identifier for the user
  • createdTimestamp - UNIX timestamp in milliseconds for when the User is created in your system

🔌 Usage

await client.consumerUsers.create({
    lockCraRiskLevel: "true",
    lockKycRiskLevel: "true",
    validateUserId: "true",
    body: {
        userId: "96647cfd9e8fe66ee0f3362e011e34e8",
        createdTimestamp: 1641654664000,
        userDetails: {
            name: {
                firstName: "Baran",
                middleName: "Realblood",
                lastName: "Ozkan",
            },
            dateOfBirth: "1991-01-01",
            countryOfResidence: "US",
            countryOfNationality: "DE",
        },
        legalDocuments: [
            {
                documentType: "passport",
                documentNumber: "Z9431P",
                documentIssuedDate: 1639939034000,
                documentExpirationDate: 1839939034000,
                documentIssuedCountry: "DE",
                tags: [
                    {
                        key: "customerType",
                        value: "wallet",
                    },
                ],
            },
        ],
        contactDetails: {
            emailIds: ["baran@flagright.com"],
            contactNumbers: ["+37112345432"],
            websites: ["flagright.com"],
            addresses: [
                {
                    addressLines: ["Klara-Franke Str 20"],
                    postcode: "10557",
                    city: "Berlin",
                    state: "Berlin",
                    country: "Germany",
                    tags: [
                        {
                            key: "customKey",
                            value: "customValue",
                        },
                    ],
                },
            ],
        },
        tags: [
            {
                key: "customKey",
                value: "customValue",
            },
        ],
    },
});

⚙️ Parameters

request: Flagright.ConsumerUsersCreateRequest

requestOptions: ConsumerUsers.RequestOptions

client.consumerUsers.get(userId) -> Flagright.UserWithRulesResult

📝 Description

GET Consumer User

/consumer/user endpoint allows you to operate on the Consumer User entity.

Calling GET /consumer/user/{userId} will return the entire user payload and rule execution results for the user with the corresponding userId

🔌 Usage

await client.consumerUsers.get("userId");

⚙️ Parameters

userId: string

requestOptions: ConsumerUsers.RequestOptions

BusinessUsers

client.businessUsers.create({ ...params }) -> Flagright.BusinessUsersCreateResponse

📝 Description

POST Business User

/business/user endpoint allows you to operate on the Business user entity.

In order to pass the payload of a User to Flagright and verify the User, you will need to call this endpoint with the User payload. Not all fields are mandatory, you will only need to pass in the fields that you have and are relevant for your compliance setup.

Payload

Each business user needs three mandatory fields:

  • userId - Unique identifier for the user
  • legalEntity - Details of the business legal entity (CompanyGeneralDetails, FinancialDetails etc) - only legalNamein CompanyGeneralDetails is mandatory
  • createdTimestamp - UNIX timestamp in milliseconds for when the User is created in your system

🔌 Usage

await client.businessUsers.create({
    lockCraRiskLevel: "true",
    lockKycRiskLevel: "true",
    validateUserId: "true",
    body: {
        userId: "userId",
        createdTimestamp: 1.1,
        legalEntity: {
            companyGeneralDetails: {
                legalName: "Ozkan Hazelnut Export JSC",
                businessIndustry: ["Farming"],
                mainProductsServicesSold: ["Hazelnut"],
            },
        },
    },
});

⚙️ Parameters

request: Flagright.BusinessUsersCreateRequest

requestOptions: BusinessUsers.RequestOptions

client.businessUsers.get(userId) -> Flagright.BusinessWithRulesResult

📝 Description

GET Business User

/business/user endpoint allows you to operate on the Business User entity.

Calling GET /business/user/{userId} will return the entire User payload and rule execution results for the User with the corresponding userId

🔌 Usage

await client.businessUsers.get("userId");

⚙️ Parameters

userId: string

requestOptions: BusinessUsers.RequestOptions

ConsumerUserEvents

client.consumerUserEvents.create({ ...params }) -> Flagright.UserWithRulesResult

📝 Description

POST Consumer User Events

/events/consumer/user endpoint allows you to operate on the Consumer User Events entity.

User events are created after the initial POST /consumer/users call (which creates a user) and are used to:

  • Update the STATE and KYC Status of the user, using the userStateDetails or kycStatusDetails field
  • Update the user details, using the updatedConsumerUserAttributes field.

If you have neither of the above two use cases, you do not need to use user events.

Payload

Each user event needs three mandatory fields:

  • timestamp- the timestamp of when the event was created or occured in your system
  • userId - The ID of the transaction for which this event is generated.

In order to make individual events retrievable, you also need to pass in a unique eventId to the request body.

🔌 Usage

await client.consumerUserEvents.create({
    allowUserTypeConversion: "true",
    lockKycRiskLevel: "true",
    lockCraRiskLevel: "true",
    body: {
        timestamp: 1.1,
        userId: "userId",
    },
});

⚙️ Parameters

request: Flagright.ConsumerUserEventsCreateRequest

requestOptions: ConsumerUserEvents.RequestOptions

client.consumerUserEvents.get(eventId) -> Flagright.ConsumerUserEventWithRulesResult

📝 Description

GET a Consumer User Event

You can retrieve any consumer user event you created using the POST Consumer User Events call.

🔌 Usage

await client.consumerUserEvents.get("eventId");

⚙️ Parameters

eventId: string — Unique Consumer User Event Identifier

requestOptions: ConsumerUserEvents.RequestOptions

BusinessUserEvents

client.businessUserEvents.create({ ...params }) -> Flagright.BusinessWithRulesResult

📝 Description

POST Business User Events

/events/business/user endpoint allows you to operate on the Business User Events entity.

User events are created after the initial POST /business/users call (which creates a user) and are used to:

  • Update the STATE and KYC Status of the user, using the userStateDetails or kycStatusDetails field
  • Update the user details, using the updatedBusinessUserAttributes field.

If you have neither of the above two use cases, you do not need to use user events.

Payload

Each user event needs three mandatory fields:

  • timestamp- the timestamp of when the event was created or occured in your system
  • userId - The ID of the transaction for which this event is generated.

In order to make individual events retrievable, you also need to pass in a unique eventId to the request body.

🔌 Usage

await client.businessUserEvents.create({
    allowUserTypeConversion: "true",
    lockKycRiskLevel: "true",
    lockCraRiskLevel: "true",
    body: {
        timestamp: 1.1,
        userId: "userId",
    },
});

⚙️ Parameters

request: Flagright.BusinessUserEventsCreateRequest

requestOptions: BusinessUserEvents.RequestOptions

client.businessUserEvents.get(eventId) -> Flagright.BusinessUserEventWithRulesResult

📝 Description

GET a Business User Event

You can retrieve any business user event you created using the POST Business User Events call.

🔌 Usage

await client.businessUserEvents.get("eventId");

⚙️ Parameters

eventId: string — Unique Business User Event Identifier

requestOptions: BusinessUserEvents.RequestOptions