/// <summary> /// Create customer in ReePay /// </summary> /// <param name="handle">Customer id, blank for auto generate</param> /// <param name="email"> customer email</param> /// <param name="firstName">custoemer firstname</param> /// <param name="lastname">customer last name</param> /// <param name="address">customer address</param> /// <param name="address2">customer address2</param> /// <param name="city">customer city</param> /// <param name="postalCode">customer postal code</param> /// <param name="country">customer country</param> /// <param name="phone">customer phone</param> /// <param name="company">customer company</param> /// <param name="vat">customer vat</param> /// <returns>statuscode and customer data</returns> public ApiResponse <Customer> CreateCustomer(string handle, string email, string firstName, string lastname, string address, string address2, string city, string postalCode, string country, string phone, string company, string vat) { var myClassname = MethodBase.GetCurrentMethod().Name; var generateHandle = string.IsNullOrEmpty(handle); var config = this.GetDefaultApiConfiguration(); var api = new CustomerApi(config); var newCustomer = new CreateCustomer(email, address, address2, city, country, phone, company, vat, handle, this._reepayTestFlag, firstName, lastname, postalCode, generateHandle); for (var i = 0; i <= MaxNoOfRetries; i++) { try { var apiResponse = api.CreateCustomerJsonWithHttpInfo(newCustomer); return(apiResponse); } catch (ApiException apiException) { this._log.Error($"{myClassname} {apiException.ErrorCode} {apiException.ErrorContent}"); return(new ApiResponse <Customer>(apiException.ErrorCode, null, null)); } catch (Exception) when(i < MaxNoOfRetries) { this._log.Debug($"{myClassname} retry attempt {i}"); } } return(new ApiResponse <Customer>((int)HttpStatusCode.InternalServerError, null, null)); }