magento / graphql-ce

[ARCHIVED] Please use magento/magento2 project
https://github.com/magento/magento2
Open Software License 3.0
131 stars 156 forks source link

[Cart Operations] Silently failed to set address on cart #1042

Closed TomashKhamlai closed 5 years ago

TomashKhamlai commented 5 years ago

Preconditions (*)

  1. The customer has an active cart

Steps to reproduce (*)

  1. Set shipping address without street parameter
    mutation shipping(
    $cart_id: String!
    ) {
    setShippingAddressesOnCart(
    input: {
      cart_id: $cart_id
      shipping_addresses: {
        address: {
          firstname: "Joe"
          country_code: "MX"
          street: [
            ""
          ]
        }
      }
    }
    ) {
    cart {
      shipping_addresses {
        firstname
        postcode
      }
    }
    }
    }
  2. Get address from cart
    {
    cart(cart_id: "12345678123456781234567812345678") {
    shipping_addresses {
      telephone
      street
      region {
        code
        label
      }
      postcode
      lastname
      firstname
    }
    }
    }

Expected result (*)

  1. "message": "The address failed to save. Verify the address and try again."

Actual result (*)

  1. Success response but
    {
    "data": {
    "cart": {
      "shipping_addresses": []
    }
    }
    }
lenaorobei commented 5 years ago

Hi @TomashKhamlai. The schema looks following:

input CartAddressInput {
 firstname: String!
 lastname: String!
 company: String
 street: [String!]!
 city: String!
 region: String
 postcode: String
 country_code: String!
 telephone: String!
 save_in_address_book: Boolean
}

street is required input parameter and the case that validation does not properly happening shows that it is a framework bug. Such validation should not happen in resolvers and such test cases are redundant.

Closing this PR since the framework bug is assigned to the internal team.