/// <summary> /// Validates the account activation request. /// </summary> /// <param name="request">The data service request.</param> /// <returns>The data service response.</returns> private ValidateAccountActivationDataResponse ValidateAccountActivation(ValidateAccountActivationDataRequest request) { CustomerSqlServerDatabaseAccessor databaseAccessor = this.GetSqlDatabaseAccessorInstance(request.RequestContext); bool isValid = databaseAccessor.ValidateAccountActivationRequest(request.Email, request.ActivationToken); return(new ValidateAccountActivationDataResponse(isValid)); }
/// <summary> /// Gets the customer by account number. /// </summary> /// <param name="request">The data service request.</param> /// <returns>The data service response.</returns> private SingleEntityDataServiceResponse <Customer> GetCustomerByAccountNumber(GetCustomerDataRequest request) { CustomerSqlServerDatabaseAccessor databaseAccessor = this.GetSqlDatabaseAccessorInstance(request.RequestContext); Customer customer = databaseAccessor.GetCustomerByAccountNumber(request.AccountNumber); return(new SingleEntityDataServiceResponse <Customer>(customer)); }
private NullResponse UnlinkFromExistingCustomerDataRequest(UnlinkFromExistingCustomerDataRequest request) { CustomerSqlServerDatabaseAccessor databaseAccessor = this.GetSqlDatabaseAccessorInstance(request.RequestContext); databaseAccessor.UnlinkExternalIdentityFromCustomer(request.ExternalIdentityId, request.ExternalIdentityIssuer, request.CustomerId); this.UpdateCustomerExternalIdentityMapCache(request.RequestContext, request.ExternalIdentityId, request.ExternalIdentityIssuer); return(new NullResponse()); }
/// <summary> /// Saves the customer account activation request to channel DB. /// </summary> /// <param name="request">The data service request.</param> /// <returns>The data service response.</returns> private SingleEntityDataServiceResponse <LinkToExistingCustomerResult> InitiateLinkToExistingCustomer(InitiateLinkToExistingCustomerDataRequest request) { CustomerSqlServerDatabaseAccessor databaseAccessor = this.GetSqlDatabaseAccessorInstance(request.RequestContext); LinkToExistingCustomerResult result = databaseAccessor.InitiateLinkToExistingCustomer(request.EmailAddress, request.ActivationToken, request.ExternalIdentityId, request.ExternalIdentityIssuer, request.CustomerId); this.UpdateCustomerExternalIdentityMapCache(request.RequestContext, result.ExternalIdentityId, result.ExternalIdentityProvider); return(new SingleEntityDataServiceResponse <LinkToExistingCustomerResult>(result)); }
/// <summary> /// Creates or updates a customer. /// </summary> /// <param name="request">The data service request.</param> /// <returns>The data service response.</returns> private SingleEntityDataServiceResponse <Customer> CreateOrUpdateCustomer(CreateOrUpdateCustomerDataRequest request) { CustomerSqlServerDatabaseAccessor databaseAccessor = this.GetSqlDatabaseAccessorInstance(request.RequestContext); Customer customer; if (request.Customer.IsAsyncCustomer) { // Create the async customer (for offline) customer = databaseAccessor.CreateOrUpdateAsyncCustomer(request.Customer); } else { // Create the customer customer = databaseAccessor.CreateOrUpdateCustomer(request.Customer); } return(new SingleEntityDataServiceResponse <Customer>(customer)); }
/// <summary> /// Creates or updates a customer address. /// </summary> /// <param name="request">The data service request.</param> /// <returns>The data service response.</returns> private SingleEntityDataServiceResponse <Address> CreateOrUpdateAsyncCustomerAddress(CreateOrUpdateAsyncCustomerAddressDataRequest request) { CustomerSqlServerDatabaseAccessor databaseAccessor = this.GetSqlDatabaseAccessorInstance(request.RequestContext); Address address = null; if (request.Customer.IsAsyncCustomer) { // Create the async customer (for offline) address = databaseAccessor.CreateOrUpdateAsyncCustomerAddress(request.Customer, request.Address); } else { // Should never happen... throw new InvalidOperationException("Only addresses of async customers can be updated with this method."); } return(new SingleEntityDataServiceResponse <Address>(address)); }