Skip to content

Commit

Permalink
feat(core): Publish event when OrderLine cancelled (#2829)
Browse files Browse the repository at this point in the history
  • Loading branch information
vjung28 authored May 31, 2024
1 parent 60856ca commit 213a26b
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 47 deletions.
97 changes: 51 additions & 46 deletions docs/docs/reference/typescript-api/events/event-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

<GenerationInfo sourceFile="packages/core/src/event-bus/events/account-registration-event.ts" sourceLine="13" packageName="@vendure/core" />

This event is fired when a new user registers an account, either as a stand-alone signup or after
This event is fired when a new user registers an account, either as a stand-alone signup or after
placing an order.

```ts title="Signature"
Expand Down Expand Up @@ -41,7 +41,7 @@ class AccountRegistrationEvent extends VendureEvent {

<GenerationInfo sourceFile="packages/core/src/event-bus/events/account-verified-event.ts" sourceLine="13" packageName="@vendure/core" />

This event is fired when a users email address successfully gets verified after
This event is fired when a users email address successfully gets verified after
the `verifyCustomerAccount` mutation was executed.

```ts title="Signature"
Expand Down Expand Up @@ -96,7 +96,7 @@ class AdministratorEvent extends VendureEntityEvent<Administrator, Administrator

<GenerationInfo sourceFile="packages/core/src/event-bus/events/asset-channel-event.ts" sourceLine="15" packageName="@vendure/core" />

This event is fired whenever an <a href='/reference/typescript-api/entities/asset#asset'>Asset</a> is assigned or removed
This event is fired whenever an <a href='/reference/typescript-api/entities/asset#asset'>Asset</a> is assigned or removed
From a channel.

```ts title="Signature"
Expand Down Expand Up @@ -157,8 +157,8 @@ class AssetEvent extends VendureEntityEvent<Asset, AssetInputTypes> {

<GenerationInfo sourceFile="packages/core/src/event-bus/events/attempted-login-event.ts" sourceLine="14" packageName="@vendure/core" />

This event is fired when an attempt is made to log in via the shop or admin API `login` mutation.
The `strategy` represents the name of the AuthenticationStrategy used in the login attempt.
This event is fired when an attempt is made to log in via the shop or admin API `login` mutation.
The `strategy` represents the name of the AuthenticationStrategy used in the login attempt.
If the "native" strategy is used, the additional `identifier` property will be available.

```ts title="Signature"
Expand Down Expand Up @@ -186,7 +186,7 @@ class AttemptedLoginEvent extends VendureEvent {

<GenerationInfo sourceFile="packages/core/src/event-bus/events/change-channel-event.ts" sourceLine="17" packageName="@vendure/core" since="1.4" />

This event is fired whenever an <a href='/reference/typescript-api/entities/interfaces#channelaware'>ChannelAware</a> entity is assigned or removed
This event is fired whenever an <a href='/reference/typescript-api/entities/interfaces#channelaware'>ChannelAware</a> entity is assigned or removed
from a channel. The entity property contains the value before updating the channels.

```ts title="Signature"
Expand Down Expand Up @@ -268,10 +268,10 @@ class CollectionEvent extends VendureEntityEvent<Collection, CollectionInputType

<GenerationInfo sourceFile="packages/core/src/event-bus/events/collection-modification-event.ts" sourceLine="18" packageName="@vendure/core" />

This event is fired whenever a Collection is modified in some way. The `productVariantIds`
argument is an array of ids of all ProductVariants which:

1. were part of this collection prior to modification and are no longer
This event is fired whenever a Collection is modified in some way. The `productVariantIds`
argument is an array of ids of all ProductVariants which:

1. were part of this collection prior to modification and are no longer
2. are now part of this collection after modification but were not before

```ts title="Signature"
Expand Down Expand Up @@ -326,7 +326,7 @@ class CountryEvent extends VendureEntityEvent<Country, CountryInputTypes> {

<GenerationInfo sourceFile="packages/core/src/event-bus/events/coupon-code-event.ts" sourceLine="15" packageName="@vendure/core" since="1.4" />

This event is fired whenever an coupon code of an active <a href='/reference/typescript-api/entities/promotion#promotion'>Promotion</a>
This event is fired whenever an coupon code of an active <a href='/reference/typescript-api/entities/promotion#promotion'>Promotion</a>
is assigned or removed to an <a href='/reference/typescript-api/entities/order#order'>Order</a>.

```ts title="Signature"
Expand Down Expand Up @@ -354,7 +354,7 @@ class CouponCodeEvent extends VendureEvent {

<GenerationInfo sourceFile="packages/core/src/event-bus/events/customer-address-event.ts" sourceLine="22" packageName="@vendure/core" since="1.4" />

This event is fired whenever a <a href='/reference/typescript-api/entities/address#address'>Address</a> is added, updated
This event is fired whenever a <a href='/reference/typescript-api/entities/address#address'>Address</a> is added, updated
or deleted.

```ts title="Signature"
Expand Down Expand Up @@ -388,7 +388,7 @@ class CustomerAddressEvent extends VendureEntityEvent<Address, CustomerAddressIn

<GenerationInfo sourceFile="packages/core/src/event-bus/events/customer-event.ts" sourceLine="22" packageName="@vendure/core" />

This event is fired whenever a <a href='/reference/typescript-api/entities/customer#customer'>Customer</a> is added, updated
This event is fired whenever a <a href='/reference/typescript-api/entities/customer#customer'>Customer</a> is added, updated
or deleted.

```ts title="Signature"
Expand Down Expand Up @@ -422,7 +422,7 @@ class CustomerEvent extends VendureEntityEvent<Customer, CustomerInputTypes> {

<GenerationInfo sourceFile="packages/core/src/event-bus/events/customer-group-change-event.ts" sourceLine="15" packageName="@vendure/core" since="1.4" />

This event is fired whenever one or more <a href='/reference/typescript-api/entities/customer#customer'>Customer</a> is assigned to or removed from a
This event is fired whenever one or more <a href='/reference/typescript-api/entities/customer#customer'>Customer</a> is assigned to or removed from a
<a href='/reference/typescript-api/entities/customer-group#customergroup'>CustomerGroup</a>.

```ts title="Signature"
Expand Down Expand Up @@ -585,7 +585,7 @@ class FulfillmentStateTransitionEvent extends VendureEvent {

<GenerationInfo sourceFile="packages/core/src/event-bus/events/global-settings-event.ts" sourceLine="16" packageName="@vendure/core" since="1.4" />

This event is fired whenever a {@link GlobalSettings} is added. The type is always `updated`, because it's
This event is fired whenever a {@link GlobalSettings} is added. The type is always `updated`, because it's
only created once and never deleted.

```ts title="Signature"
Expand Down Expand Up @@ -646,7 +646,7 @@ class HistoryEntryEvent extends VendureEntityEvent<HistoryEntry, HistoryInput> {

<GenerationInfo sourceFile="packages/core/src/event-bus/events/identifier-change-event.ts" sourceLine="13" packageName="@vendure/core" />

This event is fired when a registered user successfully changes the identifier (ie email address)
This event is fired when a registered user successfully changes the identifier (ie email address)
associated with their account.

```ts title="Signature"
Expand Down Expand Up @@ -674,7 +674,7 @@ class IdentifierChangeEvent extends VendureEvent {

<GenerationInfo sourceFile="packages/core/src/event-bus/events/identifier-change-request-event.ts" sourceLine="13" packageName="@vendure/core" />

This event is fired when a registered user requests to update the identifier (ie email address)
This event is fired when a registered user requests to update the identifier (ie email address)
associated with the account.

```ts title="Signature"
Expand Down Expand Up @@ -783,7 +783,7 @@ class LogoutEvent extends VendureEvent {

<GenerationInfo sourceFile="packages/core/src/event-bus/events/order-event.ts" sourceLine="13" packageName="@vendure/core" />

This event is fired whenever an <a href='/reference/typescript-api/entities/order#order'>Order</a> is added, updated
This event is fired whenever an <a href='/reference/typescript-api/entities/order#order'>Order</a> is added, updated
or deleted.

```ts title="Signature"
Expand Down Expand Up @@ -811,12 +811,11 @@ class OrderEvent extends VendureEvent {

<GenerationInfo sourceFile="packages/core/src/event-bus/events/order-line-event.ts" sourceLine="13" packageName="@vendure/core" />

This event is fired whenever an <a href='/reference/typescript-api/entities/order-line#orderline'>OrderLine</a> is added, updated
or deleted.
This event is fired whenever an <a href='/reference/typescript-api/entities/order-line#orderline'>OrderLine</a> is added, updated, deleted or cancelled.

```ts title="Signature"
class OrderLineEvent extends VendureEvent {
constructor(ctx: RequestContext, order: Order, orderLine: OrderLine, type: 'created' | 'updated' | 'deleted')
constructor(ctx: RequestContext, order: Order, orderLine: OrderLine, type: 'created' | 'updated' | 'deleted' | 'cancelled')
}
```
* Extends: <code><a href='/reference/typescript-api/events/vendure-event#vendureevent'>VendureEvent</a></code>
Expand All @@ -839,10 +838,10 @@ class OrderLineEvent extends VendureEvent {

<GenerationInfo sourceFile="packages/core/src/event-bus/events/order-placed-event.ts" sourceLine="17" packageName="@vendure/core" />

This event is fired whenever an <a href='/reference/typescript-api/entities/order#order'>Order</a> is set as "placed", which by default is
when it transitions from 'ArrangingPayment' to either 'PaymentAuthorized' or 'PaymentSettled'.

Note that the exact point that it is set as "placed" can be configured according to the
This event is fired whenever an <a href='/reference/typescript-api/entities/order#order'>Order</a> is set as "placed", which by default is
when it transitions from 'ArrangingPayment' to either 'PaymentAuthorized' or 'PaymentSettled'.

Note that the exact point that it is set as "placed" can be configured according to the
<a href='/reference/typescript-api/orders/order-placed-strategy#orderplacedstrategy'>OrderPlacedStrategy</a>.

```ts title="Signature"
Expand Down Expand Up @@ -951,7 +950,7 @@ class PasswordResetVerifiedEvent extends VendureEvent {

<GenerationInfo sourceFile="packages/core/src/event-bus/events/payment-method-event.ts" sourceLine="18" packageName="@vendure/core" />

This event is fired whenever a <a href='/reference/typescript-api/entities/payment-method#paymentmethod'>PaymentMethod</a> is added, updated
This event is fired whenever a <a href='/reference/typescript-api/entities/payment-method#paymentmethod'>PaymentMethod</a> is added, updated
or deleted.

```ts title="Signature"
Expand Down Expand Up @@ -979,7 +978,7 @@ class PaymentMethodEvent extends VendureEntityEvent<PaymentMethod, PaymentMethod

<GenerationInfo sourceFile="packages/core/src/event-bus/events/payment-state-transition-event.ts" sourceLine="15" packageName="@vendure/core" />

This event is fired whenever a <a href='/reference/typescript-api/entities/payment#payment'>Payment</a> transitions from one <a href='/reference/typescript-api/payment/payment-state#paymentstate'>PaymentState</a> to another, e.g.
This event is fired whenever a <a href='/reference/typescript-api/entities/payment#payment'>Payment</a> transitions from one <a href='/reference/typescript-api/payment/payment-state#paymentstate'>PaymentState</a> to another, e.g.
a Payment is authorized by the payment provider.

```ts title="Signature"
Expand Down Expand Up @@ -1007,7 +1006,7 @@ class PaymentStateTransitionEvent extends VendureEvent {

<GenerationInfo sourceFile="packages/core/src/event-bus/events/product-channel-event.ts" sourceLine="15" packageName="@vendure/core" />

This event is fired whenever a <a href='/reference/typescript-api/entities/product#product'>Product</a> is added, updated
This event is fired whenever a <a href='/reference/typescript-api/entities/product#product'>Product</a> is added, updated
or deleted.

```ts title="Signature"
Expand Down Expand Up @@ -1035,7 +1034,7 @@ class ProductChannelEvent extends VendureEvent {

<GenerationInfo sourceFile="packages/core/src/event-bus/events/product-event.ts" sourceLine="18" packageName="@vendure/core" />

This event is fired whenever a <a href='/reference/typescript-api/entities/product#product'>Product</a> is added, updated
This event is fired whenever a <a href='/reference/typescript-api/entities/product#product'>Product</a> is added, updated
or deleted.

```ts title="Signature"
Expand Down Expand Up @@ -1126,14 +1125,17 @@ class ProductOptionGroupChangeEvent extends VendureEvent {
This event is fired whenever a <a href='/reference/typescript-api/entities/product-option-group#productoptiongroup'>ProductOptionGroup</a> is added or updated.

```ts title="Signature"
class ProductOptionGroupEvent extends VendureEntityEvent<
ProductOptionGroup,
ProductOptionGroupInputTypes
class ProductOptionGroupEvent extends VendureEntityEvent<
ProductOptionGroup,
ProductOptionGroupInputTypes
> {
constructor(ctx: RequestContext, entity: ProductOptionGroup, type: 'created' | 'updated' | 'deleted', input?: ProductOptionGroupInputTypes)
}
```
* Extends: <code><a href='/reference/typescript-api/events/vendure-entity-event#vendureentityevent'>VendureEntityEvent</a>&#60; <a href='/reference/typescript-api/entities/product-option-group#productoptiongroup'>ProductOptionGroup</a>, ProductOptionGroupInputTypes &#62;</code>
* Extends: <code><a href='/reference/typescript-api/events/vendure-entity-event#vendureentityevent'>VendureEntityEvent</a>&#60;
<a href='/reference/typescript-api/entities/product-option-group#productoptiongroup'>ProductOptionGroup</a>,
ProductOptionGroupInputTypes
&#62;</code>



Expand Down Expand Up @@ -1180,7 +1182,7 @@ class ProductVariantChannelEvent extends VendureEvent {

<GenerationInfo sourceFile="packages/core/src/event-bus/events/product-variant-event.ts" sourceLine="18" packageName="@vendure/core" />

This event is fired whenever a <a href='/reference/typescript-api/entities/product-variant#productvariant'>ProductVariant</a> is added, updated
This event is fired whenever a <a href='/reference/typescript-api/entities/product-variant#productvariant'>ProductVariant</a> is added, updated
or deleted.

```ts title="Signature"
Expand Down Expand Up @@ -1217,14 +1219,17 @@ class ProductVariantEvent extends VendureEntityEvent<ProductVariant[], ProductVa
This event is fired whenever a <a href='/reference/typescript-api/entities/product-variant-price#productvariantprice'>ProductVariantPrice</a> is added, updated or deleted.

```ts title="Signature"
class ProductVariantPriceEvent extends VendureEntityEvent<
ProductVariantPrice[],
ProductVariantInputTypes
class ProductVariantPriceEvent extends VendureEntityEvent<
ProductVariantPrice[],
ProductVariantInputTypes
> {
constructor(ctx: RequestContext, entity: ProductVariantPrice[], type: 'created' | 'updated' | 'deleted', input?: ProductVariantInputTypes)
}
```
* Extends: <code><a href='/reference/typescript-api/events/vendure-entity-event#vendureentityevent'>VendureEntityEvent</a>&#60; <a href='/reference/typescript-api/entities/product-variant-price#productvariantprice'>ProductVariantPrice</a>[], ProductVariantInputTypes &#62;</code>
* Extends: <code><a href='/reference/typescript-api/events/vendure-entity-event#vendureentityevent'>VendureEntityEvent</a>&#60;
<a href='/reference/typescript-api/entities/product-variant-price#productvariantprice'>ProductVariantPrice</a>[],
ProductVariantInputTypes
&#62;</code>



Expand All @@ -1244,7 +1249,7 @@ class ProductVariantPriceEvent extends VendureEntityEvent<

<GenerationInfo sourceFile="packages/core/src/event-bus/events/promotion-event.ts" sourceLine="18" packageName="@vendure/core" />

This event is fired whenever a <a href='/reference/typescript-api/entities/promotion#promotion'>Promotion</a> is added, updated
This event is fired whenever a <a href='/reference/typescript-api/entities/promotion#promotion'>Promotion</a> is added, updated
or deleted.

```ts title="Signature"
Expand Down Expand Up @@ -1326,7 +1331,7 @@ class RefundStateTransitionEvent extends VendureEvent {

<GenerationInfo sourceFile="packages/core/src/event-bus/events/role-change-event.ts" sourceLine="16" packageName="@vendure/core" since="1.4" />

This event is fired whenever one <a href='/reference/typescript-api/entities/role#role'>Role</a> is assigned or removed from a user.
This event is fired whenever one <a href='/reference/typescript-api/entities/role#role'>Role</a> is assigned or removed from a user.
The property `roleIds` only contains the removed or assigned role ids.

```ts title="Signature"
Expand Down Expand Up @@ -1435,7 +1440,7 @@ class SellerEvent extends VendureEntityEvent<Seller, SellerInputTypes> {

<GenerationInfo sourceFile="packages/core/src/event-bus/events/shipping-method-event.ts" sourceLine="18" packageName="@vendure/core" />

This event is fired whenever a <a href='/reference/typescript-api/entities/shipping-method#shippingmethod'>ShippingMethod</a> is added, updated
This event is fired whenever a <a href='/reference/typescript-api/entities/shipping-method#shippingmethod'>ShippingMethod</a> is added, updated
or deleted.

```ts title="Signature"
Expand Down Expand Up @@ -1463,7 +1468,7 @@ class ShippingMethodEvent extends VendureEntityEvent<ShippingMethod, ShippingMet

<GenerationInfo sourceFile="packages/core/src/event-bus/events/stock-movement-event.ts" sourceLine="16" packageName="@vendure/core" since="1.1.0" />

This event is fired whenever a <a href='/reference/typescript-api/entities/stock-movement#stockmovement'>StockMovement</a> entity is created, which occurs when the saleable
This event is fired whenever a <a href='/reference/typescript-api/entities/stock-movement#stockmovement'>StockMovement</a> entity is created, which occurs when the saleable
stock level of a ProductVariant is altered due to things like sales, manual adjustments, and cancellations.

```ts title="Signature"
Expand Down Expand Up @@ -1497,7 +1502,7 @@ class StockMovementEvent extends VendureEvent {

<GenerationInfo sourceFile="packages/core/src/event-bus/events/tax-category-event.ts" sourceLine="18" packageName="@vendure/core" />

This event is fired whenever a <a href='/reference/typescript-api/entities/tax-category#taxcategory'>TaxCategory</a> is added, updated
This event is fired whenever a <a href='/reference/typescript-api/entities/tax-category#taxcategory'>TaxCategory</a> is added, updated
or deleted.

```ts title="Signature"
Expand Down Expand Up @@ -1525,7 +1530,7 @@ class TaxCategoryEvent extends VendureEntityEvent<TaxCategory, TaxCategoryInputT

<GenerationInfo sourceFile="packages/core/src/event-bus/events/tax-rate-event.ts" sourceLine="18" packageName="@vendure/core" />

This event is fired whenever a <a href='/reference/typescript-api/entities/tax-rate#taxrate'>TaxRate</a> is added, updated
This event is fired whenever a <a href='/reference/typescript-api/entities/tax-rate#taxrate'>TaxRate</a> is added, updated
or deleted.

```ts title="Signature"
Expand Down Expand Up @@ -1580,7 +1585,7 @@ class TaxRateModificationEvent extends VendureEvent {

<GenerationInfo sourceFile="packages/core/src/event-bus/events/zone-event.ts" sourceLine="18" packageName="@vendure/core" />

This event is fired whenever a <a href='/reference/typescript-api/entities/zone#zone'>Zone</a> is added, updated
This event is fired whenever a <a href='/reference/typescript-api/entities/zone#zone'>Zone</a> is added, updated
or deleted.

```ts title="Signature"
Expand Down Expand Up @@ -1608,7 +1613,7 @@ class ZoneEvent extends VendureEntityEvent<Zone, ZoneInputTypes> {

<GenerationInfo sourceFile="packages/core/src/event-bus/events/zone-members-event.ts" sourceLine="15" packageName="@vendure/core" />

This event is fired whenever a <a href='/reference/typescript-api/entities/zone#zone'>Zone</a> gets <a href='/reference/typescript-api/entities/country#country'>Country</a> members assigned or removed
This event is fired whenever a <a href='/reference/typescript-api/entities/zone#zone'>Zone</a> gets <a href='/reference/typescript-api/entities/country#country'>Country</a> members assigned or removed
The `entity` property contains the zone with the already updated member field.

```ts title="Signature"
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/event-bus/events/order-line-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class OrderLineEvent extends VendureEvent {
public ctx: RequestContext,
public order: Order,
public orderLine: OrderLine,
public type: 'created' | 'updated' | 'deleted',
public type: 'created' | 'updated' | 'deleted' | 'cancelled',
) {
super();
}
Expand Down
Loading

0 comments on commit 213a26b

Please sign in to comment.