A Ruby client for AADE myDATA API
Add this line to your application's Gemfile:
gem 'my_data'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install my_data
There are all the resources that are specified by the given xsd files from AADE.
e.g.
irb> MyData::Resources::Inv::PartyType
=> MyData::Resources::Inv::PartyType vat_number: string, country: string, branch: integer, name: string, address: MyData::Resources::Inv::AddressType
# You could set environment to :sandbox or :production
client = MyData::Client.new(
user_id: "johndoe",
subscription_key: "c9b79ff1841fb5cfecc66e1ea5a29b4d",
environment: :sandbox
)
invoice_data = {
issuer: { vat_number: "111111111", country: "GR", branch: 0 },
invoice_header: { series: "A", aa: "1", issue_date: "2021-02-21", invoice_type: "11.2", currency: "EUR" },
invoice_details: [{
line_number: "1",
net_value: 100.00,
vat_category: 1,
vat_amount: 24.00,
income_classification: [{ classification_type: "E3_561_003", classification_category: "category1_3", amount: 100.00 }]
}],
invoice_summary: {
total_net_value: 100.00,
total_vat_amount: 24.00,
total_withheld_amount: 0.0,
total_fees_amount: 0.0,
total_stamp_duty_amount: 0.0,
total_other_taxes_amount: 0.0,
total_deductions_amount: 0.0,
total_gross_value: 124.00,
income_classification: [{ classification_type: "E3_561_003", classification_category: "category1_3", amount: 100.00 }]
},
payment_methods: [{ type: 3, amount: 124.00 }]
}
invoices_doc = MyData::Resources::Inv::InvoicesDoc.new(invoice: [invoice_data])
client.send_invoices(doc: invoices_doc.to_xml)
client.request_transmitted_docs(mark: 1)
client.cancel_invoice(mark: 400001831924171)
Bug reports and pull requests are welcome on GitHub at https://github.com/mikezaby/my_data.
The gem is available as open source under the terms of the MIT License.