spreedly 2.0.4 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,7 +10,8 @@ module Spreedly
10
10
 
11
11
  def initialize(xml_doc)
12
12
  super
13
- @response = Response.new(xml_doc.at_xpath('.//response'))
13
+ response_xml_doc = xml_doc.at_xpath('.//response')
14
+ @response = response_xml_doc ? Response.new(response_xml_doc) : nil
14
15
  end
15
16
 
16
17
  end
@@ -1,3 +1,3 @@
1
1
  module Spreedly
2
- VERSION = "2.0.4"
2
+ VERSION = "2.0.5"
3
3
  end
@@ -22,6 +22,16 @@ class FindTransactionTest < Test::Unit::TestCase
22
22
  assert_equal "7sqmBrh8zS4Mgei6wOyYskFpghF", t.payment_method.token
23
23
  end
24
24
 
25
+ def test_transaction_with_no_response
26
+ t = find_using(responseless_transaction_response)
27
+
28
+ assert_kind_of(Spreedly::Purchase, t)
29
+ assert_equal("1f41avmBKchYCNam8rMgrRRTppD", t.token)
30
+
31
+ assert !t.succeeded?
32
+ assert_nil t.response
33
+ end
34
+
25
35
  private
26
36
  def find_using(response)
27
37
  @environment.stubs(:raw_ssl_request).returns(response)
@@ -40,4 +40,59 @@ module FindTransactionStubs
40
40
  </transaction>
41
41
  XML
42
42
  end
43
+
44
+ def responseless_transaction_response
45
+ StubResponse.succeeded <<-XML
46
+ <transaction>
47
+ <amount type="integer">899</amount>
48
+ <on_test_gateway type="boolean">false</on_test_gateway>
49
+ <created_at type="datetime">2014-10-15T19:02:49Z</created_at>
50
+ <updated_at type="datetime">2014-10-15T19:02:49Z</updated_at>
51
+ <currency_code>USD</currency_code>
52
+ <succeeded type="boolean">false</succeeded>
53
+ <state>failed</state>
54
+ <token>1f41avmBKchYCNam8rMgrRRTppD</token>
55
+ <transaction_type>Purchase</transaction_type>
56
+ <order_id>136</order_id>
57
+ <ip nil="true"/>
58
+ <description>The Description</description>
59
+ <merchant_name_descriptor>Descriptor</merchant_name_descriptor>
60
+ <merchant_location_descriptor>TheUrl</merchant_location_descriptor>
61
+ <gateway_specific_fields nil="true"/>
62
+ <gateway_specific_response_fields nil="true"/>
63
+ <message key="messages.cannot_use_redacted_gateway">Unable to use a gateway because it's been redacted.</message>
64
+ <gateway_token>223rRq1muGCYQUMVGu2a1qcG9PK</gateway_token>
65
+ <payment_method>
66
+ <token>rYswku4CEaenVlBdmGluGM2cJ8q</token>
67
+ <created_at type="datetime">2013-10-11T20:15:25Z</created_at>
68
+ <updated_at type="datetime">2013-10-11T20:15:25Z</updated_at>
69
+ <email>email@example.com</email>
70
+ <data nil="true"/>
71
+ <storage_state>retained</storage_state>
72
+ <last_four_digits>2111</last_four_digits>
73
+ <card_type>visa</card_type>
74
+ <first_name>Jonathan</first_name>
75
+ <last_name>Phaedrus</last_name>
76
+ <month type="integer">11</month>
77
+ <year type="integer">2016</year>
78
+ <address1>418 Main Street</address1>
79
+ <address2 nil="true"/>
80
+ <city>Chicago</city>
81
+ <state>IL</state>
82
+ <zip>10657</zip>
83
+ <country>United States</country>
84
+ <phone_number nil="true"/>
85
+ <full_name>Jonathan Phaedrus</full_name>
86
+ <payment_method_type>credit_card</payment_method_type>
87
+ <errors>
88
+ </errors>
89
+ <verification_value></verification_value>
90
+ <number>XXXX-XXXX-XXXX-2111</number>
91
+ </payment_method>
92
+ <api_urls>
93
+ </api_urls>
94
+ </transaction>
95
+ XML
96
+ end
97
+
43
98
  end
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: spreedly
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 2.0.4
5
+ version: 2.0.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Spreedly
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-25 00:00:00.000000000 Z
12
+ date: 2013-10-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  prerelease: false
@@ -231,7 +231,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
231
231
  - !ruby/object:Gem::Version
232
232
  segments:
233
233
  - 0
234
- hash: 4235559723397187348
234
+ hash: 2702196769998865619
235
235
  version: '0'
236
236
  none: false
237
237
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -240,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
240
240
  - !ruby/object:Gem::Version
241
241
  segments:
242
242
  - 0
243
- hash: 4235559723397187348
243
+ hash: 2702196769998865619
244
244
  version: '0'
245
245
  none: false
246
246
  requirements: []