Postal code validity is not checked when creating\updating an order address, call returns 200

Created on 6 October 2020, about 4 years ago
Updated 18 April 2023, over 1 year ago

If updating\creating the billing\shipping profile via the endpoint provided at /jsonapi/checkout/${order.uuid} there is no check for the validity of the address.

The case we noticed is with the postal code: if some user has insert a combination of administrative_area and postal_code not validated in the backend, thus the relative order address is not actually updated.
The API however returns a 200 code, so there's no way in the front-end to know that actually the order is without an address!

Example of a payload which has a incorrect postal code:

 {
  data: {
    type: "commerce_order--default",
    id: "ffa590d4-9e33-49ba-b9f5-dd82da5fda3e",
    attributes: {
      billing_information: {
        address_line1: "test",
        address_line2: "1",
        administrative_area: "MC",
        country_code: "IT",
        family_name: "name",
        given_name: "surname",
        locality: "Locality",
        organization: "organization",
        postal_code: "6201011", // not valid
      },
      shipping_information: {
        // …
      },
      data: {
        copy_to_address_book: true,
        address_book_profile_id: 91
      }
    },
    // ...
  }
}
🐛 Bug report
Status

Needs review

Component

Code

Created by

🇮🇹Italy Giuseppe87

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States dobe

    @jsacksick I am trying to get the shipping address and billing address to update a profile I select using the api instead of creating new entries... How do I pass those parameters? Seems like everything I have tried just creates new entries.

    Thank you!
    -Jesse

Production build 0.71.5 2024