focas-client 0.1.0
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 +7 -0
- data/.gitignore +20 -0
- data/.rspec +3 -0
- data/.travis.yml +6 -0
- data/CHANGELOG.md +1 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +46 -0
- data/LICENSE.txt +21 -0
- data/README.md +55 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/focas-client.gemspec +32 -0
- data/lib/focas/config.rb +102 -0
- data/lib/focas/errors.rb +6 -0
- data/lib/focas/payment.rb +73 -0
- data/lib/focas/query_trade_info.rb +61 -0
- data/lib/focas/version.rb +5 -0
- data/lib/focas-client.rb +11 -0
- data/lib/generators/focas/helpers.rb +13 -0
- data/lib/generators/focas/install_generator.rb +18 -0
- data/lib/generators/focas/templates/initializer.rb +61 -0
- metadata +82 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 437b2a6a29fd61f69fce24a4c4e4f64de74db25597c14167fd3c024390e03718
|
4
|
+
data.tar.gz: 234ee05500b4d9a592abbb09e9ccade6c64acb34dc2484d3c8002a0020e37353
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e080feab65aac91830754c283fdc952a7f2357763de5d39ac604dfcaffcdc7c6593d56c3affe25f0a1999ff38a4075e671577040c18d00016dee3a41d80963d4
|
7
|
+
data.tar.gz: 93f76018b8144b04276f3cfcce33d463a4cd497e844b0eb2128199f66aef20a42319b899f27da5be108933f654f1c09d09091fbd07d69ec9b7792b58d71eea55
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
## 0.1.0 (開發中)
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
focas-client (0.1.0)
|
5
|
+
activesupport (>= 4.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activesupport (7.0.4.2)
|
11
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
|
+
i18n (>= 1.6, < 2)
|
13
|
+
minitest (>= 5.1)
|
14
|
+
tzinfo (~> 2.0)
|
15
|
+
concurrent-ruby (1.2.2)
|
16
|
+
diff-lcs (1.5.0)
|
17
|
+
i18n (1.12.0)
|
18
|
+
concurrent-ruby (~> 1.0)
|
19
|
+
minitest (5.17.0)
|
20
|
+
rake (12.3.3)
|
21
|
+
rspec (3.12.0)
|
22
|
+
rspec-core (~> 3.12.0)
|
23
|
+
rspec-expectations (~> 3.12.0)
|
24
|
+
rspec-mocks (~> 3.12.0)
|
25
|
+
rspec-core (3.12.1)
|
26
|
+
rspec-support (~> 3.12.0)
|
27
|
+
rspec-expectations (3.12.2)
|
28
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
29
|
+
rspec-support (~> 3.12.0)
|
30
|
+
rspec-mocks (3.12.3)
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
+
rspec-support (~> 3.12.0)
|
33
|
+
rspec-support (3.12.0)
|
34
|
+
tzinfo (2.0.6)
|
35
|
+
concurrent-ruby (~> 1.0)
|
36
|
+
|
37
|
+
PLATFORMS
|
38
|
+
ruby
|
39
|
+
|
40
|
+
DEPENDENCIES
|
41
|
+
focas-client!
|
42
|
+
rake (~> 12.0)
|
43
|
+
rspec (~> 3.0)
|
44
|
+
|
45
|
+
BUNDLED WITH
|
46
|
+
2.1.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 Daniel Lin (pct)
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# Focas::Client (開發中)
|
2
|
+
|
3
|
+
`focas-client` 是串接財金資訊 金流 API 的 rails gem。
|
4
|
+
|
5
|
+
目前狀態為`開發中`,請優先使用別的 focas 相關 gem 來達到您的需求(好像沒看到別的 gem...)
|
6
|
+
|
7
|
+
## NOTICE: 目前僅支援信用卡,不支援銀聯卡
|
8
|
+
|
9
|
+
## 測試用信用卡號
|
10
|
+
- 請跟財金公司索取
|
11
|
+
|
12
|
+
## 安裝
|
13
|
+
Gemfile:
|
14
|
+
```ruby
|
15
|
+
gem 'focas-client'
|
16
|
+
```
|
17
|
+
|
18
|
+
執行:
|
19
|
+
```bash
|
20
|
+
$ bundle install
|
21
|
+
```
|
22
|
+
|
23
|
+
建立 `config/initializers/focas.rb`:
|
24
|
+
|
25
|
+
```bash
|
26
|
+
$ rails generate focas:install
|
27
|
+
```
|
28
|
+
|
29
|
+
設定 `config/initializers/focas.rb`:
|
30
|
+
|
31
|
+
```yml
|
32
|
+
- config.production_mode # 0: 開發環境 / 1: 正式站,預設為 0
|
33
|
+
- config.marchant_id # 商店 ID
|
34
|
+
- config.hash_key
|
35
|
+
- config.hash_iv
|
36
|
+
```
|
37
|
+
|
38
|
+
## Usage
|
39
|
+
|
40
|
+
TODO: Write usage instructions here
|
41
|
+
|
42
|
+
## Development
|
43
|
+
|
44
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
45
|
+
|
46
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
47
|
+
|
48
|
+
## Contributing
|
49
|
+
|
50
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/pct/focas-client.
|
51
|
+
|
52
|
+
|
53
|
+
## License
|
54
|
+
|
55
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "focas-client"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require_relative 'lib/focas/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "focas-client"
|
5
|
+
spec.version = Focas::VERSION
|
6
|
+
spec.authors = ["Daniel Lin (pct)"]
|
7
|
+
spec.email = ["pct@4point-inc.com"]
|
8
|
+
|
9
|
+
spec.summary = %q{財金資訊 金流 focas-client (開發中,勿用)}
|
10
|
+
spec.description = %q{財金資訊 金流 focas-client (開發中,勿用)}
|
11
|
+
spec.homepage = "https://github.com/pct/focas-client"
|
12
|
+
spec.license = "MIT"
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
|
14
|
+
|
15
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
16
|
+
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = "https://github.com/pct/focas-client"
|
19
|
+
spec.metadata["changelog_uri"] = "https://github.com/pct/focas-client/CHANGELOG.md"
|
20
|
+
|
21
|
+
# Specify which files should be added to the gem when it is released.
|
22
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
24
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
end
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
# 相依套件
|
31
|
+
spec.add_runtime_dependency "activesupport", [">= 4.0"]
|
32
|
+
end
|
data/lib/focas/config.rb
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'securerandom'
|
4
|
+
|
5
|
+
# for mattr_accessor
|
6
|
+
require 'active_support/core_ext/module/attribute_accessors'
|
7
|
+
|
8
|
+
# for with_indifferent_access
|
9
|
+
require 'active_support/core_ext/hash/indifferent_access'
|
10
|
+
|
11
|
+
module Focas
|
12
|
+
|
13
|
+
module Config
|
14
|
+
mattr_accessor :options
|
15
|
+
mattr_accessor :production_mode # 0/1,預設為 0,使用開發環境網址
|
16
|
+
mattr_accessor :api_base_url # 依據 production_mode 設定 api 網址
|
17
|
+
|
18
|
+
OPTIONS = %w[
|
19
|
+
merID
|
20
|
+
MerchantID
|
21
|
+
TerminalID
|
22
|
+
MerchantName
|
23
|
+
customize
|
24
|
+
lidm
|
25
|
+
purchAmt
|
26
|
+
CurrencyNote
|
27
|
+
AutoCap
|
28
|
+
AuthResURL
|
29
|
+
frontFailUrl
|
30
|
+
PayType
|
31
|
+
PeriodNum
|
32
|
+
LocalDate
|
33
|
+
LocalTime
|
34
|
+
reqToken
|
35
|
+
subMerchID
|
36
|
+
enCodeType
|
37
|
+
timeoutDate
|
38
|
+
timeoutTime
|
39
|
+
timeoutSecs
|
40
|
+
Currency
|
41
|
+
lagSelect
|
42
|
+
threeDSAuthInd
|
43
|
+
].freeze
|
44
|
+
|
45
|
+
# 標 **[必] 為必填,另外 threeDSAuthInd 是 3DS 驗證,需要時就必填
|
46
|
+
# TradeInfo 參數
|
47
|
+
MAPPING_TABLE = {
|
48
|
+
merID: 'mer_id', # **[必] 網站特店自訂代碼(請注意 merID 與 MerchantID 不同), number <= 10
|
49
|
+
MerchantID: 'merchant_id', # **[必] 收單銀行授權使用的特店代號(由收單銀行編製提供), number 固定 15
|
50
|
+
TerminalID: 'terminal_id', # **[必] 收單銀行授權使用的機台代號(由收單銀行編製提供), number 固定 8
|
51
|
+
MerchantName: 'merchant_name', # 特店名稱,僅供顯示
|
52
|
+
customize: 'customize', # **[必] 客製化付款授權網頁辨識碼(0: 不客製;1-8 有 8 種客製化樣式可選擇)
|
53
|
+
lidm: 'lidm', # * 交易訂單編號,建議訂單編號不可重複編號,且在 16 位以下最佳(如果是銀聯卡,則不能用 -、_ 符號)
|
54
|
+
purchAmt: 'purch_amt', # **[必] 新台幣整數(10 位數內),如果是金融卡,最大交易為 200 萬
|
55
|
+
CurrencyNote: 'currency_note', # 註記說明,50 字內
|
56
|
+
AutoCap: 'auto_cap', # 是否自動轉入請款檔作業 (0: 預設不轉入 / 1: 自動轉入)
|
57
|
+
AuthResURL: 'auth_res_url', # 授權結果回傳網址,最多 512 位元組
|
58
|
+
frontFailUrl: 'front_fail_url', # 銀聯網路 UPOP 交易失敗,返回商戶跳轉網址
|
59
|
+
PayType: 'pay_type', # 交易類別碼 (0: 預設一般交易 / 1: 分期 / 2: 紅利)
|
60
|
+
PeriodNum: 'period_num', # 分期期數 (1-99)
|
61
|
+
LocalDate: 'local_date', # 購買地交易日期(yyyymmdd)(預設為系統日期)
|
62
|
+
LocalTime: 'local_time', # 購買地交易時間(HHMMSS) (預設為系統時間)
|
63
|
+
reqToken: 'req_token', # 交易驗證碼,最大長度 64 位
|
64
|
+
subMerchID: 'sub_merch_id', # 次特店代號,固定長度 8 位
|
65
|
+
enCodeType: 'encode_type', # *[必] 網頁編碼格式(預設為 BIG5),所以必傳 "UTF-8"
|
66
|
+
timeoutDate: 'timeout_date', # 設定交易逾時日期(yyyymmdd),固定長度 8 位
|
67
|
+
timeoutTime: 'timeout_time', # 設定交易逾時起始時間(HHMMSS),固定長度 6 位
|
68
|
+
timeoutSecs: 'timeout_secs', # 設定交易逾時秒數,固定長度 3 位 (最大值為 600 秒)
|
69
|
+
Currency: 'currency', # 交易幣別,固定長度 3 位 (901)
|
70
|
+
lagSelect: 'lag_select', # 語言選擇,固定長度 1 位 (0: 繁 / 1: 簡 / 2: 英 / 3: 日 )
|
71
|
+
threeDSAuthInd: 'three_ds_auth_ind', # 3D 交易驗證類型,若該特店設定支援 3D 交易,前端未帶此欄位,則預設為 0101 (0101 表示支付類交易驗證(PA)的 Payment transaction。 0204 表示非支付類交易驗證(NPA)的 Add card。0205 表示非支付類交易驗證(NPA)的 Maintain card。 註:綁卡驗證應使用 0204 或 0205)
|
72
|
+
}.freeze
|
73
|
+
|
74
|
+
self.options = {}.with_indifferent_access
|
75
|
+
|
76
|
+
OPTIONS.each do |option|
|
77
|
+
transfer_option = MAPPING_TABLE[:"#{option}"]
|
78
|
+
define_method("#{transfer_option}=") do |value|
|
79
|
+
options[option] = value
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def configure
|
84
|
+
yield self
|
85
|
+
end
|
86
|
+
|
87
|
+
def api_base_url
|
88
|
+
self.production_mode ||= 0
|
89
|
+
self.api_base_url = self.production_mode == 0 ?
|
90
|
+
'https://www.focas-test.fisc.com.tw' :
|
91
|
+
'https://www.focas.fisc.com.tw'
|
92
|
+
end
|
93
|
+
|
94
|
+
def get_payment_url
|
95
|
+
"#{self.api_base_url}/FOCAS_WEBPOS/online/"
|
96
|
+
end
|
97
|
+
|
98
|
+
def create_lidm
|
99
|
+
lidm = "#{Time.now.strftime("%Y%m%d%H%M%S")}_#{SecureRandom.hex(2).upcase}"
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
data/lib/focas/errors.rb
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'net/http'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
require_relative 'config'
|
7
|
+
require_relative 'errors'
|
8
|
+
|
9
|
+
module Focas
|
10
|
+
class Payment
|
11
|
+
attr_accessor :trade_info
|
12
|
+
attr_reader :response
|
13
|
+
|
14
|
+
def initialize(
|
15
|
+
# 必填參數
|
16
|
+
lidm: nil,
|
17
|
+
purch_amt: nil,
|
18
|
+
|
19
|
+
# 參數
|
20
|
+
currency_note: '訂單金額說明',
|
21
|
+
|
22
|
+
# 客製回傳網址(同一個站有不同接收的 route 時使用)
|
23
|
+
auth_res_url: nil
|
24
|
+
)
|
25
|
+
unless lidm && purch_amt
|
26
|
+
raise Focas::PaymentArgumentError,
|
27
|
+
'請確認以下參數皆有填寫:
|
28
|
+
- lidm 訂單編號
|
29
|
+
- purch_amt 金額
|
30
|
+
'
|
31
|
+
end
|
32
|
+
|
33
|
+
@lidm = lidm
|
34
|
+
@purch_amt = purch_amt
|
35
|
+
@currency_note = currency_note
|
36
|
+
|
37
|
+
# 回傳網址
|
38
|
+
@auth_res_url = auth_res_url
|
39
|
+
|
40
|
+
set_trade_info
|
41
|
+
end
|
42
|
+
|
43
|
+
def success?
|
44
|
+
return if @response.nil?
|
45
|
+
@response['Status'] == 'SUCCESS'
|
46
|
+
end
|
47
|
+
|
48
|
+
def gen_payment_params
|
49
|
+
{
|
50
|
+
merID: Config.options[:merID], # merID (統一編號)
|
51
|
+
MerchantID: Config.options[:MerchantID], # 商店 ID
|
52
|
+
TerminalID: Config.options[:TerminalID], # 終端機
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def set_trade_info
|
59
|
+
options = Config.options
|
60
|
+
@trade_info = options.transform_keys(&:to_sym)
|
61
|
+
|
62
|
+
individual_trade_info = {
|
63
|
+
lidm: @lidm, # 商店訂單編號,如:用途_日期時間戳記_流水號
|
64
|
+
purchAmt: @purch_amt.to_i, # 訂單金額
|
65
|
+
CurrencyNote: @currency_note, # 商品資訊
|
66
|
+
# 回傳網址
|
67
|
+
AuthResURL: @auth_res_url,
|
68
|
+
}
|
69
|
+
|
70
|
+
@trade_info.merge!(individual_trade_info)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'net/http'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
require_relative 'config'
|
7
|
+
require_relative 'errors'
|
8
|
+
|
9
|
+
module Focas
|
10
|
+
class QueryTradeInfo
|
11
|
+
attr_accessor :trade_info
|
12
|
+
attr_reader :response
|
13
|
+
|
14
|
+
def initialize(
|
15
|
+
lidm: nil,
|
16
|
+
purch_amt: nil,
|
17
|
+
res_url: nil
|
18
|
+
)
|
19
|
+
unless lidm && purch_amt
|
20
|
+
raise Focas::PaymentArgumentError,
|
21
|
+
'請確認以下參數皆有填寫:
|
22
|
+
- lidm
|
23
|
+
- purch_amt
|
24
|
+
'
|
25
|
+
end
|
26
|
+
|
27
|
+
@lidm = lidm
|
28
|
+
@purch_amt = purch_amt
|
29
|
+
@res_url = res_url
|
30
|
+
@xid = xid
|
31
|
+
|
32
|
+
set_trade_info
|
33
|
+
set_check_value
|
34
|
+
end
|
35
|
+
|
36
|
+
def request!
|
37
|
+
uri = URI("#{Config.api_base_url}/FOCAS_WEBPOS/orderInquery/")
|
38
|
+
|
39
|
+
res = Net::HTTP.post_form(uri,
|
40
|
+
merID: Config.options[:merID],
|
41
|
+
MerchantID: Config.options[:MerchantID],
|
42
|
+
TerminalID: Config.options[:TerminalID],
|
43
|
+
lidm: @lidm,
|
44
|
+
purchAmt: @purch_amt,
|
45
|
+
ResURL: @res_url,
|
46
|
+
xid: @xid
|
47
|
+
)
|
48
|
+
|
49
|
+
@response = JSON.parse(res.body)
|
50
|
+
end
|
51
|
+
|
52
|
+
def success?
|
53
|
+
return if @response.nil?
|
54
|
+
|
55
|
+
@response['Status'] == 'SUCCESS'
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
data/lib/focas-client.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'generators/focas/helpers'
|
4
|
+
require 'rails/generators/base'
|
5
|
+
|
6
|
+
module Focas
|
7
|
+
module Generators
|
8
|
+
class InstallGenerator < Rails::Generators::Base
|
9
|
+
include Focas::Generators::Helpers
|
10
|
+
|
11
|
+
source_root File.expand_path('templates', __dir__)
|
12
|
+
|
13
|
+
def copy_initializer_file
|
14
|
+
template 'initializer.rb', focas_config_path
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
focas.configure do |config|
|
4
|
+
# ========
|
5
|
+
# 必要參數
|
6
|
+
# ========
|
7
|
+
|
8
|
+
# (0/1 使用財金資訊 正式站與否,預設為 0 測試站)
|
9
|
+
config.production_mode = 0
|
10
|
+
|
11
|
+
# **[必] 網站特店自訂代碼(請注意 merID 與 MerchantID 不同), number <= 10 (通常是統編)
|
12
|
+
config.mer_id = ''
|
13
|
+
|
14
|
+
# **[必] 收單銀行授權使用的特店代號(由收單銀行編製提供), number 固定 15
|
15
|
+
config.merchant_id = ''
|
16
|
+
|
17
|
+
# **[必] 收單銀行授權使用的機台代號(由收單銀行編製提供), number 固定 8
|
18
|
+
config.terminal_id = ''
|
19
|
+
|
20
|
+
# 特店名稱,僅供顯示
|
21
|
+
config.merchant_name = ''
|
22
|
+
|
23
|
+
# **[必] 客製化付款授權網頁辨識碼(0: 預設不客製 / 1-8: 樣式1-8)
|
24
|
+
config.customize = 1
|
25
|
+
|
26
|
+
# ========
|
27
|
+
# 其他參數
|
28
|
+
# ========
|
29
|
+
# 是否自動轉入請款檔作業 (0: 不自動轉入 / 1: 自動轉入)
|
30
|
+
config.auto_cap = 1
|
31
|
+
|
32
|
+
# 授權結果回傳網址,最多 512 位元組
|
33
|
+
#config.callback_url = ''
|
34
|
+
|
35
|
+
# 銀聯網路 UPOP 交易失敗,返回商戶跳轉網址
|
36
|
+
#config.front_fail_url = ''
|
37
|
+
|
38
|
+
# 交易類別碼 (0: 一般交易(預設) / 1: 分期交易 / 2: 紅利交易)
|
39
|
+
#config.pay_type = 0
|
40
|
+
|
41
|
+
# 分期期數 (1-99)
|
42
|
+
#config.period_num = 1
|
43
|
+
|
44
|
+
# 次特店代號,固定長度 8 位
|
45
|
+
#config.sub_merch_id = '00000000'
|
46
|
+
|
47
|
+
# *[必] 網頁編碼格式(預設為 BIG5),所以必傳 "UTF-8"
|
48
|
+
config.encode_type = 'UTF-8'
|
49
|
+
|
50
|
+
# 設定交易逾時秒數,固定長度 3 位 (最大值為 600 秒)
|
51
|
+
config.timeout_secs = 600
|
52
|
+
|
53
|
+
# 交易幣別,固定長度 3 位 (901)
|
54
|
+
config.currency = 901
|
55
|
+
|
56
|
+
# 語言選擇,固定長度 1 位 (0: 繁 / 1: 簡 / 2: 英 / 3: 日)
|
57
|
+
#config.lag_select = 0
|
58
|
+
|
59
|
+
# 3D 交易驗證類型,若該特店設定支援 3D 交易,前端未帶此欄位,則預設為 0101 (0101 表示支付類交易驗證(PA)的 Payment transaction。 0204 表示非支付類交易驗證(NPA)的 Add card。0205 表示非支付類交易驗證(NPA)的 Maintain card。
|
60
|
+
#config.three_ds_auth_ind = '0101'
|
61
|
+
end
|
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: focas-client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Daniel Lin (pct)
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-04-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.0'
|
27
|
+
description: 財金資訊 金流 focas-client (開發中,勿用)
|
28
|
+
email:
|
29
|
+
- pct@4point-inc.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".gitignore"
|
35
|
+
- ".rspec"
|
36
|
+
- ".travis.yml"
|
37
|
+
- CHANGELOG.md
|
38
|
+
- Gemfile
|
39
|
+
- Gemfile.lock
|
40
|
+
- LICENSE.txt
|
41
|
+
- README.md
|
42
|
+
- Rakefile
|
43
|
+
- bin/console
|
44
|
+
- bin/setup
|
45
|
+
- focas-client.gemspec
|
46
|
+
- lib/focas-client.rb
|
47
|
+
- lib/focas/config.rb
|
48
|
+
- lib/focas/errors.rb
|
49
|
+
- lib/focas/payment.rb
|
50
|
+
- lib/focas/query_trade_info.rb
|
51
|
+
- lib/focas/version.rb
|
52
|
+
- lib/generators/focas/helpers.rb
|
53
|
+
- lib/generators/focas/install_generator.rb
|
54
|
+
- lib/generators/focas/templates/initializer.rb
|
55
|
+
homepage: https://github.com/pct/focas-client
|
56
|
+
licenses:
|
57
|
+
- MIT
|
58
|
+
metadata:
|
59
|
+
allowed_push_host: https://rubygems.org
|
60
|
+
homepage_uri: https://github.com/pct/focas-client
|
61
|
+
source_code_uri: https://github.com/pct/focas-client
|
62
|
+
changelog_uri: https://github.com/pct/focas-client/CHANGELOG.md
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: 2.6.0
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
requirements: []
|
78
|
+
rubygems_version: 3.3.7
|
79
|
+
signing_key:
|
80
|
+
specification_version: 4
|
81
|
+
summary: 財金資訊 金流 focas-client (開發中,勿用)
|
82
|
+
test_files: []
|