@medusajs/medusa 1.1.63 → 1.2.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 (293) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/api/index.d.ts +2 -0
  3. package/dist/api/index.js +2 -0
  4. package/dist/api/index.js.map +1 -1
  5. package/dist/api/routes/admin/collections/add-products.d.ts +32 -0
  6. package/dist/api/routes/admin/{product-tags/update-collection.js → collections/add-products.js} +25 -45
  7. package/dist/api/routes/admin/collections/add-products.js.map +1 -0
  8. package/dist/api/routes/admin/collections/index.d.ts +2 -0
  9. package/dist/api/routes/admin/collections/index.js +11 -1
  10. package/dist/api/routes/admin/collections/index.js.map +1 -1
  11. package/dist/api/routes/admin/collections/remove-products.d.ts +32 -0
  12. package/dist/api/routes/admin/{product-tags/create-collection.js → collections/remove-products.js} +35 -49
  13. package/dist/api/routes/admin/collections/remove-products.js.map +1 -0
  14. package/dist/api/routes/admin/customer-groups/create-customer-group.d.ts +27 -0
  15. package/dist/api/routes/admin/customer-groups/create-customer-group.js +103 -0
  16. package/dist/api/routes/admin/customer-groups/create-customer-group.js.map +1 -0
  17. package/dist/api/routes/admin/customer-groups/delete-customer-group.d.ts +28 -0
  18. package/dist/api/routes/admin/{product-tags/delete-collection.js → customer-groups/delete-customer-group.js} +25 -25
  19. package/dist/api/routes/admin/customer-groups/delete-customer-group.js.map +1 -0
  20. package/dist/api/routes/admin/customer-groups/delete-customers-batch.d.ts +27 -0
  21. package/dist/api/routes/admin/customer-groups/delete-customers-batch.js +106 -0
  22. package/dist/api/routes/admin/customer-groups/delete-customers-batch.js.map +1 -0
  23. package/dist/api/routes/admin/customer-groups/get-customer-group.d.ts +25 -0
  24. package/dist/api/routes/admin/customer-groups/get-customer-group.js +113 -0
  25. package/dist/api/routes/admin/customer-groups/get-customer-group.js.map +1 -0
  26. package/dist/api/routes/admin/customer-groups/index.d.ts +13 -0
  27. package/dist/api/routes/admin/customer-groups/index.js +31 -0
  28. package/dist/api/routes/admin/customer-groups/index.js.map +1 -0
  29. package/dist/api/routes/admin/customer-groups/update-customer-group.d.ts +28 -0
  30. package/dist/api/routes/admin/customer-groups/update-customer-group.js +124 -0
  31. package/dist/api/routes/admin/customer-groups/update-customer-group.js.map +1 -0
  32. package/dist/api/routes/admin/customers/get-customer.js +18 -5
  33. package/dist/api/routes/admin/customers/get-customer.js.map +1 -1
  34. package/dist/api/routes/admin/customers/index.d.ts +1 -0
  35. package/dist/api/routes/admin/customers/index.js +2 -0
  36. package/dist/api/routes/admin/customers/index.js.map +1 -1
  37. package/dist/api/routes/admin/customers/update-customer.d.ts +14 -0
  38. package/dist/api/routes/admin/customers/update-customer.js +49 -10
  39. package/dist/api/routes/admin/customers/update-customer.js.map +1 -1
  40. package/dist/api/routes/admin/draft-orders/create-draft-order.d.ts +3 -3
  41. package/dist/api/routes/admin/draft-orders/create-draft-order.js.map +1 -1
  42. package/dist/api/routes/admin/draft-orders/create-line-item.d.ts +1 -1
  43. package/dist/api/routes/admin/draft-orders/create-line-item.js.map +1 -1
  44. package/dist/api/routes/admin/draft-orders/update-line-item.d.ts +1 -1
  45. package/dist/api/routes/admin/draft-orders/update-line-item.js.map +1 -1
  46. package/dist/api/routes/admin/index.js +6 -0
  47. package/dist/api/routes/admin/index.js.map +1 -1
  48. package/dist/api/routes/admin/orders/add-shipping-method.d.ts +1 -1
  49. package/dist/api/routes/admin/orders/add-shipping-method.js.map +1 -1
  50. package/dist/api/routes/admin/orders/create-claim.js +9 -1
  51. package/dist/api/routes/admin/orders/create-claim.js.map +1 -1
  52. package/dist/api/routes/admin/orders/create-swap-shipment.js +1 -0
  53. package/dist/api/routes/admin/orders/create-swap-shipment.js.map +1 -1
  54. package/dist/api/routes/admin/orders/create-swap.js +7 -1
  55. package/dist/api/routes/admin/orders/create-swap.js.map +1 -1
  56. package/dist/api/routes/admin/orders/index.d.ts +0 -1
  57. package/dist/api/routes/admin/orders/index.js +2 -5
  58. package/dist/api/routes/admin/orders/index.js.map +1 -1
  59. package/dist/api/routes/admin/product-types/index.d.ts +15 -0
  60. package/dist/api/routes/admin/product-types/index.js +40 -0
  61. package/dist/api/routes/admin/product-types/index.js.map +1 -0
  62. package/dist/api/routes/admin/product-types/list-product-types.d.ts +39 -0
  63. package/dist/api/routes/admin/{product-tags/list-collections.js → product-types/list-product-types.js} +72 -76
  64. package/dist/api/routes/admin/product-types/list-product-types.js.map +1 -0
  65. package/dist/api/routes/admin/regions/index.js +3 -0
  66. package/dist/api/routes/admin/regions/index.js.map +1 -1
  67. package/dist/api/routes/admin/regions/list-regions.d.ts +27 -3
  68. package/dist/api/routes/admin/regions/list-regions.js +91 -11
  69. package/dist/api/routes/admin/regions/list-regions.js.map +1 -1
  70. package/dist/api/routes/admin/regions/update-region.d.ts +12 -0
  71. package/dist/api/routes/admin/regions/update-region.js +24 -0
  72. package/dist/api/routes/admin/regions/update-region.js.map +1 -1
  73. package/dist/api/routes/admin/shipping-options/index.d.ts +2 -2
  74. package/dist/api/routes/admin/shipping-options/list-shipping-options.js +23 -7
  75. package/dist/api/routes/admin/shipping-options/list-shipping-options.js.map +1 -1
  76. package/dist/api/routes/admin/store/index.d.ts +4 -1
  77. package/dist/api/routes/admin/store/index.js +1 -0
  78. package/dist/api/routes/admin/store/index.js.map +1 -1
  79. package/dist/api/routes/admin/store/list-tax-providers.d.ts +22 -0
  80. package/dist/api/routes/admin/{product-tags/get-collection.js → store/list-tax-providers.js} +21 -22
  81. package/dist/api/routes/admin/store/list-tax-providers.js.map +1 -0
  82. package/dist/api/routes/admin/swaps/index.js +0 -6
  83. package/dist/api/routes/admin/swaps/index.js.map +1 -1
  84. package/dist/api/routes/admin/tax-rates/add-to-product-types.d.ts +1 -1
  85. package/dist/api/routes/admin/tax-rates/add-to-product-types.js +4 -59
  86. package/dist/api/routes/admin/tax-rates/add-to-product-types.js.map +1 -1
  87. package/dist/api/routes/admin/tax-rates/add-to-products.d.ts +1 -1
  88. package/dist/api/routes/admin/tax-rates/add-to-products.js +4 -55
  89. package/dist/api/routes/admin/tax-rates/add-to-products.js.map +1 -1
  90. package/dist/api/routes/admin/tax-rates/add-to-shipping-options.d.ts +1 -1
  91. package/dist/api/routes/admin/tax-rates/add-to-shipping-options.js +4 -59
  92. package/dist/api/routes/admin/tax-rates/add-to-shipping-options.js.map +1 -1
  93. package/dist/api/routes/admin/tax-rates/create-tax-rate.js +14 -113
  94. package/dist/api/routes/admin/tax-rates/create-tax-rate.js.map +1 -1
  95. package/dist/api/routes/admin/tax-rates/index.d.ts +3 -0
  96. package/dist/api/routes/admin/tax-rates/index.js +18 -3
  97. package/dist/api/routes/admin/tax-rates/index.js.map +1 -1
  98. package/dist/api/routes/admin/tax-rates/list-tax-rates.d.ts +2 -2
  99. package/dist/api/routes/admin/tax-rates/list-tax-rates.js.map +1 -1
  100. package/dist/api/routes/admin/tax-rates/remove-from-product-types.d.ts +29 -0
  101. package/dist/api/routes/admin/tax-rates/remove-from-product-types.js +122 -0
  102. package/dist/api/routes/admin/tax-rates/remove-from-product-types.js.map +1 -0
  103. package/dist/api/routes/admin/tax-rates/remove-from-products.d.ts +29 -0
  104. package/dist/api/routes/admin/tax-rates/remove-from-products.js +122 -0
  105. package/dist/api/routes/admin/tax-rates/remove-from-products.js.map +1 -0
  106. package/dist/api/routes/admin/tax-rates/remove-from-shipping-options.d.ts +29 -0
  107. package/dist/api/routes/admin/tax-rates/remove-from-shipping-options.js +122 -0
  108. package/dist/api/routes/admin/tax-rates/remove-from-shipping-options.js.map +1 -0
  109. package/dist/api/routes/admin/tax-rates/update-tax-rate.js +15 -116
  110. package/dist/api/routes/admin/tax-rates/update-tax-rate.js.map +1 -1
  111. package/dist/api/routes/store/carts/add-shipping-method.d.ts +1 -1
  112. package/dist/api/routes/store/carts/add-shipping-method.js.map +1 -1
  113. package/dist/api/routes/store/carts/complete-cart.js +11 -247
  114. package/dist/api/routes/store/carts/complete-cart.js.map +1 -1
  115. package/dist/api/routes/store/carts/index.js +2 -0
  116. package/dist/api/routes/store/carts/index.js.map +1 -1
  117. package/dist/api/routes/store/swaps/create-swap.js +7 -1
  118. package/dist/api/routes/store/swaps/create-swap.js.map +1 -1
  119. package/dist/db-subscribers/region.d.ts +6 -0
  120. package/dist/db-subscribers/region.js +84 -0
  121. package/dist/db-subscribers/region.js.map +1 -0
  122. package/dist/entity-subscribers/region.d.ts +6 -0
  123. package/dist/entity-subscribers/region.js +27 -0
  124. package/dist/entity-subscribers/region.js.map +1 -0
  125. package/dist/helpers/test-request.js +2 -0
  126. package/dist/helpers/test-request.js.map +1 -1
  127. package/dist/index.d.ts +59 -50
  128. package/dist/index.js +60 -101
  129. package/dist/index.js.map +1 -1
  130. package/dist/loaders/db-subscribers.d.ts +6 -0
  131. package/dist/loaders/db-subscribers.js +53 -0
  132. package/dist/loaders/db-subscribers.js.map +1 -0
  133. package/dist/loaders/index.d.ts +2 -1
  134. package/dist/loaders/index.js +17 -4
  135. package/dist/loaders/index.js.map +1 -1
  136. package/dist/loaders/models.js.map +1 -1
  137. package/dist/loaders/passport.js.map +1 -1
  138. package/dist/loaders/plugins.js +26 -0
  139. package/dist/loaders/plugins.js.map +1 -1
  140. package/dist/loaders/services.d.ts +2 -1
  141. package/dist/loaders/services.js +9 -7
  142. package/dist/loaders/services.js.map +1 -1
  143. package/dist/migrations/1641636508055-new_tax_system.js +9 -9
  144. package/dist/migrations/1641636508055-new_tax_system.js.map +1 -1
  145. package/dist/migrations/1644943746861-customer_groups.d.ts +6 -0
  146. package/dist/migrations/1644943746861-customer_groups.js +107 -0
  147. package/dist/migrations/1644943746861-customer_groups.js.map +1 -0
  148. package/dist/models/cart.d.ts +2 -1
  149. package/dist/models/cart.js +1 -0
  150. package/dist/models/cart.js.map +1 -1
  151. package/dist/models/customer-group.d.ts +11 -0
  152. package/dist/models/customer-group.js +81 -0
  153. package/dist/models/customer-group.js.map +1 -0
  154. package/dist/models/customer.d.ts +2 -0
  155. package/dist/models/customer.js +18 -1
  156. package/dist/models/customer.js.map +1 -1
  157. package/dist/models/line-item.d.ts +3 -0
  158. package/dist/models/line-item.js +9 -0
  159. package/dist/models/line-item.js.map +1 -1
  160. package/dist/models/order.d.ts +2 -1
  161. package/dist/models/order.js +3 -2
  162. package/dist/models/order.js.map +1 -1
  163. package/dist/models/product-tax-rate.d.ts +0 -1
  164. package/dist/models/product-tax-rate.js +5 -7
  165. package/dist/models/product-tax-rate.js.map +1 -1
  166. package/dist/models/product-type-tax-rate.d.ts +0 -1
  167. package/dist/models/product-type-tax-rate.js +2 -6
  168. package/dist/models/product-type-tax-rate.js.map +1 -1
  169. package/dist/models/product.d.ts +1 -1
  170. package/dist/models/product.js +2 -2
  171. package/dist/models/product.js.map +1 -1
  172. package/dist/models/region.d.ts +7 -0
  173. package/dist/models/region.js +31 -2
  174. package/dist/models/region.js.map +1 -1
  175. package/dist/models/shipping-method.d.ts +2 -0
  176. package/dist/models/shipping-method.js +7 -0
  177. package/dist/models/shipping-method.js.map +1 -1
  178. package/dist/models/shipping-tax-rate.d.ts +0 -1
  179. package/dist/models/shipping-tax-rate.js +2 -6
  180. package/dist/models/shipping-tax-rate.js.map +1 -1
  181. package/dist/models/swap.d.ts +1 -1
  182. package/dist/models/swap.js +1 -1
  183. package/dist/models/swap.js.map +1 -1
  184. package/dist/repositories/customer-group.d.ts +5 -0
  185. package/dist/repositories/customer-group.js +91 -0
  186. package/dist/repositories/customer-group.js.map +1 -0
  187. package/dist/repositories/line-item.d.ts +12 -0
  188. package/dist/repositories/line-item.js +61 -0
  189. package/dist/repositories/line-item.js.map +1 -1
  190. package/dist/repositories/money-amount.d.ts +6 -0
  191. package/dist/repositories/money-amount.js +97 -0
  192. package/dist/repositories/money-amount.js.map +1 -1
  193. package/dist/repositories/product.d.ts +2 -0
  194. package/dist/repositories/product.js +32 -0
  195. package/dist/repositories/product.js.map +1 -1
  196. package/dist/repositories/tax-provider.d.ts +4 -0
  197. package/dist/repositories/tax-provider.js +38 -0
  198. package/dist/repositories/tax-provider.js.map +1 -0
  199. package/dist/repositories/tax-rate.d.ts +7 -4
  200. package/dist/repositories/tax-rate.js +96 -21
  201. package/dist/repositories/tax-rate.js.map +1 -1
  202. package/dist/services/cart.d.ts +92 -114
  203. package/dist/services/cart.js +142 -144
  204. package/dist/services/cart.js.map +1 -1
  205. package/dist/services/claim.d.ts +22 -33
  206. package/dist/services/claim.js +106 -95
  207. package/dist/services/claim.js.map +1 -1
  208. package/dist/services/customer-group.d.ts +54 -0
  209. package/dist/services/customer-group.js +265 -0
  210. package/dist/services/customer-group.js.map +1 -0
  211. package/dist/services/customer.d.ts +3 -1
  212. package/dist/services/customer.js +28 -17
  213. package/dist/services/customer.js.map +1 -1
  214. package/dist/services/fulfillment.js +1 -1
  215. package/dist/services/fulfillment.js.map +1 -1
  216. package/dist/services/gift-card.js +1 -1
  217. package/dist/services/gift-card.js.map +1 -1
  218. package/dist/services/index.d.ts +4 -0
  219. package/dist/services/index.js +9 -1
  220. package/dist/services/index.js.map +1 -1
  221. package/dist/services/invite.d.ts +3 -3
  222. package/dist/services/invite.js +4 -2
  223. package/dist/services/invite.js.map +1 -1
  224. package/dist/services/line-item.d.ts +12 -1
  225. package/dist/services/line-item.js +49 -1
  226. package/dist/services/line-item.js.map +1 -1
  227. package/dist/services/order.d.ts +6 -2
  228. package/dist/services/order.js +186 -80
  229. package/dist/services/order.js.map +1 -1
  230. package/dist/services/product-collection.d.ts +2 -0
  231. package/dist/services/product-collection.js +49 -0
  232. package/dist/services/product-collection.js.map +1 -1
  233. package/dist/services/product-type.d.ts +15 -0
  234. package/dist/services/product-type.js +44 -0
  235. package/dist/services/product-type.js.map +1 -1
  236. package/dist/services/product-variant.d.ts +2 -1
  237. package/dist/services/product-variant.js +96 -85
  238. package/dist/services/product-variant.js.map +1 -1
  239. package/dist/services/product.js +3 -1
  240. package/dist/services/product.js.map +1 -1
  241. package/dist/services/region.d.ts +4 -1
  242. package/dist/services/region.js +25 -10
  243. package/dist/services/region.js.map +1 -1
  244. package/dist/services/return.d.ts +3 -1
  245. package/dist/services/return.js +37 -26
  246. package/dist/services/return.js.map +1 -1
  247. package/dist/services/shipping-option.d.ts +7 -4
  248. package/dist/services/shipping-option.js +22 -5
  249. package/dist/services/shipping-option.js.map +1 -1
  250. package/dist/services/swap.d.ts +5 -22
  251. package/dist/services/swap.js +308 -454
  252. package/dist/services/swap.js.map +1 -1
  253. package/dist/services/tax-provider.d.ts +3 -0
  254. package/dist/services/tax-provider.js +10 -0
  255. package/dist/services/tax-provider.js.map +1 -1
  256. package/dist/services/tax-rate.d.ts +13 -6
  257. package/dist/services/tax-rate.js +235 -41
  258. package/dist/services/tax-rate.js.map +1 -1
  259. package/dist/services/totals.d.ts +194 -59
  260. package/dist/services/totals.js +581 -106
  261. package/dist/services/totals.js.map +1 -1
  262. package/dist/subscribers/region.d.ts +14 -0
  263. package/dist/subscribers/region.js +65 -0
  264. package/dist/subscribers/region.js.map +1 -0
  265. package/dist/types/cart.d.ts +2 -1
  266. package/dist/types/cart.js +6 -1
  267. package/dist/types/cart.js.map +1 -1
  268. package/dist/types/common.d.ts +5 -1
  269. package/dist/types/common.js +22 -7
  270. package/dist/types/common.js.map +1 -1
  271. package/dist/types/customer-groups.d.ts +11 -0
  272. package/dist/types/customer-groups.js +43 -0
  273. package/dist/types/customer-groups.js.map +1 -0
  274. package/dist/types/orders.d.ts +2 -0
  275. package/dist/types/orders.js +6 -1
  276. package/dist/types/orders.js.map +1 -1
  277. package/dist/types/product.d.ts +6 -0
  278. package/dist/types/product.js +25 -1
  279. package/dist/types/product.js.map +1 -1
  280. package/dist/utils/format-registration-name.js +3 -0
  281. package/dist/utils/format-registration-name.js.map +1 -1
  282. package/package.json +5 -4
  283. package/yarn-error.log +5 -79
  284. package/dist/api/routes/admin/product-tags/create-collection.d.ts +0 -41
  285. package/dist/api/routes/admin/product-tags/create-collection.js.map +0 -1
  286. package/dist/api/routes/admin/product-tags/delete-collection.d.ts +0 -28
  287. package/dist/api/routes/admin/product-tags/delete-collection.js.map +0 -1
  288. package/dist/api/routes/admin/product-tags/get-collection.d.ts +0 -22
  289. package/dist/api/routes/admin/product-tags/get-collection.js.map +0 -1
  290. package/dist/api/routes/admin/product-tags/list-collections.d.ts +0 -40
  291. package/dist/api/routes/admin/product-tags/list-collections.js.map +0 -1
  292. package/dist/api/routes/admin/product-tags/update-collection.d.ts +0 -41
  293. package/dist/api/routes/admin/product-tags/update-collection.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"tax-rate.js","sourceRoot":"","sources":["../../src/services/tax-rate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAA+C;AAE/C,uDAA+C;AAe/C;IAA6B,kCAAW;IAKtC,wBAAY,EAAwD;YAAtD,OAAO,aAAA,EAAE,iBAAiB,uBAAA,EAAE,wBAAwB,8BAAA;QAAlE,YACE,iBAAO,SAKR;QAHC,KAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;QACvB,KAAI,CAAC,kBAAkB,GAAG,iBAAiB,CAAA;QAC3C,KAAI,CAAC,yBAAyB,GAAG,wBAAwB,CAAA;;IAC3D,CAAC;IAED,wCAAe,GAAf,UAAgB,kBAAiC;QAC/C,IAAI,CAAC,kBAAkB,EAAE;YACvB,OAAO,IAAI,CAAA;SACZ;QAED,IAAM,MAAM,GAAG,IAAI,cAAc,CAAC;YAChC,OAAO,EAAE,kBAAkB;YAC3B,iBAAiB,EAAE,IAAI,CAAC,kBAAkB;YAC1C,wBAAwB,EAAE,IAAI,CAAC,yBAAyB;SACzD,CAAC,CAAA;QAEF,MAAM,CAAC,mBAAmB,GAAG,kBAAkB,CAAA;QAC/C,MAAM,CAAC,QAAQ,GAAG,kBAAkB,CAAA;QAEpC,OAAO,MAAM,CAAA;IACf,CAAC;IAEK,6BAAI,GAAV,UACE,QAAgC,EAChC,MAAgC;QAAhC,uBAAA,E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;KACH;IACH,qBAAC;AAAD,CAAC,AAjUD,CAA6B,+BAAW,GAiUvC;AAED,kBAAe,cAAc,CAAA"}
@@ -1,94 +1,229 @@
1
- /// <reference path="../../index.d.ts" />
2
- export default TotalsService;
3
- declare const TotalsService_base: any;
1
+ import { BaseService } from "medusa-interfaces";
2
+ import { LineItemTaxLine } from "../models/line-item-tax-line";
3
+ import { ShippingMethodTaxLine } from "../models/shipping-method-tax-line";
4
+ import { Order } from "../models/order";
5
+ import { Cart } from "../models/cart";
6
+ import { ShippingMethod } from "../models/shipping-method";
7
+ import { LineItem } from "../models/line-item";
8
+ import { Discount } from "../models/discount";
9
+ import { DiscountRuleType } from "../models/discount-rule";
10
+ import TaxProviderService from "./tax-provider";
11
+ import { ITaxCalculationStrategy } from "../interfaces/tax-calculation-strategy";
12
+ import { TaxCalculationContext } from "../interfaces/tax-service";
13
+ import { SubtotalOptions, LineDiscount, LineAllocationsMap, LineDiscountAmount } from "../types/totals";
14
+ declare type ShippingMethodTotals = {
15
+ price: number;
16
+ tax_total: number;
17
+ total: number;
18
+ original_total: number;
19
+ original_tax_total: number;
20
+ tax_lines: ShippingMethodTaxLine[];
21
+ };
22
+ declare type GetShippingMethodTotalsOptions = {
23
+ include_tax?: boolean;
24
+ use_tax_lines?: boolean;
25
+ };
26
+ declare type LineItemTotals = {
27
+ unit_price: number;
28
+ quantity: number;
29
+ subtotal: number;
30
+ tax_total: number;
31
+ total: number;
32
+ original_total: number;
33
+ original_tax_total: number;
34
+ tax_lines: LineItemTaxLine[];
35
+ discount_total: number;
36
+ gift_card_total: number;
37
+ };
38
+ declare type LineItemTotalsOptions = {
39
+ include_tax?: boolean;
40
+ use_tax_lines?: boolean;
41
+ };
42
+ declare type GetLineItemTotalOptions = {
43
+ include_tax?: boolean;
44
+ exclude_gift_cards?: boolean;
45
+ exclude_discounts?: boolean;
46
+ };
47
+ declare type TotalsServiceProps = {
48
+ taxProviderService: TaxProviderService;
49
+ taxCalculationStrategy: ITaxCalculationStrategy;
50
+ };
51
+ declare type GetTotalsOptions = {
52
+ force_taxes?: boolean;
53
+ };
54
+ declare type AllocationMapOptions = {
55
+ exclude_gift_cards?: boolean;
56
+ exclude_discounts?: boolean;
57
+ };
58
+ declare type CalculationContextOptions = {
59
+ is_return?: boolean;
60
+ exclude_shipping?: boolean;
61
+ exclude_gift_cards?: boolean;
62
+ exclude_discounts?: boolean;
63
+ };
4
64
  /**
5
65
  * A service that calculates total and subtotals for orders, carts etc..
6
66
  * @implements {BaseService}
7
67
  */
8
- declare class TotalsService extends TotalsService_base implements BaseService {
9
- [x: string]: any;
68
+ declare class TotalsService extends BaseService {
69
+ private taxProviderService_;
70
+ private taxCalculationStrategy_;
71
+ constructor({ taxProviderService, taxCalculationStrategy, }: TotalsServiceProps);
10
72
  /**
11
73
  * Calculates subtotal of a given cart or order.
12
- * @param {object} object - object to calculate total for
13
- * @return {int} the calculated subtotal
74
+ * @param cartOrOrder - object to calculate total for
75
+ * @param options - options to calculate by
76
+ * @return the calculated subtotal
77
+ */
78
+ getTotal(cartOrOrder: Cart | Order, options?: GetTotalsOptions): Promise<number>;
79
+ /**
80
+ * Gets the total payments made on an order
81
+ * @param order - the order to calculate paid amount for
82
+ * @return the total paid amount
83
+ */
84
+ getPaidTotal(order: Order): number;
85
+ /**
86
+ * The total paid for swaps. May be negative in case of negative swap
87
+ * difference.
88
+ * @param order - the order to calculate swap total for
89
+ * @return the swap total
90
+ */
91
+ getSwapTotal(order: Order): number;
92
+ /**
93
+ * Gets the totals breakdown for a shipping method. Fetches tax lines if not
94
+ * already provided.
95
+ * @param shippingMethod - the shipping method to get totals breakdown for.
96
+ * @param cartOrOrder - the cart or order to use as context for the breakdown
97
+ * @param opts - options for what should be included
98
+ * @returns An object that breaks down the totals for the shipping method
14
99
  */
15
- getTotal(object: object): int;
16
- getPaidTotal(order: any): any;
17
- getSwapTotal(order: any): number;
100
+ getShippingMethodTotals(shippingMethod: ShippingMethod, cartOrOrder: Cart | Order, opts?: GetShippingMethodTotalsOptions): Promise<ShippingMethodTotals>;
18
101
  /**
19
102
  * Calculates subtotal of a given cart or order.
20
- * @param {(Cart|Order)} object - cart or order to calculate subtotal for
21
- * @param {Object} opts - options
22
- * @return {int} the calculated subtotal
103
+ * @param cartOrOrder - cart or order to calculate subtotal for
104
+ * @param opts - options
105
+ * @return the calculated subtotal
23
106
  */
24
- getSubtotal(object: (Cart | Order), opts?: any): int;
107
+ getSubtotal(cartOrOrder: Cart | Order, opts?: SubtotalOptions): number;
25
108
  /**
26
109
  * Calculates shipping total
27
- * @param {Cart | Object} object - cart or order to calculate subtotal for
28
- * @return {int} shipping total
110
+ * @param cartOrOrder - cart or order to calculate subtotal for
111
+ * @return shipping total
29
112
  */
30
- getShippingTotal(object: Cart | any): int;
113
+ getShippingTotal(cartOrOrder: Cart | Order): number;
31
114
  /**
32
115
  * Calculates tax total
33
116
  * Currently based on the Danish tax system
34
- * @param {Cart | Object} object - cart or order to calculate subtotal for
35
- * @return {int} tax total
117
+ * @param cartOrOrder - cart or order to calculate tax total for
118
+ * @param forceTaxes - whether taxes should be calculated regardless
119
+ * of region settings
120
+ * @return tax total
36
121
  */
37
- getTaxTotal(object: Cart | any): int;
38
- getRefundedTotal(object: any): number;
39
- getLineItemRefund(object: any, lineItem: any): number;
122
+ getTaxTotal(cartOrOrder: Cart | Order, forceTaxes?: boolean): Promise<number | null>;
123
+ /**
124
+ * Gets a map of discounts and gift cards that apply to line items in an
125
+ * order. The function calculates the amount of a discount or gift card that
126
+ * applies to a specific line item.
127
+ * @param orderOrCart - the order or cart to get an allocation map for
128
+ * @param options - controls what should be included in allocation map
129
+ * @return the allocation map for the line items in the cart or order.
130
+ */
131
+ getAllocationMap(orderOrCart: Cart | Order, options?: AllocationMapOptions): LineAllocationsMap;
132
+ /**
133
+ * Gets the total refund amount for an order.
134
+ * @param order - the order to get total refund amount for.
135
+ * @return the total refunded amount for an order.
136
+ */
137
+ getRefundedTotal(order: Order): number;
138
+ /**
139
+ * The amount that can be refunded for a given line item.
140
+ * @param order - order to use as context for the calculation
141
+ * @param lineItem - the line item to calculate the refund amount for.
142
+ * @return the line item refund amount.
143
+ */
144
+ getLineItemRefund(order: Order, lineItem: LineItem): number;
40
145
  /**
41
146
  * Calculates refund total of line items.
42
147
  * If any of the items to return have been discounted, we need to
43
148
  * apply the discount again before refunding them.
44
- * @param {Order} order - cart or order to calculate subtotal for
45
- * @param {[LineItem]} lineItems -
46
- * @return {int} the calculated subtotal
149
+ * @param order - cart or order to calculate subtotal for
150
+ * @param lineItems - the line items to calculate refund total for
151
+ * @return the calculated subtotal
47
152
  */
48
- getRefundTotal(order: Order, lineItems: [LineItem]): int;
153
+ getRefundTotal(order: Order, lineItems: LineItem[]): number;
49
154
  /**
50
155
  * Calculates either fixed or percentage discount of a variant
51
- * @param {string} lineItem - id of line item
52
- * @param {string} variant - id of variant in line item
53
- * @param {int} variantPrice - price of the variant based on region
54
- * @param {int} value - discount value
55
- * @param {string} discountType - the type of discount (fixed or percentage)
56
- * @return {{ string, string, int }} triples of lineitem, variant and
57
- * applied discount
58
- */
59
- calculateDiscount_(lineItem: string, variant: string, variantPrice: int, value: int, discountType: string): {
60
- string;
61
- string;
62
- int;
63
- };
156
+ * @param lineItem - id of line item
157
+ * @param variant - id of variant in line item
158
+ * @param variantPrice - price of the variant based on region
159
+ * @param value - discount value
160
+ * @param discountType - the type of discount (fixed or percentage)
161
+ * @return triples of lineitem, variant and applied discount
162
+ */
163
+ calculateDiscount_(lineItem: LineItem, variant: string, variantPrice: number, value: number, discountType: DiscountRuleType): LineDiscount;
64
164
  /**
65
165
  * If the rule of a discount has allocation="item", then we need
66
166
  * to calculate discount on each item in the cart. Furthermore, we need to
67
167
  * make sure to only apply the discount on valid variants. And finally we
68
168
  * return ether an array of percentages discounts or fixed discounts
69
169
  * alongside the variant on which the discount was applied.
70
- * @param {Discount} discount - the discount to which we do the calculation
71
- * @param {Cart} cart - the cart to calculate discounts for
72
- * @return {[{ string, string, int }]} array of triples of lineitem, variant
73
- * and applied discount
74
- */
75
- getAllocationItemDiscounts(discount: Discount, cart: Cart): [{
76
- string;
77
- string;
78
- int;
79
- }];
80
- getLineDiscounts(cart: any, discount: any): {
81
- item: any;
82
- amount: any;
83
- }[];
84
- getGiftCardTotal(cart: any): any;
170
+ * @param discount - the discount to which we do the calculation
171
+ * @param cart - the cart to calculate discounts for
172
+ * @return array of triples of lineitem, variant and applied discount
173
+ */
174
+ getAllocationItemDiscounts(discount: Discount, cart: Cart | Order): LineDiscount[];
175
+ /**
176
+ * Returns the discount amount allocated to the line items of an order.
177
+ * @param cartOrOrder - the cart or order to get line discount allocations for
178
+ * @param discount - the discount to use as context for the calculation
179
+ * @return the allocations that the discount has on the items in the cart or
180
+ * order
181
+ */
182
+ getLineDiscounts(cartOrOrder: Cart | Order, discount: Discount): LineDiscountAmount[];
183
+ /**
184
+ * Breaks down the totals related to a line item; these are the subtotal, the
185
+ * amount of discount applied to the line item, the amount of a gift card
186
+ * applied to a line item and the amount of tax applied to a line item.
187
+ * @param lineItem - the line item to calculate totals for
188
+ * @param cartOrOrder - the cart or order to use as context for the calculation
189
+ * @param options - the options to evaluate the line item totals for
190
+ * @returns the breakdown of the line item totals
191
+ */
192
+ getLineItemTotals(lineItem: LineItem, cartOrOrder: Cart | Order, options?: LineItemTotalsOptions): Promise<LineItemTotals>;
193
+ /**
194
+ * Gets a total for a line item. The total can take gift cards, discounts and
195
+ * taxes into account. This can be controlled through the options.
196
+ * @param lineItem - the line item to calculate a total for
197
+ * @param cartOrOrder - the cart or order to use as context for the calculation
198
+ * @param options - the options to use for the calculation
199
+ * @returns the line item total
200
+ */
201
+ getLineItemTotal(lineItem: LineItem, cartOrOrder: Cart | Order, options?: GetLineItemTotalOptions): Promise<number>;
202
+ /**
203
+ * Gets the gift card amount on a cart or order.
204
+ * @param cartOrOrder - the cart or order to get gift card amount for
205
+ * @return the gift card amount applied to the cart or order
206
+ */
207
+ getGiftCardTotal(cartOrOrder: Cart | Order): number;
85
208
  /**
86
209
  * Calculates the total discount amount for each of the different supported
87
210
  * discount types. If discounts aren't present or invalid returns 0.
88
- * @param {Cart} cart - the cart to calculate discounts for
89
- * @return {int} the total discounts amount
211
+ * @param cartOrOrder - the cart or order to calculate discounts for
212
+ * @return the total discounts amount
213
+ */
214
+ getDiscountTotal(cartOrOrder: Cart | Order): number;
215
+ /**
216
+ * Prepares the calculation context for a tax total calculation.
217
+ * @param cartOrOrder - the cart or order to get the calculation context for
218
+ * @param options - options to gather context by
219
+ * @return the tax calculation context
90
220
  */
91
- getDiscountTotal(cart: Cart): int;
92
- rounded(value: any): number;
221
+ getCalculationContext(cartOrOrder: Cart | Order, options?: CalculationContextOptions): TaxCalculationContext;
222
+ /**
223
+ * Rounds a number using Math.round.
224
+ * @param value - the value to round
225
+ * @return the rounded value
226
+ */
227
+ rounded(value: number): number;
93
228
  }
94
- import { BaseService } from "medusa-interfaces";
229
+ export default TotalsService;