spreedly 1.4.0 → 2.0.0
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.
- data/.gitignore +8 -0
- data/Gemfile +4 -0
- data/HISTORY.md +5 -0
- data/README.md +362 -29
- data/Rakefile +32 -0
- data/lib/certs/cacert.pem +7815 -0
- data/lib/spreedly.rb +24 -282
- data/lib/spreedly/common/errors_parser.rb +15 -0
- data/lib/spreedly/common/fields.rb +90 -0
- data/lib/spreedly/connection.rb +40 -0
- data/lib/spreedly/environment.rb +176 -0
- data/lib/spreedly/error.rb +50 -0
- data/lib/spreedly/gateway.rb +10 -0
- data/lib/spreedly/model.rb +17 -0
- data/lib/spreedly/payment_methods/credit_card.rb +9 -0
- data/lib/spreedly/payment_methods/payment_method.rb +34 -0
- data/lib/spreedly/payment_methods/paypal.rb +7 -0
- data/lib/spreedly/payment_methods/sprel.rb +7 -0
- data/lib/spreedly/ssl_requester.rb +65 -0
- data/lib/spreedly/transactions/add_payment_method.rb +16 -0
- data/lib/spreedly/transactions/auth_purchase.rb +17 -0
- data/lib/spreedly/transactions/authorization.rb +7 -0
- data/lib/spreedly/transactions/capture.rb +14 -0
- data/lib/spreedly/transactions/gateway_transaction.rb +31 -0
- data/lib/spreedly/transactions/purchase.rb +7 -0
- data/lib/spreedly/transactions/redact_payment_method.rb +14 -0
- data/lib/spreedly/transactions/refund.rb +14 -0
- data/lib/spreedly/transactions/retain_payment_method.rb +14 -0
- data/lib/spreedly/transactions/transaction.rb +41 -0
- data/lib/spreedly/transactions/void.rb +9 -0
- data/lib/spreedly/urls.rb +64 -0
- data/lib/spreedly/version.rb +1 -1
- data/spreedly.gemspec +29 -0
- data/test/credentials/credentials.yml +9 -0
- data/test/credentials/test_credentials.rb +43 -0
- data/test/helpers/assertions.rb +29 -0
- data/test/helpers/communication_helper.rb +31 -0
- data/test/helpers/creation_helper.rb +26 -0
- data/test/helpers/stub_response.rb +18 -0
- data/test/remote/remote_add_credit_card_test.rb +62 -0
- data/test/remote/remote_add_gateway_test.rb +30 -0
- data/test/remote/remote_authorize_test.rb +48 -0
- data/test/remote/remote_capture_test.rb +71 -0
- data/test/remote/remote_find_gateway_test.rb +31 -0
- data/test/remote/remote_find_payment_method_test.rb +29 -0
- data/test/remote/remote_find_transaction_test.rb +33 -0
- data/test/remote/remote_list_transactions_test.rb +36 -0
- data/test/remote/remote_purchase_test.rb +69 -0
- data/test/remote/remote_redact_test.rb +38 -0
- data/test/remote/remote_refund_test.rb +65 -0
- data/test/remote/remote_retain_test.rb +39 -0
- data/test/remote/remote_void_test.rb +64 -0
- data/test/test_helper.rb +23 -0
- data/test/unit/add_credit_card_test.rb +74 -0
- data/test/unit/add_gateway_test.rb +26 -0
- data/test/unit/authorize_test.rb +87 -0
- data/test/unit/capture_test.rb +91 -0
- data/test/unit/environment_test.rb +18 -0
- data/test/unit/fields_test.rb +75 -0
- data/test/unit/find_gateway_test.rb +28 -0
- data/test/unit/find_payment_method_test.rb +90 -0
- data/test/unit/find_transaction_test.rb +31 -0
- data/test/unit/list_transactions_test.rb +46 -0
- data/test/unit/purchase_test.rb +95 -0
- data/test/unit/redact_payment_method_test.rb +51 -0
- data/test/unit/refund_test.rb +91 -0
- data/test/unit/response_stubs/add_credit_card_stubs.rb +43 -0
- data/test/unit/response_stubs/add_gateway_stubs.rb +39 -0
- data/test/unit/response_stubs/authorization_stubs.rb +139 -0
- data/test/unit/response_stubs/capture_stubs.rb +87 -0
- data/test/unit/response_stubs/find_gateway_stubs.rb +38 -0
- data/test/unit/response_stubs/find_payment_method_stubs.rb +108 -0
- data/test/unit/response_stubs/find_transaction_stubs.rb +43 -0
- data/test/unit/response_stubs/list_transactions_stubs.rb +110 -0
- data/test/unit/response_stubs/purchase_stubs.rb +139 -0
- data/test/unit/response_stubs/redact_payment_method_stubs.rb +54 -0
- data/test/unit/response_stubs/refund_stubs.rb +87 -0
- data/test/unit/response_stubs/retain_payment_method_stubs.rb +85 -0
- data/test/unit/response_stubs/void_stubs.rb +79 -0
- data/test/unit/retain_payment_method_test.rb +44 -0
- data/test/unit/timeout_test.rb +20 -0
- data/test/unit/void_test.rb +96 -0
- metadata +215 -29
- checksums.yaml +0 -15
- data/lib/spreedly/common.rb +0 -44
- data/lib/spreedly/mock.rb +0 -221
- data/lib/spreedly/test_hacks.rb +0 -27
@@ -0,0 +1,39 @@
|
|
1
|
+
module AddGatewayStubs
|
2
|
+
|
3
|
+
def successful_add_test_gateway_response
|
4
|
+
StubResponse.succeeded <<-XML
|
5
|
+
<gateway>
|
6
|
+
<token>4dFb93AiRDEJ18MS9xDGMyu22uO</token>
|
7
|
+
<gateway_type>test</gateway_type>
|
8
|
+
<name>Test</name>
|
9
|
+
<characteristics>
|
10
|
+
<supports_purchase type="boolean">true</supports_purchase>
|
11
|
+
<supports_authorize type="boolean">true</supports_authorize>
|
12
|
+
<supports_capture type="boolean">true</supports_capture>
|
13
|
+
<supports_credit type="boolean">true</supports_credit>
|
14
|
+
<supports_void type="boolean">true</supports_void>
|
15
|
+
<supports_reference_purchase type="boolean">true</supports_reference_purchase>
|
16
|
+
<supports_purchase_via_preauthorization type="boolean">true</supports_purchase_via_preauthorization>
|
17
|
+
<supports_offsite_purchase type="boolean">true</supports_offsite_purchase>
|
18
|
+
<supports_offsite_authorize type="boolean">true</supports_offsite_authorize>
|
19
|
+
<supports_3dsecure_purchase type="boolean">true</supports_3dsecure_purchase>
|
20
|
+
<supports_3dsecure_authorize type="boolean">true</supports_3dsecure_authorize>
|
21
|
+
<supports_store type="boolean">true</supports_store>
|
22
|
+
<supports_remove type="boolean">true</supports_remove>
|
23
|
+
</characteristics>
|
24
|
+
<state>retained</state>
|
25
|
+
<payment_methods>
|
26
|
+
<payment_method>credit_card</payment_method>
|
27
|
+
<payment_method>sprel</payment_method>
|
28
|
+
<payment_method>third_party_token</payment_method>
|
29
|
+
<payment_method>bank_account</payment_method>
|
30
|
+
</payment_methods>
|
31
|
+
<gateway_specific_fields/>
|
32
|
+
<redacted type="boolean">false</redacted>
|
33
|
+
<created_at type="datetime">2013-07-31T17:17:36Z</created_at>
|
34
|
+
<updated_at type="datetime">2013-07-31T17:17:36Z</updated_at>
|
35
|
+
</gateway>
|
36
|
+
XML
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,139 @@
|
|
1
|
+
module AuthorizationStubs
|
2
|
+
|
3
|
+
def successful_authorize_response
|
4
|
+
StubResponse.succeeded <<-XML
|
5
|
+
<transaction>
|
6
|
+
<amount type="integer">345</amount>
|
7
|
+
<on_test_gateway type="boolean">true</on_test_gateway>
|
8
|
+
<created_at type="datetime">2013-08-05T13:11:28Z</created_at>
|
9
|
+
<updated_at type="datetime">2013-08-05T13:11:28Z</updated_at>
|
10
|
+
<currency_code>USD</currency_code>
|
11
|
+
<succeeded type="boolean">true</succeeded>
|
12
|
+
<state>succeeded</state>
|
13
|
+
<token>NjsT1PRC5pHyz89H01bj1t2AVNo</token>
|
14
|
+
<transaction_type>Authorization</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>YjWxOjbpeieXsZFdAsbhM2DFgLe</gateway_token>
|
24
|
+
<response>
|
25
|
+
<success type="boolean">true</success>
|
26
|
+
<message>Successful authorize</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-05T13:11:28Z</created_at>
|
36
|
+
<updated_at type="datetime">2013-08-05T13:11:28Z</updated_at>
|
37
|
+
</response>
|
38
|
+
<payment_method>
|
39
|
+
<token>Nh2Vw0kAoSQvcJDpK52q4dZlrVJ</token>
|
40
|
+
<created_at type="datetime">2013-08-05T13:11:28Z</created_at>
|
41
|
+
<updated_at type="datetime">2013-08-05T13:11:28Z</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>John</first_name>
|
48
|
+
<last_name>Forthrast</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>John Forthrast</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_authorize_response
|
72
|
+
StubResponse.failed <<-XML
|
73
|
+
<transaction>
|
74
|
+
<amount type="integer">2391</amount>
|
75
|
+
<on_test_gateway type="boolean">true</on_test_gateway>
|
76
|
+
<created_at type="datetime">2013-08-05T13:16:00Z</created_at>
|
77
|
+
<updated_at type="datetime">2013-08-05T13:16:01Z</updated_at>
|
78
|
+
<currency_code>USD</currency_code>
|
79
|
+
<succeeded type="boolean">false</succeeded>
|
80
|
+
<state>gateway_processing_failed</state>
|
81
|
+
<token>PHuCG2kfgyr92CgKuqlblFbgZJP</token>
|
82
|
+
<transaction_type>Authorization</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 authorize transaction.</message>
|
91
|
+
<gateway_token>OJoptVkyEg04N4AxfC6H42IH4HU</gateway_token>
|
92
|
+
<response>
|
93
|
+
<success type="boolean">false</success>
|
94
|
+
<message>Unable to process the authorize 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>The eagle may have perished.</error_detail>
|
102
|
+
<cancelled type="boolean">false</cancelled>
|
103
|
+
<created_at type="datetime">2013-08-05T13:16:01Z</created_at>
|
104
|
+
<updated_at type="datetime">2013-08-05T13:16:01Z</updated_at>
|
105
|
+
</response>
|
106
|
+
<payment_method>
|
107
|
+
<token>8rkaeSF9LILlSyPpNEUsjkGotb6</token>
|
108
|
+
<created_at type="datetime">2013-08-05T13:16:00Z</created_at>
|
109
|
+
<updated_at type="datetime">2013-08-05T13:16:00Z</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,87 @@
|
|
1
|
+
module CaptureStubs
|
2
|
+
|
3
|
+
def successful_capture_response
|
4
|
+
StubResponse.succeeded <<-XML
|
5
|
+
<transaction>
|
6
|
+
<amount type="integer">801</amount>
|
7
|
+
<on_test_gateway type="boolean">true</on_test_gateway>
|
8
|
+
<created_at type="datetime">2013-08-05T13:58:50Z</created_at>
|
9
|
+
<updated_at type="datetime">2013-08-05T13:58:50Z</updated_at>
|
10
|
+
<currency_code>USD</currency_code>
|
11
|
+
<succeeded type="boolean">true</succeeded>
|
12
|
+
<state>succeeded</state>
|
13
|
+
<token>T41uDjYsxGybSsp7RHuRTohMjg2</token>
|
14
|
+
<transaction_type>Capture</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>SoPblCOGDwaRyym68XGWeRiCy1C</gateway_token>
|
24
|
+
<response>
|
25
|
+
<success type="boolean">true</success>
|
26
|
+
<message>Successful capture</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-05T13:58:50Z</created_at>
|
36
|
+
<updated_at type="datetime">2013-08-05T13:58:50Z</updated_at>
|
37
|
+
</response>
|
38
|
+
<reference_token>PH6U2tyFWtDSVp88bNW2nnGy5rk</reference_token>
|
39
|
+
<api_urls>
|
40
|
+
</api_urls>
|
41
|
+
</transaction>
|
42
|
+
XML
|
43
|
+
end
|
44
|
+
|
45
|
+
def failed_capture_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-05T14:25:05Z</created_at>
|
51
|
+
<updated_at type="datetime">2013-08-05T14:25:05Z</updated_at>
|
52
|
+
<currency_code>USD</currency_code>
|
53
|
+
<succeeded type="boolean">false</succeeded>
|
54
|
+
<state>gateway_processing_failed</state>
|
55
|
+
<token>Z4XAoSG11rd4zo9p9sRxpstKufX</token>
|
56
|
+
<transaction_type>Capture</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 capture transaction.</message>
|
65
|
+
<gateway_token>K0L5hw4rhLx1xMTL2cfHWx9D1rX</gateway_token>
|
66
|
+
<response>
|
67
|
+
<success type="boolean">false</success>
|
68
|
+
<message>Unable to process the capture 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 has hit the window.</error_detail>
|
76
|
+
<cancelled type="boolean">false</cancelled>
|
77
|
+
<created_at type="datetime">2013-08-05T14:25:05Z</created_at>
|
78
|
+
<updated_at type="datetime">2013-08-05T14:25:05Z</updated_at>
|
79
|
+
</response>
|
80
|
+
<reference_token>6qTuvZtUlS6eXylk6a2VKUGjYS0</reference_token>
|
81
|
+
<api_urls>
|
82
|
+
</api_urls>
|
83
|
+
</transaction>
|
84
|
+
XML
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module FindGatewayStubs
|
2
|
+
|
3
|
+
def successful_get_gateway_response
|
4
|
+
StubResponse.succeeded <<-XML
|
5
|
+
<gateway>
|
6
|
+
<token>RsVlPgS4dMzeeUpKXxk01rMMRrQ</token>
|
7
|
+
<gateway_type>test</gateway_type>
|
8
|
+
<name>Test</name>
|
9
|
+
<characteristics>
|
10
|
+
<supports_purchase type="boolean">true</supports_purchase>
|
11
|
+
<supports_authorize type="boolean">true</supports_authorize>
|
12
|
+
<supports_capture type="boolean">true</supports_capture>
|
13
|
+
<supports_credit type="boolean">true</supports_credit>
|
14
|
+
<supports_void type="boolean">true</supports_void>
|
15
|
+
<supports_reference_purchase type="boolean">true</supports_reference_purchase>
|
16
|
+
<supports_purchase_via_preauthorization type="boolean">true</supports_purchase_via_preauthorization>
|
17
|
+
<supports_offsite_purchase type="boolean">true</supports_offsite_purchase>
|
18
|
+
<supports_offsite_authorize type="boolean">true</supports_offsite_authorize>
|
19
|
+
<supports_3dsecure_purchase type="boolean">true</supports_3dsecure_purchase>
|
20
|
+
<supports_3dsecure_authorize type="boolean">true</supports_3dsecure_authorize>
|
21
|
+
<supports_store type="boolean">true</supports_store>
|
22
|
+
<supports_remove type="boolean">true</supports_remove>
|
23
|
+
</characteristics>
|
24
|
+
<state>redacted</state>
|
25
|
+
<payment_methods>
|
26
|
+
<payment_method>credit_card</payment_method>
|
27
|
+
<payment_method>sprel</payment_method>
|
28
|
+
<payment_method>third_party_token</payment_method>
|
29
|
+
<payment_method>bank_account</payment_method>
|
30
|
+
</payment_methods>
|
31
|
+
<gateway_specific_fields/>
|
32
|
+
<redacted type="boolean">false</redacted>
|
33
|
+
<created_at type="datetime">2013-08-07T18:53:30Z</created_at>
|
34
|
+
<updated_at type="datetime">2013-08-07T18:53:30Z</updated_at>
|
35
|
+
</gateway>
|
36
|
+
XML
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
module FindPaymentMethodStubs
|
2
|
+
|
3
|
+
def successful_get_card_response
|
4
|
+
StubResponse.succeeded <<-XML
|
5
|
+
<payment_method>
|
6
|
+
<token>ROGJFe89QtbJL8QvjaJNMH0UG50</token>
|
7
|
+
<created_at type="datetime">2013-05-25T17:49:12Z</created_at>
|
8
|
+
<updated_at type="datetime">2013-05-25T18:54:04Z</updated_at>
|
9
|
+
<email>alcatraz@occulators.org</email>
|
10
|
+
<data>
|
11
|
+
<some_attribute>5</some_attribute>
|
12
|
+
</data>
|
13
|
+
<storage_state>retained</storage_state>
|
14
|
+
<last_four_digits>4445</last_four_digits>
|
15
|
+
<card_type>master</card_type>
|
16
|
+
<first_name>Alcatraz</first_name>
|
17
|
+
<last_name>Smedry</last_name>
|
18
|
+
<month type="integer">8</month>
|
19
|
+
<year type="integer">2020</year>
|
20
|
+
<address1>123 Freedom Street</address1>
|
21
|
+
<address2>Apt. 8</address2>
|
22
|
+
<city>Wanaque</city>
|
23
|
+
<state>NJ</state>
|
24
|
+
<zip>02124</zip>
|
25
|
+
<country>USA</country>
|
26
|
+
<phone_number>201.344.7712</phone_number>
|
27
|
+
<full_name>Alcatraz Smedry</full_name>
|
28
|
+
<payment_method_type>credit_card</payment_method_type>
|
29
|
+
<errors>
|
30
|
+
</errors>
|
31
|
+
<verification_value></verification_value>
|
32
|
+
<number>XXXX-XXXX-XXXX-4445</number>
|
33
|
+
</payment_method>
|
34
|
+
XML
|
35
|
+
end
|
36
|
+
|
37
|
+
def successful_get_invalid_card_response
|
38
|
+
StubResponse.succeeded <<-XML
|
39
|
+
<payment_method>
|
40
|
+
<token>CrY4e6wa3Jf4SMUZlvjFelW2YnQ</token>
|
41
|
+
<created_at type="datetime">2013-07-19T17:05:18Z</created_at>
|
42
|
+
<updated_at type="datetime">2013-07-20T05:26:01Z</updated_at>
|
43
|
+
<email nil="true"/>
|
44
|
+
<data>
|
45
|
+
<how_many>2</how_many>
|
46
|
+
</data>
|
47
|
+
<storage_state>redacted</storage_state>
|
48
|
+
<last_four_digits>1881</last_four_digits>
|
49
|
+
<card_type nil="true"/>
|
50
|
+
<first_name></first_name>
|
51
|
+
<last_name></last_name>
|
52
|
+
<month type="integer">8</month>
|
53
|
+
<year nil="true"/>
|
54
|
+
<address1 nil="true"/>
|
55
|
+
<address2 nil="true"/>
|
56
|
+
<city nil="true"/>
|
57
|
+
<state nil="true"/>
|
58
|
+
<zip nil="true"/>
|
59
|
+
<country nil="true"/>
|
60
|
+
<phone_number nil="true"/>
|
61
|
+
<full_name></full_name>
|
62
|
+
<payment_method_type>credit_card</payment_method_type>
|
63
|
+
<errors>
|
64
|
+
<error attribute="first_name" key="errors.blank">First name can't be blank</error>
|
65
|
+
<error attribute="last_name" key="errors.blank">Last name can't be blank</error>
|
66
|
+
<error attribute="year" key="errors.expired">Year is expired</error>
|
67
|
+
<error attribute="year" key="errors.invalid">Year is invalid</error>
|
68
|
+
<error attribute="number" key="errors.blank">Number can't be blank</error>
|
69
|
+
</errors>
|
70
|
+
<verification_value></verification_value>
|
71
|
+
<number>XXXX-XXXX-XXXX-1881</number>
|
72
|
+
</payment_method>
|
73
|
+
XML
|
74
|
+
end
|
75
|
+
|
76
|
+
def successful_get_sprel_response
|
77
|
+
StubResponse.succeeded <<-XML
|
78
|
+
<payment_method>
|
79
|
+
<token>RZf8ZQgvmgOfdWaRtAzMLXPSQbk</token>
|
80
|
+
<created_at type="datetime">2013-04-26T13:11:07Z</created_at>
|
81
|
+
<updated_at type="datetime">2013-04-26T13:18:21Z</updated_at>
|
82
|
+
<email>neelix@voyager.com</email>
|
83
|
+
<data>Some Pretty Data</data>
|
84
|
+
<storage_state>cached</storage_state>
|
85
|
+
<payment_method_type>sprel</payment_method_type>
|
86
|
+
<errors>
|
87
|
+
</errors>
|
88
|
+
</payment_method>
|
89
|
+
XML
|
90
|
+
end
|
91
|
+
|
92
|
+
def successful_get_paypal_response
|
93
|
+
StubResponse.succeeded <<-XML
|
94
|
+
<payment_method>
|
95
|
+
<token>X7DkJT3NUMNMJ0ZVvRMJBEyUe9B</token>
|
96
|
+
<created_at type="datetime">2013-07-31T16:26:59Z</created_at>
|
97
|
+
<updated_at type="datetime">2013-07-31T16:27:26Z</updated_at>
|
98
|
+
<email>shaun@mason.com</email>
|
99
|
+
<data nil="true"/>
|
100
|
+
<storage_state>retained</storage_state>
|
101
|
+
<payment_method_type>paypal</payment_method_type>
|
102
|
+
<errors>
|
103
|
+
</errors>
|
104
|
+
</payment_method>
|
105
|
+
XML
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module FindTransactionStubs
|
2
|
+
|
3
|
+
def successful_get_transaction_response
|
4
|
+
StubResponse.succeeded <<-XML
|
5
|
+
<transaction>
|
6
|
+
<token>2IFzBBh99rwjXKkZ0hkPVLjCBXL</token>
|
7
|
+
<created_at type="datetime">2013-08-05T19:32:49Z</created_at>
|
8
|
+
<updated_at type="datetime">2013-08-05T19:32:49Z</updated_at>
|
9
|
+
<succeeded type="boolean">true</succeeded>
|
10
|
+
<transaction_type>AddPaymentMethod</transaction_type>
|
11
|
+
<retained type="boolean">true</retained>
|
12
|
+
<message key="messages.transaction_succeeded">Succeeded!</message>
|
13
|
+
<payment_method>
|
14
|
+
<token>7sqmBrh8zS4Mgei6wOyYskFpghF</token>
|
15
|
+
<created_at type="datetime">2013-08-05T19:32:49Z</created_at>
|
16
|
+
<updated_at type="datetime">2013-08-05T19:32:49Z</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
|
+
end
|