Skip to content
This repository was archived by the owner on Dec 19, 2019. It is now read-only.

Cover lowercase countryId in the shipping/billing address if provided by variables #784

Closed
TomashKhamlai opened this issue Jul 23, 2019 · 1 comment
Labels

Comments

@TomashKhamlai
Copy link
Contributor

TomashKhamlai commented Jul 23, 2019

❗ Steps are not accurate. Don't spend much time on reproducing.

Preconditions (*)

  1. Customer is created. Empty address book
  2. The customer has a product in the cart

Steps to reproduce (*)

  1. Get Customer token
  2. Create empty cart to return active cart Investigate the changes in createEmptyCart for Customer #773. Connect to the database to copy masked_id of the cart
  3. Set shipping address like this
mutation setShippingAddressesOnCart(
  $cart_id: String!
  $firstname: String!
  $lastname: String!
  $street_lines: [String]!
  $city: String!
  $region: String!
  $postcode: String!
  $country_code: String!
  $telephone: String!
) {
  setShippingAddressesOnCart(
    input: {
      cart_id: $cart_id
      shipping_addresses: [
        {
          address: {
            firstname: $firstname
            lastname: $lastname
            street: $street_lines
            city: $city
            region: $region
            postcode: $postcode
            country_code: $country_code
            telephone: $telephone
            save_in_address_book: true
          }
        }
      ]
    }
  ) {
    cart {
      shipping_addresses {
        firstname
        lastname
        city
        postcode
        country {
          code
          label
        }
        region {
          label
          code
        }
        selected_shipping_method {
          carrier_code
          method_code
        }
        available_shipping_methods {
          carrier_code
          method_code
          carrier_title
          method_title
        }
      }
    }
  }
}

Use headers

{
  "cart_id": "{{ masked_id }}",
  "firstname": "John",
  "lastname": "Doe",
  "street_lines": ["6161 West Centinella Avenue"],
  "city": "Culver City",
  "region": "CA",
  "postcode": "90230",
  "country_code": "us",
  "telephone": "555-555-55-55"
}
  1. Set billing address
mutation setBillingAddressOnCart(
  $cart_id: String!
  $firstname: String!
  $lastname: String!
  $street_lines: [String]!
  $city: String!
  $region: String!
  $postcode: String!
  $country_code: String!
  $telephone: String!
) {
  setBillingAddressOnCart(
    input: {
      cart_id: $cart_id
      billing_address: {
        address: {
            firstname: $firstname
            lastname: $lastname
            street: $street_lines
            city: $city
            region: $region
            postcode: $postcode
            country_code: $country_code
            telephone: $telephone
            save_in_address_book: true
          }
      }
    }
  ) {
    cart {
      billing_address {
        postcode
        city
        country {
          code
          label
        }
      }
      available_payment_methods {
        code
        title
      }
    }
  }
}

Use headers

{
  "cart_id": "{{ masked_id }}",
  "firstname": "John",
  "lastname": "Doe",
  "street_lines": ["6161 West Centinella Avenue"],
  "city": "Culver City",
  "region": "CA",
  "postcode": "90230",
  "country_code": "US",
  "telephone": "555-555-55-55"
}

"country_code": "US" for billing address and "country_code": "us" for shiipping address or vice-verca.

  1. Get current masked_id of the active cart Investigate the changes in createEmptyCart for Customer #773 . Generate new masked_id that references to the active cart
mutation {
  createEmptyCart
}

Expected result (*)

  1. Validation for country_code (counrtyId)

Actual result (*)

  1. Error:
{
  "errors": [
    {
      "debugMessage": "Invalid value of \"us\" provided for the countryId field.",
      "message": "Internal server error",
      "category": "internal",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "createEmptyCart"
      ]
    }
  ],
  "data": {
    "createEmptyCart": null
  }
}
@naydav
Copy link
Contributor

naydav commented Jul 30, 2019

#790

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants