@fiado/type-kit 3.500.0 → 3.502.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/_test_/unit/loanCredit/inStorePaymentDtos.test.ts +19 -0
  2. package/_test_/unit/retailPromotions/constants.test.ts +1 -1
  3. package/_test_/unit/retailPromotions/evaluatedSalePromotion.test.ts +2 -0
  4. package/_test_/unit/retailPromotions/resolveSalePromotionKind.test.ts +2 -0
  5. package/_test_/unit/retailPromotions/salePromotionConditions.test.ts +4 -0
  6. package/_test_/unit/retailPromotions/stackablePromotions.test.ts +238 -0
  7. package/bin/loanCredit/dtos/responses/LoanPaymentListItem.d.ts +2 -0
  8. package/bin/retailPromotions/constants/retailPromotionsErrorHttpStatus.js +1 -0
  9. package/bin/retailPromotions/dtos/LinePromotionAmount.d.ts +6 -0
  10. package/bin/retailPromotions/dtos/LinePromotionAmount.js +36 -0
  11. package/bin/retailPromotions/dtos/LinePromotionDiscount.d.ts +4 -0
  12. package/bin/retailPromotions/dtos/SalePromotion.d.ts +2 -0
  13. package/bin/retailPromotions/dtos/SalePromotionRef.d.ts +5 -0
  14. package/bin/retailPromotions/dtos/SalePromotionRef.js +30 -0
  15. package/bin/retailPromotions/dtos/requests/CreateSalePromotionRequest.d.ts +2 -0
  16. package/bin/retailPromotions/dtos/requests/CreateSalePromotionRequest.js +6 -0
  17. package/bin/retailPromotions/dtos/requests/HoldPromotionInput.d.ts +8 -0
  18. package/bin/retailPromotions/dtos/requests/HoldPromotionInput.js +46 -0
  19. package/bin/retailPromotions/dtos/requests/HoldSalePromotionRequest.d.ts +9 -3
  20. package/bin/retailPromotions/dtos/requests/HoldSalePromotionRequest.js +11 -0
  21. package/bin/retailPromotions/dtos/requests/UpdateSalePromotionRequest.d.ts +2 -0
  22. package/bin/retailPromotions/dtos/requests/UpdateSalePromotionRequest.js +6 -0
  23. package/bin/retailPromotions/dtos/responses/WizardSalePromotionResponses.d.ts +20 -0
  24. package/bin/retailPromotions/enums/RetailPromotionsErrorCodeEnum.d.ts +3 -1
  25. package/bin/retailPromotions/enums/RetailPromotionsErrorCodeEnum.js +2 -0
  26. package/bin/retailPromotions/index.d.ts +4 -0
  27. package/bin/retailPromotions/index.js +5 -0
  28. package/bin/retailPromotions/validators/IsHoldModeExclusiveConstraint.d.ts +6 -0
  29. package/bin/retailPromotions/validators/IsHoldModeExclusiveConstraint.js +24 -0
  30. package/bin/retailWizard/dtos/Sale.d.ts +3 -0
  31. package/bin/retailWizard/dtos/WizardLinePromotionFields.d.ts +4 -0
  32. package/bin/retailWizard/dtos/WizardSession.d.ts +3 -0
  33. package/bin/retailWizard/dtos/requests/ApplyLinePromotionRequest.d.ts +5 -0
  34. package/bin/retailWizard/dtos/requests/ApplyLinePromotionRequest.js +16 -0
  35. package/bin/retailWizard/dtos/requests/ApplySalePromotionRequest.d.ts +3 -0
  36. package/bin/retailWizard/dtos/requests/ApplySalePromotionRequest.js +9 -0
  37. package/bin/retailWizard/dtos/responses/PrivateWizardSessionResponse.d.ts +3 -0
  38. package/bin/retailWizard/events/RetailPromotionInboundMessage.d.ts +8 -0
  39. package/bin/retailWizard/events/RetailPromotionInboundMessage.js +22 -0
  40. package/bin/retailWizard/index.d.ts +2 -0
  41. package/bin/retailWizard/index.js +5 -0
  42. package/package.json +1 -1
  43. package/src/loanCredit/dtos/responses/LoanPaymentListItem.ts +2 -0
  44. package/src/retailPromotions/constants/retailPromotionsErrorHttpStatus.ts +1 -0
  45. package/src/retailPromotions/dtos/LinePromotionAmount.ts +20 -0
  46. package/src/retailPromotions/dtos/LinePromotionDiscount.ts +5 -0
  47. package/src/retailPromotions/dtos/SalePromotion.ts +2 -0
  48. package/src/retailPromotions/dtos/SalePromotionRef.ts +15 -0
  49. package/src/retailPromotions/dtos/requests/CreateSalePromotionRequest.ts +6 -0
  50. package/src/retailPromotions/dtos/requests/HoldPromotionInput.ts +30 -0
  51. package/src/retailPromotions/dtos/requests/HoldSalePromotionRequest.ts +28 -4
  52. package/src/retailPromotions/dtos/requests/UpdateSalePromotionRequest.ts +6 -0
  53. package/src/retailPromotions/dtos/responses/WizardSalePromotionResponses.ts +21 -0
  54. package/src/retailPromotions/enums/RetailPromotionsErrorCodeEnum.ts +2 -0
  55. package/src/retailPromotions/index.ts +6 -0
  56. package/src/retailPromotions/validators/IsHoldModeExclusiveConstraint.ts +18 -0
  57. package/src/retailWizard/dtos/Sale.ts +3 -0
  58. package/src/retailWizard/dtos/WizardLinePromotionFields.ts +4 -0
  59. package/src/retailWizard/dtos/WizardSession.ts +3 -0
  60. package/src/retailWizard/dtos/requests/ApplyLinePromotionRequest.ts +18 -2
  61. package/src/retailWizard/dtos/requests/ApplySalePromotionRequest.ts +11 -2
  62. package/src/retailWizard/dtos/responses/PrivateWizardSessionResponse.ts +3 -0
  63. package/src/retailWizard/events/RetailPromotionInboundMessage.ts +22 -0
  64. package/src/retailWizard/index.ts +2 -0
@@ -1,3 +1,4 @@
1
+ import type { LinePromotionAmount } from '../../retailPromotions/dtos/LinePromotionAmount';
1
2
  import type { WizardLineRoleEnum } from '../enums/WizardLineRoleEnum';
2
3
 
3
4
  /** Campos de Promociones en la línea de sesión y de venta; solo los escribe su endpoint M2M. */
@@ -13,4 +14,7 @@ export interface WizardLinePromotionFields {
13
14
  discountCents?: number;
14
15
  /** Precio antes del descuento; en un regalo, el valor de lista con la línea a $0. */
15
16
  originalPriceCents?: number;
17
+ /** Descuento de cada promo en la línea; sin el campo, la de `promotionId` lleva todo menos el código. */
18
+ promotionDiscounts?: LinePromotionAmount[];
19
+ codeDiscountCents?: number;
16
20
  }
@@ -1,3 +1,4 @@
1
+ import type { SalePromotionRef } from '../../retailPromotions/dtos/SalePromotionRef';
1
2
  import type { WizardStateEnum } from '../enums/WizardStateEnum';
2
3
  import type { WizardStepEnum } from '../enums/WizardStepEnum';
3
4
  import type { FiadoPhoneStatusEnum } from '../enums/FiadoPhoneStatusEnum';
@@ -126,6 +127,8 @@ export interface WizardSession {
126
127
  /** Promo de venta que fijó Promociones; `null` = ninguna. */
127
128
  salePromotionId?: string | null;
128
129
  salePromotionVersion?: number | null;
130
+ /** Todas las promos de venta fijadas; `salePromotionId` queda como la principal. */
131
+ salePromotions?: SalePromotionRef[] | null;
129
132
  /** Enganche cobrado que queda por reembolsar tras cancelar. */
130
133
  refundPendingCents?: number;
131
134
  paymentMethod: PaymentMethodEnum | null;
@@ -1,5 +1,6 @@
1
- import { Expose } from 'class-transformer';
2
- import { IsInt, IsNotEmpty, IsOptional, IsString, Min, ValidateIf } from 'class-validator';
1
+ import { Expose, Type } from 'class-transformer';
2
+ import { IsArray, IsInt, IsNotEmpty, IsOptional, IsString, Min, ValidateIf, ValidateNested } from 'class-validator';
3
+ import { LinePromotionAmount } from '../../../retailPromotions/dtos/LinePromotionAmount';
3
4
 
4
5
  const hasPromotion = (o: ApplyLinePromotionRequest): boolean =>
5
6
  o.promotionId !== undefined || o.promotionVersion !== undefined;
@@ -41,4 +42,19 @@ export class ApplyLinePromotionRequest {
41
42
  @IsInt()
42
43
  @Min(0)
43
44
  originalPriceCents?: number;
45
+
46
+ /** Descuento de cada promo en la línea; `promotionId` queda como la principal. */
47
+ @Expose()
48
+ @IsOptional()
49
+ @IsArray()
50
+ @ValidateNested({ each: true })
51
+ @Type(() => LinePromotionAmount)
52
+ promotionDiscounts?: LinePromotionAmount[];
53
+
54
+ /** Parte de `discountCents` que viene del código. */
55
+ @Expose()
56
+ @IsOptional()
57
+ @IsInt()
58
+ @Min(0)
59
+ codeDiscountCents?: number;
44
60
  }
@@ -1,5 +1,6 @@
1
- import { Expose } from 'class-transformer';
2
- import { IsInt, IsNotEmpty, IsString, Min, ValidateIf } from 'class-validator';
1
+ import { Expose, Type } from 'class-transformer';
2
+ import { IsArray, IsInt, IsNotEmpty, IsOptional, IsString, Min, ValidateIf, ValidateNested } from 'class-validator';
3
+ import { SalePromotionRef } from '../../../retailPromotions/dtos/SalePromotionRef';
3
4
 
4
5
  /**
5
6
  * PUT /private/wizard/sessions/{id}/sale-promotion (privateApplySalePromotion, M2M de Promociones).
@@ -21,4 +22,12 @@ export class ApplySalePromotionRequest {
21
22
  @IsInt()
22
23
  @Min(1)
23
24
  salePromotionVersion!: number | null;
25
+
26
+ /** Todas las promos de venta fijadas; `salePromotionId` queda como la principal. */
27
+ @Expose()
28
+ @IsOptional()
29
+ @IsArray()
30
+ @ValidateNested({ each: true })
31
+ @Type(() => SalePromotionRef)
32
+ salePromotions?: SalePromotionRef[] | null;
24
33
  }
@@ -3,6 +3,7 @@ import type { WizardStateEnum } from '../../enums/WizardStateEnum';
3
3
  import type { WizardStepEnum } from '../../enums/WizardStepEnum';
4
4
  import type { WizardPayment } from '../WizardPayment';
5
5
  import type { WizardReservedLine } from '../WizardReservedLine';
6
+ import type { SalePromotionRef } from '../../../retailPromotions/dtos/SalePromotionRef';
6
7
 
7
8
  /** GET /private/wizard/sessions/{id} (privateGetWizardSession): lo que Promociones lee de la sesión. */
8
9
  export interface PrivateWizardSessionResponse {
@@ -19,6 +20,8 @@ export interface PrivateWizardSessionResponse {
19
20
  anchorLineId: string | null;
20
21
  salePromotionId: string | null;
21
22
  salePromotionVersion: number | null;
23
+ /** Todas las promos de venta fijadas; `salePromotionId` queda como la principal. */
24
+ salePromotions?: SalePromotionRef[] | null;
22
25
  /** Líneas vivas con los campos de Promociones y financedCents. */
23
26
  lines: WizardReservedLine[];
24
27
  fiadoDirectoryId?: string | null;
@@ -12,6 +12,8 @@ import {
12
12
  Min,
13
13
  ValidateNested,
14
14
  } from 'class-validator';
15
+ import { LinePromotionAmount } from '../../retailPromotions/dtos/LinePromotionAmount';
16
+ import { SalePromotionRef } from '../../retailPromotions/dtos/SalePromotionRef';
15
17
  import { RetailPromotionInboundMessageTypeEnum } from '../enums/RetailPromotionInboundMessageTypeEnum';
16
18
  import { WizardLineRoleEnum } from '../enums/WizardLineRoleEnum';
17
19
 
@@ -59,6 +61,19 @@ export class RetailPromotionInboundLine {
59
61
  @Min(0)
60
62
  discountCents?: number;
61
63
 
64
+ /** Descuento de cada promo en la línea; `promotionId` queda como la principal. */
65
+ @IsOptional()
66
+ @IsArray()
67
+ @ValidateNested({ each: true })
68
+ @Type(() => LinePromotionAmount)
69
+ promotionDiscounts?: LinePromotionAmount[];
70
+
71
+ /** Parte de `discountCents` que viene del código. */
72
+ @IsOptional()
73
+ @IsInt()
74
+ @Min(0)
75
+ codeDiscountCents?: number;
76
+
62
77
  /** Si la línea no lo trae, basePriceCents × qty. */
63
78
  @IsInt()
64
79
  @Min(0)
@@ -132,6 +147,13 @@ export class RetailPromotionInboundMessage {
132
147
  @Min(1)
133
148
  salePromotionVersion?: number | null;
134
149
 
150
+ /** Todas las promos de venta de la venta; `salePromotionId` queda como la principal. */
151
+ @IsOptional()
152
+ @IsArray()
153
+ @ValidateNested({ each: true })
154
+ @Type(() => SalePromotionRef)
155
+ salePromotions?: SalePromotionRef[] | null;
156
+
135
157
  @IsArray()
136
158
  @ArrayMinSize(1)
137
159
  @ValidateNested({ each: true })
@@ -46,6 +46,8 @@ export * from './dtos/WizardBlocked';
46
46
  export * from './dtos/WizardLineProduct';
47
47
  export * from './dtos/WizardLineIdentifiers';
48
48
  export * from './dtos/WizardLinePromotionFields';
49
+ export { LinePromotionAmount } from '../retailPromotions/dtos/LinePromotionAmount';
50
+ export { SalePromotionRef } from '../retailPromotions/dtos/SalePromotionRef';
49
51
  export * from './dtos/WizardFinancingPreview';
50
52
  export * from './dtos/WizardReservedLine';
51
53
  export * from './dtos/WizardGiftLine';