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

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

18 Sep 2023 12:11PM UTC coverage: 13.219%. First build
#2658

push

web-flow
Merge 477a9da03 into ba706cfa8

1770 of 1770 new or added lines in 34 files covered. (100.0%)

10287 of 77817 relevant lines covered (13.22%)

0.13 hits per line

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

90.0
/src/main/java/com/adyen/service/TerminalLocalAPIUnencrypted.java
1
package com.adyen.service;
2

3
import com.adyen.Client;
4
import com.adyen.Service;
5
import com.adyen.model.terminal.TerminalAPIRequest;
6
import com.adyen.model.terminal.TerminalAPIResponse;
7
import com.adyen.service.resource.terminal.local.LocalRequest;
8
import com.adyen.terminal.serialization.TerminalAPIGsonBuilder;
9
import com.google.gson.Gson;
10
import com.google.gson.reflect.TypeToken;
11

12
/**
13
 * [UNENCRYPTED] Local Terminal Api.
14
 * Use this class (in TEST only) to experiment with the Local Terminal API separately
15
 * from the encryption implementation required for live payments.
16
 * <p>
17
 * Be sure to remove the encryption key details on the Customer Area as it will not work with encryption key details set up.
18
 */
19
public class TerminalLocalAPIUnencrypted extends Service {
20

21
    private final LocalRequest localRequest;
22

23
    private final Gson terminalApiGson;
24

25
    public TerminalLocalAPIUnencrypted(Client client) {
26
        super(client);
1✔
27
        localRequest = new LocalRequest(this);
1✔
28
        terminalApiGson = TerminalAPIGsonBuilder.create();
1✔
29
    }
1✔
30

31
    /**
32
     * Local Terminal API call
33
     *
34
     * @param terminalAPIRequest TerminalAPIRequest
35
     * @return TerminalAPIResponse
36
     * @throws Exception exception
37
     */
38
    public TerminalAPIResponse request(TerminalAPIRequest terminalAPIRequest) throws Exception {
39
        String jsonRequest = terminalApiGson.toJson(terminalAPIRequest);
1✔
40

41
        String jsonResponse = localRequest.request(jsonRequest);
1✔
42

43
        if (jsonResponse == null || jsonResponse.isEmpty() || "ok".equals(jsonResponse)) {
1✔
44
            return null;
×
45
        }
46

47
        return terminalApiGson.fromJson(jsonResponse, new TypeToken<TerminalAPIResponse>() {
1✔
48
        }.getType());
1✔
49
    }
50
}
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