spreedly 1.4.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. data/.gitignore +8 -0
  2. data/Gemfile +4 -0
  3. data/HISTORY.md +5 -0
  4. data/README.md +362 -29
  5. data/Rakefile +32 -0
  6. data/lib/certs/cacert.pem +7815 -0
  7. data/lib/spreedly.rb +24 -282
  8. data/lib/spreedly/common/errors_parser.rb +15 -0
  9. data/lib/spreedly/common/fields.rb +90 -0
  10. data/lib/spreedly/connection.rb +40 -0
  11. data/lib/spreedly/environment.rb +176 -0
  12. data/lib/spreedly/error.rb +50 -0
  13. data/lib/spreedly/gateway.rb +10 -0
  14. data/lib/spreedly/model.rb +17 -0
  15. data/lib/spreedly/payment_methods/credit_card.rb +9 -0
  16. data/lib/spreedly/payment_methods/payment_method.rb +34 -0
  17. data/lib/spreedly/payment_methods/paypal.rb +7 -0
  18. data/lib/spreedly/payment_methods/sprel.rb +7 -0
  19. data/lib/spreedly/ssl_requester.rb +65 -0
  20. data/lib/spreedly/transactions/add_payment_method.rb +16 -0
  21. data/lib/spreedly/transactions/auth_purchase.rb +17 -0
  22. data/lib/spreedly/transactions/authorization.rb +7 -0
  23. data/lib/spreedly/transactions/capture.rb +14 -0
  24. data/lib/spreedly/transactions/gateway_transaction.rb +31 -0
  25. data/lib/spreedly/transactions/purchase.rb +7 -0
  26. data/lib/spreedly/transactions/redact_payment_method.rb +14 -0
  27. data/lib/spreedly/transactions/refund.rb +14 -0
  28. data/lib/spreedly/transactions/retain_payment_method.rb +14 -0
  29. data/lib/spreedly/transactions/transaction.rb +41 -0
  30. data/lib/spreedly/transactions/void.rb +9 -0
  31. data/lib/spreedly/urls.rb +64 -0
  32. data/lib/spreedly/version.rb +1 -1
  33. data/spreedly.gemspec +29 -0
  34. data/test/credentials/credentials.yml +9 -0
  35. data/test/credentials/test_credentials.rb +43 -0
  36. data/test/helpers/assertions.rb +29 -0
  37. data/test/helpers/communication_helper.rb +31 -0
  38. data/test/helpers/creation_helper.rb +26 -0
  39. data/test/helpers/stub_response.rb +18 -0
  40. data/test/remote/remote_add_credit_card_test.rb +62 -0
  41. data/test/remote/remote_add_gateway_test.rb +30 -0
  42. data/test/remote/remote_authorize_test.rb +48 -0
  43. data/test/remote/remote_capture_test.rb +71 -0
  44. data/test/remote/remote_find_gateway_test.rb +31 -0
  45. data/test/remote/remote_find_payment_method_test.rb +29 -0
  46. data/test/remote/remote_find_transaction_test.rb +33 -0
  47. data/test/remote/remote_list_transactions_test.rb +36 -0
  48. data/test/remote/remote_purchase_test.rb +69 -0
  49. data/test/remote/remote_redact_test.rb +38 -0
  50. data/test/remote/remote_refund_test.rb +65 -0
  51. data/test/remote/remote_retain_test.rb +39 -0
  52. data/test/remote/remote_void_test.rb +64 -0
  53. data/test/test_helper.rb +23 -0
  54. data/test/unit/add_credit_card_test.rb +74 -0
  55. data/test/unit/add_gateway_test.rb +26 -0
  56. data/test/unit/authorize_test.rb +87 -0
  57. data/test/unit/capture_test.rb +91 -0
  58. data/test/unit/environment_test.rb +18 -0
  59. data/test/unit/fields_test.rb +75 -0
  60. data/test/unit/find_gateway_test.rb +28 -0
  61. data/test/unit/find_payment_method_test.rb +90 -0
  62. data/test/unit/find_transaction_test.rb +31 -0
  63. data/test/unit/list_transactions_test.rb +46 -0
  64. data/test/unit/purchase_test.rb +95 -0
  65. data/test/unit/redact_payment_method_test.rb +51 -0
  66. data/test/unit/refund_test.rb +91 -0
  67. data/test/unit/response_stubs/add_credit_card_stubs.rb +43 -0
  68. data/test/unit/response_stubs/add_gateway_stubs.rb +39 -0
  69. data/test/unit/response_stubs/authorization_stubs.rb +139 -0
  70. data/test/unit/response_stubs/capture_stubs.rb +87 -0
  71. data/test/unit/response_stubs/find_gateway_stubs.rb +38 -0
  72. data/test/unit/response_stubs/find_payment_method_stubs.rb +108 -0
  73. data/test/unit/response_stubs/find_transaction_stubs.rb +43 -0
  74. data/test/unit/response_stubs/list_transactions_stubs.rb +110 -0
  75. data/test/unit/response_stubs/purchase_stubs.rb +139 -0
  76. data/test/unit/response_stubs/redact_payment_method_stubs.rb +54 -0
  77. data/test/unit/response_stubs/refund_stubs.rb +87 -0
  78. data/test/unit/response_stubs/retain_payment_method_stubs.rb +85 -0
  79. data/test/unit/response_stubs/void_stubs.rb +79 -0
  80. data/test/unit/retain_payment_method_test.rb +44 -0
  81. data/test/unit/timeout_test.rb +20 -0
  82. data/test/unit/void_test.rb +96 -0
  83. metadata +215 -29
  84. checksums.yaml +0 -15
  85. data/lib/spreedly/common.rb +0 -44
  86. data/lib/spreedly/mock.rb +0 -221
  87. data/lib/spreedly/test_hacks.rb +0 -27
@@ -0,0 +1,110 @@
1
+ module ListTransactionsStubs
2
+
3
+ def successful_list_transactions_response
4
+ StubResponse.succeeded <<-XML
5
+ <transactions>
6
+ <transaction>
7
+ <amount type="integer">444</amount>
8
+ <on_test_gateway type="boolean">true</on_test_gateway>
9
+ <created_at type="datetime">2013-08-06T02:07:24Z</created_at>
10
+ <updated_at type="datetime">2013-08-06T02:07:24Z</updated_at>
11
+ <currency_code>USD</currency_code>
12
+ <succeeded type="boolean">true</succeeded>
13
+ <state>succeeded</state>
14
+ <token>5Zkgibjs6z5R6XENMtZd8A8ajau</token>
15
+ <transaction_type>Authorization</transaction_type>
16
+ <order_id nil="true"/>
17
+ <ip nil="true"/>
18
+ <description nil="true"/>
19
+ <merchant_name_descriptor nil="true"/>
20
+ <merchant_location_descriptor nil="true"/>
21
+ <gateway_specific_fields nil="true"/>
22
+ <gateway_specific_response_fields nil="true"/>
23
+ <message key="messages.transaction_succeeded">Succeeded!</message>
24
+ <gateway_token>TpjI3MSmLOSfqpFKP2poZRKc6Ru</gateway_token>
25
+ <response>
26
+ <success type="boolean">true</success>
27
+ <message>Successful authorize</message>
28
+ <avs_code nil="true"/>
29
+ <avs_message nil="true"/>
30
+ <cvv_code nil="true"/>
31
+ <cvv_message nil="true"/>
32
+ <pending type="boolean">false</pending>
33
+ <error_code></error_code>
34
+ <error_detail nil="true"/>
35
+ <cancelled type="boolean">false</cancelled>
36
+ <created_at type="datetime">2013-08-06T02:07:24Z</created_at>
37
+ <updated_at type="datetime">2013-08-06T02:07:24Z</updated_at>
38
+ </response>
39
+ <payment_method>
40
+ <token>a7I2aus36aN1kC1XpREkYTMOwcr</token>
41
+ <created_at type="datetime">2013-08-06T02:07:23Z</created_at>
42
+ <updated_at type="datetime">2013-08-06T02:07:24Z</updated_at>
43
+ <email>perrin@wot.com</email>
44
+ <data nil="true"/>
45
+ <storage_state>retained</storage_state>
46
+ <last_four_digits>4444</last_four_digits>
47
+ <card_type>master</card_type>
48
+ <first_name>Perrin</first_name>
49
+ <last_name>Aybara</last_name>
50
+ <month type="integer">1</month>
51
+ <year type="integer">2019</year>
52
+ <address1 nil="true"/>
53
+ <address2 nil="true"/>
54
+ <city nil="true"/>
55
+ <state nil="true"/>
56
+ <zip nil="true"/>
57
+ <country nil="true"/>
58
+ <phone_number nil="true"/>
59
+ <full_name>Perrin Aybara</full_name>
60
+ <payment_method_type>credit_card</payment_method_type>
61
+ <errors>
62
+ </errors>
63
+ <verification_value></verification_value>
64
+ <number>XXXX-XXXX-XXXX-4444</number>
65
+ </payment_method>
66
+ <api_urls>
67
+ <referencing_transaction>https://core.spreedly.com/v1/transactions/IGiNeArFVKD6rfYYW9lUP7e008l.xml</referencing_transaction>
68
+ </api_urls>
69
+ </transaction>
70
+ <transaction>
71
+ <amount type="integer">22</amount>
72
+ <on_test_gateway type="boolean">true</on_test_gateway>
73
+ <created_at type="datetime">2013-08-06T02:07:24Z</created_at>
74
+ <updated_at type="datetime">2013-08-06T02:07:24Z</updated_at>
75
+ <currency_code>USD</currency_code>
76
+ <succeeded type="boolean">true</succeeded>
77
+ <state>succeeded</state>
78
+ <token>IGiNeArFVKD6rfYYW9lUP7e008l</token>
79
+ <transaction_type>Capture</transaction_type>
80
+ <order_id nil="true"/>
81
+ <ip nil="true"/>
82
+ <description nil="true"/>
83
+ <merchant_name_descriptor nil="true"/>
84
+ <merchant_location_descriptor nil="true"/>
85
+ <gateway_specific_fields nil="true"/>
86
+ <gateway_specific_response_fields nil="true"/>
87
+ <message key="messages.transaction_succeeded">Succeeded!</message>
88
+ <gateway_token>TpjI3MSmLOSfqpFKP2poZRKc6Ru</gateway_token>
89
+ <response>
90
+ <success type="boolean">true</success>
91
+ <message>Successful capture</message>
92
+ <avs_code nil="true"/>
93
+ <avs_message nil="true"/>
94
+ <cvv_code nil="true"/>
95
+ <cvv_message nil="true"/>
96
+ <pending type="boolean">false</pending>
97
+ <error_code></error_code>
98
+ <error_detail nil="true"/>
99
+ <cancelled type="boolean">false</cancelled>
100
+ <created_at type="datetime">2013-08-06T02:07:24Z</created_at>
101
+ <updated_at type="datetime">2013-08-06T02:07:24Z</updated_at>
102
+ </response>
103
+ <reference_token>5Zkgibjs6z5R6XENMtZd8A8ajau</reference_token>
104
+ <api_urls>
105
+ </api_urls>
106
+ </transaction>
107
+ </transactions>
108
+ XML
109
+ end
110
+ end
@@ -0,0 +1,139 @@
1
+ module PurchaseStubs
2
+
3
+ def successful_purchase_response
4
+ StubResponse.succeeded <<-XML
5
+ <transaction>
6
+ <amount type="integer">144</amount>
7
+ <on_test_gateway type="boolean">true</on_test_gateway>
8
+ <created_at type="datetime">2013-07-31T19:46:26Z</created_at>
9
+ <updated_at type="datetime">2013-07-31T19:46:32Z</updated_at>
10
+ <currency_code>USD</currency_code>
11
+ <succeeded type="boolean">true</succeeded>
12
+ <state>succeeded</state>
13
+ <token>Btcyks35m4JLSNOs9ymJoNQLjeX</token>
14
+ <transaction_type>Purchase</transaction_type>
15
+ <order_id>187A</order_id>
16
+ <ip nil="true"/>
17
+ <description>4 Shardblades</description>
18
+ <merchant_name_descriptor nil="true"/>
19
+ <merchant_location_descriptor nil="true"/>
20
+ <gateway_specific_fields nil="true"/>
21
+ <gateway_specific_response_fields nil="true"/>
22
+ <message key="messages.transaction_succeeded">Succeeded!</message>
23
+ <gateway_token>YOaCn5a9xRaBTGgmGAWbkgWUuqv</gateway_token>
24
+ <response>
25
+ <success type="boolean">true</success>
26
+ <message>Successful purchase</message>
27
+ <avs_code>22</avs_code>
28
+ <avs_message nil="true">I will be back</avs_message>
29
+ <cvv_code>31</cvv_code>
30
+ <cvv_message nil="true">Rutabaga</cvv_message>
31
+ <pending type="boolean">false</pending>
32
+ <error_code>899</error_code>
33
+ <error_detail nil="true">The eagle lives!</error_detail>
34
+ <cancelled type="boolean">false</cancelled>
35
+ <created_at type="datetime">2013-07-31T19:46:26Z</created_at>
36
+ <updated_at type="datetime">2013-07-31T19:46:27Z</updated_at>
37
+ </response>
38
+ <payment_method>
39
+ <token>8xXXIPGXTaPXysDA5OUpgnjTEjK</token>
40
+ <created_at type="datetime">2013-07-31T19:46:25Z</created_at>
41
+ <updated_at type="datetime">2013-07-31T19:46:26Z</updated_at>
42
+ <email>perrin@wot.com</email>
43
+ <data nil="true"/>
44
+ <storage_state>retained</storage_state>
45
+ <last_four_digits>4444</last_four_digits>
46
+ <card_type>master</card_type>
47
+ <first_name>Perrin</first_name>
48
+ <last_name>Aybara</last_name>
49
+ <month type="integer">1</month>
50
+ <year type="integer">2019</year>
51
+ <address1 nil="true"/>
52
+ <address2 nil="true"/>
53
+ <city nil="true"/>
54
+ <state nil="true"/>
55
+ <zip nil="true"/>
56
+ <country nil="true"/>
57
+ <phone_number nil="true"/>
58
+ <full_name>Perrin Aybara</full_name>
59
+ <payment_method_type>credit_card</payment_method_type>
60
+ <errors>
61
+ </errors>
62
+ <verification_value></verification_value>
63
+ <number>XXXX-XXXX-XXXX-4444</number>
64
+ </payment_method>
65
+ <api_urls>
66
+ </api_urls>
67
+ </transaction>
68
+ XML
69
+ end
70
+
71
+ def failed_purchase_response
72
+ StubResponse.failed <<-XML
73
+ <transaction>
74
+ <amount type="integer">5148</amount>
75
+ <on_test_gateway type="boolean">true</on_test_gateway>
76
+ <created_at type="datetime">2013-07-31T19:51:57Z</created_at>
77
+ <updated_at type="datetime">2013-07-31T19:51:57Z</updated_at>
78
+ <currency_code>USD</currency_code>
79
+ <succeeded type="boolean">false</succeeded>
80
+ <state>gateway_processing_failed</state>
81
+ <token>RxkxK78ZlvDiXRQRnyuJM5ee0Ww</token>
82
+ <transaction_type>Purchase</transaction_type>
83
+ <order_id nil="true"/>
84
+ <ip nil="true"/>
85
+ <description nil="true"/>
86
+ <merchant_name_descriptor nil="true"/>
87
+ <merchant_location_descriptor nil="true"/>
88
+ <gateway_specific_fields nil="true"/>
89
+ <gateway_specific_response_fields nil="true"/>
90
+ <message>Unable to process the purchase transaction.</message>
91
+ <gateway_token>Y6jMbUCm2oz6QTpavzp0xLaV9mk</gateway_token>
92
+ <response>
93
+ <success type="boolean">false</success>
94
+ <message>Unable to process the purchase transaction.</message>
95
+ <avs_code nil="true"/>
96
+ <avs_message nil="true"/>
97
+ <cvv_code nil="true"/>
98
+ <cvv_message nil="true"/>
99
+ <pending type="boolean">false</pending>
100
+ <error_code></error_code>
101
+ <error_detail nil="true">The eagle is dead Jim.</error_detail>
102
+ <cancelled type="boolean">false</cancelled>
103
+ <created_at type="datetime">2013-07-31T19:51:57Z</created_at>
104
+ <updated_at type="datetime">2013-07-31T19:51:57Z</updated_at>
105
+ </response>
106
+ <payment_method>
107
+ <token>H0kioCnUZ8YbQ9rhqJv6zyav01Q</token>
108
+ <created_at type="datetime">2013-07-31T19:51:57Z</created_at>
109
+ <updated_at type="datetime">2013-07-31T19:51:57Z</updated_at>
110
+ <email>perrin@wot.com</email>
111
+ <data nil="true"/>
112
+ <storage_state>retained</storage_state>
113
+ <last_four_digits>1881</last_four_digits>
114
+ <card_type>visa</card_type>
115
+ <first_name>Perrin</first_name>
116
+ <last_name>Aybara</last_name>
117
+ <month type="integer">1</month>
118
+ <year type="integer">2019</year>
119
+ <address1 nil="true"/>
120
+ <address2 nil="true"/>
121
+ <city nil="true"/>
122
+ <state nil="true"/>
123
+ <zip nil="true"/>
124
+ <country nil="true"/>
125
+ <phone_number nil="true"/>
126
+ <full_name>Perrin Aybara</full_name>
127
+ <payment_method_type>credit_card</payment_method_type>
128
+ <errors>
129
+ </errors>
130
+ <verification_value></verification_value>
131
+ <number>XXXX-XXXX-XXXX-1881</number>
132
+ </payment_method>
133
+ <api_urls>
134
+ </api_urls>
135
+ </transaction>
136
+ XML
137
+ end
138
+
139
+ end
@@ -0,0 +1,54 @@
1
+ module RedactPaymentMethodStubs
2
+
3
+ def successful_redact_response
4
+ StubResponse.succeeded <<-XML
5
+ <transaction>
6
+ <on_test_gateway type="boolean">false</on_test_gateway>
7
+ <created_at type="datetime">2013-08-05T17:43:41Z</created_at>
8
+ <updated_at type="datetime">2013-08-05T17:43:41Z</updated_at>
9
+ <succeeded type="boolean">true</succeeded>
10
+ <token>2BSe5T6FHpypph3ensF7m3Nb3qk</token>
11
+ <state>succeeded</state>
12
+ <gateway_specific_fields nil="true"/>
13
+ <gateway_specific_response_fields nil="true"/>
14
+ <transaction_type>RedactPaymentMethod</transaction_type>
15
+ <order_id nil="true"/>
16
+ <ip nil="true"/>
17
+ <message key="messages.transaction_succeeded">Succeeded!</message>
18
+ <payment_method>
19
+ <token>RvsxKgbAZBmiZHEPhhTcOQzJeC2</token>
20
+ <created_at type="datetime">2013-08-05T17:43:41Z</created_at>
21
+ <updated_at type="datetime">2013-08-05T17:43:41Z</updated_at>
22
+ <email>perrin@wot.com</email>
23
+ <data nil="true"/>
24
+ <storage_state>redacted</storage_state>
25
+ <last_four_digits>4444</last_four_digits>
26
+ <card_type>master</card_type>
27
+ <first_name>Perrin</first_name>
28
+ <last_name>Aybara</last_name>
29
+ <month type="integer">1</month>
30
+ <year type="integer">2019</year>
31
+ <address1 nil="true"/>
32
+ <address2 nil="true"/>
33
+ <city nil="true"/>
34
+ <state nil="true"/>
35
+ <zip nil="true"/>
36
+ <country nil="true"/>
37
+ <phone_number nil="true"/>
38
+ <full_name>Perrin Aybara</full_name>
39
+ <payment_method_type>credit_card</payment_method_type>
40
+ <errors>
41
+ </errors>
42
+ <verification_value></verification_value>
43
+ <number>XXXX-XXXX-XXXX-4444</number>
44
+ </payment_method>
45
+ </transaction>
46
+ XML
47
+ end
48
+
49
+ def failed_redact_response
50
+ StubResponse.failed <<-XML
51
+ XML
52
+ end
53
+
54
+ end
@@ -0,0 +1,87 @@
1
+ module RefundStubs
2
+
3
+ def successful_refund_response
4
+ StubResponse.succeeded <<-XML
5
+ <transaction>
6
+ <amount type="integer">944</amount>
7
+ <on_test_gateway type="boolean">true</on_test_gateway>
8
+ <created_at type="datetime">2013-08-05T16:37:13Z</created_at>
9
+ <updated_at type="datetime">2013-08-05T16:37:13Z</updated_at>
10
+ <currency_code>USD</currency_code>
11
+ <succeeded type="boolean">true</succeeded>
12
+ <state>succeeded</state>
13
+ <token>JyQegcYcIFA2jUg22OYTGiUyXTR</token>
14
+ <transaction_type>Credit</transaction_type>
15
+ <order_id>99a1</order_id>
16
+ <ip>182.129.106.102</ip>
17
+ <description>LotsOCoffee</description>
18
+ <merchant_name_descriptor>My Writeoff Inc.</merchant_name_descriptor>
19
+ <merchant_location_descriptor>Tax Free Zone</merchant_location_descriptor>
20
+ <gateway_specific_fields nil="true"/>
21
+ <gateway_specific_response_fields nil="true"/>
22
+ <message key="messages.transaction_succeeded">Succeeded!</message>
23
+ <gateway_token>XYI0V2l4KC1cAm6Y3c2kG5loJaA</gateway_token>
24
+ <response>
25
+ <success type="boolean">true</success>
26
+ <message>Successful credit</message>
27
+ <avs_code nil="true"/>
28
+ <avs_message nil="true"/>
29
+ <cvv_code nil="true"/>
30
+ <cvv_message nil="true"/>
31
+ <pending type="boolean">false</pending>
32
+ <error_code></error_code>
33
+ <error_detail nil="true"/>
34
+ <cancelled type="boolean">false</cancelled>
35
+ <created_at type="datetime">2013-08-05T16:37:13Z</created_at>
36
+ <updated_at type="datetime">2013-08-05T16:37:13Z</updated_at>
37
+ </response>
38
+ <reference_token>RkIAltzr49eXuWc7ajBjLLeKZt8</reference_token>
39
+ <api_urls>
40
+ </api_urls>
41
+ </transaction>
42
+ XML
43
+ end
44
+
45
+ def failed_refund_response
46
+ StubResponse.failed <<-XML
47
+ <transaction>
48
+ <amount type="integer">44</amount>
49
+ <on_test_gateway type="boolean">true</on_test_gateway>
50
+ <created_at type="datetime">2013-08-05T16:35:11Z</created_at>
51
+ <updated_at type="datetime">2013-08-05T16:35:11Z</updated_at>
52
+ <currency_code>USD</currency_code>
53
+ <succeeded type="boolean">false</succeeded>
54
+ <state>gateway_processing_failed</state>
55
+ <token>UWB0L2Q2hwX1qy3Z8UdHd426icC</token>
56
+ <transaction_type>Credit</transaction_type>
57
+ <order_id nil="true"/>
58
+ <ip nil="true"/>
59
+ <description nil="true"/>
60
+ <merchant_name_descriptor nil="true"/>
61
+ <merchant_location_descriptor nil="true"/>
62
+ <gateway_specific_fields nil="true"/>
63
+ <gateway_specific_response_fields nil="true"/>
64
+ <message>Unable to process the credit transaction.</message>
65
+ <gateway_token>GWUbHifwMEI8Lqyjz5H1zMbIC7M</gateway_token>
66
+ <response>
67
+ <success type="boolean">false</success>
68
+ <message>Unable to process the credit transaction.</message>
69
+ <avs_code nil="true"/>
70
+ <avs_message nil="true"/>
71
+ <cvv_code nil="true"/>
72
+ <cvv_message nil="true"/>
73
+ <pending type="boolean">false</pending>
74
+ <error_code></error_code>
75
+ <error_detail>The eagle is actually a dead duck.</error_detail>
76
+ <cancelled type="boolean">false</cancelled>
77
+ <created_at type="datetime">2013-08-05T16:35:11Z</created_at>
78
+ <updated_at type="datetime">2013-08-05T16:35:11Z</updated_at>
79
+ </response>
80
+ <reference_token>5UHTE8QU7lxsGYiBtRQRJn626kj</reference_token>
81
+ <api_urls>
82
+ </api_urls>
83
+ </transaction>
84
+ XML
85
+ end
86
+
87
+ end
@@ -0,0 +1,85 @@
1
+ module RetainPaymentMethodStubs
2
+
3
+ def successful_retain_response
4
+ StubResponse.succeeded <<-XML
5
+ <transaction>
6
+ <token>DsmkqsjRvqcMGSCBUUuUiRw8tso</token>
7
+ <created_at type="datetime">2013-08-05T18:31:51Z</created_at>
8
+ <updated_at type="datetime">2013-08-05T18:31:51Z</updated_at>
9
+ <succeeded type="boolean">true</succeeded>
10
+ <transaction_type>RetainPaymentMethod</transaction_type>
11
+ <state>succeeded</state>
12
+ <message key="messages.transaction_succeeded">Succeeded!</message>
13
+ <payment_method>
14
+ <token>RXZDzDGxpqPV7v5ZNVO89n1qtTl</token>
15
+ <created_at type="datetime">2013-08-05T18:31:51Z</created_at>
16
+ <updated_at type="datetime">2013-08-05T18:31:51Z</updated_at>
17
+ <email>perrin@wot.com</email>
18
+ <data nil="true"/>
19
+ <storage_state>retained</storage_state>
20
+ <last_four_digits>4444</last_four_digits>
21
+ <card_type>master</card_type>
22
+ <first_name>Perrin</first_name>
23
+ <last_name>Aybara</last_name>
24
+ <month type="integer">1</month>
25
+ <year type="integer">2019</year>
26
+ <address1 nil="true"/>
27
+ <address2 nil="true"/>
28
+ <city nil="true"/>
29
+ <state nil="true"/>
30
+ <zip nil="true"/>
31
+ <country nil="true"/>
32
+ <phone_number nil="true"/>
33
+ <full_name>Perrin Aybara</full_name>
34
+ <payment_method_type>credit_card</payment_method_type>
35
+ <errors>
36
+ </errors>
37
+ <verification_value></verification_value>
38
+ <number>XXXX-XXXX-XXXX-4444</number>
39
+ </payment_method>
40
+ </transaction>
41
+ XML
42
+ end
43
+
44
+ def failed_retain_response
45
+ StubResponse.failed <<-XML
46
+ <transaction>
47
+ <token>2OLUmdUE7EFIdkb9tTnWyLPkxsF</token>
48
+ <created_at type="datetime">2013-08-05T18:34:14Z</created_at>
49
+ <updated_at type="datetime">2013-08-05T18:34:14Z</updated_at>
50
+ <succeeded type="boolean">false</succeeded>
51
+ <transaction_type>RetainPaymentMethod</transaction_type>
52
+ <state>failed</state>
53
+ <message key="messages.unable_to_retain_a_redacted_payment_method">The payment method has been redacted. Therefore, it cannot be retained.</message>
54
+ <payment_method>
55
+ <token>CpurR3zCfGcRC0tqwq9zp4zzIgf</token>
56
+ <created_at type="datetime">2013-08-05T18:34:13Z</created_at>
57
+ <updated_at type="datetime">2013-08-05T18:34:14Z</updated_at>
58
+ <email>perrin@wot.com</email>
59
+ <data nil="true"/>
60
+ <storage_state>redacted</storage_state>
61
+ <last_four_digits>4444</last_four_digits>
62
+ <card_type>master</card_type>
63
+ <first_name>Perrin</first_name>
64
+ <last_name>Aybara</last_name>
65
+ <month type="integer">1</month>
66
+ <year type="integer">2019</year>
67
+ <address1 nil="true"/>
68
+ <address2 nil="true"/>
69
+ <city nil="true"/>
70
+ <state nil="true"/>
71
+ <zip nil="true"/>
72
+ <country nil="true"/>
73
+ <phone_number nil="true"/>
74
+ <full_name>Perrin Aybara</full_name>
75
+ <payment_method_type>credit_card</payment_method_type>
76
+ <errors>
77
+ </errors>
78
+ <verification_value></verification_value>
79
+ <number>XXXX-XXXX-XXXX-4444</number>
80
+ </payment_method>
81
+ </transaction>
82
+ XML
83
+ end
84
+
85
+ end