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

Adyen / adyen-node-api-library / 6746254698

03 Nov 2023 02:09PM UTC coverage: 75.252%. First build
6746254698

Pull #1275

github

web-flow
Merge c7735cd0b into ddbb4b46c
Pull Request #1275: Update Checkout to v71, remove non working Disputes endpoint

105 of 157 branches covered (0.0%)

Branch coverage included in aggregate %.

12 of 13 new or added lines in 9 files covered. (92.31%)

1908 of 2518 relevant lines covered (75.77%)

29.29 hits per line

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

60.0
/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 {acsWebhooks} from "../typings"
2✔
9
import {reportWebhooks} from "../typings";
2✔
10
import {transferWebhooks} from "../typings";
2✔
11
import {transactionWebhooks} from "../typings";
2✔
12

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

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

20
    // Return generic webhook type
21
    public getGenericWebhook(): acsWebhooks.AuthenticationNotificationRequest
22
        | configurationWebhooks.AccountHolderNotificationRequest
23
        | configurationWebhooks.BalanceAccountNotificationRequest
24
        | configurationWebhooks.PaymentNotificationRequest
25
        | configurationWebhooks.SweepConfigurationNotificationRequest
26
        | configurationWebhooks.CardOrderNotificationRequest
27
        | reportWebhooks.ReportNotificationRequest
28
        | transferWebhooks.TransferNotificationRequest
29
        | transactionWebhooks.TransactionNotificationRequestV4 {
30
        const type = this.payload['type'];
6✔
31

32
        if(Object.values(acsWebhooks.AuthenticationNotificationRequest.TypeEnum).includes(type)){
6✔
33
            return this.getAuthenticationNotificationRequest();
2✔
34
        }
35

36
        if(Object.values(configurationWebhooks.AccountHolderNotificationRequest.TypeEnum).includes(type)){
4✔
37
            return this.getAccountHolderNotificationRequest();
2✔
38
        }
39

40
        if(Object.values(configurationWebhooks.BalanceAccountNotificationRequest.TypeEnum).includes(type)){
2!
41
            return this.getBalanceAccountNotificationRequest();
×
42
        }
43

44
        if(Object.values(configurationWebhooks.CardOrderNotificationRequest.TypeEnum).includes(type)){
2!
45
            return this.getCardOrderNotificationRequest();
×
46
        }
47

48
        if(Object.values(configurationWebhooks.PaymentNotificationRequest.TypeEnum).includes(type)){
2!
49
            return this.getPaymentNotificationRequest();
×
50
        }
51

52
        if(Object.values(configurationWebhooks.SweepConfigurationNotificationRequest.TypeEnum).includes(type)){
2!
53
            return this.getSweepConfigurationNotificationRequest();
×
54
        }
55

56
        if(Object.values(reportWebhooks.ReportNotificationRequest.TypeEnum).includes(type)){
2!
57
            return this.getReportNotificationRequest();
×
58
        }
59

60
        if(Object.values(transferWebhooks.TransferNotificationRequest.TypeEnum).includes(type)){
2!
NEW
61
            return this.getTransferNotificationRequest();
×
62
        }
63

64
        if(Object.values(transactionWebhooks.TransactionNotificationRequestV4.TypeEnum).includes(type)){
2✔
65
            return this.getTransactionNotificationRequest();
2✔
66
        }
67

68
        throw new Error("Could not parse the json payload: " + this.payload)
×
69
    }
70

71
    public getAuthenticationNotificationRequest(): acsWebhooks.AuthenticationNotificationRequest {
72
        return acsWebhooks.ObjectSerializer.deserialize(this.payload, "AuthenticationNotificationRequest");
2✔
73
    }
74

75
    public getAccountHolderNotificationRequest(): configurationWebhooks.AccountHolderNotificationRequest {
76
        return configurationWebhooks.ObjectSerializer.deserialize(this.payload, "AccountHolderNotificationRequest");
4✔
77
    }
78

79
    public getBalanceAccountNotificationRequest(): configurationWebhooks.BalanceAccountNotificationRequest {
80
        return configurationWebhooks.ObjectSerializer.deserialize(this.payload, "BalanceAccountNotificationRequest");
×
81
    }
82

83
    public getCardOrderNotificationRequest(): configurationWebhooks.CardOrderNotificationRequest {
84
        return configurationWebhooks.ObjectSerializer.deserialize(this.payload, "CardOrderNotificationRequest");
×
85
    }
86

87
    public getPaymentNotificationRequest(): configurationWebhooks.PaymentNotificationRequest {
88
        return configurationWebhooks.ObjectSerializer.deserialize(this.payload, "PaymentNotificationRequest");
×
89
    }
90

91
    public getSweepConfigurationNotificationRequest(): configurationWebhooks.SweepConfigurationNotificationRequest {
92
        return configurationWebhooks.ObjectSerializer.deserialize(this.payload, "SweepConfigurationNotificationRequest");
×
93
    }
94

95
    public getReportNotificationRequest(): reportWebhooks.ReportNotificationRequest {
96
        return reportWebhooks.ObjectSerializer.deserialize(this.payload, "ReportNotificationRequest");
×
97
    }
98

99
    public getTransferNotificationRequest(): transferWebhooks.TransferNotificationRequest {
100
        return transferWebhooks.ObjectSerializer.deserialize(this.payload, "TransferNotificationRequest");
2✔
101
    }
102

103
    public getTransactionNotificationRequest(): transactionWebhooks.TransactionNotificationRequestV4 {
104
        return transactionWebhooks.ObjectSerializer.deserialize(this.payload, "TransactionNotificationRequestV4");
4✔
105
    }
106
}
107

108
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