@fiado/type-kit 3.472.0 → 3.474.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 (268) hide show
  1. package/_test_/unit/retailCatalog/accessorySubcategory.test.ts +65 -0
  2. package/_test_/unit/retailCatalog/catalogDebt.test.ts +123 -0
  3. package/_test_/unit/retailCatalog/catalogEnums.test.ts +2 -2
  4. package/_test_/unit/retailCatalog/ventaSaga.test.ts +156 -0
  5. package/_test_/unit/retailPromotions/computeBudgetUsedBps.test.ts +30 -0
  6. package/_test_/unit/retailPromotions/constants.test.ts +78 -0
  7. package/_test_/unit/retailPromotions/discountCodeAndWizardRequests.test.ts +97 -0
  8. package/_test_/unit/retailPromotions/salePromotionRequests.test.ts +159 -0
  9. package/_test_/unit/retailWizard/promotionM2mRequests.test.ts +197 -0
  10. package/_test_/unit/retailWizard/ventaSagaMessages.test.ts +186 -0
  11. package/_test_/unit/retailWizard/ventaSagaRequests.test.ts +59 -0
  12. package/_test_/unit/retailWizard/ventaSagaShapes.test.ts +99 -0
  13. package/bin/index.d.ts +1 -0
  14. package/bin/index.js +5 -2
  15. package/bin/retailCatalog/dtos/Product.d.ts +9 -0
  16. package/bin/retailCatalog/dtos/requests/BackofficeCreateProductRequest.d.ts +12 -0
  17. package/bin/retailCatalog/dtos/requests/BackofficeCreateProductRequest.js +36 -0
  18. package/bin/retailCatalog/dtos/requests/BackofficeRegisterAdjustmentRequest.d.ts +2 -0
  19. package/bin/retailCatalog/dtos/requests/BackofficeRegisterAdjustmentRequest.js +6 -0
  20. package/bin/retailCatalog/dtos/requests/BackofficeUpdateProductRequest.d.ts +12 -0
  21. package/bin/retailCatalog/dtos/requests/BackofficeUpdateProductRequest.js +36 -0
  22. package/bin/retailCatalog/dtos/requests/HoldStockRequest.d.ts +12 -0
  23. package/bin/retailCatalog/dtos/requests/HoldStockRequest.js +50 -0
  24. package/bin/retailCatalog/dtos/requests/ReserveStockRequest.d.ts +3 -0
  25. package/bin/retailCatalog/dtos/requests/ReserveStockRequest.js +6 -0
  26. package/bin/retailCatalog/dtos/requests/SuggestPiecesQuery.d.ts +2 -0
  27. package/bin/retailCatalog/dtos/requests/SuggestPiecesQuery.js +6 -0
  28. package/bin/retailCatalog/dtos/responses/GetInventorySkuResponse.d.ts +3 -0
  29. package/bin/retailCatalog/dtos/responses/HoldStockResponse.d.ts +8 -0
  30. package/bin/retailCatalog/dtos/responses/HoldStockResponse.js +2 -0
  31. package/bin/retailCatalog/dtos/responses/StoreCatalogItem.d.ts +8 -1
  32. package/bin/retailCatalog/enums/AccessorySubcategoryEnum.d.ts +9 -0
  33. package/bin/retailCatalog/enums/AccessorySubcategoryEnum.js +13 -0
  34. package/bin/retailCatalog/enums/InventoryInboundMessageTypeEnum.d.ts +5 -0
  35. package/bin/retailCatalog/enums/InventoryInboundMessageTypeEnum.js +9 -0
  36. package/bin/retailCatalog/enums/InventoryItemStatusEnum.d.ts +4 -2
  37. package/bin/retailCatalog/enums/InventoryItemStatusEnum.js +3 -1
  38. package/bin/retailCatalog/enums/ReservePurposeEnum.d.ts +4 -0
  39. package/bin/retailCatalog/enums/ReservePurposeEnum.js +8 -0
  40. package/bin/retailCatalog/events/InventoryInboundMessage.d.ts +4 -0
  41. package/bin/retailCatalog/events/InventoryInboundMessage.js +2 -0
  42. package/bin/retailCatalog/events/InventoryReturnMessage.d.ts +12 -0
  43. package/bin/retailCatalog/events/InventoryReturnMessage.js +42 -0
  44. package/bin/retailCatalog/events/InventorySaleAppliedMessage.d.ts +12 -0
  45. package/bin/retailCatalog/events/InventorySaleAppliedMessage.js +42 -0
  46. package/bin/retailCatalog/index.d.ts +8 -0
  47. package/bin/retailCatalog/index.js +9 -0
  48. package/bin/retailPromotions/constants/bonusPreMoney.d.ts +7 -0
  49. package/bin/retailPromotions/constants/bonusPreMoney.js +21 -0
  50. package/bin/retailPromotions/constants/retailPromotionsErrorHttpStatus.d.ts +3 -0
  51. package/bin/retailPromotions/constants/retailPromotionsErrorHttpStatus.js +27 -0
  52. package/bin/retailPromotions/constants/salePromotionTransitions.d.ts +7 -0
  53. package/bin/retailPromotions/constants/salePromotionTransitions.js +13 -0
  54. package/bin/retailPromotions/dtos/DiscountCode.d.ts +35 -0
  55. package/bin/retailPromotions/dtos/DiscountCode.js +2 -0
  56. package/bin/retailPromotions/dtos/DiscountValue.d.ts +7 -0
  57. package/bin/retailPromotions/dtos/DiscountValue.js +2 -0
  58. package/bin/retailPromotions/dtos/LinePromotionDiscount.d.ts +10 -0
  59. package/bin/retailPromotions/dtos/LinePromotionDiscount.js +2 -0
  60. package/bin/retailPromotions/dtos/SalePromotion.d.ts +35 -0
  61. package/bin/retailPromotions/dtos/SalePromotion.js +2 -0
  62. package/bin/retailPromotions/dtos/SalePromotionLevers.d.ts +59 -0
  63. package/bin/retailPromotions/dtos/SalePromotionLevers.js +2 -0
  64. package/bin/retailPromotions/dtos/SalePromotionLogEntry.d.ts +18 -0
  65. package/bin/retailPromotions/dtos/SalePromotionLogEntry.js +2 -0
  66. package/bin/retailPromotions/dtos/requests/ChangeDiscountCodeStatusRequest.d.ts +6 -0
  67. package/bin/retailPromotions/dtos/requests/ChangeDiscountCodeStatusRequest.js +30 -0
  68. package/bin/retailPromotions/dtos/requests/ChangeSalePromotionStatusRequest.d.ts +6 -0
  69. package/bin/retailPromotions/dtos/requests/ChangeSalePromotionStatusRequest.js +30 -0
  70. package/bin/retailPromotions/dtos/requests/CreateDiscountCodeRequest.d.ts +17 -0
  71. package/bin/retailPromotions/dtos/requests/CreateDiscountCodeRequest.js +78 -0
  72. package/bin/retailPromotions/dtos/requests/CreateSalePromotionRequest.d.ts +19 -0
  73. package/bin/retailPromotions/dtos/requests/CreateSalePromotionRequest.js +83 -0
  74. package/bin/retailPromotions/dtos/requests/DiscountValueInput.d.ts +8 -0
  75. package/bin/retailPromotions/dtos/requests/DiscountValueInput.js +36 -0
  76. package/bin/retailPromotions/dtos/requests/EvaluateSalePromotionsRequest.d.ts +5 -0
  77. package/bin/retailPromotions/dtos/requests/EvaluateSalePromotionsRequest.js +31 -0
  78. package/bin/retailPromotions/dtos/requests/GetSaleCouponQuery.d.ts +4 -0
  79. package/bin/retailPromotions/dtos/requests/GetSaleCouponQuery.js +25 -0
  80. package/bin/retailPromotions/dtos/requests/HoldSalePromotionRequest.d.ts +11 -0
  81. package/bin/retailPromotions/dtos/requests/HoldSalePromotionRequest.js +48 -0
  82. package/bin/retailPromotions/dtos/requests/ListDiscountCodesQuery.d.ts +10 -0
  83. package/bin/retailPromotions/dtos/requests/ListDiscountCodesQuery.js +49 -0
  84. package/bin/retailPromotions/dtos/requests/ListSalePromotionLogQuery.d.ts +8 -0
  85. package/bin/retailPromotions/dtos/requests/ListSalePromotionLogQuery.js +46 -0
  86. package/bin/retailPromotions/dtos/requests/ListSalePromotionsQuery.d.ts +7 -0
  87. package/bin/retailPromotions/dtos/requests/ListSalePromotionsQuery.js +40 -0
  88. package/bin/retailPromotions/dtos/requests/ListStoreSalePromotionsQuery.d.ts +4 -0
  89. package/bin/retailPromotions/dtos/requests/ListStoreSalePromotionsQuery.js +24 -0
  90. package/bin/retailPromotions/dtos/requests/SalePromotionLeversInput.d.ts +41 -0
  91. package/bin/retailPromotions/dtos/requests/SalePromotionLeversInput.js +166 -0
  92. package/bin/retailPromotions/dtos/requests/SalePromotionScopeInput.d.ts +14 -0
  93. package/bin/retailPromotions/dtos/requests/SalePromotionScopeInput.js +65 -0
  94. package/bin/retailPromotions/dtos/requests/UpdateSalePromotionRequest.d.ts +19 -0
  95. package/bin/retailPromotions/dtos/requests/UpdateSalePromotionRequest.js +85 -0
  96. package/bin/retailPromotions/dtos/responses/DiscountCodeResponses.d.ts +7 -0
  97. package/bin/retailPromotions/dtos/responses/DiscountCodeResponses.js +2 -0
  98. package/bin/retailPromotions/dtos/responses/SalePromotionCrudResponses.d.ts +30 -0
  99. package/bin/retailPromotions/dtos/responses/SalePromotionCrudResponses.js +2 -0
  100. package/bin/retailPromotions/dtos/responses/WizardSalePromotionResponses.d.ts +102 -0
  101. package/bin/retailPromotions/dtos/responses/WizardSalePromotionResponses.js +2 -0
  102. package/bin/retailPromotions/enums/CouponScopeEnum.d.ts +11 -0
  103. package/bin/retailPromotions/enums/CouponScopeEnum.js +15 -0
  104. package/bin/retailPromotions/enums/CouponStatusEnum.d.ts +11 -0
  105. package/bin/retailPromotions/enums/CouponStatusEnum.js +15 -0
  106. package/bin/retailPromotions/enums/DiscountCodeOriginEnum.d.ts +8 -0
  107. package/bin/retailPromotions/enums/DiscountCodeOriginEnum.js +12 -0
  108. package/bin/retailPromotions/enums/DiscountCodeStatusEnum.d.ts +11 -0
  109. package/bin/retailPromotions/enums/DiscountCodeStatusEnum.js +15 -0
  110. package/bin/retailPromotions/enums/DiscountCodeTransitionEnum.d.ts +7 -0
  111. package/bin/retailPromotions/enums/DiscountCodeTransitionEnum.js +11 -0
  112. package/bin/retailPromotions/enums/DiscountTypeEnum.d.ts +8 -0
  113. package/bin/retailPromotions/enums/DiscountTypeEnum.js +12 -0
  114. package/bin/retailPromotions/enums/EntitlementKindEnum.d.ts +9 -0
  115. package/bin/retailPromotions/enums/EntitlementKindEnum.js +13 -0
  116. package/bin/retailPromotions/enums/EntitlementStateEnum.d.ts +13 -0
  117. package/bin/retailPromotions/enums/EntitlementStateEnum.js +17 -0
  118. package/bin/retailPromotions/enums/GiftModeEnum.d.ts +8 -0
  119. package/bin/retailPromotions/enums/GiftModeEnum.js +12 -0
  120. package/bin/retailPromotions/enums/PromotionAppliesToEnum.d.ts +9 -0
  121. package/bin/retailPromotions/enums/PromotionAppliesToEnum.js +13 -0
  122. package/bin/retailPromotions/enums/RetailPromotionsErrorCodeEnum.d.ts +29 -0
  123. package/bin/retailPromotions/enums/RetailPromotionsErrorCodeEnum.js +33 -0
  124. package/bin/retailPromotions/enums/SaleCouponAvailabilityEnum.d.ts +10 -0
  125. package/bin/retailPromotions/enums/SaleCouponAvailabilityEnum.js +14 -0
  126. package/bin/retailPromotions/enums/SalePromotionLeverEnum.d.ts +13 -0
  127. package/bin/retailPromotions/enums/SalePromotionLeverEnum.js +17 -0
  128. package/bin/retailPromotions/enums/SalePromotionLogEventEnum.d.ts +14 -0
  129. package/bin/retailPromotions/enums/SalePromotionLogEventEnum.js +18 -0
  130. package/bin/retailPromotions/enums/SalePromotionLogFormatEnum.d.ts +5 -0
  131. package/bin/retailPromotions/enums/SalePromotionLogFormatEnum.js +9 -0
  132. package/bin/retailPromotions/enums/SalePromotionPhaseEnum.d.ts +11 -0
  133. package/bin/retailPromotions/enums/SalePromotionPhaseEnum.js +15 -0
  134. package/bin/retailPromotions/enums/SalePromotionStatusEnum.d.ts +12 -0
  135. package/bin/retailPromotions/enums/SalePromotionStatusEnum.js +16 -0
  136. package/bin/retailPromotions/enums/SalePromotionTransitionEnum.d.ts +13 -0
  137. package/bin/retailPromotions/enums/SalePromotionTransitionEnum.js +17 -0
  138. package/bin/retailPromotions/helpers/computeBudgetUsedBps.d.ts +3 -0
  139. package/bin/retailPromotions/helpers/computeBudgetUsedBps.js +15 -0
  140. package/bin/retailPromotions/helpers/resolveSalePromotionTransition.d.ts +4 -0
  141. package/bin/retailPromotions/helpers/resolveSalePromotionTransition.js +9 -0
  142. package/bin/retailPromotions/index.d.ts +47 -0
  143. package/bin/retailPromotions/index.js +68 -0
  144. package/bin/retailWizard/dtos/Sale.d.ts +8 -8
  145. package/bin/retailWizard/dtos/SaleLine.d.ts +4 -1
  146. package/bin/retailWizard/dtos/WizardFinancingPreview.d.ts +11 -0
  147. package/bin/retailWizard/dtos/WizardFinancingPreview.js +2 -0
  148. package/bin/retailWizard/dtos/WizardGiftLine.d.ts +10 -0
  149. package/bin/retailWizard/dtos/WizardGiftLine.js +2 -0
  150. package/bin/retailWizard/dtos/WizardLinePromotionFields.d.ts +15 -0
  151. package/bin/retailWizard/dtos/WizardLinePromotionFields.js +2 -0
  152. package/bin/retailWizard/dtos/WizardReservedLine.d.ts +4 -1
  153. package/bin/retailWizard/dtos/WizardSession.d.ts +10 -0
  154. package/bin/retailWizard/dtos/requests/AddProductRequest.d.ts +2 -0
  155. package/bin/retailWizard/dtos/requests/AddProductRequest.js +7 -0
  156. package/bin/retailWizard/dtos/requests/ApplyLinePromotionRequest.d.ts +14 -0
  157. package/bin/retailWizard/dtos/requests/ApplyLinePromotionRequest.js +57 -0
  158. package/bin/retailWizard/dtos/requests/ApplySalePromotionRequest.d.ts +9 -0
  159. package/bin/retailWizard/dtos/requests/ApplySalePromotionRequest.js +36 -0
  160. package/bin/retailWizard/dtos/requests/PinSessionPiecesRequest.d.ts +14 -0
  161. package/bin/retailWizard/dtos/requests/PinSessionPiecesRequest.js +60 -0
  162. package/bin/retailWizard/dtos/requests/QuoteRequest.d.ts +1 -1
  163. package/bin/retailWizard/dtos/requests/SetAnchorGiftsRequest.d.ts +14 -0
  164. package/bin/retailWizard/dtos/requests/SetAnchorGiftsRequest.js +56 -0
  165. package/bin/retailWizard/dtos/responses/PrivateWizardSessionResponse.d.ts +29 -0
  166. package/bin/retailWizard/dtos/responses/PrivateWizardSessionResponse.js +2 -0
  167. package/bin/retailWizard/dtos/responses/SetAnchorGiftsResponse.d.ts +5 -0
  168. package/bin/retailWizard/dtos/responses/SetAnchorGiftsResponse.js +2 -0
  169. package/bin/retailWizard/enums/RetailPromotionInboundMessageTypeEnum.d.ts +5 -0
  170. package/bin/retailWizard/enums/RetailPromotionInboundMessageTypeEnum.js +9 -0
  171. package/bin/retailWizard/enums/WizardLineRoleEnum.d.ts +4 -0
  172. package/bin/retailWizard/enums/WizardLineRoleEnum.js +8 -0
  173. package/bin/retailWizard/events/RetailCommissionInboundMessage.d.ts +19 -0
  174. package/bin/retailWizard/events/RetailCommissionInboundMessage.js +78 -0
  175. package/bin/retailWizard/events/RetailPromotionInboundMessage.d.ts +40 -0
  176. package/bin/retailWizard/events/RetailPromotionInboundMessage.js +162 -0
  177. package/bin/retailWizard/events/SaleCompletedV1.d.ts +2 -3
  178. package/bin/retailWizard/index.d.ts +13 -0
  179. package/bin/retailWizard/index.js +14 -0
  180. package/package.json +1 -1
  181. package/src/index.ts +3 -0
  182. package/src/retailCatalog/dtos/Product.ts +9 -0
  183. package/src/retailCatalog/dtos/requests/BackofficeCreateProductRequest.ts +36 -1
  184. package/src/retailCatalog/dtos/requests/BackofficeRegisterAdjustmentRequest.ts +6 -0
  185. package/src/retailCatalog/dtos/requests/BackofficeUpdateProductRequest.ts +36 -1
  186. package/src/retailCatalog/dtos/requests/HoldStockRequest.ts +31 -0
  187. package/src/retailCatalog/dtos/requests/ReserveStockRequest.ts +7 -1
  188. package/src/retailCatalog/dtos/requests/SuggestPiecesQuery.ts +7 -1
  189. package/src/retailCatalog/dtos/responses/GetInventorySkuResponse.ts +3 -0
  190. package/src/retailCatalog/dtos/responses/HoldStockResponse.ts +9 -0
  191. package/src/retailCatalog/dtos/responses/StoreCatalogItem.ts +9 -1
  192. package/src/retailCatalog/enums/AccessorySubcategoryEnum.ts +9 -0
  193. package/src/retailCatalog/enums/InventoryInboundMessageTypeEnum.ts +5 -0
  194. package/src/retailCatalog/enums/InventoryItemStatusEnum.ts +3 -1
  195. package/src/retailCatalog/enums/ReservePurposeEnum.ts +4 -0
  196. package/src/retailCatalog/events/InventoryInboundMessage.ts +5 -0
  197. package/src/retailCatalog/events/InventoryReturnMessage.ts +26 -0
  198. package/src/retailCatalog/events/InventorySaleAppliedMessage.ts +26 -0
  199. package/src/retailCatalog/index.ts +10 -0
  200. package/src/retailPromotions/constants/bonusPreMoney.ts +19 -0
  201. package/src/retailPromotions/constants/retailPromotionsErrorHttpStatus.ts +25 -0
  202. package/src/retailPromotions/constants/salePromotionTransitions.ts +11 -0
  203. package/src/retailPromotions/dtos/DiscountCode.ts +36 -0
  204. package/src/retailPromotions/dtos/DiscountValue.ts +8 -0
  205. package/src/retailPromotions/dtos/LinePromotionDiscount.ts +10 -0
  206. package/src/retailPromotions/dtos/SalePromotion.ts +36 -0
  207. package/src/retailPromotions/dtos/SalePromotionLevers.ts +68 -0
  208. package/src/retailPromotions/dtos/SalePromotionLogEntry.ts +19 -0
  209. package/src/retailPromotions/dtos/requests/ChangeDiscountCodeStatusRequest.ts +15 -0
  210. package/src/retailPromotions/dtos/requests/ChangeSalePromotionStatusRequest.ts +15 -0
  211. package/src/retailPromotions/dtos/requests/CreateDiscountCodeRequest.ts +71 -0
  212. package/src/retailPromotions/dtos/requests/CreateSalePromotionRequest.ts +73 -0
  213. package/src/retailPromotions/dtos/requests/DiscountValueInput.ts +21 -0
  214. package/src/retailPromotions/dtos/requests/EvaluateSalePromotionsRequest.ts +16 -0
  215. package/src/retailPromotions/dtos/requests/GetSaleCouponQuery.ts +11 -0
  216. package/src/retailPromotions/dtos/requests/HoldSalePromotionRequest.ts +32 -0
  217. package/src/retailPromotions/dtos/requests/ListDiscountCodesQuery.ts +33 -0
  218. package/src/retailPromotions/dtos/requests/ListSalePromotionLogQuery.ts +29 -0
  219. package/src/retailPromotions/dtos/requests/ListSalePromotionsQuery.ts +24 -0
  220. package/src/retailPromotions/dtos/requests/ListStoreSalePromotionsQuery.ts +10 -0
  221. package/src/retailPromotions/dtos/requests/SalePromotionLeversInput.ts +135 -0
  222. package/src/retailPromotions/dtos/requests/SalePromotionScopeInput.ts +45 -0
  223. package/src/retailPromotions/dtos/requests/UpdateSalePromotionRequest.ts +74 -0
  224. package/src/retailPromotions/dtos/responses/DiscountCodeResponses.ts +9 -0
  225. package/src/retailPromotions/dtos/responses/SalePromotionCrudResponses.ts +35 -0
  226. package/src/retailPromotions/dtos/responses/WizardSalePromotionResponses.ts +115 -0
  227. package/src/retailPromotions/enums/CouponScopeEnum.ts +11 -0
  228. package/src/retailPromotions/enums/CouponStatusEnum.ts +11 -0
  229. package/src/retailPromotions/enums/DiscountCodeOriginEnum.ts +8 -0
  230. package/src/retailPromotions/enums/DiscountCodeStatusEnum.ts +11 -0
  231. package/src/retailPromotions/enums/DiscountCodeTransitionEnum.ts +7 -0
  232. package/src/retailPromotions/enums/DiscountTypeEnum.ts +8 -0
  233. package/src/retailPromotions/enums/EntitlementKindEnum.ts +9 -0
  234. package/src/retailPromotions/enums/EntitlementStateEnum.ts +13 -0
  235. package/src/retailPromotions/enums/GiftModeEnum.ts +8 -0
  236. package/src/retailPromotions/enums/PromotionAppliesToEnum.ts +9 -0
  237. package/src/retailPromotions/enums/RetailPromotionsErrorCodeEnum.ts +29 -0
  238. package/src/retailPromotions/enums/SaleCouponAvailabilityEnum.ts +10 -0
  239. package/src/retailPromotions/enums/SalePromotionLeverEnum.ts +13 -0
  240. package/src/retailPromotions/enums/SalePromotionLogEventEnum.ts +14 -0
  241. package/src/retailPromotions/enums/SalePromotionLogFormatEnum.ts +5 -0
  242. package/src/retailPromotions/enums/SalePromotionPhaseEnum.ts +11 -0
  243. package/src/retailPromotions/enums/SalePromotionStatusEnum.ts +12 -0
  244. package/src/retailPromotions/enums/SalePromotionTransitionEnum.ts +13 -0
  245. package/src/retailPromotions/helpers/computeBudgetUsedBps.ts +15 -0
  246. package/src/retailPromotions/helpers/resolveSalePromotionTransition.ts +12 -0
  247. package/src/retailPromotions/index.ts +56 -0
  248. package/src/retailWizard/dtos/Sale.ts +8 -8
  249. package/src/retailWizard/dtos/SaleLine.ts +4 -1
  250. package/src/retailWizard/dtos/WizardFinancingPreview.ts +12 -0
  251. package/src/retailWizard/dtos/WizardGiftLine.ts +11 -0
  252. package/src/retailWizard/dtos/WizardLinePromotionFields.ts +16 -0
  253. package/src/retailWizard/dtos/WizardReservedLine.ts +4 -1
  254. package/src/retailWizard/dtos/WizardSession.ts +10 -0
  255. package/src/retailWizard/dtos/requests/AddProductRequest.ts +8 -1
  256. package/src/retailWizard/dtos/requests/ApplyLinePromotionRequest.ts +44 -0
  257. package/src/retailWizard/dtos/requests/ApplySalePromotionRequest.ts +24 -0
  258. package/src/retailWizard/dtos/requests/PinSessionPiecesRequest.ts +40 -0
  259. package/src/retailWizard/dtos/requests/QuoteRequest.ts +1 -1
  260. package/src/retailWizard/dtos/requests/SetAnchorGiftsRequest.ts +40 -0
  261. package/src/retailWizard/dtos/responses/PrivateWizardSessionResponse.ts +30 -0
  262. package/src/retailWizard/dtos/responses/SetAnchorGiftsResponse.ts +6 -0
  263. package/src/retailWizard/enums/RetailPromotionInboundMessageTypeEnum.ts +5 -0
  264. package/src/retailWizard/enums/WizardLineRoleEnum.ts +4 -0
  265. package/src/retailWizard/events/RetailCommissionInboundMessage.ts +54 -0
  266. package/src/retailWizard/events/RetailPromotionInboundMessage.ts +140 -0
  267. package/src/retailWizard/events/SaleCompletedV1.ts +2 -3
  268. package/src/retailWizard/index.ts +15 -0
@@ -0,0 +1,56 @@
1
+ // Enums
2
+ export * from './enums/SalePromotionStatusEnum';
3
+ export * from './enums/SalePromotionTransitionEnum';
4
+ export * from './enums/SalePromotionPhaseEnum';
5
+ export * from './enums/SalePromotionLeverEnum';
6
+ export * from './enums/SalePromotionLogEventEnum';
7
+ export * from './enums/SalePromotionLogFormatEnum';
8
+ export * from './enums/DiscountTypeEnum';
9
+ export * from './enums/GiftModeEnum';
10
+ export * from './enums/PromotionAppliesToEnum';
11
+ export * from './enums/CouponScopeEnum';
12
+ export * from './enums/CouponStatusEnum';
13
+ export * from './enums/DiscountCodeStatusEnum';
14
+ export * from './enums/DiscountCodeOriginEnum';
15
+ export * from './enums/DiscountCodeTransitionEnum';
16
+ export * from './enums/EntitlementStateEnum';
17
+ export * from './enums/EntitlementKindEnum';
18
+ export * from './enums/SaleCouponAvailabilityEnum';
19
+ export * from './enums/RetailPromotionsErrorCodeEnum';
20
+
21
+ // Constantes y helpers puros
22
+ export * from './constants/retailPromotionsErrorHttpStatus';
23
+ export * from './constants/salePromotionTransitions';
24
+ export * from './constants/bonusPreMoney';
25
+ export * from './helpers/resolveSalePromotionTransition';
26
+ export * from './helpers/computeBudgetUsedBps';
27
+
28
+ // Entidades del dominio
29
+ export * from './dtos/DiscountValue';
30
+ export * from './dtos/SalePromotionLevers';
31
+ export * from './dtos/SalePromotion';
32
+ export * from './dtos/SalePromotionLogEntry';
33
+ export * from './dtos/DiscountCode';
34
+ export * from './dtos/LinePromotionDiscount';
35
+
36
+ // Request DTOs
37
+ export * from './dtos/requests/DiscountValueInput';
38
+ export * from './dtos/requests/SalePromotionLeversInput';
39
+ export * from './dtos/requests/SalePromotionScopeInput';
40
+ export * from './dtos/requests/CreateSalePromotionRequest';
41
+ export * from './dtos/requests/UpdateSalePromotionRequest';
42
+ export * from './dtos/requests/ChangeSalePromotionStatusRequest';
43
+ export * from './dtos/requests/ListSalePromotionsQuery';
44
+ export * from './dtos/requests/ListSalePromotionLogQuery';
45
+ export * from './dtos/requests/CreateDiscountCodeRequest';
46
+ export * from './dtos/requests/ListDiscountCodesQuery';
47
+ export * from './dtos/requests/ChangeDiscountCodeStatusRequest';
48
+ export * from './dtos/requests/ListStoreSalePromotionsQuery';
49
+ export * from './dtos/requests/EvaluateSalePromotionsRequest';
50
+ export * from './dtos/requests/HoldSalePromotionRequest';
51
+ export * from './dtos/requests/GetSaleCouponQuery';
52
+
53
+ // Response DTOs
54
+ export * from './dtos/responses/SalePromotionCrudResponses';
55
+ export * from './dtos/responses/DiscountCodeResponses';
56
+ export * from './dtos/responses/WizardSalePromotionResponses';
@@ -27,18 +27,18 @@ export interface Sale {
27
27
  skus?: string[];
28
28
  /** La cancelación aún no confirma la devolución al inventario. */
29
29
  inventoryReturnPending?: boolean;
30
+ /** Venta de la saga: el inventario se aplica y se devuelve por la cola, no por HTTP. */
31
+ inventoryViaQueue?: boolean;
32
+ /** Promo de venta congelada al cerrar; `null` = ninguna. */
33
+ salePromotionId?: string | null;
34
+ salePromotionVersion?: number | null;
30
35
  /** IMEI consumido del silo también en contado (local-first); null en EXTERNAL_REFERRAL (D15). */
31
36
  imei: string | null;
32
- /**
33
- * Lo COBRADO en caja al cerrar. En contado == precio del equipo (lo garantiza `registerPayment`);
34
- * en crédito es SOLO el enganche. ⚠️ Su significado es contrato de `SaleCompletedV1` (La Central,
35
- * comisión F4): no redefinir — el precio del equipo viaja aparte en `equipmentPriceCents`. 0 en
36
- * EXTERNAL_REFERRAL.
37
- */
37
+ /** Lo cobrado en caja al cerrar: enganche + lo no financiado; 0 en EXTERNAL_REFERRAL. Contrato de `SaleCompletedV1`. */
38
38
  amountCents: number;
39
39
  /**
40
- * Precio de lista del equipo al cerrar (de la reserva de la sesión). En contado coincide con
41
- * `amountCents`; en crédito es el precio full financiado. `null` en ventas anteriores al campo.
40
+ * Ancla neta al cerrar (precio − discountCents de la ancla); base de comisión.
41
+ * `null` en ventas anteriores al campo.
42
42
  */
43
43
  equipmentPriceCents: number | null;
44
44
  /** Enganche cobrado (solo ventas CREDIT; `null` en contado/externa). */
@@ -1,9 +1,10 @@
1
1
  import type { SoldLineComponent } from '../../retailCatalog/dtos/responses/SellStockResponse';
2
2
  import type { LinePaymentTypeEnum } from '../enums/LinePaymentTypeEnum';
3
3
  import type { WizardLineProduct } from './WizardLineProduct';
4
+ import type { WizardLinePromotionFields } from './WizardLinePromotionFields';
4
5
 
5
6
  /** Línea de una venta cerrada; un producto suelto es un solo componente. */
6
- export interface SaleLine {
7
+ export interface SaleLine extends WizardLinePromotionFields {
7
8
  lineId: string;
8
9
  sku: string;
9
10
  qty: number;
@@ -12,6 +13,8 @@ export interface SaleLine {
12
13
  /** Llave del registro PRICE# del que salió el precio. */
13
14
  priceSk: string;
14
15
  paymentType: LinePaymentTypeEnum;
16
+ /** Parte financiada de la línea, congelada en la venta. */
17
+ financedCents?: number;
15
18
  components: SoldLineComponent[];
16
19
  product?: WizardLineProduct | null;
17
20
  }
@@ -0,0 +1,12 @@
1
+ /** Parte financiada de una línea en el reparto provisional. */
2
+ export interface WizardFinancingPreviewLine {
3
+ lineId: string;
4
+ financedCents: number;
5
+ }
6
+
7
+ /** Reparto provisional de la sesión; se calcula al leer y no se persiste. */
8
+ export interface WizardFinancingPreview {
9
+ /** Tope de extras financiables: floor(30% × ancla neta). */
10
+ capCents: number;
11
+ lines: WizardFinancingPreviewLine[];
12
+ }
@@ -0,0 +1,11 @@
1
+ import type { WizardLineRoleEnum } from '../enums/WizardLineRoleEnum';
2
+ import type { WizardReservedLine } from './WizardReservedLine';
3
+
4
+ /** Línea GIFT: ligada a un ancla, con su promo y el precio de lista que se regala. */
5
+ export type WizardGiftLine = WizardReservedLine & {
6
+ role: WizardLineRoleEnum.GIFT;
7
+ linkedLineId: string;
8
+ promotionId: string;
9
+ promotionVersion: number;
10
+ originalPriceCents: number;
11
+ };
@@ -0,0 +1,16 @@
1
+ import type { WizardLineRoleEnum } from '../enums/WizardLineRoleEnum';
2
+
3
+ /** Campos de Promociones en la línea de sesión y de venta; solo los escribe su endpoint M2M. */
4
+ export interface WizardLinePromotionFields {
5
+ role?: WizardLineRoleEnum;
6
+ promotionId?: string;
7
+ promotionVersion?: number;
8
+ /** Línea ancla a la que va ligado el regalo. */
9
+ linkedLineId?: string;
10
+ /** Solo en la línea ancla. */
11
+ discountCode?: string;
12
+ /** Descuento total de la línea; neto = basePriceCents × qty − discountCents. */
13
+ discountCents?: number;
14
+ /** Precio antes del descuento; en un regalo, el valor de lista con la línea a $0. */
15
+ originalPriceCents?: number;
16
+ }
@@ -4,9 +4,10 @@ import type { LinePaymentTypeEnum } from '../enums/LinePaymentTypeEnum';
4
4
  import type { WizardLineStatusEnum } from '../enums/WizardLineStatusEnum';
5
5
  import type { WizardLineIdentifiers } from './WizardLineIdentifiers';
6
6
  import type { WizardLineProduct } from './WizardLineProduct';
7
+ import type { WizardLinePromotionFields } from './WizardLinePromotionFields';
7
8
 
8
9
  /** Línea de la venta en curso; los campos de precio son `null` mientras la línea está PENDING. */
9
- export interface WizardReservedLine {
10
+ export interface WizardReservedLine extends WizardLinePromotionFields {
10
11
  lineId: string;
11
12
  sku: string;
12
13
  qty: number;
@@ -27,6 +28,8 @@ export interface WizardReservedLine {
27
28
  paymentType: LinePaymentTypeEnum | null;
28
29
  /** Ítems que la línea suma al tope de 100 de la venta. */
29
30
  sellItemCost: number | null;
31
+ /** Parte financiada de la línea; se escribe al cotizar y se congela con el crédito. */
32
+ financedCents?: number;
30
33
  mdmEnabled?: boolean;
31
34
  mdmProvider?: MdmProviderEnum | null;
32
35
  /** Solo si la línea es un kit. */
@@ -6,6 +6,7 @@ import type { ExternalProviderEnum } from '../enums/ExternalProviderEnum';
6
6
  import type { OccupationEnum } from '../enums/OccupationEnum';
7
7
  import type { WizardBlockedSummary } from './WizardBlocked';
8
8
  import type { WizardConsents } from './WizardConsents';
9
+ import type { WizardFinancingPreview } from './WizardFinancingPreview';
9
10
  import type { WizardLoan } from './WizardLoan';
10
11
  import type { WizardPayment } from './WizardPayment';
11
12
  import type { WizardProduct } from './WizardProduct';
@@ -117,6 +118,15 @@ export interface WizardSession {
117
118
  reservedLines?: WizardReservedLine[];
118
119
  /** Línea elegida para financiar; `null` si la venta es de contado o aún no se elige. */
119
120
  financedLineId?: string | null;
121
+ /** Reparto provisional mientras haya líneas; se calcula al leer, no se persiste. */
122
+ financingPreview?: WizardFinancingPreview | null;
123
+ /** Marca de la saga: todas las piezas rastreadas de las líneas vivas quedaron HELD. */
124
+ piecesHeldAt?: string | null;
125
+ /** Promo de venta que fijó Promociones; `null` = ninguna. */
126
+ salePromotionId?: string | null;
127
+ salePromotionVersion?: number | null;
128
+ /** Enganche cobrado que queda por reembolsar tras cancelar. */
129
+ refundPendingCents?: number;
120
130
  paymentMethod: PaymentMethodEnum | null;
121
131
  externalProvider: ExternalProviderEnum | null;
122
132
  /** Folio de cobro server-side (D11), idempotente, sobrevive al volver atrás. */
@@ -1,5 +1,5 @@
1
1
  import { Expose } from 'class-transformer';
2
- import { IsInt, IsOptional, IsString, Min } from 'class-validator';
2
+ import { IsInt, IsOptional, IsString, Min, MinLength } from 'class-validator';
3
3
 
4
4
  /**
5
5
  * POST /wizard/sessions/:id/product — agrega una línea a la venta y reserva sus piezas en el catálogo.
@@ -27,4 +27,11 @@ export class AddProductRequest {
27
27
  @IsInt()
28
28
  @Min(1)
29
29
  qty?: number;
30
+
31
+ /** Línea viva que este kit reemplaza («Cambiar por el kit»). */
32
+ @Expose()
33
+ @IsOptional()
34
+ @IsString()
35
+ @MinLength(1)
36
+ replacesLineId?: string;
30
37
  }
@@ -0,0 +1,44 @@
1
+ import { Expose } from 'class-transformer';
2
+ import { IsInt, IsNotEmpty, IsOptional, IsString, Min, ValidateIf } from 'class-validator';
3
+
4
+ const hasPromotion = (o: ApplyLinePromotionRequest): boolean =>
5
+ o.promotionId !== undefined || o.promotionVersion !== undefined;
6
+
7
+ /**
8
+ * PUT …/lines/{lineId}/promotion (privateApplyLinePromotion): reemplaza la promo de la línea por valor.
9
+ * Un campo ausente queda borrado; no toca role ni linkedLineId. `tenantId` va en el query.
10
+ */
11
+ export class ApplyLinePromotionRequest {
12
+ @Expose()
13
+ @ValidateIf(hasPromotion)
14
+ @IsString()
15
+ @IsNotEmpty()
16
+ promotionId?: string;
17
+
18
+ /** Va junto con promotionId; las versiones de Promociones empiezan en 1. */
19
+ @Expose()
20
+ @ValidateIf(hasPromotion)
21
+ @IsInt()
22
+ @Min(1)
23
+ promotionVersion?: number;
24
+
25
+ /** Solo en la línea ancla. */
26
+ @Expose()
27
+ @IsOptional()
28
+ @IsString()
29
+ @IsNotEmpty()
30
+ discountCode?: string;
31
+
32
+ /** Descuento total de la línea; 0 mientras el código espera revalidarse. */
33
+ @Expose()
34
+ @IsOptional()
35
+ @IsInt()
36
+ @Min(0)
37
+ discountCents?: number;
38
+
39
+ @Expose()
40
+ @IsOptional()
41
+ @IsInt()
42
+ @Min(0)
43
+ originalPriceCents?: number;
44
+ }
@@ -0,0 +1,24 @@
1
+ import { Expose } from 'class-transformer';
2
+ import { IsInt, IsNotEmpty, IsString, Min, ValidateIf } from 'class-validator';
3
+
4
+ /**
5
+ * PUT /private/wizard/sessions/{id}/sale-promotion (privateApplySalePromotion, M2M de Promociones).
6
+ * Ambos en `null` = «Ninguna»; la versión va solo con la promo. `tenantId` va en el query.
7
+ * Responde 204 sin body.
8
+ */
9
+ export class ApplySalePromotionRequest {
10
+ @Expose()
11
+ @ValidateIf(
12
+ (o: ApplySalePromotionRequest) =>
13
+ o.salePromotionId !== null || (o.salePromotionVersion !== null && o.salePromotionVersion !== undefined),
14
+ )
15
+ @IsString()
16
+ @IsNotEmpty()
17
+ salePromotionId!: string | null;
18
+
19
+ @Expose()
20
+ @ValidateIf((o: ApplySalePromotionRequest) => o.salePromotionId !== null && o.salePromotionId !== undefined)
21
+ @IsInt()
22
+ @Min(1)
23
+ salePromotionVersion!: number | null;
24
+ }
@@ -0,0 +1,40 @@
1
+ import { Expose, Type } from 'class-transformer';
2
+ import { ArrayMinSize, IsArray, IsNotEmpty, IsString, ValidateNested } from 'class-validator';
3
+
4
+ /** Componente de la línea con los identificadores de sus piezas. */
5
+ export class PinSessionPiecesComponent {
6
+ @Expose()
7
+ @IsString()
8
+ @IsNotEmpty()
9
+ sku!: string;
10
+
11
+ @Expose()
12
+ @IsArray()
13
+ @IsString({ each: true })
14
+ identifiers!: string[];
15
+ }
16
+
17
+ /** Línea de la sesión cuyas piezas se fijan. */
18
+ export class PinSessionPiecesLine {
19
+ @Expose()
20
+ @IsString()
21
+ @IsNotEmpty()
22
+ lineId!: string;
23
+
24
+ @Expose()
25
+ @IsArray()
26
+ @ArrayMinSize(1)
27
+ @ValidateNested({ each: true })
28
+ @Type(() => PinSessionPiecesComponent)
29
+ components!: PinSessionPiecesComponent[];
30
+ }
31
+
32
+ /** POST /wizard/sessions/:id/pieces (publicPinSessionPieces) — deja HELD las piezas de las líneas. */
33
+ export class PinSessionPiecesRequest {
34
+ @Expose()
35
+ @IsArray()
36
+ @ArrayMinSize(1)
37
+ @ValidateNested({ each: true })
38
+ @Type(() => PinSessionPiecesLine)
39
+ lines!: PinSessionPiecesLine[];
40
+ }
@@ -19,7 +19,7 @@ export class QuoteRequest {
19
19
  @Min(1)
20
20
  termWeeks!: number;
21
21
 
22
- /** Línea que se financia; su precio fijado es el del crédito. */
22
+ /** Se ignora: el servidor financia la ancla. */
23
23
  @Expose()
24
24
  @IsOptional()
25
25
  @IsString()
@@ -0,0 +1,40 @@
1
+ import { Expose, Type } from 'class-transformer';
2
+ import { IsArray, IsInt, IsNotEmpty, IsString, Min, ValidateIf, ValidateNested } from 'class-validator';
3
+
4
+ /** Un regalo del conjunto que queda ligado al ancla. */
5
+ export class AnchorGiftItem {
6
+ @Expose()
7
+ @IsString()
8
+ @IsNotEmpty()
9
+ sku!: string;
10
+ }
11
+
12
+ /** Hay que validar el campo si hay regalos o si vino con valor. */
13
+ function mustValidate(o: SetAnchorGiftsRequest, value: unknown): boolean {
14
+ return (Array.isArray(o.items) && o.items.length > 0) || (value !== null && value !== undefined);
15
+ }
16
+
17
+ /**
18
+ * PUT /private/wizard/sessions/{id}/lines/{anchorLineId}/gifts (M2M de Promociones).
19
+ * Deja exactamente esos GIFT en el ancla; `items: []` suelta todos. `tenantId` va en el query.
20
+ */
21
+ export class SetAnchorGiftsRequest {
22
+ /** Obligatorio si hay regalos; puede ir `null` con `items: []`. */
23
+ @Expose()
24
+ @ValidateIf((o: SetAnchorGiftsRequest) => mustValidate(o, o.promotionId))
25
+ @IsString()
26
+ @IsNotEmpty()
27
+ promotionId!: string | null;
28
+
29
+ @Expose()
30
+ @ValidateIf((o: SetAnchorGiftsRequest) => mustValidate(o, o.promotionVersion))
31
+ @IsInt()
32
+ @Min(1)
33
+ promotionVersion!: number | null;
34
+
35
+ @Expose()
36
+ @IsArray()
37
+ @ValidateNested({ each: true })
38
+ @Type(() => AnchorGiftItem)
39
+ items!: AnchorGiftItem[];
40
+ }
@@ -0,0 +1,30 @@
1
+ import type { PaymentMethodEnum } from '../../enums/PaymentMethodEnum';
2
+ import type { WizardStateEnum } from '../../enums/WizardStateEnum';
3
+ import type { WizardStepEnum } from '../../enums/WizardStepEnum';
4
+ import type { WizardPayment } from '../WizardPayment';
5
+ import type { WizardReservedLine } from '../WizardReservedLine';
6
+
7
+ /** GET /private/wizard/sessions/{id} (privateGetWizardSession): lo que Promociones lee de la sesión. */
8
+ export interface PrivateWizardSessionResponse {
9
+ sessionId: string;
10
+ retailerId: string;
11
+ storeId: string;
12
+ /** `null` mientras el KYC no dé de alta al cliente. */
13
+ retailCustomerId: string | null;
14
+ state: WizardStateEnum;
15
+ currentStep: WizardStepEnum;
16
+ /** `loan.creditId`; `null` en contado o antes de originar. */
17
+ creditId: string | null;
18
+ /** Línea ancla (teléfono o kit) que deriva el servidor; `null` si aún no hay. */
19
+ anchorLineId: string | null;
20
+ salePromotionId: string | null;
21
+ salePromotionVersion: number | null;
22
+ /** Líneas vivas con los campos de Promociones y financedCents. */
23
+ lines: WizardReservedLine[];
24
+ fiadoDirectoryId?: string | null;
25
+ folio?: string | null;
26
+ /** Forma de pago que eligió el vendedor; existe antes que `creditId`. */
27
+ paymentMethod?: PaymentMethodEnum | null;
28
+ /** Cobro de contado; `null` mientras no se cobra. */
29
+ payment?: WizardPayment | null;
30
+ }
@@ -0,0 +1,6 @@
1
+ import type { WizardGiftLine } from '../WizardGiftLine';
2
+
3
+ /** Respuesta del PUT de regalos: las líneas GIFT que quedaron ligadas al ancla. */
4
+ export interface SetAnchorGiftsResponse {
5
+ lines: WizardGiftLine[];
6
+ }
@@ -0,0 +1,5 @@
1
+ /** Tipo de mensaje que el wizard publica en la cola de Promociones. */
2
+ export enum RetailPromotionInboundMessageTypeEnum {
3
+ SALE_CONFIRMED = 'SALE_CONFIRMED',
4
+ SALE_CANCELLED = 'SALE_CANCELLED',
5
+ }
@@ -0,0 +1,4 @@
1
+ /** Papel especial de una línea; sin `role` es una línea normal. */
2
+ export enum WizardLineRoleEnum {
3
+ GIFT = 'GIFT',
4
+ }
@@ -0,0 +1,54 @@
1
+ import { Type } from 'class-transformer';
2
+ import { ArrayMinSize, IsArray, IsEnum, IsISO8601, IsInt, IsNotEmpty, IsString, Min, ValidateNested } from 'class-validator';
3
+ import { ItemTypeEnum } from '../../retailCatalog/enums/ItemTypeEnum';
4
+
5
+ /** Línea vendida en el mensaje de comisiones. */
6
+ export class RetailCommissionInboundLine {
7
+ @IsString()
8
+ @IsNotEmpty()
9
+ sku!: string;
10
+
11
+ @IsInt()
12
+ @Min(1)
13
+ qty!: number;
14
+
15
+ /** Precio neto de la línea (precio − descuento). */
16
+ @IsInt()
17
+ @Min(0)
18
+ netCents!: number;
19
+
20
+ @IsEnum(ItemTypeEnum)
21
+ itemType!: ItemTypeEnum;
22
+ }
23
+
24
+ /** Venta de la saga que el wizard publica en la cola de comisiones, con sus líneas. */
25
+ export class RetailCommissionInboundMessage {
26
+ @IsString()
27
+ @IsNotEmpty()
28
+ tenantId!: string;
29
+
30
+ @IsString()
31
+ @IsNotEmpty()
32
+ retailerId!: string;
33
+
34
+ @IsString()
35
+ @IsNotEmpty()
36
+ storeId!: string;
37
+
38
+ @IsString()
39
+ @IsNotEmpty()
40
+ saleId!: string;
41
+
42
+ @IsString()
43
+ @IsNotEmpty()
44
+ sessionId!: string;
45
+
46
+ @IsISO8601()
47
+ soldAt!: string;
48
+
49
+ @IsArray()
50
+ @ArrayMinSize(1)
51
+ @ValidateNested({ each: true })
52
+ @Type(() => RetailCommissionInboundLine)
53
+ lines!: RetailCommissionInboundLine[];
54
+ }
@@ -0,0 +1,140 @@
1
+ import { Type } from 'class-transformer';
2
+ import {
3
+ ArrayMinSize,
4
+ IsArray,
5
+ IsBoolean,
6
+ IsEnum,
7
+ IsISO8601,
8
+ IsInt,
9
+ IsNotEmpty,
10
+ IsOptional,
11
+ IsString,
12
+ Min,
13
+ ValidateNested,
14
+ } from 'class-validator';
15
+ import { RetailPromotionInboundMessageTypeEnum } from '../enums/RetailPromotionInboundMessageTypeEnum';
16
+ import { WizardLineRoleEnum } from '../enums/WizardLineRoleEnum';
17
+
18
+ /** Línea de la venta en el mensaje de Promociones. */
19
+ export class RetailPromotionInboundLine {
20
+ @IsString()
21
+ @IsNotEmpty()
22
+ lineId!: string;
23
+
24
+ @IsString()
25
+ @IsNotEmpty()
26
+ sku!: string;
27
+
28
+ @IsInt()
29
+ @Min(1)
30
+ qty!: number;
31
+
32
+ @IsOptional()
33
+ @IsEnum(WizardLineRoleEnum)
34
+ role?: WizardLineRoleEnum;
35
+
36
+ @IsOptional()
37
+ @IsString()
38
+ @IsNotEmpty()
39
+ linkedLineId?: string;
40
+
41
+ @IsOptional()
42
+ @IsString()
43
+ @IsNotEmpty()
44
+ promotionId?: string;
45
+
46
+ @IsOptional()
47
+ @IsInt()
48
+ @Min(1)
49
+ promotionVersion?: number;
50
+
51
+ /** Solo en la línea ancla. */
52
+ @IsOptional()
53
+ @IsString()
54
+ @IsNotEmpty()
55
+ discountCode?: string;
56
+
57
+ @IsOptional()
58
+ @IsInt()
59
+ @Min(0)
60
+ discountCents?: number;
61
+
62
+ /** Si la línea no lo trae, basePriceCents × qty. */
63
+ @IsInt()
64
+ @Min(0)
65
+ originalPriceCents!: number;
66
+
67
+ /** Identificadores de todos los componentes de la línea, aplanados. */
68
+ @IsArray()
69
+ @IsString({ each: true })
70
+ identifiers!: string[];
71
+
72
+ /** Solo en SALE_CANCELLED: la pieza regresó al inventario. */
73
+ @IsOptional()
74
+ @IsBoolean()
75
+ returned?: boolean;
76
+ }
77
+
78
+ /** Venta confirmada o cancelada que el wizard publica en RetailPromotionInboundQueue; crédito = trae creditId. */
79
+ export class RetailPromotionInboundMessage {
80
+ @IsEnum(RetailPromotionInboundMessageTypeEnum)
81
+ type!: RetailPromotionInboundMessageTypeEnum;
82
+
83
+ @IsString()
84
+ @IsNotEmpty()
85
+ tenantId!: string;
86
+
87
+ @IsString()
88
+ @IsNotEmpty()
89
+ retailerId!: string;
90
+
91
+ @IsString()
92
+ @IsNotEmpty()
93
+ storeId!: string;
94
+
95
+ @IsString()
96
+ @IsNotEmpty()
97
+ saleId!: string;
98
+
99
+ @IsString()
100
+ @IsNotEmpty()
101
+ sessionId!: string;
102
+
103
+ /** El retailCustomerId de la venta. */
104
+ @IsString()
105
+ @IsNotEmpty()
106
+ customerId!: string;
107
+
108
+ @IsISO8601()
109
+ soldAt!: string;
110
+
111
+ /** soldAt en la confirmación; cancelledAt en la cancelación. */
112
+ @IsISO8601()
113
+ occurredAt!: string;
114
+
115
+ @IsOptional()
116
+ @IsString()
117
+ @IsNotEmpty()
118
+ creditId?: string;
119
+
120
+ @IsOptional()
121
+ @IsString()
122
+ @IsNotEmpty()
123
+ fiadoDirectoryId?: string;
124
+
125
+ @IsOptional()
126
+ @IsString()
127
+ @IsNotEmpty()
128
+ salePromotionId?: string | null;
129
+
130
+ @IsOptional()
131
+ @IsInt()
132
+ @Min(1)
133
+ salePromotionVersion?: number | null;
134
+
135
+ @IsArray()
136
+ @ArrayMinSize(1)
137
+ @ValidateNested({ each: true })
138
+ @Type(() => RetailPromotionInboundLine)
139
+ lines!: RetailPromotionInboundLine[];
140
+ }
@@ -14,9 +14,8 @@ export interface SaleCompletedV1 {
14
14
  sku: string;
15
15
  imei: string | null;
16
16
  /**
17
- * Lo COBRADO en caja al cerrar (contrato histórico — La Central y comisión F4 lo asumen así).
18
- * En contado == precio del equipo; en CREDIT es SOLO el enganche: desambiguar con `type` +
19
- * `equipmentPriceCents`, NUNCA redefinir este campo.
17
+ * Lo cobrado en caja al cerrar: enganche + lo no financiado (en contado, el total).
18
+ * Desambiguar con `type` + `equipmentPriceCents`.
20
19
  */
21
20
  amountCents: number;
22
21
  /**