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

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

08 Nov 2023 09:16AM CUT coverage: 12.837%. First build
#2829

push

web-flow
Merge 828273160 into b96088175

114 of 864 new or added lines in 50 files covered. (13.19%)

12393 of 96543 relevant lines covered (12.84%)

0.13 hits per line

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

65.26
/src/main/java/com/adyen/model/terminal/SaleToAcquirerData.java
1
/*
2
 *                       ######
3
 *                       ######
4
 * ############    ####( ######  #####. ######  ############   ############
5
 * #############  #####( ######  #####. ######  #############  #############
6
 *        ######  #####( ######  #####. ######  #####  ######  #####  ######
7
 * ###### ######  #####( ######  #####. ######  #####  #####   #####  ######
8
 * ###### ######  #####( ######  #####. ######  #####          #####  ######
9
 * #############  #############  #############  #############  #####  ######
10
 *  ############   ############  #############   ############  #####  ######
11
 *                                      ######
12
 *                               #############
13
 *                               ############
14
 *
15
 * Adyen Java API Library
16
 *
17
 * Copyright (c) 2020 Adyen B.V.
18
 * This file is open source and available under the MIT license.
19
 * See the LICENSE file for more info.
20
 */
21
package com.adyen.model.terminal;
22

23
import java.io.ByteArrayInputStream;
24
import java.io.IOException;
25
import java.io.InputStreamReader;
26
import java.io.Reader;
27
import java.util.Map;
28
import java.util.Objects;
29

30
import java.util.Base64;
31
import com.adyen.model.applicationinfo.ApplicationInfo;
32
import com.google.gson.Gson;
33
import com.google.gson.GsonBuilder;
34
import com.google.gson.annotations.SerializedName;
35

36
public class SaleToAcquirerData {
37

38
    private Map<String, String> metadata;
39
    private String shopperEmail;
40
    private String shopperReference;
41
    private String recurringContract;
42
    private String shopperStatement;
43
    private String recurringDetailName;
44
    private String recurringTokenService;
45
    private String store;
46
    private String merchantAccount;
47
    private String currency;
48
    private ApplicationInfo applicationInfo;
49
    private String tenderOption;
50
    private Map<String, String> additionalData;
51
    private String authorisationType;
52
    private String ssc;
53
    private RecurringProcessingModelEnum recurringProcessingModel;
54
    private String redemptionType;
55
    private static final Gson PRETTY_PRINT_GSON = new GsonBuilder().setPrettyPrinting().create();
1✔
56

57
    public SaleToAcquirerData() {
1✔
58
        applicationInfo = new ApplicationInfo();
1✔
59
    }
1✔
60

61
    public Map<String, String> getMetadata() {
62
        return metadata;
×
63
    }
64

65
    public void setMetadata(Map<String, String> metadata) {
66
        this.metadata = metadata;
1✔
67
    }
1✔
68

69
    public String getShopperEmail() {
70
        return shopperEmail;
×
71
    }
72

73
    public void setShopperEmail(String shopperEmail) {
74
        this.shopperEmail = shopperEmail;
1✔
75
    }
1✔
76

77
    public String getShopperReference() {
78
        return shopperReference;
×
79
    }
80

81
    public void setShopperReference(String shopperReference) {
82
        this.shopperReference = shopperReference;
1✔
83
    }
1✔
84

85
    public String getRecurringContract() {
86
        return recurringContract;
×
87
    }
88

89
    public void setRecurringContract(String recurringContract) {
90
        this.recurringContract = recurringContract;
1✔
91
    }
1✔
92

93
    public String getShopperStatement() {
94
        return shopperStatement;
×
95
    }
96

97
    public void setShopperStatement(String shopperStatement) {
98
        this.shopperStatement = shopperStatement;
1✔
99
    }
1✔
100

101
    public String getRecurringDetailName() {
102
        return recurringDetailName;
×
103
    }
104

105
    public void setRecurringDetailName(String recurringDetailName) {
106
        this.recurringDetailName = recurringDetailName;
1✔
107
    }
1✔
108

109
    public String getRecurringTokenService() {
110
        return recurringTokenService;
×
111
    }
112

113
    public void setRecurringTokenService(String recurringTokenService) {
114
        this.recurringTokenService = recurringTokenService;
1✔
115
    }
1✔
116

117
    public String getStore() {
118
        return store;
×
119
    }
120

121
    public void setStore(String store) {
122
        this.store = store;
1✔
123
    }
1✔
124

125
    public String getMerchantAccount() {
126
        return merchantAccount;
×
127
    }
128

129
    public void setMerchantAccount(String merchantAccount) {
130
        this.merchantAccount = merchantAccount;
1✔
131
    }
1✔
132

133
    public String getCurrency() {
134
        return currency;
×
135
    }
136

137
    public void setCurrency(String currency) {
138
        this.currency = currency;
1✔
139
    }
1✔
140

141
    public ApplicationInfo getApplicationInfo() {
142
        return applicationInfo;
×
143
    }
144

145
    public void setApplicationInfo(ApplicationInfo applicationInfo) {
146
        this.applicationInfo = applicationInfo;
1✔
147
    }
1✔
148

149
    public String getTenderOption() {
150
        return tenderOption;
×
151
    }
152

153
    public void setTenderOption(String tenderOption) {
154
        this.tenderOption = tenderOption;
1✔
155
    }
1✔
156

157
    public Map<String, String> getAdditionalData() {
158
        return additionalData;
×
159
    }
160

161
    public void setAdditionalData(Map<String, String> additionalData) {
162
        this.additionalData = additionalData;
1✔
163
    }
1✔
164

165
    public String getAuthorisationType() {
166
        return authorisationType;
×
167
    }
168

169
    public void setAuthorisationType(String authorisationType) {
170
        this.authorisationType = authorisationType;
1✔
171
    }
1✔
172
    
173

174
    /**
175
     * Defines a recurring payment type. Required when creating a token to store payment details or using stored payment details. 
176
     */
177
    public enum RecurringProcessingModelEnum {
1✔
178
        @SerializedName("Subscription") SUBSCRIPTION("Subscription"),
1✔
179

180
        @SerializedName("CardOnFile") CARD_ON_FILE("CardOnFile"),
1✔
181

182
        @SerializedName("UnscheduledCardOnFile") UNSCHEDULED_CARD_ON_FILE("UnscheduledCardOnFile");
1✔
183

184
        private String value;
185

186
        RecurringProcessingModelEnum(String value) {
1✔
187
            this.value = value;
1✔
188
        }
1✔
189

190
        @Override
191
        public String toString() {
192
            return String.valueOf(value);
1✔
193
        }
194
    }
195

196
    public RecurringProcessingModelEnum getRecurringProcessingModel() {
197
        return this.recurringProcessingModel;
×
198
    }
199

200
    public void setRecurringProcessingModel(RecurringProcessingModelEnum recurringProcessingModel) {
201
        this.recurringProcessingModel = recurringProcessingModel;
×
202
    }
×
203

204
    public String getSsc() {
205
        return ssc;
×
206
    }
207
    public void setSsc(String ssc) {
208
        this.ssc = ssc;
×
209
    }
×
210

211
    public String getRedemptionType() {
212
        return redemptionType;
×
213
    }
214

215
    public void setRedemptionType(String redemptionType) {
216
        this.redemptionType = redemptionType;
×
217
    }
×
218

219
    public static Gson getPrettyPrintGson() {
220
        return PRETTY_PRINT_GSON;
×
221
    }
222

223
    @Override
224
    public boolean equals(Object o) {
225
        if (this == o) {
1✔
226
            return true;
×
227
        }
228
        if (o == null || getClass() != o.getClass()) {
1✔
229
            return false;
×
230
        }
231
        SaleToAcquirerData that = (SaleToAcquirerData) o;
1✔
232
        return Objects.equals(metadata, that.metadata) &&
1✔
233
                Objects.equals(shopperEmail, that.shopperEmail) &&
1✔
234
                Objects.equals(shopperReference, that.shopperReference) &&
1✔
235
                Objects.equals(recurringContract, that.recurringContract) &&
1✔
236
                Objects.equals(shopperStatement, that.shopperStatement) &&
1✔
237
                Objects.equals(recurringDetailName, that.recurringDetailName) &&
1✔
238
                Objects.equals(recurringTokenService, that.recurringTokenService) &&
1✔
239
                Objects.equals(store, that.store) &&
1✔
240
                Objects.equals(merchantAccount, that.merchantAccount) &&
1✔
241
                Objects.equals(currency, that.currency) &&
1✔
242
                Objects.equals(applicationInfo, that.applicationInfo) &&
1✔
243
                Objects.equals(tenderOption, that.tenderOption) &&
1✔
244
                Objects.equals(additionalData, that.additionalData) &&
1✔
245
                Objects.equals(authorisationType, that.authorisationType) &&
1✔
246
                Objects.equals(ssc, that.ssc) &&
1✔
247
                Objects.equals(recurringProcessingModel, that.recurringProcessingModel) &&
1✔
248
                Objects.equals(redemptionType, that.redemptionType);
1✔
249
    }
250

251
    @Override
252
    public int hashCode() {
253
        return Objects.hash(metadata, shopperEmail, shopperReference, recurringContract, shopperStatement, recurringDetailName, recurringTokenService, store, merchantAccount, currency, applicationInfo, tenderOption, additionalData, authorisationType, ssc, recurringProcessingModel, redemptionType);
×
254
    }
255

256
    @Override
257
    public String toString() {
258
        return "SaleToAcquirerDataModel{" +
×
259
                "metadata=" + metadata +
260
                ", shopperEmail='" + shopperEmail + '\'' +
261
                ", shopperReference='" + shopperReference + '\'' +
262
                ", recurringContract='" + recurringContract + '\'' +
263
                ", shopperStatement='" + shopperStatement + '\'' +
264
                ", recurringDetailName='" + recurringDetailName + '\'' +
265
                ", recurringTokenService='" + recurringTokenService + '\'' +
266
                ", store='" + store + '\'' +
267
                ", merchantAccount='" + merchantAccount + '\'' +
268
                ", currency='" + currency + '\'' +
269
                ", applicationInfo=" + applicationInfo +
270
                ", tenderOption='" + tenderOption + '\'' +
271
                ", additionalData=" + additionalData +
272
                ", authorisationType=" + authorisationType +
273
                ", ssc='" + ssc + '\'' +
274
                ", recurringProcessingModel=" + recurringProcessingModel + '\'' +
275
                ", redemptionType=" + redemptionType +
276
                '}';
277
    }
278

279
    public String toBase64() {
280
        String json = PRETTY_PRINT_GSON.toJson(this);
1✔
281
        return new String(Base64.getEncoder().encode(json.getBytes()));
1✔
282
    }
283

284
    public static SaleToAcquirerData fromBase64(String base64) {
NEW
285
        byte[] decoded = Base64.getDecoder().decode(base64);
×
286
        try (Reader reader = new InputStreamReader(new ByteArrayInputStream(decoded))) {
×
287
            return PRETTY_PRINT_GSON.fromJson(reader, SaleToAcquirerData.class);
×
288
        }
289
        catch (IOException e) {
×
290
            throw new IllegalStateException(e);
×
291
        }
292
    }
293
}
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