feat(core-flows,types,cart): add credit lines to cart (#11419)

* feat(core-flows,types,cart): add credit lines to cart

* chore: fix specs

* chore: credit lines hook

* chore: update types

* chore: added credit line totals

* chore: add totals fields to query config

* chore: add complete cart hook

* chore: add credit lines creation to order

* chore: pr ready for review

* chore: fix tests

* Apply suggestions from code review

* chore: fix types

* chore: adjust summary calculations with new totals
This commit is contained in:
Riqwan Thamir
2025-02-24 14:34:36 +01:00
committed by GitHub
parent be566ca6fb
commit fb2e86484a
27 changed files with 802 additions and 58 deletions
@@ -24,6 +24,7 @@ import {
import {
Address,
Cart,
CreditLine,
LineItem,
LineItemAdjustment,
LineItemTaxLine,
@@ -54,6 +55,7 @@ type InjectedDependencies = {
const generateMethodForModels = {
Cart,
CreditLine,
Address,
LineItem,
LineItemAdjustment,
@@ -66,6 +68,7 @@ const generateMethodForModels = {
export default class CartModuleService
extends ModulesSdkUtils.MedusaService<{
Cart: { dto: CartTypes.CartDTO }
CreditLine: { dto: CartTypes.CartCreditLineDTO }
Address: { dto: CartTypes.CartAddressDTO }
LineItem: { dto: CartTypes.CartLineItemDTO }
LineItemAdjustment: { dto: CartTypes.LineItemAdjustmentDTO }
@@ -170,6 +173,7 @@ export default class CartModuleService
const requiredFieldsForTotals = [
"items",
"credit_lines",
"items.tax_lines",
"items.adjustments",
"shipping_methods",