From 6bc4b2074dd847f5f193d4b951150caf471913c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Ro=C4=8Dek?= <122279630+drocek@users.noreply.github.com> Date: Wed, 18 Sep 2024 08:26:26 +0200 Subject: [PATCH 1/5] CF-672: added transfer methods to receipt details + added method to get custom string value (#936) --- .../server/extensions/IExtensionContext.java | 15 ++++++++++++ .../server/extensions/IReceiptDetails.java | 9 +++++++- .../extensions/ReceiptTransferMethod.java | 23 +++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/ReceiptTransferMethod.java 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 461da7fff..2179dc3dc 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 @@ -852,4 +852,19 @@ public static class EmbeddedEmailImage { * @param serverTimeToUnlock The absolute datetime when the transaction should unlock. */ void unlockTransaction(String rid, Date serverTimeToUnlock); + + /** + * Returns the custom string value set in CAS. + * + * @param serialNumber Terminal or GB Safe serial number. + * @param customStringName Name of custom string. + * @param language Language in the ISO standard (for example 'en' for English, 'de' for German, 'de_CH' for Swiss German etc.). + * For default value, set language to {@code "default"} or leave blank. If no value is found for the specified + * language, the value for the default language will be returned (if available), otherwise {@code null}. + * @return Custom string value from the selected terminal or GB Safe in the selected language. Returns {@code null} if not found. + */ + default String getCustomStringValue(String serialNumber, String customStringName, String language) { + return null; + } + } diff --git a/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/IReceiptDetails.java b/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/IReceiptDetails.java index eb0d75a05..cfcd81815 100644 --- a/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/IReceiptDetails.java +++ b/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/IReceiptDetails.java @@ -1,5 +1,5 @@ /************************************************************************************* - * Copyright (C) 2014-2020 GENERAL BYTES s.r.o. All rights reserved. + * Copyright (C) 2014-2024 GENERAL BYTES s.r.o. All rights reserved. * * This software may be distributed and modified under the terms of the GNU * General Public License version 2 (GPL2) as published by the Free Software @@ -17,6 +17,8 @@ ************************************************************************************/ package com.generalbytes.batm.server.extensions; +import java.util.Set; + public interface IReceiptDetails { String CUSTOM_DATA_RECEIPT_LANGUAGE = "receipt.language"; @@ -49,4 +51,9 @@ public interface IReceiptDetails { */ String getUserLanguage(); + /** + * @return Methods used to send the receipt. It always contains at least one transfer method. + */ + Set getTransferMethods(); + } diff --git a/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/ReceiptTransferMethod.java b/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/ReceiptTransferMethod.java new file mode 100644 index 000000000..5b86ea95b --- /dev/null +++ b/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/ReceiptTransferMethod.java @@ -0,0 +1,23 @@ +/************************************************************************************* + * Copyright (C) 2014-2024 GENERAL BYTES s.r.o. All rights reserved. + * + * This software may be distributed and modified under the terms of the GNU + * General Public License version 2 (GPL2) as published by the Free Software + * Foundation and appearing in the file GPL2.TXT included in the packaging of + * this file. Please note that GPL2 Section 2[b] requires that all works based + * on this software must also be made publicly available under the terms of + * the GPL2 ("Copyleft"). + * + * Contact information + * ------------------- + * + * GENERAL BYTES s.r.o. + * Web : http://www.generalbytes.com + * + ************************************************************************************/ +package com.generalbytes.batm.server.extensions; + +public enum ReceiptTransferMethod { + SMS, + EMAIL +} \ No newline at end of file From b85ffe7060079358d3f9d72969002cc92db5a945 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Ro=C4=8Dek?= <122279630+drocek@users.noreply.github.com> Date: Wed, 18 Sep 2024 15:28:51 +0200 Subject: [PATCH 2/5] CF-672: added properties to transaction detail and changed method returning custom string data (#937) --- .../batm/server/extensions/ICustomString.java | 26 +++++++++++++++++++ .../server/extensions/IExtensionContext.java | 19 +++++++------- .../extensions/ITransactionDetails.java | 12 +++++++++ 3 files changed, 47 insertions(+), 10 deletions(-) create mode 100644 server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/ICustomString.java diff --git a/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/ICustomString.java b/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/ICustomString.java new file mode 100644 index 000000000..5c83cc329 --- /dev/null +++ b/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/ICustomString.java @@ -0,0 +1,26 @@ +package com.generalbytes.batm.server.extensions; + +public interface ICustomString { + + /** + * @return Name of custom string. + */ + default String getName() { + return null; + } + + /** + * @return Value of custom string. + */ + default String getValue() { + return null; + } + + /** + * @return Language in the ISO standard (for example 'en' for English, 'de' for German, 'de_CH' for Swiss German etc.). + */ + default String getLanguage() { + return null; + } + +} 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 2179dc3dc..9da2adb91 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 @@ -35,6 +35,7 @@ import java.math.BigDecimal; import java.net.InetSocketAddress; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.Collection; import java.util.Date; import java.util.List; @@ -854,17 +855,15 @@ public static class EmbeddedEmailImage { void unlockTransaction(String rid, Date serverTimeToUnlock); /** - * Returns the custom string value set in CAS. + * Returns the list of custom strings. * - * @param serialNumber Terminal or GB Safe serial number. - * @param customStringName Name of custom string. - * @param language Language in the ISO standard (for example 'en' for English, 'de' for German, 'de_CH' for Swiss German etc.). - * For default value, set language to {@code "default"} or leave blank. If no value is found for the specified - * language, the value for the default language will be returned (if available), otherwise {@code null}. - * @return Custom string value from the selected terminal or GB Safe in the selected language. Returns {@code null} if not found. - */ - default String getCustomStringValue(String serialNumber, String customStringName, String language) { - return null; + * @param serialNumber Serial number of terminal or GB Safe. + * @param customStringName Name of custom string. If null, returns all custom strings of selected terminal or GB Safe. + * @return Values of the selected custom string in all available languages from the selected terminal or GB Safe. + * Returns an empty list if no custom string is found. + */ + default List getCustomStrings(String serialNumber, String customStringName) { + return new ArrayList<>(); } } diff --git a/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/ITransactionDetails.java b/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/ITransactionDetails.java index 5de9b6037..c0243b76c 100644 --- a/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/ITransactionDetails.java +++ b/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/ITransactionDetails.java @@ -329,4 +329,16 @@ public interface ITransactionDetails { * @return Payment type: CASH/PAYMENT_CARD */ String getPaymentType(); + + /** + * @return UUID of transaction. + */ + String getUuid(); + + /** + * Returns the name of the crypto setting used for the transaction. + * @return Name of crypto setting used for the transaction. + */ + String getNameOfCryptoSettingUsed(); + } From 152a6319b95ba4d0b899731aaad3916c670c010f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pl=C3=A1nsk=C3=BD?= <67519977+d0by1@users.noreply.github.com> Date: Wed, 6 Nov 2024 14:20:40 +0100 Subject: [PATCH 3/5] CF-690 Add a method to get data for receipts (#943) --- .../server/extensions/IExtensionContext.java | 15 ++++++++ .../batm/server/extensions/ReceiptData.java | 38 +++++++++++++++++++ .../extensions/TestExtensionContext.java | 5 +++ 3 files changed, 58 insertions(+) create mode 100644 server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/ReceiptData.java 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 9da2adb91..058abb72b 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 @@ -866,4 +866,19 @@ default List 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. + * + *

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.

+ * + * @return A map containing placeholder names as keys and their corresponding values. + */ + Map getVariables(); + + /** + * Retrieves an array of embedded images to be included in the receipt email. + * + *

This method is specifically intended for email receipts + * ({@link ReceiptTransferMethod#EMAIL}), where embedded images are used.

+ * + * @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 4fa5b1892..1998122a7 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 @@ -490,4 +490,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; + } } From 3ceaab2829494a4ac0f4fc1dce78ec1725d5f7df Mon Sep 17 00:00:00 2001 From: Filip Ocelka Date: Wed, 6 Nov 2024 14:21:27 +0100 Subject: [PATCH 4/5] Increase project version --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 7545d4968..d868c04fd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ # buildscript - project id projectGroup=com.generalbytes.batm.public -projectVersion=1.6.4 +projectVersion=1.6.5 # buildscript - common dependency versions bitrafaelVersion=1.0.44 From 1f03170388d32caf9dd93d022fb0e3bac336298e Mon Sep 17 00:00:00 2001 From: Filip Ocelka Date: Wed, 6 Nov 2024 15:04:24 +0100 Subject: [PATCH 5/5] BATM-6544 Fix where convention plugins are applied (#924) (#944) --- annotations/build.gradle | 2 +- batm_ssh_tunnel/build.gradle | 1 - build.gradle | 7 +++++++ buildSrc/src/main/groovy/shared-build-conventions.gradle | 1 - currencies/build.gradle | 2 +- operators_sample_website/build.gradle | 2 +- server_extensions_api/build.gradle | 2 +- server_extensions_examples/build.gradle | 2 +- server_extensions_extra/build.gradle | 2 +- server_extensions_template/build.gradle | 2 +- server_extensions_test/build.gradle | 1 - 11 files changed, 14 insertions(+), 10 deletions(-) create mode 100644 build.gradle diff --git a/annotations/build.gradle b/annotations/build.gradle index e47c2d3bb..848b52127 100644 --- a/annotations/build.gradle +++ b/annotations/build.gradle @@ -1,5 +1,5 @@ plugins { - id("shared-build-conventions") + id("shared-publish-conventions") } group = projectGroup diff --git a/batm_ssh_tunnel/build.gradle b/batm_ssh_tunnel/build.gradle index 646b2f252..eaf0ba50d 100644 --- a/batm_ssh_tunnel/build.gradle +++ b/batm_ssh_tunnel/build.gradle @@ -1,6 +1,5 @@ plugins { id("application") - id("shared-build-conventions") } version = "1.0.0" diff --git a/build.gradle b/build.gradle new file mode 100644 index 000000000..58adfc36e --- /dev/null +++ b/build.gradle @@ -0,0 +1,7 @@ +plugins { + id("shared-build-conventions") +} + +allprojects { + apply plugin: 'shared-build-conventions' +} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/shared-build-conventions.gradle b/buildSrc/src/main/groovy/shared-build-conventions.gradle index 1fb725fef..9b32d6e78 100644 --- a/buildSrc/src/main/groovy/shared-build-conventions.gradle +++ b/buildSrc/src/main/groovy/shared-build-conventions.gradle @@ -1,7 +1,6 @@ plugins { id("java") id("com.generalbytes.gradle.main") - id("shared-publish-conventions") } repositories { diff --git a/currencies/build.gradle b/currencies/build.gradle index d0ffed15d..d525bb2c3 100644 --- a/currencies/build.gradle +++ b/currencies/build.gradle @@ -1,5 +1,5 @@ plugins { - id("shared-build-conventions") + id("shared-publish-conventions") } group = projectGroup diff --git a/operators_sample_website/build.gradle b/operators_sample_website/build.gradle index a6c78c78a..77a8446d4 100644 --- a/operators_sample_website/build.gradle +++ b/operators_sample_website/build.gradle @@ -1,5 +1,5 @@ plugins { - id("shared-build-conventions") + id("shared-publish-conventions") } group = projectGroup diff --git a/server_extensions_api/build.gradle b/server_extensions_api/build.gradle index f804a2172..9686dd886 100644 --- a/server_extensions_api/build.gradle +++ b/server_extensions_api/build.gradle @@ -1,5 +1,5 @@ plugins { - id("shared-build-conventions") + id("shared-publish-conventions") id("distribution") } diff --git a/server_extensions_examples/build.gradle b/server_extensions_examples/build.gradle index 1fade2898..168c4914b 100644 --- a/server_extensions_examples/build.gradle +++ b/server_extensions_examples/build.gradle @@ -1,5 +1,5 @@ plugins { - id("shared-build-conventions") + id("shared-publish-conventions") } group = projectGroup diff --git a/server_extensions_extra/build.gradle b/server_extensions_extra/build.gradle index f29377a07..670330298 100644 --- a/server_extensions_extra/build.gradle +++ b/server_extensions_extra/build.gradle @@ -1,5 +1,5 @@ plugins { - id("shared-build-conventions") + id("shared-publish-conventions") id("shared-repositories-ext-conventions") } diff --git a/server_extensions_template/build.gradle b/server_extensions_template/build.gradle index 78226917c..c7b16fd3f 100644 --- a/server_extensions_template/build.gradle +++ b/server_extensions_template/build.gradle @@ -1,5 +1,5 @@ plugins { - id("shared-build-conventions") + id("shared-publish-conventions") } group = projectGroup diff --git a/server_extensions_test/build.gradle b/server_extensions_test/build.gradle index fd5e7cc19..cd19d52a0 100644 --- a/server_extensions_test/build.gradle +++ b/server_extensions_test/build.gradle @@ -1,6 +1,5 @@ plugins { id("application") - id("shared-build-conventions") id("shared-repositories-ext-conventions") }