Invoice put finvoice

Method invoice_put_finvoice is used for creating new invoices from existing Finvoice XML files or ZIP files with Finvoice XML files and attachments. Since Finvoice XML does not have support for attachment, the method is very strictly defined so that only one XML is allowed per request and all other files are considered attachments. If a PDF document with the same filename as the XML file exists, it is used as invoice image.

Return value

This method returns a InvoiceStatus struct.

Arguments

  1. api_keys (required)
  2. FinvoiceTrx (required)

Example code in Ruby

 1 require 'soap/wsdlDriver'
 2 require 'soap/attachment'
 3 
 4 server = SOAP::WSDLDriverFactory.new("https://testing.maventa.com/apis/bravo/wsdl").create_rpc_driver
 5 
 6 #Set up API keys
 7 api_keys = Hash.new
 8 api_keys[:vendor_api_key] = "" # Partner software API key
 9 api_keys[:user_api_key] = "" # User API key
10 api_keys[:company_uuid] = "" # UUID of current company
11 
12 files_out = Hash.new
13 files_out[:files] = []
14 files_out[:filenames] = []
15 
16 files_out[:files] << SOAP::Attachment.new(File.new("finvoice.xml"))
17 files_out[:filenames] << "finvoice.xml" 
18 files_out[:files] << SOAP::Attachment.new(File.new("finvoice.pdf"))
19 files_out[:filenames] << "finvoice.pdf" 
20 
21 result = server.invoice_put_finvoice(api_keys, files_out)
22 puts result.status
23 

Example code in C#

 1 //WSDL at https://testing.maventa.com/apis/bravo/wsdl needs to be added as web reference for the example to work
 2 
 3 using System;
 4 using System.IO;
 5 using System.Collections.Generic;
 6 using System.Drawing;
 7 using System.Windows.Forms;
 8 using MaventaAPI;
 9 
10 namespace MaventaDemo
11 {
12     public partial class MainForm : Form
13     {
14         public MainForm()
15         {
16             MaventaService m_server = new MaventaService();        
17             ApiKeys apiKeyParams = new ApiKeys();
18             apiKeyParams.user_api_key = "";
19             apiKeyParams.company_uuid = "";
20 
21             FinvoiceTrx finvoiceOut = new FinvoiceTrx();
22 
23             //Finvoice method requires that PDF image has the same name as the Finvoice XML file
24             string[] filenameArray = new string[2];
25             filenameArray[0] = "finvoice.xml";
26             filenameArray[1] = "finvoice.pdf";
27 
28             byte[][] fileArray = new byte[2][];
29             fileArray[0] = File.ReadAllBytes("finvoice.xml");
30             fileArray[1] = File.ReadAllBytes("finvoice.pdf");
31 
32             finvoiceOut.filenames = filenameArray;
33             finvoiceOut.files = fileArray;
34 
35             InvoiceStatus result = new InvoiceStatus();
36             result = m_server.invoice_put_finvoice(apiKeyParams, finvoiceOut);
37             MessageBox.Show(result.status);
38         }
39     }
40 }

Also available in: HTML TXT