taxamo 1.0.6.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -0
  3. data/lib/taxamo.rb +52 -10
  4. data/lib/taxamo/models/calculatesimpletaxout.rb +14 -2
  5. data/lib/taxamo/models/calculatetaxout.rb +14 -2
  6. data/lib/taxamo/models/confirmtransactionout.rb +14 -2
  7. data/lib/taxamo/models/country.rb +6 -1
  8. data/lib/taxamo/models/countryschema.rb +6 -1
  9. data/lib/taxamo/models/createtransactionout.rb +14 -2
  10. data/lib/taxamo/models/gettransactionout.rb +14 -2
  11. data/lib/taxamo/models/gettransactionsstatsbycountryout.rb +63 -0
  12. data/lib/taxamo/models/inputtransaction.rb +16 -1
  13. data/lib/taxamo/models/inputtransactionline.rb +6 -1
  14. data/lib/taxamo/models/inputtransactionupdate.rb +16 -1
  15. data/lib/taxamo/models/report.rb +28 -18
  16. data/lib/taxamo/models/storagerequiredfields.rb +62 -0
  17. data/lib/taxamo/models/summary.rb +11 -1
  18. data/lib/taxamo/models/taxdataschema.rb +62 -0
  19. data/lib/taxamo/models/taxrequiredfields.rb +62 -0
  20. data/lib/taxamo/models/transaction.rb +26 -1
  21. data/lib/taxamo/models/transactionlines.rb +6 -1
  22. data/lib/taxamo/models/transactions.rb +26 -1
  23. data/lib/taxamo/models/unconfirmtransactionout.rb +14 -2
  24. data/lib/taxamo/models/updatetransactionout.rb +14 -2
  25. data/lib/taxamo/models/ustaxexemptioncertificatedetailsschema.rb +138 -0
  26. data/lib/taxamo/models/ustaxexemptioncertificateschema.rb +67 -0
  27. data/lib/taxamo/models/ustaxexemptstate.rb +72 -0
  28. data/lib/taxamo/models/ustaxid.rb +72 -0
  29. data/lib/taxamo/version.rb +1 -1
  30. data/test/taxamo/tax_test.rb +14 -9
  31. data/test/taxamo/transactions_api_test.rb +37 -28
  32. metadata +10 -2
@@ -0,0 +1,72 @@
1
+ # Copyright 2014-2015 Taxamo, Ltd.
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ class UsTaxId
14
+ attr_accessor :tax_id_type, :tax_id, :state_of_issue
15
+
16
+ # :internal => :external
17
+ def self.attribute_map
18
+ {
19
+ :tax_id_type => :tax_id_type,
20
+ :tax_id => :tax_id,
21
+ :state_of_issue => :state_of_issue
22
+
23
+ }
24
+ end
25
+
26
+ def initialize(attributes = {})
27
+ return if attributes.empty?
28
+ # Morph attribute keys into undescored rubyish style
29
+ if attributes["tax_id_type"]
30
+ @tax_id_type = attributes["tax_id_type"]
31
+
32
+ end
33
+ if attributes["tax_id"]
34
+ @tax_id = attributes["tax_id"]
35
+
36
+ end
37
+ if attributes["state_of_issue"]
38
+ @state_of_issue = attributes["state_of_issue"]
39
+
40
+ end
41
+
42
+
43
+ end
44
+
45
+ def to_body
46
+ body = {}
47
+ self.class.attribute_map.each_pair do |key, value|
48
+ v = self.send(key)
49
+ unless v.nil?
50
+ if v.is_a?(Array)
51
+ array = Array.new
52
+ v.each do |item|
53
+ if item.respond_to?("to_body".to_sym)
54
+ array.push item.to_body
55
+ else
56
+ array.push item
57
+ end
58
+ end
59
+ body[value] = array
60
+ else
61
+ if v.respond_to?("to_body".to_sym)
62
+ body[value] = v.to_body
63
+ else
64
+ body[value] = v
65
+ end
66
+ end
67
+ end
68
+ end
69
+ body
70
+ end
71
+ end
72
+
@@ -11,7 +11,7 @@
11
11
  # limitations under the License.
12
12
 
13
13
  module Taxamo
14
- VERSION = "1.0.6.1"
14
+ VERSION = "1.1.0"
15
15
  end
16
16
 
17
17
 
@@ -87,18 +87,23 @@ class TaxTest < Test::Unit::TestCase
87
87
  Swagger.configure do |config|
88
88
  config.api_key = 'SamplePrivateTestKey1'
89
89
  end
90
- resp = Taxamo.calculate_simple_tax(nil,
91
- nil,
92
- 'e-book', #product_type
90
+ #,,,,,
91
+ resp = Taxamo.calculate_simple_tax('e-book', #product_type
92
+ nil, #invoice_address_city
93
+ nil, #buyer_credit_card_prefix
94
+ 'USD', #currency_code
95
+ nil, #invoice_address_region
96
+ nil, #unit_price
97
+ nil, #quantity
98
+ nil, #buyer_tax_number
93
99
  'FR', #force_country_code
94
- nil,
95
- nil,
96
- nil,
97
- nil,
100
+ nil, #order_date
98
101
  100, #amount
99
102
  'IE', #billing_country_code
100
- 'USD', #currency_code
101
- nil)
103
+ nil, #invoice_address_postal_code
104
+ nil, #total_amount
105
+ nil #tax_deducted
106
+ )
102
107
 
103
108
  assert_equal resp.transaction.tax_country_code, 'FR'
104
109
  assert_equal resp.transaction.amount, 100
@@ -116,19 +116,22 @@ class TransactionsApiTest < Test::Unit::TestCase
116
116
  assert_equal resp.transaction.evidence.by_ip.resolved_country_code, 'IE'
117
117
  assert_equal resp.transaction.evidence.forced.resolved_country_code, 'FR'
118
118
 
119
- #statuses,sort_reverse,tax_country_code,order_date_from,offset,filter_text,format,order_date_to,currency_code,limit
120
- resp = Taxamo.list_transactions('C', #statuses
119
+ #filter_text,offset,key_or_custom_id,currency_code,order_date_to,sort_reverse,limit,invoice_number,statuses,order_date_from,total_amount_greater_than,format,total_amount_less_than,tax_country_code
120
+ resp = Taxamo.list_transactions(nil, #filter_text
121
+ 0, #offset
122
+ nil, #key_or_custom_id
123
+ 'EUR', #currency_code,
124
+ '2099-12-31', #order_date_to,
121
125
  'true', #sort_reverse
122
- nil, #tax_country_code
126
+ 100, #limit
127
+ nil,#invoice_number
128
+ 'C', #statuses
123
129
  '2014-01-01', #order_date_from
124
- nil, #key_or_custom_id
125
- nil, #filter_text
126
- 0, #offset
130
+ nil, #total_amount_greater_than
127
131
  nil, #format,
128
- nil,#invoice_number
129
- '2099-12-31', #order_date_to,
130
- 'EUR', #currency_code,
131
- 100)
132
+ nil, #total_amount_less_than
133
+ nil #tax_country_code
134
+ )
132
135
 
133
136
  assert_true resp.transactions.length > 0
134
137
  assert_true resp.transactions.length <= 100
@@ -137,18 +140,21 @@ class TransactionsApiTest < Test::Unit::TestCase
137
140
  assert_equal transaction.status, 'C'
138
141
  assert_equal transaction.currency_code, 'EUR'
139
142
  end
140
- resp = Taxamo.list_transactions('N', #statuses
143
+ resp = Taxamo.list_transactions(nil, #filter_text
144
+ 0, #offset
145
+ nil, #key_or_custom_id
146
+ 'EUR', #currency_code,
147
+ '2099-12-31', #order_date_to,
141
148
  'true', #sort_reverse
142
- nil, #tax_country_code
149
+ 10, #limit
150
+ nil,#invoice_number
151
+ 'N', #statuses
143
152
  '2099-12-01', #order_date_from
144
- nil, #key_or_custom_id
145
- nil, #filter_text
146
- 0, #offset
153
+ nil, #total_amount_greater_than
147
154
  nil, #format,
148
- nil, #invoice_number
149
- '2099-12-31', #order_date_to,
150
- 'EUR', #currency_code,
151
- 10)
155
+ nil, #total_amount_less_than
156
+ nil #tax_country_code
157
+ )
152
158
  assert_true resp.transactions.length == 0
153
159
 
154
160
  end
@@ -282,18 +288,21 @@ class TransactionsApiTest < Test::Unit::TestCase
282
288
 
283
289
  assert_raise(ValidationError) { Taxamo.capture_payment(resp.transaction.key)}
284
290
 
285
- resp = Taxamo.list_transactions('N', #statuses
291
+ resp = Taxamo.list_transactions( nil, #filter_text
292
+ 0, #offset
293
+ nil, #key_or_custom_id
294
+ 'CHF', #currency_code,
295
+ '2099-12-31', #order_date_to,
286
296
  'true', #sort_reverse
287
- nil, #tax_country_code
297
+ 10, #limit
298
+ nil,#invoice_number
299
+ 'N', #statuses
288
300
  '2001-12-01', #order_date_from
289
- nil, #key_or_custom_id
290
- 0, #offset
291
- nil, #filter_text
301
+ nil, #total_amount_greater_than
292
302
  nil, #format,
293
- nil, #invoice_number
294
- '2099-12-31', #order_date_to,
295
- 'CHF', #currency_code,
296
- 10)
303
+ nil, #total_amount_less_than
304
+ nil #tax_country_code
305
+ )
297
306
 
298
307
  assert_false resp.transactions[0].key.nil?
299
308
  assert_equal resp.transactions[0].status, 'N'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taxamo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomek Lipski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-20 00:00:00.000000000 Z
11
+ date: 2015-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -167,6 +167,7 @@ files:
167
167
  - lib/taxamo/models/getsettlementstatsbytaxationtypeout.rb
168
168
  - lib/taxamo/models/getsettlementsummaryout.rb
169
169
  - lib/taxamo/models/gettransactionout.rb
170
+ - lib/taxamo/models/gettransactionsstatsbycountryout.rb
170
171
  - lib/taxamo/models/gettransactionsstatsout.rb
171
172
  - lib/taxamo/models/inputtransaction.rb
172
173
  - lib/taxamo/models/inputtransactionline.rb
@@ -181,7 +182,10 @@ files:
181
182
  - lib/taxamo/models/producttypeschema.rb
182
183
  - lib/taxamo/models/report.rb
183
184
  - lib/taxamo/models/settlementdailystatsschema.rb
185
+ - lib/taxamo/models/storagerequiredfields.rb
184
186
  - lib/taxamo/models/summary.rb
187
+ - lib/taxamo/models/taxdataschema.rb
188
+ - lib/taxamo/models/taxrequiredfields.rb
185
189
  - lib/taxamo/models/transaction.rb
186
190
  - lib/taxamo/models/transactionlines.rb
187
191
  - lib/taxamo/models/transactions.rb
@@ -189,6 +193,10 @@ files:
189
193
  - lib/taxamo/models/unconfirmtransactionout.rb
190
194
  - lib/taxamo/models/updatetransactionin.rb
191
195
  - lib/taxamo/models/updatetransactionout.rb
196
+ - lib/taxamo/models/ustaxexemptioncertificatedetailsschema.rb
197
+ - lib/taxamo/models/ustaxexemptioncertificateschema.rb
198
+ - lib/taxamo/models/ustaxexemptstate.rb
199
+ - lib/taxamo/models/ustaxid.rb
192
200
  - lib/taxamo/models/validatetaxnumberout.rb
193
201
  - lib/taxamo/models/verifysmstokenout.rb
194
202
  - lib/taxamo/version.rb