@stamhoofd/structures 2.106.1 → 2.107.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 (325) hide show
  1. package/dist/index.d.ts +1 -2
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +2 -2
  4. package/dist/index.js.map +1 -1
  5. package/dist/src/AppliedRegistrationDiscount.d.ts +1 -1
  6. package/dist/src/AppliedRegistrationDiscount.d.ts.map +1 -1
  7. package/dist/src/AppliedRegistrationDiscount.js +3 -1
  8. package/dist/src/AppliedRegistrationDiscount.js.map +1 -1
  9. package/dist/src/BalanceItem.d.ts +90 -14
  10. package/dist/src/BalanceItem.d.ts.map +1 -1
  11. package/dist/src/BalanceItem.js +173 -24
  12. package/dist/src/BalanceItem.js.map +1 -1
  13. package/dist/src/Document.d.ts.map +1 -1
  14. package/dist/src/Document.js +9 -4
  15. package/dist/src/Document.js.map +1 -1
  16. package/dist/src/GenericBalance.d.ts.map +1 -1
  17. package/dist/src/GenericBalance.js +5 -2
  18. package/dist/src/GenericBalance.js.map +1 -1
  19. package/dist/src/GroupPriceDiscount.d.ts +1 -0
  20. package/dist/src/GroupPriceDiscount.d.ts.map +1 -1
  21. package/dist/src/GroupPriceDiscount.js +28 -2
  22. package/dist/src/GroupPriceDiscount.js.map +1 -1
  23. package/dist/src/OldGroupPrices.d.ts.map +1 -1
  24. package/dist/src/OldGroupPrices.js +13 -6
  25. package/dist/src/OldGroupPrices.js.map +1 -1
  26. package/dist/src/OrganizationPrivateMetaData.d.ts.map +1 -1
  27. package/dist/src/OrganizationPrivateMetaData.js +3 -1
  28. package/dist/src/OrganizationPrivateMetaData.js.map +1 -1
  29. package/dist/src/PaymentConfiguration.d.ts.map +1 -1
  30. package/dist/src/PaymentConfiguration.js +8 -4
  31. package/dist/src/PaymentConfiguration.js.map +1 -1
  32. package/dist/src/PaymentMandate.d.ts +13 -0
  33. package/dist/src/PaymentMandate.d.ts.map +1 -0
  34. package/dist/src/PaymentMandate.js +8 -0
  35. package/dist/src/PaymentMandate.js.map +1 -0
  36. package/dist/src/PaymentType.d.ts +1 -0
  37. package/dist/src/PaymentType.d.ts.map +1 -1
  38. package/dist/src/PaymentType.js +8 -0
  39. package/dist/src/PaymentType.js.map +1 -1
  40. package/dist/src/Platform.d.ts.map +1 -1
  41. package/dist/src/Platform.js +3 -1
  42. package/dist/src/Platform.js.map +1 -1
  43. package/dist/src/ReceivableBalance.d.ts.map +1 -1
  44. package/dist/src/ReceivableBalance.js +9 -4
  45. package/dist/src/ReceivableBalance.js.map +1 -1
  46. package/dist/src/ReduceablePrice.d.ts.map +1 -1
  47. package/dist/src/ReduceablePrice.js +5 -2
  48. package/dist/src/ReduceablePrice.js.map +1 -1
  49. package/dist/src/RegisterCodeStatus.d.ts.map +1 -1
  50. package/dist/src/RegisterCodeStatus.js +9 -4
  51. package/dist/src/RegisterCodeStatus.js.map +1 -1
  52. package/dist/src/SeatingPlan.d.ts.map +1 -1
  53. package/dist/src/SeatingPlan.js +5 -2
  54. package/dist/src/SeatingPlan.js.map +1 -1
  55. package/dist/src/UitpasClientCredentialsStatus.d.ts +1 -1
  56. package/dist/src/Version.d.ts +1 -1
  57. package/dist/src/Version.js +1 -1
  58. package/dist/src/billing/Invoice.d.ts +51 -0
  59. package/dist/src/billing/Invoice.d.ts.map +1 -0
  60. package/dist/src/billing/Invoice.js +57 -0
  61. package/dist/src/billing/Invoice.js.map +1 -0
  62. package/dist/src/billing/InvoicedBalanceItem.d.ts +29 -0
  63. package/dist/src/billing/InvoicedBalanceItem.d.ts.map +1 -0
  64. package/dist/src/billing/InvoicedBalanceItem.js +64 -0
  65. package/dist/src/billing/InvoicedBalanceItem.js.map +1 -0
  66. package/dist/src/billing/STCredit.d.ts.map +1 -1
  67. package/dist/src/billing/STCredit.js +3 -1
  68. package/dist/src/billing/STCredit.js.map +1 -1
  69. package/dist/src/billing/STInvoice.d.ts +32 -5
  70. package/dist/src/billing/STInvoice.d.ts.map +1 -1
  71. package/dist/src/billing/STInvoice.js +70 -21
  72. package/dist/src/billing/STInvoice.js.map +1 -1
  73. package/dist/src/billing/STPackage.d.ts.map +1 -1
  74. package/dist/src/billing/STPackage.js +19 -9
  75. package/dist/src/billing/STPackage.js.map +1 -1
  76. package/dist/src/billing/STPackageBundle.js +2 -2
  77. package/dist/src/billing/STPackageBundle.js.map +1 -1
  78. package/dist/src/billing/index.d.ts +2 -0
  79. package/dist/src/billing/index.d.ts.map +1 -1
  80. package/dist/src/billing/index.js +2 -0
  81. package/dist/src/billing/index.js.map +1 -1
  82. package/dist/src/checkout/CheckoutResponse.d.ts +27 -0
  83. package/dist/src/checkout/CheckoutResponse.d.ts.map +1 -0
  84. package/dist/src/checkout/CheckoutResponse.js +47 -0
  85. package/dist/src/checkout/CheckoutResponse.js.map +1 -0
  86. package/dist/src/checkout/Checkoutable.d.ts +65 -0
  87. package/dist/src/checkout/Checkoutable.d.ts.map +1 -0
  88. package/dist/src/checkout/Checkoutable.js +96 -0
  89. package/dist/src/checkout/Checkoutable.js.map +1 -0
  90. package/dist/src/checkout/PackageCheckout.d.ts +17 -0
  91. package/dist/src/checkout/PackageCheckout.d.ts.map +1 -0
  92. package/dist/src/checkout/PackageCheckout.js +26 -0
  93. package/dist/src/checkout/PackageCheckout.js.map +1 -0
  94. package/dist/src/checkout/index.d.ts +3 -0
  95. package/dist/src/checkout/index.d.ts.map +1 -0
  96. package/dist/src/checkout/index.js +6 -0
  97. package/dist/src/checkout/index.js.map +1 -0
  98. package/dist/src/endpoints/ChargeMembershipsSummary.d.ts.map +1 -1
  99. package/dist/src/endpoints/ChargeMembershipsSummary.js +5 -2
  100. package/dist/src/endpoints/ChargeMembershipsSummary.js.map +1 -1
  101. package/dist/src/endpoints/PayableBalanceCollection.d.ts.map +1 -1
  102. package/dist/src/endpoints/PayableBalanceCollection.js +7 -3
  103. package/dist/src/endpoints/PayableBalanceCollection.js.map +1 -1
  104. package/dist/src/endpoints/UitpasPriceCheckRequest.d.ts.map +1 -1
  105. package/dist/src/endpoints/UitpasPriceCheckRequest.js +5 -2
  106. package/dist/src/endpoints/UitpasPriceCheckRequest.js.map +1 -1
  107. package/dist/src/filters/FilterCompilers.d.ts.map +1 -1
  108. package/dist/src/filters/FilterCompilers.js +16 -3
  109. package/dist/src/filters/FilterCompilers.js.map +1 -1
  110. package/dist/src/filters/convertOldPropertyFilter.d.ts.map +1 -1
  111. package/dist/src/filters/convertOldPropertyFilter.js +4 -8
  112. package/dist/src/filters/convertOldPropertyFilter.js.map +1 -1
  113. package/dist/src/members/MemberPlatformMembership.d.ts.map +1 -1
  114. package/dist/src/members/MemberPlatformMembership.js +5 -2
  115. package/dist/src/members/MemberPlatformMembership.js.map +1 -1
  116. package/dist/src/members/OrganizationRecordsConfiguration.d.ts.map +1 -1
  117. package/dist/src/members/OrganizationRecordsConfiguration.js +18 -2
  118. package/dist/src/members/OrganizationRecordsConfiguration.js.map +1 -1
  119. package/dist/src/members/Payment.d.ts.map +1 -1
  120. package/dist/src/members/Payment.js +17 -8
  121. package/dist/src/members/Payment.js.map +1 -1
  122. package/dist/src/members/PaymentGeneral.d.ts.map +1 -1
  123. package/dist/src/members/PaymentGeneral.js +9 -4
  124. package/dist/src/members/PaymentGeneral.js.map +1 -1
  125. package/dist/src/members/checkout/BalanceItemCartItem.d.ts.map +1 -1
  126. package/dist/src/members/checkout/BalanceItemCartItem.js +3 -1
  127. package/dist/src/members/checkout/BalanceItemCartItem.js.map +1 -1
  128. package/dist/src/members/checkout/RegisterCart.test.js +305 -259
  129. package/dist/src/members/checkout/RegisterCart.test.js.map +1 -1
  130. package/dist/src/members/checkout/RegisterCheckout.d.ts.map +1 -1
  131. package/dist/src/members/checkout/RegisterCheckout.js +28 -23
  132. package/dist/src/members/checkout/RegisterCheckout.js.map +1 -1
  133. package/dist/src/members/checkout/RegisterItem.d.ts.map +1 -1
  134. package/dist/src/members/checkout/RegisterItem.js +3 -1
  135. package/dist/src/members/checkout/RegisterItem.js.map +1 -1
  136. package/dist/src/upgradePriceFrom2To4DecimalPlaces.d.ts +9 -0
  137. package/dist/src/upgradePriceFrom2To4DecimalPlaces.d.ts.map +1 -0
  138. package/dist/src/upgradePriceFrom2To4DecimalPlaces.js +29 -0
  139. package/dist/src/upgradePriceFrom2To4DecimalPlaces.js.map +1 -0
  140. package/dist/src/webshops/CartItem.d.ts.map +1 -1
  141. package/dist/src/webshops/CartItem.js +8 -4
  142. package/dist/src/webshops/CartItem.js.map +1 -1
  143. package/dist/src/webshops/Checkout.d.ts.map +1 -1
  144. package/dist/src/webshops/Checkout.js +6 -3
  145. package/dist/src/webshops/Checkout.js.map +1 -1
  146. package/dist/src/webshops/Discount.d.ts.map +1 -1
  147. package/dist/src/webshops/Discount.js +6 -3
  148. package/dist/src/webshops/Discount.js.map +1 -1
  149. package/dist/src/webshops/Product.d.ts.map +1 -1
  150. package/dist/src/webshops/Product.js +7 -3
  151. package/dist/src/webshops/Product.js.map +1 -1
  152. package/dist/src/webshops/UitpasNumberAndPrice.d.ts.map +1 -1
  153. package/dist/src/webshops/UitpasNumberAndPrice.js +3 -1
  154. package/dist/src/webshops/UitpasNumberAndPrice.js.map +1 -1
  155. package/dist/src/webshops/WebshopMetaData.d.ts.map +1 -1
  156. package/dist/src/webshops/WebshopMetaData.js +7 -3
  157. package/dist/src/webshops/WebshopMetaData.js.map +1 -1
  158. package/esm/dist/index.d.ts +1 -2
  159. package/esm/dist/index.d.ts.map +1 -1
  160. package/esm/dist/index.js +2 -2
  161. package/esm/dist/index.js.map +1 -1
  162. package/esm/dist/src/AppliedRegistrationDiscount.d.ts +1 -1
  163. package/esm/dist/src/AppliedRegistrationDiscount.d.ts.map +1 -1
  164. package/esm/dist/src/AppliedRegistrationDiscount.js +3 -1
  165. package/esm/dist/src/AppliedRegistrationDiscount.js.map +1 -1
  166. package/esm/dist/src/BalanceItem.d.ts +90 -14
  167. package/esm/dist/src/BalanceItem.d.ts.map +1 -1
  168. package/esm/dist/src/BalanceItem.js +172 -24
  169. package/esm/dist/src/BalanceItem.js.map +1 -1
  170. package/esm/dist/src/Document.d.ts.map +1 -1
  171. package/esm/dist/src/Document.js +9 -4
  172. package/esm/dist/src/Document.js.map +1 -1
  173. package/esm/dist/src/GenericBalance.d.ts.map +1 -1
  174. package/esm/dist/src/GenericBalance.js +5 -2
  175. package/esm/dist/src/GenericBalance.js.map +1 -1
  176. package/esm/dist/src/GroupPriceDiscount.d.ts +1 -0
  177. package/esm/dist/src/GroupPriceDiscount.d.ts.map +1 -1
  178. package/esm/dist/src/GroupPriceDiscount.js +28 -2
  179. package/esm/dist/src/GroupPriceDiscount.js.map +1 -1
  180. package/esm/dist/src/OldGroupPrices.d.ts.map +1 -1
  181. package/esm/dist/src/OldGroupPrices.js +13 -6
  182. package/esm/dist/src/OldGroupPrices.js.map +1 -1
  183. package/esm/dist/src/OrganizationPrivateMetaData.d.ts.map +1 -1
  184. package/esm/dist/src/OrganizationPrivateMetaData.js +3 -1
  185. package/esm/dist/src/OrganizationPrivateMetaData.js.map +1 -1
  186. package/esm/dist/src/PaymentConfiguration.d.ts.map +1 -1
  187. package/esm/dist/src/PaymentConfiguration.js +8 -4
  188. package/esm/dist/src/PaymentConfiguration.js.map +1 -1
  189. package/esm/dist/src/PaymentMandate.d.ts +13 -0
  190. package/esm/dist/src/PaymentMandate.d.ts.map +1 -0
  191. package/esm/dist/src/PaymentMandate.js +4 -0
  192. package/esm/dist/src/PaymentMandate.js.map +1 -0
  193. package/esm/dist/src/PaymentType.d.ts +1 -0
  194. package/esm/dist/src/PaymentType.d.ts.map +1 -1
  195. package/esm/dist/src/PaymentType.js +8 -0
  196. package/esm/dist/src/PaymentType.js.map +1 -1
  197. package/esm/dist/src/Platform.d.ts.map +1 -1
  198. package/esm/dist/src/Platform.js +3 -1
  199. package/esm/dist/src/Platform.js.map +1 -1
  200. package/esm/dist/src/ReceivableBalance.d.ts.map +1 -1
  201. package/esm/dist/src/ReceivableBalance.js +9 -4
  202. package/esm/dist/src/ReceivableBalance.js.map +1 -1
  203. package/esm/dist/src/ReduceablePrice.d.ts.map +1 -1
  204. package/esm/dist/src/ReduceablePrice.js +5 -2
  205. package/esm/dist/src/ReduceablePrice.js.map +1 -1
  206. package/esm/dist/src/RegisterCodeStatus.d.ts.map +1 -1
  207. package/esm/dist/src/RegisterCodeStatus.js +9 -4
  208. package/esm/dist/src/RegisterCodeStatus.js.map +1 -1
  209. package/esm/dist/src/SeatingPlan.d.ts.map +1 -1
  210. package/esm/dist/src/SeatingPlan.js +5 -2
  211. package/esm/dist/src/SeatingPlan.js.map +1 -1
  212. package/esm/dist/src/UitpasClientCredentialsStatus.d.ts +1 -1
  213. package/esm/dist/src/Version.d.ts +1 -1
  214. package/esm/dist/src/Version.js +1 -1
  215. package/esm/dist/src/billing/Invoice.d.ts +51 -0
  216. package/esm/dist/src/billing/Invoice.d.ts.map +1 -0
  217. package/esm/dist/src/billing/Invoice.js +53 -0
  218. package/esm/dist/src/billing/Invoice.js.map +1 -0
  219. package/esm/dist/src/billing/InvoicedBalanceItem.d.ts +29 -0
  220. package/esm/dist/src/billing/InvoicedBalanceItem.d.ts.map +1 -0
  221. package/esm/dist/src/billing/InvoicedBalanceItem.js +60 -0
  222. package/esm/dist/src/billing/InvoicedBalanceItem.js.map +1 -0
  223. package/esm/dist/src/billing/STCredit.d.ts.map +1 -1
  224. package/esm/dist/src/billing/STCredit.js +3 -1
  225. package/esm/dist/src/billing/STCredit.js.map +1 -1
  226. package/esm/dist/src/billing/STInvoice.d.ts +32 -5
  227. package/esm/dist/src/billing/STInvoice.d.ts.map +1 -1
  228. package/esm/dist/src/billing/STInvoice.js +61 -12
  229. package/esm/dist/src/billing/STInvoice.js.map +1 -1
  230. package/esm/dist/src/billing/STPackage.d.ts.map +1 -1
  231. package/esm/dist/src/billing/STPackage.js +19 -9
  232. package/esm/dist/src/billing/STPackage.js.map +1 -1
  233. package/esm/dist/src/billing/STPackageBundle.js +2 -2
  234. package/esm/dist/src/billing/STPackageBundle.js.map +1 -1
  235. package/esm/dist/src/billing/index.d.ts +2 -0
  236. package/esm/dist/src/billing/index.d.ts.map +1 -1
  237. package/esm/dist/src/billing/index.js +2 -0
  238. package/esm/dist/src/billing/index.js.map +1 -1
  239. package/esm/dist/src/checkout/Checkoutable.d.ts +65 -0
  240. package/esm/dist/src/checkout/Checkoutable.d.ts.map +1 -0
  241. package/esm/dist/src/checkout/Checkoutable.js +92 -0
  242. package/esm/dist/src/checkout/Checkoutable.js.map +1 -0
  243. package/esm/dist/src/checkout/PackageCheckout.d.ts +17 -0
  244. package/esm/dist/src/checkout/PackageCheckout.d.ts.map +1 -0
  245. package/esm/dist/src/checkout/PackageCheckout.js +21 -0
  246. package/esm/dist/src/checkout/PackageCheckout.js.map +1 -0
  247. package/esm/dist/src/checkout/index.d.ts +3 -0
  248. package/esm/dist/src/checkout/index.d.ts.map +1 -0
  249. package/esm/dist/src/checkout/index.js +3 -0
  250. package/esm/dist/src/checkout/index.js.map +1 -0
  251. package/esm/dist/src/endpoints/ChargeMembershipsSummary.d.ts.map +1 -1
  252. package/esm/dist/src/endpoints/ChargeMembershipsSummary.js +5 -2
  253. package/esm/dist/src/endpoints/ChargeMembershipsSummary.js.map +1 -1
  254. package/esm/dist/src/endpoints/PayableBalanceCollection.d.ts.map +1 -1
  255. package/esm/dist/src/endpoints/PayableBalanceCollection.js +7 -3
  256. package/esm/dist/src/endpoints/PayableBalanceCollection.js.map +1 -1
  257. package/esm/dist/src/endpoints/UitpasPriceCheckRequest.d.ts.map +1 -1
  258. package/esm/dist/src/endpoints/UitpasPriceCheckRequest.js +5 -2
  259. package/esm/dist/src/endpoints/UitpasPriceCheckRequest.js.map +1 -1
  260. package/esm/dist/src/filters/FilterCompilers.d.ts.map +1 -1
  261. package/esm/dist/src/filters/FilterCompilers.js +16 -3
  262. package/esm/dist/src/filters/FilterCompilers.js.map +1 -1
  263. package/esm/dist/src/filters/convertOldPropertyFilter.d.ts.map +1 -1
  264. package/esm/dist/src/filters/convertOldPropertyFilter.js +4 -8
  265. package/esm/dist/src/filters/convertOldPropertyFilter.js.map +1 -1
  266. package/esm/dist/src/members/MemberPlatformMembership.d.ts.map +1 -1
  267. package/esm/dist/src/members/MemberPlatformMembership.js +5 -2
  268. package/esm/dist/src/members/MemberPlatformMembership.js.map +1 -1
  269. package/esm/dist/src/members/OrganizationRecordsConfiguration.d.ts.map +1 -1
  270. package/esm/dist/src/members/OrganizationRecordsConfiguration.js +18 -2
  271. package/esm/dist/src/members/OrganizationRecordsConfiguration.js.map +1 -1
  272. package/esm/dist/src/members/Payment.d.ts.map +1 -1
  273. package/esm/dist/src/members/Payment.js +17 -8
  274. package/esm/dist/src/members/Payment.js.map +1 -1
  275. package/esm/dist/src/members/PaymentGeneral.d.ts.map +1 -1
  276. package/esm/dist/src/members/PaymentGeneral.js +9 -4
  277. package/esm/dist/src/members/PaymentGeneral.js.map +1 -1
  278. package/esm/dist/src/members/checkout/BalanceItemCartItem.d.ts.map +1 -1
  279. package/esm/dist/src/members/checkout/BalanceItemCartItem.js +3 -1
  280. package/esm/dist/src/members/checkout/BalanceItemCartItem.js.map +1 -1
  281. package/esm/dist/src/members/checkout/RegisterCheckout.d.ts.map +1 -1
  282. package/esm/dist/src/members/checkout/RegisterCheckout.js +28 -23
  283. package/esm/dist/src/members/checkout/RegisterCheckout.js.map +1 -1
  284. package/esm/dist/src/members/checkout/RegisterItem.d.ts.map +1 -1
  285. package/esm/dist/src/members/checkout/RegisterItem.js +3 -1
  286. package/esm/dist/src/members/checkout/RegisterItem.js.map +1 -1
  287. package/esm/dist/src/upgradePriceFrom2To4DecimalPlaces.d.ts +9 -0
  288. package/esm/dist/src/upgradePriceFrom2To4DecimalPlaces.d.ts.map +1 -0
  289. package/esm/dist/src/upgradePriceFrom2To4DecimalPlaces.js +26 -0
  290. package/esm/dist/src/upgradePriceFrom2To4DecimalPlaces.js.map +1 -0
  291. package/esm/dist/src/webshops/CartItem.d.ts.map +1 -1
  292. package/esm/dist/src/webshops/CartItem.js +8 -4
  293. package/esm/dist/src/webshops/CartItem.js.map +1 -1
  294. package/esm/dist/src/webshops/Checkout.d.ts.map +1 -1
  295. package/esm/dist/src/webshops/Checkout.js +6 -3
  296. package/esm/dist/src/webshops/Checkout.js.map +1 -1
  297. package/esm/dist/src/webshops/Discount.d.ts.map +1 -1
  298. package/esm/dist/src/webshops/Discount.js +6 -3
  299. package/esm/dist/src/webshops/Discount.js.map +1 -1
  300. package/esm/dist/src/webshops/Product.d.ts.map +1 -1
  301. package/esm/dist/src/webshops/Product.js +7 -3
  302. package/esm/dist/src/webshops/Product.js.map +1 -1
  303. package/esm/dist/src/webshops/UitpasNumberAndPrice.d.ts.map +1 -1
  304. package/esm/dist/src/webshops/UitpasNumberAndPrice.js +3 -1
  305. package/esm/dist/src/webshops/UitpasNumberAndPrice.js.map +1 -1
  306. package/esm/dist/src/webshops/WebshopMetaData.d.ts.map +1 -1
  307. package/esm/dist/src/webshops/WebshopMetaData.js +7 -3
  308. package/esm/dist/src/webshops/WebshopMetaData.js.map +1 -1
  309. package/package.json +2 -2
  310. package/dist/src/members/PaymentPatch.d.ts +0 -14
  311. package/dist/src/members/PaymentPatch.d.ts.map +0 -1
  312. package/dist/src/members/PaymentPatch.js +0 -33
  313. package/dist/src/members/PaymentPatch.js.map +0 -1
  314. package/dist/src/members/RegistrationPatch.d.ts +0 -9
  315. package/dist/src/members/RegistrationPatch.d.ts.map +0 -1
  316. package/dist/src/members/RegistrationPatch.js +0 -24
  317. package/dist/src/members/RegistrationPatch.js.map +0 -1
  318. package/esm/dist/src/members/PaymentPatch.d.ts +0 -14
  319. package/esm/dist/src/members/PaymentPatch.d.ts.map +0 -1
  320. package/esm/dist/src/members/PaymentPatch.js +0 -29
  321. package/esm/dist/src/members/PaymentPatch.js.map +0 -1
  322. package/esm/dist/src/members/RegistrationPatch.d.ts +0 -9
  323. package/esm/dist/src/members/RegistrationPatch.d.ts.map +0 -1
  324. package/esm/dist/src/members/RegistrationPatch.js +0 -20
  325. package/esm/dist/src/members/RegistrationPatch.js.map +0 -1
@@ -30,7 +30,7 @@ function createTestPeriod() {
30
30
  });
31
31
  return { period, organizationRegistrationPeriod, organization };
32
32
  }
33
- function createTestGroups(organization, period, prices = [5000, 4000], names) {
33
+ function createTestGroups(organization, period, prices = [500000, 400000], names) {
34
34
  return prices.map((price, index) => {
35
35
  return Group_js_1.Group.create({
36
36
  organizationId: organization.id,
@@ -49,8 +49,8 @@ function createTestGroups(organization, period, prices = [5000, 4000], names) {
49
49
  });
50
50
  }
51
51
  function createBundleDiscount({ name = 'Bundle discount', countWholeFamily = true, countPerGroup = false, discounts = [
52
- { value: 1000, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Fixed },
53
- { value: 1500, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Fixed },
52
+ { value: 100000, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Fixed },
53
+ { value: 150000, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Fixed },
54
54
  ], } = {}) {
55
55
  return BundleDiscount_js_1.BundleDiscount.create({
56
56
  name: new TranslatedString_js_1.TranslatedString(name),
@@ -83,7 +83,7 @@ function createTestFamily(memberCount = 3) {
83
83
  });
84
84
  return PlatformMember_js_1.PlatformFamily.create(blob, { platform: Platform_js_1.Platform.create({}) });
85
85
  }
86
- function setupDiscountTest({ memberCount = 3, groupPrices = [5000, 4000], groupNames, bundleDiscount, } = {}) {
86
+ function setupDiscountTest({ memberCount = 3, groupPrices = [500000, 400000], groupNames, bundleDiscount, } = {}) {
87
87
  const { period, organizationRegistrationPeriod, organization } = createTestPeriod();
88
88
  const groups = createTestGroups(organization, period, groupPrices, groupNames);
89
89
  organizationRegistrationPeriod.groups = groups;
@@ -135,8 +135,8 @@ describe('Unit.RegisterCart', () => {
135
135
  bundleDiscount: createBundleDiscount({
136
136
  name: 'Bundle discount',
137
137
  discounts: [
138
- { value: 1000, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Fixed },
139
- { value: 1500, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Fixed },
138
+ { value: 100000, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Fixed },
139
+ { value: 150000, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Fixed },
140
140
  ],
141
141
  }),
142
142
  });
@@ -153,33 +153,33 @@ describe('Unit.RegisterCart', () => {
153
153
  cart.add(itemC);
154
154
  cart.calculatePrices();
155
155
  // Check price for item A is 50.00
156
- expect(itemA.calculatedPrice).toEqual(5000);
156
+ expect(itemA.calculatedPrice).toEqual(500000);
157
157
  expect(itemA.calculatedRefund).toEqual(0);
158
158
  expect(itemA.calculatedPriceDueLater).toEqual(0);
159
159
  // Check price for items B and C
160
- expect(itemB.calculatedPrice).toEqual(4000);
160
+ expect(itemB.calculatedPrice).toEqual(400000);
161
161
  expect(itemB.calculatedRefund).toEqual(0);
162
162
  expect(itemB.calculatedPriceDueLater).toEqual(0);
163
- expect(itemC.calculatedPrice).toEqual(4000);
163
+ expect(itemC.calculatedPrice).toEqual(400000);
164
164
  expect(itemC.calculatedRefund).toEqual(0);
165
165
  expect(itemC.calculatedPriceDueLater).toEqual(0);
166
- // Check calculated discount is 10_00 + 15_00 = 25_00
166
+ // Check calculated discount is 10_0000 + 15_0000 = 25_0000
167
167
  expect(cart.bundleDiscounts).toHaveLength(1);
168
- expect(cart.bundleDiscounts[0].total).toEqual(2500);
168
+ expect(cart.bundleDiscounts[0].total).toEqual(250000);
169
169
  expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(0);
170
- expect(cart.bundleDiscounts[0].netTotal).toEqual(2500);
171
- expect(cart.price).toEqual(5000 + 4000 + 4000);
172
- expect(checkout.totalPrice).toEqual(5000 + 4000 + 4000 - 2500);
170
+ expect(cart.bundleDiscounts[0].netTotal).toEqual(250000);
171
+ expect(cart.price).toEqual(500000 + 400000 + 400000);
172
+ expect(checkout.totalPrice).toEqual(500000 + 400000 + 400000 - 250000);
173
173
  expect(checkout.priceBreakown).toEqual([
174
174
  expect.objectContaining({
175
- price: 13000,
175
+ price: 1300000,
176
176
  }),
177
177
  {
178
178
  name: 'Bundle discount',
179
- price: -2500,
179
+ price: -250000,
180
180
  },
181
181
  expect.objectContaining({
182
- price: 13000 - 2500,
182
+ price: 1300000 - 250000,
183
183
  }),
184
184
  ]);
185
185
  });
@@ -206,26 +206,72 @@ describe('Unit.RegisterCart', () => {
206
206
  cart.add(itemC);
207
207
  cart.calculatePrices();
208
208
  // Check price for items
209
- expect(itemA.calculatedPrice).toEqual(5000);
210
- expect(itemB.calculatedPrice).toEqual(4000);
211
- expect(itemC.calculatedPrice).toEqual(4000);
209
+ expect(itemA.calculatedPrice).toEqual(500000);
210
+ expect(itemB.calculatedPrice).toEqual(400000);
211
+ expect(itemC.calculatedPrice).toEqual(400000);
212
212
  // 15% will be applied to 50 euro (max), and 10% to one of the 40 euros
213
- // Check calculated discount is 50_00 * 0.15 + 40_00 * 0.10 = 7_50 + 4_00 = 11_50
213
+ // Check calculated discount is 50_0000 * 0.15 + 40_0000 * 0.10 = 7_5000 + 4_0000 = 11_5000
214
+ expect(cart.bundleDiscounts).toHaveLength(1);
215
+ expect(cart.bundleDiscounts[0].total).toEqual(115000);
216
+ expect(cart.bundleDiscounts[0].netTotal).toEqual(115000);
217
+ expect(cart.price).toEqual(500000 + 400000 + 400000);
218
+ expect(checkout.totalPrice).toEqual(500000 + 400000 + 400000 - 115000);
219
+ expect(checkout.priceBreakown).toEqual([
220
+ expect.objectContaining({
221
+ price: 1300000,
222
+ }),
223
+ {
224
+ name: 'Bundle discount',
225
+ price: -115000,
226
+ },
227
+ expect.objectContaining({
228
+ price: 1300000 - 115000,
229
+ }),
230
+ ]);
231
+ });
232
+ test('Percentage discounts are rounded to 1 cent', () => {
233
+ const { organization, groups, family } = setupDiscountTest({
234
+ bundleDiscount: createBundleDiscount({
235
+ name: 'Bundle discount',
236
+ discounts: [
237
+ { value: 111, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Percentage },
238
+ { value: 152, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Percentage },
239
+ ],
240
+ }),
241
+ });
242
+ const [groupA, groupB] = groups;
243
+ const [memberA, memberB, memberC] = family.members;
244
+ const itemA = RegisterItem_js_1.RegisterItem.defaultFor(memberA, groupA, organization);
245
+ const itemB = RegisterItem_js_1.RegisterItem.defaultFor(memberB, groupB, organization);
246
+ const itemC = RegisterItem_js_1.RegisterItem.defaultFor(memberC, groupB, organization);
247
+ // Add to a single cart
248
+ const checkout = family.checkout;
249
+ const cart = checkout.cart;
250
+ cart.add(itemA);
251
+ cart.add(itemB);
252
+ cart.add(itemC);
253
+ cart.calculatePrices();
254
+ // Check price for items
255
+ expect(itemA.calculatedPrice).toEqual(500000);
256
+ expect(itemB.calculatedPrice).toEqual(400000);
257
+ expect(itemC.calculatedPrice).toEqual(400000);
258
+ // 1,5% will be applied to 50 euro (max), and 1% to one of the 40 euros
259
+ // Check calculated discount is 50_0000 * 0.0152 + 40_0000 * 0.0111 = 7500 + 4000 = 1_2040 normally, but not allowed, rounded to 1_2000
214
260
  expect(cart.bundleDiscounts).toHaveLength(1);
215
- expect(cart.bundleDiscounts[0].total).toEqual(1150);
216
- expect(cart.bundleDiscounts[0].netTotal).toEqual(1150);
217
- expect(cart.price).toEqual(5000 + 4000 + 4000);
218
- expect(checkout.totalPrice).toEqual(5000 + 4000 + 4000 - 1150);
261
+ expect(cart.bundleDiscounts[0].total).toEqual(12000);
262
+ expect(cart.bundleDiscounts[0].netTotal).toEqual(12000);
263
+ expect(cart.price).toEqual(500000 + 400000 + 400000);
264
+ expect(checkout.totalPrice).toEqual(500000 + 400000 + 400000 - 12000);
219
265
  expect(checkout.priceBreakown).toEqual([
220
266
  expect.objectContaining({
221
- price: 13000,
267
+ price: 1300000,
222
268
  }),
223
269
  {
224
270
  name: 'Bundle discount',
225
- price: -1150,
271
+ price: -12000,
226
272
  },
227
273
  expect.objectContaining({
228
- price: 13000 - 1150,
274
+ price: 1300000 - 12000,
229
275
  }),
230
276
  ]);
231
277
  });
@@ -252,25 +298,25 @@ describe('Unit.RegisterCart', () => {
252
298
  cart.add(itemC);
253
299
  cart.calculatePrices();
254
300
  // Check price for items
255
- expect(itemB.calculatedPrice).toEqual(4000);
256
- expect(itemC.calculatedPrice).toEqual(4000);
301
+ expect(itemB.calculatedPrice).toEqual(400000);
302
+ expect(itemC.calculatedPrice).toEqual(400000);
257
303
  // 15% will be applied to 50 euro (max), and 10% to one of the 40 euros
258
- // Check calculated discount is 50_00 * 0.15 + 40_00 * 0.10 = 7_50 + 4_00 = 11_50
304
+ // Check calculated discount is 50_0000 * 0.15 + 40_0000 * 0.10 = 7_5000 + 4_0000 = 11_5000
259
305
  expect(cart.bundleDiscounts).toHaveLength(1);
260
- expect(cart.bundleDiscounts[0].total).toEqual(1150);
261
- expect(cart.bundleDiscounts[0].netTotal).toEqual(1150);
262
- expect(cart.price).toEqual(4000 + 4000);
263
- expect(checkout.totalPrice).toEqual(4000 + 4000 - 1150);
306
+ expect(cart.bundleDiscounts[0].total).toEqual(115000);
307
+ expect(cart.bundleDiscounts[0].netTotal).toEqual(115000);
308
+ expect(cart.price).toEqual(400000 + 400000);
309
+ expect(checkout.totalPrice).toEqual(400000 + 400000 - 115000);
264
310
  expect(checkout.priceBreakown).toEqual([
265
311
  expect.objectContaining({
266
- price: 8000,
312
+ price: 800000,
267
313
  }),
268
314
  {
269
315
  name: 'Bundle discount',
270
- price: -1150,
316
+ price: -115000,
271
317
  },
272
318
  expect.objectContaining({
273
- price: 8000 - 1150,
319
+ price: 800000 - 115000,
274
320
  }),
275
321
  ]);
276
322
  });
@@ -291,7 +337,7 @@ describe('Unit.RegisterCart', () => {
291
337
  { value: 1500, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Percentage },
292
338
  ],
293
339
  }),
294
- groupPrices: [10000, 4000],
340
+ groupPrices: [1000000, 400000],
295
341
  });
296
342
  const [groupA, groupB] = groups;
297
343
  const [memberA, memberB] = family.members;
@@ -301,7 +347,7 @@ describe('Unit.RegisterCart', () => {
301
347
  discount.id,
302
348
  AppliedRegistrationDiscount_js_1.AppliedRegistrationDiscount.create({
303
349
  name: discount.name,
304
- amount: 1000, // 10% discount on 100_00 = 10_00
350
+ amount: 100000, // 10% discount on 100_0000 = 10_0000
305
351
  }),
306
352
  ],
307
353
  ]));
@@ -314,13 +360,13 @@ describe('Unit.RegisterCart', () => {
314
360
  }));
315
361
  cart.calculatePrices();
316
362
  expect(cart.bundleDiscounts).toHaveLength(0);
317
- expect(checkout.totalPrice).toEqual(-3000);
363
+ expect(checkout.totalPrice).toEqual(-300000);
318
364
  expect(checkout.priceBreakown).toEqual([
319
365
  expect.objectContaining({
320
- price: -4000 + 1000,
366
+ price: -400000 + 100000,
321
367
  }),
322
368
  expect.objectContaining({
323
- price: -4000 + 1000,
369
+ price: -400000 + 100000,
324
370
  }),
325
371
  ]);
326
372
  // Now readd the registration
@@ -336,19 +382,19 @@ describe('Unit.RegisterCart', () => {
336
382
  cart.calculatePrices();
337
383
  expect(cart.bundleDiscounts).toHaveLength(1);
338
384
  expect(cart.bundleDiscounts[0].total).toEqual(0);
339
- expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(1000); // The previous discount
340
- expect(cart.bundleDiscounts[0].netTotal).toEqual(-1000);
341
- expect(checkout.totalPrice).toEqual(-9000);
385
+ expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(100000); // The previous discount
386
+ expect(cart.bundleDiscounts[0].netTotal).toEqual(-100000);
387
+ expect(checkout.totalPrice).toEqual(-900000);
342
388
  expect(checkout.priceBreakown).toEqual([
343
- expect.objectContaining({
344
- price: -10000, // Reeds aangerekend
345
- }),
346
389
  {
347
390
  name: '766a39be-a4af-4a04-baf0-1f064d2fed16 (Multiple family members discount)',
348
- price: 1000,
391
+ price: 100000,
349
392
  },
350
393
  expect.objectContaining({
351
- price: -9000,
394
+ price: -1000000, // Reeds aangerekend
395
+ }),
396
+ expect.objectContaining({
397
+ price: -900000,
352
398
  }),
353
399
  ]);
354
400
  });
@@ -369,7 +415,7 @@ describe('Unit.RegisterCart', () => {
369
415
  { value: 1500, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Percentage },
370
416
  ],
371
417
  }),
372
- groupPrices: [10000, 4000],
418
+ groupPrices: [1000000, 400000],
373
419
  });
374
420
  const [groupA, groupB] = groups;
375
421
  const [memberA, memberB] = family.members;
@@ -379,7 +425,7 @@ describe('Unit.RegisterCart', () => {
379
425
  discount.id,
380
426
  AppliedRegistrationDiscount_js_1.AppliedRegistrationDiscount.create({
381
427
  name: discount.name,
382
- amount: 1000, // 10% discount on 100_00 = 10_00
428
+ amount: 100000, // 10% discount on 1_0000 = 10_00
383
429
  }),
384
430
  ],
385
431
  ]));
@@ -393,17 +439,17 @@ describe('Unit.RegisterCart', () => {
393
439
  }));
394
440
  cart.calculatePrices();
395
441
  expect(cart.bundleDiscounts).toHaveLength(0);
396
- expect(checkout.totalPrice).toEqual(-1500);
442
+ expect(checkout.totalPrice).toEqual(-150000);
397
443
  expect(checkout.priceBreakown).toEqual([
398
444
  expect.objectContaining({
399
- price: -4000 + 1000, // Already charged amount
445
+ price: -400000 + 100000, // Already charged amount
400
446
  }),
401
- // Cancellation fee = 50% of the balance total, 30_00 = 15_00
447
+ // Cancellation fee = 50% of the balance total, 30_0000 = 15_0000
402
448
  expect.objectContaining({
403
- price: 1500,
449
+ price: 150000,
404
450
  }),
405
451
  expect.objectContaining({
406
- price: -1500,
452
+ price: -150000,
407
453
  }),
408
454
  ]);
409
455
  // Now readd the registration
@@ -419,24 +465,24 @@ describe('Unit.RegisterCart', () => {
419
465
  cart.calculatePrices();
420
466
  expect(cart.bundleDiscounts).toHaveLength(1);
421
467
  expect(cart.bundleDiscounts[0].total).toEqual(0);
422
- expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(1000); // The previous discount
423
- expect(cart.bundleDiscounts[0].netTotal).toEqual(-1000);
424
- expect(checkout.totalPrice).toEqual(-4000);
468
+ expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(100000); // The previous discount
469
+ expect(cart.bundleDiscounts[0].netTotal).toEqual(-100000);
470
+ expect(checkout.totalPrice).toEqual(-400000);
425
471
  expect(checkout.priceBreakown).toEqual([
426
- expect.objectContaining({
427
- price: -10000, // Already charged for registration A that is being deleted
428
- }),
429
- // Cancellation fee = 50% of the balance total, 100_00 = 50_00
430
- expect.objectContaining({
431
- price: 5000,
432
- }),
433
472
  {
434
473
  // Side effect in registration B
435
474
  name: '766a39be-a4af-4a04-baf0-1f064d2fed16 (Multiple family members discount)',
436
- price: 1000,
475
+ price: 100000,
437
476
  },
438
477
  expect.objectContaining({
439
- price: -4000,
478
+ price: -1000000, // Already charged for registration A that is being deleted
479
+ }),
480
+ // Cancellation fee = 50% of the balance total, 100_0000 = 50_0000
481
+ expect.objectContaining({
482
+ price: 500000,
483
+ }),
484
+ expect.objectContaining({
485
+ price: -400000,
440
486
  }),
441
487
  ]);
442
488
  });
@@ -456,7 +502,7 @@ describe('Unit.RegisterCart', () => {
456
502
  { value: 1500, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Percentage },
457
503
  ],
458
504
  }),
459
- groupPrices: [10000, 4000],
505
+ groupPrices: [1000000, 400000],
460
506
  });
461
507
  const [groupA, groupB] = groups;
462
508
  const [memberA, memberB] = family.members;
@@ -466,13 +512,13 @@ describe('Unit.RegisterCart', () => {
466
512
  discount.id,
467
513
  AppliedRegistrationDiscount_js_1.AppliedRegistrationDiscount.create({
468
514
  name: discount.name,
469
- amount: 1000, // 10% discount on 100_00 = 10_00
515
+ amount: 100000, // 10% discount on 100_0000 = 10_0000
470
516
  }),
471
517
  ],
472
518
  ]));
473
519
  const groupCPrice = GroupSettings_js_1.GroupPrice.create({
474
520
  price: ReduceablePrice_js_1.ReduceablePrice.create({
475
- price: 5000,
521
+ price: 500000,
476
522
  }),
477
523
  });
478
524
  const groupC = Group_js_1.Group.create({
@@ -497,30 +543,30 @@ describe('Unit.RegisterCart', () => {
497
543
  cart.add(itemA);
498
544
  cart.calculatePrices();
499
545
  // Check price for items
500
- expect(itemA.calculatedPrice).toEqual(5000);
501
- expect(itemA.calculatedRefund).toEqual(10000);
546
+ expect(itemA.calculatedPrice).toEqual(500000);
547
+ expect(itemA.calculatedRefund).toEqual(1000000);
502
548
  expect(itemA.calculatedPriceDueLater).toEqual(0);
503
549
  // Check discount should be given back
504
550
  expect(cart.bundleDiscounts).toHaveLength(1);
505
551
  expect(cart.bundleDiscounts[0].total).toEqual(0);
506
- expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(1000); // The previous discount
507
- expect(cart.bundleDiscounts[0].netTotal).toEqual(-1000);
508
- expect(checkout.totalPrice).toEqual(5000 - 10000 + 1000);
552
+ expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(100000); // The previous discount
553
+ expect(cart.bundleDiscounts[0].netTotal).toEqual(-100000);
554
+ expect(checkout.totalPrice).toEqual(500000 - 1000000 + 100000);
509
555
  expect(checkout.priceBreakown).toEqual([
510
556
  expect.objectContaining({
511
557
  // Subtotal (normal price)
512
- price: 5000,
513
- }),
514
- expect.objectContaining({
515
- // Refund for the previous registration
516
- price: -10000,
558
+ price: 500000,
517
559
  }),
518
560
  {
519
561
  name: '766a39be-a4af-4a04-baf0-1f064d2fed16 (Multiple family members discount)',
520
- price: 1000,
562
+ price: 100000,
521
563
  },
522
564
  expect.objectContaining({
523
- price: -5000 + 1000,
565
+ // Refund for the previous registration
566
+ price: -1000000,
567
+ }),
568
+ expect.objectContaining({
569
+ price: -500000 + 100000,
524
570
  }),
525
571
  ]);
526
572
  // Now, what if groupC does have a higher discount instead of no discount?
@@ -530,7 +576,7 @@ describe('Unit.RegisterCart', () => {
530
576
  // Custom discount for this price
531
577
  GroupPriceDiscount_js_1.GroupPriceDiscount.create({
532
578
  value: ReduceablePrice_js_1.ReduceablePrice.create({
533
- price: 2500,
579
+ price: 250000,
534
580
  }),
535
581
  type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Fixed,
536
582
  }),
@@ -540,25 +586,25 @@ describe('Unit.RegisterCart', () => {
540
586
  cart.calculatePrices();
541
587
  // Check discount should be given back
542
588
  expect(cart.bundleDiscounts).toHaveLength(1);
543
- expect(cart.bundleDiscounts[0].total).toEqual(2500);
544
- expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(1000); // The previous discount
545
- expect(cart.bundleDiscounts[0].netTotal).toEqual(1500);
546
- expect(checkout.totalPrice).toEqual(5000 - 10000 - 1500);
589
+ expect(cart.bundleDiscounts[0].total).toEqual(250000);
590
+ expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(100000); // The previous discount
591
+ expect(cart.bundleDiscounts[0].netTotal).toEqual(150000);
592
+ expect(checkout.totalPrice).toEqual(500000 - 1000000 - 150000);
547
593
  expect(checkout.priceBreakown).toEqual([
548
594
  expect.objectContaining({
549
595
  // Subtotal (normal price)
550
- price: 5000,
551
- }),
552
- expect.objectContaining({
553
- // Refund for the previous registration
554
- price: -10000,
596
+ price: 500000,
555
597
  }),
556
598
  {
557
599
  name: 'Multiple family members discount',
558
- price: -1500,
600
+ price: -150000,
559
601
  },
560
602
  expect.objectContaining({
561
- price: -5000 - 1500,
603
+ // Refund for the previous registration
604
+ price: -1000000,
605
+ }),
606
+ expect.objectContaining({
607
+ price: -500000 - 150000,
562
608
  }),
563
609
  ]);
564
610
  });
@@ -574,7 +620,7 @@ describe('Unit.RegisterCart', () => {
574
620
  { value: 1500, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Percentage },
575
621
  ],
576
622
  }),
577
- groupPrices: [10000, 4000],
623
+ groupPrices: [1000000, 400000],
578
624
  });
579
625
  const [groupA, groupB] = groups;
580
626
  const [memberA, memberB] = family.members;
@@ -583,14 +629,14 @@ describe('Unit.RegisterCart', () => {
583
629
  discount.id,
584
630
  AppliedRegistrationDiscount_js_1.AppliedRegistrationDiscount.create({
585
631
  name: discount.name,
586
- amount: 1000, // 10% discount on 100_00 = 10_00
632
+ amount: 100000, // 10% discount on 100_0000 = 10_0000
587
633
  }),
588
634
  ],
589
635
  ]));
590
636
  addHistoricRegistration(memberB, groupB, organization);
591
637
  const groupCPrice = GroupSettings_js_1.GroupPrice.create({
592
638
  price: ReduceablePrice_js_1.ReduceablePrice.create({
593
- price: 5000,
639
+ price: 500000,
594
640
  }),
595
641
  });
596
642
  const groupC = Group_js_1.Group.create({
@@ -615,23 +661,23 @@ describe('Unit.RegisterCart', () => {
615
661
  cart.add(itemA);
616
662
  cart.calculatePrices();
617
663
  // Check price for items
618
- expect(itemA.calculatedPrice).toEqual(5000);
619
- expect(itemA.calculatedRefund).toEqual(9000);
664
+ expect(itemA.calculatedPrice).toEqual(500000);
665
+ expect(itemA.calculatedRefund).toEqual(900000);
620
666
  expect(itemA.calculatedPriceDueLater).toEqual(0);
621
667
  // No discounts anymore
622
668
  expect(cart.bundleDiscounts).toHaveLength(0);
623
- expect(checkout.totalPrice).toEqual(5000 - 9000);
669
+ expect(checkout.totalPrice).toEqual(500000 - 900000);
624
670
  expect(checkout.priceBreakown).toEqual([
625
671
  expect.objectContaining({
626
672
  // Subtotal (normal price)
627
- price: 5000,
673
+ price: 500000,
628
674
  }),
629
675
  expect.objectContaining({
630
676
  // Refund for the previous registration, without the discount that was granted
631
- price: -9000,
677
+ price: -900000,
632
678
  }),
633
679
  expect.objectContaining({
634
- price: 5000 - 9000,
680
+ price: 500000 - 900000,
635
681
  }),
636
682
  ]);
637
683
  // Now, what if groupC does have a higher discount instead of no discount?
@@ -641,7 +687,7 @@ describe('Unit.RegisterCart', () => {
641
687
  // Custom discount for this price
642
688
  GroupPriceDiscount_js_1.GroupPriceDiscount.create({
643
689
  value: ReduceablePrice_js_1.ReduceablePrice.create({
644
- price: 2500,
690
+ price: 250000,
645
691
  }),
646
692
  type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Fixed,
647
693
  }),
@@ -651,25 +697,25 @@ describe('Unit.RegisterCart', () => {
651
697
  cart.calculatePrices();
652
698
  // Check discount should be given back
653
699
  expect(cart.bundleDiscounts).toHaveLength(1);
654
- expect(cart.bundleDiscounts[0].total).toEqual(2500);
700
+ expect(cart.bundleDiscounts[0].total).toEqual(250000);
655
701
  expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(0); // Not included here, because the registration will be removed including the applied discount
656
- expect(cart.bundleDiscounts[0].netTotal).toEqual(2500);
657
- expect(checkout.totalPrice).toEqual(5000 - 9000 - 2500);
702
+ expect(cart.bundleDiscounts[0].netTotal).toEqual(250000);
703
+ expect(checkout.totalPrice).toEqual(500000 - 900000 - 250000);
658
704
  expect(checkout.priceBreakown).toEqual([
659
705
  expect.objectContaining({
660
706
  // Subtotal (normal price)
661
- price: 5000,
662
- }),
663
- expect.objectContaining({
664
- // Refund for the previous registration
665
- price: -9000,
707
+ price: 500000,
666
708
  }),
667
709
  {
668
710
  name: 'Multiple family members discount',
669
- price: -2500,
711
+ price: -250000,
670
712
  },
671
713
  expect.objectContaining({
672
- price: 5000 - 9000 - 2500,
714
+ // Refund for the previous registration
715
+ price: -900000,
716
+ }),
717
+ expect.objectContaining({
718
+ price: 500000 - 900000 - 250000,
673
719
  }),
674
720
  ]);
675
721
  });
@@ -678,7 +724,7 @@ describe('Unit.RegisterCart', () => {
678
724
  // The bundle discount only defined one discount, but that should be repated for the second and third item
679
725
  const { organization, groups, family, discount } = setupDiscountTest({
680
726
  memberCount: 3,
681
- groupPrices: [5000, 4000],
727
+ groupPrices: [500000, 400000],
682
728
  groupNames: ['Group A', 'Group B'],
683
729
  bundleDiscount: createBundleDiscount({
684
730
  name: 'Bundle discount',
@@ -700,39 +746,39 @@ describe('Unit.RegisterCart', () => {
700
746
  cart.add(itemC);
701
747
  cart.calculatePrices();
702
748
  // Check price for items
703
- expect(itemA.calculatedPrice).toEqual(5000);
749
+ expect(itemA.calculatedPrice).toEqual(500000);
704
750
  expect(itemA.calculatedRefund).toEqual(0);
705
751
  expect(itemA.calculatedPriceDueLater).toEqual(0);
706
- expect(itemB.calculatedPrice).toEqual(4000);
752
+ expect(itemB.calculatedPrice).toEqual(400000);
707
753
  expect(itemB.calculatedRefund).toEqual(0);
708
754
  expect(itemB.calculatedPriceDueLater).toEqual(0);
709
- expect(itemC.calculatedPrice).toEqual(4000);
755
+ expect(itemC.calculatedPrice).toEqual(400000);
710
756
  expect(itemC.calculatedRefund).toEqual(0);
711
757
  expect(itemC.calculatedPriceDueLater).toEqual(0);
712
- // Check calculated discount is 50_00 * 0.10 + 40_00 * 0.10 = 5_00 + 4_00 = 9_00
758
+ // Check calculated discount is 50_0000 * 0.10 + 40_0000 * 0.10 = 5_0000 + 4_0000 = 9_0000
713
759
  expect(cart.bundleDiscounts).toHaveLength(1);
714
- expect(cart.bundleDiscounts[0].total).toEqual(900);
760
+ expect(cart.bundleDiscounts[0].total).toEqual(90000);
715
761
  expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(0);
716
- expect(cart.bundleDiscounts[0].netTotal).toEqual(900);
717
- expect(cart.price).toEqual(5000 + 4000 + 4000);
718
- expect(checkout.totalPrice).toEqual(5000 + 4000 + 4000 - 900);
762
+ expect(cart.bundleDiscounts[0].netTotal).toEqual(90000);
763
+ expect(cart.price).toEqual(500000 + 400000 + 400000);
764
+ expect(checkout.totalPrice).toEqual(500000 + 400000 + 400000 - 90000);
719
765
  expect(checkout.priceBreakown).toEqual([
720
766
  expect.objectContaining({
721
- price: 13000,
767
+ price: 1300000,
722
768
  }),
723
769
  {
724
770
  name: 'Bundle discount',
725
- price: -900,
771
+ price: -90000,
726
772
  },
727
773
  expect.objectContaining({
728
- price: 13000 - 900,
774
+ price: 1300000 - 90000,
729
775
  }),
730
776
  ]);
731
777
  });
732
778
  test('The highest possible discount is granted', () => {
733
779
  const { organization, groups, family, discount } = setupDiscountTest({
734
780
  memberCount: 3,
735
- groupPrices: [5000, 4000],
781
+ groupPrices: [500000, 400000],
736
782
  groupNames: ['Group A', 'Group B'],
737
783
  bundleDiscount: createBundleDiscount({
738
784
  name: 'Bundle discount',
@@ -752,7 +798,7 @@ describe('Unit.RegisterCart', () => {
752
798
  customDiscounts: [
753
799
  GroupPriceDiscount_js_1.GroupPriceDiscount.create({
754
800
  value: ReduceablePrice_js_1.ReduceablePrice.create({
755
- price: 2000,
801
+ price: 200000,
756
802
  }),
757
803
  type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Fixed,
758
804
  }),
@@ -772,32 +818,32 @@ describe('Unit.RegisterCart', () => {
772
818
  cart.add(itemC);
773
819
  cart.calculatePrices();
774
820
  // Check price for items
775
- expect(itemA.calculatedPrice).toEqual(5000);
821
+ expect(itemA.calculatedPrice).toEqual(500000);
776
822
  expect(itemA.calculatedRefund).toEqual(0);
777
823
  expect(itemA.calculatedPriceDueLater).toEqual(0);
778
- expect(itemB.calculatedPrice).toEqual(4000);
824
+ expect(itemB.calculatedPrice).toEqual(400000);
779
825
  expect(itemB.calculatedRefund).toEqual(0);
780
826
  expect(itemB.calculatedPriceDueLater).toEqual(0);
781
- expect(itemC.calculatedPrice).toEqual(4000);
827
+ expect(itemC.calculatedPrice).toEqual(400000);
782
828
  expect(itemC.calculatedRefund).toEqual(0);
783
829
  expect(itemC.calculatedPriceDueLater).toEqual(0);
784
- // Check calculated discount is 50_00 * 0.10 + 20_00 fixed + 0 = 5_00 + 20_00 + 0 = 25_00
830
+ // Check calculated discount is 50_0000 * 0.10 + 20_0000 fixed + 0 = 5_0000 + 20_0000 + 0 = 25_0000
785
831
  expect(cart.bundleDiscounts).toHaveLength(1);
786
- expect(cart.bundleDiscounts[0].total).toEqual(2500);
832
+ expect(cart.bundleDiscounts[0].total).toEqual(250000);
787
833
  expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(0);
788
- expect(cart.bundleDiscounts[0].netTotal).toEqual(2500);
789
- expect(cart.price).toEqual(5000 + 4000 + 4000);
790
- expect(checkout.totalPrice).toEqual(5000 + 4000 + 4000 - 2500);
834
+ expect(cart.bundleDiscounts[0].netTotal).toEqual(250000);
835
+ expect(cart.price).toEqual(500000 + 400000 + 400000);
836
+ expect(checkout.totalPrice).toEqual(500000 + 400000 + 400000 - 250000);
791
837
  expect(checkout.priceBreakown).toEqual([
792
838
  expect.objectContaining({
793
- price: 13000,
839
+ price: 1300000,
794
840
  }),
795
841
  {
796
842
  name: 'Bundle discount',
797
- price: -2500,
843
+ price: -250000,
798
844
  },
799
845
  expect.objectContaining({
800
- price: 13000 - 2500,
846
+ price: 1300000 - 250000,
801
847
  }),
802
848
  ]);
803
849
  });
@@ -808,12 +854,12 @@ describe('Unit.RegisterCart', () => {
808
854
  // On top of that there is an extra discount if you combine multiple expensive camps (camp B) of 5 euro, 10 ...
809
855
  const { organization, groups, family, organizationRegistrationPeriod } = setupDiscountTest({
810
856
  memberCount: 5,
811
- groupPrices: [10000, 15000],
857
+ groupPrices: [1000000, 1500000],
812
858
  groupNames: ['Camp A', 'Camp B'],
813
859
  bundleDiscount: createBundleDiscount({
814
860
  name: 'All camp discount',
815
861
  discounts: [
816
- { value: 1000, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Fixed },
862
+ { value: 100000, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Fixed },
817
863
  ],
818
864
  }),
819
865
  });
@@ -822,7 +868,7 @@ describe('Unit.RegisterCart', () => {
822
868
  const expensiveCampDiscount = createBundleDiscount({
823
869
  name: 'Expensive camp discount',
824
870
  discounts: [
825
- { value: 500, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Fixed },
871
+ { value: 50000, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Fixed },
826
872
  ],
827
873
  });
828
874
  // Add discount to organizationRegistrationPeriod
@@ -835,10 +881,10 @@ describe('Unit.RegisterCart', () => {
835
881
  const checkout = family.checkout;
836
882
  const cart = checkout.cart;
837
883
  const itemA = RegisterItem_js_1.RegisterItem.defaultFor(memberA, campA, organization);
838
- const itemB = RegisterItem_js_1.RegisterItem.defaultFor(memberB, campB, organization); // +10_00 discount
839
- const itemC = RegisterItem_js_1.RegisterItem.defaultFor(memberC, campB, organization); // +10_00 discount and +5_00 discount
840
- const itemD = RegisterItem_js_1.RegisterItem.defaultFor(memberD, campA, organization); // +10_00 discount
841
- const itemE = RegisterItem_js_1.RegisterItem.defaultFor(memberE, campB, organization); // +10_00 discount and +5_00 discount
884
+ const itemB = RegisterItem_js_1.RegisterItem.defaultFor(memberB, campB, organization); // +10_0000 discount
885
+ const itemC = RegisterItem_js_1.RegisterItem.defaultFor(memberC, campB, organization); // +10_0000 discount and +5_0000 discount
886
+ const itemD = RegisterItem_js_1.RegisterItem.defaultFor(memberD, campA, organization); // +10_0000 discount
887
+ const itemE = RegisterItem_js_1.RegisterItem.defaultFor(memberE, campB, organization); // +10_0000 discount and +5_0000 discount
842
888
  cart.add(itemA);
843
889
  cart.add(itemB);
844
890
  cart.add(itemC);
@@ -855,29 +901,29 @@ describe('Unit.RegisterCart', () => {
855
901
  })).toEqual([
856
902
  {
857
903
  name: 'All camp discount',
858
- total: 1000 * 4,
859
- netTotal: 1000 * 4,
904
+ total: 100000 * 4,
905
+ netTotal: 100000 * 4,
860
906
  },
861
907
  {
862
908
  name: 'Expensive camp discount',
863
- total: 500 * 2,
864
- netTotal: 500 * 2,
909
+ total: 50000 * 2,
910
+ netTotal: 50000 * 2,
865
911
  },
866
912
  ]);
867
913
  expect(checkout.priceBreakown).toEqual([
868
914
  expect.objectContaining({
869
- price: 10000 * 2 + 15000 * 3,
915
+ price: 1000000 * 2 + 1500000 * 3,
870
916
  }),
871
917
  {
872
918
  name: 'All camp discount',
873
- price: -1000 * 4,
919
+ price: -100000 * 4,
874
920
  },
875
921
  {
876
922
  name: 'Expensive camp discount',
877
- price: -500 * 2,
923
+ price: -50000 * 2,
878
924
  },
879
925
  expect.objectContaining({
880
- price: 10000 * 2 + 15000 * 3 - 1000 * 4 - 500 * 2,
926
+ price: 1000000 * 2 + 1500000 * 3 - 100000 * 4 - 50000 * 2,
881
927
  }),
882
928
  ]);
883
929
  });
@@ -898,7 +944,7 @@ describe('Unit.RegisterCart', () => {
898
944
  { value: 1500, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Percentage },
899
945
  ],
900
946
  }),
901
- groupPrices: [10000, 4000],
947
+ groupPrices: [1000000, 400000],
902
948
  });
903
949
  const [groupA, groupB] = groups;
904
950
  const [memberA, memberB] = family.members;
@@ -906,7 +952,7 @@ describe('Unit.RegisterCart', () => {
906
952
  const registrationB = addHistoricRegistration(memberB, groupB, organization);
907
953
  registrationA.discounts.set(discount.id, AppliedRegistrationDiscount_js_1.AppliedRegistrationDiscount.create({
908
954
  name: discount.name,
909
- amount: 1000, // 10% discount on 100_00 = 10_00
955
+ amount: 100000, // 10% discount on 100_0000 = 10_0000
910
956
  }));
911
957
  // Now create itemC
912
958
  const itemC = RegisterItem_js_1.RegisterItem.defaultFor(memberA, groupB, organization);
@@ -916,26 +962,26 @@ describe('Unit.RegisterCart', () => {
916
962
  cart.add(itemC);
917
963
  cart.calculatePrices();
918
964
  // Check price for items
919
- expect(itemC.calculatedPrice).toEqual(4000);
965
+ expect(itemC.calculatedPrice).toEqual(400000);
920
966
  expect(itemC.calculatedRefund).toEqual(0);
921
967
  expect(itemC.calculatedPriceDueLater).toEqual(0);
922
- // Check calculated discount is 100_00 * 0.15 + 40_00 * 0.10 = 15_00 + 4_00 = 19_00
968
+ // Check calculated discount is 100_0000 * 0.15 + 40_0000 * 0.10 = 15_0000 + 4_0000 = 19_0000
923
969
  expect(cart.bundleDiscounts).toHaveLength(1);
924
- expect(cart.bundleDiscounts[0].total).toEqual(1900);
925
- expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(1000); // The previous discount
926
- expect(cart.bundleDiscounts[0].netTotal).toEqual(900);
927
- expect(cart.price).toEqual(4000);
928
- expect(checkout.totalPrice).toEqual(4000 - 900);
970
+ expect(cart.bundleDiscounts[0].total).toEqual(190000);
971
+ expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(100000); // The previous discount
972
+ expect(cart.bundleDiscounts[0].netTotal).toEqual(90000);
973
+ expect(cart.price).toEqual(400000);
974
+ expect(checkout.totalPrice).toEqual(400000 - 90000);
929
975
  expect(checkout.priceBreakown).toEqual([
930
976
  expect.objectContaining({
931
- price: 4000,
977
+ price: 400000,
932
978
  }),
933
979
  {
934
980
  name: 'Multiple family members discount',
935
- price: -900,
981
+ price: -90000,
936
982
  },
937
983
  expect.objectContaining({
938
- price: 4000 - 900,
984
+ price: 400000 - 90000,
939
985
  }),
940
986
  ]);
941
987
  });
@@ -944,7 +990,7 @@ describe('Unit.RegisterCart', () => {
944
990
  // The bundle discount only defined one discount, but that should be repated for the second and third item
945
991
  const { organization, groups, family, discount } = setupDiscountTest({
946
992
  memberCount: 3,
947
- groupPrices: [5000, 4000],
993
+ groupPrices: [500000, 400000],
948
994
  groupNames: ['Group A', 'Group B'],
949
995
  bundleDiscount: createBundleDiscount({
950
996
  name: 'Bundle discount',
@@ -967,32 +1013,32 @@ describe('Unit.RegisterCart', () => {
967
1013
  cart.add(itemC);
968
1014
  cart.calculatePrices();
969
1015
  // Check price for items
970
- expect(itemA.calculatedPrice).toEqual(5000);
1016
+ expect(itemA.calculatedPrice).toEqual(500000);
971
1017
  expect(itemA.calculatedRefund).toEqual(0);
972
1018
  expect(itemA.calculatedPriceDueLater).toEqual(0);
973
- expect(itemB.calculatedPrice).toEqual(4000);
1019
+ expect(itemB.calculatedPrice).toEqual(400000);
974
1020
  expect(itemB.calculatedRefund).toEqual(0);
975
1021
  expect(itemB.calculatedPriceDueLater).toEqual(0);
976
- expect(itemC.calculatedPrice).toEqual(4000);
1022
+ expect(itemC.calculatedPrice).toEqual(400000);
977
1023
  expect(itemC.calculatedRefund).toEqual(0);
978
1024
  expect(itemC.calculatedPriceDueLater).toEqual(0);
979
- // Check calculated discount is 50_00 * 0.10 = 5_00
1025
+ // Check calculated discount is 50_0000 * 0.10 = 5_0000
980
1026
  expect(cart.bundleDiscounts).toHaveLength(1);
981
- expect(cart.bundleDiscounts[0].total).toEqual(500);
1027
+ expect(cart.bundleDiscounts[0].total).toEqual(50000);
982
1028
  expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(0);
983
- expect(cart.bundleDiscounts[0].netTotal).toEqual(500);
984
- expect(cart.price).toEqual(5000 + 4000 + 4000);
985
- expect(checkout.totalPrice).toEqual(5000 + 4000 + 4000 - 500);
1029
+ expect(cart.bundleDiscounts[0].netTotal).toEqual(50000);
1030
+ expect(cart.price).toEqual(500000 + 400000 + 400000);
1031
+ expect(checkout.totalPrice).toEqual(500000 + 400000 + 400000 - 50000);
986
1032
  expect(checkout.priceBreakown).toEqual([
987
1033
  expect.objectContaining({
988
- price: 13000,
1034
+ price: 1300000,
989
1035
  }),
990
1036
  {
991
1037
  name: 'Bundle discount',
992
- price: -500,
1038
+ price: -50000,
993
1039
  },
994
1040
  expect.objectContaining({
995
- price: 13000 - 500,
1041
+ price: 1300000 - 50000,
996
1042
  }),
997
1043
  ]);
998
1044
  });
@@ -1003,7 +1049,7 @@ describe('Unit.RegisterCart', () => {
1003
1049
  // Create a 50%, 100% discount for the reduced price in a bundle discount (so it should be free in a family with 3 members)
1004
1050
  const { organization, groups, family } = setupDiscountTest({
1005
1051
  memberCount: 3,
1006
- groupPrices: [5000, 4000],
1052
+ groupPrices: [500000, 400000],
1007
1053
  groupNames: ['Group A', 'Group B'],
1008
1054
  bundleDiscount: createBundleDiscount({
1009
1055
  name: 'Bundle discount',
@@ -1028,42 +1074,42 @@ describe('Unit.RegisterCart', () => {
1028
1074
  cart.add(itemC);
1029
1075
  cart.calculatePrices();
1030
1076
  // Check price for items
1031
- expect(itemA.calculatedPrice).toEqual(5000);
1032
- expect(itemB.calculatedPrice).toEqual(4000);
1033
- expect(itemC.calculatedPrice).toEqual(4000);
1034
- // Check calculated discount is 40_00 * 1 + 50_00 * 5% = 40_00 + 2_50 = 42_50
1077
+ expect(itemA.calculatedPrice).toEqual(500000);
1078
+ expect(itemB.calculatedPrice).toEqual(400000);
1079
+ expect(itemC.calculatedPrice).toEqual(400000);
1080
+ // Check calculated discount is 40_0000 * 1 + 50_0000 * 5% = 40_0000 + 2_5000 = 42_5000
1035
1081
  expect(cart.bundleDiscounts).toHaveLength(1);
1036
- expect(cart.bundleDiscounts[0].total).toEqual(4250);
1082
+ expect(cart.bundleDiscounts[0].total).toEqual(425000);
1037
1083
  expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(0);
1038
- expect(cart.bundleDiscounts[0].netTotal).toEqual(4250);
1039
- expect(cart.price).toEqual(5000 + 4000 + 4000);
1040
- expect(checkout.totalPrice).toEqual(5000 + 4000 + 4000 - 4250);
1084
+ expect(cart.bundleDiscounts[0].netTotal).toEqual(425000);
1085
+ expect(cart.price).toEqual(500000 + 400000 + 400000);
1086
+ expect(checkout.totalPrice).toEqual(500000 + 400000 + 400000 - 425000);
1041
1087
  expect(checkout.priceBreakown).toEqual([
1042
1088
  expect.objectContaining({
1043
- price: 13000,
1089
+ price: 1300000,
1044
1090
  }),
1045
1091
  {
1046
1092
  name: 'Bundle discount',
1047
- price: -4250,
1093
+ price: -425000,
1048
1094
  },
1049
1095
  expect.objectContaining({
1050
- price: 13000 - 4250,
1096
+ price: 1300000 - 425000,
1051
1097
  }),
1052
1098
  ]);
1053
1099
  // Remove requires financial support, then recalculate
1054
1100
  memberC.member.details.requiresFinancialSupport = MemberDetails_js_1.BooleanStatus.create({ value: false });
1055
1101
  cart.calculatePrices();
1056
- // 10% on 50_00 + 5% on 40_00 = 5_00 + 2_00 = 7_00
1102
+ // 10% on 50_0000 + 5% on 40_0000 = 5_0000 + 2_0000 = 7_0000
1057
1103
  expect(checkout.priceBreakown).toEqual([
1058
1104
  expect.objectContaining({
1059
- price: 13000,
1105
+ price: 1300000,
1060
1106
  }),
1061
1107
  {
1062
1108
  name: 'Bundle discount',
1063
- price: -700,
1109
+ price: -70000,
1064
1110
  },
1065
1111
  expect.objectContaining({
1066
- price: 13000 - 700,
1112
+ price: 1300000 - 70000,
1067
1113
  }),
1068
1114
  ]);
1069
1115
  });
@@ -1095,25 +1141,25 @@ describe('Unit.RegisterCart', () => {
1095
1141
  cart.add(itemC);
1096
1142
  cart.calculatePrices();
1097
1143
  // Check price for items
1098
- expect(itemA.calculatedPrice).toEqual(5000);
1099
- expect(itemB.calculatedPrice).toEqual(4000);
1100
- expect(itemC.calculatedPrice).toEqual(5000);
1101
- // Check calculated discount is 50_00 * 0.10 = 5_00
1144
+ expect(itemA.calculatedPrice).toEqual(500000);
1145
+ expect(itemB.calculatedPrice).toEqual(400000);
1146
+ expect(itemC.calculatedPrice).toEqual(500000);
1147
+ // Check calculated discount is 50_0000 * 0.10 = 5_0000
1102
1148
  expect(cart.bundleDiscounts.map(c => c.netTotal)).toHaveLength(1);
1103
- expect(cart.bundleDiscounts[0].total).toEqual(500);
1104
- expect(cart.bundleDiscounts[0].netTotal).toEqual(500);
1105
- expect(cart.price).toEqual(5000 + 4000 + 5000);
1106
- expect(checkout.totalPrice).toEqual(5000 + 4000 + 5000 - 500);
1149
+ expect(cart.bundleDiscounts[0].total).toEqual(50000);
1150
+ expect(cart.bundleDiscounts[0].netTotal).toEqual(50000);
1151
+ expect(cart.price).toEqual(500000 + 400000 + 500000);
1152
+ expect(checkout.totalPrice).toEqual(500000 + 400000 + 500000 - 50000);
1107
1153
  expect(checkout.priceBreakown).toEqual([
1108
1154
  expect.objectContaining({
1109
- price: 5000 + 4000 + 5000,
1155
+ price: 500000 + 400000 + 500000,
1110
1156
  }),
1111
1157
  {
1112
1158
  name: 'Multiple lessons discount (John)',
1113
- price: -500,
1159
+ price: -50000,
1114
1160
  },
1115
1161
  expect.objectContaining({
1116
- price: 5000 + 4000 + 5000 - 500,
1162
+ price: 500000 + 400000 + 500000 - 50000,
1117
1163
  }),
1118
1164
  ]);
1119
1165
  // Add a historic registration for member B, so it also gets a discount
@@ -1121,18 +1167,18 @@ describe('Unit.RegisterCart', () => {
1121
1167
  cart.calculatePrices();
1122
1168
  expect(checkout.priceBreakown).toEqual([
1123
1169
  expect.objectContaining({
1124
- price: 5000 + 4000 + 5000, // no change
1170
+ price: 500000 + 400000 + 500000, // no change
1125
1171
  }),
1126
1172
  {
1127
1173
  name: 'Multiple lessons discount (John)',
1128
- price: -500,
1174
+ price: -50000,
1129
1175
  },
1130
1176
  {
1131
1177
  name: 'Multiple lessons discount (Jane)',
1132
- price: -500,
1178
+ price: -50000,
1133
1179
  },
1134
1180
  expect.objectContaining({
1135
- price: 5000 + 4000 + 5000 - 500 - 500,
1181
+ price: 500000 + 400000 + 500000 - 50000 - 50000,
1136
1182
  }),
1137
1183
  ]);
1138
1184
  });
@@ -1162,27 +1208,27 @@ describe('Unit.RegisterCart', () => {
1162
1208
  cart.calculatePrices();
1163
1209
  // No discount should be applied yet (need at least 2 different groups)
1164
1210
  expect(cart.bundleDiscounts).toHaveLength(0);
1165
- expect(checkout.totalPrice).toEqual(5000 + 4000);
1211
+ expect(checkout.totalPrice).toEqual(500000 + 400000);
1166
1212
  // Now register one member for group B as well
1167
1213
  const itemC = RegisterItem_js_1.RegisterItem.defaultFor(memberA, groupB, organization);
1168
1214
  cart.add(itemC);
1169
1215
  cart.calculatePrices();
1170
1216
  // Now we should get a discount
1171
1217
  expect(cart.bundleDiscounts).toHaveLength(1);
1172
- expect(cart.bundleDiscounts[0].total).toEqual(400); // 10% of 40_00 (not 50_00)
1173
- expect(cart.bundleDiscounts[0].netTotal).toEqual(400);
1174
- expect(cart.price).toEqual(5000 + 4000 + 4000);
1175
- expect(checkout.totalPrice).toEqual(5000 + 4000 + 4000 - 400);
1218
+ expect(cart.bundleDiscounts[0].total).toEqual(40000); // 10% of 40_0000 (not 50_0000)
1219
+ expect(cart.bundleDiscounts[0].netTotal).toEqual(40000);
1220
+ expect(cart.price).toEqual(500000 + 400000 + 400000);
1221
+ expect(checkout.totalPrice).toEqual(500000 + 400000 + 400000 - 40000);
1176
1222
  expect(checkout.priceBreakown).toEqual([
1177
1223
  expect.objectContaining({
1178
- price: 5000 + 4000 + 4000,
1224
+ price: 500000 + 400000 + 400000,
1179
1225
  }),
1180
1226
  {
1181
1227
  name: 'Multiple family members discount (Group B)',
1182
- price: -400,
1228
+ price: -40000,
1183
1229
  },
1184
1230
  expect.objectContaining({
1185
- price: 5000 + 4000 + 4000 - 400,
1231
+ price: 500000 + 400000 + 400000 - 40000,
1186
1232
  }),
1187
1233
  ]);
1188
1234
  // Change calculation to count across groups
@@ -1191,14 +1237,14 @@ describe('Unit.RegisterCart', () => {
1191
1237
  // Now we should get a discount for both groups
1192
1238
  expect(checkout.priceBreakown).toEqual([
1193
1239
  expect.objectContaining({
1194
- price: 5000 + 4000 + 4000,
1240
+ price: 500000 + 400000 + 400000,
1195
1241
  }),
1196
1242
  {
1197
1243
  name: 'Multiple family members discount',
1198
- price: -900,
1244
+ price: -90000,
1199
1245
  },
1200
1246
  expect.objectContaining({
1201
- price: 5000 + 4000 + 4000 - 900,
1247
+ price: 500000 + 400000 + 400000 - 90000,
1202
1248
  }),
1203
1249
  ]);
1204
1250
  });
@@ -1230,25 +1276,25 @@ describe('Unit.RegisterCart', () => {
1230
1276
  cart.add(itemC);
1231
1277
  cart.calculatePrices();
1232
1278
  // Check price for items
1233
- expect(itemA.calculatedPrice).toEqual(5000);
1234
- expect(itemB.calculatedPrice).toEqual(4000);
1235
- expect(itemC.calculatedPrice).toEqual(5000);
1279
+ expect(itemA.calculatedPrice).toEqual(500000);
1280
+ expect(itemB.calculatedPrice).toEqual(400000);
1281
+ expect(itemC.calculatedPrice).toEqual(500000);
1236
1282
  // Check calculated discount - should only apply to member A (who has multiple registrations)
1237
1283
  expect(cart.bundleDiscounts).toHaveLength(1);
1238
- expect(cart.bundleDiscounts[0].total).toEqual(500); // 10% of 50_00 (we always apply discounts to highest price first)
1239
- expect(cart.bundleDiscounts[0].netTotal).toEqual(500);
1240
- expect(cart.price).toEqual(5000 + 4000 + 5000);
1241
- expect(checkout.totalPrice).toEqual(5000 + 4000 + 5000 - 500);
1284
+ expect(cart.bundleDiscounts[0].total).toEqual(50000); // 10% of 50_0000 (we always apply discounts to highest price first)
1285
+ expect(cart.bundleDiscounts[0].netTotal).toEqual(50000);
1286
+ expect(cart.price).toEqual(500000 + 400000 + 500000);
1287
+ expect(checkout.totalPrice).toEqual(500000 + 400000 + 500000 - 50000);
1242
1288
  expect(checkout.priceBreakown).toEqual([
1243
1289
  expect.objectContaining({
1244
- price: 5000 + 4000 + 5000,
1290
+ price: 500000 + 400000 + 500000,
1245
1291
  }),
1246
1292
  {
1247
1293
  name: 'Multiple lessons discount (John)',
1248
- price: -500,
1294
+ price: -50000,
1249
1295
  },
1250
1296
  expect.objectContaining({
1251
- price: 5000 + 4000 + 5000 - 500,
1297
+ price: 500000 + 400000 + 500000 - 50000,
1252
1298
  }),
1253
1299
  ]);
1254
1300
  // Now explicitly turn on countPerGroup and set countWholeFamily to true
@@ -1259,14 +1305,14 @@ describe('Unit.RegisterCart', () => {
1259
1305
  // Now we should get a discount for group A (since two members are registered for it)
1260
1306
  expect(checkout.priceBreakown).toEqual([
1261
1307
  expect.objectContaining({
1262
- price: 5000 + 4000 + 5000,
1308
+ price: 500000 + 400000 + 500000,
1263
1309
  }),
1264
1310
  {
1265
1311
  name: 'Multiple lessons discount (Group A)',
1266
- price: -500, // 10% of the second 50_00
1312
+ price: -50000, // 10% of the second 50_0000
1267
1313
  },
1268
1314
  expect.objectContaining({
1269
- price: 5000 + 4000 + 5000 - 500,
1315
+ price: 500000 + 400000 + 500000 - 50000,
1270
1316
  }),
1271
1317
  ]);
1272
1318
  });
@@ -1275,7 +1321,7 @@ describe('Unit.RegisterCart', () => {
1275
1321
  // now, add a new registration to the cart that is not applicable to the discount - the old discount should not be altered
1276
1322
  const { organization, groups, family, period, discount } = setupDiscountTest({
1277
1323
  memberCount: 2,
1278
- groupPrices: [5000, 4000],
1324
+ groupPrices: [500000, 400000],
1279
1325
  groupNames: ['Group A', 'Group B'],
1280
1326
  bundleDiscount: createBundleDiscount({
1281
1327
  name: 'Multiple family members discount',
@@ -1291,19 +1337,19 @@ describe('Unit.RegisterCart', () => {
1291
1337
  const registrationA = addHistoricRegistration(memberA, groupA, organization);
1292
1338
  const registrationB = addHistoricRegistration(memberB, groupB, organization);
1293
1339
  // Create a new group that is not applicable to the discount
1294
- const [groupC] = createTestGroups(organization, period, [3000], ['Group C']);
1340
+ const [groupC] = createTestGroups(organization, period, [300000], ['Group C']);
1295
1341
  const itemC = RegisterItem_js_1.RegisterItem.defaultFor(memberA, groupC, organization);
1296
1342
  // Add to a single cart
1297
1343
  const checkout = family.checkout;
1298
1344
  const cart = checkout.cart;
1299
1345
  cart.add(itemC);
1300
1346
  cart.calculatePrices();
1301
- expect(itemC.calculatedPrice).toEqual(3000);
1347
+ expect(itemC.calculatedPrice).toEqual(300000);
1302
1348
  expect(cart.bundleDiscounts).toHaveLength(0);
1303
- expect(checkout.totalPrice).toEqual(3000);
1349
+ expect(checkout.totalPrice).toEqual(300000);
1304
1350
  expect(checkout.priceBreakown).toEqual([
1305
1351
  expect.objectContaining({
1306
- price: 3000,
1352
+ price: 300000,
1307
1353
  }),
1308
1354
  ]);
1309
1355
  // Now also register memberB for group A and add it to the cart
@@ -1311,26 +1357,26 @@ describe('Unit.RegisterCart', () => {
1311
1357
  cart.add(itemD);
1312
1358
  cart.calculatePrices();
1313
1359
  // Check price for items
1314
- expect(itemD.calculatedPrice).toEqual(5000);
1315
- expect(itemC.calculatedPrice).toEqual(3000);
1360
+ expect(itemD.calculatedPrice).toEqual(500000);
1361
+ expect(itemC.calculatedPrice).toEqual(300000);
1316
1362
  // Check calculated discount: should also take old registrations into account
1317
- // 50_00 * 10% + 50_00 * 10% = 5_00 + 5_00 = 10_00
1363
+ // 50_0000 * 10% + 50_0000 * 10% = 5_0000 + 5_0000 = 10_0000
1318
1364
  expect(cart.bundleDiscounts).toHaveLength(1);
1319
- expect(cart.bundleDiscounts[0].total).toEqual(1000);
1365
+ expect(cart.bundleDiscounts[0].total).toEqual(100000);
1320
1366
  expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(0);
1321
- expect(cart.bundleDiscounts[0].netTotal).toEqual(1000);
1322
- expect(cart.price).toEqual(5000 + 3000);
1323
- expect(checkout.totalPrice).toEqual(5000 + 3000 - 1000);
1367
+ expect(cart.bundleDiscounts[0].netTotal).toEqual(100000);
1368
+ expect(cart.price).toEqual(500000 + 300000);
1369
+ expect(checkout.totalPrice).toEqual(500000 + 300000 - 100000);
1324
1370
  expect(checkout.priceBreakown).toEqual([
1325
1371
  expect.objectContaining({
1326
- price: 5000 + 3000,
1372
+ price: 500000 + 300000,
1327
1373
  }),
1328
1374
  {
1329
1375
  name: 'Multiple family members discount',
1330
- price: -1000,
1376
+ price: -100000,
1331
1377
  },
1332
1378
  expect.objectContaining({
1333
- price: 5000 + 3000 - 1000,
1379
+ price: 500000 + 300000 - 100000,
1334
1380
  }),
1335
1381
  ]);
1336
1382
  });
@@ -1343,7 +1389,7 @@ describe('Unit.RegisterCart', () => {
1343
1389
  countWholeFamily: true,
1344
1390
  countPerGroup: false,
1345
1391
  discounts: [
1346
- { value: 100000, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Fixed },
1392
+ { value: 10000000, type: GroupPriceDiscount_js_1.GroupPriceDiscountType.Fixed },
1347
1393
  ],
1348
1394
  }),
1349
1395
  });
@@ -1358,21 +1404,21 @@ describe('Unit.RegisterCart', () => {
1358
1404
  cart.add(itemB);
1359
1405
  cart.calculatePrices();
1360
1406
  expect(cart.bundleDiscounts).toHaveLength(1);
1361
- expect(cart.bundleDiscounts[0].total).toEqual(5000);
1407
+ expect(cart.bundleDiscounts[0].total).toEqual(500000);
1362
1408
  expect(cart.bundleDiscounts[0].totalAlreadyApplied).toEqual(0);
1363
- expect(cart.bundleDiscounts[0].netTotal).toEqual(5000);
1364
- expect(cart.price).toEqual(5000 + 4000);
1365
- expect(checkout.totalPrice).toEqual(4000);
1409
+ expect(cart.bundleDiscounts[0].netTotal).toEqual(500000);
1410
+ expect(cart.price).toEqual(500000 + 400000);
1411
+ expect(checkout.totalPrice).toEqual(400000);
1366
1412
  expect(checkout.priceBreakown).toEqual([
1367
1413
  expect.objectContaining({
1368
- price: 5000 + 4000,
1414
+ price: 500000 + 400000,
1369
1415
  }),
1370
1416
  {
1371
1417
  name: 'Multiple family members discount',
1372
- price: -5000,
1418
+ price: -500000,
1373
1419
  },
1374
1420
  expect.objectContaining({
1375
- price: 4000,
1421
+ price: 400000,
1376
1422
  }),
1377
1423
  ]);
1378
1424
  });