From 135cbe5185196d208ca11295520e2eb3ee4729c5 Mon Sep 17 00:00:00 2001 From: Dmitriy Kolpakov Date: Mon, 10 Mar 2025 07:23:49 +0300 Subject: [PATCH 01/14] =?UTF-8?q?STDEV-20296=20=D0=A0=D0=B0=D1=81=D1=88?= =?UTF-8?q?=D0=B8=D1=80=D0=B5=D0=BD=D1=8B=20discount=20=D0=B5=D0=B2=D0=B5?= =?UTF-8?q?=D0=BD=D1=82=D1=8B=20=D0=B8=20paymentPurpose?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datamapper/PaymentPurposeMapper.java | 6 ++- .../discount/ReceiptDiscountEvent.java | 23 +++++++++++- .../discount/ReceiptDiscountEventResult.java | 37 ++++++++++++++++++- .../framework/payment/PaymentPurpose.java | 28 ++++++++++---- 4 files changed, 83 insertions(+), 11 deletions(-) diff --git a/src/main/java/ru/evotor/framework/core/action/datamapper/PaymentPurposeMapper.java b/src/main/java/ru/evotor/framework/core/action/datamapper/PaymentPurposeMapper.java index 3069b14fc5..0fa020fa7b 100644 --- a/src/main/java/ru/evotor/framework/core/action/datamapper/PaymentPurposeMapper.java +++ b/src/main/java/ru/evotor/framework/core/action/datamapper/PaymentPurposeMapper.java @@ -16,6 +16,7 @@ public final class PaymentPurposeMapper { private static final String KEY_TOTAL = "total"; private static final String KEY_ACCOUNT_ID = "account"; private static final String KEY_USER_MESSAGE = "userMessage"; + private static final String KEY_PAYMENT_SESSION_ID = "paymentSessionId"; @Nullable public static PaymentPurpose from(@Nullable Bundle bundle) { @@ -28,13 +29,15 @@ public static PaymentPurpose from(@Nullable Bundle bundle) { BigDecimal total = BundleUtils.getMoney(bundle, KEY_TOTAL); String account = bundle.getString(KEY_ACCOUNT_ID); String userMessage = bundle.getString(KEY_USER_MESSAGE); + String paymentSessionId = bundle.getString(KEY_PAYMENT_SESSION_ID); return new PaymentPurpose( identifier, paymentPerformer != null ? paymentPerformer.getPaymentSystem() != null ? paymentPerformer.getPaymentSystem().getPaymentSystemId() : paymentSystemId : paymentSystemId, paymentPerformer, total != null ? total : BigDecimal.ZERO, account, - userMessage + userMessage, + paymentSessionId ); } @@ -52,6 +55,7 @@ public static Bundle toBundle(@Nullable PaymentPurpose paymentPurpose) { bundle.putString(KEY_TOTAL, paymentPurpose.getTotal().toPlainString()); bundle.putString(KEY_ACCOUNT_ID, paymentPurpose.getAccountId()); bundle.putString(KEY_USER_MESSAGE, paymentPurpose.getUserMessage()); + bundle.putString(KEY_PAYMENT_SESSION_ID, paymentPurpose.getPaymentSessionId()); return bundle; } diff --git a/src/main/java/ru/evotor/framework/core/action/event/receipt/discount/ReceiptDiscountEvent.java b/src/main/java/ru/evotor/framework/core/action/event/receipt/discount/ReceiptDiscountEvent.java index c69ca5272e..2cfef5f5ad 100644 --- a/src/main/java/ru/evotor/framework/core/action/event/receipt/discount/ReceiptDiscountEvent.java +++ b/src/main/java/ru/evotor/framework/core/action/event/receipt/discount/ReceiptDiscountEvent.java @@ -90,6 +90,8 @@ public class ReceiptDiscountEvent implements IBundlable { private static final String KEY_RECEIPT_UUID = "receiptUuid"; private static final String KEY_DISCOUNT = "discount"; + private static final String KEY_LOYALTY_CARD_ID = "loyaltyCardId"; + @Nullable public static ReceiptDiscountEvent create(@Nullable Bundle bundle) { @@ -101,13 +103,17 @@ public static ReceiptDiscountEvent create(@Nullable Bundle bundle) { if (discount == null) { return null; } - return new ReceiptDiscountEvent(receiptUuid, discount); + String loyaltyCardId = bundle.getString(KEY_LOYALTY_CARD_ID, null); + + return new ReceiptDiscountEvent(receiptUuid, discount, loyaltyCardId); } @NonNull private final String receiptUuid; @NonNull private final BigDecimal discount; + @Nullable + private String loyaltyCardId = null; public ReceiptDiscountEvent( @NonNull String receiptUuid, @@ -116,12 +122,22 @@ public ReceiptDiscountEvent( this.receiptUuid = receiptUuid; this.discount = discount; } + public ReceiptDiscountEvent( + @NonNull String receiptUuid, + @NonNull BigDecimal discount, + @Nullable String loyaltyCardId + ) { + this.receiptUuid = receiptUuid; + this.discount = discount; + this.loyaltyCardId = loyaltyCardId; + } @NonNull public Bundle toBundle() { Bundle result = new Bundle(); result.putString(KEY_RECEIPT_UUID, receiptUuid); result.putString(KEY_DISCOUNT, discount.toPlainString()); + result.putString(KEY_LOYALTY_CARD_ID, loyaltyCardId); return result; } @@ -134,4 +150,9 @@ public String getReceiptUuid() { public BigDecimal getDiscount() { return discount; } + + @Nullable + public String getLoyaltyCardId(){ + return loyaltyCardId; + } } diff --git a/src/main/java/ru/evotor/framework/core/action/event/receipt/discount/ReceiptDiscountEventResult.java b/src/main/java/ru/evotor/framework/core/action/event/receipt/discount/ReceiptDiscountEventResult.java index e1d6d2a0d5..63815d1ad0 100644 --- a/src/main/java/ru/evotor/framework/core/action/event/receipt/discount/ReceiptDiscountEventResult.java +++ b/src/main/java/ru/evotor/framework/core/action/event/receipt/discount/ReceiptDiscountEventResult.java @@ -29,6 +29,7 @@ public class ReceiptDiscountEventResult implements IBundlable { private static final String KEY_RECEIPT_SET_PURCHASER_CONTACT_DATA = "setPurchaserContactData"; private static final String KEY_POSITION_UUID_TO_DISCOUNT_MAP = "positionUuidToDiscountMap"; + private static final String KEY_LOYALTY_CARD_ID = "loyaltyCardId"; @Nullable public static ReceiptDiscountEventResult create(@Nullable Bundle bundle) { @@ -43,6 +44,10 @@ public static ReceiptDiscountEventResult create(@Nullable Bundle bundle) { if(bundle.containsKey(KEY_POSITION_UUID_TO_DISCOUNT_MAP)) { positionUuidToDiscountMap = (Map) bundle.getSerializable(KEY_POSITION_UUID_TO_DISCOUNT_MAP); } + String loyaltyCardId = null; + if (bundle.containsKey(KEY_LOYALTY_CARD_ID)){ + loyaltyCardId = bundle.getString(KEY_LOYALTY_CARD_ID, null); + } return new ReceiptDiscountEventResult( discount, SetExtra.from(bundle.getBundle(KEY_RECEIPT_EXTRA)), @@ -51,7 +56,8 @@ public static ReceiptDiscountEventResult create(@Nullable Bundle bundle) { IPositionChange.class ), SetPurchaserContactData.from(bundle.getBundle(KEY_RECEIPT_SET_PURCHASER_CONTACT_DATA)), - positionUuidToDiscountMap + positionUuidToDiscountMap, + loyaltyCardId ); } @@ -66,6 +72,8 @@ public static ReceiptDiscountEventResult create(@Nullable Bundle bundle) { @Nullable private final Map positionUuidToDiscountMap; + @Nullable + private final String loyaltyCardId; public ReceiptDiscountEventResult( @NonNull BigDecimal discount, @@ -80,6 +88,7 @@ public ReceiptDiscountEventResult( this.changes = changes; this.setPurchaserContactData = setPurchaserContactData; this.positionUuidToDiscountMap = null; + this.loyaltyCardId = null; } public ReceiptDiscountEventResult( @@ -96,6 +105,25 @@ public ReceiptDiscountEventResult( this.changes = changes; this.setPurchaserContactData = setPurchaserContactData; this.positionUuidToDiscountMap = positionUuidToDiscountMap; + this.loyaltyCardId = null; + } + + public ReceiptDiscountEventResult( + @NonNull BigDecimal discount, + @Nullable SetExtra extra, + @NonNull List changes, + @Nullable SetPurchaserContactData setPurchaserContactData, + @Nullable Map positionUuidToDiscountMap, + @Nullable String loyaltyCardInfo + ) { + Objects.requireNonNull(discount); + + this.discount = discount; + this.extra = extra; + this.changes = changes; + this.setPurchaserContactData = setPurchaserContactData; + this.positionUuidToDiscountMap = positionUuidToDiscountMap; + this.loyaltyCardId = loyaltyCardInfo; } @NonNull @@ -116,6 +144,9 @@ public Bundle toBundle() { if (positionUuidToDiscountMap != null) { bundle.putSerializable(KEY_POSITION_UUID_TO_DISCOUNT_MAP, (Serializable) positionUuidToDiscountMap); } + if (loyaltyCardId != null) { + bundle.putString(KEY_LOYALTY_CARD_ID, loyaltyCardId); + } return bundle; } @@ -143,4 +174,8 @@ public SetPurchaserContactData getSetPurchaserContactData() { public Map getPositionUuidToDiscountMap() { return positionUuidToDiscountMap; } + @Nullable + public String getLoyaltyCardId(){ + return loyaltyCardId; + } } \ No newline at end of file diff --git a/src/main/java/ru/evotor/framework/payment/PaymentPurpose.java b/src/main/java/ru/evotor/framework/payment/PaymentPurpose.java index 397cf65391..be7d5f3174 100644 --- a/src/main/java/ru/evotor/framework/payment/PaymentPurpose.java +++ b/src/main/java/ru/evotor/framework/payment/PaymentPurpose.java @@ -4,6 +4,7 @@ import android.os.Parcelable; import java.math.BigDecimal; +import java.util.Objects; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -53,14 +54,20 @@ public class PaymentPurpose implements Parcelable { */ @Nullable private final String userMessage; + /** + * ID платежной сессии + */ + @Nullable + private final String paymentSessionId; - public PaymentPurpose(@Nullable String identifier, @Nullable String paymentSystemId, @Nullable PaymentPerformer paymentPerformer, @NonNull BigDecimal total, @Nullable String accountId, @Nullable String userMessage) { + public PaymentPurpose(@Nullable String identifier, @Nullable String paymentSystemId, @Nullable PaymentPerformer paymentPerformer, @NonNull BigDecimal total, @Nullable String accountId, @Nullable String userMessage, @Nullable String paymentSessionId) { this.identifier = identifier; this.paymentSystemId = paymentSystemId; this.paymentPerformer = paymentPerformer; this.total = total; this.accountId = accountId; this.userMessage = userMessage; + this.paymentSessionId = paymentSessionId; } @Nullable @@ -98,6 +105,11 @@ public String getUserMessage() { return userMessage; } + @Nullable + public String getPaymentSessionId() { + return paymentSessionId; + } + @Override public boolean equals(Object o) { if (this == o) return true; @@ -134,13 +146,10 @@ public boolean equals(Object o) { return false; return total.equals(that.total) - && (accountId != null - ? accountId.equals(that.accountId) - : that.accountId == null) - && (userMessage != null - ? userMessage.equals(that.userMessage) - : that.userMessage == null); - + && (Objects.equals(accountId, that.accountId)) + && (Objects.equals(userMessage, that.userMessage)) + && (Objects.equals(paymentSessionId, that.paymentSessionId) + ); } @Override @@ -162,6 +171,7 @@ public int hashCode() { result = 31 * result + total.hashCode(); result = 31 * result + (accountId != null ? accountId.hashCode() : 0); result = 31 * result + (userMessage != null ? userMessage.hashCode() : 0); + result = 31 * result + (paymentSessionId != null ? paymentSessionId.hashCode() : 0); return result; } @@ -177,6 +187,7 @@ public void writeToParcel(Parcel dest, int flags) { dest.writeString(this.total.toPlainString()); dest.writeString(this.accountId); dest.writeString(this.userMessage); + dest.writeString(this.paymentSessionId); } protected PaymentPurpose(Parcel in) { @@ -186,6 +197,7 @@ protected PaymentPurpose(Parcel in) { this.total = new BigDecimal(in.readString()); this.accountId = in.readString(); this.userMessage = in.readString(); + this.paymentSessionId = in.readString(); } public static final Creator CREATOR = new Creator() { From 90ddeb5b6a805c065305ac6ad55ef9413980a314 Mon Sep 17 00:00:00 2001 From: Dmitriy Kolpakov Date: Mon, 10 Mar 2025 09:15:09 +0300 Subject: [PATCH 02/14] =?UTF-8?q?STDEV-20296=20=D0=9E=D1=82=D0=BA=D0=B0?= =?UTF-8?q?=D1=82=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D0=B9?= =?UTF-8?q?=20=D0=B2=20paymentPurpose?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datamapper/PaymentPurposeMapper.java | 6 +--- .../framework/payment/PaymentPurpose.java | 28 ++++++------------- 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/src/main/java/ru/evotor/framework/core/action/datamapper/PaymentPurposeMapper.java b/src/main/java/ru/evotor/framework/core/action/datamapper/PaymentPurposeMapper.java index 0fa020fa7b..3069b14fc5 100644 --- a/src/main/java/ru/evotor/framework/core/action/datamapper/PaymentPurposeMapper.java +++ b/src/main/java/ru/evotor/framework/core/action/datamapper/PaymentPurposeMapper.java @@ -16,7 +16,6 @@ public final class PaymentPurposeMapper { private static final String KEY_TOTAL = "total"; private static final String KEY_ACCOUNT_ID = "account"; private static final String KEY_USER_MESSAGE = "userMessage"; - private static final String KEY_PAYMENT_SESSION_ID = "paymentSessionId"; @Nullable public static PaymentPurpose from(@Nullable Bundle bundle) { @@ -29,15 +28,13 @@ public static PaymentPurpose from(@Nullable Bundle bundle) { BigDecimal total = BundleUtils.getMoney(bundle, KEY_TOTAL); String account = bundle.getString(KEY_ACCOUNT_ID); String userMessage = bundle.getString(KEY_USER_MESSAGE); - String paymentSessionId = bundle.getString(KEY_PAYMENT_SESSION_ID); return new PaymentPurpose( identifier, paymentPerformer != null ? paymentPerformer.getPaymentSystem() != null ? paymentPerformer.getPaymentSystem().getPaymentSystemId() : paymentSystemId : paymentSystemId, paymentPerformer, total != null ? total : BigDecimal.ZERO, account, - userMessage, - paymentSessionId + userMessage ); } @@ -55,7 +52,6 @@ public static Bundle toBundle(@Nullable PaymentPurpose paymentPurpose) { bundle.putString(KEY_TOTAL, paymentPurpose.getTotal().toPlainString()); bundle.putString(KEY_ACCOUNT_ID, paymentPurpose.getAccountId()); bundle.putString(KEY_USER_MESSAGE, paymentPurpose.getUserMessage()); - bundle.putString(KEY_PAYMENT_SESSION_ID, paymentPurpose.getPaymentSessionId()); return bundle; } diff --git a/src/main/java/ru/evotor/framework/payment/PaymentPurpose.java b/src/main/java/ru/evotor/framework/payment/PaymentPurpose.java index be7d5f3174..397cf65391 100644 --- a/src/main/java/ru/evotor/framework/payment/PaymentPurpose.java +++ b/src/main/java/ru/evotor/framework/payment/PaymentPurpose.java @@ -4,7 +4,6 @@ import android.os.Parcelable; import java.math.BigDecimal; -import java.util.Objects; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -54,20 +53,14 @@ public class PaymentPurpose implements Parcelable { */ @Nullable private final String userMessage; - /** - * ID платежной сессии - */ - @Nullable - private final String paymentSessionId; - public PaymentPurpose(@Nullable String identifier, @Nullable String paymentSystemId, @Nullable PaymentPerformer paymentPerformer, @NonNull BigDecimal total, @Nullable String accountId, @Nullable String userMessage, @Nullable String paymentSessionId) { + public PaymentPurpose(@Nullable String identifier, @Nullable String paymentSystemId, @Nullable PaymentPerformer paymentPerformer, @NonNull BigDecimal total, @Nullable String accountId, @Nullable String userMessage) { this.identifier = identifier; this.paymentSystemId = paymentSystemId; this.paymentPerformer = paymentPerformer; this.total = total; this.accountId = accountId; this.userMessage = userMessage; - this.paymentSessionId = paymentSessionId; } @Nullable @@ -105,11 +98,6 @@ public String getUserMessage() { return userMessage; } - @Nullable - public String getPaymentSessionId() { - return paymentSessionId; - } - @Override public boolean equals(Object o) { if (this == o) return true; @@ -146,10 +134,13 @@ public boolean equals(Object o) { return false; return total.equals(that.total) - && (Objects.equals(accountId, that.accountId)) - && (Objects.equals(userMessage, that.userMessage)) - && (Objects.equals(paymentSessionId, that.paymentSessionId) - ); + && (accountId != null + ? accountId.equals(that.accountId) + : that.accountId == null) + && (userMessage != null + ? userMessage.equals(that.userMessage) + : that.userMessage == null); + } @Override @@ -171,7 +162,6 @@ public int hashCode() { result = 31 * result + total.hashCode(); result = 31 * result + (accountId != null ? accountId.hashCode() : 0); result = 31 * result + (userMessage != null ? userMessage.hashCode() : 0); - result = 31 * result + (paymentSessionId != null ? paymentSessionId.hashCode() : 0); return result; } @@ -187,7 +177,6 @@ public void writeToParcel(Parcel dest, int flags) { dest.writeString(this.total.toPlainString()); dest.writeString(this.accountId); dest.writeString(this.userMessage); - dest.writeString(this.paymentSessionId); } protected PaymentPurpose(Parcel in) { @@ -197,7 +186,6 @@ protected PaymentPurpose(Parcel in) { this.total = new BigDecimal(in.readString()); this.accountId = in.readString(); this.userMessage = in.readString(); - this.paymentSessionId = in.readString(); } public static final Creator CREATOR = new Creator() { From 6e9e91843e5e24d4e1a17e0e7df41c27adfcc542 Mon Sep 17 00:00:00 2001 From: Dmitriy Kolpakov Date: Tue, 25 Mar 2025 13:58:37 +0300 Subject: [PATCH 03/14] =?UTF-8?q?STDEV-20296=20=D0=A0=D0=B0=D1=81=D1=88?= =?UTF-8?q?=D0=B8=D1=80=D0=B5=D0=BD=20Receipt.kt=20=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?=D1=8B=D0=BC=D0=B8=20=D0=BF=D0=BE=D0=BB=D1=8F=D0=BC=D0=B8.=20?= =?UTF-8?q?=D0=A0=D0=B0=D1=81=D1=88=D0=B8=D1=80=D0=B5=D0=BD=20ReceiptDisco?= =?UTF-8?q?untRequiredEventResult=20=D0=BF=D0=BE=D0=BB=D0=B5=D0=BC=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4=D0=B0=D1=87?= =?UTF-8?q?=D0=B8=20=D0=BD=D0=BE=D0=BC=D0=B5=D1=80=D0=B0=20=D0=BA=D0=B0?= =?UTF-8?q?=D1=80=D1=82=D1=8B=20=D0=BB=D0=BE=D1=8F=D0=BB=D1=8C=D0=BD=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D0=B8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datamapper/ReceiptHeaderMapper.java | 20 ++++++++++++++++--- .../ReceiptDiscountRequiredEventResult.kt | 9 +++++++-- .../ru/evotor/framework/receipt/Receipt.kt | 13 +++++++++++- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/src/main/java/ru/evotor/framework/core/action/datamapper/ReceiptHeaderMapper.java b/src/main/java/ru/evotor/framework/core/action/datamapper/ReceiptHeaderMapper.java index 503b1717dc..35242fe161 100644 --- a/src/main/java/ru/evotor/framework/core/action/datamapper/ReceiptHeaderMapper.java +++ b/src/main/java/ru/evotor/framework/core/action/datamapper/ReceiptHeaderMapper.java @@ -20,6 +20,8 @@ public final class ReceiptHeaderMapper { private static final String KEY_CLIENT_PHONE = "clientPhone"; private static final String KEY_EXTRA = "extra"; private static final String KEY_SESSION_NUMBER = "sessionNumber"; + private static final String KEY_PAYMENT_SESSION_ID = "paymentSessionId"; + private static final String KEY_LOYALTY_CARD_ID = "loyaltyCardId"; @Nullable public static Receipt.Header from(@Nullable Bundle bundle) { @@ -43,7 +45,14 @@ public static Receipt.Header from(@Nullable Bundle bundle) { if(bundle.containsKey(KEY_SESSION_NUMBER)) { sessionNumber = bundle.getLong(KEY_SESSION_NUMBER); } - + String paymentSessionId = null; + if (bundle.containsKey(KEY_PAYMENT_SESSION_ID)){ + paymentSessionId = bundle.getString(KEY_PAYMENT_SESSION_ID); + } + String loyaltyCardId = null; + if (bundle.containsKey(KEY_LOYALTY_CARD_ID)){ + loyaltyCardId = bundle.getString(KEY_LOYALTY_CARD_ID); + } return new Receipt.Header( receiptUuid, baseReceiptUuid, @@ -53,7 +62,9 @@ public static Receipt.Header from(@Nullable Bundle bundle) { bundle.getString(KEY_CLIENT_EMAIL), bundle.getString(KEY_CLIENT_PHONE), bundle.getString(KEY_EXTRA), - sessionNumber + sessionNumber, + paymentSessionId, + loyaltyCardId ); } @@ -80,7 +91,10 @@ public static Bundle toBundle(@Nullable Receipt.Header header) { if(header.getSessionNumber() != null) bundle.putLong(KEY_SESSION_NUMBER, header.getSessionNumber()); - + if (header.getPaymentSessionId() != null) + bundle.putString(KEY_PAYMENT_SESSION_ID, header.getPaymentSessionId()); + if (header.getLoyaltyCardId() != null) + bundle.putString(KEY_LOYALTY_CARD_ID, header.getLoyaltyCardId()); return bundle; } diff --git a/src/main/java/ru/evotor/framework/core/action/event/receipt/discount_required/ReceiptDiscountRequiredEventResult.kt b/src/main/java/ru/evotor/framework/core/action/event/receipt/discount_required/ReceiptDiscountRequiredEventResult.kt index 25a6ce4f0d..bb407d233b 100644 --- a/src/main/java/ru/evotor/framework/core/action/event/receipt/discount_required/ReceiptDiscountRequiredEventResult.kt +++ b/src/main/java/ru/evotor/framework/core/action/event/receipt/discount_required/ReceiptDiscountRequiredEventResult.kt @@ -5,16 +5,19 @@ import android.os.Bundle import ru.evotor.IBundlable class ReceiptDiscountRequiredEventResult( - val componentName: ComponentName + val componentName: ComponentName, + val loyaltyCardId: String? ) : IBundlable { override fun toBundle(): Bundle { return Bundle().also { it.putParcelable(KEY_COMPONENT_NAME, componentName) + it.putString(KEY_LOYALTY_CARD_ID, loyaltyCardId) } } companion object { private const val KEY_COMPONENT_NAME = "KEY_COMPONENT_NAME" + private const val KEY_LOYALTY_CARD_ID = "KEY_LOYALTY_CARD_ID" fun create(bundle: Bundle?): ReceiptDiscountRequiredEventResult? { bundle ?: return null @@ -22,7 +25,9 @@ class ReceiptDiscountRequiredEventResult( val componentName = bundle.getParcelable(KEY_COMPONENT_NAME) ?: throw IllegalStateException("Bundle doesn't contain the necessary data to create ReceiptDiscountRequiredEventResult") - return ReceiptDiscountRequiredEventResult(componentName) + val loyaltyCardId = bundle.getString(KEY_LOYALTY_CARD_ID) + + return ReceiptDiscountRequiredEventResult(componentName, loyaltyCardId) } } diff --git a/src/main/java/ru/evotor/framework/receipt/Receipt.kt b/src/main/java/ru/evotor/framework/receipt/Receipt.kt index e2757afcd3..fedc3bd5ad 100644 --- a/src/main/java/ru/evotor/framework/receipt/Receipt.kt +++ b/src/main/java/ru/evotor/framework/receipt/Receipt.kt @@ -90,7 +90,18 @@ data class Receipt /** * Номер аппаратной смены. Может быть null для еще незакрытого чека */ - val sessionNumber: Long? + val sessionNumber: Long?, + + /** + * Номер платежной сессии. Может быть null, если платежная система не поддерживает номера сессий + */ + val paymentSessionId: String?, + + /** + * Номер карты лояльности. Может быть null, если система лояльности не была использована + * или система лояльности не поддерживает номера карт + */ + val loyaltyCardId: String? ) /** From 5e9145b1d9811db512a6dbaca3517c137570799d Mon Sep 17 00:00:00 2001 From: Dmitriy Kolpakov Date: Tue, 25 Mar 2025 16:13:33 +0300 Subject: [PATCH 04/14] =?UTF-8?q?STDEV-20296=20=D0=A0=D0=B0=D1=81=D1=88?= =?UTF-8?q?=D0=B8=D1=80=D0=B5=D0=BD=20ReceiptApi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/ru/evotor/framework/receipt/ReceiptApi.kt | 4 +++- .../java/ru/evotor/framework/receipt/ReceiptHeaderTable.kt | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/ru/evotor/framework/receipt/ReceiptApi.kt b/src/main/java/ru/evotor/framework/receipt/ReceiptApi.kt index 43f3bfb8cd..553731b949 100644 --- a/src/main/java/ru/evotor/framework/receipt/ReceiptApi.kt +++ b/src/main/java/ru/evotor/framework/receipt/ReceiptApi.kt @@ -593,7 +593,9 @@ object ReceiptApi { clientEmail = cursor.optString(ReceiptHeaderTable.COLUMN_CLIENT_EMAIL), clientPhone = cursor.optString(ReceiptHeaderTable.COLUMN_CLIENT_PHONE), extra = extra, - sessionNumber = cursor.optLong(ReceiptHeaderTable.COLUMN_SESSION_NUMBER) + sessionNumber = cursor.optLong(ReceiptHeaderTable.COLUMN_SESSION_NUMBER), + paymentSessionId = cursor.optString(ReceiptHeaderTable.COLUMN_PAYMENT_SESSION_ID), + loyaltyCardId = cursor.optString(ReceiptHeaderTable.COLUMN_LOYALTY_CARD_ID) ) } diff --git a/src/main/java/ru/evotor/framework/receipt/ReceiptHeaderTable.kt b/src/main/java/ru/evotor/framework/receipt/ReceiptHeaderTable.kt index c6492ec9ee..1763a5f2f8 100644 --- a/src/main/java/ru/evotor/framework/receipt/ReceiptHeaderTable.kt +++ b/src/main/java/ru/evotor/framework/receipt/ReceiptHeaderTable.kt @@ -10,4 +10,6 @@ object ReceiptHeaderTable { const val COLUMN_CLIENT_PHONE = "CLIENT_PHONE" const val COLUMN_EXTRA = "EXTRA" const val COLUMN_SESSION_NUMBER = "SESSION_NUMBER" + const val COLUMN_PAYMENT_SESSION_ID = "PAYMENT_SESSION_ID" + const val COLUMN_LOYALTY_CARD_ID = "LOYALTY_CARD_ID" } From e01ffcacafbc26f0b73fb89c883d0490961753e9 Mon Sep 17 00:00:00 2001 From: Dmitriy Kolpakov Date: Sat, 29 Mar 2025 14:47:56 +0300 Subject: [PATCH 05/14] =?UTF-8?q?STDEV-20296=20=D0=94=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B0=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4?= =?UTF-8?q?=D0=B0=D1=87=D0=B0=20paymentSessionId=20=D0=B2=20ReceiptDiscoun?= =?UTF-8?q?tRequiredEvent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ReceiptDiscountRequiredEvent.kt | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/java/ru/evotor/framework/core/action/event/receipt/discount_required/ReceiptDiscountRequiredEvent.kt b/src/main/java/ru/evotor/framework/core/action/event/receipt/discount_required/ReceiptDiscountRequiredEvent.kt index aefcf060e0..65028778c8 100644 --- a/src/main/java/ru/evotor/framework/core/action/event/receipt/discount_required/ReceiptDiscountRequiredEvent.kt +++ b/src/main/java/ru/evotor/framework/core/action/event/receipt/discount_required/ReceiptDiscountRequiredEvent.kt @@ -2,6 +2,9 @@ package ru.evotor.framework.core.action.event.receipt.discount_required import android.os.Bundle import ru.evotor.IBundlable +import ru.evotor.framework.core.action.event.receipt.discount_required.ReceiptDiscountRequiredEvent.Companion.NAME_BUY_RECEIPT +import ru.evotor.framework.core.action.event.receipt.discount_required.ReceiptDiscountRequiredEvent.Companion.NAME_PAYBACK_RECEIPT +import ru.evotor.framework.core.action.event.receipt.discount_required.ReceiptDiscountRequiredEvent.Companion.NAME_SELL_RECEIPT /** * Событие, которое возникает при переходе на экран выбора типа оплаты. @@ -9,10 +12,14 @@ import ru.evotor.IBundlable * Чтобы приложение получало событие, значение константы [NAME_SELL_RECEIPT], [NAME_PAYBACK_RECEIPT] или [NAME_BUY_RECEIPT] * необходимо указать в элементе intent-фильтра соотвествующей службы */ -class ReceiptDiscountRequiredEvent: IBundlable { +class ReceiptDiscountRequiredEvent( + val paymentSessionId: String? +) : IBundlable { override fun toBundle(): Bundle { - return Bundle() + val result = Bundle() + result.putString(KEY_PAYMENT_SESSION_ID, paymentSessionId) + return result } companion object { @@ -38,10 +45,14 @@ class ReceiptDiscountRequiredEvent: IBundlable { */ const val NAME_BUY_RECEIPT = "evo.v2.receipt.buy.receiptDiscountRequiredEvent" + private const val KEY_PAYMENT_SESSION_ID = "payment_session_id" + fun create(bundle: Bundle?): ReceiptDiscountRequiredEvent? { bundle ?: return null - return ReceiptDiscountRequiredEvent() + return ReceiptDiscountRequiredEvent( + bundle.getString(KEY_PAYMENT_SESSION_ID, null) + ) } } } From 45150299600089fd77db44cdfce9420d60ba8a8e Mon Sep 17 00:00:00 2001 From: Dmitriy Kolpakov Date: Mon, 31 Mar 2025 13:32:09 +0300 Subject: [PATCH 06/14] =?UTF-8?q?STDEV-20296=20=D0=A0=D0=B0=D1=81=D1=88?= =?UTF-8?q?=D0=B8=D1=80=D0=B5=D0=BD=20ReceiptEvent=20=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?=D1=8B=D0=BC=20=D0=BF=D0=BE=D0=BB=D0=B5=D0=BC.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../receipt/event/ApplyDiscountToReceiptEvent.kt | 5 +++-- .../ru/evotor/framework/receipt/event/ReceiptEvent.kt | 9 ++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/ru/evotor/framework/receipt/event/ApplyDiscountToReceiptEvent.kt b/src/main/java/ru/evotor/framework/receipt/event/ApplyDiscountToReceiptEvent.kt index dbfb8b9e75..2ea9206195 100644 --- a/src/main/java/ru/evotor/framework/receipt/event/ApplyDiscountToReceiptEvent.kt +++ b/src/main/java/ru/evotor/framework/receipt/event/ApplyDiscountToReceiptEvent.kt @@ -18,11 +18,12 @@ import android.os.Bundle * [ru.evotor.framework.receipt.event.handler.receiver.CorrectionReturnOutcomeReceiptBroadcastReceiver] * * @param receiptUuid uuid чека + * @param loyaltyCardId id примененной карты лояльности */ -class ApplyDiscountToReceiptEvent(receiptUuid: String) : ReceiptEvent(receiptUuid) { +class ApplyDiscountToReceiptEvent(receiptUuid: String, loyaltyCardId: String?) : ReceiptEvent(receiptUuid,loyaltyCardId) { companion object { fun from(bundle: Bundle?): ApplyDiscountToReceiptEvent? = bundle?.let { - ApplyDiscountToReceiptEvent(ReceiptEvent.getReceiptUuid(it) ?: return null) + ApplyDiscountToReceiptEvent(getReceiptUuid(it) ?: return null,getLoyaltyCardId(it)) } } } diff --git a/src/main/java/ru/evotor/framework/receipt/event/ReceiptEvent.kt b/src/main/java/ru/evotor/framework/receipt/event/ReceiptEvent.kt index 13db06783e..05cc3ea260 100644 --- a/src/main/java/ru/evotor/framework/receipt/event/ReceiptEvent.kt +++ b/src/main/java/ru/evotor/framework/receipt/event/ReceiptEvent.kt @@ -4,20 +4,27 @@ import android.os.Bundle import ru.evotor.IBundlable -abstract class ReceiptEvent internal constructor(val receiptUuid: String) : IBundlable { +abstract class ReceiptEvent internal constructor( + val receiptUuid: String, + val loyaltyCardId: String? = null +) : IBundlable { override fun toBundle(): Bundle { val result = Bundle() result.putString(KEY_RECEIPT_UUID, receiptUuid) + result.putString(KEY_LOYALTY_CARD_ID, loyaltyCardId) return result } companion object { private const val KEY_RECEIPT_UUID = "receiptUuid" + private const val KEY_LOYALTY_CARD_ID = "loyaltyCardId" internal fun getReceiptUuid(bundle: Bundle): String? = bundle.getString(KEY_RECEIPT_UUID, null) + internal fun getLoyaltyCardId(bundle: Bundle): String? = + bundle.getString(KEY_LOYALTY_CARD_ID, null) } From c2c358478e652333610c5e7fcd563ba2231d5c9b Mon Sep 17 00:00:00 2001 From: Dmitriy Kolpakov Date: Mon, 7 Apr 2025 16:30:14 +0300 Subject: [PATCH 07/14] =?UTF-8?q?STDEV-20296=20Uuid=20=D0=BF=D1=80=D0=B8?= =?UTF-8?q?=D0=BB=D0=BE=D0=B6=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BB=D0=BE=D1=8F?= =?UTF-8?q?=D0=BB=D1=8C=D0=BD=D0=BE=D1=81=D1=82=D0=B8=20=D0=B2=20=D1=85?= =?UTF-8?q?=D0=B5=D0=B4=D0=B5=D1=80=20=D1=87=D0=B5=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/action/datamapper/ReceiptHeaderMapper.java | 10 +++++++++- src/main/java/ru/evotor/framework/receipt/Receipt.kt | 7 ++++++- .../java/ru/evotor/framework/receipt/ReceiptApi.kt | 3 ++- .../ru/evotor/framework/receipt/ReceiptHeaderTable.kt | 1 + 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/main/java/ru/evotor/framework/core/action/datamapper/ReceiptHeaderMapper.java b/src/main/java/ru/evotor/framework/core/action/datamapper/ReceiptHeaderMapper.java index 35242fe161..be67bf2df0 100644 --- a/src/main/java/ru/evotor/framework/core/action/datamapper/ReceiptHeaderMapper.java +++ b/src/main/java/ru/evotor/framework/core/action/datamapper/ReceiptHeaderMapper.java @@ -22,6 +22,7 @@ public final class ReceiptHeaderMapper { private static final String KEY_SESSION_NUMBER = "sessionNumber"; private static final String KEY_PAYMENT_SESSION_ID = "paymentSessionId"; private static final String KEY_LOYALTY_CARD_ID = "loyaltyCardId"; + private static final String KEY_LOYALTY_APP_UUID = "loyaltyAppUuid"; @Nullable public static Receipt.Header from(@Nullable Bundle bundle) { @@ -53,6 +54,10 @@ public static Receipt.Header from(@Nullable Bundle bundle) { if (bundle.containsKey(KEY_LOYALTY_CARD_ID)){ loyaltyCardId = bundle.getString(KEY_LOYALTY_CARD_ID); } + String loyaltyAppUuid = null; + if (bundle.containsKey(KEY_LOYALTY_APP_UUID)){ + loyaltyAppUuid = bundle.getString(KEY_LOYALTY_APP_UUID); + } return new Receipt.Header( receiptUuid, baseReceiptUuid, @@ -64,7 +69,8 @@ public static Receipt.Header from(@Nullable Bundle bundle) { bundle.getString(KEY_EXTRA), sessionNumber, paymentSessionId, - loyaltyCardId + loyaltyCardId, + loyaltyAppUuid ); } @@ -95,6 +101,8 @@ public static Bundle toBundle(@Nullable Receipt.Header header) { bundle.putString(KEY_PAYMENT_SESSION_ID, header.getPaymentSessionId()); if (header.getLoyaltyCardId() != null) bundle.putString(KEY_LOYALTY_CARD_ID, header.getLoyaltyCardId()); + if (header.getLoyaltyAppUuid() != null) + bundle.putString(KEY_LOYALTY_APP_UUID, header.getLoyaltyAppUuid()); return bundle; } diff --git a/src/main/java/ru/evotor/framework/receipt/Receipt.kt b/src/main/java/ru/evotor/framework/receipt/Receipt.kt index fedc3bd5ad..29f2920205 100644 --- a/src/main/java/ru/evotor/framework/receipt/Receipt.kt +++ b/src/main/java/ru/evotor/framework/receipt/Receipt.kt @@ -101,7 +101,12 @@ data class Receipt * Номер карты лояльности. Может быть null, если система лояльности не была использована * или система лояльности не поддерживает номера карт */ - val loyaltyCardId: String? + val loyaltyCardId: String?, + + /** + * Id приложения лояльности + */ + val loyaltyAppUuid: String? ) /** diff --git a/src/main/java/ru/evotor/framework/receipt/ReceiptApi.kt b/src/main/java/ru/evotor/framework/receipt/ReceiptApi.kt index 553731b949..eeb905e6b7 100644 --- a/src/main/java/ru/evotor/framework/receipt/ReceiptApi.kt +++ b/src/main/java/ru/evotor/framework/receipt/ReceiptApi.kt @@ -595,7 +595,8 @@ object ReceiptApi { extra = extra, sessionNumber = cursor.optLong(ReceiptHeaderTable.COLUMN_SESSION_NUMBER), paymentSessionId = cursor.optString(ReceiptHeaderTable.COLUMN_PAYMENT_SESSION_ID), - loyaltyCardId = cursor.optString(ReceiptHeaderTable.COLUMN_LOYALTY_CARD_ID) + loyaltyCardId = cursor.optString(ReceiptHeaderTable.COLUMN_LOYALTY_CARD_ID), + loyaltyAppUuid = cursor.optString(ReceiptHeaderTable.COLUMN_LOYALTY_APP_UUID) ) } diff --git a/src/main/java/ru/evotor/framework/receipt/ReceiptHeaderTable.kt b/src/main/java/ru/evotor/framework/receipt/ReceiptHeaderTable.kt index 1763a5f2f8..4a4406197c 100644 --- a/src/main/java/ru/evotor/framework/receipt/ReceiptHeaderTable.kt +++ b/src/main/java/ru/evotor/framework/receipt/ReceiptHeaderTable.kt @@ -12,4 +12,5 @@ object ReceiptHeaderTable { const val COLUMN_SESSION_NUMBER = "SESSION_NUMBER" const val COLUMN_PAYMENT_SESSION_ID = "PAYMENT_SESSION_ID" const val COLUMN_LOYALTY_CARD_ID = "LOYALTY_CARD_ID" + const val COLUMN_LOYALTY_APP_UUID = "LOYALTY_APP_UUID" } From 978eabdb07ec9ce962b1c58fcd7bb1512979225a Mon Sep 17 00:00:00 2001 From: Dmitry Kolpakov Date: Sun, 30 Nov 2025 13:33:02 +0300 Subject: [PATCH 08/14] =?UTF-8?q?STDEV-20296=20=D0=94=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D1=8B=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B?= =?UTF-8?q?=D0=B5=20=D0=BE=20=D0=BF=D1=80=D0=B8=D0=BB=D0=BE=D0=B6=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B8=20=D0=BB=D0=BE=D1=8F=D0=BB=D1=8C=D0=BD=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D0=B8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datamapper/ReceiptHeaderMapper.java | 24 ++--- .../ReceiptDiscountRequiredEvent.kt | 10 ++- .../framework/receipt/AppliedLoyaltyData.kt | 89 +++++++++++++++++++ .../ru/evotor/framework/receipt/Receipt.kt | 13 +-- .../ru/evotor/framework/receipt/ReceiptApi.kt | 14 ++- .../framework/receipt/ReceiptHeaderTable.kt | 5 +- 6 files changed, 126 insertions(+), 29 deletions(-) create mode 100644 src/main/java/ru/evotor/framework/receipt/AppliedLoyaltyData.kt diff --git a/src/main/java/ru/evotor/framework/core/action/datamapper/ReceiptHeaderMapper.java b/src/main/java/ru/evotor/framework/core/action/datamapper/ReceiptHeaderMapper.java index be67bf2df0..b7b162bed1 100644 --- a/src/main/java/ru/evotor/framework/core/action/datamapper/ReceiptHeaderMapper.java +++ b/src/main/java/ru/evotor/framework/core/action/datamapper/ReceiptHeaderMapper.java @@ -6,6 +6,7 @@ import androidx.annotation.Nullable; import ru.evotor.framework.Utils; +import ru.evotor.framework.receipt.AppliedLoyaltyData; import ru.evotor.framework.receipt.Receipt; @@ -21,8 +22,8 @@ public final class ReceiptHeaderMapper { private static final String KEY_EXTRA = "extra"; private static final String KEY_SESSION_NUMBER = "sessionNumber"; private static final String KEY_PAYMENT_SESSION_ID = "paymentSessionId"; - private static final String KEY_LOYALTY_CARD_ID = "loyaltyCardId"; - private static final String KEY_LOYALTY_APP_UUID = "loyaltyAppUuid"; + private static final String KEY_LOYALTY_APP_DATA = "loyaltyAppData"; + @Nullable public static Receipt.Header from(@Nullable Bundle bundle) { @@ -50,13 +51,9 @@ public static Receipt.Header from(@Nullable Bundle bundle) { if (bundle.containsKey(KEY_PAYMENT_SESSION_ID)){ paymentSessionId = bundle.getString(KEY_PAYMENT_SESSION_ID); } - String loyaltyCardId = null; - if (bundle.containsKey(KEY_LOYALTY_CARD_ID)){ - loyaltyCardId = bundle.getString(KEY_LOYALTY_CARD_ID); - } - String loyaltyAppUuid = null; - if (bundle.containsKey(KEY_LOYALTY_APP_UUID)){ - loyaltyAppUuid = bundle.getString(KEY_LOYALTY_APP_UUID); + AppliedLoyaltyData loyaltyAppData = null; + if (bundle.containsKey(KEY_LOYALTY_APP_DATA)){ + loyaltyAppData = AppliedLoyaltyData.from(bundle.getBundle(KEY_LOYALTY_APP_DATA)); } return new Receipt.Header( receiptUuid, @@ -69,8 +66,7 @@ public static Receipt.Header from(@Nullable Bundle bundle) { bundle.getString(KEY_EXTRA), sessionNumber, paymentSessionId, - loyaltyCardId, - loyaltyAppUuid + loyaltyAppData ); } @@ -99,10 +95,8 @@ public static Bundle toBundle(@Nullable Receipt.Header header) { bundle.putLong(KEY_SESSION_NUMBER, header.getSessionNumber()); if (header.getPaymentSessionId() != null) bundle.putString(KEY_PAYMENT_SESSION_ID, header.getPaymentSessionId()); - if (header.getLoyaltyCardId() != null) - bundle.putString(KEY_LOYALTY_CARD_ID, header.getLoyaltyCardId()); - if (header.getLoyaltyAppUuid() != null) - bundle.putString(KEY_LOYALTY_APP_UUID, header.getLoyaltyAppUuid()); + if (header.getLoyaltyAppData() != null) + bundle.putBundle(KEY_LOYALTY_APP_DATA, header.getLoyaltyAppData().toBundle()); return bundle; } diff --git a/src/main/java/ru/evotor/framework/core/action/event/receipt/discount_required/ReceiptDiscountRequiredEvent.kt b/src/main/java/ru/evotor/framework/core/action/event/receipt/discount_required/ReceiptDiscountRequiredEvent.kt index 65028778c8..c9b74ea5f6 100644 --- a/src/main/java/ru/evotor/framework/core/action/event/receipt/discount_required/ReceiptDiscountRequiredEvent.kt +++ b/src/main/java/ru/evotor/framework/core/action/event/receipt/discount_required/ReceiptDiscountRequiredEvent.kt @@ -13,12 +13,14 @@ import ru.evotor.framework.core.action.event.receipt.discount_required.ReceiptDi * необходимо указать в элементе intent-фильтра соотвествующей службы */ class ReceiptDiscountRequiredEvent( - val paymentSessionId: String? + val paymentSessionId: String?, + val externalLoyaltyCardId: String? ) : IBundlable { override fun toBundle(): Bundle { val result = Bundle() result.putString(KEY_PAYMENT_SESSION_ID, paymentSessionId) + result.putString(KEY_EXTERNAL_LOYALTY_CARD_ID, externalLoyaltyCardId) return result } @@ -47,11 +49,15 @@ class ReceiptDiscountRequiredEvent( private const val KEY_PAYMENT_SESSION_ID = "payment_session_id" + private const val KEY_EXTERNAL_LOYALTY_CARD_ID = "external_loyalty_card_id" + + fun create(bundle: Bundle?): ReceiptDiscountRequiredEvent? { bundle ?: return null return ReceiptDiscountRequiredEvent( - bundle.getString(KEY_PAYMENT_SESSION_ID, null) + bundle.getString(KEY_PAYMENT_SESSION_ID, null), + bundle.getString(KEY_EXTERNAL_LOYALTY_CARD_ID, null) ) } } diff --git a/src/main/java/ru/evotor/framework/receipt/AppliedLoyaltyData.kt b/src/main/java/ru/evotor/framework/receipt/AppliedLoyaltyData.kt new file mode 100644 index 0000000000..447ec529c4 --- /dev/null +++ b/src/main/java/ru/evotor/framework/receipt/AppliedLoyaltyData.kt @@ -0,0 +1,89 @@ +package ru.evotor.framework.receipt + +import android.content.ComponentName +import android.os.Bundle +import android.os.Parcel +import android.os.Parcelable +import ru.evotor.IBundlable +import ru.evotor.framework.ParcelableUtils + +data class AppliedLoyaltyData( + val loyaltyAppId: String, + val loyaltyServiceInfo: ComponentName, + val loyaltyCardId: String?, + val externalLoyaltyCardId: String? +) : Parcelable, IBundlable { + override fun describeContents(): Int = 0 + + override fun writeToParcel(dest: Parcel, flag: Int) { + ParcelableUtils.writeExpand(dest, VERSION) { parcel -> + parcel.writeString(loyaltyAppId) + parcel.writeString(loyaltyServiceInfo.packageName) + parcel.writeString(loyaltyServiceInfo.className) + parcel.writeString(loyaltyCardId) + parcel.writeString(externalLoyaltyCardId) + } + } + + override fun toBundle(): Bundle { + return Bundle().apply { + putString(KEY_LOYALTY_APP_ID, loyaltyAppId) + putString(KEY_LOYALTY_SERVICE_PACKAGE, loyaltyServiceInfo.packageName) + putString(KEY_LOYALTY_SERVICE_CLASS, loyaltyServiceInfo.className) + putString(KEY_LOYALTY_CARD_ID, loyaltyCardId) + putString(KEY_EXTERNAL_LOYALTY_CARD_ID, externalLoyaltyCardId) + } + } + + companion object { + private const val VERSION = 1 + + private const val KEY_LOYALTY_APP_ID = "loyaltyAppId" + private const val KEY_LOYALTY_SERVICE_PACKAGE = "loyaltyServicePackage" + private const val KEY_LOYALTY_SERVICE_CLASS = "loyaltyServiceClass" + private const val KEY_LOYALTY_CARD_ID = "loyaltyCardId" + private const val KEY_EXTERNAL_LOYALTY_CARD_ID = "externalLoyaltyCardId" + + @JvmField + val CREATOR = object : Parcelable.Creator { + override fun createFromParcel(parcel: Parcel): AppliedLoyaltyData? = create(parcel) + + override fun newArray(size: Int): Array = arrayOfNulls(size) + } + + private fun create(dest: Parcel): AppliedLoyaltyData? { + var appliedLoyaltyData: AppliedLoyaltyData? = null + ParcelableUtils.readExpand(dest, VERSION) { parcel, version -> + if (version >= 1) { + val loyaltyAppId = parcel.readString() + val packageName = parcel.readString() + val className = parcel.readString() + val loyaltyCardId = parcel.readString() + val externalLoyaltyCardId = parcel.readString() + if (loyaltyAppId != null && packageName != null && className != null) { + appliedLoyaltyData = AppliedLoyaltyData( + loyaltyAppId = loyaltyAppId, + loyaltyServiceInfo = ComponentName(packageName, className), + loyaltyCardId = loyaltyCardId, + externalLoyaltyCardId = externalLoyaltyCardId + ) + } + } + } + return appliedLoyaltyData + } + + @JvmStatic + fun from(bundle: Bundle?): AppliedLoyaltyData? = bundle?.let { + val loyaltyAppId = it.getString(KEY_LOYALTY_APP_ID) ?: return null + val packageName = it.getString(KEY_LOYALTY_SERVICE_PACKAGE) ?: return null + val name = it.getString(KEY_LOYALTY_SERVICE_CLASS) ?: return null + return AppliedLoyaltyData( + loyaltyAppId = loyaltyAppId, + loyaltyServiceInfo = ComponentName(packageName, name), + loyaltyCardId = it.getString(KEY_LOYALTY_CARD_ID), + externalLoyaltyCardId = it.getString(KEY_EXTERNAL_LOYALTY_CARD_ID), + ) + } + } +} diff --git a/src/main/java/ru/evotor/framework/receipt/Receipt.kt b/src/main/java/ru/evotor/framework/receipt/Receipt.kt index 29f2920205..58c451e249 100644 --- a/src/main/java/ru/evotor/framework/receipt/Receipt.kt +++ b/src/main/java/ru/evotor/framework/receipt/Receipt.kt @@ -95,18 +95,11 @@ data class Receipt /** * Номер платежной сессии. Может быть null, если платежная система не поддерживает номера сессий */ - val paymentSessionId: String?, - - /** - * Номер карты лояльности. Может быть null, если система лояльности не была использована - * или система лояльности не поддерживает номера карт - */ - val loyaltyCardId: String?, - + var paymentSessionId: String?, /** - * Id приложения лояльности + * Информация использованного приложения лояльности */ - val loyaltyAppUuid: String? + var loyaltyAppData: AppliedLoyaltyData? ) /** diff --git a/src/main/java/ru/evotor/framework/receipt/ReceiptApi.kt b/src/main/java/ru/evotor/framework/receipt/ReceiptApi.kt index 0d78438213..a1675e7df9 100644 --- a/src/main/java/ru/evotor/framework/receipt/ReceiptApi.kt +++ b/src/main/java/ru/evotor/framework/receipt/ReceiptApi.kt @@ -1,5 +1,6 @@ package ru.evotor.framework.receipt +import android.content.ComponentName import android.content.Context import android.database.Cursor import android.net.Uri @@ -609,8 +610,19 @@ object ReceiptApi { extra = extra, sessionNumber = cursor.optLong(ReceiptHeaderTable.COLUMN_SESSION_NUMBER), paymentSessionId = cursor.optString(ReceiptHeaderTable.COLUMN_PAYMENT_SESSION_ID), + loyaltyAppData = createAppliedLoyaltyData(cursor) + ) + } + + private fun createAppliedLoyaltyData(cursor: Cursor): AppliedLoyaltyData? { + return AppliedLoyaltyData( + loyaltyAppId = cursor.optString(ReceiptHeaderTable.COLUMN_LOYALTY_APP_ID) ?: return null, + loyaltyServiceInfo = ComponentName( + cursor.optString(ReceiptHeaderTable.COLUMN_LOYALTY_SERVICE_PACKAGE) ?: return null, + cursor.optString(ReceiptHeaderTable.COLUMN_LOYALTY_SERVICE_CLASS) ?: return null + ), loyaltyCardId = cursor.optString(ReceiptHeaderTable.COLUMN_LOYALTY_CARD_ID), - loyaltyAppUuid = cursor.optString(ReceiptHeaderTable.COLUMN_LOYALTY_APP_UUID) + externalLoyaltyCardId = cursor.optString(ReceiptHeaderTable.COLUMN_EXTERNAL_LOYALTY_CARD_ID) ) } diff --git a/src/main/java/ru/evotor/framework/receipt/ReceiptHeaderTable.kt b/src/main/java/ru/evotor/framework/receipt/ReceiptHeaderTable.kt index 4a4406197c..6fef99aa02 100644 --- a/src/main/java/ru/evotor/framework/receipt/ReceiptHeaderTable.kt +++ b/src/main/java/ru/evotor/framework/receipt/ReceiptHeaderTable.kt @@ -11,6 +11,9 @@ object ReceiptHeaderTable { const val COLUMN_EXTRA = "EXTRA" const val COLUMN_SESSION_NUMBER = "SESSION_NUMBER" const val COLUMN_PAYMENT_SESSION_ID = "PAYMENT_SESSION_ID" + const val COLUMN_LOYALTY_APP_ID = "LOYALTY_APP_ID" + const val COLUMN_LOYALTY_SERVICE_PACKAGE = "LOYALTY_SERVICE_PACKAGE" + const val COLUMN_LOYALTY_SERVICE_CLASS = "LOYALTY_SERVICE_CLASS" const val COLUMN_LOYALTY_CARD_ID = "LOYALTY_CARD_ID" - const val COLUMN_LOYALTY_APP_UUID = "LOYALTY_APP_UUID" + const val COLUMN_EXTERNAL_LOYALTY_CARD_ID = "EXTERNAL_LOYALTY_CARD_ID" } From facc8478c9f66144f48bc1f2edc1e7b1edb0bcbf Mon Sep 17 00:00:00 2001 From: Dmitry Kolpakov Date: Mon, 1 Dec 2025 12:03:42 +0300 Subject: [PATCH 09/14] STDEV-20296 Change version + fix rder --- build.gradle | 4 +-- .../discount/ReceiptDiscountEventResult.java | 33 ++++++++++--------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/build.gradle b/build.gradle index 4f00f8eeb4..52fb2bd3a0 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ apply plugin: 'maven-publish' apply plugin: 'org.jetbrains.dokka' android { - def version = 37 + def version = 38 compileSdk 29 @@ -112,7 +112,7 @@ publishing { mavenKotlin(MavenPublication) { groupId 'com.github.evotor' artifactId "integration-library" - version "STDEV-13213" + version "STDEV-20296" artifact(sourceJar) artifact(javadocJar) artifact "${project.buildDir}/outputs/aar/${project.archivesBaseName}-release.aar" diff --git a/src/main/java/ru/evotor/framework/core/action/event/receipt/discount/ReceiptDiscountEventResult.java b/src/main/java/ru/evotor/framework/core/action/event/receipt/discount/ReceiptDiscountEventResult.java index 63815d1ad0..a66e1c26eb 100644 --- a/src/main/java/ru/evotor/framework/core/action/event/receipt/discount/ReceiptDiscountEventResult.java +++ b/src/main/java/ru/evotor/framework/core/action/event/receipt/discount/ReceiptDiscountEventResult.java @@ -20,6 +20,7 @@ import ru.evotor.framework.core.action.event.receipt.changes.position.IPositionChange; import ru.evotor.framework.core.action.event.receipt.changes.receipt.SetExtra; import ru.evotor.framework.core.action.event.receipt.changes.receipt.SetPurchaserContactData; +import ru.evotor.framework.receipt.AppliedLoyaltyData; public class ReceiptDiscountEventResult implements IBundlable { @@ -29,7 +30,8 @@ public class ReceiptDiscountEventResult implements IBundlable { private static final String KEY_RECEIPT_SET_PURCHASER_CONTACT_DATA = "setPurchaserContactData"; private static final String KEY_POSITION_UUID_TO_DISCOUNT_MAP = "positionUuidToDiscountMap"; - private static final String KEY_LOYALTY_CARD_ID = "loyaltyCardId"; + + private static final String KEY_RECEIPT_LOYALTY_APP_DATA = "appliedLoyaltyData"; @Nullable public static ReceiptDiscountEventResult create(@Nullable Bundle bundle) { @@ -44,10 +46,6 @@ public static ReceiptDiscountEventResult create(@Nullable Bundle bundle) { if(bundle.containsKey(KEY_POSITION_UUID_TO_DISCOUNT_MAP)) { positionUuidToDiscountMap = (Map) bundle.getSerializable(KEY_POSITION_UUID_TO_DISCOUNT_MAP); } - String loyaltyCardId = null; - if (bundle.containsKey(KEY_LOYALTY_CARD_ID)){ - loyaltyCardId = bundle.getString(KEY_LOYALTY_CARD_ID, null); - } return new ReceiptDiscountEventResult( discount, SetExtra.from(bundle.getBundle(KEY_RECEIPT_EXTRA)), @@ -57,7 +55,7 @@ public static ReceiptDiscountEventResult create(@Nullable Bundle bundle) { ), SetPurchaserContactData.from(bundle.getBundle(KEY_RECEIPT_SET_PURCHASER_CONTACT_DATA)), positionUuidToDiscountMap, - loyaltyCardId + AppliedLoyaltyData.from(bundle.getBundle(KEY_RECEIPT_LOYALTY_APP_DATA)) ); } @@ -72,8 +70,9 @@ public static ReceiptDiscountEventResult create(@Nullable Bundle bundle) { @Nullable private final Map positionUuidToDiscountMap; + @Nullable - private final String loyaltyCardId; + private final AppliedLoyaltyData appliedLoyaltyData; public ReceiptDiscountEventResult( @NonNull BigDecimal discount, @@ -88,7 +87,7 @@ public ReceiptDiscountEventResult( this.changes = changes; this.setPurchaserContactData = setPurchaserContactData; this.positionUuidToDiscountMap = null; - this.loyaltyCardId = null; + this.appliedLoyaltyData = null; } public ReceiptDiscountEventResult( @@ -105,7 +104,7 @@ public ReceiptDiscountEventResult( this.changes = changes; this.setPurchaserContactData = setPurchaserContactData; this.positionUuidToDiscountMap = positionUuidToDiscountMap; - this.loyaltyCardId = null; + this.appliedLoyaltyData = null; } public ReceiptDiscountEventResult( @@ -114,7 +113,7 @@ public ReceiptDiscountEventResult( @NonNull List changes, @Nullable SetPurchaserContactData setPurchaserContactData, @Nullable Map positionUuidToDiscountMap, - @Nullable String loyaltyCardInfo + @Nullable AppliedLoyaltyData appliedLoyaltyData ) { Objects.requireNonNull(discount); @@ -123,7 +122,7 @@ public ReceiptDiscountEventResult( this.changes = changes; this.setPurchaserContactData = setPurchaserContactData; this.positionUuidToDiscountMap = positionUuidToDiscountMap; - this.loyaltyCardId = loyaltyCardInfo; + this.appliedLoyaltyData = appliedLoyaltyData; } @NonNull @@ -144,9 +143,10 @@ public Bundle toBundle() { if (positionUuidToDiscountMap != null) { bundle.putSerializable(KEY_POSITION_UUID_TO_DISCOUNT_MAP, (Serializable) positionUuidToDiscountMap); } - if (loyaltyCardId != null) { - bundle.putString(KEY_LOYALTY_CARD_ID, loyaltyCardId); - } + bundle.putBundle( + KEY_RECEIPT_LOYALTY_APP_DATA, + appliedLoyaltyData == null ? null : appliedLoyaltyData.toBundle() + ); return bundle; } @@ -174,8 +174,9 @@ public SetPurchaserContactData getSetPurchaserContactData() { public Map getPositionUuidToDiscountMap() { return positionUuidToDiscountMap; } + @Nullable - public String getLoyaltyCardId(){ - return loyaltyCardId; + public AppliedLoyaltyData getAppliedLoyaltyData(){ + return appliedLoyaltyData; } } \ No newline at end of file From a7dbb12e4d43c6865dc8565d5a68bc5343bfe14f Mon Sep 17 00:00:00 2001 From: Dmitry Kolpakov Date: Wed, 17 Dec 2025 08:46:18 +0300 Subject: [PATCH 10/14] =?UTF-8?q?STDEV-20296=20loyaltyCardId=20=D0=B2=20tr?= =?UTF-8?q?iggerReceiptDiscountEvent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ru/evotor/framework/receipt/formation/api/SellApi.kt | 5 +++-- .../event/TriggerReceiptDiscountEventRequestedEvent.kt | 9 ++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/ru/evotor/framework/receipt/formation/api/SellApi.kt b/src/main/java/ru/evotor/framework/receipt/formation/api/SellApi.kt index b830317c19..e40b5be86b 100644 --- a/src/main/java/ru/evotor/framework/receipt/formation/api/SellApi.kt +++ b/src/main/java/ru/evotor/framework/receipt/formation/api/SellApi.kt @@ -65,12 +65,13 @@ object SellApi { * @param context Контекст приложения * @param componentName - ComponentName сервиса-обработчика события ReceiptDiscountEvent * @param callback + * @param loyaltyCardId - Id карты лояльности */ @JvmStatic - fun triggerReceiptDiscountEvent(context: Context, componentName: ComponentName, callback: TriggerReceiptDiscountEventCallback) { + fun triggerReceiptDiscountEvent(context: Context, componentName: ComponentName, callback: TriggerReceiptDiscountEventCallback, loyaltyCardId: String?) { context.startIntegrationService( TriggerReceiptDiscountEventIntegrationService.ACTION_TRIGGER_RECEIPT_DISCOUNT_EVENT, - TriggerReceiptDiscountEventRequestedEvent(componentName, Receipt.Type.SELL) + TriggerReceiptDiscountEventRequestedEvent(componentName, Receipt.Type.SELL, loyaltyCardId) ) { it?.result?.error?.let { error -> callback.onError(TriggerReceiptDiscountEventException(error.code, error.message)) } ?: callback.onSuccess() diff --git a/src/main/java/ru/evotor/framework/receipt/formation/event/TriggerReceiptDiscountEventRequestedEvent.kt b/src/main/java/ru/evotor/framework/receipt/formation/event/TriggerReceiptDiscountEventRequestedEvent.kt index c9564392f7..5744ab481a 100644 --- a/src/main/java/ru/evotor/framework/receipt/formation/event/TriggerReceiptDiscountEventRequestedEvent.kt +++ b/src/main/java/ru/evotor/framework/receipt/formation/event/TriggerReceiptDiscountEventRequestedEvent.kt @@ -7,12 +7,14 @@ import ru.evotor.framework.receipt.Receipt class TriggerReceiptDiscountEventRequestedEvent( val componentName: ComponentName, - val receiptType: Receipt.Type + val receiptType: Receipt.Type, + val loyaltyCardId: String? ) : IBundlable { override fun toBundle(): Bundle { return Bundle().also { it.putParcelable(KEY_COMPONENT_NAME, componentName) it.putString(KEY_RECEIPT_TYPE, receiptType.name) + it.putString(KEY_LOYALTY_CARD_ID, loyaltyCardId) } } @@ -26,6 +28,7 @@ class TriggerReceiptDiscountEventRequestedEvent( private const val KEY_COMPONENT_NAME = "KEY_COMPONENT_NAME" private const val KEY_RECEIPT_TYPE = "KEY_RECEIPT_TYPE" + private const val KEY_LOYALTY_CARD_ID= "KEY_LOYALTY_CARD_ID" fun create(bundle: Bundle?): TriggerReceiptDiscountEventRequestedEvent? { bundle ?: return null @@ -34,8 +37,8 @@ class TriggerReceiptDiscountEventRequestedEvent( ?: throw IllegalStateException("Bundle doesn't contain the necessary data to create TriggerReceiptDiscountEventCommand") val receiptType = bundle.getString(KEY_RECEIPT_TYPE)?.let { Receipt.Type.valueOf(it) } ?: throw IllegalStateException("Bundle doesn't contain the necessary data to create TriggerReceiptDiscountEventCommand") - - return TriggerReceiptDiscountEventRequestedEvent(componentName, receiptType) + val loyaltyCardId = bundle.getString(KEY_LOYALTY_CARD_ID) + return TriggerReceiptDiscountEventRequestedEvent(componentName, receiptType, loyaltyCardId) } } } From 65ea295a1bdd3c394cb472f4195f75a7162d8bb5 Mon Sep 17 00:00:00 2001 From: Dmitry Kolpakov Date: Wed, 17 Dec 2025 09:00:40 +0300 Subject: [PATCH 11/14] =?UTF-8?q?STDEV-20296=20loyaltyCardId=20=D0=B2=20tr?= =?UTF-8?q?iggerReceiptDiscountEvent=20(payback\buy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/ru/evotor/framework/receipt/formation/api/BuyApi.kt | 4 ++-- .../ru/evotor/framework/receipt/formation/api/PaybackApi.kt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/ru/evotor/framework/receipt/formation/api/BuyApi.kt b/src/main/java/ru/evotor/framework/receipt/formation/api/BuyApi.kt index 89f690f65c..1e147da460 100644 --- a/src/main/java/ru/evotor/framework/receipt/formation/api/BuyApi.kt +++ b/src/main/java/ru/evotor/framework/receipt/formation/api/BuyApi.kt @@ -67,10 +67,10 @@ object BuyApi { * @param callback */ @JvmStatic - fun triggerReceiptDiscountEvent(context: Context, componentName: ComponentName, callback: TriggerReceiptDiscountEventCallback) { + fun triggerReceiptDiscountEvent(context: Context, componentName: ComponentName, callback: TriggerReceiptDiscountEventCallback, loyaltyCardId: String?) { context.startIntegrationService( TriggerReceiptDiscountEventIntegrationService.ACTION_TRIGGER_RECEIPT_DISCOUNT_EVENT, - TriggerReceiptDiscountEventRequestedEvent(componentName, Receipt.Type.BUY) + TriggerReceiptDiscountEventRequestedEvent(componentName, Receipt.Type.BUY, loyaltyCardId) ) { it?.result?.error?.let { error -> callback.onError(TriggerReceiptDiscountEventException(error.code, error.message)) } ?: callback.onSuccess() diff --git a/src/main/java/ru/evotor/framework/receipt/formation/api/PaybackApi.kt b/src/main/java/ru/evotor/framework/receipt/formation/api/PaybackApi.kt index afc490c9ab..2b565cb1ff 100644 --- a/src/main/java/ru/evotor/framework/receipt/formation/api/PaybackApi.kt +++ b/src/main/java/ru/evotor/framework/receipt/formation/api/PaybackApi.kt @@ -67,10 +67,10 @@ object PaybackApi { * @param callback */ @JvmStatic - fun triggerReceiptDiscountEvent(context: Context, componentName: ComponentName, callback: TriggerReceiptDiscountEventCallback) { + fun triggerReceiptDiscountEvent(context: Context, componentName: ComponentName, callback: TriggerReceiptDiscountEventCallback, loyaltyCardId: String?) { context.startIntegrationService( TriggerReceiptDiscountEventIntegrationService.ACTION_TRIGGER_RECEIPT_DISCOUNT_EVENT, - TriggerReceiptDiscountEventRequestedEvent(componentName, Receipt.Type.PAYBACK) + TriggerReceiptDiscountEventRequestedEvent(componentName, Receipt.Type.PAYBACK, loyaltyCardId) ) { it?.result?.error?.let { error -> callback.onError(TriggerReceiptDiscountEventException(error.code, error.message)) } ?: callback.onSuccess() From 345f306e05714940785e011b686c1e7f8ffcf698 Mon Sep 17 00:00:00 2001 From: Dmitry Kolpakov Date: Tue, 13 Jan 2026 08:05:57 +0300 Subject: [PATCH 12/14] STDEV-20296 Bonuses info --- .../framework/receipt/AppliedLoyaltyData.kt | 23 +++++++++++++++---- .../ru/evotor/framework/receipt/ReceiptApi.kt | 4 +++- .../framework/receipt/ReceiptHeaderTable.kt | 2 ++ 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/main/java/ru/evotor/framework/receipt/AppliedLoyaltyData.kt b/src/main/java/ru/evotor/framework/receipt/AppliedLoyaltyData.kt index 447ec529c4..9462d2b7ca 100644 --- a/src/main/java/ru/evotor/framework/receipt/AppliedLoyaltyData.kt +++ b/src/main/java/ru/evotor/framework/receipt/AppliedLoyaltyData.kt @@ -6,12 +6,15 @@ import android.os.Parcel import android.os.Parcelable import ru.evotor.IBundlable import ru.evotor.framework.ParcelableUtils +import java.math.BigDecimal data class AppliedLoyaltyData( val loyaltyAppId: String, val loyaltyServiceInfo: ComponentName, val loyaltyCardId: String?, - val externalLoyaltyCardId: String? + val externalLoyaltyCardId: String?, + val earnedBonus: BigDecimal = BigDecimal.ZERO, + val spentBonus: BigDecimal = BigDecimal.ZERO ) : Parcelable, IBundlable { override fun describeContents(): Int = 0 @@ -22,6 +25,8 @@ data class AppliedLoyaltyData( parcel.writeString(loyaltyServiceInfo.className) parcel.writeString(loyaltyCardId) parcel.writeString(externalLoyaltyCardId) + parcel.writeSerializable(earnedBonus) + parcel.writeSerializable(spentBonus) } } @@ -32,6 +37,8 @@ data class AppliedLoyaltyData( putString(KEY_LOYALTY_SERVICE_CLASS, loyaltyServiceInfo.className) putString(KEY_LOYALTY_CARD_ID, loyaltyCardId) putString(KEY_EXTERNAL_LOYALTY_CARD_ID, externalLoyaltyCardId) + putSerializable(KEY_EARNED_BONUS, earnedBonus) + putSerializable(KEY_SPENT_BONUS, spentBonus) } } @@ -43,6 +50,8 @@ data class AppliedLoyaltyData( private const val KEY_LOYALTY_SERVICE_CLASS = "loyaltyServiceClass" private const val KEY_LOYALTY_CARD_ID = "loyaltyCardId" private const val KEY_EXTERNAL_LOYALTY_CARD_ID = "externalLoyaltyCardId" + private const val KEY_EARNED_BONUS = "earnedBonus" + private const val KEY_SPENT_BONUS = "spentBonus" @JvmField val CREATOR = object : Parcelable.Creator { @@ -58,14 +67,18 @@ data class AppliedLoyaltyData( val loyaltyAppId = parcel.readString() val packageName = parcel.readString() val className = parcel.readString() - val loyaltyCardId = parcel.readString() - val externalLoyaltyCardId = parcel.readString() if (loyaltyAppId != null && packageName != null && className != null) { + val loyaltyCardId = parcel.readString() + val externalLoyaltyCardId = parcel.readString() + val earnedBonus = parcel.readSerializable() as BigDecimal + val spentBonus = parcel.readSerializable() as BigDecimal appliedLoyaltyData = AppliedLoyaltyData( loyaltyAppId = loyaltyAppId, loyaltyServiceInfo = ComponentName(packageName, className), loyaltyCardId = loyaltyCardId, - externalLoyaltyCardId = externalLoyaltyCardId + externalLoyaltyCardId = externalLoyaltyCardId, + earnedBonus = earnedBonus, + spentBonus = spentBonus ) } } @@ -83,6 +96,8 @@ data class AppliedLoyaltyData( loyaltyServiceInfo = ComponentName(packageName, name), loyaltyCardId = it.getString(KEY_LOYALTY_CARD_ID), externalLoyaltyCardId = it.getString(KEY_EXTERNAL_LOYALTY_CARD_ID), + earnedBonus = it.getSerializable(KEY_EARNED_BONUS) as BigDecimal, + spentBonus = it.getSerializable(KEY_SPENT_BONUS) as BigDecimal ) } } diff --git a/src/main/java/ru/evotor/framework/receipt/ReceiptApi.kt b/src/main/java/ru/evotor/framework/receipt/ReceiptApi.kt index 7bb429b6bb..ed40a4b534 100644 --- a/src/main/java/ru/evotor/framework/receipt/ReceiptApi.kt +++ b/src/main/java/ru/evotor/framework/receipt/ReceiptApi.kt @@ -630,7 +630,9 @@ object ReceiptApi { cursor.optString(ReceiptHeaderTable.COLUMN_LOYALTY_SERVICE_CLASS) ?: return null ), loyaltyCardId = cursor.optString(ReceiptHeaderTable.COLUMN_LOYALTY_CARD_ID), - externalLoyaltyCardId = cursor.optString(ReceiptHeaderTable.COLUMN_EXTERNAL_LOYALTY_CARD_ID) + externalLoyaltyCardId = cursor.optString(ReceiptHeaderTable.COLUMN_EXTERNAL_LOYALTY_CARD_ID), + earnedBonus = cursor.getMoney(ReceiptHeaderTable.COLUMN_EARNED_BONUS), + spentBonus = cursor.getMoney(ReceiptHeaderTable.COLUMN_SPENT_BONUS) ) } diff --git a/src/main/java/ru/evotor/framework/receipt/ReceiptHeaderTable.kt b/src/main/java/ru/evotor/framework/receipt/ReceiptHeaderTable.kt index 6875cf4d9b..a1f536de40 100644 --- a/src/main/java/ru/evotor/framework/receipt/ReceiptHeaderTable.kt +++ b/src/main/java/ru/evotor/framework/receipt/ReceiptHeaderTable.kt @@ -19,4 +19,6 @@ object ReceiptHeaderTable { const val COLUMN_LOYALTY_SERVICE_CLASS = "LOYALTY_SERVICE_CLASS" const val COLUMN_LOYALTY_CARD_ID = "LOYALTY_CARD_ID" const val COLUMN_EXTERNAL_LOYALTY_CARD_ID = "EXTERNAL_LOYALTY_CARD_ID" + const val COLUMN_EARNED_BONUS = "EARNED_BONUS" + const val COLUMN_SPENT_BONUS = "SPENT_BONUS" } From 48e64363dd3f3d91b257f344f13beb6f65b65eff Mon Sep 17 00:00:00 2001 From: Dmitry Kolpakov Date: Wed, 11 Feb 2026 14:22:27 +0300 Subject: [PATCH 13/14] STDEV-20296 Added additionalData field. --- .../framework/receipt/AppliedLoyaltyData.kt | 21 +++++++------------ .../ru/evotor/framework/receipt/ReceiptApi.kt | 3 +-- .../framework/receipt/ReceiptHeaderTable.kt | 3 +-- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/main/java/ru/evotor/framework/receipt/AppliedLoyaltyData.kt b/src/main/java/ru/evotor/framework/receipt/AppliedLoyaltyData.kt index 9462d2b7ca..3e7cbab996 100644 --- a/src/main/java/ru/evotor/framework/receipt/AppliedLoyaltyData.kt +++ b/src/main/java/ru/evotor/framework/receipt/AppliedLoyaltyData.kt @@ -13,8 +13,7 @@ data class AppliedLoyaltyData( val loyaltyServiceInfo: ComponentName, val loyaltyCardId: String?, val externalLoyaltyCardId: String?, - val earnedBonus: BigDecimal = BigDecimal.ZERO, - val spentBonus: BigDecimal = BigDecimal.ZERO + val additionalData: String? ) : Parcelable, IBundlable { override fun describeContents(): Int = 0 @@ -25,8 +24,7 @@ data class AppliedLoyaltyData( parcel.writeString(loyaltyServiceInfo.className) parcel.writeString(loyaltyCardId) parcel.writeString(externalLoyaltyCardId) - parcel.writeSerializable(earnedBonus) - parcel.writeSerializable(spentBonus) + parcel.writeString(additionalData) } } @@ -37,8 +35,7 @@ data class AppliedLoyaltyData( putString(KEY_LOYALTY_SERVICE_CLASS, loyaltyServiceInfo.className) putString(KEY_LOYALTY_CARD_ID, loyaltyCardId) putString(KEY_EXTERNAL_LOYALTY_CARD_ID, externalLoyaltyCardId) - putSerializable(KEY_EARNED_BONUS, earnedBonus) - putSerializable(KEY_SPENT_BONUS, spentBonus) + putString(KEY_EXTERNAL_LOYALTY_CARD_ID, additionalData) } } @@ -50,8 +47,7 @@ data class AppliedLoyaltyData( private const val KEY_LOYALTY_SERVICE_CLASS = "loyaltyServiceClass" private const val KEY_LOYALTY_CARD_ID = "loyaltyCardId" private const val KEY_EXTERNAL_LOYALTY_CARD_ID = "externalLoyaltyCardId" - private const val KEY_EARNED_BONUS = "earnedBonus" - private const val KEY_SPENT_BONUS = "spentBonus" + private const val KEY_ADDITIONAL_DATA = "additionalData" @JvmField val CREATOR = object : Parcelable.Creator { @@ -70,15 +66,13 @@ data class AppliedLoyaltyData( if (loyaltyAppId != null && packageName != null && className != null) { val loyaltyCardId = parcel.readString() val externalLoyaltyCardId = parcel.readString() - val earnedBonus = parcel.readSerializable() as BigDecimal - val spentBonus = parcel.readSerializable() as BigDecimal + val additionalData = parcel.readString() appliedLoyaltyData = AppliedLoyaltyData( loyaltyAppId = loyaltyAppId, loyaltyServiceInfo = ComponentName(packageName, className), loyaltyCardId = loyaltyCardId, externalLoyaltyCardId = externalLoyaltyCardId, - earnedBonus = earnedBonus, - spentBonus = spentBonus + additionalData = additionalData ) } } @@ -96,8 +90,7 @@ data class AppliedLoyaltyData( loyaltyServiceInfo = ComponentName(packageName, name), loyaltyCardId = it.getString(KEY_LOYALTY_CARD_ID), externalLoyaltyCardId = it.getString(KEY_EXTERNAL_LOYALTY_CARD_ID), - earnedBonus = it.getSerializable(KEY_EARNED_BONUS) as BigDecimal, - spentBonus = it.getSerializable(KEY_SPENT_BONUS) as BigDecimal + additionalData = it.getString(KEY_ADDITIONAL_DATA) ) } } diff --git a/src/main/java/ru/evotor/framework/receipt/ReceiptApi.kt b/src/main/java/ru/evotor/framework/receipt/ReceiptApi.kt index ed40a4b534..11fda3dff4 100644 --- a/src/main/java/ru/evotor/framework/receipt/ReceiptApi.kt +++ b/src/main/java/ru/evotor/framework/receipt/ReceiptApi.kt @@ -631,8 +631,7 @@ object ReceiptApi { ), loyaltyCardId = cursor.optString(ReceiptHeaderTable.COLUMN_LOYALTY_CARD_ID), externalLoyaltyCardId = cursor.optString(ReceiptHeaderTable.COLUMN_EXTERNAL_LOYALTY_CARD_ID), - earnedBonus = cursor.getMoney(ReceiptHeaderTable.COLUMN_EARNED_BONUS), - spentBonus = cursor.getMoney(ReceiptHeaderTable.COLUMN_SPENT_BONUS) + additionalData = cursor.optString(ReceiptHeaderTable.COLUMN_ADDITIONAL_DATA) ) } diff --git a/src/main/java/ru/evotor/framework/receipt/ReceiptHeaderTable.kt b/src/main/java/ru/evotor/framework/receipt/ReceiptHeaderTable.kt index a1f536de40..b137698078 100644 --- a/src/main/java/ru/evotor/framework/receipt/ReceiptHeaderTable.kt +++ b/src/main/java/ru/evotor/framework/receipt/ReceiptHeaderTable.kt @@ -19,6 +19,5 @@ object ReceiptHeaderTable { const val COLUMN_LOYALTY_SERVICE_CLASS = "LOYALTY_SERVICE_CLASS" const val COLUMN_LOYALTY_CARD_ID = "LOYALTY_CARD_ID" const val COLUMN_EXTERNAL_LOYALTY_CARD_ID = "EXTERNAL_LOYALTY_CARD_ID" - const val COLUMN_EARNED_BONUS = "EARNED_BONUS" - const val COLUMN_SPENT_BONUS = "SPENT_BONUS" + const val COLUMN_ADDITIONAL_DATA = "ADDITIONAL_DATA" } From 90fb4456e7f967a87cdf174b80f2a50683821f4b Mon Sep 17 00:00:00 2001 From: Dmitry Kolpakov Date: Fri, 20 Feb 2026 18:20:53 +0300 Subject: [PATCH 14/14] STDEV-20296 Fix overite externalLoyaltyCardId --- src/main/java/ru/evotor/framework/receipt/AppliedLoyaltyData.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/ru/evotor/framework/receipt/AppliedLoyaltyData.kt b/src/main/java/ru/evotor/framework/receipt/AppliedLoyaltyData.kt index 3e7cbab996..8b87e34eb2 100644 --- a/src/main/java/ru/evotor/framework/receipt/AppliedLoyaltyData.kt +++ b/src/main/java/ru/evotor/framework/receipt/AppliedLoyaltyData.kt @@ -35,7 +35,7 @@ data class AppliedLoyaltyData( putString(KEY_LOYALTY_SERVICE_CLASS, loyaltyServiceInfo.className) putString(KEY_LOYALTY_CARD_ID, loyaltyCardId) putString(KEY_EXTERNAL_LOYALTY_CARD_ID, externalLoyaltyCardId) - putString(KEY_EXTERNAL_LOYALTY_CARD_ID, additionalData) + putString(KEY_ADDITIONAL_DATA, additionalData) } }