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.
- checksums.yaml +4 -4
- data/.coderabbit.yaml +6 -8
- data/.github/workflows/build.yml +6 -3
- data/CHANGELOG.md +43 -44
- data/Gemfile +3 -10
- data/README.md +221 -328
- data/README.zh-TW.md +322 -0
- data/Rakefile +2 -51
- data/bin/console +3 -6
- data/einvoice.gemspec +16 -18
- data/lib/einvoice/amego/client.rb +116 -0
- data/lib/einvoice/amego/errors.rb +84 -0
- data/lib/einvoice/amego/payload.rb +276 -0
- data/lib/einvoice/amego/provider.rb +267 -0
- data/lib/einvoice/amego.rb +27 -0
- data/lib/einvoice/capability.rb +79 -0
- data/lib/einvoice/ecpay/client.rb +183 -0
- data/lib/einvoice/ecpay/crypto.rb +85 -0
- data/lib/einvoice/ecpay/errors.rb +115 -0
- data/lib/einvoice/ecpay/payload.rb +241 -0
- data/lib/einvoice/ecpay/provider.rb +362 -0
- data/lib/einvoice/ecpay.rb +31 -0
- data/lib/einvoice/error.rb +220 -0
- data/lib/einvoice/ezpay/client.rb +130 -0
- data/lib/einvoice/ezpay/crypto.rb +85 -0
- data/lib/einvoice/ezpay/errors.rb +72 -0
- data/lib/einvoice/ezpay/payload.rb +269 -0
- data/lib/einvoice/ezpay/provider.rb +235 -0
- data/lib/einvoice/ezpay.rb +19 -0
- data/lib/einvoice/input.rb +494 -0
- data/lib/einvoice/mock_provider.rb +191 -0
- data/lib/einvoice/mof/donation_codes.rb +157 -0
- data/lib/einvoice/mof.rb +16 -0
- data/lib/einvoice/number.rb +51 -0
- data/lib/einvoice/provider.rb +57 -13
- data/lib/einvoice/redaction.rb +54 -0
- data/lib/einvoice/taipei.rb +89 -0
- data/lib/einvoice/tax_split.rb +124 -0
- data/lib/einvoice/tradevan/default_api/client.rb +175 -0
- data/lib/einvoice/tradevan/default_api/crypto.rb +90 -0
- data/lib/einvoice/tradevan/default_api/errors.rb +54 -0
- data/lib/einvoice/tradevan/default_api/payload.rb +259 -0
- data/lib/einvoice/tradevan/default_api/provider.rb +366 -0
- data/lib/einvoice/tradevan/default_api/rules.rb +314 -0
- data/lib/einvoice/tradevan.rb +25 -0
- data/lib/einvoice/types.rb +323 -0
- data/lib/einvoice/version.rb +3 -1
- data/lib/einvoice.rb +21 -9
- metadata +52 -145
- data/.github/workflows/cron.yml +0 -31
- data/docs/Tradevan E-Invoice APIs.md +0 -201
- data/docs/neweb.md +0 -347
- data/lib/einvoice/client.rb +0 -21
- data/lib/einvoice/configuration.rb +0 -49
- data/lib/einvoice/connection.rb +0 -31
- data/lib/einvoice/donation_unit_list.json +0 -2025
- data/lib/einvoice/result.rb +0 -21
- data/lib/einvoice/tradevan/model/base.rb +0 -34
- data/lib/einvoice/tradevan/model/issue_data.rb +0 -129
- data/lib/einvoice/tradevan/model/issue_item.rb +0 -41
- data/lib/einvoice/tradevan/model/void_data.rb +0 -35
- data/lib/einvoice/tradevan/provider.rb +0 -139
- data/lib/einvoice/tradevan/result.rb +0 -25
- data/lib/einvoice/tradevan/validator/issue_data_validator.rb +0 -80
- data/lib/faraday/response/decode_tradevan.rb +0 -37
- data/lib/faraday/response/parse_xml.rb +0 -14
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
require "faraday"
|
|
2
|
-
|
|
3
|
-
module Einvoice
|
|
4
|
-
module Configuration
|
|
5
|
-
VALID_OPTIONS_KEYS = [
|
|
6
|
-
:endpoint,
|
|
7
|
-
:endpoint_url,
|
|
8
|
-
:client_id,
|
|
9
|
-
:client_secret,
|
|
10
|
-
:encryption_keys,
|
|
11
|
-
:format,
|
|
12
|
-
:ssl_verify
|
|
13
|
-
].freeze
|
|
14
|
-
|
|
15
|
-
DEFAULT_CLIENT_ID = nil
|
|
16
|
-
DEFAULT_CLIENT_SECRET = nil
|
|
17
|
-
DEFAULT_ENDPOINT = "".freeze
|
|
18
|
-
DEFAULT_ENDPOINT_URL = nil
|
|
19
|
-
DEFAULT_FORMAT = ""
|
|
20
|
-
DEFAULT_ENCRYPTION_KEYS = {}
|
|
21
|
-
DEFAULT_SSL_VERIFY = true
|
|
22
|
-
|
|
23
|
-
attr_accessor(*VALID_OPTIONS_KEYS)
|
|
24
|
-
|
|
25
|
-
def self.extended(base)
|
|
26
|
-
base.reset
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def configure
|
|
30
|
-
yield self
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def options
|
|
34
|
-
VALID_OPTIONS_KEYS.inject({}) do |option, key|
|
|
35
|
-
option.merge!(key => send(key))
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def reset
|
|
40
|
-
self.client_id = DEFAULT_CLIENT_ID
|
|
41
|
-
self.client_secret = DEFAULT_CLIENT_SECRET
|
|
42
|
-
self.endpoint = DEFAULT_ENDPOINT
|
|
43
|
-
self.endpoint_url = DEFAULT_ENDPOINT_URL
|
|
44
|
-
self.encryption_keys = DEFAULT_ENCRYPTION_KEYS
|
|
45
|
-
self.format = DEFAULT_FORMAT
|
|
46
|
-
self.ssl_verify = DEFAULT_SSL_VERIFY
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
end
|
data/lib/einvoice/connection.rb
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
require "faraday/response/decode_tradevan"
|
|
2
|
-
require "faraday/response/parse_xml"
|
|
3
|
-
|
|
4
|
-
module Einvoice
|
|
5
|
-
module Connection
|
|
6
|
-
private
|
|
7
|
-
|
|
8
|
-
def connection(options = {})
|
|
9
|
-
connection_options = {
|
|
10
|
-
headers: { "Accept" => "application/#{format}; charset=utf-8" },
|
|
11
|
-
url: endpoint,
|
|
12
|
-
ssl: { verify: ssl_verify != false }
|
|
13
|
-
}.merge(options)
|
|
14
|
-
|
|
15
|
-
::Faraday::Connection.new(connection_options) do |connection|
|
|
16
|
-
case self.class.to_s
|
|
17
|
-
when "Einvoice::Tradevan::Provider"
|
|
18
|
-
connection.response :decode_tradevan, encryption_keys[:key1]
|
|
19
|
-
end
|
|
20
|
-
connection.request :url_encoded
|
|
21
|
-
|
|
22
|
-
case format.to_s.downcase
|
|
23
|
-
when "xml" then connection.response :xml
|
|
24
|
-
when "json" then connection.response :json
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
connection.adapter Faraday.default_adapter
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|