Skip to content

Commit

Permalink
feat(core): Implement transitionOrderToState in Admin API
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Jul 10, 2020
1 parent d166c08 commit 3196b52
Show file tree
Hide file tree
Showing 14 changed files with 466 additions and 121 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1862,6 +1862,7 @@ export type Mutation = {
addNoteToOrder: Order;
updateOrderNote: HistoryEntry;
deleteOrderNote: DeletionResponse;
transitionOrderToState?: Maybe<Order>;
/** Update an existing PaymentMethod */
updatePaymentMethod: PaymentMethod;
/** Create a new ProductOptionGroup */
Expand Down Expand Up @@ -2149,6 +2150,11 @@ export type MutationDeleteOrderNoteArgs = {
id: Scalars['ID'];
};

export type MutationTransitionOrderToStateArgs = {
id: Scalars['ID'];
state: Scalars['String'];
};

export type MutationUpdatePaymentMethodArgs = {
input: UpdatePaymentMethodInput;
};
Expand Down
7 changes: 7 additions & 0 deletions packages/common/src/generated-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1861,6 +1861,7 @@ export type Mutation = {
addNoteToOrder: Order;
updateOrderNote: HistoryEntry;
deleteOrderNote: DeletionResponse;
transitionOrderToState?: Maybe<Order>;
/** Update an existing PaymentMethod */
updatePaymentMethod: PaymentMethod;
/** Create a new ProductOptionGroup */
Expand Down Expand Up @@ -2200,6 +2201,12 @@ export type MutationDeleteOrderNoteArgs = {
};


export type MutationTransitionOrderToStateArgs = {
id: Scalars['ID'];
state: Scalars['String'];
};


export type MutationUpdatePaymentMethodArgs = {
input: UpdatePaymentMethodInput;
};
Expand Down
49 changes: 35 additions & 14 deletions packages/core/e2e/graphql/generated-e2e-admin-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1862,6 +1862,7 @@ export type Mutation = {
addNoteToOrder: Order;
updateOrderNote: HistoryEntry;
deleteOrderNote: DeletionResponse;
transitionOrderToState?: Maybe<Order>;
/** Update an existing PaymentMethod */
updatePaymentMethod: PaymentMethod;
/** Create a new ProductOptionGroup */
Expand Down Expand Up @@ -2149,6 +2150,11 @@ export type MutationDeleteOrderNoteArgs = {
id: Scalars['ID'];
};

export type MutationTransitionOrderToStateArgs = {
id: Scalars['ID'];
state: Scalars['String'];
};

export type MutationUpdatePaymentMethodArgs = {
input: UpdatePaymentMethodInput;
};
Expand Down Expand Up @@ -5032,6 +5038,14 @@ export type GetCustomerHistoryQuery = { __typename?: 'Query' } & {
>;
};

export type GetOrderQueryVariables = {
id: Scalars['ID'];
};

export type GetOrderQuery = { __typename?: 'Query' } & {
order?: Maybe<{ __typename?: 'Order' } & OrderWithLinesFragment>;
};

export type UpdateOptionGroupMutationVariables = {
input: UpdateProductOptionGroupInput;
};
Expand All @@ -5040,6 +5054,15 @@ export type UpdateOptionGroupMutation = { __typename?: 'Mutation' } & {
updateProductOptionGroup: { __typename?: 'ProductOptionGroup' } & Pick<ProductOptionGroup, 'id'>;
};

export type AdminTransitionMutationVariables = {
id: Scalars['ID'];
state: Scalars['String'];
};

export type AdminTransitionMutation = { __typename?: 'Mutation' } & {
transitionOrderToState?: Maybe<{ __typename?: 'Order' } & Pick<Order, 'id' | 'state' | 'nextStates'>>;
};

export type DeletePromotionAdHoc1MutationVariables = {};

export type DeletePromotionAdHoc1Mutation = { __typename?: 'Mutation' } & {
Expand Down Expand Up @@ -5077,14 +5100,6 @@ export type GetOrderListQuery = { __typename?: 'Query' } & {
};
};

export type GetOrderQueryVariables = {
id: Scalars['ID'];
};

export type GetOrderQuery = { __typename?: 'Query' } & {
order?: Maybe<{ __typename?: 'Order' } & OrderWithLinesFragment>;
};

export type SettlePaymentMutationVariables = {
id: Scalars['ID'];
};
Expand Down Expand Up @@ -6706,12 +6721,24 @@ export namespace GetCustomerHistory {
>;
}

export namespace GetOrder {
export type Variables = GetOrderQueryVariables;
export type Query = GetOrderQuery;
export type Order = OrderWithLinesFragment;
}

export namespace UpdateOptionGroup {
export type Variables = UpdateOptionGroupMutationVariables;
export type Mutation = UpdateOptionGroupMutation;
export type UpdateProductOptionGroup = UpdateOptionGroupMutation['updateProductOptionGroup'];
}

export namespace AdminTransition {
export type Variables = AdminTransitionMutationVariables;
export type Mutation = AdminTransitionMutation;
export type TransitionOrderToState = NonNullable<AdminTransitionMutation['transitionOrderToState']>;
}

export namespace DeletePromotionAdHoc1 {
export type Variables = DeletePromotionAdHoc1MutationVariables;
export type Mutation = DeletePromotionAdHoc1Mutation;
Expand Down Expand Up @@ -6740,12 +6767,6 @@ export namespace GetOrderList {
export type Items = OrderFragment;
}

export namespace GetOrder {
export type Variables = GetOrderQueryVariables;
export type Query = GetOrderQuery;
export type Order = OrderWithLinesFragment;
}

export namespace SettlePayment {
export type Variables = SettlePaymentMutationVariables;
export type Mutation = SettlePaymentMutation;
Expand Down
10 changes: 10 additions & 0 deletions packages/core/e2e/graphql/shared-definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
CURRENT_USER_FRAGMENT,
CUSTOMER_FRAGMENT,
FACET_WITH_VALUES_FRAGMENT,
ORDER_WITH_LINES_FRAGMENT,
PRODUCT_VARIANT_FRAGMENT,
PRODUCT_WITH_VARIANTS_FRAGMENT,
PROMOTION_FRAGMENT,
Expand Down Expand Up @@ -395,3 +396,12 @@ export const GET_CUSTOMER_HISTORY = gql`
}
}
`;

export const GET_ORDER = gql`
query GetOrder($id: ID!) {
order(id: $id) {
...OrderWithLines
}
}
${ORDER_WITH_LINES_FRAGMENT}
`;
Loading

0 comments on commit 3196b52

Please sign in to comment.