• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Adyen / adyen-node-api-library / 5786763605

pending completion
5786763605

Pull #1159

github

web-flow
Merge 78b6393cf into cb8de0b32
Pull Request #1159: Release v14.0.0

97 of 149 branches covered (65.1%)

Branch coverage included in aggregate %.

1519 of 1519 new or added lines in 79 files covered. (100.0%)

1834 of 2388 relevant lines covered (76.8%)

30.72 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

29.41
/src/notification/bankingWebhookHandler.ts
1
/*
2
 * Adyen NodeJS API Library
3
 * Copyright (c) 2023 Adyen B.V.
4
 * This file is open source and available under the MIT license.
5
 * See the LICENSE file for more info.
6
 */
7
import {configurationWebhooks} from "../typings";
2✔
8
import {reportWebhooks} from "../typings";
2✔
9
import {transferWebhooks} from "../typings";
2✔
10
import {TransferNotificationRequest} from "../typings/transferWebhooks/transferNotificationRequest";
11

12
class BankingWebhookHandler {
13
    private readonly payload: string;
14

15
    public constructor(jsonPayload: string) {
16
        this.payload = JSON.parse(jsonPayload)
2✔
17
    }
18

19
    // Return generic webhook type
20
    public getGenericWebhook(): configurationWebhooks.AccountHolderNotificationRequest
21
        | configurationWebhooks.BalanceAccountNotificationRequest
22
        | configurationWebhooks.PaymentNotificationRequest
23
        | configurationWebhooks.SweepConfigurationNotificationRequest
24
        | reportWebhooks.ReportNotificationRequest
25
        | TransferNotificationRequest
26
        | void {
27
        const type = this.payload['type'];
2✔
28
        if(Object.values(configurationWebhooks.AccountHolderNotificationRequest.TypeEnum).includes(type)){
2✔
29
            return this.getAccountHolderNotificationRequest();
2✔
30
        }
31

32
        if(Object.values(configurationWebhooks.BalanceAccountNotificationRequest.TypeEnum).includes(type)){
×
33
            return this.getBalanceAccountNotificationRequest();
×
34
        }
35

36
        if(Object.values(configurationWebhooks.CardOrderNotificationRequest.TypeEnum).includes(type)){
×
37
            return this.getCardOrderNotificationRequest();
×
38
        }
39

40
        if(Object.values(configurationWebhooks.PaymentNotificationRequest.TypeEnum).includes(type)){
×
41
            return this.getPaymentNotificationRequest();
×
42
        }
43

44
        if(Object.values(configurationWebhooks.SweepConfigurationNotificationRequest.TypeEnum).includes(type)){
×
45
            return this.getSweepConfigurationNotificationRequest();
×
46
        }
47

48
        if(Object.values(reportWebhooks.ReportNotificationRequest.TypeEnum).includes(type)){
×
49
            return this.getReportNotificationRequest();
×
50
        }
51

52
        if(Object.values(transferWebhooks.TransferNotificationRequest.TypeEnum).includes(type)){
×
53
            return this.getTransferNotificationRequest();
×
54
        }
55
    }
56

57
    public getAccountHolderNotificationRequest(): configurationWebhooks.AccountHolderNotificationRequest {
58
        return configurationWebhooks.ObjectSerializer.deserialize(this.payload, "AccountHolderNotificationRequest");
4✔
59
    }
60

61
    public getBalanceAccountNotificationRequest(): configurationWebhooks.BalanceAccountNotificationRequest {
62
        return configurationWebhooks.ObjectSerializer.deserialize(this.payload, "BalanceAccountNotificationRequest");
×
63
    }
64

65
    public getCardOrderNotificationRequest(): configurationWebhooks.CardOrderNotificationRequest {
66
        return configurationWebhooks.ObjectSerializer.deserialize(this.payload, "CardOrderNotificationRequest");
×
67
    }
68

69
    public getPaymentNotificationRequest(): configurationWebhooks.PaymentNotificationRequest {
70
        return configurationWebhooks.ObjectSerializer.deserialize(this.payload, "PaymentNotificationRequest");
×
71
    }
72

73
    public getSweepConfigurationNotificationRequest(): configurationWebhooks.SweepConfigurationNotificationRequest {
74
        return configurationWebhooks.ObjectSerializer.deserialize(this.payload, "SweepConfigurationNotificationRequest");
×
75
    }
76

77
    public getReportNotificationRequest(): reportWebhooks.ReportNotificationRequest {
78
        return reportWebhooks.ObjectSerializer.deserialize(this.payload, "ReportNotificationRequest");
×
79
    }
80

81
    public getTransferNotificationRequest(): transferWebhooks.TransferNotificationRequest {
82
        return reportWebhooks.ObjectSerializer.deserialize(this.payload, "TransferNotificationRequest");
×
83
    }
84
}
85

86
export default BankingWebhookHandler;
2✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc