Skip to content

Commit

Permalink
feat(core): Implement GuestCheckoutStrategy
Browse files Browse the repository at this point in the history
Fixes #911, Fixes #762
  • Loading branch information
michaelbromley committed Mar 16, 2023
1 parent aa91bd0 commit 7e0f1d1
Show file tree
Hide file tree
Showing 27 changed files with 5,406 additions and 8,547 deletions.
15 changes: 12 additions & 3 deletions packages/admin-ui/src/lib/core/src/common/generated-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1477,6 +1477,7 @@ export enum ErrorCode {
EMPTY_ORDER_LINE_SELECTION_ERROR = 'EMPTY_ORDER_LINE_SELECTION_ERROR',
FACET_IN_USE_ERROR = 'FACET_IN_USE_ERROR',
FULFILLMENT_STATE_TRANSITION_ERROR = 'FULFILLMENT_STATE_TRANSITION_ERROR',
GUEST_CHECKOUT_ERROR = 'GUEST_CHECKOUT_ERROR',
INELIGIBLE_SHIPPING_METHOD_ERROR = 'INELIGIBLE_SHIPPING_METHOD_ERROR',
INSUFFICIENT_STOCK_ERROR = 'INSUFFICIENT_STOCK_ERROR',
INSUFFICIENT_STOCK_ON_HAND_ERROR = 'INSUFFICIENT_STOCK_ON_HAND_ERROR',
Expand Down Expand Up @@ -1751,6 +1752,14 @@ export type GlobalSettings = {
updatedAt: Scalars['DateTime'];
};

/** Returned when attempting to set the Customer on a guest checkout when the configured GuestCheckoutStrategy does not allow it. */
export type GuestCheckoutError = ErrorResult & {
__typename?: 'GuestCheckoutError';
errorCode: ErrorCode;
errorDetail: Scalars['String'];
message: Scalars['String'];
};

export type HistoryEntry = Node & {
__typename?: 'HistoryEntry';
administrator?: Maybe<Administrator>;
Expand Down Expand Up @@ -5105,8 +5114,6 @@ export type SearchInput = {
collectionId?: InputMaybe<Scalars['ID']>;
collectionSlug?: InputMaybe<Scalars['String']>;
facetValueFilters?: InputMaybe<Array<FacetValueFilterInput>>;
facetValueIds?: InputMaybe<Array<Scalars['ID']>>;
facetValueOperator?: InputMaybe<LogicalOperator>;
groupByProduct?: InputMaybe<Scalars['Boolean']>;
skip?: InputMaybe<Scalars['Int']>;
sort?: InputMaybe<SearchResultSortParameter>;
Expand Down Expand Up @@ -7599,6 +7606,8 @@ type ErrorResult_FacetInUseError_Fragment = { __typename?: 'FacetInUseError', er

type ErrorResult_FulfillmentStateTransitionError_Fragment = { __typename?: 'FulfillmentStateTransitionError', errorCode: ErrorCode, message: string };

type ErrorResult_GuestCheckoutError_Fragment = { __typename?: 'GuestCheckoutError', errorCode: ErrorCode, message: string };

type ErrorResult_IneligibleShippingMethodError_Fragment = { __typename?: 'IneligibleShippingMethodError', errorCode: ErrorCode, message: string };

type ErrorResult_InsufficientStockError_Fragment = { __typename?: 'InsufficientStockError', errorCode: ErrorCode, message: string };
Expand Down Expand Up @@ -7657,7 +7666,7 @@ type ErrorResult_RefundStateTransitionError_Fragment = { __typename?: 'RefundSta

type ErrorResult_SettlePaymentError_Fragment = { __typename?: 'SettlePaymentError', errorCode: ErrorCode, message: string };

export type ErrorResultFragment = ErrorResult_AlreadyRefundedError_Fragment | ErrorResult_CancelActiveOrderError_Fragment | ErrorResult_CancelPaymentError_Fragment | ErrorResult_ChannelDefaultLanguageError_Fragment | ErrorResult_CouponCodeExpiredError_Fragment | ErrorResult_CouponCodeInvalidError_Fragment | ErrorResult_CouponCodeLimitError_Fragment | ErrorResult_CreateFulfillmentError_Fragment | ErrorResult_EmailAddressConflictError_Fragment | ErrorResult_EmptyOrderLineSelectionError_Fragment | ErrorResult_FacetInUseError_Fragment | ErrorResult_FulfillmentStateTransitionError_Fragment | ErrorResult_IneligibleShippingMethodError_Fragment | ErrorResult_InsufficientStockError_Fragment | ErrorResult_InsufficientStockOnHandError_Fragment | ErrorResult_InvalidCredentialsError_Fragment | ErrorResult_InvalidFulfillmentHandlerError_Fragment | ErrorResult_ItemsAlreadyFulfilledError_Fragment | ErrorResult_LanguageNotAvailableError_Fragment | ErrorResult_ManualPaymentStateError_Fragment | ErrorResult_MimeTypeError_Fragment | ErrorResult_MissingConditionsError_Fragment | ErrorResult_MultipleOrderError_Fragment | ErrorResult_NativeAuthStrategyError_Fragment | ErrorResult_NegativeQuantityError_Fragment | ErrorResult_NoActiveOrderError_Fragment | ErrorResult_NoChangesSpecifiedError_Fragment | ErrorResult_NothingToRefundError_Fragment | ErrorResult_OrderLimitError_Fragment | ErrorResult_OrderModificationError_Fragment | ErrorResult_OrderModificationStateError_Fragment | ErrorResult_OrderStateTransitionError_Fragment | ErrorResult_PaymentMethodMissingError_Fragment | ErrorResult_PaymentOrderMismatchError_Fragment | ErrorResult_PaymentStateTransitionError_Fragment | ErrorResult_ProductOptionInUseError_Fragment | ErrorResult_QuantityTooGreatError_Fragment | ErrorResult_RefundOrderStateError_Fragment | ErrorResult_RefundPaymentIdMissingError_Fragment | ErrorResult_RefundStateTransitionError_Fragment | ErrorResult_SettlePaymentError_Fragment;
export type ErrorResultFragment = ErrorResult_AlreadyRefundedError_Fragment | ErrorResult_CancelActiveOrderError_Fragment | ErrorResult_CancelPaymentError_Fragment | ErrorResult_ChannelDefaultLanguageError_Fragment | ErrorResult_CouponCodeExpiredError_Fragment | ErrorResult_CouponCodeInvalidError_Fragment | ErrorResult_CouponCodeLimitError_Fragment | ErrorResult_CreateFulfillmentError_Fragment | ErrorResult_EmailAddressConflictError_Fragment | ErrorResult_EmptyOrderLineSelectionError_Fragment | ErrorResult_FacetInUseError_Fragment | ErrorResult_FulfillmentStateTransitionError_Fragment | ErrorResult_GuestCheckoutError_Fragment | ErrorResult_IneligibleShippingMethodError_Fragment | ErrorResult_InsufficientStockError_Fragment | ErrorResult_InsufficientStockOnHandError_Fragment | ErrorResult_InvalidCredentialsError_Fragment | ErrorResult_InvalidFulfillmentHandlerError_Fragment | ErrorResult_ItemsAlreadyFulfilledError_Fragment | ErrorResult_LanguageNotAvailableError_Fragment | ErrorResult_ManualPaymentStateError_Fragment | ErrorResult_MimeTypeError_Fragment | ErrorResult_MissingConditionsError_Fragment | ErrorResult_MultipleOrderError_Fragment | ErrorResult_NativeAuthStrategyError_Fragment | ErrorResult_NegativeQuantityError_Fragment | ErrorResult_NoActiveOrderError_Fragment | ErrorResult_NoChangesSpecifiedError_Fragment | ErrorResult_NothingToRefundError_Fragment | ErrorResult_OrderLimitError_Fragment | ErrorResult_OrderModificationError_Fragment | ErrorResult_OrderModificationStateError_Fragment | ErrorResult_OrderStateTransitionError_Fragment | ErrorResult_PaymentMethodMissingError_Fragment | ErrorResult_PaymentOrderMismatchError_Fragment | ErrorResult_PaymentStateTransitionError_Fragment | ErrorResult_ProductOptionInUseError_Fragment | ErrorResult_QuantityTooGreatError_Fragment | ErrorResult_RefundOrderStateError_Fragment | ErrorResult_RefundPaymentIdMissingError_Fragment | ErrorResult_RefundStateTransitionError_Fragment | ErrorResult_SettlePaymentError_Fragment;

export type ShippingMethodFragment = { __typename?: 'ShippingMethod', id: string, createdAt: any, updatedAt: any, code: string, name: string, description: string, fulfillmentHandlerCode: string, checker: { __typename?: 'ConfigurableOperation', code: string, args: Array<{ __typename?: 'ConfigArg', name: string, value: string }> }, calculator: { __typename?: 'ConfigurableOperation', code: string, args: Array<{ __typename?: 'ConfigArg', name: string, value: string }> }, translations: Array<{ __typename?: 'ShippingMethodTranslation', id: string, languageCode: LanguageCode, name: string, description: string }> };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
"EmptyOrderLineSelectionError",
"FacetInUseError",
"FulfillmentStateTransitionError",
"GuestCheckoutError",
"IneligibleShippingMethodError",
"InsufficientStockError",
"InsufficientStockOnHandError",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1422,6 +1422,7 @@ export enum ErrorCode {
EMPTY_ORDER_LINE_SELECTION_ERROR = 'EMPTY_ORDER_LINE_SELECTION_ERROR',
FACET_IN_USE_ERROR = 'FACET_IN_USE_ERROR',
FULFILLMENT_STATE_TRANSITION_ERROR = 'FULFILLMENT_STATE_TRANSITION_ERROR',
GUEST_CHECKOUT_ERROR = 'GUEST_CHECKOUT_ERROR',
INELIGIBLE_SHIPPING_METHOD_ERROR = 'INELIGIBLE_SHIPPING_METHOD_ERROR',
INSUFFICIENT_STOCK_ERROR = 'INSUFFICIENT_STOCK_ERROR',
INSUFFICIENT_STOCK_ON_HAND_ERROR = 'INSUFFICIENT_STOCK_ON_HAND_ERROR',
Expand Down Expand Up @@ -1683,6 +1684,13 @@ export type GlobalSettings = {
updatedAt: Scalars['DateTime'];
};

/** Returned when attempting to set the Customer on a guest checkout when the configured GuestCheckoutStrategy does not allow it. */
export type GuestCheckoutError = ErrorResult & {
errorCode: ErrorCode;
errorDetail: Scalars['String'];
message: Scalars['String'];
};

export type HistoryEntry = Node & {
administrator?: Maybe<Administrator>;
createdAt: Scalars['DateTime'];
Expand Down Expand Up @@ -4899,8 +4907,6 @@ export type SearchInput = {
collectionId?: InputMaybe<Scalars['ID']>;
collectionSlug?: InputMaybe<Scalars['String']>;
facetValueFilters?: InputMaybe<Array<FacetValueFilterInput>>;
facetValueIds?: InputMaybe<Array<Scalars['ID']>>;
facetValueOperator?: InputMaybe<LogicalOperator>;
groupByProduct?: InputMaybe<Scalars['Boolean']>;
skip?: InputMaybe<Scalars['Int']>;
sort?: InputMaybe<SearchResultSortParameter>;
Expand Down
13 changes: 10 additions & 3 deletions packages/common/src/generated-shop-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,7 @@ export enum ErrorCode {
COUPON_CODE_INVALID_ERROR = 'COUPON_CODE_INVALID_ERROR',
COUPON_CODE_LIMIT_ERROR = 'COUPON_CODE_LIMIT_ERROR',
EMAIL_ADDRESS_CONFLICT_ERROR = 'EMAIL_ADDRESS_CONFLICT_ERROR',
GUEST_CHECKOUT_ERROR = 'GUEST_CHECKOUT_ERROR',
IDENTIFIER_CHANGE_TOKEN_EXPIRED_ERROR = 'IDENTIFIER_CHANGE_TOKEN_EXPIRED_ERROR',
IDENTIFIER_CHANGE_TOKEN_INVALID_ERROR = 'IDENTIFIER_CHANGE_TOKEN_INVALID_ERROR',
INELIGIBLE_PAYMENT_METHOD_ERROR = 'INELIGIBLE_PAYMENT_METHOD_ERROR',
Expand Down Expand Up @@ -1049,6 +1050,14 @@ export enum GlobalFlag {
TRUE = 'TRUE'
}

/** Returned when attempting to set the Customer on a guest checkout when the configured GuestCheckoutStrategy does not allow it. */
export type GuestCheckoutError = ErrorResult & {
__typename?: 'GuestCheckoutError';
errorCode: ErrorCode;
errorDetail: Scalars['String'];
message: Scalars['String'];
};

export type HistoryEntry = Node & {
__typename?: 'HistoryEntry';
createdAt: Scalars['DateTime'];
Expand Down Expand Up @@ -2907,8 +2916,6 @@ export type SearchInput = {
collectionId?: InputMaybe<Scalars['ID']>;
collectionSlug?: InputMaybe<Scalars['String']>;
facetValueFilters?: InputMaybe<Array<FacetValueFilterInput>>;
facetValueIds?: InputMaybe<Array<Scalars['ID']>>;
facetValueOperator?: InputMaybe<LogicalOperator>;
groupByProduct?: InputMaybe<Scalars['Boolean']>;
skip?: InputMaybe<Scalars['Int']>;
sort?: InputMaybe<SearchResultSortParameter>;
Expand Down Expand Up @@ -2975,7 +2982,7 @@ export type Seller = Node & {
updatedAt: Scalars['DateTime'];
};

export type SetCustomerForOrderResult = AlreadyLoggedInError | EmailAddressConflictError | NoActiveOrderError | Order;
export type SetCustomerForOrderResult = AlreadyLoggedInError | EmailAddressConflictError | GuestCheckoutError | NoActiveOrderError | Order;

export type SetOrderShippingMethodResult = IneligibleShippingMethodError | NoActiveOrderError | Order | OrderModificationError;

Expand Down
11 changes: 9 additions & 2 deletions packages/common/src/generated-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1466,6 +1466,7 @@ export enum ErrorCode {
EMPTY_ORDER_LINE_SELECTION_ERROR = 'EMPTY_ORDER_LINE_SELECTION_ERROR',
FACET_IN_USE_ERROR = 'FACET_IN_USE_ERROR',
FULFILLMENT_STATE_TRANSITION_ERROR = 'FULFILLMENT_STATE_TRANSITION_ERROR',
GUEST_CHECKOUT_ERROR = 'GUEST_CHECKOUT_ERROR',
INELIGIBLE_SHIPPING_METHOD_ERROR = 'INELIGIBLE_SHIPPING_METHOD_ERROR',
INSUFFICIENT_STOCK_ERROR = 'INSUFFICIENT_STOCK_ERROR',
INSUFFICIENT_STOCK_ON_HAND_ERROR = 'INSUFFICIENT_STOCK_ON_HAND_ERROR',
Expand Down Expand Up @@ -1740,6 +1741,14 @@ export type GlobalSettings = {
updatedAt: Scalars['DateTime'];
};

/** Returned when attempting to set the Customer on a guest checkout when the configured GuestCheckoutStrategy does not allow it. */
export type GuestCheckoutError = ErrorResult & {
__typename?: 'GuestCheckoutError';
errorCode: ErrorCode;
errorDetail: Scalars['String'];
message: Scalars['String'];
};

export type HistoryEntry = Node & {
__typename?: 'HistoryEntry';
administrator?: Maybe<Administrator>;
Expand Down Expand Up @@ -5034,8 +5043,6 @@ export type SearchInput = {
collectionId?: InputMaybe<Scalars['ID']>;
collectionSlug?: InputMaybe<Scalars['String']>;
facetValueFilters?: InputMaybe<Array<FacetValueFilterInput>>;
facetValueIds?: InputMaybe<Array<Scalars['ID']>>;
facetValueOperator?: InputMaybe<LogicalOperator>;
groupByProduct?: InputMaybe<Scalars['Boolean']>;
skip?: InputMaybe<Scalars['Int']>;
sort?: InputMaybe<SearchResultSortParameter>;
Expand Down
Loading

0 comments on commit 7e0f1d1

Please sign in to comment.