Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added missing place order address fields, added new StoreConfig fields #463

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions design-documents/graph-ql/coverage/b2b/company.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ type CompanyLegalAddress @doc(description: "Company legal address output data sc
street: [String] @doc(description: "An array of strings that defines the Company's street address.")
city: String @doc(description: "City name.")
region: CustomerAddressRegion @doc(description: "An object containing region data for the Company.")
country_code: CountryCodeEnum @doc(description: "Country code.")
country_code: String @doc(description: "Country code.") @deprecated(reason: "Use country instead")
country: Country
postcode: String @doc(description: "ZIP/postal code.")
telephone: String @doc(description: "Company's phone number.")
}
Expand Down Expand Up @@ -230,7 +231,8 @@ input CompanyAdminInput @doc(description: "Defines the Company's Administrator i
input CompanyLegalAddressCreateInput @doc(description: "Defines the Company legal address input data schema for creating a new entity.") {
street: [String!]! @doc(description: "An array of strings that define the Company street address. Required array value for a field with strings as values of array.")
city: String! @doc(description: "Company's city name. Required.")
country_id: CountryCodeEnum! @doc(description: "Company's country ID. Required. See 'countries' query. Required.")
country_id: String! @doc(description: "Company's country ID. Required. See 'countries' query. Required.") @deprecated(reason: "Use `country_code` instead")
country_code: String! @doc(description: "Company's country code. Required. See 'countries query. Required.")
region: CustomerAddressRegionInput! @doc(description: "An object containing the region name and/or region ID. Required.")
postcode: String! @doc(description: "Company's ZIP/postal code. Required.")
telephone: String! @doc(description: "Company's phone number. Required.")
Expand All @@ -248,7 +250,8 @@ input CompanyUpdateInput @doc(description: "Defines the Company input data schem
input CompanyLegalAddressUpdateInput @doc(description: "Defines the Company legal address input data schema for updating an existing entity. Allows only needed fields to be passed for update.") {
street: [String!] @doc(description: "An array of strings that define the Company street address.")
city: String @doc(description: "Company's city name.")
country_id: CountryCodeEnum @doc(description: "Company's country ID. See 'countries' query.")
country_id: String @doc(description: "Company's country ID. See 'countries' query.") @deprecated(reason: "Use `country_code` instead")
country_code: String @doc(description: "Company's country ID. See 'countries' query.")
region: CustomerAddressRegionInput @doc(description: "An object containing the region name and/or region ID. Required.")
postcode: String @doc(description: "Company's ZIP/postal code.")
telephone: String @doc(description: "Company's phone number.")
Expand Down
1 change: 1 addition & 0 deletions design-documents/graph-ql/coverage/cart/Cart.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ type CheckoutCustomer {
enum GenderEnum {
MALE
FEMALE
OTHER
}

type CheckoutPaymentMethod {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,26 @@ input ShippingAddressInput {
}

input CartAddressInput {
prefix: String @doc(description: "An honorific, such as Dr., Mr., or Mrs. See StoreConfig.address_prefix and StoreConfig.address_prefix_options")
firstname: String!
middlename: String @doc(description: "Middlename of a person. See StoreConfig.address_middlename")
lastname: String!
company: String
suffix: String @doc(description: "A value such as Sr., Jr., or III. See StoreConfig.address_suffix and StoreConfig.address_suffix_options")
gender: GenderEnum @doc(description: "Please check StoreConfig.address_gender if field is required")
company: String @doc(description: "Please check StoreConfig.address_company if field is required")
street: [String!]!
city: String!
region: String
postcode: String
region: String @doc(description: "See Country type for field requirements")
postcode: String @doc(description: "See Country type for field requirements")
country_code: String!
telephone: String!
date_of_birth: String @doc(description: "Please check StoreConfig.address_date_of_birth if field is required"),
telephone: String @doc(description: "Please check StoreConfig.address_telephone if field is required"),
fax: String @doc(description: "Please check StoreConfig.address_fax if field is required"),
vat_id: String @doc(description: "Please check StoreConfig.address_taxvat if field is required"),
save_in_address_book: Boolean!
}


type SetShippingAddressesOnCartOutput {
cart: Cart!
}
Expand All @@ -68,15 +76,24 @@ type Cart {
}

interface CartAddressInterface {
firstname: String
lastname: String
prefix: String @doc(description: "An honorific, such as Dr., Mr., or Mrs.")
firstname: String!
middlename: String
lastname: String!
suffix: String @doc(description: "A value such as Sr., Jr., or III.")
gender: GenderEnum
company: String
street: [String]
city: String
region: CartAddressRegion
city: String!
region: CartAddressRegion @deprecated(reason: "Deprecated use `region_v2`")
region_v2: Region
postcode: String
country: CartAddressCountry
country: CartAddressCountry @deprecated(reason: "Deprecated use `country_v2`")
country_v2: Country
date_of_birth: String
telephone: String
fax: String
vat_id: String
}

type ShippingCartAddress implements CartAddressInterface {
Expand Down
32 changes: 27 additions & 5 deletions design-documents/graph-ql/coverage/customer.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ input CustomerAddressInput {
city: String @doc(description: "The city or town")
region: CustomerAddressRegionInput @doc(description: "An object containing the region name, region code, and region ID")
postcode: String @doc(description: "The customer's ZIP or postal code")
country_id: CountryCodeEnum @doc(description: "Deprecated: use `country_code` instead.")
country_code: CountryCodeEnum @doc(description: "The customer's country")
country_id: CountryCodeEnum @deprecated(reason: "Use `country_code_v2` instead.")
country_code: CountryCodeEnum @doc(description: "The customer's country") @deprecated(reason: "Use `country_code_v2` instead.")
country_code_v2: String @doc(description: "The customer's country. See 'countries' query.")
default_shipping: Boolean @doc(description: "Indicates whether the address is the default shipping address")
default_billing: Boolean @doc(description: "Indicates whether the address is the default billing address")
fax: String @doc(description: "The fax number")
Expand Down Expand Up @@ -143,8 +144,9 @@ type CustomerAddress @doc(description: "CustomerAddress contains detailed inform
customer_id: Int @doc(description: "The customer ID") @deprecated(reason: "customer_id is not needed as part of CustomerAddress, address ID (id) is unique identifier for the addresses.")
region: CustomerAddressRegion @doc(description: "An object containing the region name, region code, and region ID")
region_id: Int @doc(description: "The unique ID for a pre-defined region")
country_id: String @doc(description: "The customer's country") @deprecated(reason: "Use `country_code` instead.")
country_code: CountryCodeEnum @doc(description: "The customer's country")
country_id: String @doc(description: "The customer's country") @deprecated(reason: "Use `country` instead.")
country_code: String @doc(description: "The customer's country") @deprecated(reason: "Use `country` instead.")
country: Country @descrption(description: "The country of the user")
street: [String] @doc(description: "An array of strings that define the street number and name")
company: String @doc(description: "The customer's company")
telephone: String @doc(description: "The telephone number")
Expand Down Expand Up @@ -178,7 +180,27 @@ type IsEmailAvailableOutput {
is_email_available: Boolean @doc(description: "Is email availabel value")
}

enum CountryCodeEnum @doc(description: "The list of countries codes") {
enum AddressFieldVisibilityEnum {
HIDDEN
OPTIONAL
REQUIRED
}

type StoreConfig {
address_prefix: AddressFieldVisibilityEnum! @doc(description: "Should field be hidden, optional or required")
address_prefix_options: [String!] @doc(description: "Possible dropdown options, returns null if it is free to fill in")
address_middlename: AddressFieldVisibilityEnum! @doc(description: "Should field be hidden, optional or required")
address_suffix: AddressFieldVisibilityEnum! @doc(description: "Possible dropdown options, returns null if it is free to fill in")
address_suffix_options: [String!] @doc(description: "Should field be hidden, optional or required")
address_date_of_birth: AddressFieldVisibilityEnum! @doc(description: "Should field be hidden, optional or required")
address_gender: AddressFieldVisibilityEnum! @doc(description: "Should field be hidden, optional or required")
address_telephone: AddressFieldVisibilityEnum! @doc(description: "Should field be hidden, optional or required")
address_fax: AddressFieldVisibilityEnum! @doc(description: "Should field be hidden, optional or required")
address_company: AddressFieldVisibilityEnum! @doc(description: "Should field be hidden, optional or required")
address_vat_id: AddressFieldVisibilityEnum! @doc(description: "Should field be hidden, optional or required")
}

enum CountryCodeEnum @doc(description: "The list of countries codes") @deprecated(reason: "Use in favor of the id type Country") {
AF @doc(description: "Afghanistan")
AX @doc(description: "Åland Islands")
AL @doc(description: "Albania")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,8 @@ type OrderAddress @doc(description: "OrderAddress contains detailed information
middlename: String @doc(description: "The middle name of the person associated with the shipping/billing address")
region: String @doc(description: "The state or province name")
region_id: ID @doc(description: "The unique ID for a pre-defined region")
country_code: CountryCodeEnum @doc(description: "The customer's order country")
country_code: CountryCodeEnum @doc(description: "The customer's order country") @deprecated(reason: "Use `country`")
country: Country @doc(description: "The customer's order country)
street: [String!] @doc(description: "An array of strings that define the street number and name")
company: String @doc(description: "The customer's order company")
telephone: String! @doc(description: "The telephone number")
Expand Down
8 changes: 5 additions & 3 deletions design-documents/graph-ql/coverage/customer/customer.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type Mutation {
resetPassword(email: String!, resetPasswordToken: String!, newPassword: String!): Boolean @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\ResetPassword") @doc(description: "Reset a customer's password using the reset password token that the customer received in an email after requesting it using requestPasswordResetEmail.")
}

# todo: We have a problem here that some fields should be required, but that is a breaking schema change?
input CustomerAddressInput {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've currently left this Todo in place, because the fields shouldn't have been made optional from the start. All input types should be non nullable by default and be made nullable when they actually can be nullable.

firstname: String @doc(description: "The first name of the person associated with the shipping/billing address")
lastname: String @doc(description: "The family name of the person associated with the shipping/billing address")
Expand All @@ -36,8 +37,9 @@ input CustomerAddressInput {
city: String @doc(description: "The city or town")
region: CustomerAddressRegionInput @doc(description: "An object containing the region name, region code, and region ID")
postcode: String @doc(description: "The customer's ZIP or postal code")
country_id: CountryCodeEnum @doc(description: "Deprecated: use `country_code` instead.")
country_code: CountryCodeEnum @doc(description: "The customer's country")
country_id: CountryCodeEnum @deprecated(reason: "Use `country_code_v2` instead.")
country_code: CountryCodeEnum @doc(description: "The customer's country") @deprecated(reason: "Use `country_code_v2` instead.")
country_code_v2: String @doc(description: "The customer's country. See 'countries' query.")
default_shipping: Boolean @doc(description: "Indicates whether the address is the default shipping address")
default_billing: Boolean @doc(description: "Indicates whether the address is the default billing address")
fax: String @doc(description: "The fax number")
Expand Down Expand Up @@ -147,7 +149,7 @@ type IsEmailAvailableOutput {
is_email_available: Boolean @doc(description: "Is email availabel value")
}

enum CountryCodeEnum @doc(description: "The list of countries codes") {
enum CountryCodeEnum @doc(description: "The list of countries codes") @deprecated(reason: "Use in favor of the id type Country") {
AF @doc(description: "Afghanistan")
AX @doc(description: "Åland Islands")
AL @doc(description: "Albania")
Expand Down