public PostCustomerResponse PostCustomer(PostCustomerRequest apcr_request) { PostCustomerResponse lpcr_response; lpcr_response = new PostCustomerResponse(); lpcr_response.status = new Status(); try { ICustomerServiceBusiness licsb_icsb; licsb_icsb = new CustomerServicesBusiness(); lpcr_response = licsb_icsb.PostCustomerRequest(apcr_request); } catch (Exception ae_e) { Exception le_e; le_e = ae_e.InnerException != null ? ae_e.InnerException : ae_e; lpcr_response.status.CodeResp = "01"; lpcr_response.status.MessageResp = ae_e.InnerException != null ? "Error en la ejecucion del servicio" : ae_e.Message; Common.CreateTrace.WriteLog(Common.CreateTrace.LogLevel.Error, "ERROR EN LA CAPA DE SERVICIO CustomerService:PostCustomer"); Common.CreateTrace.WriteLog(Common.CreateTrace.LogLevel.Error, " :: " + le_e.Message); } return(lpcr_response); }
public System.Threading.Tasks.Task <PostCustomerResponse1> PostCustomerAsync(PostCustomerRequest PostCustomerRequest) { PostCustomerRequest1 inValue = new PostCustomerRequest1(); inValue.PostCustomerRequest = PostCustomerRequest; return(((CustomerService)(this)).PostCustomerAsync(inValue)); }
public ResponseModel Post(PostCustomerRequest request) { _service.Create(request.FirstName, request.LastName, request.Age); return(new ResponseModel { StatusCode = HttpStatusCode.Created }); }
public PostCustomerResponse PostCustomer(PostCustomerRequest PostCustomerRequest) { PostCustomerRequest1 inValue = new PostCustomerRequest1(); inValue.PostCustomerRequest = PostCustomerRequest; PostCustomerResponse1 retVal = ((CustomerService)(this)).PostCustomer(inValue); return(retVal.PostCustomerResponse); }
public static TmsV2CustomersResponse Run() { string buyerInformationMerchantCustomerID = "Your customer identifier"; string buyerInformationEmail = "*****@*****.**"; Tmsv2customersBuyerInformation buyerInformation = new Tmsv2customersBuyerInformation( MerchantCustomerID: buyerInformationMerchantCustomerID, Email: buyerInformationEmail ); string clientReferenceInformationCode = "TC50171_3"; Tmsv2customersClientReferenceInformation clientReferenceInformation = new Tmsv2customersClientReferenceInformation( Code: clientReferenceInformationCode ); List <Tmsv2customersMerchantDefinedInformation> merchantDefinedInformation = new List <Tmsv2customersMerchantDefinedInformation>(); string merchantDefinedInformationName1 = "data1"; string merchantDefinedInformationValue1 = "Your customer data"; merchantDefinedInformation.Add(new Tmsv2customersMerchantDefinedInformation( Name: merchantDefinedInformationName1, Value: merchantDefinedInformationValue1 )); var requestObj = new PostCustomerRequest( BuyerInformation: buyerInformation, ClientReferenceInformation: clientReferenceInformation, MerchantDefinedInformation: merchantDefinedInformation ); try { var configDictionary = new Configuration().GetConfiguration(); var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); var apiInstance = new CustomerApi(clientConfig); TmsV2CustomersResponse result = apiInstance.PostCustomer(requestObj); Console.WriteLine(result); return(result); } catch (Exception e) { Console.WriteLine("Exception on calling the API : " + e.Message); return(null); } }
public PostCustomerRequest1(PostCustomerRequest PostCustomerRequest) { this.PostCustomerRequest = PostCustomerRequest; }
PostCustomerResponse ICustomerServiceBusiness.PostCustomerRequest(PostCustomerRequest apcr_request) { PostCustomerResponse lpcr_response; lpcr_response = new PostCustomerResponse(); lpcr_response.status = new Status(); lpcr_response.Customer = new PostCustomer(); try { if (apcr_request != null) { if (apcr_request.Customer != null) { ClientesDTO lc_cliente; lc_cliente = new ClientesDTO(); if (apcr_request.Customer.IdType != null) { if (apcr_request.Customer.IdType.Trim().Length > 0) { lc_cliente.CodTypeIdent = apcr_request.Customer.IdType; } else { throw new Exception("El tipo de identificación es obligatorio"); } } else { throw new Exception("El tipo de identificación es obligatorio"); } if (apcr_request.Customer.IdNumber <= 0) { throw new Exception("Numero de indentificación vacio o no valido"); } else { lc_cliente.CustID = apcr_request.Customer.IdNumber; } if (apcr_request.Customer.FirstName != null) { if (apcr_request.Customer.FirstName.Trim().Length > 0) { lc_cliente.FName = apcr_request.Customer.FirstName; } else { throw new Exception("El nombre del cliente es obligatorio"); } } else { throw new Exception("El nombre del cliente es obligatorio"); } if (apcr_request.Customer.LastNames != null) { if (apcr_request.Customer.LastNames.Trim().Length > 0) { lc_cliente.LName = apcr_request.Customer.LastNames; } else { throw new Exception("El apellido del cliente es obligatorio"); } } else { throw new Exception("El apellido del cliente es obligatorio"); } if (apcr_request.Customer.Email != null) { if (apcr_request.Customer.Email.Trim().Length > 0) { lc_cliente.Email = apcr_request.Customer.Email; } } if (apcr_request.Customer.PhoneNumber != null) { if (apcr_request.Customer.PhoneNumber.Trim().Length > 0) { lc_cliente.PhoneNumber = apcr_request.Customer.PhoneNumber; } } if (apcr_request.Customer.Address != null) { if (apcr_request.Customer.Address.Trim().Length > 0) { lc_cliente.Address = apcr_request.Customer.Address; } else { throw new Exception("La dirección del cliente es obligatoria"); } } else { throw new Exception("La dirección del cliente es obligatoria"); } if (apcr_request.Customer.City != null) { if (apcr_request.Customer.City.Trim().Length > 0) { lc_cliente.City = apcr_request.Customer.City; } else { throw new Exception("La ciudad del cliente es obligatoria"); } } else { throw new Exception("La ciudad del cliente es obligatoria"); } if (apcr_request.Customer.Country != null) { if (apcr_request.Customer.Country.Trim().Length > 0) { lc_cliente.Country = apcr_request.Customer.Country; } else { throw new Exception("El país del cliente es obligatorio"); } } else { throw new Exception("El país del cliente es obligatorio"); } if (apcr_request.Customer.User != null) { if (apcr_request.Customer.User.Trim().Length > 0) { lc_cliente.User = apcr_request.Customer.User; } else { throw new Exception("El username del cliente es obligatorio"); } } else { throw new Exception("El username del cliente es obligatorio"); } if (apcr_request.Customer.Password != null) { if (apcr_request.Customer.Password.Trim().Length > 0) { lc_cliente.Password = apcr_request.Customer.Password; } else { throw new Exception("El password del cliente es obligatorio"); } } else { throw new Exception("El password del cliente es obligatorio"); } if (apcr_request.Customer.CreditCard != null) { CreditCardDTO lcc_creditCard; DateTime ldt_fechaVencimiento; lcc_creditCard = new CreditCardDTO(); ldt_fechaVencimiento = new DateTime(); lc_cliente.LCreditCard = new List <CreditCardDTO>(); if (apcr_request.Customer.CreditCard.Type != null) { if (apcr_request.Customer.CreditCard.Type.Trim().Length > 0) { lcc_creditCard.Type = apcr_request.Customer.CreditCard.Type; } else { throw new Exception("El tipo de tarjeta de credito es obligatorio"); } } else { throw new Exception("El tipo de tarjeta de credito es obligatorio"); } if (apcr_request.Customer.CreditCard.Number != null) { if (apcr_request.Customer.CreditCard.Number.Trim().Length > 0) { lcc_creditCard.Number = apcr_request.Customer.CreditCard.Number; } else { throw new Exception("El numero de tarjeta de credito es obligatorio"); } } else { throw new Exception("El numero de tarjeta de credito es obligatorio"); } if (apcr_request.Customer.CreditCard.CardName != null) { if (apcr_request.Customer.CreditCard.CardName.Trim().Length > 0) { lcc_creditCard.CardName = apcr_request.Customer.CreditCard.CardName; } else { throw new Exception("El nombre en la tarjeta de credito es obligatorio"); } } else { throw new Exception("El nombre en la tarjeta de credito es obligatorio"); } if (apcr_request.Customer.CreditCard.ExpirationDate == null) { throw new Exception("La fecha de vencimiento en la tarjeta de credito es obligatorio"); } else if (!DateTime.TryParseExact("01" + apcr_request.Customer.CreditCard.ExpirationDate.ToString(), "ddMMyyyy", null, System.Globalization.DateTimeStyles.None, out ldt_fechaVencimiento)) { throw new Exception("La fecha de vencimiento en la tarjeta de credito es obligatorio"); } else { lcc_creditCard.ExpirationDate = apcr_request.Customer.CreditCard.ExpirationDate; } if (apcr_request.Customer.CreditCard.SecurityCode != null) { if (apcr_request.Customer.CreditCard.SecurityCode.Trim().Length > 0) { lcc_creditCard.SecurityCode = apcr_request.Customer.CreditCard.SecurityCode; } else { throw new Exception("El codigo de seguridad en la tarjeta de credito es obligatorio"); } } else { throw new Exception("El codigo de seguridad en la tarjeta de credito es obligatorio"); } lc_cliente.LCreditCard.Add(lcc_creditCard); } ClientesDAL lcd_clientesDAL; lcd_clientesDAL = new ClientesDAL(); long IDUser; IDUser = lcd_clientesDAL.InsertarCliente(lc_cliente); if (IDUser != 0) { lpcr_response.Customer.IdUser = IDUser; lpcr_response.status.CodeResp = "0"; lpcr_response.status.MessageResp = ""; } else { lpcr_response.status.CodeResp = "01"; lpcr_response.status.MessageResp = "Error ingresando datos"; } } else { throw new Exception("Parametros de entrada vacios"); } } else { throw new Exception("Parametros de entrada vacios"); } } catch (Exception ae_e) { Exception le_e; le_e = ae_e.InnerException != null ? ae_e.InnerException : ae_e; lpcr_response.status.CodeResp = "01"; lpcr_response.status.MessageResp = ae_e.InnerException != null ? "Error en la ejecucion del servicio" : ae_e.Message; Common.CreateTrace.WriteLog(Common.CreateTrace.LogLevel.Error, "ERROR EN LA CAPA DE NEGOCIO OrderService:GetOrder"); Common.CreateTrace.WriteLog(Common.CreateTrace.LogLevel.Error, " :: " + le_e.Message); throw le_e; } return(lpcr_response); }