@@ -32,8 +32,8 @@ public class CVRMastercard implements Loggeable {
3232 private final byte [] cvr ;
3333
3434 /**
35- *
36- * @param cvr Byte array containing the CVR value.
35+ * Creates a CVRMastercard from raw bytes.
36+ * @param cvr byte array containing the CVR value (must be 6 bytes)
3737 */
3838 public CVRMastercard (byte [] cvr ) {
3939 Objects .requireNonNull ("cvr" , "CVR cannot be null." );
@@ -44,8 +44,8 @@ public CVRMastercard(byte[] cvr) {
4444 }
4545
4646 /**
47- *
48- * @param cvr Hexadecimal string representation of the CVR value.
47+ * Creates a CVRMastercard from a hex string.
48+ * @param cvr hexadecimal string representation (must be 12 chars)
4949 */
5050 public CVRMastercard (String cvr ) {
5151 Objects .requireNonNull ("cvr" , "CVR cannot be null." );
@@ -56,70 +56,138 @@ public CVRMastercard(String cvr) {
5656 this .cvr = ISOUtil .hex2byte (cvr );
5757 }
5858
59+ /**
60+ * Returns true if aac returned in second generate a c.
61+ * @return true if condition applies
62+ */
5963 public boolean aacReturnedInSecondGenerateAC () {
6064 return !isBitOn (cvr [0 ], 8 ) && !isBitOn (cvr [0 ], 7 );
6165 }
6266
67+ /**
68+ * Returns true if aac returned in first generate a c.
69+ * @return true if condition applies
70+ */
6371 public boolean aacReturnedInFirstGenerateAC () {
6472 return !isBitOn (cvr [0 ], 6 ) && !isBitOn (cvr [0 ], 5 );
6573 }
6674
75+ /**
76+ * Returns true if tc returned in second generate a c.
77+ * @return true if condition applies
78+ */
6779 public boolean tcReturnedInSecondGenerateAC () {
6880 return !isBitOn (cvr [0 ], 8 ) && isBitOn (cvr [0 ], 7 );
6981 }
7082
83+ /**
84+ * Returns true if arqc returned in first generate a c.
85+ * @return true if condition applies
86+ */
7187 public boolean arqcReturnedInFirstGenerateAC () {
7288 return isBitOn (cvr [0 ], 6 ) && !isBitOn (cvr [0 ], 5 );
7389 }
7490
91+ /**
92+ * Returns true if tc returned in first generate a c.
93+ * @return true if condition applies
94+ */
7595 public boolean tcReturnedInFirstGenerateAC () {
7696 return !isBitOn (cvr [0 ], 6 ) && isBitOn (cvr [0 ], 5 );
7797 }
7898
99+ /**
100+ * Returns true if offline p i n verification performed.
101+ * @return true if condition applies
102+ */
79103 public boolean offlinePINVerificationPerformed () {
80104 return isBitOn (cvr [0 ], 3 );
81105 }
82106
107+ /**
108+ * Returns true if offline p i n verification not performed.
109+ * @return true if condition applies
110+ */
83111 public boolean offlinePINVerificationNotPerformed () {
84112 return isBitOn (cvr [3 ], 6 );
85113 }
86114
115+ /**
116+ * Returns true if dda returned.
117+ * @return true if condition applies
118+ */
87119 public boolean ddaReturned () {
88120 return isBitOn (cvr [1 ], 8 );
89121 }
90122
123+ /**
124+ * Returns true if combined d d a a c generation returned in first generate a c.
125+ * @return true if condition applies
126+ */
91127 public boolean combinedDDAACGenerationReturnedInFirstGenerateAC () {
92128 return isBitOn (cvr [1 ], 7 );
93129 }
94130
131+ /**
132+ * Returns true if combined d d a a c generation returned in second generate a c.
133+ * @return true if condition applies
134+ */
95135 public boolean combinedDDAACGenerationReturnedInSecondGenerateAC () {
96136 return isBitOn (cvr [1 ], 6 );
97137 }
98138
139+ /**
140+ * Returns true if issuer authentication failed.
141+ * @return true if condition applies
142+ */
99143 public boolean issuerAuthenticationFailed () {
100144 return isBitOn (cvr [4 ], 3 );
101145 }
102146
147+ /**
148+ * Returns true if script received.
149+ * @return true if condition applies
150+ */
103151 public boolean scriptReceived () {
104152 return isBitOn (cvr [4 ], 2 );
105153 }
106154
155+ /**
156+ * Returns true if script failed.
157+ * @return true if condition applies
158+ */
107159 public boolean scriptFailed () {
108160 return isBitOn (cvr [4 ], 1 );
109161 }
110162
163+ /**
164+ * Returns true if ciac default skipped on c a t3.
165+ * @return true if condition applies
166+ */
111167 public boolean ciacDefaultSkippedOnCAT3 () {
112168 return isBitOn (cvr [1 ], 4 );
113169 }
114170
171+ /**
172+ * Returns true if match found in additional check table.
173+ * @return true if condition applies
174+ */
115175 public boolean matchFoundInAdditionalCheckTable () {
116176 return isBitOn (cvr [5 ], 2 );
117177 }
118178
179+ /**
180+ * Returns true if no match found in additional check table.
181+ * @return true if condition applies
182+ */
119183 public boolean noMatchFoundInAdditionalCheckTable () {
120184 return isBitOn (cvr [5 ], 1 );
121185 }
122186
187+ /**
188+ * Returns the right nibble of script counter.
189+ * @return the value
190+ */
123191 public int rightNibbleOfScriptCounter () {
124192 StringBuilder sb = new StringBuilder ();
125193 sb .append (isBitOn (cvr [2 ], 8 ) ? "1" : "0" );
@@ -129,6 +197,10 @@ public int rightNibbleOfScriptCounter() {
129197 return Integer .parseInt (sb .toString (), 2 );
130198 }
131199
200+ /**
201+ * Returns the right nibble of p i n try counter.
202+ * @return the value
203+ */
132204 public int rightNibbleOfPINTryCounter () {
133205 StringBuilder sb = new StringBuilder ();
134206 sb .append (isBitOn (cvr [2 ], 4 ) ? "1" : "0" );
@@ -138,58 +210,114 @@ public int rightNibbleOfPINTryCounter() {
138210 return Integer .parseInt (sb .toString (), 2 );
139211 }
140212
213+ /**
214+ * Returns true if offline p i n verification failed.
215+ * @return true if condition applies
216+ */
141217 public boolean offlinePINVerificationFailed () {
142218 return isBitOn (cvr [0 ], 2 );
143219 }
144220
221+ /**
222+ * Returns true if ptl exceeded.
223+ * @return true if condition applies
224+ */
145225 public boolean ptlExceeded () {
146226 return isBitOn (cvr [0 ], 2 );
147227 }
148228
229+ /**
230+ * Returns true if international transaction.
231+ * @return true if condition applies
232+ */
149233 public boolean internationalTransaction () {
150234 return isBitOn (cvr [3 ], 3 );
151235 }
152236
237+ /**
238+ * Returns true if domestic transaction.
239+ * @return true if condition applies
240+ */
153241 public boolean domesticTransaction () {
154242 return isBitOn (cvr [3 ], 2 );
155243 }
156244
245+ /**
246+ * Returns true if terminal erroneously considers offline p i n o k.
247+ * @return true if condition applies
248+ */
157249 public boolean terminalErroneouslyConsidersOfflinePINOK () {
158250 return isBitOn (cvr [3 ], 1 );
159251 }
160252
253+ /**
254+ * Returns true if lower consecutive offline limit exceeded.
255+ * @return true if condition applies
256+ */
161257 public boolean lowerConsecutiveOfflineLimitExceeded () {
162258 return isBitOn (cvr [4 ], 8 );
163259 }
164260
261+ /**
262+ * Returns true if upper consecutive offline limit exceeded.
263+ * @return true if condition applies
264+ */
165265 public boolean upperConsecutiveOfflineLimitExceeded () {
166266 return isBitOn (cvr [4 ], 7 );
167267 }
168268
269+ /**
270+ * Returns true if lower cumulative offline limit exceeded.
271+ * @return true if condition applies
272+ */
169273 public boolean lowerCumulativeOfflineLimitExceeded () {
170274 return isBitOn (cvr [4 ], 6 );
171275 }
172276
277+ /**
278+ * Returns true if upper cumulative offline limit exceeded.
279+ * @return true if condition applies
280+ */
173281 public boolean upperCumulativeOfflineLimitExceeded () {
174282 return isBitOn (cvr [4 ], 5 );
175283 }
176284
285+ /**
286+ * Returns true if go online on next transaction set.
287+ * @return true if condition applies
288+ */
177289 public boolean goOnlineOnNextTransactionSet () {
178290 return isBitOn (cvr [4 ], 4 );
179291 }
180292
293+ /**
294+ * Returns true if unable to go online.
295+ * @return true if condition applies
296+ */
181297 public boolean unableToGoOnline () {
182298 return isBitOn (cvr [3 ], 7 );
183299 }
184300
301+ /**
302+ * Returns true if second generate a c not requested.
303+ * @return true if condition applies
304+ */
185305 public boolean secondGenerateACNotRequested () {
186306 return isBitOn (cvr [0 ], 8 ) && !isBitOn (cvr [0 ], 7 );
187307 }
188308
309+ /**
310+ * Returns true if issuer authentication performed.
311+ * @return true if condition applies
312+ */
189313 public boolean issuerAuthenticationPerformed () {
190314 return isBitOn (cvr [1 ], 5 );
191315 }
192316
317+ /**
318+ * Returns true if offline encrypted p i n verification performed.
319+ * @return true if condition applies
320+ */
193321 public boolean offlineEncryptedPINVerificationPerformed () {
194322 return isBitOn (cvr [0 ], 2 );
195323 }
0 commit comments