Esempio n. 1
0
        /// <summary>
        /// Send an existing invoice to a list of recipients. Makes a POST request to the Invoices/Messages resource.
        /// </summary>
        /// <param name="invoiceId">The ID of the invoice to send</param>
        /// <param name="options">The options of the message to send</param>
        public InvoiceMessage SendInvoice(long invoiceId, InvoiceMessageOptions options)
        {
            var request = Request("invoices/" + invoiceId + "/messages", RestSharp.Method.POST);

            request.AddBody(options);

            return(Execute <InvoiceMessage>(request));
        }
Esempio n. 2
0
        public IRestRequest SendInvoiceRequest(long invoiceId, InvoiceMessageOptions options)
        {
            var request = Request($"{InvoicesResource}/{invoiceId}/messages", RestSharp.Method.POST);

            request.AddBody(options);

            return(request);
        }
        private IRestRequest CreateInvoiceMessageActionRequest(long invoiceId, string body, string action)
        {
            var request = Request(INVOICES_RESOURCE, invoiceId, $"{MESSAGES_SUBRESOURCE}/{action}", Method.POST);

            var options = new InvoiceMessageOptions {
                Body = body
            };

            request.AddBody(options);

            return(request);
        }
Esempio n. 4
0
        private IRestRequest CreateInvoiceMessageActionRequest(long invoiceId, string body, string action)
        {
            var request = Request($"{InvoicesResource}/{invoiceId}/messages/{action}", RestSharp.Method.POST);

            var options = new InvoiceMessageOptions()
            {
                Body = body
            };

            request.AddBody(options);

            return(request);
        }
Esempio n. 5
0
        /// <summary>
        /// Send an existing invoice to a list of recipients. Makes a POST request to the Invoices/Messages resource.
        /// </summary>
        /// <param name="invoiceId">The ID of the invoice to send</param>
        /// <param name="recipients">The email addresses of the recipients</param>
        /// <param name="body">The body of the message</param>
        /// <param name="sendMeACopy">Whether to send a copy of the invoice to the authenticated user</param>
        /// <param name="attachPdf">Whether to attach a pdf copy of the invoice to the email(s)</param>
        public InvoiceMessage SendInvoice(long invoiceId, string recipients, string body = null, bool sendMeACopy = true, bool attachPdf = true, bool includeLink = false)
        {
            var options = new InvoiceMessageOptions()
            {
                Recipients        = recipients,
                Body              = body,
                SendMeACopy       = sendMeACopy,
                AttachPdf         = attachPdf,
                IncludePayPalLink = includeLink
            };

            return(SendInvoice(invoiceId, options));
        }
Esempio n. 6
0
        private bool _createInvoiceMessageAction(long invoiceId, string body, string action)
        {
            var request = Request("invoices/" + invoiceId + "/messages/" + action, RestSharp.Method.POST);

            var options = new InvoiceMessageOptions()
            {
                Body = body
            };

            request.AddBody(options);

            var result = Execute(request);

            return(result.StatusCode == System.Net.HttpStatusCode.OK);
        }
Esempio n. 7
0
 /// <summary>
 /// Send an existing invoice to a list of recipients. Makes a POST request to the Invoices/Messages resource.
 /// </summary>
 /// <param name="invoiceId">The ID of the invoice to send</param>
 /// <param name="options">The options of the message to send</param>
 public async Task <InvoiceMessage> SendInvoiceAsync(long invoiceId, InvoiceMessageOptions options, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(await ExecuteAsync <InvoiceMessage>(SendInvoiceRequest(invoiceId, options), cancellationToken));
 }
Esempio n. 8
0
 /// <summary>
 /// Send an existing invoice to a list of recipients. Makes a POST request to the Invoices/Messages resource.
 /// </summary>
 /// <param name="invoiceId">The ID of the invoice to send</param>
 /// <param name="options">The options of the message to send</param>
 public InvoiceMessage SendInvoice(long invoiceId, InvoiceMessageOptions options)
 {
     return(Execute <InvoiceMessage>(SendInvoiceRequest(invoiceId, options)));
 }
        /// <summary>
        /// Send an existing invoice to a list of recipients. Makes a POST request to the Invoices/Messages resource.
        /// </summary>
        /// <param name="invoiceId">The ID of the invoice to send</param>
        /// <param name="options">The options of the message to send</param>
        public Task <InvoiceMessage> SendInvoiceAsync(long invoiceId, InvoiceMessageOptions options)
        {
            var request = CreateRequest(INVOICES_RESOURCE, invoiceId, MESSAGES_SUBRESOURCE, options);

            return(ExecuteAsync <InvoiceMessage>(request));
        }