/** * AUTO_GENERATED */ public SearchInvoicesResponse SearchInvoices(SearchInvoicesRequest searchInvoicesRequest, string apiUserName) { string response = Call("SearchInvoices", searchInvoicesRequest.ToNVPString(""), apiUserName); NVPUtil util = new NVPUtil(); return(SearchInvoicesResponse.CreateInstance(util.ParseNVPString(response), "", -1)); }
public void SearchInvoices() { SearchInvoicesSample sample = new SearchInvoicesSample(); SearchInvoicesResponse searchInvoicesResponse = sample.SearchInvoicesAPIOperation(); Assert.IsNotNull(searchInvoicesResponse); Assert.AreEqual(searchInvoicesResponse.responseEnvelope.ack.ToString().Trim().ToUpper(), "SUCCESS"); }
/// <summary> /// /// </summary> ///<param name="searchInvoicesRequest"></param> ///<param name="credential">An explicit ICredential object that you want to authenticate this call against</param> public SearchInvoicesResponse SearchInvoices(SearchInvoicesRequest searchInvoicesRequest, ICredential credential) { IAPICallPreHandler apiCallPreHandler = new PlatformAPICallPreHandler(this.config, searchInvoicesRequest.ToNVPString(string.Empty), ServiceName, "SearchInvoices", credential); ((PlatformAPICallPreHandler)apiCallPreHandler).SDKName = SDKName; ((PlatformAPICallPreHandler)apiCallPreHandler).SDKVersion = SDKVersion; ((PlatformAPICallPreHandler)apiCallPreHandler).PortName = "Invoice"; NVPUtil util = new NVPUtil(); return(SearchInvoicesResponse.CreateInstance(util.ParseNVPString(Call(apiCallPreHandler)), string.Empty, -1)); }
// # SearchInvoices API Operation // Use the SearchInvoice API operation to search an invoice. public SearchInvoicesResponse SearchInvoicesAPIOperation() { // Create the SearchInvoicesResponse object SearchInvoicesResponse responseSearchInvoices = new SearchInvoicesResponse(); try { // # SearchInvoicesRequest // Use the SearchInvoiceRequest message to search an invoice. // The code for the language in which errors are returned, which must be // en_US. RequestEnvelope envelopeRequest = new RequestEnvelope(); envelopeRequest.errorLanguage = "en_US"; SearchParametersType parameters = new SearchParametersType(); // Invoice amount search. It specifies the smallest amount to be // returned. If you pass a value for this field, you must also pass a // currencyCode value. parameters.upperAmount = Convert.ToDecimal("4.00"); // Currency used for lower and upper amounts. It is required when you // specify lowerAmount or upperAmount. parameters.currencyCode = "USD"; // SearchInvoicesRequest which takes mandatory params: // // * `Request Envelope` - Information common to each API operation, such // as the language in which an error message is returned. // * `Merchant Email` - Email address of invoice creator. // * `SearchParameters` - Parameters constraining the search. // * `Page` - Page number of result set, starting with 1. // * `Page Size` - Number of results per page, between 1 and 100. SearchInvoicesRequest requestSearchInvoices = new SearchInvoicesRequest(envelopeRequest, "*****@*****.**", parameters, Convert.ToInt32("1"), Convert.ToInt32("10")); // Create the service wrapper object to make the API call InvoiceService service = new InvoiceService(); // # API call // Invoke the SearchInvoices method in service responseSearchInvoices = service.SearchInvoices(requestSearchInvoices); if (responseSearchInvoices != null) { // Response envelope acknowledgement string acknowledgement = "SearchInvoices API Operation - "; acknowledgement += responseSearchInvoices.responseEnvelope.ack.ToString(); logger.Info(acknowledgement + "\n"); Console.WriteLine(acknowledgement + "\n"); // # Success values if (responseSearchInvoices.responseEnvelope.ack.ToString().Trim().ToUpper().Equals("SUCCESS")) { // Number of invoices that matched the request. logger.Info("Count : " + responseSearchInvoices.count + "\n"); Console.WriteLine("Count : " + responseSearchInvoices.count + "\n"); } // # Error Values else { List <ErrorData> errorMessages = responseSearchInvoices.error; foreach (ErrorData error in errorMessages) { logger.Debug("API Error Message : " + error.message + "\n"); Console.WriteLine("API Error Message : " + error.message + "\n"); } } } } // # Exception log catch (System.Exception ex) { // Log the exception message logger.Debug("Error Message : " + ex.Message); Console.WriteLine("Error Message : " + ex.Message); } return(responseSearchInvoices); }