|
40 | 40 | * Позиция чека. |
41 | 41 | */ |
42 | 42 | public class Position implements Parcelable { |
| 43 | + /** |
| 44 | + * Разрешение для установки признака принудительного использования указанного НДС. |
| 45 | + * Указывайте разрешение в манифесте приложения, в элементе `<uses-permission android:name="" />` до элемента `<application>`. |
| 46 | + */ |
| 47 | + public static final String FORCE_TAX_NUMBER_SET_PERMISSION = "ru.evotor.permission.position.forceTaxNumber.SET"; |
| 48 | + |
43 | 49 | /** |
44 | 50 | * Текущая версия объекта Position |
45 | 51 | */ |
46 | | - private static final int VERSION = 15; |
| 52 | + private static final int VERSION = 16; |
47 | 53 | /** |
48 | 54 | * Магическое число для идентификации использования версионирования объекта. |
49 | 55 | */ |
@@ -240,6 +246,12 @@ public class Position implements Parcelable { |
240 | 246 | @Nullable |
241 | 247 | private TimeRange saleBanTime; |
242 | 248 |
|
| 249 | + /** |
| 250 | + * Признак принудительного использования указанного НДС |
| 251 | + */ |
| 252 | + @Nullable |
| 253 | + private Boolean forceTaxNumber; |
| 254 | + |
243 | 255 | public Position( |
244 | 256 | String uuid, |
245 | 257 | @Nullable String productUuid, |
@@ -314,6 +326,7 @@ public Position(Position position) { |
314 | 326 | this.isMarkSkipped = position.isMarkSkipped; |
315 | 327 | this.saleBanTime = position.saleBanTime; |
316 | 328 | this.veterinaryAttribute = position.veterinaryAttribute; |
| 329 | + this.forceTaxNumber = position.forceTaxNumber; |
317 | 330 | } |
318 | 331 |
|
319 | 332 | /** |
@@ -642,6 +655,11 @@ public MarksCheckingInfo getMarksCheckingInfo() { |
642 | 655 | return marksCheckingInfo; |
643 | 656 | } |
644 | 657 |
|
| 658 | + @Nullable |
| 659 | + public Boolean getForceTaxNumber() { |
| 660 | + return forceTaxNumber; |
| 661 | + } |
| 662 | + |
645 | 663 | @Override |
646 | 664 | public boolean equals(Object o) { |
647 | 665 | return equals(o, false); |
@@ -715,6 +733,8 @@ private boolean equals(Object o, boolean exceptQuantity) { |
715 | 733 | return false; |
716 | 734 | if (!Objects.equals(veterinaryAttribute, position.veterinaryAttribute)) |
717 | 735 | return false; |
| 736 | + if (!Objects.equals(forceTaxNumber, position.forceTaxNumber)) |
| 737 | + return false; |
718 | 738 | return Objects.equals(subPositions, position.subPositions); |
719 | 739 | } |
720 | 740 |
|
@@ -751,6 +771,7 @@ public int hashCode() { |
751 | 771 | result = 31 * result + (isMarkSkipped != null ? isMarkSkipped.hashCode() : 0); |
752 | 772 | result = 31 * result + (saleBanTime != null ? saleBanTime.hashCode() : 0); |
753 | 773 | result = 31 * result + (veterinaryAttribute != null ? veterinaryAttribute.hashCode() : 0); |
| 774 | + result = 31 * result + (forceTaxNumber != null ? forceTaxNumber.hashCode() : 0); |
754 | 775 | return result; |
755 | 776 | } |
756 | 777 |
|
@@ -787,6 +808,7 @@ public String toString() { |
787 | 808 | ", isAgeLimited=" + isAgeLimited + |
788 | 809 | ", isMarkSkipped=" + isMarkSkipped + |
789 | 810 | ", veterinaryAttribute=" + veterinaryAttribute + |
| 811 | + ", forceTaxNumber=" + forceTaxNumber + |
790 | 812 | '}'; |
791 | 813 | } |
792 | 814 |
|
@@ -880,6 +902,7 @@ private void writeAdditionalFields(Parcel dest, int flags) { |
880 | 902 | dest.writeSerializable(this.isMarkSkipped); |
881 | 903 | dest.writeBundle(this.saleBanTime != null ? this.saleBanTime.toBundle() : null); |
882 | 904 | dest.writeBundle(this.veterinaryAttribute != null ? this.veterinaryAttribute.toBundle() : null); |
| 905 | + dest.writeSerializable(this.forceTaxNumber); |
883 | 906 | } |
884 | 907 |
|
885 | 908 | protected Position(Parcel in) { |
@@ -989,6 +1012,9 @@ private void readAdditionalFields(Parcel in, String measureName, int measurePrec |
989 | 1012 | if (version >= 15) { |
990 | 1013 | readVeterinaryAttribute(in); |
991 | 1014 | } |
| 1015 | + if (version >= 16) { |
| 1016 | + this.forceTaxNumber = (Boolean) in.readSerializable(); |
| 1017 | + } |
992 | 1018 | if (isVersionGreaterThanCurrent) { |
993 | 1019 | in.setDataPosition(startDataPosition + dataSize); |
994 | 1020 | } |
@@ -2017,6 +2043,11 @@ public Builder setSaleBanTime(@Nullable TimeRange saleBanTime) { |
2017 | 2043 | return this; |
2018 | 2044 | } |
2019 | 2045 |
|
| 2046 | + public Builder setForceTaxNumber(@Nullable Boolean forceTaxNumber) { |
| 2047 | + position.forceTaxNumber = forceTaxNumber; |
| 2048 | + return this; |
| 2049 | + } |
| 2050 | + |
2020 | 2051 | public Position build() { |
2021 | 2052 | return new Position(position); |
2022 | 2053 | } |
|
0 commit comments