|
8 | 8 | import com.dtone.dvs.dto.BalanceFilter; |
9 | 9 | import com.dtone.dvs.dto.BenefitType; |
10 | 10 | import com.dtone.dvs.dto.Country; |
| 11 | +import com.dtone.dvs.dto.LookupOperatorRequest; |
11 | 12 | import com.dtone.dvs.dto.Operator; |
12 | 13 | import com.dtone.dvs.dto.PageAsync; |
13 | 14 | import com.dtone.dvs.dto.Product; |
14 | 15 | import com.dtone.dvs.dto.ProductFilter; |
15 | 16 | import com.dtone.dvs.dto.Promotion; |
16 | 17 | import com.dtone.dvs.dto.PromotionFilter; |
17 | 18 | import com.dtone.dvs.dto.Service; |
18 | | -import com.dtone.dvs.dto.StatementDetail; |
19 | | -import com.dtone.dvs.dto.StatementFilter; |
| 19 | +import com.dtone.dvs.dto.Transaction; |
20 | 20 | import com.dtone.dvs.dto.TransactionFilter; |
21 | 21 | import com.dtone.dvs.dto.TransactionRequest; |
22 | | -import com.dtone.dvs.dto.TransactionResponse; |
23 | 22 | import com.dtone.dvs.helper.DvsApiClientHelperAsync; |
24 | 23 |
|
25 | 24 | public class DvsApiClientAsync { |
@@ -169,26 +168,37 @@ public CompletableFuture<ApiResponse<List<Operator>>> lookupOperators(String mob |
169 | 168 | } |
170 | 169 |
|
171 | 170 | /** |
172 | | - * Get list of operators by mobile number, page number and records per page |
173 | | - * |
174 | | - * @param mobileNumber |
175 | | - * @param pageNumber the page number |
176 | | - * @param recordsPerPage the number of records per page |
177 | | - * @return list of operators |
178 | | - */ |
179 | | - public CompletableFuture<ApiResponse<List<Operator>>> lookupOperators(String mobileNumber, int pageNumber, int recordsPerPage) { |
180 | | - return this.dvsApiClientHelper.lookupOperators(mobileNumber, pageNumber, recordsPerPage); |
181 | | - } |
182 | | - |
183 | | - // Operators - End |
184 | | - |
185 | | - // Benefit Types - Begin |
186 | | - |
187 | | - /** |
188 | | - * Get benefit types |
189 | | - * |
190 | | - * @return paginated list of benefit types |
191 | | - */ |
| 171 | + * Get list of operators by mobile number, page number and records per page |
| 172 | + * |
| 173 | + * @param mobileNumber |
| 174 | + * @param pageNumber the page number |
| 175 | + * @param recordsPerPage the number of records per page |
| 176 | + * @return list of operators |
| 177 | + */ |
| 178 | + public CompletableFuture<ApiResponse<List<Operator>>> lookupOperators(String mobileNumber, int pageNumber, int recordsPerPage) { |
| 179 | + return this.dvsApiClientHelper.lookupOperators(mobileNumber, pageNumber, recordsPerPage); |
| 180 | + } |
| 181 | + |
| 182 | + /** |
| 183 | + * Get list of operators by mobile number, page number and records per page |
| 184 | + * (POST) |
| 185 | + * |
| 186 | + * @param lookupOperatorRequest {@link LookupOperatorRequest} object |
| 187 | + * @return list of operators |
| 188 | + */ |
| 189 | + public CompletableFuture<ApiResponse<List<Operator>>> lookupOperators(LookupOperatorRequest lookupOperatorRequest) { |
| 190 | + return this.dvsApiClientHelper.lookupOperators(lookupOperatorRequest); |
| 191 | + } |
| 192 | + |
| 193 | + // Operators - End |
| 194 | + |
| 195 | + // Benefit Types - Begin |
| 196 | + |
| 197 | + /** |
| 198 | + * Get benefit types |
| 199 | + * |
| 200 | + * @return paginated list of benefit types |
| 201 | + */ |
192 | 202 | public CompletableFuture<PageAsync<CompletableFuture<ApiResponse<List<BenefitType>>>>> getBenefitTypes() { |
193 | 203 | return this.dvsApiClientHelper.getAllBenefitTypes(); |
194 | 204 | } |
@@ -320,69 +330,90 @@ public CompletableFuture<ApiResponse<Product>> getProduct(Long productId) { |
320 | 330 |
|
321 | 331 | // Transactions - Begin |
322 | 332 |
|
323 | | - /** |
324 | | - * Create a new transaction |
325 | | - * |
326 | | - * @param transactionRequest the transaction request |
327 | | - * @return transaction |
328 | | - */ |
329 | | - public CompletableFuture<ApiResponse<TransactionResponse>> createTransaction(TransactionRequest transactionRequest) { |
330 | | - return this.dvsApiClientHelper.postTransaction(transactionRequest); |
331 | | - } |
332 | | - |
333 | | - /** |
334 | | - * Get transaction by id |
335 | | - * |
336 | | - * @param transactionId the transaction id |
337 | | - * @return transaction |
338 | | - */ |
339 | | - public CompletableFuture<ApiResponse<TransactionResponse>> getTransaction(Long transactionId) { |
340 | | - return this.dvsApiClientHelper.getTransaction(transactionId); |
341 | | - } |
342 | | - |
343 | | - /** |
344 | | - * Get transactions by external id |
345 | | - * <p> |
346 | | - * transactionFilter the TransactionFilter instance |
347 | | - * |
348 | | - * @return list of transactions |
349 | | - */ |
350 | | - public CompletableFuture<ApiResponse<List<TransactionResponse>>> getTransactions(TransactionFilter transactionFilter) { |
351 | | - return this.dvsApiClientHelper.getTransactions(transactionFilter, 0, 0); |
352 | | - } |
353 | | - |
354 | | - /** |
355 | | - * Get transactions by external id, page number and records per page |
356 | | - * <p> |
357 | | - * transactionFilter the TransactionFilter instance |
358 | | - * |
359 | | - * @param transactionFilter the TransactionFilter instance |
360 | | - * @param pageNumber the current page number |
361 | | - * @param recordsPerPage the number of records per page |
362 | | - * @return list of transactions |
363 | | - */ |
364 | | - public CompletableFuture<ApiResponse<List<TransactionResponse>>> getTransactions(TransactionFilter transactionFilter, int pageNumber, int recordsPerPage) { |
365 | | - return this.dvsApiClientHelper.getTransactions(transactionFilter, pageNumber, recordsPerPage); |
366 | | - } |
367 | | - |
368 | | - /** |
369 | | - * Confirm a transaction |
370 | | - * |
371 | | - * @param transactionId the transaction id |
372 | | - * @return transaction |
373 | | - */ |
374 | | - public CompletableFuture<ApiResponse<TransactionResponse>> confirmTransaction(Long transactionId) { |
375 | | - return this.dvsApiClientHelper.confirmTransaction(transactionId); |
376 | | - } |
377 | | - |
378 | | - /** |
379 | | - * Cancel a transaction |
380 | | - * |
381 | | - * @param transactionId the transaction id |
382 | | - * @return transaction |
383 | | - */ |
384 | | - public CompletableFuture<ApiResponse<TransactionResponse>> cancelTransaction(Long transactionId) { |
385 | | - return this.dvsApiClientHelper.cancelTransaction(transactionId); |
| 333 | + /** |
| 334 | + * Create a new transaction |
| 335 | + * |
| 336 | + * @param transactionRequest the transaction request |
| 337 | + * @return transaction |
| 338 | + */ |
| 339 | + public CompletableFuture<ApiResponse<Transaction>> createTransaction(TransactionRequest transactionRequest) { |
| 340 | + return this.dvsApiClientHelper.postTransaction(transactionRequest); |
| 341 | + } |
| 342 | + |
| 343 | + /** |
| 344 | + * Get transactions |
| 345 | + * |
| 346 | + * @return paginated list of transactions |
| 347 | + */ |
| 348 | + public CompletableFuture<PageAsync<CompletableFuture<ApiResponse<List<Transaction>>>>> getTransactions() { |
| 349 | + return this.dvsApiClientHelper.getAllTransactions(); |
| 350 | + } |
| 351 | + |
| 352 | + /** |
| 353 | + * Get transactions by page number and records per page |
| 354 | + * |
| 355 | + * @param pageNumber the page number |
| 356 | + * @param recordsPerPage the number of records per page |
| 357 | + * @return list of transactions |
| 358 | + */ |
| 359 | + public CompletableFuture<ApiResponse<List<Transaction>>> getTransactions(int pageNumber, int recordsPerPage) { |
| 360 | + return this.dvsApiClientHelper.getTransactions(new TransactionFilter(), pageNumber, recordsPerPage); |
| 361 | + } |
| 362 | + |
| 363 | + |
| 364 | + /** |
| 365 | + * Get transaction by id |
| 366 | + * |
| 367 | + * @param transactionId the transaction id |
| 368 | + * @return transaction |
| 369 | + */ |
| 370 | + public CompletableFuture<ApiResponse<Transaction>> getTransaction(Long transactionId) { |
| 371 | + return this.dvsApiClientHelper.getTransaction(transactionId); |
| 372 | + } |
| 373 | + |
| 374 | + /** |
| 375 | + * Get transactions by external id |
| 376 | + * <p> |
| 377 | + * transactionFilter the TransactionFilter instance |
| 378 | + * |
| 379 | + * @return list of transactions |
| 380 | + */ |
| 381 | + public CompletableFuture<ApiResponse<List<Transaction>>> getTransactions(TransactionFilter transactionFilter) { |
| 382 | + return this.dvsApiClientHelper.getTransactions(transactionFilter, 0, 0); |
| 383 | + } |
| 384 | + |
| 385 | + /** |
| 386 | + * Get transactions by external id, page number and records per page |
| 387 | + * <p> |
| 388 | + * transactionFilter the TransactionFilter instance |
| 389 | + * |
| 390 | + * @param transactionFilter the TransactionFilter instance |
| 391 | + * @param pageNumber the current page number |
| 392 | + * @param recordsPerPage the number of records per page |
| 393 | + * @return list of transactions |
| 394 | + */ |
| 395 | + public CompletableFuture<ApiResponse<List<Transaction>>> getTransactions(TransactionFilter transactionFilter, int pageNumber, int recordsPerPage) { |
| 396 | + return this.dvsApiClientHelper.getTransactions(transactionFilter, pageNumber, recordsPerPage); |
| 397 | + } |
| 398 | + |
| 399 | + /** |
| 400 | + * Confirm a transaction |
| 401 | + * |
| 402 | + * @param transactionId the transaction id |
| 403 | + * @return transaction |
| 404 | + */ |
| 405 | + public CompletableFuture<ApiResponse<Transaction>> confirmTransaction(Long transactionId) { |
| 406 | + return this.dvsApiClientHelper.confirmTransaction(transactionId); |
| 407 | + } |
| 408 | + |
| 409 | + /** |
| 410 | + * Cancel a transaction |
| 411 | + * |
| 412 | + * @param transactionId the transaction id |
| 413 | + * @return transaction |
| 414 | + */ |
| 415 | + public CompletableFuture<ApiResponse<Transaction>> cancelTransaction(Long transactionId) { |
| 416 | + return this.dvsApiClientHelper.cancelTransaction(transactionId); |
386 | 417 | } |
387 | 418 |
|
388 | 419 | // Transactions - End |
@@ -420,18 +451,5 @@ public CompletableFuture<ApiResponse<List<Balance>>> getBalances(BalanceFilter b |
420 | 451 |
|
421 | 452 |
|
422 | 453 | // Balances - End |
423 | | - |
424 | | - // Statement Inquiry - Begin |
425 | | - |
426 | | - /** |
427 | | - * Get statement for an account number |
428 | | - * |
429 | | - * @return statement details |
430 | | - */ |
431 | | - private CompletableFuture<ApiResponse<List<StatementDetail>>> getStatement(StatementFilter statementFilter) { |
432 | | - return this.dvsApiClientHelper.getStatement(statementFilter); |
433 | | - } |
434 | | - |
435 | | - // Statement Inquiry - End |
436 | 454 |
|
437 | 455 | } |
0 commit comments