public Person() { this.birthday = new Birthday(); this.contactInformation = new ContactInformation(); this.name = new PersonalName(); this.healthInformation = new HealthInformation(); }
public bool Equals(PersonalName other) { if ((object)other == null) { return false; } return this.FirstName == other.FirstName && this.LastName == other.LastName; }
public bool Equals(PersonalName other) { if ((object)other == null) { return(false); } return(this.FirstName == other.FirstName && this.LastName == other.LastName); }
public Professor(PersonalName name) { if (name is null) { throw new System.ArgumentNullException(nameof(name)); } Name = name; }
public async void Example() { #pragma warning disable 0168 using (Client client = GetClient()) { AmountOfMoney amountOfMoney = new AmountOfMoney(); amountOfMoney.Amount = 1L; amountOfMoney.CurrencyCode = "EUR"; BankAccountIban bankAccountIban = new BankAccountIban(); bankAccountIban.Iban = "NL53INGB0000000036"; BankRefundMethodSpecificInput bankRefundMethodSpecificInput = new BankRefundMethodSpecificInput(); bankRefundMethodSpecificInput.BankAccountIban = bankAccountIban; PersonalName name = new PersonalName(); name.Surname = "Coyote"; AddressPersonal address = new AddressPersonal(); address.CountryCode = "US"; address.Name = name; ContactDetailsBase contactDetails = new ContactDetailsBase(); contactDetails.EmailAddress = "*****@*****.**"; contactDetails.EmailMessageType = "html"; RefundCustomer customer = new RefundCustomer(); customer.Address = address; customer.ContactDetails = contactDetails; RefundReferences refundReferences = new RefundReferences(); refundReferences.MerchantReference = "AcmeOrder0001"; RefundRequest body = new RefundRequest(); body.AmountOfMoney = amountOfMoney; body.BankRefundMethodSpecificInput = bankRefundMethodSpecificInput; body.Customer = customer; body.RefundDate = "20140306"; body.RefundReferences = refundReferences; try { RefundResponse response = await client.Merchant("merchantId").Payments().Refund("paymentId", body); } catch (DeclinedRefundException e) { HandleDeclinedRefund(e.RefundResult); } catch (ApiException e) { HandleApiErrors(e.Errors); } } #pragma warning restore 0168 }
/// <summary> /// Create a new customer from the parameters. If not valid, return null /// </summary> public static Customer Create(CustomerId id, PersonalName name, EmailAddress email) { if (id == null) { return null; } if (name == null) { return null; } if (email == null) { return null; } // Compare this with the F# version, where the domain object // doesn't need to check for nulls return new Customer { Id = id, Name = name, EmailAddress = email }; }
/// <summary> /// Convert a DbCustomer into a domain Customer /// </summary> public static Customer FromDbCustomer(DbCustomer sqlCustomer) { if (sqlCustomer == null) { return(null); } var id = CustomerId.Create(sqlCustomer.Id); var name = PersonalName.Create(sqlCustomer.FirstName, sqlCustomer.LastName); var email = EmailAddress.Create(sqlCustomer.Email); var cust = Customer.Create(id, name, email); return(cust); }
/// <summary> /// Create a domain customer from a DTO or null if not valid. /// </summary> public static Customer DtoToCustomer(CustomerDto dto) { if (dto == null) { // dto can be null if deserialization fails return(null); } var id = CustomerId.Create(dto.Id); var name = PersonalName.Create(dto.FirstName, dto.LastName); var email = EmailAddress.Create(dto.Email); var cust = Customer.Create(id, name, email); return(cust); }
/// <summary> /// Create a new customer from the parameters. If not valid, return null /// </summary> public static Customer Create(CustomerId id, PersonalName name, EmailAddress email) { if (id == null) { return(null); } if (name == null) { return(null); } if (email == null) { return(null); } // Compare this with the F# version, where the domain object // doesn't need to check for nulls return(new Customer(id, name, email)); }
private static void Main(string[] args) { using (var ctx = new MyContext()) { ctx.Database.Delete(); var roger = new Person( PersonalName.Of("Roger"), Address.Of("Stora mellösa", "Linfrövägen 12", "T", "Sverige") ); ctx.Persons.Add(roger); roger.Relocate(Address.Of("Foo", "Bar", "X", "Sverige")); roger.Rename(PersonalName.Of("FooBar")); ctx.SaveChanges(); } using (var ctx = new MyContext()) { Person p = ctx.Persons.First(); } }
public Contact( PersonalName personalName, ContactInfo contactInfo ) {
public async void Example() { #pragma warning disable 0168 using (Client client = GetClient()) { Card card = new Card(); card.CardNumber = "4567350000427977"; card.CardholderName = "Wile E. Coyote"; card.Cvv = "123"; card.ExpiryDate = "1220"; RedirectionData redirectionData = new RedirectionData(); redirectionData.ReturnUrl = "https://hostname.myownwebsite.url"; ThreeDSecure threeDSecure = new ThreeDSecure(); threeDSecure.AuthenticationFlow = "browser"; threeDSecure.ChallengeCanvasSize = "600x400"; threeDSecure.ChallengeIndicator = "challenge-requested"; threeDSecure.ExemptionRequest = "none"; threeDSecure.RedirectionData = redirectionData; threeDSecure.SkipAuthentication = false; CardPaymentMethodSpecificInput cardPaymentMethodSpecificInput = new CardPaymentMethodSpecificInput(); cardPaymentMethodSpecificInput.Card = card; cardPaymentMethodSpecificInput.IsRecurring = false; cardPaymentMethodSpecificInput.MerchantInitiatedReasonIndicator = "delayedCharges"; cardPaymentMethodSpecificInput.PaymentProductId = 1; cardPaymentMethodSpecificInput.ThreeDSecure = threeDSecure; cardPaymentMethodSpecificInput.TransactionChannel = "ECOMMERCE"; AmountOfMoney amountOfMoney = new AmountOfMoney(); amountOfMoney.Amount = 2980L; amountOfMoney.CurrencyCode = "EUR"; Address billingAddress = new Address(); billingAddress.AdditionalInfo = "b"; billingAddress.City = "Monument Valley"; billingAddress.CountryCode = "US"; billingAddress.HouseNumber = "13"; billingAddress.State = "Utah"; billingAddress.Street = "Desertroad"; billingAddress.Zip = "84536"; CompanyInformation companyInformation = new CompanyInformation(); companyInformation.Name = "Acme Labs"; companyInformation.VatNumber = "1234AB5678CD"; ContactDetails contactDetails = new ContactDetails(); contactDetails.EmailAddress = "*****@*****.**"; contactDetails.FaxNumber = "+1234567891"; contactDetails.PhoneNumber = "+1234567890"; BrowserData browserData = new BrowserData(); browserData.ColorDepth = 24; browserData.JavaEnabled = false; browserData.ScreenHeight = "1200"; browserData.ScreenWidth = "1920"; CustomerDevice device = new CustomerDevice(); device.AcceptHeader = "texthtml,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"; device.BrowserData = browserData; device.IpAddress = "123.123.123.123"; device.Locale = "en-US"; device.TimezoneOffsetUtcMinutes = "420"; device.UserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15"; PersonalName name = new PersonalName(); name.FirstName = "Wile"; name.Surname = "Coyote"; name.SurnamePrefix = "E."; name.Title = "Mr."; PersonalInformation personalInformation = new PersonalInformation(); personalInformation.DateOfBirth = "19490917"; personalInformation.Gender = "male"; personalInformation.Name = name; Customer customer = new Customer(); customer.AccountType = "none"; customer.BillingAddress = billingAddress; customer.CompanyInformation = companyInformation; customer.ContactDetails = contactDetails; customer.Device = device; customer.Locale = "en_US"; customer.MerchantCustomerId = "1234"; customer.PersonalInformation = personalInformation; OrderInvoiceData invoiceData = new OrderInvoiceData(); invoiceData.InvoiceDate = "20140306191500"; invoiceData.InvoiceNumber = "000000123"; OrderReferences references = new OrderReferences(); references.Descriptor = "Fast and Furry-ous"; references.InvoiceData = invoiceData; references.MerchantOrderId = 123456L; references.MerchantReference = "AcmeOrder0001"; PersonalName shippingName = new PersonalName(); shippingName.FirstName = "Road"; shippingName.Surname = "Runner"; shippingName.Title = "Miss"; AddressPersonal address = new AddressPersonal(); address.AdditionalInfo = "Suite II"; address.City = "Monument Valley"; address.CountryCode = "US"; address.HouseNumber = "1"; address.Name = shippingName; address.State = "Utah"; address.Street = "Desertroad"; address.Zip = "84536"; Shipping shipping = new Shipping(); shipping.Address = address; IList <LineItem> items = new List <LineItem>(); AmountOfMoney item1AmountOfMoney = new AmountOfMoney(); item1AmountOfMoney.Amount = 2500L; item1AmountOfMoney.CurrencyCode = "EUR"; LineItemInvoiceData item1InvoiceData = new LineItemInvoiceData(); item1InvoiceData.Description = "ACME Super Outfit"; item1InvoiceData.NrOfItems = "1"; item1InvoiceData.PricePerItem = 2500L; LineItem item1 = new LineItem(); item1.AmountOfMoney = item1AmountOfMoney; item1.InvoiceData = item1InvoiceData; items.Add(item1); AmountOfMoney item2AmountOfMoney = new AmountOfMoney(); item2AmountOfMoney.Amount = 480L; item2AmountOfMoney.CurrencyCode = "EUR"; LineItemInvoiceData item2InvoiceData = new LineItemInvoiceData(); item2InvoiceData.Description = "Aspirin"; item2InvoiceData.NrOfItems = "12"; item2InvoiceData.PricePerItem = 40L; LineItem item2 = new LineItem(); item2.AmountOfMoney = item2AmountOfMoney; item2.InvoiceData = item2InvoiceData; items.Add(item2); ShoppingCart shoppingCart = new ShoppingCart(); shoppingCart.Items = items; Order order = new Order(); order.AmountOfMoney = amountOfMoney; order.Customer = customer; order.References = references; order.Shipping = shipping; order.ShoppingCart = shoppingCart; CreatePaymentRequest body = new CreatePaymentRequest(); body.CardPaymentMethodSpecificInput = cardPaymentMethodSpecificInput; body.Order = order; try { CreatePaymentResponse response = await client.Merchant("merchantId").Payments().Create(body); } catch (DeclinedPaymentException e) { HandleDeclinedPayment(e.CreatePaymentResult); } catch (ApiException e) { HandleApiErrors(e.Errors); } } #pragma warning restore 0168 }
public RegularStudent(PersonalName name) : base(name) { }
// private constructor to force use of static private Customer(CustomerId id, PersonalName name, EmailAddress email) { Id = id; Name = name; EmailAddress = email; }
public ContactCreated(PersonalName name) { Name = name; }
public RenameContact(Guid id, int originalVersion, PersonalName name) : base(id, originalVersion) =>
public ExchangeStudent(PersonalName name) : base(name) { }
public async void Example() { #pragma warning disable 0168 using (Client client = GetClient()) { Card card = new Card(); card.CardNumber = "4567350000427977"; card.CardholderName = "Wile E. Coyote"; card.Cvv = "123"; card.ExpiryDate = "1220"; CardPaymentMethodSpecificInput cardPaymentMethodSpecificInput = new CardPaymentMethodSpecificInput(); cardPaymentMethodSpecificInput.Card = card; cardPaymentMethodSpecificInput.PaymentProductId = 1; cardPaymentMethodSpecificInput.SkipAuthentication = false; AmountOfMoney amountOfMoney = new AmountOfMoney(); amountOfMoney.Amount = 2980L; amountOfMoney.CurrencyCode = "EUR"; Address billingAddress = new Address(); billingAddress.AdditionalInfo = "b"; billingAddress.City = "Monument Valley"; billingAddress.CountryCode = "US"; billingAddress.HouseNumber = "13"; billingAddress.State = "Utah"; billingAddress.Street = "Desertroad"; billingAddress.Zip = "84536"; CompanyInformation companyInformation = new CompanyInformation(); companyInformation.Name = "Acme Labs"; ContactDetails contactDetails = new ContactDetails(); contactDetails.EmailAddress = "*****@*****.**"; contactDetails.EmailMessageType = "html"; contactDetails.FaxNumber = "+1234567891"; contactDetails.PhoneNumber = "+1234567890"; PersonalName name = new PersonalName(); name.FirstName = "Wile"; name.Surname = "Coyote"; name.SurnamePrefix = "E."; name.Title = "Mr."; PersonalInformation personalInformation = new PersonalInformation(); personalInformation.DateOfBirth = "19490917"; personalInformation.Gender = "male"; personalInformation.Name = name; PersonalName shippingName = new PersonalName(); shippingName.FirstName = "Road"; shippingName.Surname = "Runner"; shippingName.Title = "Miss"; AddressPersonal shippingAddress = new AddressPersonal(); shippingAddress.AdditionalInfo = "Suite II"; shippingAddress.City = "Monument Valley"; shippingAddress.CountryCode = "US"; shippingAddress.HouseNumber = "1"; shippingAddress.Name = shippingName; shippingAddress.State = "Utah"; shippingAddress.Street = "Desertroad"; shippingAddress.Zip = "84536"; Customer customer = new Customer(); customer.BillingAddress = billingAddress; customer.CompanyInformation = companyInformation; customer.ContactDetails = contactDetails; customer.Locale = "en_US"; customer.MerchantCustomerId = "1234"; customer.PersonalInformation = personalInformation; customer.ShippingAddress = shippingAddress; customer.VatNumber = "1234AB5678CD"; OrderInvoiceData invoiceData = new OrderInvoiceData(); invoiceData.InvoiceDate = "20140306191500"; invoiceData.InvoiceNumber = "000000123"; OrderReferences references = new OrderReferences(); references.Descriptor = "Fast and Furry-ous"; references.InvoiceData = invoiceData; references.MerchantOrderId = 123456L; references.MerchantReference = "AcmeOrder0001"; IList <LineItem> items = new List <LineItem>(); AmountOfMoney item1AmountOfMoney = new AmountOfMoney(); item1AmountOfMoney.Amount = 2500L; item1AmountOfMoney.CurrencyCode = "EUR"; LineItemInvoiceData item1InvoiceData = new LineItemInvoiceData(); item1InvoiceData.Description = "ACME Super Outfit"; item1InvoiceData.NrOfItems = "1"; item1InvoiceData.PricePerItem = 2500L; LineItem item1 = new LineItem(); item1.AmountOfMoney = item1AmountOfMoney; item1.InvoiceData = item1InvoiceData; items.Add(item1); AmountOfMoney item2AmountOfMoney = new AmountOfMoney(); item2AmountOfMoney.Amount = 480L; item2AmountOfMoney.CurrencyCode = "EUR"; LineItemInvoiceData item2InvoiceData = new LineItemInvoiceData(); item2InvoiceData.Description = "Aspirin"; item2InvoiceData.NrOfItems = "12"; item2InvoiceData.PricePerItem = 40L; LineItem item2 = new LineItem(); item2.AmountOfMoney = item2AmountOfMoney; item2.InvoiceData = item2InvoiceData; items.Add(item2); ShoppingCart shoppingCart = new ShoppingCart(); shoppingCart.Items = items; Order order = new Order(); order.AmountOfMoney = amountOfMoney; order.Customer = customer; order.References = references; order.ShoppingCart = shoppingCart; CreatePaymentRequest body = new CreatePaymentRequest(); body.CardPaymentMethodSpecificInput = cardPaymentMethodSpecificInput; body.Order = order; try { CreatePaymentResponse response = await client.Merchant("merchantId").Payments().Create(body); } catch (DeclinedPaymentException e) { HandleDeclinedPayment(e.CreatePaymentResult); } catch (ApiException e) { HandleApiErrors(e.Errors); } } #pragma warning restore 0168 }
public ContactRenamed(PersonalName name) { Name = name; }
public Person(PersonalName personalName, Age age) { this.Age = age ?? throw new ArgumentNullException(nameof(age)); this.PersonalName = personalName ?? throw new ArgumentNullException(nameof(personalName)); }
public async void Example() { #pragma warning disable 0168 using (Client client = GetClient()) { AmountOfMoney amountOfMoney = new AmountOfMoney(); amountOfMoney.Amount = 2345L; amountOfMoney.CurrencyCode = "EUR"; BankAccountIban bankAccountIban = new BankAccountIban(); bankAccountIban.AccountHolderName = "Wile E. Coyote"; bankAccountIban.Iban = "IT60X0542811101000000123456"; Address address = new Address(); address.City = "Burbank"; address.CountryCode = "US"; address.HouseNumber = "411"; address.State = "California"; address.Street = "N Hollywood Way"; address.Zip = "91505"; CompanyInformation companyInformation = new CompanyInformation(); companyInformation.Name = "Acme Labs"; ContactDetailsBase contactDetails = new ContactDetailsBase(); contactDetails.EmailAddress = "*****@*****.**"; PersonalName name = new PersonalName(); name.FirstName = "Wile"; name.Surname = "Coyote"; name.SurnamePrefix = "E."; name.Title = "Mr."; PayoutCustomer customer = new PayoutCustomer(); customer.Address = address; customer.CompanyInformation = companyInformation; customer.ContactDetails = contactDetails; customer.Name = name; BankTransferPayoutMethodSpecificInput bankTransferPayoutMethodSpecificInput = new BankTransferPayoutMethodSpecificInput(); bankTransferPayoutMethodSpecificInput.BankAccountIban = bankAccountIban; bankTransferPayoutMethodSpecificInput.Customer = customer; bankTransferPayoutMethodSpecificInput.PayoutDate = "20150102"; bankTransferPayoutMethodSpecificInput.PayoutText = "Payout Acme"; bankTransferPayoutMethodSpecificInput.SwiftCode = "swift"; PayoutReferences references = new PayoutReferences(); references.MerchantReference = "AcmeOrder001"; CreatePayoutRequest body = new CreatePayoutRequest(); body.AmountOfMoney = amountOfMoney; body.BankTransferPayoutMethodSpecificInput = bankTransferPayoutMethodSpecificInput; body.References = references; try { PayoutResponse response = await client.Merchant("merchantId").Payouts().Create(body); } catch (DeclinedPayoutException e) { HandleDeclinedPayout(e.PayoutResult); } catch (ApiException e) { HandleApiErrors(e.Errors); } } #pragma warning restore 0168 }
public CreateContact(PersonalName name) =>