Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export type GenericWebhook =
| configurationWebhooks.AccountHolderNotificationRequest
| configurationWebhooks.BalanceAccountNotificationRequest
| configurationWebhooks.CardOrderNotificationRequest
| configurationWebhooks.MandateNotificationRequest
| configurationWebhooks.NetworkTokenNotificationRequest
| configurationWebhooks.PaymentNotificationRequest
| configurationWebhooks.ScoreNotificationRequest
Expand Down Expand Up @@ -57,6 +58,10 @@ export class ConfigurationWebhooksHandler {
return this.getCardOrderNotificationRequest();
}

if(Object.values(configurationWebhooks.MandateNotificationRequest.TypeEnum).includes(type)) {
return this.getMandateNotificationRequest();
}

if(Object.values(configurationWebhooks.NetworkTokenNotificationRequest.TypeEnum).includes(type)) {
return this.getNetworkTokenNotificationRequest();
}
Expand Down Expand Up @@ -104,6 +109,15 @@ export class ConfigurationWebhooksHandler {
return configurationWebhooks.ObjectSerializer.deserialize(this.payload, "CardOrderNotificationRequest");
}

/**
* Deserialize the webhook payload into a MandateNotificationRequest
*
* @returns Deserialized MandateNotificationRequest object.
*/
public getMandateNotificationRequest(): configurationWebhooks.MandateNotificationRequest {
return configurationWebhooks.ObjectSerializer.deserialize(this.payload, "MandateNotificationRequest");
}

/**
* Deserialize the webhook payload into a NetworkTokenNotificationRequest
*
Expand Down
109 changes: 109 additions & 0 deletions src/typings/configurationWebhooks/mandate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/*
* The version of the OpenAPI document: v2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/

import { MandateBankAccount } from "./mandateBankAccount";


export class Mandate {
/**
* The unique identifier of the balance account linked to the payment instrument.
*/
"balanceAccountId"?: string;
"counterparty"?: MandateBankAccount | null;
"createdAt"?: any;
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The type of createdAt is any, which is not type-safe. For better type safety and consistency with other timestamp fields (like timestamp in MandateNotificationRequest), this should be typed as Date. The same applies to updatedAt on line 36. You will also need to update the attributeTypeMap for both properties to use "type": "Date" and "format": "date-time" (see lines 58-59 and 88-89).

Suggested change
"createdAt"?: any;
"createdAt"?: Date;

/**
* The unique identifier of the mandate.
*/
"id"?: string;
/**
* The unique identifier of the payment instrument linked to the mandate.
*/
"paymentInstrumentId"?: string;
/**
* The status of the mandate. Possible values: **pending**, **approved**, **cancelled**.
*/
"status"?: Mandate.StatusEnum;
/**
* The type of mandate. Possible value: **bacs**.
*/
"type"?: Mandate.TypeEnum;
"updatedAt"?: any;

static readonly discriminator: string | undefined = undefined;

static readonly mapping: {[index: string]: string} | undefined = undefined;

static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
{
"name": "balanceAccountId",
"baseName": "balanceAccountId",
"type": "string",
"format": ""
},
{
"name": "counterparty",
"baseName": "counterparty",
"type": "MandateBankAccount | null",
"format": ""
},
{
"name": "createdAt",
"baseName": "createdAt",
"type": "any",
"format": ""
},
{
"name": "id",
"baseName": "id",
"type": "string",
"format": ""
},
{
"name": "paymentInstrumentId",
"baseName": "paymentInstrumentId",
"type": "string",
"format": ""
},
{
"name": "status",
"baseName": "status",
"type": "Mandate.StatusEnum",
"format": ""
},
{
"name": "type",
"baseName": "type",
"type": "Mandate.TypeEnum",
"format": ""
},
{
"name": "updatedAt",
"baseName": "updatedAt",
"type": "any",
"format": ""
} ];

static getAttributeTypeMap() {
return Mandate.attributeTypeMap;
}

public constructor() {
}
}

export namespace Mandate {
export enum StatusEnum {
Approved = 'approved',
Cancelled = 'cancelled',
Pending = 'pending'
}
export enum TypeEnum {
Bacs = 'bacs'
}
}
43 changes: 43 additions & 0 deletions src/typings/configurationWebhooks/mandateBankAccount.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* The version of the OpenAPI document: v2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/

import { MandatePartyIdentification } from "./mandatePartyIdentification";
import { UKLocalMandateAccountIdentification } from "./uKLocalMandateAccountIdentification";


export class MandateBankAccount {
"accountHolder": MandatePartyIdentification;
"accountIdentification": UKLocalMandateAccountIdentification;
Comment on lines +15 to +16
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The properties accountHolder and accountIdentification are declared as required (non-optional) but are not initialized in the constructor. This can lead to runtime errors if an instance is created and these properties are not immediately populated. This appears to be a systemic issue in the generated code. If these properties are truly required by the API, the ObjectSerializer should validate their presence. If they can be absent, they should be marked as optional (?) to reflect that and to comply with TypeScript's strict property initialization.


static readonly discriminator: string | undefined = undefined;

static readonly mapping: {[index: string]: string} | undefined = undefined;

static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
{
"name": "accountHolder",
"baseName": "accountHolder",
"type": "MandatePartyIdentification",
"format": ""
},
{
"name": "accountIdentification",
"baseName": "accountIdentification",
"type": "UKLocalMandateAccountIdentification",
"format": ""
} ];

static getAttributeTypeMap() {
return MandateBankAccount.attributeTypeMap;
}

public constructor() {
}
}

45 changes: 45 additions & 0 deletions src/typings/configurationWebhooks/mandateNotificationData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* The version of the OpenAPI document: v2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/

import { Mandate } from "./mandate";


export class MandateNotificationData {
/**
* The unique identifier of the balance platform.
*/
"balancePlatform"?: string;
"mandate"?: Mandate | null;

static readonly discriminator: string | undefined = undefined;

static readonly mapping: {[index: string]: string} | undefined = undefined;

static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
{
"name": "balancePlatform",
"baseName": "balancePlatform",
"type": "string",
"format": ""
},
{
"name": "mandate",
"baseName": "mandate",
"type": "Mandate | null",
"format": ""
} ];

static getAttributeTypeMap() {
return MandateNotificationData.attributeTypeMap;
}

public constructor() {
}
}

71 changes: 71 additions & 0 deletions src/typings/configurationWebhooks/mandateNotificationRequest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* The version of the OpenAPI document: v2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/

import { MandateNotificationData } from "./mandateNotificationData";


export class MandateNotificationRequest {
"data": MandateNotificationData;
/**
* The environment from which the webhook originated. Possible values: **test**, **live**.
*/
"environment": string;
/**
* When the event was queued.
*/
"timestamp"?: Date;
/**
* Type of webhook.
*/
"type": MandateNotificationRequest.TypeEnum;
Comment on lines +14 to +26
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The properties data, environment, and type are declared as required (non-optional) but are not initialized in the constructor. This can lead to runtime errors if an instance is created and these properties are not immediately populated. This appears to be a systemic issue in the generated code. If these properties are truly required by the API, the ObjectSerializer should validate their presence. If they can be absent, they should be marked as optional (?) to reflect that and to comply with TypeScript's strict property initialization.


static readonly discriminator: string | undefined = undefined;

static readonly mapping: {[index: string]: string} | undefined = undefined;

static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
{
"name": "data",
"baseName": "data",
"type": "MandateNotificationData",
"format": ""
},
{
"name": "environment",
"baseName": "environment",
"type": "string",
"format": ""
},
{
"name": "timestamp",
"baseName": "timestamp",
"type": "Date",
"format": "date-time"
},
{
"name": "type",
"baseName": "type",
"type": "MandateNotificationRequest.TypeEnum",
"format": ""
} ];

static getAttributeTypeMap() {
return MandateNotificationRequest.attributeTypeMap;
}

public constructor() {
}
}

export namespace MandateNotificationRequest {
export enum TypeEnum {
BalancePlatformMandateCreated = 'balancePlatform.mandate.created',
BalancePlatformMandateUpdated = 'balancePlatform.mandate.updated'
}
}
36 changes: 36 additions & 0 deletions src/typings/configurationWebhooks/mandatePartyIdentification.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* The version of the OpenAPI document: v2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/


export class MandatePartyIdentification {
/**
* The full name of the entity that owns the bank account. Supported characters: [a-z] [A-Z] [0-9] , . ; : - — / \\ + & ! ? @ ( ) \" \' and space.
*/
"fullName"?: string;

static readonly discriminator: string | undefined = undefined;

static readonly mapping: {[index: string]: string} | undefined = undefined;

static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
{
"name": "fullName",
"baseName": "fullName",
"type": "string",
"format": ""
} ];

static getAttributeTypeMap() {
return MandatePartyIdentification.attributeTypeMap;
}

public constructor() {
}
}

6 changes: 6 additions & 0 deletions src/typings/configurationWebhooks/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ export * from "./deliveryContact"
export * from "./device"
export * from "./expiry"
export * from "./ibanAccountIdentification"
export * from "./mandate"
export * from "./mandateBankAccount"
export * from "./mandateNotificationData"
export * from "./mandateNotificationRequest"
export * from "./mandatePartyIdentification"
export * from "./name"
export * from "./networkTokenNotificationDataV2"
export * from "./networkTokenNotificationRequest"
Expand All @@ -54,6 +59,7 @@ export * from "./sweepConfigurationV2"
export * from "./sweepCounterparty"
export * from "./sweepSchedule"
export * from "./tokenAuthentication"
export * from "./uKLocalMandateAccountIdentification"
export * from "./validationFacts"
export * from "./verificationDeadline"
export * from "./verificationError"
Expand Down
Loading
Loading