breadmachine 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
data/README
ADDED
File without changes
|
@@ -22,6 +22,8 @@ module BreadMachine
|
|
22
22
|
autoload :St3dAuthRequest, 'breadmachine/secure_trading/st_3d_auth_request'
|
23
23
|
autoload :St3dAuthResponse, 'breadmachine/secure_trading/st_3d_auth_response'
|
24
24
|
|
25
|
+
autoload :Request, 'breadmachine/secure_trading/request'
|
26
|
+
|
25
27
|
autoload :AuthRequest, 'breadmachine/secure_trading/auth_request'
|
26
28
|
autoload :MotoAuthRequest, 'breadmachine/secure_trading/moto_auth_request'
|
27
29
|
|
@@ -8,19 +8,11 @@ module BreadMachine
|
|
8
8
|
return SecureTrading::XPay.exchange(request)
|
9
9
|
end
|
10
10
|
|
11
|
-
def repeat_auth(*args)
|
12
|
-
auth(*args)
|
13
|
-
end
|
14
|
-
|
15
11
|
def moto_auth(*args)
|
16
12
|
request = SecureTrading::MotoAuthRequest.new(*args)
|
17
13
|
return SecureTrading::XPay.exchange(request)
|
18
14
|
end
|
19
15
|
|
20
|
-
def repeat_moto_auth(*args)
|
21
|
-
moto_auth(*args)
|
22
|
-
end
|
23
|
-
|
24
16
|
# Checks to see whether a card is enrolled in 3-D Secure. Returns a
|
25
17
|
# ST3DCardQueryResponse which can tell us whether the card is enrolled
|
26
18
|
# and what kind of authorisation to perform.
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module BreadMachine
|
2
|
+
module SecureTrading
|
3
|
+
|
4
|
+
class Request
|
5
|
+
|
6
|
+
def initialize(request)
|
7
|
+
@request = request
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_xml
|
11
|
+
xml = Builder::XmlMarkup.new(:indent => 2)
|
12
|
+
xml.instruct!(:xml, :encoding => "UTF-8")
|
13
|
+
xml.RequestBlock('Version' => '3.51') do |request_block|
|
14
|
+
request_block << @request.to_xml
|
15
|
+
xml.Certificate BreadMachine::SecureTrading::configuration.site_reference
|
16
|
+
end
|
17
|
+
return xml.target!
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -28,13 +28,8 @@ module BreadMachine
|
|
28
28
|
protected
|
29
29
|
|
30
30
|
def generate_xml(request)
|
31
|
-
|
32
|
-
|
33
|
-
xml.RequestBlock('Version' => '3.51') do |request_block|
|
34
|
-
request_block << request.to_xml
|
35
|
-
xml.Certificate BreadMachine::SecureTrading::configuration.site_reference
|
36
|
-
end
|
37
|
-
return xml.to_s
|
31
|
+
request = BreadMachine::SecureTrading::Request.new(request)
|
32
|
+
request.to_xml
|
38
33
|
end
|
39
34
|
|
40
35
|
def exchange_with_xpay_client(request_xml)
|
@@ -119,11 +114,11 @@ module BreadMachine
|
|
119
114
|
if response.error?
|
120
115
|
message = response.message
|
121
116
|
case message.match(/\((\d+)\)/)[1].to_i
|
122
|
-
when 100, 101, 1000, 1100, 3000, 3010, 3330, 3350, 5000
|
117
|
+
when 100, 101, 1000, 1100, 3000, 3010, 3330, 3350, 5000 then
|
123
118
|
raise BreadMachine::GatewayConnectionError.new(message)
|
124
|
-
when 2100, 3100
|
119
|
+
when 2100, 3100 then
|
125
120
|
raise BreadMachine::MerchantConfigurationError.new(message)
|
126
|
-
when 2500, 5100, 10500
|
121
|
+
when 2500, 5100, 10500 then
|
127
122
|
raise BreadMachine::MerchantRequestError.new(message)
|
128
123
|
end
|
129
124
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
3
|
+
|
4
|
+
describe BreadMachine::SecureTrading::Request do
|
5
|
+
|
6
|
+
describe "XML generation" do
|
7
|
+
|
8
|
+
before(:each) do
|
9
|
+
@request = described_class.new(Builder::XmlMarkup.new)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should set xml instruct" do
|
13
|
+
@request.to_xml.should match(%r{<\?xml version="1.0" encoding="UTF-8"\?>})
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should output xml as utf-8" do
|
17
|
+
xml = Builder::XmlMarkup.new
|
18
|
+
xml.foo "Min luftpudebåd er fyldt med ål"
|
19
|
+
@request = described_class.new(xml)
|
20
|
+
@request.to_xml.should match(/Min luftpudebåd er fyldt med ål/)
|
21
|
+
end
|
22
|
+
|
23
|
+
def request_xml
|
24
|
+
Nokogiri::XML::Document.parse(@request.to_xml)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: breadmachine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Southerden
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10-
|
12
|
+
date: 2009-10-31 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -110,6 +110,7 @@ extensions: []
|
|
110
110
|
|
111
111
|
extra_rdoc_files:
|
112
112
|
- LICENSE
|
113
|
+
- README
|
113
114
|
- README.rdoc
|
114
115
|
files:
|
115
116
|
- lib/breadmachine.rb
|
@@ -131,6 +132,7 @@ files:
|
|
131
132
|
- lib/breadmachine/secure_trading/moto_auth_request.rb
|
132
133
|
- lib/breadmachine/secure_trading/order_info_xml.rb
|
133
134
|
- lib/breadmachine/secure_trading/payment_methods.rb
|
135
|
+
- lib/breadmachine/secure_trading/request.rb
|
134
136
|
- lib/breadmachine/secure_trading/st_3d_auth_request.rb
|
135
137
|
- lib/breadmachine/secure_trading/st_3d_auth_response.rb
|
136
138
|
- lib/breadmachine/secure_trading/st_3d_card_query_request.rb
|
@@ -140,6 +142,7 @@ files:
|
|
140
142
|
- lib/breadmachine/secure_trading/xpay_response.rb
|
141
143
|
- lib/breadmachine/secure_trading/xpay_socket.rb
|
142
144
|
- LICENSE
|
145
|
+
- README
|
143
146
|
- README.rdoc
|
144
147
|
has_rdoc: true
|
145
148
|
homepage: http://github.com/mattsoutherden/breadmachine
|
@@ -181,6 +184,7 @@ test_files:
|
|
181
184
|
- spec/secure_trading/customer_info_enrolment_xml_spec.rb
|
182
185
|
- spec/secure_trading/moto_auth_request_spec.rb
|
183
186
|
- spec/secure_trading/order_info_xml_spec.rb
|
187
|
+
- spec/secure_trading/request_spec.rb
|
184
188
|
- spec/secure_trading/st_3d_auth_request_spec.rb
|
185
189
|
- spec/secure_trading/st_3d_auth_response_spec.rb
|
186
190
|
- spec/secure_trading/st_3d_card_query_request_spec.rb
|