hncb_e_atm 0.0.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 +15 -0
- data/.gitignore +20 -0
- data/.rvmrc +1 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +91 -0
- data/Rakefile +10 -0
- data/hncb_e_atm.gemspec +25 -0
- data/lib/generators/hncb_e_atm/install_generator.rb +13 -0
- data/lib/generators/hncb_e_atm/templates/config.yml +20 -0
- data/lib/hncb_e_atm/form.rb +43 -0
- data/lib/hncb_e_atm/railtie.rb +18 -0
- data/lib/hncb_e_atm/utils.rb +10 -0
- data/lib/hncb_e_atm/version.rb +3 -0
- data/lib/hncb_e_atm/view_helpers.rb +31 -0
- data/lib/hncb_e_atm.rb +37 -0
- data/spec/lib/hncb_e_atm/form_spec.rb +39 -0
- data/spec/lib/hncb_e_atm/view_helpers_spec.rb +51 -0
- data/spec/lib/hncb_e_atm_spec.rb +21 -0
- metadata +121 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NTg2MGJiY2YyNzQ0MjVhMmRiMjAyOTk2OWVmZTI2YmE4MTI5NGUyNw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MGNhMGJjN2IyNmU4YjkzNDk5MzliZjA4ODVlNzljOWUwOTgxYWRiZg==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MzU4Yzk0MTAzNDU4NDU2ZmFmMWY3ZGRkY2M1Y2E5YjYzYWU0MGE3ZWM4NTQw
|
10
|
+
MWZmOGQzYjI0MTA1ZDE1ZGI1OGEyZjJhMzU5ZGI4MWVhMjcxZTNjYzE1MjU3
|
11
|
+
YTU5YWZiOTY4YjNkZjZkZjJkNmI1MjQ2MjcxZDM1NDUzYzU4NTM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MzFiOTU2ZGViNmZiOWRhMTc5MDkzYjA1OTQ2ZWFmNGM5YWQzMWY4N2VkNzhi
|
14
|
+
YWU4ZjY5NTFlMmM2OWM0YTE4ZGJlZWU4MWJmZmYwMTI0OTRlZmYwOWNlYWIy
|
15
|
+
NmMyOWY3ODBkZTY4Mzk1ZGM0MzRiYjZlNzY5NmQzZWI0NjJiM2Q=
|
data/.gitignore
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use ruby-1.9.3@hncb_e_atm --create
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Hao Liu
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
# HncbEAtm
|
2
|
+
|
3
|
+
A simple Hncb Eatm ruby gem, without unnecessary magic or wraper, it's directly facing how Hncb Eatm api works.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'hncb_e_atm'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install hncb_e_atm
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
$ rails g hncb_e_atm:install
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
### Generate payment url
|
26
|
+
you have two selections
|
27
|
+
|
28
|
+
1. generator url directly
|
29
|
+
```ruby
|
30
|
+
options = {
|
31
|
+
StoreID: "008757080070001ABCD1310",
|
32
|
+
StoreAcnt: "100200000025",
|
33
|
+
StoreTxDate: "2005-11-10",
|
34
|
+
OrderNumber: "00001",
|
35
|
+
Amount: "10",
|
36
|
+
StoreName: "博客來網絡書店",
|
37
|
+
StoreURL: "http://10.8.61.71:8080/mctmk/eatm/Shopping_01.jsp",
|
38
|
+
SuccessURL: "http://10.8.61.71:8080/mctmk/eatm/Shopping_03OK.jsp",
|
39
|
+
FailURL: "http://10.8.61.71:8080/mctmk/eatm/Shopping_03NOK.jsp"
|
40
|
+
}
|
41
|
+
HncbEAtm::Service.create_trade(@options)
|
42
|
+
# => "https://www.smartatm.com.tw/eatm/servlet/TrxDispatcher?trx=com.eatm.wibc.trx.web.EAtmWShopping&state=prompt&val=...&mac=..."
|
43
|
+
```
|
44
|
+
You can redirect user to this payment url, and user will see a payment page for his/her order. NOTICE: use HTTP POST method
|
45
|
+
|
46
|
+
2. generate a form
|
47
|
+
```ruby
|
48
|
+
options = {
|
49
|
+
StoreID: "008757080070001ABCD1310",
|
50
|
+
StoreAcnt: "100200000025",
|
51
|
+
StoreTxDate: "2005-11-10",
|
52
|
+
OrderNumber: "00001",
|
53
|
+
Amount: "10",
|
54
|
+
StoreName: "博客來網絡書店",
|
55
|
+
StoreURL: "http://10.8.61.71:8080/mctmk/eatm/Shopping_01.jsp",
|
56
|
+
SuccessURL: "http://10.8.61.71:8080/mctmk/eatm/Shopping_03OK.jsp",
|
57
|
+
FailURL: "http://10.8.61.71:8080/mctmk/eatm/Shopping_03NOK.jsp"
|
58
|
+
}
|
59
|
+
HncbEAtm::Service.create_trade(@options)
|
60
|
+
hncb_e_atm_form_for(@options) do
|
61
|
+
"<input>Other</input>" #option
|
62
|
+
end
|
63
|
+
# => "<form action=..."
|
64
|
+
```
|
65
|
+
|
66
|
+
###callback
|
67
|
+
in the callback controller
|
68
|
+
```ruby
|
69
|
+
HncbEAtm::Notify.parse params
|
70
|
+
# => {
|
71
|
+
'StoreID' => "...",
|
72
|
+
'StoreAcnt' => "...",
|
73
|
+
'StoreTxDate' => "...",
|
74
|
+
'OrderNumber' => "...",
|
75
|
+
'Amount' => "...",
|
76
|
+
'StoreName' => "...",
|
77
|
+
'StoreURL' => "...",
|
78
|
+
'SuccessURL' => "...",
|
79
|
+
'FailURL' => "..."
|
80
|
+
}
|
81
|
+
# or => nil
|
82
|
+
```
|
83
|
+
###
|
84
|
+
|
85
|
+
## Contributing
|
86
|
+
|
87
|
+
1. Fork it
|
88
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
89
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
90
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
91
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/hncb_e_atm.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'hncb_e_atm/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "hncb_e_atm"
|
8
|
+
spec.version = HncbEAtm::VERSION
|
9
|
+
spec.authors = ["Hao Liu"]
|
10
|
+
spec.email = ["leomayleomay@gmail.com"]
|
11
|
+
spec.description = %q{eATM interface for 華南銀行(HNCB)}
|
12
|
+
spec.summary = %q{eATM interface for 華南銀行(HNCB)}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
spec.add_development_dependency "debugger"
|
25
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module HncbEAtm
|
4
|
+
class InstallGenerator < Rails::Generators::Base
|
5
|
+
source_root File.expand_path("../templates", __FILE__)
|
6
|
+
|
7
|
+
desc "HncbEAtm installation generator"
|
8
|
+
def install
|
9
|
+
template "config.yml", "config/hncb_e_atm.yml"
|
10
|
+
puts "HncbEAtm is installed."
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
test:
|
2
|
+
store_id: "008757080070001ABCD1310"
|
3
|
+
store_account: "100200000025"
|
4
|
+
store_name: "博客來網絡書店"
|
5
|
+
store_url: "http://10.8.61.71:8080/mctmk/eatm/Shopping_01.jsp"
|
6
|
+
debug: true
|
7
|
+
|
8
|
+
development:
|
9
|
+
store_id: "008757080070001ABCD1310"
|
10
|
+
store_account: "100200000025"
|
11
|
+
store_name: "博客來網絡書店"
|
12
|
+
store_url: "http://10.8.61.71:8080/mctmk/eatm/Shopping_01.jsp"
|
13
|
+
debug: true
|
14
|
+
|
15
|
+
production:
|
16
|
+
store_id: ""
|
17
|
+
store_account: ""
|
18
|
+
store_name: ""
|
19
|
+
store_url: ""
|
20
|
+
debug: false
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module HncbEAtm
|
2
|
+
class Form
|
3
|
+
REQUIRED_FIELDS = [
|
4
|
+
"store_id",
|
5
|
+
"store_account",
|
6
|
+
"store_transaction_date",
|
7
|
+
"order_number",
|
8
|
+
"amount",
|
9
|
+
"store_name",
|
10
|
+
"store_url",
|
11
|
+
"success_url",
|
12
|
+
"fail_url"
|
13
|
+
]
|
14
|
+
|
15
|
+
def initialize(params)
|
16
|
+
@params = HncbEAtm::Utils.stringfy_keys(params)
|
17
|
+
|
18
|
+
REQUIRED_FIELDS.each do |field|
|
19
|
+
next if @params.keys.include?(field) &&
|
20
|
+
@params.fetch(field).to_s.length > 0
|
21
|
+
|
22
|
+
raise ArgumentError.new("#{field} is a required field")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def serialize
|
27
|
+
{
|
28
|
+
"StoreID" => @params["store_id"] || HncbEAtm.store_id,
|
29
|
+
"StoreAcnt" => @params['store_account'] || HncbEAtm.store_account,
|
30
|
+
"StoreTxDate" => @params['store_transaction_date'],
|
31
|
+
"OrderNumber" => @params['order_number'],
|
32
|
+
"Amount" => @params['amount'],
|
33
|
+
"StoreName" => @params['store_name'] || HncbEAtm.store_name,
|
34
|
+
"StoreURL" => @params['store_url'] || HncbEAtm.store_url,
|
35
|
+
"SuccessURL" => @params['success_url'],
|
36
|
+
"FailURL" => @params['fail_url']
|
37
|
+
}.inject([]) do |fields, (key, value)|
|
38
|
+
fields << "#{key.to_s}=#{value.to_s}"
|
39
|
+
fields
|
40
|
+
end.join("&")
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module HncbEAtm
|
2
|
+
class Railtie < Rails::Railtie
|
3
|
+
initializer "hncb_e_atm.setup" do
|
4
|
+
ActionView::Base.send :include, HncbEAtm::ViewHelpers
|
5
|
+
|
6
|
+
config_file = Rails.root.join("config/hncb_e_atm.yml")
|
7
|
+
if config_file.file?
|
8
|
+
config = YAML.load_file(config_file)[Rails.env].freeze
|
9
|
+
|
10
|
+
HncbEAtm.store_id = config["store_id"]
|
11
|
+
HncbEAtm.store_account = config["store_account"]
|
12
|
+
HncbEAtm.store_name = config["store_name"]
|
13
|
+
HncbEAtm.store_url = config["store_url"]
|
14
|
+
HncbEAtm.debug = config["debug"]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'action_view'
|
2
|
+
require 'base64'
|
3
|
+
|
4
|
+
module HncbEAtm
|
5
|
+
module ViewHelpers
|
6
|
+
include ::ActionView::Helpers
|
7
|
+
include ::ActionView::Context
|
8
|
+
|
9
|
+
def hncb_e_atm_form_for(params, &block)
|
10
|
+
query_string = HncbEAtm::Form.new(params).serialize
|
11
|
+
val = Base64.encode64(query_string)
|
12
|
+
mac = Digest::SHA1.hexdigest(query_string).upcase
|
13
|
+
|
14
|
+
html_form = []
|
15
|
+
|
16
|
+
html_form << "<form action='"+HncbEAtm.endpoint+"' method='post'>"
|
17
|
+
html_form << "<input type='hidden' name='trx' value='com.eatm.wibc.trx.web.EAtmWShopping'>"
|
18
|
+
html_form << "<input type='hidden' name='state' value='prompt'>"
|
19
|
+
html_form << "<input type='hidden' name='val' value='#{val}'>"
|
20
|
+
html_form << "<input type='hidden' name='mac' value='#{mac}'>"
|
21
|
+
html_form << capture(&block) if block_given?
|
22
|
+
html_form << "</form>"
|
23
|
+
|
24
|
+
html_form = html_form.join("\n")
|
25
|
+
|
26
|
+
concat(html_form.respond_to?(:html_safe) ? html_form.html_safe : html_form)
|
27
|
+
|
28
|
+
nil
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/hncb_e_atm.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
require "hncb_e_atm/version"
|
2
|
+
require "hncb_e_atm/utils"
|
3
|
+
require "hncb_e_atm/view_helpers"
|
4
|
+
require "hncb_e_atm/form"
|
5
|
+
|
6
|
+
if defined?(Rails)
|
7
|
+
require 'hncb_e_atm/railtie'
|
8
|
+
require 'generators/hncb_e_atm/install_generator'
|
9
|
+
end
|
10
|
+
|
11
|
+
module HncbEAtm
|
12
|
+
GATEWAY_ENDPOINT = "https://www.smartatm.com.tw/eatm/servlet/TrxDispatcher"
|
13
|
+
SANDBOX_ENDPOINT = "https://210.65.217.216/eatm/servlet/TrxDispatcher"
|
14
|
+
|
15
|
+
class << self
|
16
|
+
attr_accessor :endpoint
|
17
|
+
attr_accessor :store_id
|
18
|
+
attr_accessor :store_account
|
19
|
+
attr_accessor :store_name
|
20
|
+
attr_accessor :store_url
|
21
|
+
attr_accessor :debug
|
22
|
+
|
23
|
+
def debug=(d)
|
24
|
+
@@debug = d
|
25
|
+
|
26
|
+
if @@debug
|
27
|
+
@@endpoint = SANDBOX_ENDPOINT
|
28
|
+
else
|
29
|
+
@@endpoint = GATEWAY_ENDPOINT
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def endpoint
|
34
|
+
@@endpoint ||= SANDBOX_ENDPOINT
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require File.expand_path('../../../lib/hncb_e_atm/form', File.dirname(__FILE__))
|
2
|
+
|
3
|
+
describe HncbEAtm::Form do
|
4
|
+
before do
|
5
|
+
@params = {
|
6
|
+
:store_id => "1",
|
7
|
+
:store_account => "2",
|
8
|
+
:store_transaction_date => Date.today,
|
9
|
+
:order_number => "3",
|
10
|
+
:amount => 12.44,
|
11
|
+
:store_name => "xinqianbi",
|
12
|
+
:store_url => "http://sandbox.xinqianbi.com",
|
13
|
+
:success_url => "http://sandbox.xinqianbi.com/transactions/succeed",
|
14
|
+
:fail_url => "http://sandbox.xinqianbi.com/transactions/fail"
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
HncbEAtm::Form::REQUIRED_FIELDS.each do |field|
|
19
|
+
it "should validate the presence of #{field}" do
|
20
|
+
@params.delete(field.to_sym)
|
21
|
+
|
22
|
+
lambda do
|
23
|
+
HncbEAtm::Form.new(@params)
|
24
|
+
end.should raise_error(ArgumentError, "#{field} is a required field")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "#serialize" do
|
29
|
+
it "should serialize the fields for the form" do
|
30
|
+
form = HncbEAtm::Form.new(@params)
|
31
|
+
|
32
|
+
form.serialize.should == "StoreID=1&StoreAcnt=2&StoreTxDate=#{Date.today.strftime("%Y-%m-%d")}&\
|
33
|
+
OrderNumber=3&Amount=12.44&StoreName=xinqianbi&\
|
34
|
+
StoreURL=http://sandbox.xinqianbi.com&\
|
35
|
+
SuccessURL=http://sandbox.xinqianbi.com/transactions/succeed&\
|
36
|
+
FailURL=http://sandbox.xinqianbi.com/transactions/fail"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path('../../../lib/hncb_e_atm', File.dirname(__FILE__))
|
4
|
+
require File.expand_path('../../../lib/hncb_e_atm/view_helpers', File.dirname(__FILE__))
|
5
|
+
|
6
|
+
describe HncbEAtm::ViewHelpers do
|
7
|
+
include HncbEAtm::ViewHelpers
|
8
|
+
|
9
|
+
before do
|
10
|
+
self.output_buffer = ""
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "#hncb_e_atm_form_for" do
|
14
|
+
let (:params) {
|
15
|
+
{
|
16
|
+
:store_id => "008757080070001ABCD1310",
|
17
|
+
:store_account => "100200000025",
|
18
|
+
:store_transaction_date => "2005-11-10",
|
19
|
+
:order_number => "00001",
|
20
|
+
:amount => "10",
|
21
|
+
:store_name => "博客來網絡書店",
|
22
|
+
:store_url => "http://10.8.61.71:8080/mctmk/eatm/Shopping_01.jsp",
|
23
|
+
:success_url => "http://10.8.61.71:8080/mctmk/eatm/Shopping_03OK.jsp",
|
24
|
+
:fail_url => "http://10.8.61.71:8080/mctmk/eatm/Shopping_03NOK.jsp"
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
before do
|
29
|
+
HncbEAtm.debug = true
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should generate a HTML form for the given parameters" do
|
33
|
+
expected_output = <<-FORM
|
34
|
+
<form action='https://210.65.217.216/eatm/servlet/TrxDispatcher' method='post'>
|
35
|
+
<input type='hidden' name='trx' value='com.eatm.wibc.trx.web.EAtmWShopping'>
|
36
|
+
<input type='hidden' name='state' value='prompt'>
|
37
|
+
<input type='hidden' name='val' value='U3RvcmVJRD0wMDg3NTcwODAwNzAwMDFBQkNEMTMxMCZTdG9yZUFjbnQ9MTAw\nMjAwMDAwMDI1JlN0b3JlVHhEYXRlPTIwMDUtMTEtMTAmT3JkZXJOdW1iZXI9\nMDAwMDEmQW1vdW50PTEwJlN0b3JlTmFtZT3ljZrlrqLkvobntrLntaHmm7jl\nupcmU3RvcmVVUkw9aHR0cDovLzEwLjguNjEuNzE6ODA4MC9tY3Rtay9lYXRt\nL1Nob3BwaW5nXzAxLmpzcCZTdWNjZXNzVVJMPWh0dHA6Ly8xMC44LjYxLjcx\nOjgwODAvbWN0bWsvZWF0bS9TaG9wcGluZ18wM09LLmpzcCZGYWlsVVJMPWh0\ndHA6Ly8xMC44LjYxLjcxOjgwODAvbWN0bWsvZWF0bS9TaG9wcGluZ18wM05P\nSy5qc3A=\n'>
|
38
|
+
<input type='hidden' name='mac' value='8E446B831D90EF4DC429DAA5FD82979580B53DAD'>
|
39
|
+
<%= submit_tag 'Pay Now!' %>
|
40
|
+
</form>
|
41
|
+
FORM
|
42
|
+
|
43
|
+
hncb_e_atm_form_for(params) do
|
44
|
+
"<%= submit_tag 'Pay Now!' %>"
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
self.output_buffer.should == expected_output.strip
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require File.expand_path("../../lib/hncb_e_atm", File.dirname(__FILE__))
|
2
|
+
|
3
|
+
describe HncbEAtm do
|
4
|
+
describe "#debug=" do
|
5
|
+
it "should set the API endpoint to SANDBOX_ENDPOINT if it's debug mode" do
|
6
|
+
HncbEAtm.endpoint = HncbEAtm::GATEWAY_ENDPOINT
|
7
|
+
|
8
|
+
HncbEAtm.debug = true
|
9
|
+
|
10
|
+
HncbEAtm.endpoint.should == HncbEAtm::SANDBOX_ENDPOINT
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should set the API endpoint to GATEWAY_ENDPOINT if it's not debug mode" do
|
14
|
+
HncbEAtm.endpoint = HncbEAtm::SANDBOX_ENDPOINT
|
15
|
+
|
16
|
+
HncbEAtm.debug = false
|
17
|
+
|
18
|
+
HncbEAtm.endpoint.should == HncbEAtm::GATEWAY_ENDPOINT
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hncb_e_atm
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Hao Liu
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-09-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: debugger
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: eATM interface for 華南銀行(HNCB)
|
70
|
+
email:
|
71
|
+
- leomayleomay@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- .gitignore
|
77
|
+
- .rvmrc
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- hncb_e_atm.gemspec
|
83
|
+
- lib/generators/hncb_e_atm/install_generator.rb
|
84
|
+
- lib/generators/hncb_e_atm/templates/config.yml
|
85
|
+
- lib/hncb_e_atm.rb
|
86
|
+
- lib/hncb_e_atm/form.rb
|
87
|
+
- lib/hncb_e_atm/railtie.rb
|
88
|
+
- lib/hncb_e_atm/utils.rb
|
89
|
+
- lib/hncb_e_atm/version.rb
|
90
|
+
- lib/hncb_e_atm/view_helpers.rb
|
91
|
+
- spec/lib/hncb_e_atm/form_spec.rb
|
92
|
+
- spec/lib/hncb_e_atm/view_helpers_spec.rb
|
93
|
+
- spec/lib/hncb_e_atm_spec.rb
|
94
|
+
homepage: ''
|
95
|
+
licenses:
|
96
|
+
- MIT
|
97
|
+
metadata: {}
|
98
|
+
post_install_message:
|
99
|
+
rdoc_options: []
|
100
|
+
require_paths:
|
101
|
+
- lib
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ! '>='
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ! '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
requirements: []
|
113
|
+
rubyforge_project:
|
114
|
+
rubygems_version: 2.1.3
|
115
|
+
signing_key:
|
116
|
+
specification_version: 4
|
117
|
+
summary: eATM interface for 華南銀行(HNCB)
|
118
|
+
test_files:
|
119
|
+
- spec/lib/hncb_e_atm/form_spec.rb
|
120
|
+
- spec/lib/hncb_e_atm/view_helpers_spec.rb
|
121
|
+
- spec/lib/hncb_e_atm_spec.rb
|