magento/graphql-ce

[Cart Operations] Silently failed to set address on cart

TomashKhamlai opened this issue · 1 comments

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
      }
    }
  }
}
  1. 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": []
    }
  }
}

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.