Skip to content

Commit 8a5b4d6

Browse files
committed
Deprecate old Webhook handlers
1 parent c48c5c5 commit 8a5b4d6

File tree

1 file changed

+57
-1
lines changed

1 file changed

+57
-1
lines changed

src/notification/bankingWebhookHandler.ts

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,34 @@
77

88
import {configurationWebhooks, acsWebhooks, reportWebhooks, transferWebhooks, transactionWebhooks, negativeBalanceWarningWebhooks, balanceWebhooks} from "../typings";
99

10+
/**
11+
* DEPRECATED
12+
*
13+
* Centralised handler for de-serialising all (Banking) webhook payloads.
14+
*
15+
* @deprecated Each webhook provides its own handler, for example use AcsWebhooksHandler to process AcsWebhooks events
16+
* Use the specific WebhookHandler implementation: AcsWebhooksHandler, ReportWebhooksHandler, ConfigurationWebhooksHandler,
17+
* TransferWebhooksHandler, TransactionWebhooksHandler, etc..
18+
*/
1019
class BankingWebhookHandler {
1120
private readonly payload: string;
1221

22+
/**
23+
* Constructor
24+
* @deprecated Use specific webhook handlers instead.
25+
*
26+
* @param jsonPayload
27+
*/
1328
public constructor(jsonPayload: string) {
1429
this.payload = JSON.parse(jsonPayload);
1530
}
1631

17-
// Return generic webhook type
32+
/**
33+
* Return generic webhook type
34+
* @deprecated Use specific webhook handlers instead.
35+
*
36+
* @param jsonPayload
37+
*/
1838
public getGenericWebhook(): acsWebhooks.AuthenticationNotificationRequest
1939
| acsWebhooks.RelayedAuthenticationRequest
2040
| balanceWebhooks.BalanceAccountBalanceNotificationRequest
@@ -82,50 +102,86 @@ class BankingWebhookHandler {
82102
throw new Error("Could not parse the json payload: " + this.payload);
83103
}
84104

105+
/**
106+
* @deprecated Use AcsWebhooksHandler instead.
107+
*/
85108
public getAuthenticationNotificationRequest(): acsWebhooks.AuthenticationNotificationRequest {
86109
return acsWebhooks.ObjectSerializer.deserialize(this.payload, "AuthenticationNotificationRequest");
87110
}
88111

112+
/**
113+
* @deprecated Use AcsWebhooksHandler instead.
114+
*/
89115
public getRelayedAuthenticationRequest(): acsWebhooks.RelayedAuthenticationRequest {
90116
return acsWebhooks.ObjectSerializer.deserialize(this.payload, "RelayedAuthenticationRequest");
91117
}
92118

119+
/**
120+
* @deprecated Use BalanceWebhooksHandler instead.
121+
*/
93122
public getBalanceAccountBalanceNotificationRequest(): balanceWebhooks.BalanceAccountBalanceNotificationRequest {
94123
return balanceWebhooks.ObjectSerializer.deserialize(this.payload, "BalanceAccountBalanceNotificationRequest");
95124
}
96125

126+
/**
127+
* @deprecated Use ConfigurationWebhooksHandler instead.
128+
*/
97129
public getAccountHolderNotificationRequest(): configurationWebhooks.AccountHolderNotificationRequest {
98130
return configurationWebhooks.ObjectSerializer.deserialize(this.payload, "AccountHolderNotificationRequest");
99131
}
100132

133+
/**
134+
* @deprecated Use ConfigurationWebhooksHandler instead.
135+
*/
101136
public getCardOrderNotificationRequest(): configurationWebhooks.CardOrderNotificationRequest {
102137
return configurationWebhooks.ObjectSerializer.deserialize(this.payload, "CardOrderNotificationRequest");
103138
}
104139

140+
/**
141+
* @deprecated Use ConfigurationWebhooksHandler instead.
142+
*/
105143
public getPaymentNotificationRequest(): configurationWebhooks.PaymentNotificationRequest {
106144
return configurationWebhooks.ObjectSerializer.deserialize(this.payload, "PaymentNotificationRequest");
107145
}
108146

147+
/**
148+
* @deprecated Use ConfigurationWebhooksHandler instead.
149+
*/
109150
public getSweepConfigurationNotificationRequest(): configurationWebhooks.SweepConfigurationNotificationRequest {
110151
return configurationWebhooks.ObjectSerializer.deserialize(this.payload, "SweepConfigurationNotificationRequest");
111152
}
112153

154+
/**
155+
* @deprecated Use NegativeBalanceWarningWebhooksHandler instead.
156+
*/
113157
public getNegativeBalanceCompensationWarningNotificationRequest(): negativeBalanceWarningWebhooks.NegativeBalanceCompensationWarningNotificationRequest {
114158
return negativeBalanceWarningWebhooks.ObjectSerializer.deserialize(this.payload, "NegativeBalanceCompensationWarningNotificationRequest");
115159
}
116160

161+
/**
162+
* @deprecated Use ReportWebhooksHandler instead.
163+
*/
117164
public getReportNotificationRequest(): reportWebhooks.ReportNotificationRequest {
118165
return reportWebhooks.ObjectSerializer.deserialize(this.payload, "ReportNotificationRequest");
119166
}
120167

168+
/**
169+
* @deprecated Use TransferWebhooksHandler instead.
170+
*/
121171
public getTransferNotificationRequest(): transferWebhooks.TransferNotificationRequest {
122172
return transferWebhooks.ObjectSerializer.deserialize(this.payload, "TransferNotificationRequest");
123173
}
124174

175+
/**
176+
* @deprecated Use TransactionWebhooksHandler instead.
177+
*/
125178
public getTransactionNotificationRequest(): transactionWebhooks.TransactionNotificationRequestV4 {
126179
return transactionWebhooks.ObjectSerializer.deserialize(this.payload, "TransactionNotificationRequestV4");
127180
}
128181

182+
/**
183+
* @deprecated Use BalanceWebhooksHandler instead.
184+
*/
129185
public BalanceAccountBalanceNotificationRequest(): balanceWebhooks.BalanceAccountBalanceNotificationRequest {
130186
return balanceWebhooks.ObjectSerializer.deserialize(this.payload, "BalanceAccountBalanceNotificationRequest");
131187
}

0 commit comments

Comments
 (0)