Esempio n. 1
0
        /// <summary>
        /// Full update of the invoice resource for the given identifier.
        /// </summary>
        /// <param name="apiContext">APIContext used for the API call.</param>
        /// <param name="invoice">Invoice object to update.</param>
        /// <param name="notifyMerchant">Specifies if the invoice update notification is needed for merchant</param>
        /// <returns>Invoice</returns>
        public static Invoice Update(APIContext apiContext, Invoice invoice, bool notifyMerchant = true)
        {
            // Validate the arguments to be used in the request
            ArgumentValidator.ValidateAndSetupAPIContext(apiContext);
            ArgumentValidator.Validate(invoice, "invoice");

            var queryParameters = new QueryParameters();

            queryParameters["notify_merchant"] = notifyMerchant.ToString();

            // Configure and send the request
            var pattern      = "v1/invoicing/invoices/{0}";
            var resourcePath = SDKUtil.FormatURIPath(pattern, new object[] { invoice.id }) + queryParameters.ToUrlFormattedString();

            return(PayPalResource.ConfigureAndExecute <Invoice>(apiContext, HttpMethod.PUT, resourcePath, invoice.ConvertToJson()));
        }
Esempio n. 2
0
        /// <summary>
        /// Full update of the invoice resource for the given identifier.
        /// </summary>
        /// <param name="apiContext">APIContext used for the API call.</param>
        /// <param name="invoice">Invoice object to update.</param>
        /// <param name="notifyMerchant">Specifies if the invoice update notification is needed for merchant</param>
        /// <returns>Invoice</returns>
        public static Invoice Update(APIContext apiContext, Invoice invoice, bool notifyMerchant = true)
        {
            // Validate the arguments to be used in the request
            ArgumentValidator.ValidateAndSetupAPIContext(apiContext);
            ArgumentValidator.Validate(invoice, "invoice");

            var queryParameters = new QueryParameters();
            queryParameters["notify_merchant"] = notifyMerchant.ToString();

            // Configure and send the request
            var pattern = "v1/invoicing/invoices/{0}";
            var resourcePath = SDKUtil.FormatURIPath(pattern, new object[] { invoice.id }) + queryParameters.ToUrlFormattedString();
            return PayPalResource.ConfigureAndExecute<Invoice>(apiContext, HttpMethod.PUT, resourcePath, invoice.ConvertToJson());
        }
Esempio n. 3
0
        /// <summary>
        /// Creates a draft invoice. You can optionally create an invoice [template](/docs/api/invoicing/#templates). Then, when you create an invoice from a template, the invoice is populated with the predefined data that the source template contains. To move the invoice from a draft to payable state, you must [send the invoice](/docs/api/invoicing/#invoices_send). In the JSON request body, include invoice details including merchant information. The `invoice` object must include an `items` array.<blockquote><strong>Note:</strong> The merchant specified in an invoice must have a PayPal account in good standing.</blockquote>
        /// </summary>
        /// <param name="apiContext">APIContext used for the API call.</param>
        /// <param name="invoice">Invoice object to be used for creating the PayPal resource.</param>
        /// <returns>Invoice</returns>
        public static Invoice Create(APIContext apiContext, Invoice invoice)
        {
            // Validate the arguments to be used in the request
            ArgumentValidator.ValidateAndSetupAPIContext(apiContext);

            // Configure and send the request
            var resourcePath = "v1/invoicing/invoices";

            return(PayPalResource.ConfigureAndExecute <Invoice>(apiContext, HttpMethod.POST, resourcePath, invoice.ConvertToJson()));
        }
Esempio n. 4
0
        /// <summary>
        /// Creates a new invoice Resource.
        /// </summary>
        /// <param name="apiContext">APIContext used for the API call.</param>
        /// <param name="invoice">Invoice object to be used for creating the PayPal resource.</param>
        /// <returns>Invoice</returns>
        public static Invoice Create(APIContext apiContext, Invoice invoice)
        {
            // Validate the arguments to be used in the request
            ArgumentValidator.ValidateAndSetupAPIContext(apiContext);

            // Configure and send the request
            var resourcePath = "v1/invoicing/invoices";
            return PayPalResource.ConfigureAndExecute<Invoice>(apiContext, HttpMethod.POST, resourcePath, invoice.ConvertToJson());
        }