public async Task <INativePickupGetServiceCenterFacilitiesResponse> ProcessPickupGetServiceCenterFacilitiesAsync(IPickupGetServiceCenterFacilitiesRequest request, IUPSConfiguration configuration = null) { Pickup.UPSSecurity upsSecurity = configuration != null?SetupAuthentication <Pickup.UPSSecurity>(configuration?.Authentication) : UPSPickupAuthenticationDetail; request.Request = request?.Request ?? new RequestType() { RequestOption = new string[] { "validate" }, TransactionReference = new TransactionReferenceType { CustomerContext = configuration?.Authentication?.CustomerContext ?? Configuration.Authentication.CustomerContext } }; var pickupRequest = BuildRequest <PickupGetServiceCenterFacilitiesRequest, Pickup.PickupGetServiceCenterFacilitiesRequest>((PickupGetServiceCenterFacilitiesRequest)request, PickupMapperConfiguration); //var client = new Pickup.PickupPortTypeClient(); string endPointUrl = AppSetupConfiguration.IsProductionEnvironment ? AppSetupConfiguration?.Urls?.ProductionEndPoint?.PickupServiceUrl : AppSetupConfiguration?.Urls?.TestEndPoint?.PickupServiceUrl; var client = new Pickup.PickupPortTypeClient(endPointUrl, AppSetupConfiguration.TimeOut, AppSetupConfiguration?.UserId, AppSetupConfiguration?.Password); if (AppSetupConfiguration.WriteXmlRequest) { WriteXML(pickupRequest); } var response = await client.ProcessPickupGetServiceCenterFacilitiesAsync(upsSecurity, pickupRequest); if (AppSetupConfiguration.WriteXmlResponse) { WriteXML(response); } var nativeResponse = BuildResponse <Pickup.PickupGetServiceCenterFacilitiesResponse1, NativePickupGetServiceCenterFacilitiesResponse>(response, PickupMapperConfiguration); nativeResponse.Message = nativeResponse.IsSuccessful ? MessageConfiguration.SuccessfulGetServiceCenterFacilities : MessageConfiguration.FailedGetServiceCenterFacilities; return(nativeResponse); }
public async Task <INativePickupCreationResponse> ProcessPickupCreationAsync(IPickupCreationRequest request, IUPSConfiguration configuration = null) { Pickup.UPSSecurity upsSecurity = configuration != null?SetupAuthentication <Pickup.UPSSecurity>(configuration?.Authentication) : UPSPickupAuthenticationDetail; request.Request = request?.Request ?? new RequestType() { RequestOption = new string[] { "Pickup" }, TransactionReference = new TransactionReferenceType { CustomerContext = configuration?.Authentication?.CustomerContext ?? Configuration.Authentication.CustomerContext } }; var pickupRequest = BuildRequest <PickupCreationRequest, Pickup.PickupCreationRequest>((PickupCreationRequest)request, PickupMapperConfiguration); //var client = new Pickup.PickupPortTypeClient(); string endPointUrl = AppSetupConfiguration.IsProductionEnvironment ? AppSetupConfiguration?.Urls?.ProductionEndPoint?.PickupServiceUrl : AppSetupConfiguration?.Urls?.TestEndPoint?.PickupServiceUrl; var client = new Pickup.PickupPortTypeClient(endPointUrl, AppSetupConfiguration.TimeOut, AppSetupConfiguration?.UserId, AppSetupConfiguration?.Password); if (AppSetupConfiguration.WriteXmlRequest) { WriteXML(pickupRequest); } //var xsdFiles = new Dictionary<string, string>(); //xsdFiles.Add(@"E:\POC\UPS\Pickup\PickupforPACKAGEWebService\SCHEMAS-WSDLs\PickupWebServiceSchema.xsd", "http://www.ups.com/XMLSchema/XOLTWS/Pickup/v1.1"); //xsdFiles.Add(@"E:\POC\UPS\Pickup\PickupforPACKAGEWebService\SCHEMAS-WSDLs\common.xsd", "http://www.ups.com/XMLSchema/XOLTWS/Common/v1.0"); //xsdFiles.Add(@"E:\POC\UPS\Pickup\PickupforPACKAGEWebService\SCHEMAS-WSDLs\Error1.1.xsd", "http://www.ups.com/XMLSchema/XOLTWS/Error/v1.1"); //xsdFiles.Add(@"E:\POC\UPS\Pickup\PickupforPACKAGEWebService\SCHEMAS-WSDLs\UPSSecurity.xsd", "http://www.ups.com/XMLSchema/XOLTWS/UPSS/v1.0"); //var isValid = Validate(pickupRequest, xsdFiles, out string errorMessage); //if (!isValid) // throw new System.Exception(errorMessage); var response = await client.ProcessPickupCreationAsync(upsSecurity, pickupRequest); if (Configuration.AppSetupConfiguration.WriteXmlResponse) { WriteXML(response); } var nativeResponse = BuildResponse <Pickup.PickupCreationResponse1, NativePickupCreationResponse>(response, PickupMapperConfiguration); nativeResponse.Message = nativeResponse.IsSuccessful ? string.Format(MessageConfiguration.SuccessfulPickupCreation, nativeResponse?.PickupConfirmationNumber) : string.Format(MessageConfiguration.FailedPickupCreation); return(nativeResponse); }