public static Result CreateCustomer(string name, string billingInfo) { Result <BillingInfo> billingInfoResult = BillingInfo.Create(billingInfo); Result <CustomerName> customerNameResult = CustomerName.Create(name); return(Result.Combine(billingInfoResult, customerNameResult) .OnSuccess(() => _paymentGateway.ChargeCommission(billingInfoResult.Value)) .OnSuccess(() => new Customer(customerNameResult.Value)) .OnSuccess(customer => _repository.Save(customer) .OnFailure(() => _paymentGateway.RollbackLastTransaction())) .OnSuccess(() => _emailSender.SendGreetings(customerNameResult.Value)) .OnBoth(result => Log(result))); }
public Customer(CustomerName value) { this.value = value; }
internal Result SendGreetings(CustomerName value) { throw new NotImplementedException(); }