Ejemplo n.º 1
0
        /// <summary>
        /// Example: Ordering a service. Example of ordring credit from Credco.
        /// </summary>
        private static void OrderService()
        {
            if (_accessToken == null)
            {
                Authenticate();
            }
            var serviceApiClient = ApiClientProvider.GetApiClient <ServiceApi>(_accessToken);

            Console.Write("Enter Credco User Name  : ");
            var userName = Console.ReadLine();

            Console.Write("Enter Credco Password   : "******"Enter Borrower Id       : ");
            var borrowerId = Console.ReadLine();

            //Ordering credit from credco
            var request = new OrderServiceRequest
            {
                Product = new Product
                {
                    Credentials = new ProductCredentials
                    {
                        UserName = userName,
                        Password = password
                    },
                    EntityRef = new ProductEntityRef
                    {
                        EntityId   = $"{LoanId}#{borrowerId}",
                        EntityType = "urn:elli:encompass:loan:borrower"
                    },
                    Name    = "CREDITIQ",
                    Options = new ProductOptions
                    {
                        DigiCert               = true,
                        CreditBureauEquifax    = true,
                        CreditBureauExperian   = true,
                        CreditBureauTransUnion = true,
                        CreditReportIdentifier = "",
                        Note        = "",
                        ReportOn    = "Joint",
                        ReportType  = "Merge",
                        RequestType = "NewOrder"
                    },
                    Preferences = new ProductPreferences
                    {
                        ExcludeZeroforImportLiabilities = true,
                        ImportLiabilities = true
                    }
                }
            };

            //Partner ID for credco is 307378
            var resp = serviceApiClient.OrderServiceWithHttpInfo(307378, request);

            //Example Getting ID from location header
            _transactionId = resp.Headers["Location"].Split('/')[6];
            Console.WriteLine($"Transaction ID: {_transactionId}");
        }
        /// <summary>
        /// Order Service. Submits an order for a service and creates a transaction object. The response header includes the transactionId that is used to retrieve the results from the service provider.
        /// </summary>
        /// <exception cref="Elli.Api.Services.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="partnerId">Ellie Mae&#39;s Partner ID for the service provider. Partner IDs are listed on the Credit Partners and Samples page.</param>
        /// <param name="product">The product data elements. Product attributes are listed on the Credit Partners and Samples page.</param>
        /// <returns>Task of ApiResponse (Response)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <Response> > OrderServiceAsyncWithHttpInfo(int?partnerId, OrderServiceRequest product)
        {
            // verify the required parameter 'partnerId' is set
            if (partnerId == null)
            {
                throw new ApiException(400, "Missing required parameter 'partnerId' when calling ServiceApi->OrderService");
            }
            // verify the required parameter 'product' is set
            if (product == null)
            {
                throw new ApiException(400, "Missing required parameter 'product' when calling ServiceApi->OrderService");
            }

            var    localVarPath         = "/services/v1/partners/{partnerId}/transactions";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new Dictionary <String, String>();
            var    localVarHeaderParams = new Dictionary <String, String>(Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            if (partnerId != null)
            {
                localVarPathParams.Add("partnerId", Configuration.ApiClient.ParameterToString(partnerId));                    // path parameter
            }
            if (product != null && product.GetType() != typeof(byte[]))
            {
                localVarPostBody = Configuration.ApiClient.Serialize(product); // http body (model) parameter
            }
            else
            {
                localVarPostBody = product; // byte array
            }

            // authentication (bearerAuth) required
            // oauth required
            if (!String.IsNullOrEmpty(Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken;
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath,
                                                                                                       Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                                       localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("OrderService", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <Response>(localVarStatusCode,
                                              localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                              (Response)Configuration.ApiClient.Deserialize(localVarResponse, typeof(Response))));
        }
        /// <summary>
        /// Order Service. Submits an order for a service and creates a transaction object. The response header includes the transactionId that is used to retrieve the results from the service provider.
        /// </summary>
        /// <exception cref="Elli.Api.Services.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="partnerId">Ellie Mae&#39;s Partner ID for the service provider. Partner IDs are listed on the Credit Partners and Samples page.</param>
        /// <param name="product">The product data elements. Product attributes are listed on the Credit Partners and Samples page.</param>
        /// <returns>Task of Response</returns>
        public async System.Threading.Tasks.Task <Response> OrderServiceAsync(int?partnerId, OrderServiceRequest product)
        {
            ApiResponse <Response> localVarResponse = await OrderServiceAsyncWithHttpInfo(partnerId, product);

            return(localVarResponse.Data);
        }
        /// <summary>
        /// Order Service. Submits an order for a service and creates a transaction object. The response header includes the transactionId that is used to retrieve the results from the service provider.
        /// </summary>
        /// <exception cref="Elli.Api.Services.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="partnerId">Ellie Mae&#39;s Partner ID for the service provider. Partner IDs are listed on the Credit Partners and Samples page.</param>
        /// <param name="product">The product data elements. Product attributes are listed on the Credit Partners and Samples page.</param>
        /// <returns>Response</returns>
        public Response OrderService(int?partnerId, OrderServiceRequest product)
        {
            ApiResponse <Response> localVarResponse = OrderServiceWithHttpInfo(partnerId, product);

            return(localVarResponse.Data);
        }
 /// <summary>
 /// Order Service. Submits an order for a service and creates a transaction object. The response header includes the transactionId that is used to retrieve the results from the service provider.
 /// </summary>
 /// <exception cref="Elli.Api.Services.Client.ApiException">Thrown when fails to make API call</exception>
 /// <param name="partnerId">Ellie Mae&#39;s Partner ID for the service provider. Partner IDs are listed on the Credit Partners and Samples page.</param>
 /// <param name="product">The product data elements that comprise of the transactions request object. Encapsulates information about the loan in whose context the service is being placed, product name, product options/configurations, service credentials to authenticate with the service provider and user preferences.</param>
 /// <returns>Task of void</returns>
 public async System.Threading.Tasks.Task OrderServiceAsync(int?partnerId, OrderServiceRequest product)
 {
     await OrderServiceAsyncWithHttpInfo(partnerId, product);
 }
 /// <summary>
 /// Order Service. Submits an order for a service and creates a transaction object. The response header includes the transactionId that is used to retrieve the results from the service provider.
 /// </summary>
 /// <exception cref="Elli.Api.Services.Client.ApiException">Thrown when fails to make API call</exception>
 /// <param name="partnerId">Ellie Mae&#39;s Partner ID for the service provider. Partner IDs are listed on the Credit Partners and Samples page.</param>
 /// <param name="product">The product data elements that comprise of the transactions request object. Encapsulates information about the loan in whose context the service is being placed, product name, product options/configurations, service credentials to authenticate with the service provider and user preferences.</param>
 /// <returns></returns>
 public void OrderService(int?partnerId, OrderServiceRequest product)
 {
     OrderServiceWithHttpInfo(partnerId, product);
 }