From 03a01e1548440f662ce9afb9a54ace10f3065da1 Mon Sep 17 00:00:00 2001 From: Maros Silady Date: Tue, 7 Nov 2023 11:35:13 +0100 Subject: [PATCH 1/2] LC-255 - Discount from fixed fee --- .../batm/server/extensions/DiscountSpec.java | 48 +++++++++++++++++-- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/DiscountSpec.java b/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/DiscountSpec.java index a1b58e9cc..2c63c9b78 100644 --- a/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/DiscountSpec.java +++ b/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/DiscountSpec.java @@ -6,6 +6,8 @@ public class DiscountSpec { private BigDecimal buyDiscount; private BigDecimal sellDiscount; + private BigDecimal buyFixedFeeDiscount; + private BigDecimal sellFixedFeeDiscount; private Date validityFrom; private Date validityTill; private Long maximumUsages; @@ -23,21 +25,41 @@ public class DiscountSpec { * * @param buyDiscount * @param sellDiscount + * @param buyFixedFeeDiscount The percentage discount applied to the fixed fee on purchase transactions + * A value of 10 would represent a 10% discount on the fixed fee for buying. + * @param sellFixedFeeDiscount The percentage discount applied to the fixed fee on sale transactions + * A value of 10 would represent a 10% discount on the fixed fee for selling. * @param validityFrom * @param validityTill * @param maximumUsages * @param maximumUsagesPerIdentity * @param minimumTransactionAmount * @param totalLimit - * @param fiatCurrency in which currency are limit amounts + * @param fiatCurrency in which currency are limit amounts * @param firstTransactionOnly - * @param code (Optional) Defined code to be used (upper-cased) or null for code to be generated. - * @param linkedIdentityPublicId (Optional) Public ID of an existing identity to be linked to the Discount. - * @param notes (Optional) Notes worth noting. + * @param code (Optional) Defined code to be used (upper-cased) or null for code to be generated. + * @param linkedIdentityPublicId (Optional) Public ID of an existing identity to be linked to the Discount. + * @param notes (Optional) Notes worth noting. */ - public DiscountSpec(BigDecimal buyDiscount, BigDecimal sellDiscount, Date validityFrom, Date validityTill, Long maximumUsages, Long maximumUsagesPerIdentity, BigDecimal minimumTransactionAmount, BigDecimal totalLimit, String fiatCurrency, boolean firstTransactionOnly, String code, String linkedIdentityPublicId, String notes) { + public DiscountSpec(BigDecimal buyDiscount, + BigDecimal sellDiscount, + BigDecimal buyFixedFeeDiscount, + BigDecimal sellFixedFeeDiscount, + Date validityFrom, + Date validityTill, + Long maximumUsages, + Long maximumUsagesPerIdentity, + BigDecimal minimumTransactionAmount, + BigDecimal totalLimit, + String fiatCurrency, + boolean firstTransactionOnly, + String code, + String linkedIdentityPublicId, + String notes) { this.buyDiscount = buyDiscount; this.sellDiscount = sellDiscount; + this.buyFixedFeeDiscount = buyFixedFeeDiscount; + this.sellFixedFeeDiscount = sellFixedFeeDiscount; this.validityFrom = validityFrom; this.validityTill = validityTill; this.maximumUsages = maximumUsages; @@ -67,6 +89,22 @@ public void setSellDiscount(BigDecimal sellDiscount) { this.sellDiscount = sellDiscount; } + public BigDecimal getBuyFixedFeeDiscount() { + return buyFixedFeeDiscount; + } + + public void setBuyFixedFeeDiscount(BigDecimal buyFixedFeeDiscount) { + this.buyFixedFeeDiscount = buyFixedFeeDiscount; + } + + public BigDecimal getSellFixedFeeDiscount() { + return sellFixedFeeDiscount; + } + + public void setSellFixedFeeDiscount(BigDecimal sellFixedFeeDiscount) { + this.sellFixedFeeDiscount = sellFixedFeeDiscount; + } + public Date getValidityFrom() { return validityFrom; } From b6c1592b6d39c46758733a5f725aec0f7d4bd5c9 Mon Sep 17 00:00:00 2001 From: Maros Silady Date: Mon, 11 Dec 2023 10:49:29 +0100 Subject: [PATCH 2/2] LC-255 - Keep DiscountSpec compatible with older versions --- .../batm/server/extensions/DiscountSpec.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/DiscountSpec.java b/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/DiscountSpec.java index 2c63c9b78..2d6865681 100644 --- a/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/DiscountSpec.java +++ b/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/DiscountSpec.java @@ -73,6 +73,42 @@ public DiscountSpec(BigDecimal buyDiscount, this.notes = notes; } + /** + * @deprecated Use first constructor instead. + * Creates Discount Specification. + * + * @param buyDiscount + * @param sellDiscount + * @param validityFrom + * @param validityTill + * @param maximumUsages + * @param maximumUsagesPerIdentity + * @param minimumTransactionAmount + * @param totalLimit + * @param fiatCurrency in which currency are limit amounts + * @param firstTransactionOnly + * @param code (Optional) Defined code to be used (upper-cased) or null for code to be generated. + * @param linkedIdentityPublicId (Optional) Public ID of an existing identity to be linked to the Discount. + * @param notes (Optional) Notes worth noting. + * + */ + @Deprecated + public DiscountSpec(BigDecimal buyDiscount, BigDecimal sellDiscount, Date validityFrom, Date validityTill, Long maximumUsages, Long maximumUsagesPerIdentity, BigDecimal minimumTransactionAmount, BigDecimal totalLimit, String fiatCurrency, boolean firstTransactionOnly, String code, String linkedIdentityPublicId, String notes) { + this.buyDiscount = buyDiscount; + this.sellDiscount = sellDiscount; + this.validityFrom = validityFrom; + this.validityTill = validityTill; + this.maximumUsages = maximumUsages; + this.maximumUsagesPerIdentity = maximumUsagesPerIdentity; + this.minimumTransactionAmount = minimumTransactionAmount; + this.totalLimit = totalLimit; + this.fiatCurrency = fiatCurrency; + this.firstTransactionOnly = firstTransactionOnly; + this.code = code; + this.linkedIdentityPublicId = linkedIdentityPublicId; + this.notes = notes; + } + public BigDecimal getBuyDiscount() { return buyDiscount; }