Skip to content

Instantly share code, notes, and snippets.

@jonlunsford
Created September 29, 2022 19:01
Show Gist options
  • Save jonlunsford/720ad12c6d18ee6f1ba87b0fc89c2789 to your computer and use it in GitHub Desktop.
Save jonlunsford/720ad12c6d18ee6f1ba87b0fc89c2789 to your computer and use it in GitHub Desktop.
# GET http://ninive-6292.sandbox-quadernoapp.com/api/tax_rates/calculate
my_client.calculate_tax_rate(
amount: 10.0,
currency: "EUR",
from_country: "FR", # CK Customer's business address
to_country: "ES", # Purchaser's location
tax_code: "ebook",
product_type: "good",
tax_behavior: "inclusive"
)
{
:country=>"FR", # Should this be ES? Local to the `to_country` above?
:currency=>"EUR",
:name=>"TVA",
:notes=>nil,
:product_type=>"good",
:rate=>5.5,
:region=>nil,
:tax_behavior=>"inclusive",
:tax_code=>"ebook",
:taxable_part=>100.0,
:import=>false,
:subtotal=>9.48,
:tax_amount=>0.52,
:total_amount=>10.0,
:status=>"taxable"
}
# Our account is 'registered' in all ES jurisdictions, here's one:
# GET http://ninive-6292.sandbox-quadernoapp.com/api/tax_ids/12581
my_client.retrieve_tax_id(12581)
{
:id=>12581,
:jurisdiction=>{
:id=>84,
:country=>"ES",
:name=>"Spain – Canarias"
},
:state=>"verified",
:valid_from=>"2022-09-01",
:valid_until=>nil,
:value=>"ES1234ABCD3F",
:created_at=>1664474076
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment