iso8583-mkb 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/iso8583-mkb/authorization.rb +2 -8
- data/lib/iso8583-mkb/iso8583_connection.rb +0 -4
- data/lib/iso8583-mkb/iso8583_transaction.rb +1 -1
- data/lib/iso8583-mkb/request.rb +3 -5
- data/lib/iso8583-mkb/reversal.rb +1 -4
- data/lib/iso8583-mkb/synchronous_gateway.rb +15 -1
- data/lib/iso8583-mkb/version.rb +1 -1
- metadata +2 -2
@@ -39,23 +39,17 @@ module ISO8583::MKB
|
|
39
39
|
build_class
|
40
40
|
|
41
41
|
def reverse
|
42
|
-
reversal = Reversal.new
|
42
|
+
reversal = Reversal.new(@transaction)
|
43
43
|
|
44
44
|
[
|
45
45
|
:pan, :processing_code, :amount, :expiry, :merchant_type,
|
46
46
|
:acquirer_country, :entry_mode, :condition_code, :acquirer,
|
47
|
-
:currency
|
47
|
+
:currency, :additional , :terminal_id, :acceptor_id, :acceptor_name
|
48
48
|
].each do |key|
|
49
49
|
reversal.send :"#{key}=", instance_variable_get(:"@#{key}")
|
50
50
|
end
|
51
51
|
|
52
|
-
reversal.auth_id = @auth_id
|
53
52
|
reversal.response_code = @status
|
54
|
-
reversal.original_data = sprintf("%04d%06d%10s%011d%011d",
|
55
|
-
@request.request.mti,
|
56
|
-
@transaction.trace,
|
57
|
-
@request.request["Transmission Date and Time"].strftime("%m%d%H%M%S"),
|
58
|
-
@acquirer, @acquirer).to_i
|
59
53
|
|
60
54
|
reversal
|
61
55
|
end
|
@@ -149,8 +149,6 @@ module ISO8583::MKB
|
|
149
149
|
private
|
150
150
|
|
151
151
|
def send_ping
|
152
|
-
Logging.logger.debug "Ping"
|
153
|
-
|
154
152
|
@ping_timer = nil
|
155
153
|
|
156
154
|
transaction = @gateway.new_transaction
|
@@ -171,8 +169,6 @@ module ISO8583::MKB
|
|
171
169
|
|
172
170
|
close_connection_after_writing
|
173
171
|
else
|
174
|
-
Logging.logger.debug "Pong"
|
175
|
-
|
176
172
|
@ping_timer = EventMachine.add_timer(60, method(:send_ping))
|
177
173
|
end
|
178
174
|
end
|
@@ -23,7 +23,7 @@ module ISO8583::MKB
|
|
23
23
|
|
24
24
|
def request(&block)
|
25
25
|
message = MKBMessage.new
|
26
|
-
message["Transmission Date and Time"] =
|
26
|
+
message["Transmission Date and Time"] = @started_at
|
27
27
|
message["Systems Trace Audit Number"] = @trace
|
28
28
|
message["Time, Local Transaction"] = @started_at
|
29
29
|
message["Date, Local Transaction"] = @started_at
|
data/lib/iso8583-mkb/request.rb
CHANGED
@@ -19,12 +19,13 @@ module ISO8583::MKB
|
|
19
19
|
attr_accessor :retries
|
20
20
|
attr_accessor :timeout
|
21
21
|
|
22
|
-
def initialize
|
22
|
+
def initialize(transaction)
|
23
23
|
@retries = 4
|
24
24
|
@timeout = 60
|
25
25
|
@retry_with = nil
|
26
26
|
@complete = nil
|
27
27
|
@request = nil
|
28
|
+
@transaction = transaction
|
28
29
|
end
|
29
30
|
|
30
31
|
def success?
|
@@ -35,9 +36,7 @@ module ISO8583::MKB
|
|
35
36
|
Errors.error @status
|
36
37
|
end
|
37
38
|
|
38
|
-
def submit(
|
39
|
-
@transaction = gateway.new_transaction
|
40
|
-
|
39
|
+
def submit(&complete)
|
41
40
|
translated_fields = {}
|
42
41
|
|
43
42
|
self.class.const_get(:MANDATORY).each do |key, iso8583_name|
|
@@ -112,7 +111,6 @@ module ISO8583::MKB
|
|
112
111
|
|
113
112
|
def complete_request(status)
|
114
113
|
@status = status
|
115
|
-
@transaction.complete
|
116
114
|
|
117
115
|
complete, @complete = @complete, nil
|
118
116
|
complete.call self
|
data/lib/iso8583-mkb/reversal.rb
CHANGED
@@ -14,10 +14,7 @@ module ISO8583::MKB
|
|
14
14
|
"condition_code" => "Point of Service Condition Code",
|
15
15
|
"acquirer" => "Acquiring Institution ID code",
|
16
16
|
"currency" => "Currency Code, Transaction",
|
17
|
-
"
|
18
|
-
"response_code" => "Response Code",
|
19
|
-
"reason" => "Message Reason Code",
|
20
|
-
"original_data" => "Original Data Elements"
|
17
|
+
"response_code" => "Response Code"
|
21
18
|
}
|
22
19
|
|
23
20
|
OPTIONAL = {
|
@@ -32,12 +32,26 @@ module ISO8583::MKB
|
|
32
32
|
queue = Queue.new
|
33
33
|
|
34
34
|
EventMachine.schedule do
|
35
|
-
request.submit
|
35
|
+
request.submit { queue.push nil }
|
36
36
|
end
|
37
37
|
|
38
38
|
queue.pop
|
39
39
|
end
|
40
40
|
|
41
|
+
def transaction(&block)
|
42
|
+
queue = Queue.new
|
43
|
+
|
44
|
+
EventMachine.schedule { queue.push @gateway.new_transaction }
|
45
|
+
|
46
|
+
transaction = queue.pop
|
47
|
+
|
48
|
+
begin
|
49
|
+
yield transaction
|
50
|
+
ensure
|
51
|
+
EventMachine.schedule { transaction.complete }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
41
55
|
private
|
42
56
|
|
43
57
|
def thread(config)
|
data/lib/iso8583-mkb/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iso8583-mkb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: iso8583
|