focas-client 0.1.1 → 0.1.2
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/CHANGELOG.md +1 -1
- data/Gemfile.lock +1 -1
- data/README.md +8 -19
- data/lib/focas/config.rb +1 -1
- data/lib/focas/payment.rb +5 -10
- data/lib/focas/version.rb +1 -1
- data/lib/generators/focas/templates/initializer.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b083e5b0da2910143a54d9374252cbad5a5fa17d3a9c3f617ac77c980ec42b7a
|
4
|
+
data.tar.gz: a1067fbb7afca792242235e6bfae1b8d8e1884650d931028499b27ce20e68754
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d436deb7ebeabd939351d52e678105f89c167a764ceb1fee1090645208232280727b004f6a2e4c5df72b9e7a52280eb3c967e45ab76f3ae0dafead32cb16e0be
|
7
|
+
data.tar.gz: 319c8d978c1202c7c3bff17b743619c1a50e64980f7f454094938c9e0616f12eb9235c2dd2a866cd2a0c4478c211fbb11f6db3a24282f91ca86257c5862b2619
|
data/CHANGELOG.md
CHANGED
@@ -1 +1 @@
|
|
1
|
-
## 0.1.
|
1
|
+
## 0.1.2 (開發中)
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -29,27 +29,16 @@ $ rails generate focas:install
|
|
29
29
|
設定 `config/initializers/focas.rb`:
|
30
30
|
|
31
31
|
```yml
|
32
|
-
- config.production_mode
|
33
|
-
- config.mer_id # 通常是統編
|
34
|
-
- config.marchant_id # 商店 ID
|
35
|
-
- config.terminal_id # 付費終端機 ID
|
32
|
+
- config.production_mode # 0: 開發環境 / 1: 正式站,預設為 0
|
33
|
+
- config.mer_id = '' # 通常是統編
|
34
|
+
- config.marchant_id = '' # 商店 ID
|
35
|
+
- config.terminal_id = '' # 付費終端機 ID
|
36
|
+
- config.customize = 1 # 使用客製頁面1
|
37
|
+
- config.auto_cap = 1 # 自動請款
|
38
|
+
- config.encode_type = 'UTF-8' # 編碼一定要用 UTF-8,避免亂碼
|
39
|
+
- config.currency = 901 # 交易幣別,901 新台幣
|
36
40
|
```
|
37
41
|
|
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
42
|
## License
|
54
43
|
|
55
44
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/lib/focas/config.rb
CHANGED
@@ -65,7 +65,7 @@ module Focas
|
|
65
65
|
enCodeType: 'encode_type', # *[必] 網頁編碼格式(預設為 BIG5),所以必傳 "UTF-8"
|
66
66
|
timeoutDate: 'timeout_date', # 設定交易逾時日期(yyyymmdd),固定長度 8 位
|
67
67
|
timeoutTime: 'timeout_time', # 設定交易逾時起始時間(HHMMSS),固定長度 6 位
|
68
|
-
timeoutSecs: 'timeout_secs', # 設定交易逾時秒數,固定長度 3 位 (最大值為 600 秒)
|
68
|
+
timeoutSecs: 'timeout_secs', # 設定交易逾時秒數,固定長度 3 位 (最大值為 600 秒),先不設定,使用 600 會錯
|
69
69
|
Currency: 'currency', # 交易幣別,固定長度 3 位 (901)
|
70
70
|
lagSelect: 'lag_select', # 語言選擇,固定長度 1 位 (0: 繁 / 1: 簡 / 2: 英 / 3: 日 )
|
71
71
|
threeDSAuthInd: 'three_ds_auth_ind', # 3D 交易驗證類型,若該特店設定支援 3D 交易,前端未帶此欄位,則預設為 0101 (0101 表示支付類交易驗證(PA)的 Payment transaction。 0204 表示非支付類交易驗證(NPA)的 Add card。0205 表示非支付類交易驗證(NPA)的 Maintain card。 註:綁卡驗證應使用 0204 或 0205)
|
data/lib/focas/payment.rb
CHANGED
@@ -45,19 +45,11 @@ module Focas
|
|
45
45
|
@response['Status'] == 'SUCCESS'
|
46
46
|
end
|
47
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
48
|
private
|
57
49
|
|
58
50
|
def set_trade_info
|
59
51
|
options = Config.options
|
60
|
-
@trade_info = options.transform_keys(&:to_sym)
|
52
|
+
@trade_info = options.transform_keys(&:to_sym).to_h
|
61
53
|
|
62
54
|
individual_trade_info = {
|
63
55
|
lidm: @lidm, # 商店訂單編號,如:用途_日期時間戳記_流水號
|
@@ -67,7 +59,10 @@ module Focas
|
|
67
59
|
AuthResURL: @auth_res_url,
|
68
60
|
}
|
69
61
|
|
70
|
-
|
62
|
+
individual_trade_info.merge!(options[:trade_info]) if options[:trade_info]
|
63
|
+
|
64
|
+
# 同是 hash 再來 merge
|
65
|
+
@trade_info = (options.to_h.merge!(individual_trade_info)).transform_keys(&:to_sym)
|
71
66
|
end
|
72
67
|
end
|
73
68
|
end
|
data/lib/focas/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
Focas.configure do |config|
|
4
4
|
# ========
|
5
5
|
# 必要參數
|
6
6
|
# ========
|
@@ -47,8 +47,8 @@ focas.configure do |config|
|
|
47
47
|
# *[必] 網頁編碼格式(預設為 BIG5),所以必傳 "UTF-8"
|
48
48
|
config.encode_type = 'UTF-8'
|
49
49
|
|
50
|
-
# 設定交易逾時秒數,固定長度 3 位 (最大值為 600 秒)
|
51
|
-
config.timeout_secs = 600
|
50
|
+
# 設定交易逾時秒數,固定長度 3 位 (最大值為 600 秒),先不設定,使用 600 會錯
|
51
|
+
#config.timeout_secs = 600
|
52
52
|
|
53
53
|
# 交易幣別,固定長度 3 位 (901)
|
54
54
|
config.currency = 901
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: focas-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Lin (pct)
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|