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

Adyen / adyen-java-api-library / #2703

16 Oct 2023 09:08AM CUT coverage: 12.568%. First build
#2703

push

web-flow
Merge 5bb3765b7 into fe719ccb3

6014 of 6014 new or added lines in 86 files covered. (100.0%)

11852 of 94302 relevant lines covered (12.57%)

0.13 hits per line

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

24.0
/src/main/java/com/adyen/notification/ClassicPlatformWebhookHandler.java
1
package com.adyen.notification;
2

3
import com.adyen.model.marketpaywebhooks.AccountCloseNotification;
4
import com.adyen.model.marketpaywebhooks.AccountCreateNotification;
5
import com.adyen.model.marketpaywebhooks.AccountFundsBelowThresholdNotification;
6
import com.adyen.model.marketpaywebhooks.AccountHolderCreateNotification;
7
import com.adyen.model.marketpaywebhooks.AccountHolderPayoutNotification;
8
import com.adyen.model.marketpaywebhooks.AccountHolderStatusChangeNotification;
9
import com.adyen.model.marketpaywebhooks.AccountHolderUpcomingDeadlineNotification;
10
import com.adyen.model.marketpaywebhooks.AccountHolderUpdateNotification;
11
import com.adyen.model.marketpaywebhooks.AccountHolderVerificationNotification;
12
import com.adyen.model.marketpaywebhooks.AccountUpdateNotification;
13
import com.adyen.model.marketpaywebhooks.BeneficiarySetupNotification;
14
import com.adyen.model.marketpaywebhooks.CompensateNegativeBalanceNotification;
15
import com.adyen.model.marketpaywebhooks.DirectDebitInitiatedNotification;
16
import com.adyen.model.marketpaywebhooks.PaymentFailureNotification;
17
import com.adyen.model.marketpaywebhooks.RefundFundsTransferNotification;
18
import com.adyen.model.marketpaywebhooks.ReportAvailableNotification;
19
import com.adyen.model.marketpaywebhooks.ScheduledRefundsNotification;
20
import com.adyen.model.marketpaywebhooks.TransferFundsNotification;
21
import com.adyen.model.transferwebhooks.JSON;
22

23
import java.util.Optional;
24

25
public class ClassicPlatformWebhookHandler {
26
    private final String payload;
27

28
    public ClassicPlatformWebhookHandler(String payload) {
1✔
29
        this.payload = payload;
1✔
30
    }
1✔
31

32
    public Optional<AccountCreateNotification> getAccountCreateNotification() {
33
        return getOptionalField(AccountCreateNotification.class);
×
34
    }
35

36
    public Optional<AccountCloseNotification> getAccountCloseNotification() {
37
        return getOptionalField(AccountCloseNotification.class);
×
38
    }
39

40
    public Optional<AccountFundsBelowThresholdNotification> getAccountFundsBelowThresholdNotification() {
41
        return getOptionalField(AccountFundsBelowThresholdNotification.class);
×
42
    }
43

44
    public Optional<AccountHolderCreateNotification> getAccountHolderCreateNotification() {
45
        return getOptionalField(AccountHolderCreateNotification.class);
1✔
46
    }
47

48
    public Optional<AccountHolderPayoutNotification> getAccountHolderPayoutNotification() {
49
        return getOptionalField(AccountHolderPayoutNotification.class);
×
50
    }
51

52
    public Optional<AccountHolderStatusChangeNotification> getAccountHolderStatusChangeNotification() {
53
        return getOptionalField(AccountHolderStatusChangeNotification.class);
×
54
    }
55

56
    public Optional<AccountHolderUpcomingDeadlineNotification> getAccountHolderUpcomingDeadlineNotification() {
57
        return getOptionalField(AccountHolderUpcomingDeadlineNotification.class);
×
58
    }
59

60
    public Optional<AccountHolderUpdateNotification> getAccountHolderUpdateNotification() {
61
        return getOptionalField(AccountHolderUpdateNotification.class);
×
62
    }
63

64
    public Optional<AccountHolderVerificationNotification> getAccountHolderVerificationNotification() {
65
        return getOptionalField(AccountHolderVerificationNotification.class);
×
66
    }
67

68
    public Optional<AccountUpdateNotification> getAccountUpdateNotification() {
69
        return getOptionalField(AccountUpdateNotification.class);
×
70
    }
71

72
    public Optional<BeneficiarySetupNotification> getBeneficiarySetupNotification() {
73
        return getOptionalField(BeneficiarySetupNotification.class);
×
74
    }
75

76
    public Optional<CompensateNegativeBalanceNotification> getCompensateNegativeBalanceNotification() {
77
        return getOptionalField(CompensateNegativeBalanceNotification.class);
×
78
    }
79

80
    public Optional<DirectDebitInitiatedNotification> getDirectDebitInitiatedNotification() {
81
        return getOptionalField(DirectDebitInitiatedNotification.class);
×
82
    }
83

84
    public Optional<PaymentFailureNotification> getPaymentFailureNotification() {
85
        return getOptionalField(PaymentFailureNotification.class);
×
86
    }
87

88
    public Optional<RefundFundsTransferNotification> getRefundFundsTransferNotification() {
89
        return getOptionalField(RefundFundsTransferNotification.class);
×
90
    }
91

92
    public Optional<ReportAvailableNotification> getReportAvailableNotification() {
93
        return getOptionalField(ReportAvailableNotification.class);
×
94
    }
95

96
    public Optional<ScheduledRefundsNotification> getScheduledRefundsNotification() {
97
        return getOptionalField(ScheduledRefundsNotification.class);
×
98
    }
99

100
    public Optional<TransferFundsNotification> getTransferFundsNotification() {
101
        return getOptionalField(TransferFundsNotification.class);
×
102
    }
103

104
    private <T> Optional<T> getOptionalField(Class<T> clazz) {
105
        try {
106
            T val = JSON.getMapper().readValue(payload, clazz);
1✔
107
            return Optional.ofNullable(val);
1✔
108
        } catch (Exception e) {
×
109
            return Optional.empty();
×
110
        }
111
    }
112
}
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

© 2025 Coveralls, Inc