-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: P4PU-201 added business logic to retrieve transaction details (#17
) * P4PU-201 added business logic to retrieve transaction details * P4PU-201 added fakers * P4PU-201 added tests * P4PU-201 updated service * P4PU-201 updated mapper and tests
- Loading branch information
1 parent
674f278
commit 87e85d6
Showing
12 changed files
with
209 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/main/java/it/gov/pagopa/arc/service/TransactionsService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
package it.gov.pagopa.arc.service; | ||
|
||
|
||
import it.gov.pagopa.arc.model.generated.TransactionDetailsDTO; | ||
import it.gov.pagopa.arc.model.generated.TransactionsListDTO; | ||
|
||
public interface TransactionsService { | ||
TransactionsListDTO retrieveTransactionsList(Integer page, Integer size, String filter); | ||
TransactionDetailsDTO retrieveTransactionDetails(String transactionId); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/main/java/it/gov/pagopa/arc/service/bizevents/BizEventsService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
package it.gov.pagopa.arc.service.bizevents; | ||
|
||
import it.gov.pagopa.arc.model.generated.TransactionDetailsDTO; | ||
import it.gov.pagopa.arc.model.generated.TransactionsListDTO; | ||
|
||
public interface BizEventsService { | ||
TransactionsListDTO retrieveTransactionsListFromBizEvents(Integer page, Integer size, String filter); | ||
TransactionDetailsDTO retrieveTransactionDetailsFromBizEvents(String transactionId); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/test/java/it/gov/pagopa/arc/fakers/TransactionDetailsDTOFaker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package it.gov.pagopa.arc.fakers; | ||
|
||
import it.gov.pagopa.arc.model.generated.*; | ||
|
||
import java.util.List; | ||
|
||
public class TransactionDetailsDTOFaker { | ||
public static TransactionDetailsDTO mockInstance(){ | ||
return mockInstanceBuilder().build(); | ||
} | ||
|
||
public static TransactionDetailsDTO.TransactionDetailsDTOBuilder mockInstanceBuilder(){ | ||
WalletInfoDTO walletInfo = CommonWalletInfoDTOFaker.mockWalletInfoDTO(false); | ||
UserDetailDTO payerMapped = CommonUserDetailDTOFaker.mockUserDetailDTO(CommonUserDetailDTOFaker.USER_DETAIL_PAYER); | ||
InfoTransactionDTO infoTransaction = InfoTransactionDTOFaker.mockInstance(walletInfo, payerMapped); | ||
|
||
UserDetailDTO payeeResponse = CommonUserDetailDTOFaker.mockUserDetailDTO(CommonUserDetailDTOFaker.USER_DETAIL_PAYEE); | ||
UserDetailDTO debtorResponse = CommonUserDetailDTOFaker.mockUserDetailDTO(CommonUserDetailDTOFaker.USER_DETAIL_DEBTOR); | ||
CartItemDTO cartItem1 = CartItemDTOFaker.mockInstance(payeeResponse, debtorResponse); | ||
CartItemDTO cartItem2 = CartItemDTOFaker.mockInstance(payeeResponse, debtorResponse); | ||
List<CartItemDTO> cartsList = List.of(cartItem1, cartItem2); | ||
|
||
return TransactionDetailsDTO.builder() | ||
.infoTransaction(infoTransaction) | ||
.carts(cartsList); | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
src/test/java/it/gov/pagopa/arc/fakers/bizEvents/BizEventsTransactionDetailsDTOFaker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package it.gov.pagopa.arc.fakers.bizEvents; | ||
|
||
import it.gov.pagopa.arc.connector.bizevents.dto.*; | ||
import it.gov.pagopa.arc.fakers.CommonUserDetailDTOFaker; | ||
import it.gov.pagopa.arc.fakers.CommonWalletInfoDTOFaker; | ||
|
||
import java.util.List; | ||
|
||
public class BizEventsTransactionDetailsDTOFaker { | ||
public static BizEventsTransactionDetailsDTO mockInstance(){ | ||
return mockInstanceBuilder().build(); | ||
} | ||
|
||
public static BizEventsTransactionDetailsDTO.BizEventsTransactionDetailsDTOBuilder mockInstanceBuilder(){ | ||
BizEventsWalletInfoDTO bizEventsWalletInfo = CommonWalletInfoDTOFaker.mockBizEventsWalletInfoDTO(false); | ||
BizEventsUserDetailDTO payer = CommonUserDetailDTOFaker.mockBizEventsUserDetailDTO(CommonUserDetailDTOFaker.USER_DETAIL_PAYER); | ||
BizEventsInfoTransactionDTO bizEventsInfoTransaction = BizEventsInfoTransactionDTOFaker.mockInstance(bizEventsWalletInfo, payer); | ||
|
||
BizEventsUserDetailDTO payee = CommonUserDetailDTOFaker.mockBizEventsUserDetailDTO(CommonUserDetailDTOFaker.USER_DETAIL_PAYEE); | ||
BizEventsUserDetailDTO debtor = CommonUserDetailDTOFaker.mockBizEventsUserDetailDTO(CommonUserDetailDTOFaker.USER_DETAIL_DEBTOR); | ||
BizEventsCartItemDTO bizEventsCartItem1 = BizEventsCartItemDTOFaker.mockInstance(payee,debtor); | ||
BizEventsCartItemDTO bizEventsCartItem2 = BizEventsCartItemDTOFaker.mockInstance(payee,debtor); | ||
List<BizEventsCartItemDTO> bizEventsCartsList = List.of(bizEventsCartItem1, bizEventsCartItem2); | ||
|
||
return BizEventsTransactionDetailsDTO.builder() | ||
.bizEventsInfoTransactionDTO(bizEventsInfoTransaction) | ||
.bizEventsCartsDTO(bizEventsCartsList); | ||
} | ||
} |
Oops, something went wrong.