Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Requesting price summary fragment in shipping info mutation. #2445

Merged
merged 9 commits into from
Jun 3, 2020
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import gql from 'graphql-tag';

import { PriceSummaryFragment } from '../../CartPage/PriceSummary/priceSummaryFragments';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On line 28 in this file too, I think we intended to turn the lint rule back on.

import { AvailablePaymentMethodsFragment } from './paymentInformation.gql';

// We disable linting for local fields because there is no way to add them to
// the fetched schema. Additionally, since we don't want to make a network call
// for "id" we disable "required-fields"
// https://github.com/apollographql/eslint-plugin-graphql/issues/99

/* eslint-disable graphql/template-strings */
/* eslint-disable graphql/required-fields */
export const GET_IS_BILLING_ADDRESS_SAME = gql`
Expand All @@ -21,8 +25,9 @@ export const GET_PAYMENT_NONCE = gql`
}
}
`;

/* eslint-enable graphql/required-fields */
/* eslint-enable graphql/template-strings */
/* eslint-disable graphql/required-fields */

export const GET_BILLING_ADDRESS = gql`
query getBillingAddress($cartId: String!) {
Expand Down Expand Up @@ -115,9 +120,13 @@ export const SET_BILLING_ADDRESS = gql`
postcode
telephone
}
...PriceSummaryFragment
...AvailablePaymentMethodsFragment
}
}
}
${PriceSummaryFragment}
${AvailablePaymentMethodsFragment}
`;

export const SET_CC_DETAILS_ON_CART = gql`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
import gql from 'graphql-tag';
import { PriceSummaryFragment } from '../../CartPage/PriceSummary/priceSummaryFragments';

// We disable linting for local fields because there is no way to add them to
// the fetched schema.
// https://github.com/apollographql/eslint-plugin-graphql/issues/99
export const AvailablePaymentMethodsFragment = gql`
fragment AvailablePaymentMethodsFragment on Cart {
id
available_payment_methods {
code
title
}
}
`;

/* eslint-disable graphql/template-strings */
export const GET_PAYMENT_INFORMATION = gql`
query getPaymentInformation($cartId: String!) {
cart(cart_id: $cartId) @connection(key: "Cart") {
id
available_payment_methods {
code
title
}
selected_payment_method {
code
}
Expand All @@ -29,8 +36,10 @@ export const GET_PAYMENT_INFORMATION = gql`
}
telephone
}
...AvailablePaymentMethodsFragment
}
}
${AvailablePaymentMethodsFragment}
`;

/* eslint-disable graphql/required-fields */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to this PR, but couldn't help but notice this rule get disabled, and never re-enabled. This is probably preventing any file after this from being properly linted. Consider fixing in this scope, or please create a followup task to resolve this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch Tommy. Havn't noticed that. Also looks like my linter is not working 😓 . Fixed it in 06608bf

Expand All @@ -42,6 +51,7 @@ export const GET_PAYMENT_NONCE = gql`
}
`;

/* eslint-enable graphql/required-fields */
/* eslint-enable graphql/template-strings */

export const SET_BILLING_ADDRESS = gql`
Expand Down Expand Up @@ -90,9 +100,13 @@ export const SET_BILLING_ADDRESS = gql`
postcode
telephone
}
...PriceSummaryFragment
...AvailablePaymentMethodsFragment
}
}
}
${PriceSummaryFragment}
${AvailablePaymentMethodsFragment}
`;

// Sets the provided payment method object on the cart.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import gql from 'graphql-tag';

import { ShippingInformationFragment } from '../shippingInformationFragments.gql';
import { ShippingMethodsCheckoutFragment } from '../../ShippingMethod/shippingMethodFragments.gql';
import { PriceSummaryFragment } from '../../../CartPage/PriceSummary/priceSummaryFragments';
import { AvailablePaymentMethodsFragment } from '../../PaymentInformation/paymentInformation.gql';

export const SET_GUEST_SHIPPING_MUTATION = gql`
mutation SetGuestShipping(
Expand All @@ -26,11 +28,15 @@ export const SET_GUEST_SHIPPING_MUTATION = gql`
id
...ShippingInformationFragment
...ShippingMethodsCheckoutFragment
...PriceSummaryFragment
...AvailablePaymentMethodsFragment
}
}
}
${ShippingInformationFragment}
${ShippingMethodsCheckoutFragment}
${PriceSummaryFragment}
${AvailablePaymentMethodsFragment}
`;

export default {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import gql from 'graphql-tag';

import { ShippingInformationFragment } from './shippingInformationFragments.gql';
import { ShippingMethodsCheckoutFragment } from '../ShippingMethod/shippingMethodFragments.gql';
import { PriceSummaryFragment } from '../../CartPage/PriceSummary/priceSummaryFragments';
import { AvailablePaymentMethodsFragment } from '../PaymentInformation/paymentInformation.gql';

export const GET_SHIPPING_INFORMATION = gql`
query GetShippingInformation($cartId: String!) {
Expand Down Expand Up @@ -34,11 +36,15 @@ export const SET_CUSTOMER_ADDRESS_ON_CART = gql`
id
...ShippingInformationFragment
...ShippingMethodsCheckoutFragment
...PriceSummaryFragment
...AvailablePaymentMethodsFragment
}
}
}
${ShippingInformationFragment}
${ShippingMethodsCheckoutFragment}
${PriceSummaryFragment}
${AvailablePaymentMethodsFragment}
`;

export default {
Expand Down