generated from pagopa/pagopa-functions-template
-
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.
Merge pull request #91 from pagopa/PRDP-258-add-receipt-status-TO_REVIEW
[PRDP-258] Added new Receipt status TO_REVIEW
- Loading branch information
Showing
10 changed files
with
223 additions
and
93 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
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
2 changes: 1 addition & 1 deletion
2
...ava/it/gov/pagopa/receipt/pdf/generator/entity/receipt/enumeration/ReceiptStatusType.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,5 +1,5 @@ | ||
package it.gov.pagopa.receipt.pdf.generator.entity.receipt.enumeration; | ||
|
||
public enum ReceiptStatusType { | ||
NOT_QUEUE_SENT, INSERTED, RETRY, GENERATED, SIGNED, FAILED, IO_NOTIFIED, IO_ERROR_TO_NOTIFY, IO_NOTIFIER_RETRY, UNABLE_TO_SEND, NOT_TO_NOTIFY | ||
NOT_QUEUE_SENT, INSERTED, RETRY, GENERATED, SIGNED, FAILED, IO_NOTIFIED, IO_ERROR_TO_NOTIFY, IO_NOTIFIER_RETRY, UNABLE_TO_SEND, NOT_TO_NOTIFY, TO_REVIEW | ||
} |
15 changes: 15 additions & 0 deletions
15
src/main/java/it/gov/pagopa/receipt/pdf/generator/service/ReceiptCosmosService.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,15 @@ | ||
package it.gov.pagopa.receipt.pdf.generator.service; | ||
|
||
import it.gov.pagopa.receipt.pdf.generator.entity.receipt.Receipt; | ||
import it.gov.pagopa.receipt.pdf.generator.exception.ReceiptNotFoundException; | ||
|
||
public interface ReceiptCosmosService { | ||
|
||
/** | ||
* Recovers a receipt from the CosmosDB by the property eventId | ||
* @param bizEventId BizEvent id relative to the receipt | ||
* @return the receipt found | ||
* @throws ReceiptNotFoundException when no receipt has been found | ||
*/ | ||
Receipt getReceipt(String bizEventId) throws ReceiptNotFoundException; | ||
} |
40 changes: 40 additions & 0 deletions
40
src/main/java/it/gov/pagopa/receipt/pdf/generator/service/impl/ReceiptCosmosServiceImpl.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,40 @@ | ||
package it.gov.pagopa.receipt.pdf.generator.service.impl; | ||
|
||
import it.gov.pagopa.receipt.pdf.generator.client.ReceiptCosmosClient; | ||
import it.gov.pagopa.receipt.pdf.generator.client.impl.ReceiptCosmosClientImpl; | ||
import it.gov.pagopa.receipt.pdf.generator.entity.receipt.Receipt; | ||
import it.gov.pagopa.receipt.pdf.generator.exception.ReceiptNotFoundException; | ||
import it.gov.pagopa.receipt.pdf.generator.service.ReceiptCosmosService; | ||
|
||
public class ReceiptCosmosServiceImpl implements ReceiptCosmosService { | ||
|
||
private final ReceiptCosmosClient receiptCosmosClient; | ||
|
||
public ReceiptCosmosServiceImpl() { | ||
this.receiptCosmosClient = ReceiptCosmosClientImpl.getInstance(); | ||
} | ||
|
||
public ReceiptCosmosServiceImpl(ReceiptCosmosClient receiptCosmosClient) { | ||
this.receiptCosmosClient = receiptCosmosClient; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public Receipt getReceipt(String bizEventId) throws ReceiptNotFoundException { | ||
Receipt receipt; | ||
try { | ||
receipt = receiptCosmosClient.getReceiptDocument(bizEventId); | ||
} catch (ReceiptNotFoundException e) { | ||
String errorMsg = String.format("Receipt not found with the biz-event id %s",bizEventId); | ||
throw new ReceiptNotFoundException(errorMsg, e); | ||
} | ||
|
||
if (receipt == null) { | ||
String errorMsg = String.format("Receipt retrieved with the biz-event id %s is null", bizEventId); | ||
throw new ReceiptNotFoundException(errorMsg); | ||
} | ||
return receipt; | ||
} | ||
} |
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
Oops, something went wrong.