Skip to content

Customer

Customer properties for CustomerEvent

Properties

  • DefaultWarehouseId (['string', 'null'])Default warehouse ID.
  • Id (string)Customer ID.
  • XmlSenderId (['string', 'null'])XML sender ID.
  • BillToCodeRequiredOnOrder (boolean)Whether bill-to code is required on order.
  • BillingEntities (['array', 'null'])Billing entities.

    • Items (object)

      • Id (string, required)Billing entity ID.
      • XmlSenderId (['string', 'null'])XML sender ID.
      • Addresses (['array', 'null'])Billing entity addresses.

        • Items (object)

          • XmlSenderId (['string', 'null'])XML sender ID.
          • Address1 (string, required)Address line 1.
          • Address2 (['string', 'null'])Address line 2.
          • Address3 (['string', 'null'])Address line 3.
          • City (string, required)City.
          • Code (string, required)Address code.
          • Company (['string', 'null'])Company name.
          • Country (string, required)Country.
          • EmailAddress (['string', 'null'])Email address.
          • FaxNumber (['string', 'null'])Fax number.
          • IsBillToDefault (boolean)Whether this is the default bill-to address.
          • IsShipToDefault (boolean)Whether this is the default ship-to address.
          • Name (string, required)Address name.
          • PhoneNumber (['string', 'null'])Phone number.
          • PostalCode (string, required)Postal code.
          • StateProvince (string, required)State or province.
      • IsDefaultForCustomer (boolean, required)Whether this is the default billing entity for the customer.

  • BrokerScopes (['array', 'null'])Broker scopes.

    • Items (string)
  • ContactAddress (['object', 'null'])Contact address.

    • Address1 (string, required)Address line 1.
    • Address2 (['string', 'null'])Address line 2.
    • Address3 (['string', 'null'])Address line 3.
    • City (string, required)City.
    • Company (['string', 'null'])Company.
    • Country (string, required)Country.
    • FaxNumber (['string', 'null'])Fax number.
    • Name (['string', 'null'])Name.
    • PhoneNumber (['string', 'null'])Phone number.
    • PostalCode (string, required)Postal code.
    • StateProvince (string, required)State or province.
  • ContactEmailAddress (['string', 'null'])Contact email address.

  • DoValidateOrderPrice (boolean)Whether to validate order price.
  • EmailNotificationSubscriptions (['array', 'null'])Email notification subscriptions.

    • Items (object)

      • EmailNotificationTemplateId (string, required)Email notification template ID.
      • EmailAddresses (array, required)Email addresses.

        • Items (string)
  • InvoiceEmailAddress (['string', 'null'])Invoice email address.

  • Name (string)Customer name.
  • OfferRevisionDelimiter (['string', 'null'])Offer revision delimiter.
  • Parent (['object', 'null'])Parent customer.

    • Id (string)Parent customer ID.
    • Name (string)Parent customer name.
  • Partner (['string', 'null'])Partner.

  • PaymentEmailAddress (['string', 'null'])Payment email address.
  • PhoneNumber (['string', 'null'])Phone number.
  • ProductionFileLocation (['string', 'null'])Production file location.
  • SalesRep (['string', 'null'])Sales representative.
  • ShipMethodMappings (['array', 'null'])Ship method mappings.

    • Items (object)

      • RatesProviderShipMethodId (string, required)Rates provider ship method ID.
      • SourceSystemShipMethodId (string, required)Source system ship method ID.
      • FulfillmentSystemShipMethods (array, required)Fulfillment system ship methods.

        • Items (object)

          • FulfillmentSystemId (integer, required)Fulfillment system ID.
          • FulfillmentSystemShipMethodId (string, required)Fulfillment system ship method ID.
      • TrackingUrl (['string', 'null'])Tracking URL.

  • SourceSystems (['array', 'null'])Source systems.

    • Items (object)

      • Id (integer, required)Source system ID.
      • SourceSystemCustomerId (string)This is an automatically generated field added by middleware. It is considered read-only.
      • Name (string)Source system name.
  • Subsidiary (['string', 'null'])Subsidiary.

  • Website (['string', 'null'])Website.

Quicktype Command

quicktype \
    --framework SystemTextJson  \
    --lang cs  \
    --number-type double  \
    --src-lang schema  \
    --no-check-required  \
    --density dense  \
    --features complete  \
    --namespace OtpSchema.Event.Customer.Customer  \
    --src .working/build/internal/json-schema-for-cs/Customer.json -o .working/build/internal/csharp/OtpSchema/Event/Customer/Customer.cs
Customer
// <auto-generated />
//
// To parse this JSON data, add NuGet 'System.Text.Json' then do:
//
//    using OtpSchema.Event.Customer.Customer;
//
//    var customer = Customer.FromJson(jsonString);
#nullable enable
#pragma warning disable CS8618
#pragma warning disable CS8601
#pragma warning disable CS8603

namespace OtpSchema.Event.Customer.Customer
{
    using System;
    using System.Collections.Generic;

    using System.Text.Json;
    using System.Text.Json.Serialization;
    using System.Globalization;
    using J = System.Text.Json.Serialization.JsonPropertyNameAttribute;
    using N = System.Text.Json.Serialization.JsonIgnoreCondition;

    /// <summary>Customer properties for CustomerEvent</summary>
    public partial class Customer
    {
        [J("BillingEntities")]                public BillingEntity[] BillingEntities { get; set; }                                // Billing entities
        [J("BillToCodeRequiredOnOrder")]      public bool BillToCodeRequiredOnOrder { get; set; }                                 // Whether bill-to code is required on order
        [J("BrokerScopes")]                   public string[] BrokerScopes { get; set; }                                          // Broker scopes
        [J("ContactAddress")]                 public ContactAddress ContactAddress { get; set; }                                  // Contact address
        [J("ContactEmailAddress")]            public string ContactEmailAddress { get; set; }                                     // Contact email address
        [J("DefaultWarehouseId")]             public string DefaultWarehouseId { get; set; }                                      // Default warehouse ID
        [J("DoValidateOrderPrice")]           public bool DoValidateOrderPrice { get; set; }                                      // Whether to validate order price
        [J("EmailNotificationSubscriptions")] public EmailNotificationSubscription[] EmailNotificationSubscriptions { get; set; } // Email notification subscriptions
        [J("Id")]                             public string Id { get; set; }                                                      // Customer ID
        [J("InvoiceEmailAddress")]            public string InvoiceEmailAddress { get; set; }                                     // Invoice email address
        [J("Name")]                           public string Name { get; set; }                                                    // Customer name
        [J("OfferRevisionDelimiter")]         public string OfferRevisionDelimiter { get; set; }                                  // Offer revision delimiter
        [J("Parent")]                         public Parent Parent { get; set; }                                                  // Parent customer
        [J("Partner")]                        public string Partner { get; set; }                                                 // Partner
        [J("PaymentEmailAddress")]            public string PaymentEmailAddress { get; set; }                                     // Payment email address
        [J("PhoneNumber")]                    public string PhoneNumber { get; set; }                                             // Phone number
        [J("ProductionFileLocation")]         public string ProductionFileLocation { get; set; }                                  // Production file location
        [J("SalesRep")]                       public string SalesRep { get; set; }                                                // Sales representative
        [J("ShipMethodMappings")]             public ShipMethodMapping[] ShipMethodMappings { get; set; }                         // Ship method mappings
        [J("SourceSystems")]                  public SourceSystem[] SourceSystems { get; set; }                                   // Source systems
        [J("Subsidiary")]                     public string Subsidiary { get; set; }                                              // Subsidiary
        [J("Website")]                        public string Website { get; set; }                                                 // Website
        [J("XmlSenderId")]                    public string XmlSenderId { get; set; }                                             // XML sender ID
    }

    public partial class BillingEntity
    {
        [J("Addresses")]            public Address[] Addresses { get; set; }       // Billing entity addresses
        [J("Id")]                   public string Id { get; set; }                 // Billing entity ID
        [J("IsDefaultForCustomer")] public bool IsDefaultForCustomer { get; set; } // Whether this is the default billing entity for the customer
        [J("XmlSenderId")]          public string XmlSenderId { get; set; }        // XML sender ID
    }

    public partial class Address
    {
        [J("Address1")]                                                                     public string Address1 { get; set; }       // Address line 1
        [J("Address2")]                                                                     public string Address2 { get; set; }       // Address line 2
        [J("Address3")]                                                                     public string Address3 { get; set; }       // Address line 3
        [J("City")]                                                                         public string City { get; set; }           // City
        [J("Code")]                                                                         public string Code { get; set; }           // Address code
        [J("Company")]                                                                      public string Company { get; set; }        // Company name
        [J("Country")]                                                                      public string Country { get; set; }        // Country
        [J("EmailAddress")]                                                                 public string EmailAddress { get; set; }   // Email address
        [J("FaxNumber")]                                                                    public string FaxNumber { get; set; }      // Fax number
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)][J("IsBillToDefault")] public bool? IsBillToDefault { get; set; } // Whether this is the default bill-to address
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)][J("IsShipToDefault")] public bool? IsShipToDefault { get; set; } // Whether this is the default ship-to address
        [J("Name")]                                                                         public string Name { get; set; }           // Address name
        [J("PhoneNumber")]                                                                  public string PhoneNumber { get; set; }    // Phone number
        [J("PostalCode")]                                                                   public string PostalCode { get; set; }     // Postal code
        [J("StateProvince")]                                                                public string StateProvince { get; set; }  // State or province
        [J("XmlSenderId")]                                                                  public string XmlSenderId { get; set; }    // XML sender ID
    }

    public partial class ContactAddress
    {
        [J("Address1")]      public string Address1 { get; set; }      // Address line 1
        [J("Address2")]      public string Address2 { get; set; }      // Address line 2
        [J("Address3")]      public string Address3 { get; set; }      // Address line 3
        [J("City")]          public string City { get; set; }          // City
        [J("Company")]       public string Company { get; set; }       // Company
        [J("Country")]       public string Country { get; set; }       // Country
        [J("FaxNumber")]     public string FaxNumber { get; set; }     // Fax number
        [J("Name")]          public string Name { get; set; }          // Name
        [J("PhoneNumber")]   public string PhoneNumber { get; set; }   // Phone number
        [J("PostalCode")]    public string PostalCode { get; set; }    // Postal code
        [J("StateProvince")] public string StateProvince { get; set; } // State or province
    }

    public partial class EmailNotificationSubscription
    {
        [J("EmailAddresses")]              public string[] EmailAddresses { get; set; }            // Email addresses
        [J("EmailNotificationTemplateId")] public string EmailNotificationTemplateId { get; set; } // Email notification template ID
    }

    public partial class Parent
    {
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)][J("Id")]   public string Id { get; set; }   // Parent customer ID
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)][J("Name")] public string Name { get; set; } // Parent customer name
    }

    public partial class ShipMethodMapping
    {
        [J("FulfillmentSystemShipMethods")] public FulfillmentSystemShipMethod[] FulfillmentSystemShipMethods { get; set; } // Fulfillment system ship methods
        [J("RatesProviderShipMethodId")]    public string RatesProviderShipMethodId { get; set; }                           // Rates provider ship method ID
        [J("SourceSystemShipMethodId")]     public string SourceSystemShipMethodId { get; set; }                            // Source system ship method ID
        [J("TrackingUrl")]                  public string TrackingUrl { get; set; }                                         // Tracking URL
    }

    public partial class FulfillmentSystemShipMethod
    {
        [J("FulfillmentSystemId")]           public long FulfillmentSystemId { get; set; }             // Fulfillment system ID
        [J("FulfillmentSystemShipMethodId")] public string FulfillmentSystemShipMethodId { get; set; } // Fulfillment system ship method ID
    }

    public partial class SourceSystem
    {
        [J("Id")]                                                                                  public long Id { get; set; }                       // Source system ID
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)][J("Name")]                   public string Name { get; set; }                   // Source system name
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)][J("SourceSystemCustomerId")] public string SourceSystemCustomerId { get; set; } // This is an automatically generated field added by middleware.  It is considered read-only
    }

    public partial class Customer
    {
        public static Customer FromJson(string json) => JsonSerializer.Deserialize<Customer>(json, OtpSchema.Event.Customer.Customer.Converter.Settings);
    }

    public static class Serialize
    {
        public static string ToJson(this Customer self) => JsonSerializer.Serialize(self, OtpSchema.Event.Customer.Customer.Converter.Settings);
    }

    internal static class Converter
    {
        public static readonly JsonSerializerOptions Settings = new(JsonSerializerDefaults.General)
        {
            Converters =
            {
                new DateOnlyConverter(),
                new TimeOnlyConverter(),
                IsoDateTimeOffsetConverter.Singleton
            },
        };
    }

    public class DateOnlyConverter : JsonConverter<DateOnly>
    {
        private readonly string serializationFormat;
        public DateOnlyConverter() : this(null) { }

        public DateOnlyConverter(string? serializationFormat)
        {
                this.serializationFormat = serializationFormat ?? "yyyy-MM-dd";
        }

        public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
                var value = reader.GetString();
                return DateOnly.Parse(value!);
        }

        public override void Write(Utf8JsonWriter writer, DateOnly value, JsonSerializerOptions options)
                => writer.WriteStringValue(value.ToString(serializationFormat));
    }

    public class TimeOnlyConverter : JsonConverter<TimeOnly>
    {
        private readonly string serializationFormat;

        public TimeOnlyConverter() : this(null) { }

        public TimeOnlyConverter(string? serializationFormat)
        {
                this.serializationFormat = serializationFormat ?? "HH:mm:ss.fff";
        }

        public override TimeOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
                var value = reader.GetString();
                return TimeOnly.Parse(value!);
        }

        public override void Write(Utf8JsonWriter writer, TimeOnly value, JsonSerializerOptions options)
                => writer.WriteStringValue(value.ToString(serializationFormat));
    }

    internal class IsoDateTimeOffsetConverter : JsonConverter<DateTimeOffset>
    {
        public override bool CanConvert(Type t) => t == typeof(DateTimeOffset);

        private const string DefaultDateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK";

        private DateTimeStyles _dateTimeStyles = DateTimeStyles.RoundtripKind;
        private string? _dateTimeFormat;
        private CultureInfo? _culture;

        public DateTimeStyles DateTimeStyles
        {
                get => _dateTimeStyles;
                set => _dateTimeStyles = value;
        }

        public string? DateTimeFormat
        {
                get => _dateTimeFormat ?? string.Empty;
                set => _dateTimeFormat = (string.IsNullOrEmpty(value)) ? null : value;
        }

        public CultureInfo Culture
        {
                get => _culture ?? CultureInfo.CurrentCulture;
                set => _culture = value;
        }

        public override void Write(Utf8JsonWriter writer, DateTimeOffset value, JsonSerializerOptions options)
        {
                string text;


                if ((_dateTimeStyles & DateTimeStyles.AdjustToUniversal) == DateTimeStyles.AdjustToUniversal
                        || (_dateTimeStyles & DateTimeStyles.AssumeUniversal) == DateTimeStyles.AssumeUniversal)
                {
                        value = value.ToUniversalTime();
                }

                text = value.ToString(_dateTimeFormat ?? DefaultDateTimeFormat, Culture);

                writer.WriteStringValue(text);
        }

        public override DateTimeOffset Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
                string? dateText = reader.GetString();

                if (string.IsNullOrEmpty(dateText) == false)
                {
                        if (!string.IsNullOrEmpty(_dateTimeFormat))
                        {
                                return DateTimeOffset.ParseExact(dateText, _dateTimeFormat, Culture, _dateTimeStyles);
                        }
                        else
                        {
                                return DateTimeOffset.Parse(dateText, Culture, _dateTimeStyles);
                        }
                }
                else
                {
                        return default(DateTimeOffset);
                }
        }


        public static readonly IsoDateTimeOffsetConverter Singleton = new IsoDateTimeOffsetConverter();
    }
}
#pragma warning restore CS8618
#pragma warning restore CS8601
#pragma warning restore CS8603

Customer
{
  "$schema": "http://json-schema.org/draft-07/schema#", 
  "$id": "Customer.json", 
  "description": "Customer properties for CustomerEvent", 
  "type": "object", 
  "properties": {
    "DefaultWarehouseId": { "description": "Default warehouse ID", "type": ["string", "null"] }, 
    "Id": {"description": "Customer ID", "type": "string"}, 
    "XmlSenderId": { "description": "XML sender ID", "type": ["string", "null"] }, 
    "BillToCodeRequiredOnOrder": {"description": "Whether bill-to code is required on order", "type": "boolean"}, 
    "BillingEntities": {
      "description": "Billing entities", 
      "type": ["array", "null"], 
      "items": {
        "type": "object", 
        "properties": {
          "Id": {"description": "Billing entity ID", "type": "string"}, 
          "XmlSenderId": { "description": "XML sender ID", "type": ["string", "null"] }, 
          "Addresses": {
            "description": "Billing entity addresses", 
            "type": ["array", "null"], 
            "items": {
              "type": "object", 
              "properties": {
                "XmlSenderId": { "description": "XML sender ID", "type": ["string", "null"] }, 
                "Address1": {"description": "Address line 1", "type": "string"}, 
                "Address2": { "description": "Address line 2", "type": ["string", "null"] }, 
                "Address3": { "description": "Address line 3", "type": ["string", "null"] }, 
                "City": {"description": "City", "type": "string"}, 
                "Code": {"description": "Address code", "type": "string"}, 
                "Company": { "description": "Company name", "type": ["string", "null"] }, 
                "Country": {"description": "Country", "type": "string"}, 
                "EmailAddress": { "description": "Email address", "type": ["string", "null"] }, 
                "FaxNumber": { "description": "Fax number", "type": ["string", "null"] }, 
                "IsBillToDefault": {
                  "description": "Whether this is the default bill-to address", 
                  "type": "boolean"
                }, 
                "IsShipToDefault": {
                  "description": "Whether this is the default ship-to address", 
                  "type": "boolean"
                }, 
                "Name": {"description": "Address name", "type": "string"}, 
                "PhoneNumber": { "description": "Phone number", "type": ["string", "null"] }, 
                "PostalCode": {"description": "Postal code", "type": "string"}, 
                "StateProvince": {"description": "State or province", "type": "string"}
              }, 
              "required": ["Name", "Address1", "City", "Country", "StateProvince", "PostalCode", "Code"]
            }
          }, 
          "IsDefaultForCustomer": {
            "description": "Whether this is the default billing entity for the customer", 
            "type": "boolean"
          }
        }, 
        "required": ["Id", "IsDefaultForCustomer"]
      }
    }, 
    "BrokerScopes": {
      "description": "Broker scopes", 
      "type": ["array", "null"], 
      "items": {"type": "string"}
    }, 
    "ContactAddress": {
      "description": "Contact address", 
      "type": ["object", "null"], 
      "properties": {
        "Address1"     : { "description": "Address line 1"   , "type": "string"           }, 
        "Address2"     : { "description": "Address line 2"   , "type": ["string", "null"] }, 
        "Address3"     : { "description": "Address line 3"   , "type": ["string", "null"] }, 
        "City"         : { "description": "City"             , "type": "string"           }, 
        "Company"      : { "description": "Company"          , "type": ["string", "null"] }, 
        "Country"      : { "description": "Country"          , "type": "string"           }, 
        "FaxNumber"    : { "description": "Fax number"       , "type": ["string", "null"] }, 
        "Name"         : { "description": "Name"             , "type": ["string", "null"] }, 
        "PhoneNumber"  : { "description": "Phone number"     , "type": ["string", "null"] }, 
        "PostalCode"   : { "description": "Postal code"      , "type": "string"           }, 
        "StateProvince": { "description": "State or province", "type": "string"           }
      }, 
      "required": ["Address1", "City", "Country", "PostalCode", "StateProvince"]
    }, 
    "ContactEmailAddress": { "description": "Contact email address", "type": ["string", "null"] }, 
    "DoValidateOrderPrice": {"description": "Whether to validate order price", "type": "boolean"}, 
    "EmailNotificationSubscriptions": {
      "description": "Email notification subscriptions", 
      "type": ["array", "null"], 
      "items": {
        "type": "object", 
        "properties": {
          "EmailNotificationTemplateId": {"description": "Email notification template ID", "type": "string"}, 
          "EmailAddresses": {
            "description": "Email addresses", 
            "type": "array", 
            "items": {"type": "string"}
          }
        }, 
        "required": ["EmailNotificationTemplateId", "EmailAddresses"]
      }
    }, 
    "InvoiceEmailAddress": { "description": "Invoice email address", "type": ["string", "null"] }, 
    "Name": {"description": "Customer name", "type": "string"}, 
    "OfferRevisionDelimiter": { "description": "Offer revision delimiter", "type": ["string", "null"] }, 
    "Parent": {
      "description": "Parent customer", 
      "type": ["object", "null"], 
      "properties": {
        "Id"  : { "description": "Parent customer ID"  , "type": "string" }, 
        "Name": { "description": "Parent customer name", "type": "string" }
      }
    }, 
    "Partner": { "description": "Partner", "type": ["string", "null"] }, 
    "PaymentEmailAddress": { "description": "Payment email address", "type": ["string", "null"] }, 
    "PhoneNumber": { "description": "Phone number", "type": ["string", "null"] }, 
    "ProductionFileLocation": { "description": "Production file location", "type": ["string", "null"] }, 
    "SalesRep": { "description": "Sales representative", "type": ["string", "null"] }, 
    "ShipMethodMappings": {
      "description": "Ship method mappings", 
      "type": ["array", "null"], 
      "items": {
        "type": "object", 
        "properties": {
          "RatesProviderShipMethodId": {"description": "Rates provider ship method ID", "type": "string"}, 
          "SourceSystemShipMethodId": {"description": "Source system ship method ID", "type": "string"}, 
          "FulfillmentSystemShipMethods": {
            "description": "Fulfillment system ship methods", 
            "type": "array", 
            "items": {
              "type": "object", 
              "properties": {
                "FulfillmentSystemId"          : { "description": "Fulfillment system ID"            , "type": "integer" }, 
                "FulfillmentSystemShipMethodId": { "description": "Fulfillment system ship method ID", "type": "string"  }
              }, 
              "required": ["FulfillmentSystemId", "FulfillmentSystemShipMethodId"]
            }
          }, 
          "TrackingUrl": { "description": "Tracking URL", "type": ["string", "null"] }
        }, 
        "required": [
          "SourceSystemShipMethodId", "RatesProviderShipMethodId", 
          "FulfillmentSystemShipMethods"
        ]
      }
    }, 
    "SourceSystems": {
      "description": "Source systems", 
      "type": ["array", "null"], 
      "items": {
        "type": "object", 
        "properties": {
          "Id": {"description": "Source system ID", "type": "integer"}, 
          "SourceSystemCustomerId": {
            "description": "This is an automatically generated field added by middleware.  It is considered read-only", 
            "type": "string", 
            "readonly": true
          }, 
          "Name": {"description": "Source system name", "type": "string"}
        }, 
        "required": ["Id"]
      }
    }, 
    "Subsidiary": { "description": "Subsidiary", "type": ["string", "null"] }, 
    "Website": { "description": "Website", "type": ["string", "null"] }
  }, 
  "required": ["Id", "Name", "BillToCodeRequiredOnOrder", "DoValidateOrderPrice"]
}