Skip to content

Commit

Permalink
Release 1.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Jan 31, 2024
1 parent 549d28b commit 24941c3
Show file tree
Hide file tree
Showing 33 changed files with 3,160 additions and 24 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "flagright",
"version": "1.3.3",
"version": "1.3.4",
"private": false,
"repository": "https://github.com/flagright/flagright-node",
"main": "./index.js",
Expand Down
16 changes: 16 additions & 0 deletions src/api/errors/ForbiddenError.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

import * as errors from "../../errors";

export class ForbiddenError extends errors.FlagrightError {
constructor(body?: unknown) {
super({
message: "ForbiddenError",
statusCode: 403,
body: body,
});
Object.setPrototypeOf(this, ForbiddenError.prototype);
}
}
1 change: 1 addition & 0 deletions src/api/errors/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from "./BadRequestError";
export * from "./UnauthorizedError";
export * from "./ForbiddenError";
export * from "./TooManyRequestsError";
532 changes: 531 additions & 1 deletion src/api/resources/businessUserEvents/client/Client.ts

Large diffs are not rendered by default.

Large diffs are not rendered by default.

534 changes: 532 additions & 2 deletions src/api/resources/businessUsers/client/Client.ts

Large diffs are not rendered by default.

439 changes: 438 additions & 1 deletion src/api/resources/consumerUserEvents/client/Client.ts

Large diffs are not rendered by default.

Large diffs are not rendered by default.

451 changes: 449 additions & 2 deletions src/api/resources/consumerUsers/client/Client.ts

Large diffs are not rendered by default.

42 changes: 40 additions & 2 deletions src/api/resources/transactionEvents/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,41 @@ export class TransactionEvents {
* @throws {@link Flagright.BadRequestError}
* @throws {@link Flagright.UnauthorizedError}
* @throws {@link Flagright.TooManyRequestsError}
*
* @example
* await flagright.transactionEvents.create({
* transactionState: Flagright.TransactionState.Successful,
* timestamp: 1431231244001,
* transactionId: "443dea26147a406b957d9ee3a1247b11",
* eventId: "aaeeb166147a406b957dd9147a406b957",
* eventDescription: "Transaction created",
* updatedTransactionAttributes: {
* transactionState: Flagright.TransactionState.Created,
* originAmountDetails: {
* transactionAmount: 1.1,
* transactionCurrency: Flagright.CurrencyCode.OneInch,
* country: Flagright.CountryCode.Af
* },
* destinationAmountDetails: {
* transactionAmount: 1.1,
* transactionCurrency: Flagright.CurrencyCode.OneInch,
* country: Flagright.CountryCode.Af
* },
* originDeviceData: {},
* destinationDeviceData: {},
* tags: [{
* key: "string",
* value: "string"
* }]
* },
* metaData: {
* batteryLevel: 76.3,
* deviceLatitude: 13.009711,
* deviceLongitude: 76.102898,
* ipAddress: "79.144.2.20",
* vpnUsed: true
* }
* })
*/
public async create(
request: Flagright.TransactionEvent,
Expand All @@ -63,7 +98,7 @@ export class TransactionEvents {
"x-api-key": await core.Supplier.get(this._options.apiKey),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "flagright",
"X-Fern-SDK-Version": "1.3.3",
"X-Fern-SDK-Version": "1.3.4",
},
contentType: "application/json",
body: await serializers.TransactionEvent.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
Expand Down Expand Up @@ -118,6 +153,9 @@ export class TransactionEvents {
* You can retrieve any transaction event you create using the [POST Transaction Events](https://docs.flagright.com/docs/flagright-api/d7c4dc4d02850-create-a-transaction-event) call.
* @throws {@link Flagright.UnauthorizedError}
* @throws {@link Flagright.TooManyRequestsError}
*
* @example
* await flagright.transactionEvents.get("string")
*/
public async get(
eventId: string,
Expand All @@ -133,7 +171,7 @@ export class TransactionEvents {
"x-api-key": await core.Supplier.get(this._options.apiKey),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "flagright",
"X-Fern-SDK-Version": "1.3.3",
"X-Fern-SDK-Version": "1.3.4",
},
contentType: "application/json",
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
Expand Down
66 changes: 64 additions & 2 deletions src/api/resources/transactions/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,64 @@ export class Transactions {
* - `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.
* @throws {@link Flagright.BadRequestError}
* @throws {@link Flagright.UnauthorizedError}
* @throws {@link Flagright.ForbiddenError}
* @throws {@link Flagright.TooManyRequestsError}
*
* @example
* await flagright.transactions.verify({
* validateOriginUserId: Flagright.BooleanString.True,
* validateDestinationUserId: Flagright.BooleanString.True,
* body: {
* transactionState: Flagright.TransactionState.Created,
* originAmountDetails: {
* transactionAmount: 800,
* transactionCurrency: Flagright.CurrencyCode.Eur,
* country: Flagright.CountryCode.De
* },
* destinationAmountDetails: {
* transactionAmount: 68351.34,
* transactionCurrency: Flagright.CurrencyCode.Inr,
* country: Flagright.CountryCode.In
* },
* 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"
* }],
* type: Flagright.TransactionType.Deposit,
* transactionId: "7b80a539eea6e78acbd6d458e5971482",
* timestamp: 1641654664000,
* originUserId: "8650a2611d0771cba03310f74bf6",
* destinationUserId: "9350a2611e0771cba03310f74bf6"
* }
* })
*/
public async verify(
request: Flagright.TransactionsVerifyRequest,
Expand All @@ -73,7 +130,7 @@ export class Transactions {
"x-api-key": await core.Supplier.get(this._options.apiKey),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "flagright",
"X-Fern-SDK-Version": "1.3.3",
"X-Fern-SDK-Version": "1.3.4",
},
contentType: "application/json",
queryParameters: _queryParams,
Expand All @@ -96,6 +153,8 @@ export class Transactions {
throw new Flagright.BadRequestError(_response.error.body);
case 401:
throw new Flagright.UnauthorizedError(_response.error.body);
case 403:
throw new Flagright.ForbiddenError(_response.error.body);
case 429:
throw new Flagright.TooManyRequestsError(_response.error.body);
default:
Expand Down Expand Up @@ -129,6 +188,9 @@ export class Transactions {
* Calling `GET /transactions/{transactionId}` will return the entire transaction payload and rule execution results for the transaction with the corresponding `transactionId`
* @throws {@link Flagright.UnauthorizedError}
* @throws {@link Flagright.TooManyRequestsError}
*
* @example
* await flagright.transactions.get("string")
*/
public async get(
transactionId: string,
Expand All @@ -144,7 +206,7 @@ export class Transactions {
"x-api-key": await core.Supplier.get(this._options.apiKey),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "flagright",
"X-Fern-SDK-Version": "1.3.3",
"X-Fern-SDK-Version": "1.3.4",
},
contentType: "application/json",
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,63 @@

import * as Flagright from "../../../..";

/**
* @example
* {
* validateOriginUserId: Flagright.BooleanString.True,
* validateDestinationUserId: Flagright.BooleanString.True,
* body: {
* transactionState: Flagright.TransactionState.Created,
* originAmountDetails: {
* transactionAmount: 800,
* transactionCurrency: Flagright.CurrencyCode.Eur,
* country: Flagright.CountryCode.De
* },
* destinationAmountDetails: {
* transactionAmount: 68351.34,
* transactionCurrency: Flagright.CurrencyCode.Inr,
* country: Flagright.CountryCode.In
* },
* 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"
* }],
* type: Flagright.TransactionType.Deposit,
* transactionId: "7b80a539eea6e78acbd6d458e5971482",
* timestamp: 1641654664000,
* originUserId: "8650a2611d0771cba03310f74bf6",
* destinationUserId: "9350a2611e0771cba03310f74bf6"
* }
* }
*/
export interface TransactionsVerifyRequest {
/**
* Boolean string whether Flagright should validate if provided originUserId exist. True by default
Expand Down
1 change: 1 addition & 0 deletions src/api/types/AchDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface AchDetails {
bankAddress?: Flagright.Address;
/** Beneficiary name of the account */
beneficiaryName?: string;
emailId?: Flagright.EmailId;
/** Additional information that can be added via tags */
tags?: Flagright.Tag[];
}
1 change: 1 addition & 0 deletions src/api/types/CardDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import * as Flagright from "..";
export interface CardDetails {
/** Unique card fingerprint that helps identify a specific card without having to use explicit card number. This is likely available at your card payment scheme provider */
cardFingerprint?: string;
emailId?: Flagright.EmailId;
cardIssuedCountry?: Flagright.CountryCode;
/** Reference for the transaction */
transactionReferenceField?: string;
Expand Down
8 changes: 8 additions & 0 deletions src/api/types/EmailId.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

/**
* Email ID format. Ex: [email protected]
*/
export type EmailId = string;
1 change: 1 addition & 0 deletions src/api/types/GenericBankAccountDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface GenericBankAccountDetails {
/** Name of the account holder */
name?: string;
bankAddress?: Flagright.Address;
emailId?: Flagright.EmailId;
/** Special instructions to be specified if any */
specialInstructions?: string;
paymentChannel?: string;
Expand Down
5 changes: 3 additions & 2 deletions src/api/types/IbanDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ export interface IbanDetails {
iban?: string;
/** Name of the bank account holder */
name?: string;
/** Additional information that can be added via tags */
tags?: Flagright.Tag[];
emailId?: Flagright.EmailId;
/** Branch code of the bank. In some countries, this can be the same as the bank's SWIFT code */
bankBranchCode?: string;
paymentChannel?: string;
/** Additional information that can be added via tags */
tags?: Flagright.Tag[];
}
1 change: 1 addition & 0 deletions src/api/types/MpesaDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface MpesaDetails {
transactionType: Flagright.MpesaTransactionType;
/** Contact Number of the account holder */
phoneNumber: string;
emailId?: Flagright.EmailId;
/** Additional information that can be added via tags */
tags?: Flagright.Tag[];
}
1 change: 1 addition & 0 deletions src/api/types/SwiftDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface SwiftDetails {
/** Name of the account holder */
name?: string;
bankAddress?: Flagright.Address;
emailId?: Flagright.EmailId;
/** Special instructions if any */
specialInstructions?: string;
/** Additional information that can be added via tags */
Expand Down
1 change: 1 addition & 0 deletions src/api/types/UpiDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface UpiDetails {
interfaceProvider?: string;
/** Name of the account holder */
name?: string;
emailId?: Flagright.EmailId;
/** Additional information that can be added via tags */
tags?: Flagright.Tag[];
}
1 change: 1 addition & 0 deletions src/api/types/WalletDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface WalletDetails {
paymentChannel?: string;
/** Name of the account holder for a specific wallet */
name?: string;
emailId?: Flagright.EmailId;
/** Additional information that can be added via tags */
tags?: Flagright.Tag[];
/** Phone number associated with the wallet, if any */
Expand Down
1 change: 1 addition & 0 deletions src/api/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export * from "./User";
export * from "./Person";
export * from "./LegalDocument";
export * from "./Tag";
export * from "./EmailId";
export * from "./Transaction";
export * from "./TransactionUpdatableOriginPaymentDetails";
export * from "./TransactionUpdatableDestinationPaymentDetails";
Expand Down
2 changes: 2 additions & 0 deletions src/serialization/types/AchDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const AchDetails: core.serialization.ObjectSchema<serializers.AchDetails.
name: core.serialization.string().optional(),
bankAddress: core.serialization.lazyObject(async () => (await import("..")).Address).optional(),
beneficiaryName: core.serialization.string().optional(),
emailId: core.serialization.lazy(async () => (await import("..")).EmailId).optional(),
tags: core.serialization.list(core.serialization.lazyObject(async () => (await import("..")).Tag)).optional(),
});

Expand All @@ -25,6 +26,7 @@ export declare namespace AchDetails {
name?: string | null;
bankAddress?: serializers.Address.Raw | null;
beneficiaryName?: string | null;
emailId?: serializers.EmailId.Raw | null;
tags?: serializers.Tag.Raw[] | null;
}
}
2 changes: 2 additions & 0 deletions src/serialization/types/CardDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import * as core from "../../core";
export const CardDetails: core.serialization.ObjectSchema<serializers.CardDetails.Raw, Flagright.CardDetails> =
core.serialization.object({
cardFingerprint: core.serialization.string().optional(),
emailId: core.serialization.lazy(async () => (await import("..")).EmailId).optional(),
cardIssuedCountry: core.serialization.lazy(async () => (await import("..")).CountryCode).optional(),
transactionReferenceField: core.serialization.string().optional(),
"3DsDone": core.serialization.property("3dsDone", core.serialization.boolean().optional()),
Expand All @@ -27,6 +28,7 @@ export const CardDetails: core.serialization.ObjectSchema<serializers.CardDetail
export declare namespace CardDetails {
interface Raw {
cardFingerprint?: string | null;
emailId?: serializers.EmailId.Raw | null;
cardIssuedCountry?: serializers.CountryCode.Raw | null;
transactionReferenceField?: string | null;
"3dsDone"?: boolean | null;
Expand Down
14 changes: 14 additions & 0 deletions src/serialization/types/EmailId.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

import * as serializers from "..";
import * as Flagright from "../../api";
import * as core from "../../core";

export const EmailId: core.serialization.Schema<serializers.EmailId.Raw, Flagright.EmailId> =
core.serialization.string();

export declare namespace EmailId {
type Raw = string;
}
Loading

0 comments on commit 24941c3

Please sign in to comment.