| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- import gql from 'graphql-tag';
- export const TEST_ORDER_FRAGMENT = gql`
- fragment TestOrderFragment on Order {
- id
- code
- state
- active
- subTotal
- subTotalWithTax
- shipping
- shippingWithTax
- total
- totalWithTax
- currencyCode
- couponCodes
- discounts {
- adjustmentSource
- amount
- amountWithTax
- description
- type
- }
- payments {
- id
- transactionId
- method
- amount
- state
- metadata
- }
- lines {
- id
- quantity
- linePrice
- linePriceWithTax
- unitPrice
- unitPriceWithTax
- unitPriceChangeSinceAdded
- unitPriceWithTaxChangeSinceAdded
- proratedUnitPriceWithTax
- productVariant {
- id
- }
- discounts {
- adjustmentSource
- amount
- amountWithTax
- description
- type
- }
- }
- shippingLines {
- shippingMethod {
- id
- code
- description
- }
- }
- customer {
- id
- user {
- id
- identifier
- }
- }
- history {
- items {
- id
- type
- data
- }
- }
- }
- `;
- export const ADD_PAYMENT = gql`
- mutation AddPaymentToOrder($input: PaymentInput!) {
- addPaymentToOrder(input: $input) {
- ...TestOrderFragment
- ... on ErrorResult {
- errorCode
- message
- }
- ... on PaymentDeclinedError {
- paymentErrorMessage
- }
- ... on PaymentFailedError {
- paymentErrorMessage
- }
- ... on OrderStateTransitionError {
- transitionError
- }
- ... on IneligiblePaymentMethodError {
- eligibilityCheckerMessage
- }
- }
- }
- ${TEST_ORDER_FRAGMENT}
- `;
- export const SET_SHIPPING_ADDRESS = gql`
- mutation SetShippingAddress($input: CreateAddressInput!) {
- setOrderShippingAddress(input: $input) {
- ... on Order {
- shippingAddress {
- fullName
- company
- streetLine1
- streetLine2
- city
- province
- postalCode
- country
- phoneNumber
- }
- }
- ... on ErrorResult {
- errorCode
- message
- }
- }
- }
- `;
- export const GET_ELIGIBLE_SHIPPING_METHODS = gql`
- query GetShippingMethods {
- eligibleShippingMethods {
- id
- code
- price
- name
- description
- }
- }
- `;
- export const TRANSITION_TO_STATE = gql`
- mutation TransitionToState($state: String!) {
- transitionOrderToState(state: $state) {
- ... on Order {
- id
- }
- ... on OrderStateTransitionError {
- errorCode
- message
- transitionError
- fromState
- toState
- }
- }
- }
- `;
- export const SET_SHIPPING_METHOD = gql`
- mutation SetShippingMethod($id: [ID!]!) {
- setOrderShippingMethod(shippingMethodId: $id) {
- ...TestOrderFragment
- ... on ErrorResult {
- errorCode
- message
- }
- }
- }
- ${TEST_ORDER_FRAGMENT}
- `;
- export const ADD_ITEM_TO_ORDER = gql`
- mutation AddItemToOrder($productVariantId: ID!, $quantity: Int!) {
- addItemToOrder(productVariantId: $productVariantId, quantity: $quantity) {
- ...TestOrderFragment
- ... on ErrorResult {
- errorCode
- message
- }
- ... on InsufficientStockError {
- quantityAvailable
- order {
- ...TestOrderFragment
- }
- }
- }
- }
- ${TEST_ORDER_FRAGMENT}
- `;
- export const GET_ORDER_BY_CODE = gql`
- query GetOrderByCode($code: String!) {
- orderByCode(code: $code) {
- ...TestOrderFragment
- }
- }
- ${TEST_ORDER_FRAGMENT}
- `;
- export const GET_ACTIVE_ORDER = gql`
- query GetActiveOrder {
- activeOrder {
- ...TestOrderFragment
- }
- }
- ${TEST_ORDER_FRAGMENT}
- `;
|