From 2be03d0d3952337d622ba3fa64104a7aca97c2b3 Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Mon, 7 Apr 2025 16:08:39 +0300 Subject: [PATCH] chore(types,utils): fixes to TSDocs for HTTP types and payment provider (#12102) --- packages/core/types/src/http/product/common.ts | 5 +++++ packages/core/utils/src/payment/abstract-payment-provider.ts | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/packages/core/types/src/http/product/common.ts b/packages/core/types/src/http/product/common.ts index 9a17450904..acaad36054 100644 --- a/packages/core/types/src/http/product/common.ts +++ b/packages/core/types/src/http/product/common.ts @@ -170,6 +170,11 @@ export interface BaseProductVariant { manage_inventory: boolean | null /** * The variant's inventory quantity if `manage_inventory` is enabled. + * This field is only retrieved in the [Get Product](https://docs.medusajs.com/api/store#products_getproductsid) + * and [List Products](https://docs.medusajs.com/api/store#products_getproducts) API routes if you + * pass `+variants.inventory_quantity` in the `fields` query parameter. + * + * Learn more in the [Retrieve Product Variant's Inventory](https://docs.medusajs.com/resources/storefront-development/products/inventory) storefront guide. */ inventory_quantity?: number /** diff --git a/packages/core/utils/src/payment/abstract-payment-provider.ts b/packages/core/utils/src/payment/abstract-payment-provider.ts index f49df0b93d..f09653fa86 100644 --- a/packages/core/utils/src/payment/abstract-payment-provider.ts +++ b/packages/core/utils/src/payment/abstract-payment-provider.ts @@ -486,6 +486,11 @@ export abstract class AbstractPaymentProvider> * ): Promise { * const { amount, currency_code, context } = input * const externalId = input.data?.id + * + * // Validate context.customer + * if (!context || !context.customer) { + * throw new Error("Context must include a valid customer."); + * } * * // assuming you have a client that updates the payment * const response = await this.client.update(