diff --git a/gradle.properties b/gradle.properties index e5384dca8..a0d21c66e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ # buildscript - project id projectGroup=com.generalbytes.batm.public -projectVersion=1.8.1 +projectVersion=1.8.2 # buildscript - common dependency versions bitrafaelVersion=1.0.44 diff --git a/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/IExtensionContext.java b/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/IExtensionContext.java index 5b230b9fc..a508ca0e6 100644 --- a/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/IExtensionContext.java +++ b/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/IExtensionContext.java @@ -876,4 +876,19 @@ default List<ICustomString> getCustomStrings(String serialNumber, String customS return new ArrayList<>(); } + /** + * Retrieves the data required to generate a receipt, including placeholder variables + * and any additional elements needed based on the specified template and transaction details. + * + * @param receiptTransferMethod The method used to send the receipt, + * determining the format and additional data required. + * @param transactionDetails The details of the transaction for which the receipt + * is being generated, providing values for relevant placeholders. + * @param template The template used for generating the receipt, + * which defines the structure and required placeholders. + * @return A {@link ReceiptData} instance containing all necessary data and placeholders + * for constructing the receipt according to the specified template. + */ + ReceiptData getReceiptData(ReceiptTransferMethod receiptTransferMethod, ITransactionDetails transactionDetails, String template); + } diff --git a/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/ReceiptData.java b/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/ReceiptData.java new file mode 100644 index 000000000..6aed4d10d --- /dev/null +++ b/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/ReceiptData.java @@ -0,0 +1,38 @@ +package com.generalbytes.batm.server.extensions; + +import java.util.Map; + +/** + * Represents data necessary to generate a receipt message. + * This interface provides access to placeholder variables and embedded images + * that may be used within a receipt. + */ +public interface ReceiptData { + + /** + * Retrieves a map of placeholder variables for the receipt. + * These variables contain values for all placeholders available for constructing + * a receipt message. + * + * <p>Each entry in the map represents a placeholder's name and its corresponding value. + * Placeholders are identified by their names without brackets. For example, a key + * {@code "text.crypto.amount"} corresponds to the value for the placeholder + * {@code {text.crypto.amount}} in the receipt template.</p> + * + * @return A map containing placeholder names as keys and their corresponding values. + */ + Map<String, String> getVariables(); + + /** + * Retrieves an array of embedded images to be included in the receipt email. + * + * <p>This method is specifically intended for email receipts + * ({@link ReceiptTransferMethod#EMAIL}), where embedded images are used.</p> + * + * @return An array of {@link IExtensionContext.EmbeddedEmailImage} objects, + * representing the images to embed in the email. + * @see IExtensionContext#sendHTMLMailAsync(String, String, String, String, String, IExtensionContext.EmbeddedEmailImage...) + */ + IExtensionContext.EmbeddedEmailImage[] getEmbeddedEmailImages(); + +} diff --git a/server_extensions_extra/src/main/java/com/generalbytes/batm/server/extensions/TestExtensionContext.java b/server_extensions_extra/src/main/java/com/generalbytes/batm/server/extensions/TestExtensionContext.java index e913b13f2..b35a9df78 100644 --- a/server_extensions_extra/src/main/java/com/generalbytes/batm/server/extensions/TestExtensionContext.java +++ b/server_extensions_extra/src/main/java/com/generalbytes/batm/server/extensions/TestExtensionContext.java @@ -507,4 +507,9 @@ public void markTransactionAsWithdrawn(String remoteOrLocalTransactionId) { @Override public void unlockTransaction(String rid, Date serverTimeToUnlock) { } + + @Override + public ReceiptData getReceiptData(ReceiptTransferMethod receiptTransferMethod, ITransactionDetails transactionDetails, String template) { + return null; + } }