spreedly 2.0.16 → 2.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/lib/spreedly.rb +2 -0
- data/lib/spreedly/common/fields.rb +5 -2
- data/lib/spreedly/environment.rb +10 -1
- data/lib/spreedly/receiver_class.rb +21 -0
- data/lib/spreedly/transactions/add_payment_method.rb +2 -1
- data/lib/spreedly/transactions/offsite_purchase.rb +7 -0
- data/lib/spreedly/transactions/transaction.rb +2 -0
- data/lib/spreedly/urls.rb +4 -0
- data/lib/spreedly/version.rb +1 -1
- data/test/helpers/creation_helper.rb +25 -1
- data/test/remote/remote_find_transaction_test.rb +1 -1
- data/test/remote/remote_find_transcript_test.rb +1 -1
- data/test/remote/remote_gateway_options_test.rb +1 -1
- data/test/remote/remote_purchase_test.rb +21 -0
- data/test/remote/remote_receiver_options_test.rb +18 -0
- data/test/test_helper.rb +0 -1
- data/test/unit/add_credit_card_test.rb +51 -0
- data/test/unit/fields_test.rb +16 -6
- data/test/unit/find_transaction_test.rb +10 -0
- data/test/unit/receiver_options_test.rb +31 -0
- data/test/unit/response_stubs/add_credit_card_stubs.rb +35 -1
- data/test/unit/response_stubs/find_transaction_stubs.rb +15 -0
- data/test/unit/response_stubs/receiver_options_stubs.rb +22 -0
- metadata +11 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3184c257106f0bad1a9cb40cb5e461b704ddff97
|
4
|
+
data.tar.gz: 758c4e4c12545433de5e2cf5e6ad8bb96a2eaffe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 945d439187bd066d83cf46edbdeb79aedf07cb3833f79b0e416e959dd118179250cd8831866d1063b4f61f2c49995465d92e5125b79f6bf49f52bb842aed740b
|
7
|
+
data.tar.gz: bd33131952ef6e7d8061c1bd307c5c5e43a7aea60942e30872b1f21376dee08fd9e061a772d7ef4c727451ca4630de26e51f2b2b5e60c302151d34413b3858fe
|
data/README.md
CHANGED
@@ -314,6 +314,14 @@ You can get the full list of supported gateways like so:
|
|
314
314
|
env.gateway_options
|
315
315
|
```
|
316
316
|
|
317
|
+
#### Getting meta information about the supported payment method distribution receivers
|
318
|
+
|
319
|
+
You can get the full list of supported receivers like so:
|
320
|
+
|
321
|
+
``` ruby
|
322
|
+
env.receiver_options
|
323
|
+
```
|
324
|
+
|
317
325
|
|
318
326
|
## Error Handling
|
319
327
|
|
data/lib/spreedly.rb
CHANGED
@@ -18,6 +18,7 @@ require 'spreedly/transactions/gateway_transaction'
|
|
18
18
|
require 'spreedly/transactions/add_payment_method'
|
19
19
|
require 'spreedly/transactions/auth_purchase'
|
20
20
|
require 'spreedly/transactions/purchase'
|
21
|
+
require 'spreedly/transactions/offsite_purchase'
|
21
22
|
require 'spreedly/transactions/void'
|
22
23
|
require 'spreedly/transactions/verification'
|
23
24
|
require 'spreedly/transactions/authorization'
|
@@ -32,6 +33,7 @@ require 'spreedly/transactions/store'
|
|
32
33
|
require 'spreedly/gateway'
|
33
34
|
require 'spreedly/receiver'
|
34
35
|
require 'spreedly/gateway_class'
|
36
|
+
require 'spreedly/receiver_class'
|
35
37
|
require 'spreedly/error'
|
36
38
|
|
37
39
|
module Spreedly
|
@@ -7,8 +7,11 @@ module Spreedly
|
|
7
7
|
|
8
8
|
def initialize_fields(xml_doc)
|
9
9
|
self.class.fields.each do |field|
|
10
|
-
|
11
|
-
|
10
|
+
node = xml_doc.at_xpath(".//#{field}")
|
11
|
+
if node
|
12
|
+
value = node.inner_html.strip
|
13
|
+
instance_variable_set("@#{field}", value)
|
14
|
+
end
|
12
15
|
end
|
13
16
|
end
|
14
17
|
|
data/lib/spreedly/environment.rb
CHANGED
@@ -110,6 +110,15 @@ module Spreedly
|
|
110
110
|
self.new("", "").gateway_options
|
111
111
|
end
|
112
112
|
|
113
|
+
def receiver_options
|
114
|
+
xml_doc = ssl_get(receiver_options_url, headers)
|
115
|
+
ReceiverClass.new_list_from(xml_doc)
|
116
|
+
end
|
117
|
+
|
118
|
+
def self.receiver_options
|
119
|
+
self.new("", "").receiver_options
|
120
|
+
end
|
121
|
+
|
113
122
|
def add_gateway(gateway_type, credentials = {})
|
114
123
|
body = add_gateway_body(gateway_type, credentials)
|
115
124
|
xml_doc = ssl_post(add_gateway_url, body, headers)
|
@@ -270,7 +279,7 @@ module Spreedly
|
|
270
279
|
add_gateway_specific_fields(doc, options)
|
271
280
|
add_shipping_address_override(doc, options)
|
272
281
|
add_to_doc(doc, options, :order_id, :description, :ip, :email, :merchant_name_descriptor,
|
273
|
-
:merchant_location_descriptor)
|
282
|
+
:merchant_location_descriptor, :redirect_url, :callback_url)
|
274
283
|
end
|
275
284
|
|
276
285
|
def add_gateway_specific_fields(doc, options)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Spreedly
|
2
|
+
|
3
|
+
class ReceiverClass
|
4
|
+
include Fields
|
5
|
+
|
6
|
+
field :receiver_type, :hostnames, :name, :company_name
|
7
|
+
|
8
|
+
def initialize(xml_doc)
|
9
|
+
initialize_fields(xml_doc)
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.new_list_from(xml_doc)
|
13
|
+
receivers = xml_doc.xpath('.//receivers/receiver')
|
14
|
+
receivers.map do |each|
|
15
|
+
self.new(each)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -8,7 +8,8 @@ module Spreedly
|
|
8
8
|
|
9
9
|
def initialize(xml_doc)
|
10
10
|
super
|
11
|
-
|
11
|
+
payment_method_xml_doc = xml_doc.at_xpath('.//payment_method')
|
12
|
+
@payment_method = payment_method_xml_doc ? PaymentMethod.new_from(payment_method_xml_doc) : nil
|
12
13
|
end
|
13
14
|
|
14
15
|
end
|
data/lib/spreedly/urls.rb
CHANGED
data/lib/spreedly/version.rb
CHANGED
@@ -13,14 +13,38 @@ module Spreedly
|
|
13
13
|
environment.add_credit_card(deets).payment_method
|
14
14
|
end
|
15
15
|
|
16
|
+
def create_sprel_on(environment)
|
17
|
+
body = default_sprel_body(environment)
|
18
|
+
redirect_html = raw_ssl_request(:post, environment.transparent_redirect_form_action, body, {}).body
|
19
|
+
redirect_html.match(/token=(\w+)/)[1]
|
20
|
+
end
|
16
21
|
|
17
22
|
private
|
23
|
+
|
18
24
|
def default_card_deets
|
19
25
|
{
|
20
26
|
email: 'perrin@wot.com', number: '5555555555554444', month: 1, year: 2019,
|
21
27
|
last_name: 'Aybara', first_name: 'Perrin', retained: true
|
22
28
|
}
|
23
29
|
end
|
24
|
-
end
|
25
30
|
|
31
|
+
def default_sprel_body(environment)
|
32
|
+
{
|
33
|
+
environment_key: environment.key,
|
34
|
+
redirect_url: "http://example.com/transparent_redirect_complete",
|
35
|
+
payment_method_type: "sprel"
|
36
|
+
}.map do |key, value|
|
37
|
+
"#{key}=#{CGI.escape(value.to_s)}"
|
38
|
+
end.compact.join("&")
|
39
|
+
end
|
40
|
+
|
41
|
+
def raw_ssl_request(method, endpoint, body, headers, options = {})
|
42
|
+
raw_response = Timeout::timeout(60) do
|
43
|
+
connection = Spreedly::Connection.new(endpoint)
|
44
|
+
connection.request(method, body, headers)
|
45
|
+
end
|
46
|
+
|
47
|
+
raw_response
|
48
|
+
end
|
49
|
+
end
|
26
50
|
end
|
@@ -13,7 +13,7 @@ class RemoteFindTransactionTest < Test::Unit::TestCase
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def test_transaction_not_found
|
16
|
-
|
16
|
+
assert_raise(Spreedly::NotFoundError) do
|
17
17
|
@environment.find_transaction("SomeUnknownToken")
|
18
18
|
end
|
19
19
|
end
|
@@ -13,7 +13,7 @@ class RemoteFindTranscriptTest < Test::Unit::TestCase
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def test_transaction_not_found
|
16
|
-
|
16
|
+
assert_raise(Spreedly::NotFoundError) do
|
17
17
|
@environment.find_transcript("SomeUnknownToken")
|
18
18
|
end
|
19
19
|
end
|
@@ -10,7 +10,7 @@ class RemoteGatewayOptionsTest < Test::Unit::TestCase
|
|
10
10
|
gateway_classes = @environment.gateway_options
|
11
11
|
braintree = gateway_classes.select { |each| each.name == "Braintree" }.first
|
12
12
|
assert_equal "http://www.braintreepaymentsolutions.com/", braintree.homepage
|
13
|
-
assert_equal %w(credit_card third_party_token apple_pay), braintree.payment_methods
|
13
|
+
assert_equal %w(credit_card third_party_token apple_pay android_pay), braintree.payment_methods
|
14
14
|
assert_equal %w(asia_pacific europe north_america), braintree.regions
|
15
15
|
assert_equal %w(orange blue), braintree.auth_modes.map { |e| e.auth_mode_type }
|
16
16
|
assert_equal %w(login password), braintree.auth_modes.first.credentials.map { |e| e.name }
|
@@ -45,6 +45,27 @@ class RemotePurchaseTest < Test::Unit::TestCase
|
|
45
45
|
assert_equal gateway_token, transaction.gateway_token
|
46
46
|
end
|
47
47
|
|
48
|
+
def test_offsite_transaction_arguments
|
49
|
+
gateway_token = @environment.add_gateway(:test).token
|
50
|
+
sprel_token = create_sprel_on(@environment)
|
51
|
+
|
52
|
+
transaction = @environment.purchase_on_gateway(gateway_token, sprel_token, 344,
|
53
|
+
order_id: "8675",
|
54
|
+
description: "SuperDuper",
|
55
|
+
ip: "183.128.100.103",
|
56
|
+
email: "fred@example.com",
|
57
|
+
merchant_name_descriptor: "Real Stuff",
|
58
|
+
merchant_location_descriptor: "Raleigh",
|
59
|
+
retain_on_success: true,
|
60
|
+
redirect_url: "https://example.com/redirect",
|
61
|
+
callback_url: "https://example.com/callback")
|
62
|
+
|
63
|
+
assert_equal "pending", transaction.state
|
64
|
+
assert "https://example.com/callback", transaction.callback_url
|
65
|
+
assert "https://example.com/redirect", transaction.redirect_url
|
66
|
+
assert transaction.checkout_url
|
67
|
+
end
|
68
|
+
|
48
69
|
def test_optional_arguments
|
49
70
|
gateway_token = @environment.add_gateway(:test).token
|
50
71
|
card_token = create_card_on(@environment, retained: false).token
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class RemoteReceiverOptionsTest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
@environment = Spreedly::Environment.new(remote_test_environment_key, remote_test_access_secret)
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_successfully_get_options
|
10
|
+
receiver_classes = @environment.receiver_options
|
11
|
+
ace = receiver_classes.select { |each| each.name == "Acerentacar Receiver" }.first
|
12
|
+
assert_equal "https://ota.acerentacar.com", ace.hostnames
|
13
|
+
assert_equal "Ace Rent a Car", ace.company_name
|
14
|
+
assert_equal "ace_rent_a_car", ace.receiver_type
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
data/test/test_helper.rb
CHANGED
@@ -25,6 +25,8 @@ class AddCreditCreditCardTest < Test::Unit::TestCase
|
|
25
25
|
assert_equal "AXaBXfVUqhaGMg8ytf8isiMAAL9", t.payment_method.token
|
26
26
|
assert_equal "Eland Venture", t.payment_method.full_name
|
27
27
|
assert_equal "Don't test everything here, since find_payment_method tests it all.", t.payment_method.data
|
28
|
+
|
29
|
+
assert t.payment_method.eligible_for_card_updater
|
28
30
|
end
|
29
31
|
|
30
32
|
def test_request_body_params
|
@@ -54,6 +56,55 @@ class AddCreditCreditCardTest < Test::Unit::TestCase
|
|
54
56
|
[ './phone_number', '81Ab' ]
|
55
57
|
end
|
56
58
|
|
59
|
+
def test_successful_add_credit_card_without_fields_in_response
|
60
|
+
t = add_card_using(successful_add_credit_card_partial_response)
|
61
|
+
|
62
|
+
assert_kind_of(Spreedly::AddPaymentMethod, t)
|
63
|
+
assert_kind_of(Spreedly::CreditCard, t.payment_method)
|
64
|
+
|
65
|
+
assert_equal '6wxjN6HcDik8e3mAhBaaoVGSImH', t.token
|
66
|
+
assert !t.retained?
|
67
|
+
assert t.succeeded?
|
68
|
+
assert_equal Time.parse("2013-08-02T18:04:45Z"), t.created_at
|
69
|
+
assert_equal Time.parse("2013-08-02T18:04:45Z"), t.updated_at
|
70
|
+
assert_equal 'Succeeded!', t.message
|
71
|
+
|
72
|
+
assert_equal "AXaBXfVUqhaGMg8ytf8isiMAAL9", t.payment_method.token
|
73
|
+
assert_equal "Don't test everything here, since find_payment_method tests it all.", t.payment_method.data
|
74
|
+
|
75
|
+
assert_nil t.payment_method.full_name
|
76
|
+
assert_nil t.payment_method.address1
|
77
|
+
assert_nil t.payment_method.address2
|
78
|
+
assert_nil t.payment_method.city
|
79
|
+
assert_nil t.payment_method.state
|
80
|
+
assert_nil t.payment_method.zip
|
81
|
+
assert_nil t.payment_method.eligible_for_card_updater
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_request_body_params_without_fields_in_response
|
85
|
+
body = get_request_body(successful_add_credit_card_partial_response) do
|
86
|
+
@environment.add_credit_card(full_card_details)
|
87
|
+
end
|
88
|
+
|
89
|
+
payment_method = body.xpath('./payment_method')
|
90
|
+
assert_xpaths_in payment_method, [ './retained', 'true' ]
|
91
|
+
|
92
|
+
card = body.xpath('./payment_method/credit_card')
|
93
|
+
assert_xpaths_in card,
|
94
|
+
[ './first_name', 'Leavenworth' ],
|
95
|
+
[ './last_name', 'Smedry' ],
|
96
|
+
[ './number', '9555555555554444' ],
|
97
|
+
[ './month', '3' ],
|
98
|
+
[ './year', '2021' ]
|
99
|
+
|
100
|
+
assert_nil body.at_xpath('./payment_method/address1')
|
101
|
+
assert_nil body.at_xpath('./payment_method/address2')
|
102
|
+
assert_nil body.at_xpath('./payment_method/city')
|
103
|
+
assert_nil body.at_xpath('./payment_method/state')
|
104
|
+
assert_nil body.at_xpath('./payment_method/zip')
|
105
|
+
assert_nil body.at_xpath('./payment_method/eligible_for_card_updater')
|
106
|
+
end
|
107
|
+
|
57
108
|
private
|
58
109
|
def add_card_using(response)
|
59
110
|
@environment.stubs(:raw_ssl_request).returns(response)
|
data/test/unit/fields_test.rb
CHANGED
@@ -4,15 +4,15 @@ class FieldsTest < Test::Unit::TestCase
|
|
4
4
|
|
5
5
|
class ModelWithFields
|
6
6
|
include Spreedly::Fields
|
7
|
-
field :message, :amount, :on_test_gateway, :updated_at, :succeeded
|
7
|
+
field :message, :amount, :on_test_gateway, :updated_at, :succeeded, :field_not_in_response
|
8
8
|
end
|
9
9
|
|
10
10
|
class ModelWithTypedFields
|
11
11
|
include Spreedly::Fields
|
12
|
-
field :message
|
13
|
-
field :succeeded, :on_test_gateway, type: :boolean
|
14
|
-
field :amount, type: :integer
|
15
|
-
field :updated_at, type: :date_time
|
12
|
+
field :message, :string_field_not_in_response
|
13
|
+
field :succeeded, :on_test_gateway, :boolean_field_not_in_response, type: :boolean
|
14
|
+
field :amount, :integer_field_not_in_response, type: :integer
|
15
|
+
field :updated_at, :date_time_field_not_in_response, type: :date_time
|
16
16
|
end
|
17
17
|
|
18
18
|
def setup
|
@@ -26,6 +26,7 @@ class FieldsTest < Test::Unit::TestCase
|
|
26
26
|
assert_nil @model.on_test_gateway
|
27
27
|
assert_nil @model.updated_at
|
28
28
|
assert_nil @model.succeeded
|
29
|
+
assert_nil @model.field_not_in_response
|
29
30
|
end
|
30
31
|
|
31
32
|
def test_defaults_to_nil_for_typed_fields
|
@@ -36,6 +37,10 @@ class FieldsTest < Test::Unit::TestCase
|
|
36
37
|
assert_nil @typed_model.updated_at
|
37
38
|
assert_nil @typed_model.succeeded
|
38
39
|
assert_nil @typed_model.succeeded?
|
40
|
+
assert_nil @typed_model.string_field_not_in_response
|
41
|
+
assert_nil @typed_model.boolean_field_not_in_response
|
42
|
+
assert_nil @typed_model.integer_field_not_in_response
|
43
|
+
assert_nil @typed_model.date_time_field_not_in_response
|
39
44
|
end
|
40
45
|
|
41
46
|
def test_initialize_fields_for_strings
|
@@ -45,6 +50,7 @@ class FieldsTest < Test::Unit::TestCase
|
|
45
50
|
assert_equal "true", @model.on_test_gateway
|
46
51
|
assert_equal "2013-07-31T19:51:57Z", @model.updated_at
|
47
52
|
assert_equal "false", @model.succeeded
|
53
|
+
assert_nil @model.field_not_in_response
|
48
54
|
end
|
49
55
|
|
50
56
|
def test_initialize_fields_for_typed_fields
|
@@ -56,9 +62,13 @@ class FieldsTest < Test::Unit::TestCase
|
|
56
62
|
assert_equal Time.parse("2013-07-31T19:51:57Z"), @typed_model.updated_at
|
57
63
|
assert_equal false, @typed_model.succeeded
|
58
64
|
assert_equal false, @typed_model.succeeded?
|
65
|
+
|
66
|
+
assert_nil @typed_model.string_field_not_in_response
|
67
|
+
assert_nil @typed_model.boolean_field_not_in_response
|
68
|
+
assert_nil @typed_model.integer_field_not_in_response
|
69
|
+
assert_nil @typed_model.date_time_field_not_in_response
|
59
70
|
end
|
60
71
|
|
61
|
-
|
62
72
|
private
|
63
73
|
def xml
|
64
74
|
<<-XML
|
@@ -32,6 +32,16 @@ class FindTransactionTest < Test::Unit::TestCase
|
|
32
32
|
assert_nil t.response
|
33
33
|
end
|
34
34
|
|
35
|
+
def test_add_payment_method_transaction_with_no_payment_method
|
36
|
+
t = find_using(add_credit_card_transaction_sans_payment_method_method)
|
37
|
+
|
38
|
+
assert_kind_of(Spreedly::AddPaymentMethod, t)
|
39
|
+
assert_equal("rMyrUp27o11gA1pZu2SikMVRNIn", t.token)
|
40
|
+
|
41
|
+
assert !t.succeeded?
|
42
|
+
assert_nil t.payment_method
|
43
|
+
end
|
44
|
+
|
35
45
|
private
|
36
46
|
def find_using(response)
|
37
47
|
@environment.stubs(:raw_ssl_request).returns(response)
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'unit/response_stubs/receiver_options_stubs'
|
3
|
+
|
4
|
+
class ReceiverOptionsTest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
include ReceiverOptionsStubs
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@environment = Spreedly::Environment.new("key", "secret")
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_successful_receiver_options
|
13
|
+
@environment.stubs(:raw_ssl_request).returns(successful_receiver_options_response)
|
14
|
+
list = @environment.receiver_options
|
15
|
+
|
16
|
+
assert_kind_of(Array, list)
|
17
|
+
assert_equal 2, list.size
|
18
|
+
|
19
|
+
assert_equal 'test', list.first.receiver_type
|
20
|
+
assert_equal 'Api', list.first.name
|
21
|
+
assert_equal "http://api.example.com/post", list.first.hostnames
|
22
|
+
assert_equal "The Example API", list.first.company_name
|
23
|
+
assert_equal 'test', list.last.receiver_type
|
24
|
+
assert_equal 'Funny', list.last.name
|
25
|
+
assert_equal "http://funny.pretend.example.com", list.last.hostnames
|
26
|
+
assert_equal "Funny Pretend", list.last.company_name
|
27
|
+
assert_kind_of Spreedly::ReceiverClass, list.first
|
28
|
+
assert_kind_of Spreedly::ReceiverClass, list.last
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -35,7 +35,41 @@ module AddCreditCardStubs
|
|
35
35
|
<full_name>Eland Venture</full_name>
|
36
36
|
<eligible_for_card_updater type="boolean">true</eligible_for_card_updater>
|
37
37
|
<payment_method_type>credit_card</payment_method_type>
|
38
|
-
<
|
38
|
+
<errors>
|
39
|
+
</errors>
|
40
|
+
<verification_value></verification_value>
|
41
|
+
<fingerprint>ac5579920013cc571e506805f1c8f3220eff</fingerprint>
|
42
|
+
<number>XXXX-XXXX-XXXX-4942</number>
|
43
|
+
</payment_method>
|
44
|
+
</transaction>
|
45
|
+
XML
|
46
|
+
end
|
47
|
+
|
48
|
+
def successful_add_credit_card_partial_response
|
49
|
+
StubResponse.succeeded <<-XML
|
50
|
+
<transaction>
|
51
|
+
<token>6wxjN6HcDik8e3mAhBaaoVGSImH</token>
|
52
|
+
<created_at type="datetime">2013-08-02T18:04:45Z</created_at>
|
53
|
+
<updated_at type="datetime">2013-08-02T18:04:45Z</updated_at>
|
54
|
+
<succeeded type="boolean">true</succeeded>
|
55
|
+
<transaction_type>AddPaymentMethod</transaction_type>
|
56
|
+
<retained type="boolean">false</retained>
|
57
|
+
<message key="messages.transaction_succeeded">Succeeded!</message>
|
58
|
+
<payment_method>
|
59
|
+
<token>AXaBXfVUqhaGMg8ytf8isiMAAL9</token>
|
60
|
+
<created_at type="datetime">2013-08-02T18:04:45Z</created_at>
|
61
|
+
<updated_at type="datetime">2013-08-02T18:04:45Z</updated_at>
|
62
|
+
<email>ellend@mistborn.com</email>
|
63
|
+
<data>Don't test everything here, since find_payment_method tests it all.</data>
|
64
|
+
<storage_state>cached</storage_state>
|
65
|
+
<last_four_digits>4942</last_four_digits>
|
66
|
+
<first_six_digits>411111</first_six_digits>
|
67
|
+
<card_type>master</card_type>
|
68
|
+
<first_name>Eland</first_name>
|
69
|
+
<last_name>Venture</last_name>
|
70
|
+
<month type="integer">1</month>
|
71
|
+
<year type="integer">2019</year>
|
72
|
+
<payment_method_type>credit_card</payment_method_type>
|
39
73
|
<errors>
|
40
74
|
</errors>
|
41
75
|
<verification_value></verification_value>
|
@@ -105,4 +105,19 @@ module FindTransactionStubs
|
|
105
105
|
XML
|
106
106
|
end
|
107
107
|
|
108
|
+
def add_credit_card_transaction_sans_payment_method_method
|
109
|
+
StubResponse.succeeded <<-XML
|
110
|
+
<transaction>
|
111
|
+
<token>rMyrUp27o11gA1pZu2SikMVRNIn</token>
|
112
|
+
<created_at type="dateTime">2015-03-11T06:22:57Z</created_at>
|
113
|
+
<updated_at type="dateTime">2015-03-11T06:22:57Z</updated_at>
|
114
|
+
<succeeded type="boolean">false</succeeded>
|
115
|
+
<transaction_type>AddPaymentMethod</transaction_type>
|
116
|
+
<retained type="boolean">false</retained>
|
117
|
+
<state>created</state>
|
118
|
+
<message nil="true"/>
|
119
|
+
</transaction>
|
120
|
+
XML
|
121
|
+
end
|
122
|
+
|
108
123
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module ReceiverOptionsStubs
|
2
|
+
|
3
|
+
def successful_receiver_options_response
|
4
|
+
StubResponse.succeeded <<-XML
|
5
|
+
<receivers>
|
6
|
+
<receiver>
|
7
|
+
<name>Api</name>
|
8
|
+
<receiver_type>test</receiver_type>
|
9
|
+
<hostnames>http://api.example.com/post</hostnames>
|
10
|
+
<company_name>The Example API</company>
|
11
|
+
</receiver>
|
12
|
+
<receiver>
|
13
|
+
<name>Funny</name>
|
14
|
+
<receiver_type>test</receiver_type>
|
15
|
+
<hostnames>http://funny.pretend.example.com</hostnames>
|
16
|
+
<company_name>Funny Pretend</company>
|
17
|
+
</receiver>
|
18
|
+
</receivers>
|
19
|
+
XML
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spreedly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Spreedly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -140,6 +140,7 @@ files:
|
|
140
140
|
- lib/spreedly/payment_methods/sprel.rb
|
141
141
|
- lib/spreedly/payment_methods/third_party_token.rb
|
142
142
|
- lib/spreedly/receiver.rb
|
143
|
+
- lib/spreedly/receiver_class.rb
|
143
144
|
- lib/spreedly/ssl_requester.rb
|
144
145
|
- lib/spreedly/transactions/add_payment_method.rb
|
145
146
|
- lib/spreedly/transactions/auth_purchase.rb
|
@@ -147,6 +148,7 @@ files:
|
|
147
148
|
- lib/spreedly/transactions/capture.rb
|
148
149
|
- lib/spreedly/transactions/deliver_payment_method.rb
|
149
150
|
- lib/spreedly/transactions/gateway_transaction.rb
|
151
|
+
- lib/spreedly/transactions/offsite_purchase.rb
|
150
152
|
- lib/spreedly/transactions/purchase.rb
|
151
153
|
- lib/spreedly/transactions/recache_sensitive_data.rb
|
152
154
|
- lib/spreedly/transactions/redact_gateway.rb
|
@@ -181,6 +183,7 @@ files:
|
|
181
183
|
- test/remote/remote_list_payment_methods_test.rb
|
182
184
|
- test/remote/remote_list_transactions_test.rb
|
183
185
|
- test/remote/remote_purchase_test.rb
|
186
|
+
- test/remote/remote_receiver_options_test.rb
|
184
187
|
- test/remote/remote_redact_gateway_test.rb
|
185
188
|
- test/remote/remote_redact_payment_method_test.rb
|
186
189
|
- test/remote/remote_refund_test.rb
|
@@ -207,6 +210,7 @@ files:
|
|
207
210
|
- test/unit/list_payment_methods_test.rb
|
208
211
|
- test/unit/list_transactions_test.rb
|
209
212
|
- test/unit/purchase_test.rb
|
213
|
+
- test/unit/receiver_options_test.rb
|
210
214
|
- test/unit/redact_gateway_test.rb
|
211
215
|
- test/unit/redact_payment_method_test.rb
|
212
216
|
- test/unit/refund_test.rb
|
@@ -224,6 +228,7 @@ files:
|
|
224
228
|
- test/unit/response_stubs/list_payment_methods_stubs.rb
|
225
229
|
- test/unit/response_stubs/list_transactions_stubs.rb
|
226
230
|
- test/unit/response_stubs/purchase_stubs.rb
|
231
|
+
- test/unit/response_stubs/receiver_options_stubs.rb
|
227
232
|
- test/unit/response_stubs/redact_gateway_stubs.rb
|
228
233
|
- test/unit/response_stubs/redact_payment_method_stubs.rb
|
229
234
|
- test/unit/response_stubs/refund_stubs.rb
|
@@ -258,7 +263,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
258
263
|
version: '0'
|
259
264
|
requirements: []
|
260
265
|
rubyforge_project:
|
261
|
-
rubygems_version: 2.
|
266
|
+
rubygems_version: 2.2.5
|
262
267
|
signing_key:
|
263
268
|
specification_version: 4
|
264
269
|
summary: Provides a Ruby wrapper for the Spreedly API.
|
@@ -284,6 +289,7 @@ test_files:
|
|
284
289
|
- test/remote/remote_list_payment_methods_test.rb
|
285
290
|
- test/remote/remote_list_transactions_test.rb
|
286
291
|
- test/remote/remote_purchase_test.rb
|
292
|
+
- test/remote/remote_receiver_options_test.rb
|
287
293
|
- test/remote/remote_redact_gateway_test.rb
|
288
294
|
- test/remote/remote_redact_payment_method_test.rb
|
289
295
|
- test/remote/remote_refund_test.rb
|
@@ -310,6 +316,7 @@ test_files:
|
|
310
316
|
- test/unit/list_payment_methods_test.rb
|
311
317
|
- test/unit/list_transactions_test.rb
|
312
318
|
- test/unit/purchase_test.rb
|
319
|
+
- test/unit/receiver_options_test.rb
|
313
320
|
- test/unit/redact_gateway_test.rb
|
314
321
|
- test/unit/redact_payment_method_test.rb
|
315
322
|
- test/unit/refund_test.rb
|
@@ -327,6 +334,7 @@ test_files:
|
|
327
334
|
- test/unit/response_stubs/list_payment_methods_stubs.rb
|
328
335
|
- test/unit/response_stubs/list_transactions_stubs.rb
|
329
336
|
- test/unit/response_stubs/purchase_stubs.rb
|
337
|
+
- test/unit/response_stubs/receiver_options_stubs.rb
|
330
338
|
- test/unit/response_stubs/redact_gateway_stubs.rb
|
331
339
|
- test/unit/response_stubs/redact_payment_method_stubs.rb
|
332
340
|
- test/unit/response_stubs/refund_stubs.rb
|