예제 #1
0
        /// <summary>
        /// Search for invoice resources.
        /// </summary>
        /// <param name="apiContext">APIContext used for the API call.</param>
        /// <param name="search">Search</param>
        /// <returns>Invoices</returns>
        public Invoices Search(APIContext apiContext, Search search)
        {
            if (apiContext == null)
            {
                throw new ArgumentNullException("APIContext cannot be null");
            }
            if (string.IsNullOrEmpty(apiContext.AccessToken))
            {
                throw new ArgumentNullException("AccessToken cannot be null or empty");
            }
            if (apiContext.HTTPHeaders == null)
            {
                apiContext.HTTPHeaders = new Dictionary <string, string>();
            }
            apiContext.HTTPHeaders.Add(BaseConstants.ContentTypeHeader, BaseConstants.ContentTypeHeaderJson);
            apiContext.SdkVersion = new SDKVersionImpl();
            if (search == null)
            {
                throw new ArgumentNullException("search cannot be null");
            }
            object[] parameters   = new object[] { this.id };
            string   pattern      = "v1/invoicing/search";
            string   resourcePath = SDKUtil.FormatURIPath(pattern, parameters);
            string   payLoad      = search.ConvertToJson();

            return(PayPalResource.ConfigureAndExecute <Invoices>(apiContext, HttpMethod.POST, resourcePath, payLoad));
        }
예제 #2
0
        /// <summary>
        /// Search for invoice resources.
        /// </summary>
        /// <param name="apiContext">APIContext used for the API call.</param>
        /// <param name="search">Search</param>
        /// <returns>Invoices</returns>
        public Invoices Search(APIContext apiContext, Search search)
        {
            // Validate the arguments to be used in the request
            ArgumentValidator.ValidateAndSetupAPIContext(apiContext);
            ArgumentValidator.Validate(search, "search");

            // Configure and send the request
            object[] parameters   = new object[] { this.id };
            string   pattern      = "v1/invoicing/search";
            string   resourcePath = SDKUtil.FormatURIPath(pattern, parameters);
            string   payLoad      = search.ConvertToJson();

            return(PayPalResource.ConfigureAndExecute <Invoices>(apiContext, HttpMethod.POST, resourcePath, payLoad));
        }
예제 #3
0
		/// <summary>
		/// Search for invoice resources.
		/// </summary>
		/// <param name="apiContext">APIContext used for the API call.</param>
		/// <param name="search">Search</param>
		/// <returns>Invoices</returns>
		public Invoices Search(APIContext apiContext, Search search)
		{
			if (apiContext == null)
			{
				throw new ArgumentNullException("APIContext cannot be null");
			}
			if (string.IsNullOrEmpty(apiContext.AccessToken))
			{
				throw new ArgumentNullException("AccessToken cannot be null or empty");
			}
			if (apiContext.HTTPHeaders == null)
			{
				apiContext.HTTPHeaders = new Dictionary<string, string>();
			}
			apiContext.HTTPHeaders.Add(BaseConstants.ContentTypeHeader, BaseConstants.ContentTypeHeaderJson);
			apiContext.SdkVersion = new SDKVersionImpl();
			if (search == null)
			{
				throw new ArgumentNullException("search cannot be null");
			}
			object[] parameters = new object[] {this.id};
			string pattern = "v1/invoicing/search";
			string resourcePath = SDKUtil.FormatURIPath(pattern, parameters);
			string payLoad = search.ConvertToJson();
			return PayPalResource.ConfigureAndExecute<Invoices>(apiContext, HttpMethod.POST, resourcePath, payLoad);
		}