pingan_api 0.0.5
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/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +16 -0
- data/lib/pingan_api/assistance_business.rb +27 -0
- data/lib/pingan_api/base.rb +45 -0
- data/lib/pingan_api/configuration.rb +43 -0
- data/lib/pingan_api/models/assistance/operation_send_request.rb +53 -0
- data/lib/pingan_api/models/assistance/operation_send_response.rb +25 -0
- data/lib/pingan_api/models/assistance/salvation_query_request.rb +25 -0
- data/lib/pingan_api/models/assistance/salvation_query_response.rb +41 -0
- data/lib/pingan_api/models/assistance/salvation_receive_request.rb +43 -0
- data/lib/pingan_api/models/assistance/salvation_receive_response.rb +26 -0
- data/lib/pingan_api/models/extensions/attributes.rb +28 -0
- data/lib/pingan_api/models/extensions/map.rb +50 -0
- data/lib/pingan_api/models/log.rb +16 -0
- data/lib/pingan_api/templates/assistance/operation_send_request.xml.erb +48 -0
- data/lib/pingan_api/templates/assistance/salvation_query_request.xml.erb +21 -0
- data/lib/pingan_api/templates/assistance/salvation_receive_response.xml.erb +22 -0
- data/lib/pingan_api/templates/samples/assistance/operation_send_request.xml.erb +87 -0
- data/lib/pingan_api/templates/samples/assistance/operation_send_response.xml.erb +33 -0
- data/lib/pingan_api/templates/samples/assistance/salvation_query_request.xml.erb +33 -0
- data/lib/pingan_api/templates/samples/assistance/salvation_query_response.xml.erb +67 -0
- data/lib/pingan_api/templates/samples/assistance/salvation_receive_request.xml.erb +69 -0
- data/lib/pingan_api/templates/samples/assistance/salvation_receive_response.xml.erb +35 -0
- data/lib/pingan_api/version.rb +3 -0
- data/lib/pingan_api.rb +27 -0
- data/pingan_api.gemspec +29 -0
- data/spec/assistance_bussiness_spec.rb +77 -0
- data/spec/insurance_spec.rb +41 -0
- data/spec/operation_receive_request_spec.rb +9 -0
- data/spec/samples/assistance/operation_send_request.xml.erb +87 -0
- data/spec/samples/assistance/operation_send_response.xml.erb +33 -0
- data/spec/samples/assistance/salvation_query_request.xml.erb +33 -0
- data/spec/samples/assistance/salvation_query_response.xml.erb +67 -0
- data/spec/samples/assistance/salvation_receive_request.xml.erb +69 -0
- data/spec/samples/assistance/salvation_receive_response.xml.erb +35 -0
- data/spec/spec_helper.rb +64 -0
- data/test/test_assistance_bussiness.rb +15 -0
- data/test/test_helper.rb +3 -0
- data/test/test_pingan_api.rb +22 -0
- metadata +183 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8838d16ebe982d2c5d9a90d89bf12d5192bfc8d1
|
4
|
+
data.tar.gz: bfe45697a6a62ab27c44e2b23507cb8c24bef685
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6f8864152fd24a03444c9078c3ae41890c0edef12453d5ca430fa1775ee0ed30d1ad054b4fd2e08c0f28c4dc6f1d3f158035f70e9c81a7c53bd99fc4906c7f23
|
7
|
+
data.tar.gz: b78742badfcf93bebd37073a512c783574861bae939fd96843b90e0d37ed07c8a6bb878ad759cd39ec463de5fc9be0e7b3a592bcc56161fc15717e5a861b7c71
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 liuzelei
|
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,29 @@
|
|
1
|
+
# 平安银行api
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'pingan_api'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install pingan_api
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
require 'rake/testtask'
|
5
|
+
desc 'Run tests on PaperTrail with Test::Unit.'
|
6
|
+
Rake::TestTask.new(:test) do |t|
|
7
|
+
t.libs << 'lib'
|
8
|
+
t.libs << 'test'
|
9
|
+
end
|
10
|
+
|
11
|
+
require 'rspec/core/rake_task'
|
12
|
+
desc 'Run PaperTrail specs for the RSpec helper.'
|
13
|
+
RSpec::Core::RakeTask.new(:spec)
|
14
|
+
|
15
|
+
desc 'Default: run all available test suites'
|
16
|
+
task :default => [:test, :spec]
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module PinganApi
|
3
|
+
class AssistanceBusiness < PinganApi::Base
|
4
|
+
|
5
|
+
# 接收平安银行推送过来的救援请求
|
6
|
+
def receive_salvation(body)
|
7
|
+
return PinganApi::Models::Assistance::SalvationReceiveRequest.from_xml(body)
|
8
|
+
end
|
9
|
+
|
10
|
+
# 返回数据给平安
|
11
|
+
def receive_salvation_response(data)
|
12
|
+
return data.get_result(PinganApi.config.salvation_receive_response_template)
|
13
|
+
end
|
14
|
+
|
15
|
+
# 发送救援执行情况给平安银行
|
16
|
+
def send_operation(operation)
|
17
|
+
data = send_request_with_data_and_template(operation, PinganApi.config.operation_send_request_template)
|
18
|
+
return PinganApi::Models::Assistance::OperationSendResponse.from_xml(data)
|
19
|
+
end
|
20
|
+
|
21
|
+
# 向平安银行查询指定的救援请求
|
22
|
+
def query_salvation(salvation_query)
|
23
|
+
data = send_request_with_data_and_template(salvation_query, PinganApi.config.salvation_query_request_template)
|
24
|
+
return PinganApi::Models::Assistance::SalvationQueryResponse.from_xml(data)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
|
3
|
+
module PinganApi
|
4
|
+
class Base
|
5
|
+
|
6
|
+
def send_request_with_data_and_template(data, template_path)
|
7
|
+
erb = ERB.new(File.read(template_path))
|
8
|
+
body = erb.result(data.get_binding)
|
9
|
+
return send_request(body)
|
10
|
+
end
|
11
|
+
|
12
|
+
def send_request(body)
|
13
|
+
#File.open("tmp/#{Time.now.to_i}.xml", "w") { |file| file.write body }
|
14
|
+
uri = URI(PinganApi.config.server)
|
15
|
+
|
16
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
17
|
+
http.use_ssl = true if uri.scheme == "https"
|
18
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
19
|
+
|
20
|
+
pem = File.read(PinganApi.config.cert)
|
21
|
+
http.cert = OpenSSL::X509::Certificate.new(pem)
|
22
|
+
http.key = OpenSSL::PKey::RSA.new(pem)
|
23
|
+
|
24
|
+
request = Net::HTTP::Post.new("/", initheader = {'Content-Type' =>'text/html;charset=GBK'})
|
25
|
+
request.body = body.encode('gbk')
|
26
|
+
|
27
|
+
return send_request_and_log(http, request)
|
28
|
+
end
|
29
|
+
|
30
|
+
def send_request_and_log(http, request)
|
31
|
+
#log = PinganApi::Models::Log.new
|
32
|
+
# TODO,save request
|
33
|
+
#log.write_request(request)
|
34
|
+
#begin
|
35
|
+
# TODO, save response
|
36
|
+
res = http.request(request)
|
37
|
+
#log.write_response(res)
|
38
|
+
return res.body
|
39
|
+
#rescue => e
|
40
|
+
#log.write_error(e.to_s)
|
41
|
+
# return nil
|
42
|
+
#end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module PinganApi
|
2
|
+
class Configuration
|
3
|
+
def server
|
4
|
+
@server ||= "https://222.68.184.181:8007"
|
5
|
+
end
|
6
|
+
|
7
|
+
def server=(server)
|
8
|
+
@server = server
|
9
|
+
end
|
10
|
+
|
11
|
+
def cert
|
12
|
+
@cert ||= "config/certs/pingan_api.pem"
|
13
|
+
end
|
14
|
+
|
15
|
+
def cert=(cert)
|
16
|
+
@cert = cert
|
17
|
+
end
|
18
|
+
|
19
|
+
def salvation_receive_response_template
|
20
|
+
@salvation_receive_response_template ||= File.join(File.dirname(File.expand_path(__FILE__)), "templates/assistance/salvation_receive_response.xml.erb")
|
21
|
+
end
|
22
|
+
|
23
|
+
def salvation_receive_response_template=(template)
|
24
|
+
@salvation_receive_response_template = template
|
25
|
+
end
|
26
|
+
|
27
|
+
def salvation_query_request_template
|
28
|
+
@salvation_query_request_template ||= File.join(File.dirname(File.expand_path(__FILE__)), "templates/assistance/salvation_query_request.xml.erb")
|
29
|
+
end
|
30
|
+
|
31
|
+
def salvation_query_request_template=(template)
|
32
|
+
@salvation_query_request_template = template
|
33
|
+
end
|
34
|
+
|
35
|
+
def operation_send_request_template
|
36
|
+
@operation_send_request_template ||= File.join(File.dirname(File.expand_path(__FILE__)), "templates/assistance/operation_send_request.xml.erb")
|
37
|
+
end
|
38
|
+
|
39
|
+
def operation_send_request_template=(template)
|
40
|
+
@operation_send_request_template = template
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'pingan_api/models/extensions/attributes'
|
2
|
+
require 'pingan_api/models/extensions/map'
|
3
|
+
|
4
|
+
module PinganApi
|
5
|
+
module Models
|
6
|
+
module Assistance
|
7
|
+
class OperationSendRequest
|
8
|
+
include PinganApi::Models::Extensions::Attributes
|
9
|
+
include PinganApi::Models::Extensions::Map
|
10
|
+
|
11
|
+
attr_accessor :tran_code,
|
12
|
+
:bank_code,
|
13
|
+
:brno,
|
14
|
+
:tellerno,
|
15
|
+
:bk_acct_datetime,
|
16
|
+
:bk_serial,
|
17
|
+
:bk_orgn_sril,
|
18
|
+
:bk_tran_chnl,
|
19
|
+
:region_code,
|
20
|
+
:salvation_id,
|
21
|
+
:malfunction_type,
|
22
|
+
:salvation_type_act,
|
23
|
+
:begin_point,
|
24
|
+
:salvation_fee_type,
|
25
|
+
:salvation_state,
|
26
|
+
:date_connecting,
|
27
|
+
:date_dispatch,
|
28
|
+
:date_arrive,
|
29
|
+
:date_finished,
|
30
|
+
:drag_distance,
|
31
|
+
:salvation_result,
|
32
|
+
:quit_reason,
|
33
|
+
:other_info,
|
34
|
+
:salvation_fee,
|
35
|
+
:insured_status,
|
36
|
+
:end_point,
|
37
|
+
:salvation_fee_pt,
|
38
|
+
:salvation_object_aa,
|
39
|
+
:salvation_help_time,
|
40
|
+
:salvation_person_name,
|
41
|
+
:salvation_person_telno,
|
42
|
+
:salvation_intending_time,
|
43
|
+
:salvation_person_workno,
|
44
|
+
:salvation_inteding_time,
|
45
|
+
:act_gps_x,
|
46
|
+
:act_gps_y,
|
47
|
+
:act_salvation_place,
|
48
|
+
:salvation_factory_id,
|
49
|
+
:salvation_person_mobile_no
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'pingan_api/models/extensions/attributes'
|
2
|
+
require 'pingan_api/models/extensions/map'
|
3
|
+
|
4
|
+
module PinganApi
|
5
|
+
module Models
|
6
|
+
module Assistance
|
7
|
+
class OperationSendResponse
|
8
|
+
include PinganApi::Models::Extensions::Attributes
|
9
|
+
include PinganApi::Models::Extensions::Map
|
10
|
+
|
11
|
+
attr_accessor :tran_code,
|
12
|
+
:bank_code,
|
13
|
+
:bk_serial,
|
14
|
+
:pa_acct_datetime,
|
15
|
+
:business_no,
|
16
|
+
:ft_serial,
|
17
|
+
:region_code,
|
18
|
+
:pa_rslt_code,
|
19
|
+
:pa_rslt_mesg,
|
20
|
+
:salvation_id,
|
21
|
+
:result_time
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'pingan_api/models/extensions/attributes'
|
2
|
+
require 'pingan_api/models/extensions/map'
|
3
|
+
|
4
|
+
module PinganApi
|
5
|
+
module Models
|
6
|
+
module Assistance
|
7
|
+
class SalvationQueryRequest
|
8
|
+
include PinganApi::Models::Extensions::Attributes
|
9
|
+
include PinganApi::Models::Extensions::Map
|
10
|
+
|
11
|
+
attr_accessor :tran_code,
|
12
|
+
:bank_code,
|
13
|
+
:brno,
|
14
|
+
:tellerno,
|
15
|
+
:bk_acct_datetime,
|
16
|
+
:bk_serial,
|
17
|
+
:bk_orgn_sril,
|
18
|
+
:bk_tran_chnl,
|
19
|
+
:region_code,
|
20
|
+
:salvation_id,
|
21
|
+
:salvation_factory_id
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'pingan_api/models/extensions/attributes'
|
2
|
+
require 'pingan_api/models/extensions/map'
|
3
|
+
|
4
|
+
module PinganApi
|
5
|
+
module Models
|
6
|
+
module Assistance
|
7
|
+
class SalvationQueryResponse
|
8
|
+
include PinganApi::Models::Extensions::Attributes
|
9
|
+
include PinganApi::Models::Extensions::Map
|
10
|
+
|
11
|
+
attr_accessor :tran_code,
|
12
|
+
:bank_code,
|
13
|
+
:bk_serial,
|
14
|
+
:pa_acct_datetime,
|
15
|
+
:business_no,
|
16
|
+
:ft_serial,
|
17
|
+
:region_code,
|
18
|
+
:pa_rslt_code,
|
19
|
+
:pa_rslt_mesg,
|
20
|
+
:salvation_id,
|
21
|
+
:report_name,
|
22
|
+
:salvation_object,
|
23
|
+
:car_mark,
|
24
|
+
:car_type,
|
25
|
+
:salvation_type,
|
26
|
+
:dep_code,
|
27
|
+
:damage_time,
|
28
|
+
:damage_place,
|
29
|
+
:insured_name,
|
30
|
+
:supplement_info,
|
31
|
+
:operator_id,
|
32
|
+
:callerno,
|
33
|
+
:salvation_fee,
|
34
|
+
:obligate_field,
|
35
|
+
:gps_x,
|
36
|
+
:gps_y,
|
37
|
+
:data_source
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'pingan_api/models/extensions/attributes'
|
2
|
+
require 'pingan_api/models/extensions/map'
|
3
|
+
|
4
|
+
module PinganApi
|
5
|
+
module Models
|
6
|
+
module Assistance
|
7
|
+
class SalvationReceiveRequest
|
8
|
+
include PinganApi::Models::Extensions::Attributes
|
9
|
+
include PinganApi::Models::Extensions::Map
|
10
|
+
|
11
|
+
attr_accessor :tran_code,
|
12
|
+
:bank_code,
|
13
|
+
:brno,
|
14
|
+
:tellerno,
|
15
|
+
:bk_acct_datetime,
|
16
|
+
:bk_serial,
|
17
|
+
:bk_orgn_sril,
|
18
|
+
:bk_tran_chnl,
|
19
|
+
:region_code,
|
20
|
+
:salvation_id,
|
21
|
+
:report_name,
|
22
|
+
:report_telephone,
|
23
|
+
:salvation_object,
|
24
|
+
:car_mark,
|
25
|
+
:salvation_type,
|
26
|
+
:dep_code,
|
27
|
+
:damage_time,
|
28
|
+
:damage_place,
|
29
|
+
:insured_name,
|
30
|
+
:supplement_info,
|
31
|
+
:operator_id,
|
32
|
+
:callerno,
|
33
|
+
:salvation_fee_type,
|
34
|
+
:obligate_field,
|
35
|
+
:gps_x,
|
36
|
+
:gps_y,
|
37
|
+
:salvation_factory_id,
|
38
|
+
:data_source
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'pingan_api/models/extensions/attributes'
|
2
|
+
require 'pingan_api/models/extensions/map'
|
3
|
+
|
4
|
+
module PinganApi
|
5
|
+
module Models
|
6
|
+
module Assistance
|
7
|
+
class SalvationReceiveResponse
|
8
|
+
include PinganApi::Models::Extensions::Attributes
|
9
|
+
include PinganApi::Models::Extensions::Map
|
10
|
+
|
11
|
+
attr_accessor :tran_code,
|
12
|
+
:bank_code,
|
13
|
+
:bk_serial,
|
14
|
+
:pa_acct_datetime,
|
15
|
+
:business_no,
|
16
|
+
:ft_serial,
|
17
|
+
:region_code,
|
18
|
+
:pa_rslt_code,
|
19
|
+
:pa_rslt_mesg,
|
20
|
+
:salvation_id,
|
21
|
+
:result_time,
|
22
|
+
:salvation_factory_id
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module PinganApi
|
2
|
+
module Models
|
3
|
+
module Extensions
|
4
|
+
module Attributes
|
5
|
+
def self.included(base)
|
6
|
+
def base.attr_names
|
7
|
+
@_list_attr ||= []
|
8
|
+
end
|
9
|
+
|
10
|
+
def base.attr_accessor(*names)
|
11
|
+
attr_names.concat(names)
|
12
|
+
super(*names)
|
13
|
+
end
|
14
|
+
|
15
|
+
def base.attr_reader(*names)
|
16
|
+
attr_names.concat(names)
|
17
|
+
super(*names)
|
18
|
+
end
|
19
|
+
|
20
|
+
def base.attr_writer(*names)
|
21
|
+
attr_names.concat(names)
|
22
|
+
super(*names)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'erb'
|
2
|
+
|
3
|
+
module PinganApi
|
4
|
+
module Models
|
5
|
+
module Extensions
|
6
|
+
module Map
|
7
|
+
|
8
|
+
def get_binding
|
9
|
+
binding
|
10
|
+
end
|
11
|
+
|
12
|
+
def get_result(template_path)
|
13
|
+
erb = ERB.new(File.read(template_path))
|
14
|
+
return erb.result(self.get_binding)
|
15
|
+
end
|
16
|
+
|
17
|
+
def mapping(hash)
|
18
|
+
self.class.attr_names.each do |a|
|
19
|
+
self.send("#{a.to_s}=", hash[a.upcase.to_s])
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def to_hash
|
24
|
+
hash = {}
|
25
|
+
self.instance_variables.each do |var|
|
26
|
+
hash[var.to_s.delete("@")] = self.instance_variable_get(var)
|
27
|
+
end
|
28
|
+
return hash
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.included(base)
|
32
|
+
def base.from_xml(xml)
|
33
|
+
hash = Hash.from_xml(xml)
|
34
|
+
hash_all = nil
|
35
|
+
unless hash["Response"].nil?
|
36
|
+
hash_all = hash["Response"]["Head"].merge(hash["Response"]["Body"]["Apply"])
|
37
|
+
end
|
38
|
+
unless hash["Request"].nil?
|
39
|
+
hash_all = hash["Request"]["Head"].merge(hash["Request"]["Body"]["Apply"])
|
40
|
+
end
|
41
|
+
|
42
|
+
instance = self.new
|
43
|
+
instance.mapping(hash_all)
|
44
|
+
return instance
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'mongoid'
|
2
|
+
module PinganApi
|
3
|
+
module Models
|
4
|
+
class Log
|
5
|
+
include Mongoid::Document
|
6
|
+
|
7
|
+
field :request_at, type: DateTime
|
8
|
+
field :request_body, type: String
|
9
|
+
|
10
|
+
field :response_at, type: DateTime
|
11
|
+
field :response_body, type: String
|
12
|
+
field :response_status, type: String
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<?xml version="1.0" encoding="GBK" ?>
|
2
|
+
<Request>
|
3
|
+
<Head>
|
4
|
+
<TRAN_CODE><%= tran_code %></TRAN_CODE>
|
5
|
+
<BANK_CODE><%= bank_code %></BANK_CODE>
|
6
|
+
<BRNO><%= brno %></BRNO>
|
7
|
+
<TELLERNO><%= tellerno %></TELLERNO>
|
8
|
+
<BK_ACCT_DATE><%= bk_acct_datetime.strftime('%Y%m%d') %></BK_ACCT_DATE>
|
9
|
+
<BK_ACCT_TIME><%= bk_acct_datetime.strftime('%H%M%S') %></BK_ACCT_TIME>
|
10
|
+
<BK_SERIAL><%= bk_serial %></BK_SERIAL>
|
11
|
+
<BK_ORGN_SRIL><%= bk_orgn_sril %></BK_ORGN_SRIL>
|
12
|
+
<BK_TRAN_CHNL><%= bk_tran_chnl %></BK_TRAN_CHNL>
|
13
|
+
<REGION_CODE><%= region_code %></REGION_CODE>
|
14
|
+
</Head>
|
15
|
+
<Body>
|
16
|
+
<Apply>
|
17
|
+
<SALVATION_ID><%= salvation_id %></SALVATION_ID>
|
18
|
+
<MALFUNCTION_TYPE><%= malfunction_type %></MALFUNCTION_TYPE>
|
19
|
+
<SALVATION_TYPE_ACT><%= salvation_type_act %></SALVATION_TYPE_ACT>
|
20
|
+
<BEGIN_POINT><%= begin_point %></BEGIN_POINT>
|
21
|
+
<SALVATION_FEE_TYPE><%= salvation_fee_type %></SALVATION_FEE_TYPE>
|
22
|
+
<SALVATION_STATE><%= salvation_state %></SALVATION_STATE>
|
23
|
+
<DATE_CONNECTING><%= date_connecting %></DATE_CONNECTING>
|
24
|
+
<DATE_DISPATCH><%= date_dispatch %></DATE_DISPATCH>
|
25
|
+
<DATE_ARRIVE><%= date_arrive %></DATE_ARRIVE>
|
26
|
+
<DATE_FINISHED><%= date_finished %></DATE_FINISHED>
|
27
|
+
<DRAG_DISTANCE><%= drag_distance %></DRAG_DISTANCE>
|
28
|
+
<SALVATION_RESULT><%= salvation_result %></SALVATION_RESULT>
|
29
|
+
<QUIT_REASON><%= quit_reason %></QUIT_REASON>
|
30
|
+
<OTHER_INFO><%= other_info %></OTHER_INFO>
|
31
|
+
<SALVATION_FEE><%= salvation_fee %></SALVATION_FEE>
|
32
|
+
<INSURED_STATUS><%= insured_status %></INSURED_STATUS>
|
33
|
+
<END_POINT><%= end_point %></END_POINT>
|
34
|
+
<SALVATION_FEE_PT><%= salvation_fee_pt %></SALVATION_FEE_PT>
|
35
|
+
<SALVATION_OBJECT_AA><%= salvation_object_aa %></SALVATION_OBJECT_AA>
|
36
|
+
<SALVATION_HELP_TIME><%= salvation_help_time %></SALVATION_HELP_TIME>
|
37
|
+
<SALVATION_PERSON_NAME><%= salvation_person_name %></SALVATION_PERSON_NAME>
|
38
|
+
<SALVATION_PERSON_TELNO><%= salvation_person_telno %></SALVATION_PERSON_TELNO>
|
39
|
+
<SALVATION_PERSON_WORKNO><%= salvation_person_workno %></SALVATION_PERSON_WORKNO>
|
40
|
+
<SALVATION_INTENDING_TIME><%= salvation_intending_time %></SALVATION_INTENDING_TIME>
|
41
|
+
<ACT_GPS_X><%= act_gps_x %></ACT_GPS_X>
|
42
|
+
<ACT_GPS_Y><%= act_gps_y %></ACT_GPS_Y>
|
43
|
+
<ACT_SALVATION_PLACE><%= act_salvation_place %></ACT_SALVATION_PLACE>
|
44
|
+
<SALVATION_FACTORY_ID><%= salvation_factory_id %></SALVATION_FACTORY_ID>
|
45
|
+
<SALVATION_PERSON_MOBILE_NO><%= salvation_person_mobile_no %></SALVATION_PERSON_MOBILE_NO>
|
46
|
+
</Apply>
|
47
|
+
</Body>
|
48
|
+
</Request>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<?xml version="1.0" encoding="GBK" ?>
|
2
|
+
<Request>
|
3
|
+
<Head>
|
4
|
+
<TRAN_CODE><%= tran_code %></TRAN_CODE>
|
5
|
+
<BANK_CODE><%= bank_code %></BANK_CODE>
|
6
|
+
<BRNO><%= brno %></BRNO>
|
7
|
+
<TELLERNO><%= tellerno %></TELLERNO>
|
8
|
+
<BK_ACCT_DATE><%= bk_acct_datetime.strftime('%Y%m%d') %></BK_ACCT_DATE>
|
9
|
+
<BK_ACCT_TIME><%= bk_acct_datetime.strftime('%H%M%S') %></BK_ACCT_TIME>
|
10
|
+
<BK_SERIAL><%= bk_serial %></BK_SERIAL>
|
11
|
+
<BK_ORGN_SRIL><%= bk_orgn_sril %></BK_ORGN_SRIL>
|
12
|
+
<BK_TRAN_CHNL><%= bk_tran_chnl %></BK_TRAN_CHNL>
|
13
|
+
<REGION_CODE><%= region_code %></REGION_CODE>
|
14
|
+
</Head>
|
15
|
+
<Body>
|
16
|
+
<Apply>
|
17
|
+
<SALVATION_ID><%= salvation_id %></SALVATION_ID>
|
18
|
+
<SALVATION_FACTORY_ID><%= salvation_factory_id %></SALVATION_FACTORY_ID>
|
19
|
+
</Apply>
|
20
|
+
</Body>
|
21
|
+
</Request>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<?xml version="1.0" encoding="GBK" ?>
|
2
|
+
<Response>
|
3
|
+
<Head>
|
4
|
+
<TRAN_CODE><%= tran_code %></TRAN_CODE>
|
5
|
+
<BANK_CODE><%= bank_code %></BANK_CODE>
|
6
|
+
<BK_SERIAL><%= bk_serial %></BK_SERIAL>
|
7
|
+
<PA_ACCT_DATE><%= pa_acct_datetime.strftime('%Y%m%d') %></PA_ACCT_DATE>
|
8
|
+
<PA_ACCT_TIME><%= pa_acct_datetime.strftime('%H%M%S') %></PA_ACCT_TIME>
|
9
|
+
<BUSINESS_NO><%= business_no %></BUSINESS_NO>
|
10
|
+
<FT_SERIAL><%= ft_serial %></FT_SERIAL>
|
11
|
+
<REGION_CODE><%= region_code %></REGION_CODE>
|
12
|
+
<PA_RSLT_CODE><%= pa_rslt_code %></PA_RSLT_CODE>
|
13
|
+
<PA_RSLT_MESG><%= pa_rslt_mesg %></PA_RSLT_MESG>
|
14
|
+
</Head>
|
15
|
+
<Body>
|
16
|
+
<Apply>
|
17
|
+
<SALVATION_ID><%= salvation_id %></SALVATION_ID>
|
18
|
+
<RESULT_TIME><%= result_time %></RESULT_TIME>
|
19
|
+
<SALVATION_FACTORY_ID><%= salvation_factory_id %></SALVATION_FACTORY_ID>
|
20
|
+
</Apply>
|
21
|
+
</Body>
|
22
|
+
</Response>
|