diff --git a/docs/docs/reference/core-plugins/payments-plugin/stripe-plugin.md b/docs/docs/reference/core-plugins/payments-plugin/stripe-plugin.md index 6cf864dc85..2dd473137c 100644 --- a/docs/docs/reference/core-plugins/payments-plugin/stripe-plugin.md +++ b/docs/docs/reference/core-plugins/payments-plugin/stripe-plugin.md @@ -209,6 +209,7 @@ interface StripePluginOptions { ctx: RequestContext, order: Order, ) => AdditionalCustomerCreateParams | Promise; + skipPaymentIntentsWithoutExpectedMetadata?: boolean; } ``` @@ -347,6 +348,12 @@ export const config: VendureConfig = { ], }; ``` +### skipPaymentIntentsWithoutExpectedMetadata + + + +If your Stripe account also generates payment intents which are independent of Vendure orders, you can set this +to `true` to skip processing those payment intents. diff --git a/docs/docs/reference/typescript-api/configuration/default-config.md b/docs/docs/reference/typescript-api/configuration/default-config.md index 5b2d2248e0..52ffa7b3a8 100644 --- a/docs/docs/reference/typescript-api/configuration/default-config.md +++ b/docs/docs/reference/typescript-api/configuration/default-config.md @@ -11,7 +11,7 @@ import MemberDescription from '@site/src/components/MemberDescription'; ## defaultConfig - + The default configuration settings which are used if not explicitly overridden in the bootstrap() call. diff --git a/docs/docs/reference/typescript-api/events/event-types.md b/docs/docs/reference/typescript-api/events/event-types.md index 838058f7bc..f946fc333f 100644 --- a/docs/docs/reference/typescript-api/events/event-types.md +++ b/docs/docs/reference/typescript-api/events/event-types.md @@ -1483,6 +1483,34 @@ class ShippingMethodEvent extends VendureEntityEvent + + +## StockLocationEvent + + + +This event is fired whenever a StockLocation is added, updated +or deleted. + +```ts title="Signature" +class StockLocationEvent extends VendureEntityEvent { + constructor(ctx: RequestContext, entity: StockLocation, type: 'created' | 'updated' | 'deleted', input?: StockLocationInputTypes) +} +``` +* Extends: VendureEntityEvent<StockLocation, StockLocationInputTypes> + + + +
+ +### constructor + +RequestContext, entity: StockLocation, type: 'created' | 'updated' | 'deleted', input?: StockLocationInputTypes) => StockLocationEvent`} /> + + + +
diff --git a/docs/docs/reference/typescript-api/products-stock/default-stock-location-strategy.md b/docs/docs/reference/typescript-api/products-stock/default-stock-location-strategy.md index 8d0b669b54..8481d83c79 100644 --- a/docs/docs/reference/typescript-api/products-stock/default-stock-location-strategy.md +++ b/docs/docs/reference/typescript-api/products-stock/default-stock-location-strategy.md @@ -11,33 +11,26 @@ import MemberDescription from '@site/src/components/MemberDescription'; ## DefaultStockLocationStrategy - + -The DefaultStockLocationStrategy is the default implementation of the StockLocationStrategy. -It assumes only a single StockLocation and that all stock is allocated from that location. +The DefaultStockLocationStrategy was the default implementation of the StockLocationStrategy +prior to the introduction of the MultiChannelStockLocationStrategy. +It assumes only a single StockLocation and that all stock is allocated from that location. When +more than one StockLocation or Channel is used, it will not behave as expected. ```ts title="Signature" -class DefaultStockLocationStrategy implements StockLocationStrategy { - protected connection: TransactionalConnection; +class DefaultStockLocationStrategy extends BaseStockLocationStrategy { init(injector: Injector) => ; getAvailableStock(ctx: RequestContext, productVariantId: ID, stockLevels: StockLevel[]) => AvailableStock; forAllocation(ctx: RequestContext, stockLocations: StockLocation[], orderLine: OrderLine, quantity: number) => LocationWithQuantity[] | Promise; - forCancellation(ctx: RequestContext, stockLocations: StockLocation[], orderLine: OrderLine, quantity: number) => Promise; - forRelease(ctx: RequestContext, stockLocations: StockLocation[], orderLine: OrderLine, quantity: number) => Promise; - forSale(ctx: RequestContext, stockLocations: StockLocation[], orderLine: OrderLine, quantity: number) => Promise; } ``` -* Implements: StockLocationStrategy +* Extends: BaseStockLocationStrategy
-### connection - -TransactionalConnection`} /> - - ### init Injector) => `} /> @@ -53,21 +46,6 @@ class DefaultStockLocationStrategy implements StockLocationStrategy { RequestContext, stockLocations: StockLocation[], orderLine: OrderLine, quantity: number) => LocationWithQuantity[] | Promise<LocationWithQuantity[]>`} /> -### forCancellation - -RequestContext, stockLocations: StockLocation[], orderLine: OrderLine, quantity: number) => Promise<LocationWithQuantity[]>`} /> - - -### forRelease - -RequestContext, stockLocations: StockLocation[], orderLine: OrderLine, quantity: number) => Promise<LocationWithQuantity[]>`} /> - - -### forSale - -RequestContext, stockLocations: StockLocation[], orderLine: OrderLine, quantity: number) => Promise<LocationWithQuantity[]>`} /> - -
diff --git a/docs/docs/reference/typescript-api/products-stock/multi-channel-stock-location-strategy.md b/docs/docs/reference/typescript-api/products-stock/multi-channel-stock-location-strategy.md new file mode 100644 index 0000000000..8a25fec31b --- /dev/null +++ b/docs/docs/reference/typescript-api/products-stock/multi-channel-stock-location-strategy.md @@ -0,0 +1,81 @@ +--- +title: "MultiChannelStockLocationStrategy" +isDefaultIndex: false +generated: true +--- + +import MemberInfo from '@site/src/components/MemberInfo'; +import GenerationInfo from '@site/src/components/GenerationInfo'; +import MemberDescription from '@site/src/components/MemberDescription'; + + +## MultiChannelStockLocationStrategy + + + +The MultiChannelStockLocationStrategy is an implementation of the StockLocationStrategy. +which is suitable for both single- and multichannel setups. It takes into account the active +channel when determining stock levels, and also ensures that allocations are made only against +stock locations which are associated with the active channel. + +This strategy became the default in Vendure 3.1.0. If you want to use the previous strategy which +does not take channels into account, update your VendureConfig to use to DefaultStockLocationStrategy. + +```ts title="Signature" +class MultiChannelStockLocationStrategy extends BaseStockLocationStrategy { + protected cacheService: CacheService; + protected channelIdCache: Cache; + protected eventBus: EventBus; + protected globalSettingsService: GlobalSettingsService; + protected requestContextCache: RequestContextCacheService; + getAvailableStock(ctx: RequestContext, productVariantId: ID, stockLevels: StockLevel[]) => Promise; + forAllocation(ctx: RequestContext, stockLocations: StockLocation[], orderLine: OrderLine, quantity: number) => Promise; +} +``` +* Extends: BaseStockLocationStrategy + + + +
+ +### cacheService + +CacheService`} /> + + +### channelIdCache + +Cache`} /> + + +### eventBus + +EventBus`} /> + + +### globalSettingsService + +GlobalSettingsService`} /> + + +### requestContextCache + +RequestContextCacheService`} /> + + +### getAvailableStock + +RequestContext, productVariantId: ID, stockLevels: StockLevel[]) => Promise<AvailableStock>`} /> + +Returns the available stock for the given ProductVariant, taking into account the active Channel. +### forAllocation + +RequestContext, stockLocations: StockLocation[], orderLine: OrderLine, quantity: number) => Promise<LocationWithQuantity[]>`} /> + +This method takes into account whether the stock location is applicable to the active channel. +It furthermore respects the `trackInventory` and `outOfStockThreshold` settings of the ProductVariant, +in order to allocate stock only from locations which are relevant to the active channel and which +have sufficient stock available. + + +