einvoice 1.5.0 → 2.0.0.alpha2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.coderabbit.yaml +6 -8
  3. data/.github/workflows/build.yml +6 -3
  4. data/CHANGELOG.md +43 -44
  5. data/Gemfile +3 -10
  6. data/README.md +221 -328
  7. data/README.zh-TW.md +322 -0
  8. data/Rakefile +2 -51
  9. data/bin/console +3 -6
  10. data/einvoice.gemspec +16 -18
  11. data/lib/einvoice/amego/client.rb +116 -0
  12. data/lib/einvoice/amego/errors.rb +84 -0
  13. data/lib/einvoice/amego/payload.rb +276 -0
  14. data/lib/einvoice/amego/provider.rb +267 -0
  15. data/lib/einvoice/amego.rb +27 -0
  16. data/lib/einvoice/capability.rb +79 -0
  17. data/lib/einvoice/ecpay/client.rb +183 -0
  18. data/lib/einvoice/ecpay/crypto.rb +85 -0
  19. data/lib/einvoice/ecpay/errors.rb +115 -0
  20. data/lib/einvoice/ecpay/payload.rb +241 -0
  21. data/lib/einvoice/ecpay/provider.rb +362 -0
  22. data/lib/einvoice/ecpay.rb +31 -0
  23. data/lib/einvoice/error.rb +220 -0
  24. data/lib/einvoice/ezpay/client.rb +130 -0
  25. data/lib/einvoice/ezpay/crypto.rb +85 -0
  26. data/lib/einvoice/ezpay/errors.rb +72 -0
  27. data/lib/einvoice/ezpay/payload.rb +269 -0
  28. data/lib/einvoice/ezpay/provider.rb +235 -0
  29. data/lib/einvoice/ezpay.rb +19 -0
  30. data/lib/einvoice/input.rb +494 -0
  31. data/lib/einvoice/mock_provider.rb +191 -0
  32. data/lib/einvoice/mof/donation_codes.rb +157 -0
  33. data/lib/einvoice/mof.rb +16 -0
  34. data/lib/einvoice/number.rb +51 -0
  35. data/lib/einvoice/provider.rb +57 -13
  36. data/lib/einvoice/redaction.rb +54 -0
  37. data/lib/einvoice/taipei.rb +89 -0
  38. data/lib/einvoice/tax_split.rb +124 -0
  39. data/lib/einvoice/tradevan/default_api/client.rb +175 -0
  40. data/lib/einvoice/tradevan/default_api/crypto.rb +90 -0
  41. data/lib/einvoice/tradevan/default_api/errors.rb +54 -0
  42. data/lib/einvoice/tradevan/default_api/payload.rb +259 -0
  43. data/lib/einvoice/tradevan/default_api/provider.rb +366 -0
  44. data/lib/einvoice/tradevan/default_api/rules.rb +314 -0
  45. data/lib/einvoice/tradevan.rb +25 -0
  46. data/lib/einvoice/types.rb +323 -0
  47. data/lib/einvoice/version.rb +3 -1
  48. data/lib/einvoice.rb +21 -9
  49. metadata +52 -145
  50. data/.github/workflows/cron.yml +0 -31
  51. data/docs/Tradevan E-Invoice APIs.md +0 -201
  52. data/docs/neweb.md +0 -347
  53. data/lib/einvoice/client.rb +0 -21
  54. data/lib/einvoice/configuration.rb +0 -49
  55. data/lib/einvoice/connection.rb +0 -31
  56. data/lib/einvoice/donation_unit_list.json +0 -2025
  57. data/lib/einvoice/result.rb +0 -21
  58. data/lib/einvoice/tradevan/model/base.rb +0 -34
  59. data/lib/einvoice/tradevan/model/issue_data.rb +0 -129
  60. data/lib/einvoice/tradevan/model/issue_item.rb +0 -41
  61. data/lib/einvoice/tradevan/model/void_data.rb +0 -35
  62. data/lib/einvoice/tradevan/provider.rb +0 -139
  63. data/lib/einvoice/tradevan/result.rb +0 -25
  64. data/lib/einvoice/tradevan/validator/issue_data_validator.rb +0 -80
  65. data/lib/faraday/response/decode_tradevan.rb +0 -37
  66. data/lib/faraday/response/parse_xml.rb +0 -14
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "einvoice"
4
+ require "einvoice/tradevan/default_api/crypto"
5
+ require "einvoice/tradevan/default_api/errors"
6
+ require "einvoice/tradevan/default_api/client"
7
+ require "einvoice/tradevan/default_api/rules"
8
+ require "einvoice/tradevan/default_api/payload"
9
+ require "einvoice/tradevan/default_api/provider"
10
+
11
+ module Einvoice
12
+ # Adapters for Tradevan 關貿網路. Each Tradevan API version has its own
13
+ # namespace, so a newer one can sit next to the old one:
14
+ #
15
+ # provider = Einvoice::Tradevan::DefaultAPI::Provider.new(...)
16
+ #
17
+ # There is deliberately no shorter alias. An alias that later points to a newer
18
+ # API would move users to it without them noticing.
19
+ module Tradevan
20
+ # Tradevan's DEFAULTAPI (paths under +/DEFAULTAPI/+), the API the 1.x client
21
+ # wraps. Experimental: see {Provider}.
22
+ module DefaultAPI
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,323 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Einvoice
4
+ # Provider-agnostic domain model for Taiwan e-invoices (財政部 MIG 4.0).
5
+ #
6
+ # Every adapter maps these unified types to/from its own wire format; business
7
+ # code depends ONLY on these so switching providers never touches application
8
+ # logic. All value objects are immutable ({Data}) — use +#with+ to derive a
9
+ # changed copy, and pattern-match via +deconstruct_keys+.
10
+ #
11
+ # Money convention: the statutory amount fields are integers in New Taiwan
12
+ # Dollars (a MIG invariant — even cross-border invoices are filed in TWD). For
13
+ # a foreign-currency sale, set +currency+ (ISO 4217) + +exchange_rate+ to
14
+ # annotate the original transaction; the amount fields stay TWD.
15
+
16
+ # 課稅別 — maps to MIG TaxType.
17
+ module TaxType
18
+ TAXABLE = :taxable # 應稅 (5% business tax)
19
+ ZERO_RATED = :zero_rated # 零稅率 (exports etc.)
20
+ TAX_FREE = :tax_free # 免稅
21
+ SPECIAL = :special # 特種稅額
22
+ ALL = [TAXABLE, ZERO_RATED, TAX_FREE, SPECIAL].freeze
23
+ # Not a MIG tax type, and an issue input does not take it. It describes an
24
+ # existing invoice whose items have different tax types, on a reference or
25
+ # an allowance. Each allowance item then has to carry its own tax_type.
26
+ MIXED = :mixed
27
+ # Taxes that add tax to a line. ZERO_RATED and TAX_FREE lines have tax 0.
28
+ TAXED = [TAXABLE, SPECIAL].freeze
29
+
30
+ module_function
31
+
32
+ # The tax type of a whole invoice: the one its items share, else MIXED.
33
+ def of(items, invoice_tax_type)
34
+ kinds = items.map { |item| item.tax_type || invoice_tax_type }.uniq
35
+ kinds.size > 1 ? MIXED : kinds.first || invoice_tax_type
36
+ end
37
+ end
38
+
39
+ # Invoice category. Derived from whether the buyer has a 統一編號:
40
+ # B2B = triplicate (三聯式), B2C = duplicate (二聯式).
41
+ module InvoiceCategory
42
+ B2B = :b2b
43
+ B2C = :b2c
44
+ ALL = [B2B, B2C].freeze
45
+ end
46
+
47
+ # Whether item/line amounts already include the 5% business tax.
48
+ module PriceMode
49
+ TAX_INCLUSIVE = :tax_inclusive
50
+ TAX_EXCLUSIVE = :tax_exclusive
51
+ ALL = [TAX_INCLUSIVE, TAX_EXCLUSIVE].freeze
52
+ end
53
+
54
+ # 載具類別.
55
+ module CarrierType
56
+ MOBILE_BARCODE = :mobile_barcode # 手機條碼 — /ABC1234 (MIG 3J0002)
57
+ CITIZEN_CERTIFICATE = :citizen_certificate # 自然人憑證條碼 — 16 chars (MIG CQ0001)
58
+ MEMBER = :member # 會員/通用載具 issued by the center
59
+ ALL = [MOBILE_BARCODE, CITIZEN_CERTIFICATE, MEMBER].freeze
60
+ end
61
+
62
+ # Lifecycle status of an invoice as reported by a provider.
63
+ module InvoiceStatus
64
+ ISSUED = :issued
65
+ VOIDED = :voided
66
+ ALLOWANCE = :allowance # has at least one active allowance (折讓)
67
+ ALL = [ISSUED, VOIDED, ALLOWANCE].freeze
68
+ end
69
+
70
+ module ProviderMode
71
+ TEST = :test
72
+ PRODUCTION = :production
73
+ ALL = [TEST, PRODUCTION].freeze
74
+ end
75
+
76
+ # 買受人. A ubn (統一編號, 8 digits) implies a B2B / triplicate invoice.
77
+ Buyer = Data.define(:name, :ubn, :email, :address, :phone) do
78
+ def initialize(name: nil, ubn: nil, email: nil, address: nil, phone: nil)
79
+ super
80
+ end
81
+
82
+ # Presence of a 統一編號 implies a business (B2B) buyer.
83
+ def business?
84
+ !(ubn.nil? || ubn.to_s.empty?)
85
+ end
86
+
87
+ # Name, email, address and phone are personal data, so inspect, to_s and pp
88
+ # show them as [FILTERED], here and inside every input or result. The ubn is
89
+ # a company's public number and stays. Read the fields directly when needed.
90
+ def inspect
91
+ fields = to_h.map do |key, value|
92
+ "#{key}=#{key == :ubn || value.nil? ? value.inspect : Redaction::FILTERED}"
93
+ end
94
+ "#<data #{self.class.name} #{fields.join(', ')}>"
95
+ end
96
+ alias_method :to_s, :inspect
97
+
98
+ def pretty_print(printer)
99
+ printer.text(inspect)
100
+ end
101
+ end
102
+
103
+ # 載具. +code+ shape depends on +type+ (mobile barcode "/"+7, citizen cert 16
104
+ # chars, member often omitted — provider links by email/member id).
105
+ Carrier = Data.define(:type, :code) do
106
+ def initialize(type:, code: nil)
107
+ super
108
+ end
109
+ end
110
+
111
+ # 捐贈 — donating the invoice to a charity by 愛心碼.
112
+ Donation = Data.define(:npoban)
113
+
114
+ # 愛心碼 are 3–7 digits (MIG 捐贈碼). The single definition of that shape:
115
+ # {Input} enforces it on the way in, and both the adapters and
116
+ # {MOF::DonationCodes} refer to it rather than restating the pattern.
117
+ #
118
+ # Assigned here rather than inside a +Data.define+ block, where a constant
119
+ # would land in +Einvoice+ instead of on this class — the block is evaluated
120
+ # with the enclosing lexical scope, so +Donation::CODE_FORMAT+ would not exist.
121
+ Donation::CODE_FORMAT = /\A\d{3,7}\z/
122
+
123
+ # A single invoice line. +tax_type+ is required only on mixed-tax invoices.
124
+ # +unit_price+ and +amount+ include tax or not as the input's +price_mode+
125
+ # says. The core never changes them: the tax of each line is in the input's
126
+ # #tax_breakdown.
127
+ InvoiceItem = Data.define(:description, :quantity, :unit_price, :amount, :unit, :tax_type, :remark) do
128
+ def initialize(description:, quantity:, unit_price:, amount:, unit: nil, tax_type: nil, remark: nil)
129
+ super
130
+ end
131
+ end
132
+
133
+ # Monetary summary for the whole invoice (integer TWD).
134
+ # total_amount = sales_amount + tax_amount.
135
+ AmountSummary = Data.define(:sales_amount, :tax_amount, :total_amount)
136
+
137
+ # --- Issue (開立) ---
138
+
139
+ # +customs_clearance_mark+ (+"1"+ or +"2"+) and +zero_tax_rate_reason+
140
+ # (+"71"+ to +"79"+) are the MIG's CustomsClearanceMark and
141
+ # ZeroTaxRateReason, for an invoice with a zero-rated line.
142
+ IssueInvoiceInput = Data.define(
143
+ :order_id, :buyer, :items, :amount, :tax_type, :price_mode, :tax_rate, :category,
144
+ :carrier, :donation, :remark, :currency, :exchange_rate, :customs_clearance_mark,
145
+ :zero_tax_rate_reason, :provider_options
146
+ ) do
147
+ def initialize(order_id:, buyer:, items:, tax_type:, price_mode:, amount: nil, tax_rate: nil,
148
+ category: nil, carrier: nil, donation: nil, remark: nil, currency: nil,
149
+ exchange_rate: nil, customs_clearance_mark: nil, zero_tax_rate_reason: nil,
150
+ provider_options: nil)
151
+ super
152
+ end
153
+
154
+ # True when a line is zero rated, by its own tax type or the invoice's.
155
+ def zero_rated?
156
+ items.any? { |item| (item.tax_type || tax_type) == TaxType::ZERO_RATED }
157
+ end
158
+
159
+ # Explicit +category+, else derived from the buyer's 統一編號.
160
+ def resolved_category
161
+ category || (buyer&.business? ? InvoiceCategory::B2B : InvoiceCategory::B2C)
162
+ end
163
+
164
+ # The tax of every line and the MIG totals, computed by the core. See
165
+ # {TaxBreakdown}.
166
+ def tax_breakdown(provider: nil)
167
+ TaxSplit.breakdown(items, tax_type: tax_type, tax_rate: tax_rate, price_mode: price_mode, provider: provider)
168
+ end
169
+ end
170
+
171
+ # --- References ---
172
+
173
+ # The facts about an existing invoice that providers ask for when they void,
174
+ # credit or query it. Results of issue and query return one as #reference, so
175
+ # a caller passes it on and does not have to know what each provider needs.
176
+ # Every field is optional. An adapter that needs a missing field may query the
177
+ # provider for it, or raises ValidationError naming the field.
178
+ #
179
+ # +invoice_datetime+ is a Time in UTC+8. +buyer_ubn+ is nil for a consumer.
180
+ # +tax_type+ and +tax_rate+ are the invoice's, so an allowance can take them
181
+ # from here. +tax_type+ is MIXED when the items differ.
182
+ #
183
+ # A reference is stored between calls, often for days. #to_h is that stored
184
+ # form: JSON-safe values only, with +invoice_datetime+ as an ISO 8601 string in
185
+ # UTC+8. Pass the Hash back as +invoice:+, as it is or after a JSON round
186
+ # trip, and Input reads the same reference.
187
+ InvoiceReference = Data.define(:number, :invoice_datetime, :random_code, :order_id, :total_amount,
188
+ :buyer_ubn, :tax_type, :tax_rate) do
189
+ def initialize(number: nil, invoice_datetime: nil, random_code: nil, order_id: nil,
190
+ total_amount: nil, buyer_ubn: nil, tax_type: nil, tax_rate: nil)
191
+ super
192
+ end
193
+
194
+ def to_h
195
+ super.merge(invoice_datetime: invoice_datetime && Taipei.iso8601(invoice_datetime),
196
+ tax_type: tax_type&.to_s, tax_rate: tax_rate && Number.plain(tax_rate.to_r)).compact
197
+ end
198
+ end
199
+
200
+ # The facts about an existing allowance. +allowance_date+ is a Date. #to_h is
201
+ # the stored form, as for InvoiceReference, with the date as YYYY-MM-DD.
202
+ AllowanceReference = Data.define(:allowance_number, :allowance_date, :invoice_number) do
203
+ def initialize(allowance_number:, allowance_date: nil, invoice_number: nil)
204
+ super
205
+ end
206
+
207
+ def to_h
208
+ super.merge(allowance_date: allowance_date&.strftime("%Y-%m-%d")).compact
209
+ end
210
+ end
211
+
212
+ # --- Issue results ---
213
+
214
+ # +invoice_datetime+ is a Time in UTC+8 (MIG InvoiceDate and InvoiceTime).
215
+ # +buyer_ubn+ is nil for a consumer. +tax_type+ is TaxType.of the input, so
216
+ # MIXED for a mixed-tax invoice, and +tax_rate+ is the input's rate.
217
+ IssueInvoiceResult = Data.define(
218
+ :invoice_number, :invoice_datetime, :random_code, :order_id, :total_amount, :buyer_ubn, :tax_type,
219
+ :tax_rate, :status, :raw
220
+ ) do
221
+ include Redaction::Raw
222
+
223
+ def reference
224
+ InvoiceReference.new(number: invoice_number, invoice_datetime: invoice_datetime,
225
+ random_code: random_code, order_id: order_id,
226
+ total_amount: total_amount, buyer_ubn: buyer_ubn,
227
+ tax_type: tax_type, tax_rate: tax_rate)
228
+ end
229
+ end
230
+
231
+ # --- Void (作廢) ---
232
+
233
+ # +invoice+ is an InvoiceReference (Input also takes a plain number).
234
+ VoidInvoiceInput = Data.define(:invoice, :reason, :provider_options) do
235
+ def initialize(invoice:, reason:, provider_options: nil)
236
+ super
237
+ end
238
+ end
239
+
240
+ # +cancel_datetime+ is a Time in UTC+8 (MIG CancelDate and CancelTime), or nil
241
+ # when the provider does not return it.
242
+ VoidInvoiceResult = Data.define(:invoice_number, :status, :cancel_datetime, :raw) do
243
+ include Redaction::Raw
244
+
245
+ def initialize(invoice_number:, status:, raw:, cancel_datetime: nil)
246
+ super
247
+ end
248
+ end
249
+
250
+ # --- Allowance (折讓) and its cancellation (折讓作廢) ---
251
+
252
+ # +price_mode+ says if the item amounts include tax. +tax_type+ and
253
+ # +tax_rate+ come from the input, else from the invoice reference. With a
254
+ # MIXED tax type, every item carries its own tax_type.
255
+ #
256
+ # +amount+ follows G0401: +sales_amount+ excludes tax. Input checks it
257
+ # against #tax_breakdown, which holds the tax of each line.
258
+ AllowanceInput = Data.define(:invoice, :allowance_id, :items, :amount, :price_mode, :tax_type, :tax_rate,
259
+ :provider_options) do
260
+ def initialize(invoice:, allowance_id:, items:, price_mode:, tax_type:, tax_rate:, amount: nil,
261
+ provider_options: nil)
262
+ super
263
+ end
264
+
265
+ def tax_breakdown(provider: nil)
266
+ TaxSplit.breakdown(items, tax_type: tax_type, tax_rate: tax_rate, price_mode: price_mode, provider: provider)
267
+ end
268
+ end
269
+
270
+ # +allowance_date+ is a Date (MIG AllowanceDate has no time).
271
+ AllowanceResult = Data.define(:allowance_number, :invoice_number, :allowance_date, :total_amount, :raw) do
272
+ include Redaction::Raw
273
+
274
+ def reference
275
+ AllowanceReference.new(allowance_number: allowance_number, allowance_date: allowance_date,
276
+ invoice_number: invoice_number)
277
+ end
278
+ end
279
+
280
+ # +allowance+ is an AllowanceReference (Input also takes a plain number).
281
+ VoidAllowanceInput = Data.define(:allowance, :reason, :provider_options) do
282
+ def initialize(allowance:, reason: nil, provider_options: nil)
283
+ super
284
+ end
285
+ end
286
+
287
+ VoidAllowanceResult = Data.define(:allowance_number, :cancel_datetime, :raw) do
288
+ include Redaction::Raw
289
+
290
+ def initialize(allowance_number:, raw:, cancel_datetime: nil)
291
+ super
292
+ end
293
+ end
294
+
295
+ # --- Query (查詢) ---
296
+
297
+ # +invoice+ is an InvoiceReference with a number or an order id. A reference
298
+ # with only an order id (and what the provider needs with it) finds an invoice
299
+ # without its number. That needs QUERY_BY_ORDER_ID.
300
+ QueryInvoiceInput = Data.define(:invoice, :provider_options) do
301
+ def initialize(invoice:, provider_options: nil)
302
+ super
303
+ end
304
+ end
305
+
306
+ # +status+ is nil when the provider's status has no InvoiceStatus, for
307
+ # example a cancelled (註銷) invoice.
308
+ #
309
+ # +tax_type+ and +tax_rate+ are nil when the provider does not say.
310
+ QueryInvoiceResult = Data.define(
311
+ :invoice_number, :invoice_datetime, :random_code, :order_id, :status, :amount, :buyer, :items, :tax_type,
312
+ :tax_rate, :raw
313
+ ) do
314
+ include Redaction::Raw
315
+
316
+ def reference
317
+ InvoiceReference.new(number: invoice_number, invoice_datetime: invoice_datetime,
318
+ random_code: random_code, order_id: order_id,
319
+ total_amount: amount&.total_amount, buyer_ubn: buyer&.ubn,
320
+ tax_type: tax_type, tax_rate: tax_rate)
321
+ end
322
+ end
323
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Einvoice
2
- VERSION = "1.5.0"
4
+ VERSION = "2.0.0.alpha2"
3
5
  end
data/lib/einvoice.rb CHANGED
@@ -1,14 +1,26 @@
1
- require "active_support"
1
+ # frozen_string_literal: true
2
2
 
3
- require "einvoice/client"
4
- require "einvoice/configuration"
5
- require "einvoice/connection"
6
- require "einvoice/provider"
7
- require "einvoice/result"
8
3
  require "einvoice/version"
4
+ require "einvoice/error"
5
+ require "einvoice/redaction"
6
+ require "einvoice/taipei"
7
+ require "einvoice/number"
8
+ require "einvoice/tax_split"
9
+ require "einvoice/capability"
10
+ require "einvoice/types"
11
+ require "einvoice/input"
12
+ require "einvoice/provider"
13
+ require "einvoice/mock_provider"
9
14
 
10
- require "einvoice/tradevan/provider"
11
-
15
+ # Provider-agnostic Taiwan e-invoice SDK (財政部 MIG 4.1).
16
+ #
17
+ # The core models the five operations once: issue (開立), void (作廢),
18
+ # allowance (折讓), void-allowance (折讓作廢) and query (查詢). It has a unified
19
+ # value model and an {Einvoice::Provider} contract. Each value-added center is a
20
+ # thin adapter that maps the unified model to its wire format and back.
21
+ #
22
+ # This file loads the core only. The adapters and the MOF clients load on
23
+ # demand, so an app loads only what it uses: require "einvoice/ecpay",
24
+ # "einvoice/amego", "einvoice/ezpay", "einvoice/tradevan" or "einvoice/mof".
12
25
  module Einvoice
13
- extend Configuration
14
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: einvoice
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 2.0.0.alpha2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Yun
@@ -9,76 +9,6 @@ bindir: exe
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
- - !ruby/object:Gem::Dependency
13
- name: faraday
14
- requirement: !ruby/object:Gem::Requirement
15
- requirements:
16
- - - "~>"
17
- - !ruby/object:Gem::Version
18
- version: '2.1'
19
- type: :runtime
20
- prerelease: false
21
- version_requirements: !ruby/object:Gem::Requirement
22
- requirements:
23
- - - "~>"
24
- - !ruby/object:Gem::Version
25
- version: '2.1'
26
- - !ruby/object:Gem::Dependency
27
- name: multi_xml
28
- requirement: !ruby/object:Gem::Requirement
29
- requirements:
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: '0'
33
- type: :runtime
34
- prerelease: false
35
- version_requirements: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- version: '0'
40
- - !ruby/object:Gem::Dependency
41
- name: activemodel
42
- requirement: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: '0'
47
- type: :runtime
48
- prerelease: false
49
- version_requirements: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
- - !ruby/object:Gem::Dependency
55
- name: activesupport
56
- requirement: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- version: '0'
61
- type: :runtime
62
- prerelease: false
63
- version_requirements: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- version: '0'
68
- - !ruby/object:Gem::Dependency
69
- name: bundler
70
- requirement: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - ">"
73
- - !ruby/object:Gem::Version
74
- version: '1.17'
75
- type: :development
76
- prerelease: false
77
- version_requirements: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - ">"
80
- - !ruby/object:Gem::Version
81
- version: '1.17'
82
12
  - !ruby/object:Gem::Dependency
83
13
  name: rake
84
14
  requirement: !ruby/object:Gem::Requirement
@@ -93,90 +23,48 @@ dependencies:
93
23
  - - "~>"
94
24
  - !ruby/object:Gem::Version
95
25
  version: '13.0'
96
- - !ruby/object:Gem::Dependency
97
- name: pry
98
- requirement: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- version: '0'
103
- type: :development
104
- prerelease: false
105
- version_requirements: !ruby/object:Gem::Requirement
106
- requirements:
107
- - - ">="
108
- - !ruby/object:Gem::Version
109
- version: '0'
110
26
  - !ruby/object:Gem::Dependency
111
27
  name: rspec
112
28
  requirement: !ruby/object:Gem::Requirement
113
29
  requirements:
114
- - - ">="
115
- - !ruby/object:Gem::Version
116
- version: '0'
117
- type: :development
118
- prerelease: false
119
- version_requirements: !ruby/object:Gem::Requirement
120
- requirements:
121
- - - ">="
122
- - !ruby/object:Gem::Version
123
- version: '0'
124
- - !ruby/object:Gem::Dependency
125
- name: factory_bot
126
- requirement: !ruby/object:Gem::Requirement
127
- requirements:
128
- - - ">="
129
- - !ruby/object:Gem::Version
130
- version: '0'
131
- type: :development
132
- prerelease: false
133
- version_requirements: !ruby/object:Gem::Requirement
134
- requirements:
135
- - - ">="
136
- - !ruby/object:Gem::Version
137
- version: '0'
138
- - !ruby/object:Gem::Dependency
139
- name: shoulda-matchers
140
- requirement: !ruby/object:Gem::Requirement
141
- requirements:
142
- - - ">="
30
+ - - "~>"
143
31
  - !ruby/object:Gem::Version
144
- version: '0'
32
+ version: '3.13'
145
33
  type: :development
146
34
  prerelease: false
147
35
  version_requirements: !ruby/object:Gem::Requirement
148
36
  requirements:
149
- - - ">="
37
+ - - "~>"
150
38
  - !ruby/object:Gem::Version
151
- version: '0'
39
+ version: '3.13'
152
40
  - !ruby/object:Gem::Dependency
153
41
  name: vcr
154
42
  requirement: !ruby/object:Gem::Requirement
155
43
  requirements:
156
- - - ">="
44
+ - - "~>"
157
45
  - !ruby/object:Gem::Version
158
- version: '0'
46
+ version: '6.3'
159
47
  type: :development
160
48
  prerelease: false
161
49
  version_requirements: !ruby/object:Gem::Requirement
162
50
  requirements:
163
- - - ">="
51
+ - - "~>"
164
52
  - !ruby/object:Gem::Version
165
- version: '0'
53
+ version: '6.3'
166
54
  - !ruby/object:Gem::Dependency
167
55
  name: webmock
168
56
  requirement: !ruby/object:Gem::Requirement
169
57
  requirements:
170
- - - ">="
58
+ - - "~>"
171
59
  - !ruby/object:Gem::Version
172
- version: '0'
60
+ version: '3.23'
173
61
  type: :development
174
62
  prerelease: false
175
63
  version_requirements: !ruby/object:Gem::Requirement
176
64
  requirements:
177
- - - ">="
65
+ - - "~>"
178
66
  - !ruby/object:Gem::Version
179
- version: '0'
67
+ version: '3.23'
180
68
  email:
181
69
  - abookyun@gmail.com
182
70
  executables: []
@@ -185,42 +73,61 @@ extra_rdoc_files: []
185
73
  files:
186
74
  - ".coderabbit.yaml"
187
75
  - ".github/workflows/build.yml"
188
- - ".github/workflows/cron.yml"
189
76
  - ".gitignore"
190
77
  - ".rspec"
191
78
  - CHANGELOG.md
192
79
  - Gemfile
193
80
  - LICENSE.txt
194
81
  - README.md
82
+ - README.zh-TW.md
195
83
  - Rakefile
196
84
  - bin/console
197
85
  - bin/setup
198
- - docs/Tradevan E-Invoice APIs.md
199
- - docs/neweb.md
200
86
  - einvoice.gemspec
201
87
  - lib/einvoice.rb
202
- - lib/einvoice/client.rb
203
- - lib/einvoice/configuration.rb
204
- - lib/einvoice/connection.rb
205
- - lib/einvoice/donation_unit_list.json
88
+ - lib/einvoice/amego.rb
89
+ - lib/einvoice/amego/client.rb
90
+ - lib/einvoice/amego/errors.rb
91
+ - lib/einvoice/amego/payload.rb
92
+ - lib/einvoice/amego/provider.rb
93
+ - lib/einvoice/capability.rb
94
+ - lib/einvoice/ecpay.rb
95
+ - lib/einvoice/ecpay/client.rb
96
+ - lib/einvoice/ecpay/crypto.rb
97
+ - lib/einvoice/ecpay/errors.rb
98
+ - lib/einvoice/ecpay/payload.rb
99
+ - lib/einvoice/ecpay/provider.rb
100
+ - lib/einvoice/error.rb
101
+ - lib/einvoice/ezpay.rb
102
+ - lib/einvoice/ezpay/client.rb
103
+ - lib/einvoice/ezpay/crypto.rb
104
+ - lib/einvoice/ezpay/errors.rb
105
+ - lib/einvoice/ezpay/payload.rb
106
+ - lib/einvoice/ezpay/provider.rb
107
+ - lib/einvoice/input.rb
108
+ - lib/einvoice/mock_provider.rb
109
+ - lib/einvoice/mof.rb
110
+ - lib/einvoice/mof/donation_codes.rb
111
+ - lib/einvoice/number.rb
206
112
  - lib/einvoice/provider.rb
207
- - lib/einvoice/result.rb
208
- - lib/einvoice/tradevan/model/base.rb
209
- - lib/einvoice/tradevan/model/issue_data.rb
210
- - lib/einvoice/tradevan/model/issue_item.rb
211
- - lib/einvoice/tradevan/model/void_data.rb
212
- - lib/einvoice/tradevan/provider.rb
213
- - lib/einvoice/tradevan/result.rb
214
- - lib/einvoice/tradevan/validator/issue_data_validator.rb
113
+ - lib/einvoice/redaction.rb
114
+ - lib/einvoice/taipei.rb
115
+ - lib/einvoice/tax_split.rb
116
+ - lib/einvoice/tradevan.rb
117
+ - lib/einvoice/tradevan/default_api/client.rb
118
+ - lib/einvoice/tradevan/default_api/crypto.rb
119
+ - lib/einvoice/tradevan/default_api/errors.rb
120
+ - lib/einvoice/tradevan/default_api/payload.rb
121
+ - lib/einvoice/tradevan/default_api/provider.rb
122
+ - lib/einvoice/tradevan/default_api/rules.rb
123
+ - lib/einvoice/types.rb
215
124
  - lib/einvoice/version.rb
216
- - lib/faraday/response/decode_tradevan.rb
217
- - lib/faraday/response/parse_xml.rb
218
125
  homepage: https://github.com/abookyun/einvoice
219
126
  licenses:
220
127
  - MIT
221
128
  metadata:
222
129
  source_code_uri: https://github.com/abookyun/einvoice
223
- changelog_uri: https://github.com/abookyun/einvoice/blob/main/CHANGELOG.md
130
+ changelog_uri: https://github.com/abookyun/einvoice/blob/v2.0.0.alpha2/CHANGELOG.md
224
131
  bug_tracker_uri: https://github.com/abookyun/einvoice/issues
225
132
  rubygems_mfa_required: 'true'
226
133
  rdoc_options: []
@@ -230,7 +137,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
230
137
  requirements:
231
138
  - - ">="
232
139
  - !ruby/object:Gem::Version
233
- version: '3.1'
140
+ version: '3.2'
234
141
  required_rubygems_version: !ruby/object:Gem::Requirement
235
142
  requirements:
236
143
  - - ">="
@@ -239,5 +146,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
239
146
  requirements: []
240
147
  rubygems_version: 4.0.20
241
148
  specification_version: 4
242
- summary: An API wrapper for Taiwan e-invoice services.
149
+ summary: Provider-agnostic Taiwan e-invoice SDK (unified model + per-provider adapters).
243
150
  test_files: []