spreedly 2.0.18 → 2.0.19
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.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/CHANGELOG.md +18 -0
- data/README.md +6 -2
- data/Rakefile +2 -14
- data/lib/spreedly/environment.rb +21 -1
- data/lib/spreedly/gateway_class.rb +1 -1
- data/lib/spreedly/payment_methods/payment_method.rb +1 -1
- data/lib/spreedly/receiver.rb +1 -1
- data/lib/spreedly/transactions/auth_purchase.rb +2 -5
- data/lib/spreedly/transactions/gateway_transaction.rb +6 -5
- data/lib/spreedly/transactions/purchase.rb +0 -3
- data/lib/spreedly/urls.rb +8 -0
- data/lib/spreedly/version.rb +1 -1
- data/spreedly.gemspec +14 -17
- data/test/credentials/credentials.yml.example +5 -0
- data/test/credentials/test_credentials.rb +1 -1
- data/test/helpers/creation_helper.rb +1 -1
- data/test/remote/remote_add_credit_card_test.rb +2 -2
- data/test/remote/remote_add_receiver_test.rb +2 -2
- data/test/remote/remote_deliver_payment_method_test.rb +3 -3
- data/test/remote/remote_gateway_options_test.rb +1 -1
- data/test/remote/remote_purchase_test.rb +24 -0
- data/test/remote/remote_recache_payment_method_test.rb +30 -0
- data/test/remote/remote_redact_receiver_test.rb +16 -0
- data/test/remote/remote_update_credit_card_test.rb +1 -1
- data/test/unit/add_credit_card_test.rb +1 -2
- data/test/unit/authorize_test.rb +7 -2
- data/test/unit/capture_test.rb +2 -0
- data/test/unit/find_payment_method_test.rb +1 -0
- data/test/unit/list_payment_methods_test.rb +1 -0
- data/test/unit/purchase_test.rb +58 -2
- data/test/unit/recache_payment_method_test.rb +34 -0
- data/test/unit/refund_test.rb +1 -0
- data/test/unit/response_stubs/authorization_stubs.rb +5 -2
- data/test/unit/response_stubs/capture_stubs.rb +5 -1
- data/test/unit/response_stubs/purchase_stubs.rb +105 -0
- data/test/unit/response_stubs/recache_payment_method_stubs.rb +53 -0
- data/test/unit/verify_test.rb +5 -2
- data/test/unit/void_test.rb +1 -0
- metadata +25 -14
- data/test/credentials/credentials.yml +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0110d918dc588bb377b7d8cfb5071e438cb74103
|
4
|
+
data.tar.gz: 8afcecf45db7a9e8fc7da38d9fdffc7fa8566b8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66bbfc2431d1aee375fffda01c43d1dba5b4c3c0440f3b5c24d8ba587bb5ad1521287f6afee507a1f39db8f3baddc615d71c229b6ededf8f0592df42cb6ff300
|
7
|
+
data.tar.gz: 2c3862d8c1eac3d9d5a1c53142210530b11302c70d79f510b51524e746f7368c7f8c606a492e7649f2216af3c51a579f3b10c3a5187b4181a823f7e86cf9bdc6
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
## [Unreleased]
|
6
|
+
|
7
|
+
## [2.0.19] - 2019-06-07
|
8
|
+
### Added
|
9
|
+
- Lori Holden - Receiver redaction
|
10
|
+
- Lancelot Carlson - Recached payment method support
|
11
|
+
- @pawel-krysiak and @jeremywrowe - Support 3D-Secure transactions
|
12
|
+
|
13
|
+
### Changed
|
14
|
+
- @therufs - Expose `display_api_url` on gateway
|
15
|
+
- @ZeusPerez - Expose `continue_caching` on transactions
|
16
|
+
- @adamcohen - Expose `transaction_type` on transaction
|
17
|
+
- @adamcohen - Expose `gateway_specific_response_fields` on transaction
|
18
|
+
- @adamcohen - Expose `payment_method_type` on transaction
|
data/README.md
CHANGED
@@ -273,7 +273,7 @@ Here's how you can do it:
|
|
273
273
|
|
274
274
|
``` ruby
|
275
275
|
options = {
|
276
|
-
email: 'perrin@wot.com', number: '5555555555554444', month: 1, year:
|
276
|
+
email: 'perrin@wot.com', number: '5555555555554444', month: 1, year: 2023, last_name: 'Aybara', first_name: 'Perrin', data: "occupation: Blacksmith"
|
277
277
|
}
|
278
278
|
transaction = env.add_credit_card(options)
|
279
279
|
|
@@ -286,7 +286,7 @@ You can also retain the card immediately like so:
|
|
286
286
|
|
287
287
|
``` ruby
|
288
288
|
options = {
|
289
|
-
email: 'perrin@wot.com', number: '5555555555554444', month: 1, year:
|
289
|
+
email: 'perrin@wot.com', number: '5555555555554444', month: 1, year: 2023, last_name: 'Aybara', first_name: 'Perrin', data: "occupation: Blacksmith", retained: true
|
290
290
|
}
|
291
291
|
transaction = env.add_credit_card(options)
|
292
292
|
|
@@ -409,3 +409,7 @@ There are two rake tasks to help run the tests:
|
|
409
409
|
rake test:remote # Run remote tests that actually hit the Spreedly site
|
410
410
|
rake test:units # Run unit tests
|
411
411
|
```
|
412
|
+
|
413
|
+
To run remote tests you'll need to copy `test/credentials/credentials.yml.example` to `test/credentials/credentials.yml` and update the values of `environment_key` and `access_secret`.
|
414
|
+
|
415
|
+
When you're happy with your change, don't forget to add your contributions to CHANGELOG.md. We follow the changelog format found [here](https://keepachangelog.com/en/1.0.0/).
|
data/Rakefile
CHANGED
@@ -2,20 +2,10 @@ require "bundler/gem_tasks"
|
|
2
2
|
|
3
3
|
require 'rake/testtask'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
# end
|
8
|
-
|
9
|
-
# desc "Run tests"
|
10
|
-
# task :default => :test
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
desc "Run the unit test suite"
|
15
|
-
task :default => 'test:units'
|
5
|
+
desc 'Run the unit test suite'
|
6
|
+
task default: 'test:units'
|
16
7
|
|
17
8
|
namespace :test do
|
18
|
-
|
19
9
|
Rake::TestTask.new(:units) do |t|
|
20
10
|
t.pattern = 'test/unit/**/*_test.rb'
|
21
11
|
t.libs << 'test'
|
@@ -27,6 +17,4 @@ namespace :test do
|
|
27
17
|
t.libs << 'test'
|
28
18
|
t.verbose = true
|
29
19
|
end
|
30
|
-
|
31
20
|
end
|
32
|
-
|
data/lib/spreedly/environment.rb
CHANGED
@@ -76,11 +76,22 @@ module Spreedly
|
|
76
76
|
Transaction.new_from(xml_doc)
|
77
77
|
end
|
78
78
|
|
79
|
+
def recache_payment_method(payment_method_token, options = {})
|
80
|
+
body = recache_payment_method_body(options)
|
81
|
+
xml_doc = ssl_put(recache_payment_method_url(payment_method_token), body, headers)
|
82
|
+
RecacheSensitiveData.new_from(xml_doc)
|
83
|
+
end
|
84
|
+
|
79
85
|
def redact_gateway(gateway_token, options = {})
|
80
86
|
xml_doc = ssl_put(redact_gateway_url(gateway_token), '', headers)
|
81
87
|
Transaction.new_from(xml_doc)
|
82
88
|
end
|
83
89
|
|
90
|
+
def redact_receiver(receiver_token, options = {})
|
91
|
+
xml_doc = ssl_put(redact_receiver_url(receiver_token), '', headers)
|
92
|
+
Transaction.new_from(xml_doc)
|
93
|
+
end
|
94
|
+
|
84
95
|
def list_transactions(since_token = nil, payment_method_token = nil)
|
85
96
|
xml_doc = ssl_get(list_transactions_url(since_token, payment_method_token), headers)
|
86
97
|
Transaction.new_list_from(xml_doc)
|
@@ -205,6 +216,14 @@ module Spreedly
|
|
205
216
|
end
|
206
217
|
end
|
207
218
|
|
219
|
+
def recache_payment_method_body(options)
|
220
|
+
build_xml_request('payment_method') do |doc|
|
221
|
+
doc.credit_card do
|
222
|
+
add_to_doc(doc, options, :verification_value)
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
208
227
|
def add_gateway_body(gateway_type, credentials)
|
209
228
|
build_xml_request('gateway') do |doc|
|
210
229
|
doc.gateway_type gateway_type
|
@@ -279,7 +298,8 @@ module Spreedly
|
|
279
298
|
add_gateway_specific_fields(doc, options)
|
280
299
|
add_shipping_address_override(doc, options)
|
281
300
|
add_to_doc(doc, options, :order_id, :description, :ip, :email, :merchant_name_descriptor,
|
282
|
-
:merchant_location_descriptor, :redirect_url, :callback_url
|
301
|
+
:merchant_location_descriptor, :redirect_url, :callback_url,
|
302
|
+
:continue_caching, :attempt_3dsecure, :browser_info)
|
283
303
|
end
|
284
304
|
|
285
305
|
def add_gateway_specific_fields(doc, options)
|
@@ -3,7 +3,7 @@ module Spreedly
|
|
3
3
|
class GatewayClass
|
4
4
|
include Fields
|
5
5
|
|
6
|
-
field :gateway_type, :name, :homepage, :company_name
|
6
|
+
field :gateway_type, :name, :homepage, :company_name, :display_api_url
|
7
7
|
field :supports_purchase, :supports_authorize, :supports_capture, :supports_credit,
|
8
8
|
:supports_void, :supports_verify, :supports_reference_purchase,
|
9
9
|
:supports_purchase_via_preauthorization, :supports_offsite_purchase,
|
data/lib/spreedly/receiver.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
module Spreedly
|
2
|
-
|
3
2
|
class AuthPurchase < GatewayTransaction
|
4
|
-
|
5
|
-
field :
|
3
|
+
field :currency_code, :checkout_url, :checkout_form, :redirect_url, :callback_url
|
4
|
+
field :required_action, :challenge_form, :challenge_url, :device_fingerprint_form
|
6
5
|
field :amount, type: :integer
|
7
6
|
|
8
7
|
attr_reader :payment_method
|
@@ -11,7 +10,5 @@ module Spreedly
|
|
11
10
|
super
|
12
11
|
@payment_method = PaymentMethod.new_from(xml_doc.at_xpath('.//payment_method'))
|
13
12
|
end
|
14
|
-
|
15
13
|
end
|
16
|
-
|
17
14
|
end
|
@@ -2,11 +2,11 @@ module Spreedly
|
|
2
2
|
|
3
3
|
class GatewayTransaction < Transaction
|
4
4
|
|
5
|
-
field :order_id, :ip, :description, :gateway_token, :gateway_transaction_id, :email
|
5
|
+
field :order_id, :ip, :description, :gateway_token, :gateway_transaction_id, :email, :transaction_type
|
6
6
|
field :merchant_name_descriptor, :merchant_location_descriptor
|
7
7
|
field :on_test_gateway, type: :boolean
|
8
8
|
|
9
|
-
attr_reader :response, :gateway_specific_fields, :shipping_address
|
9
|
+
attr_reader :response, :gateway_specific_fields, :gateway_specific_response_fields, :shipping_address
|
10
10
|
|
11
11
|
def initialize(xml_doc)
|
12
12
|
super
|
@@ -14,13 +14,14 @@ module Spreedly
|
|
14
14
|
shipping_address_xml_doc = xml_doc.at_xpath('.//shipping_address')
|
15
15
|
@response = response_xml_doc ? Response.new(response_xml_doc) : nil
|
16
16
|
@shipping_address = shipping_address_xml_doc ? ShippingAddress.new(shipping_address_xml_doc) : nil
|
17
|
-
@gateway_specific_fields =
|
17
|
+
@gateway_specific_fields = parse_gateway_fields(xml_doc, './/gateway_specific_fields')
|
18
|
+
@gateway_specific_response_fields = parse_gateway_fields(xml_doc, './/gateway_specific_response_fields')
|
18
19
|
end
|
19
20
|
|
20
|
-
def
|
21
|
+
def parse_gateway_fields(xml_doc, path)
|
21
22
|
result = {}
|
22
23
|
|
23
|
-
xml_doc.at_xpath(
|
24
|
+
xml_doc.at_xpath(path).xpath('*').each do |node|
|
24
25
|
node_name = node.name.to_sym
|
25
26
|
if (node.elements.empty?)
|
26
27
|
result[node_name] = node.text
|
data/lib/spreedly/urls.rb
CHANGED
@@ -50,6 +50,10 @@ module Spreedly
|
|
50
50
|
"#{base_url}/v1/payment_methods/#{payment_method_token}/redact.xml"
|
51
51
|
end
|
52
52
|
|
53
|
+
def recache_payment_method_url(payment_method_token)
|
54
|
+
"#{base_url}/v1/payment_methods/#{payment_method_token}/recache.xml"
|
55
|
+
end
|
56
|
+
|
53
57
|
def redact_gateway_url(gateway_token)
|
54
58
|
"#{base_url}/v1/gateways/#{gateway_token}/redact.xml"
|
55
59
|
end
|
@@ -91,6 +95,10 @@ module Spreedly
|
|
91
95
|
"#{base_url}/v1/receivers.xml"
|
92
96
|
end
|
93
97
|
|
98
|
+
def redact_receiver_url(token)
|
99
|
+
"#{base_url}/v1/receivers/#{token}/redact.xml"
|
100
|
+
end
|
101
|
+
|
94
102
|
def add_payment_method_url
|
95
103
|
"#{base_url}/v1/payment_methods.xml"
|
96
104
|
end
|
data/lib/spreedly/version.rb
CHANGED
data/spreedly.gemspec
CHANGED
@@ -1,30 +1,27 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require 'spreedly/version'
|
5
4
|
|
6
|
-
|
7
5
|
Gem::Specification.new do |s|
|
8
|
-
s.name =
|
6
|
+
s.name = 'spreedly'
|
9
7
|
s.version = Spreedly::VERSION
|
10
|
-
s.authors = [
|
11
|
-
s.email = [
|
12
|
-
s.summary =
|
13
|
-
s.description =
|
14
|
-
s.homepage =
|
15
|
-
s.license =
|
8
|
+
s.authors = ['Spreedly']
|
9
|
+
s.email = ['duff@spreedly.com', 'doug@spreedly.com', 'jeremy@spreedly.com']
|
10
|
+
s.summary = 'Provides a Ruby wrapper for the Spreedly API.'
|
11
|
+
s.description = 'The Spreedly gem provides a convenient Ruby wrapper for the Spreedly API.'
|
12
|
+
s.homepage = 'https://github.com/spreedly/spreedly-gem'
|
13
|
+
s.license = 'MIT'
|
16
14
|
|
17
|
-
s.files = `git ls-files`.split(
|
15
|
+
s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
18
16
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
19
|
-
s.require_paths = [
|
17
|
+
s.require_paths = ['lib']
|
20
18
|
|
21
19
|
s.add_dependency 'nokogiri'
|
22
20
|
|
23
|
-
s.add_development_dependency 'bundler', '~> 1.3'
|
24
|
-
s.add_development_dependency 'rake'
|
25
|
-
s.add_development_dependency 'mocha'
|
26
|
-
s.add_development_dependency 'log_buddy'
|
27
21
|
s.add_development_dependency 'awesome_print'
|
22
|
+
s.add_development_dependency 'bundler'
|
23
|
+
s.add_development_dependency 'log_buddy'
|
24
|
+
s.add_development_dependency 'mocha'
|
25
|
+
s.add_development_dependency 'rake'
|
28
26
|
s.add_development_dependency 'test-unit'
|
29
27
|
end
|
30
|
-
|
@@ -23,7 +23,7 @@ module Spreedly
|
|
23
23
|
|
24
24
|
def default_card_deets
|
25
25
|
{
|
26
|
-
email: 'perrin@wot.com', number: '5555555555554444', month: 1, year:
|
26
|
+
email: 'perrin@wot.com', number: '5555555555554444', month: 1, year: 2023,
|
27
27
|
last_name: 'Aybara', first_name: 'Perrin', retained: true
|
28
28
|
}
|
29
29
|
end
|
@@ -51,7 +51,7 @@ class RemoteAddCreditCardTest < Test::Unit::TestCase
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def test_successfull_add_using_full_name
|
54
|
-
t = @environment.add_credit_card(number: '5555555555554444', month: 1, year:
|
54
|
+
t = @environment.add_credit_card(number: '5555555555554444', month: 1, year: 2023, full_name: "Kvothe Jones")
|
55
55
|
assert t.succeeded?
|
56
56
|
assert_equal "Kvothe", t.payment_method.first_name
|
57
57
|
assert_equal "Jones", t.payment_method.last_name
|
@@ -62,7 +62,7 @@ class RemoteAddCreditCardTest < Test::Unit::TestCase
|
|
62
62
|
private
|
63
63
|
def card_deets(options = {})
|
64
64
|
{
|
65
|
-
email: 'perrin@wot.com', number: '5555555555554444', month: 1, year:
|
65
|
+
email: 'perrin@wot.com', number: '5555555555554444', month: 1, year: 2023,
|
66
66
|
last_name: 'Aybara', first_name: 'Perrin', data: "occupation: Blacksmith"
|
67
67
|
}.merge(options)
|
68
68
|
end
|
@@ -25,9 +25,9 @@ class RemoteAddReceiverTest < Test::Unit::TestCase
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def test_add_test_receiver
|
28
|
-
receiver = @environment.add_receiver(:test, 'http://
|
28
|
+
receiver = @environment.add_receiver(:test, 'http://spreedly-echo.herokuapp.com')
|
29
29
|
assert_equal "test", receiver.receiver_type
|
30
|
-
assert_equal 'http://
|
30
|
+
assert_equal 'http://spreedly-echo.herokuapp.com', receiver.hostnames
|
31
31
|
end
|
32
32
|
|
33
33
|
def test_need_active_account
|
@@ -38,9 +38,9 @@ class RemoteDeliverPaymentMethodTest < Test::Unit::TestCase
|
|
38
38
|
assert_equal(true, transaction.succeeded?)
|
39
39
|
assert_equal(card_token, transaction.payment_method.token)
|
40
40
|
assert_equal(receiver_token, transaction.receiver.token)
|
41
|
-
assert_match(/
|
41
|
+
assert_match(/HOST: spreedly-echo.herokuapp.com\nCONNECTION: close/m, transaction.response.body)
|
42
42
|
assert_equal('200', transaction.response.status)
|
43
|
-
assert_match(/Server:
|
43
|
+
assert_match(/Server: thin/m, transaction.response.headers)
|
44
44
|
end
|
45
45
|
|
46
46
|
private
|
@@ -49,7 +49,7 @@ class RemoteDeliverPaymentMethodTest < Test::Unit::TestCase
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def url
|
52
|
-
'
|
52
|
+
'https://spreedly-echo.herokuapp.com'
|
53
53
|
end
|
54
54
|
|
55
55
|
def receiver_test_credentials
|
@@ -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 android_pay), braintree.payment_methods
|
13
|
+
assert_equal %w(credit_card third_party_token apple_pay android_pay google_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 }
|
@@ -66,6 +66,29 @@ class RemotePurchaseTest < Test::Unit::TestCase
|
|
66
66
|
assert transaction.checkout_url
|
67
67
|
end
|
68
68
|
|
69
|
+
def test_3d_secure_attempt_transaction_arguments
|
70
|
+
gateway_token = @environment.add_gateway(:test).token
|
71
|
+
card_token = create_card_on(@environment, number: '4556761029983886', retained: false).token
|
72
|
+
|
73
|
+
transaction = @environment.purchase_on_gateway(gateway_token, card_token, 344,
|
74
|
+
order_id: "8675",
|
75
|
+
description: "SuperDuper",
|
76
|
+
ip: "183.128.100.103",
|
77
|
+
email: "fred@example.com",
|
78
|
+
merchant_name_descriptor: "Real Stuff",
|
79
|
+
merchant_location_descriptor: "Raleigh",
|
80
|
+
retain_on_success: true,
|
81
|
+
redirect_url: "https://example.com/redirect",
|
82
|
+
callback_url: "https://example.com/callback",
|
83
|
+
attempt_3dsecure: true)
|
84
|
+
|
85
|
+
assert_equal "pending", transaction.state
|
86
|
+
assert "https://example.com/callback", transaction.callback_url
|
87
|
+
assert "https://example.com/redirect", transaction.redirect_url
|
88
|
+
assert_equal '', transaction.checkout_url
|
89
|
+
assert transaction.checkout_form.include?("<form action=\"https://core.spreedly.com/test/#{gateway_token}")
|
90
|
+
end
|
91
|
+
|
69
92
|
def test_optional_arguments
|
70
93
|
gateway_token = @environment.add_gateway(:test).token
|
71
94
|
card_token = create_card_on(@environment, retained: false).token
|
@@ -89,6 +112,7 @@ class RemotePurchaseTest < Test::Unit::TestCase
|
|
89
112
|
assert_equal "fred@example.com", transaction.email
|
90
113
|
assert_equal "perrin@wot.com", transaction.payment_method.email
|
91
114
|
assert_match /\d/, transaction.gateway_transaction_id
|
115
|
+
assert_match "Purchase", transaction.transaction_type
|
92
116
|
end
|
93
117
|
|
94
118
|
def test_gateway_specific_fields
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class RemoteRecachePaymentMethodTest < 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_invalid_login
|
10
|
+
assert_invalid_login do |environment|
|
11
|
+
environment.recache_payment_method('payment_method_token')
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_payment_method_token_token_not_found
|
16
|
+
assert_raise_with_message(Spreedly::NotFoundError, "Unable to find the specified payment method.") do
|
17
|
+
@environment.recache_payment_method('unknown_token')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_successful_recache
|
22
|
+
card_token = create_card_on(@environment).token
|
23
|
+
|
24
|
+
transaction = @environment.recache_payment_method(card_token, verification_value: '123')
|
25
|
+
|
26
|
+
assert transaction.succeeded?
|
27
|
+
assert_equal 'retained', transaction.payment_method.storage_state
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class RemoteRedactReceiverTest < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@environment = Spreedly::Environment.new(remote_test_environment_key, remote_test_access_secret)
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_successful_redact
|
9
|
+
receiver = @environment.add_receiver(:test, 'https://sandbox.usaepay.com')
|
10
|
+
|
11
|
+
transaction = @environment.redact_receiver(receiver.token)
|
12
|
+
|
13
|
+
assert transaction.succeeded?
|
14
|
+
assert_equal 'redacted', transaction.state
|
15
|
+
end
|
16
|
+
end
|
@@ -56,7 +56,7 @@ class RemoteUpdateCreditCardTest < Test::Unit::TestCase
|
|
56
56
|
private
|
57
57
|
def card_deets(options = {})
|
58
58
|
{
|
59
|
-
email: 'cauthon@wot.com', month: 1, year:
|
59
|
+
email: 'cauthon@wot.com', month: 1, year: 2023,
|
60
60
|
last_name: 'Cauthon', first_name: 'Mat',
|
61
61
|
eligible_for_card_updater: 'false'
|
62
62
|
}.merge(options)
|
@@ -24,6 +24,7 @@ class AddCreditCreditCardTest < Test::Unit::TestCase
|
|
24
24
|
|
25
25
|
assert_equal "AXaBXfVUqhaGMg8ytf8isiMAAL9", t.payment_method.token
|
26
26
|
assert_equal "Eland Venture", t.payment_method.full_name
|
27
|
+
assert_equal 'credit_card', t.payment_method.payment_method_type
|
27
28
|
assert_equal "Don't test everything here, since find_payment_method tests it all.", t.payment_method.data
|
28
29
|
|
29
30
|
assert t.payment_method.eligible_for_card_updater
|
@@ -121,5 +122,3 @@ class AddCreditCreditCardTest < Test::Unit::TestCase
|
|
121
122
|
end
|
122
123
|
|
123
124
|
end
|
124
|
-
|
125
|
-
|
data/test/unit/authorize_test.rb
CHANGED
@@ -28,11 +28,14 @@ class AuthorizeTest < Test::Unit::TestCase
|
|
28
28
|
assert_equal 'Tax Free Zone', t.merchant_location_descriptor
|
29
29
|
assert_equal 'YjWxOjbpeieXsZFdAsbhM2DFgLe', t.gateway_token
|
30
30
|
assert_equal "44", t.gateway_transaction_id
|
31
|
+
assert_equal "Authorization", t.transaction_type
|
31
32
|
assert_equal "TheName", t.gateway_specific_fields[:litle][:descriptor_name]
|
32
33
|
assert_equal "33411441", t.gateway_specific_fields[:litle][:descriptor_phone]
|
33
34
|
assert_equal "844", t.gateway_specific_fields[:stripe][:application_fee]
|
35
|
+
assert_equal "credit", t.gateway_specific_response_fields[:stripe][:card_funding]
|
34
36
|
|
35
37
|
assert_equal 'Nh2Vw0kAoSQvcJDpK52q4dZlrVJ', t.payment_method.token
|
38
|
+
assert_equal 'credit_card', t.payment_method.payment_method_type
|
36
39
|
assert_equal 'Forthrast', t.payment_method.last_name
|
37
40
|
|
38
41
|
assert t.response.success
|
@@ -67,7 +70,8 @@ class AuthorizeTest < Test::Unit::TestCase
|
|
67
70
|
[ './merchant_name_descriptor', 'TRain' ],
|
68
71
|
[ './merchant_location_descriptor', 'British Colombia' ],
|
69
72
|
[ './gateway_specific_fields/braintree/customer_id', '1143' ],
|
70
|
-
[ './retain_on_success', 'true' ]
|
73
|
+
[ './retain_on_success', 'true' ],
|
74
|
+
[ './continue_caching', 'true']
|
71
75
|
end
|
72
76
|
|
73
77
|
|
@@ -88,7 +92,8 @@ class AuthorizeTest < Test::Unit::TestCase
|
|
88
92
|
gateway_specific_fields: {
|
89
93
|
braintree: { customer_id: "1143" }
|
90
94
|
},
|
91
|
-
retain_on_success: true
|
95
|
+
retain_on_success: true,
|
96
|
+
continue_caching: true
|
92
97
|
}
|
93
98
|
end
|
94
99
|
|
data/test/unit/capture_test.rb
CHANGED
@@ -28,6 +28,8 @@ class CaptureTest < Test::Unit::TestCase
|
|
28
28
|
assert_equal 'Tax Free Zone', t.merchant_location_descriptor
|
29
29
|
assert_equal 'SoPblCOGDwaRyym68XGWeRiCy1C', t.gateway_token
|
30
30
|
assert_equal 'PH6U2tyFWtDSVp88bNW2nnGy5rk', t.reference_token
|
31
|
+
assert_equal 'Capture', t.transaction_type
|
32
|
+
assert_equal "credit", t.gateway_specific_response_fields[:stripe][:card_funding]
|
31
33
|
|
32
34
|
assert t.response.success
|
33
35
|
assert_equal 'Successful capture', t.response.message
|
@@ -22,6 +22,7 @@ class FindPaymentMethodTest < Test::Unit::TestCase
|
|
22
22
|
assert_equal(1369504152, card.created_at.to_i)
|
23
23
|
assert_equal(1369508044, card.updated_at.to_i)
|
24
24
|
assert_equal('master', card.card_type)
|
25
|
+
assert_equal('credit_card', card.payment_method_type)
|
25
26
|
assert_equal('Alcatraz', card.first_name)
|
26
27
|
assert_equal('Smedry', card.last_name)
|
27
28
|
assert_equal('8', card.month)
|
@@ -23,6 +23,7 @@ class ListPaymentMethodsTest < Test::Unit::TestCase
|
|
23
23
|
|
24
24
|
assert_equal 'Perrin Aybara', list.first.full_name
|
25
25
|
assert_equal 'Mat Cauthon', list[1].full_name
|
26
|
+
assert_equal 'credit_card', list.first.payment_method_type
|
26
27
|
assert_equal 'test_vault:4111111111111111', list[2].third_party_token
|
27
28
|
assert_equal 'retained', list[3].storage_state
|
28
29
|
assert_equal '4321', list[4].account_number_display_digits
|
data/test/unit/purchase_test.rb
CHANGED
@@ -29,6 +29,7 @@ class PurchaseTest < Test::Unit::TestCase
|
|
29
29
|
assert_equal 'YOaCn5a9xRaBTGgmGAWbkgWUuqv', t.gateway_token
|
30
30
|
assert_equal '8xXXIPGXTaPXysDA5OUpgnjTEjK', t.payment_method.token
|
31
31
|
assert_equal "44", t.gateway_transaction_id
|
32
|
+
assert_equal "Purchase", t.transaction_type
|
32
33
|
|
33
34
|
assert t.response.success
|
34
35
|
assert_equal 'Successful purchase', t.response.message
|
@@ -54,6 +55,59 @@ class PurchaseTest < Test::Unit::TestCase
|
|
54
55
|
assert_equal '', t.shipping_address.phone_number
|
55
56
|
end
|
56
57
|
|
58
|
+
def test_successful_3dsecure_purchase_attempt
|
59
|
+
t = purchase_using(successful_purchase_3dsecure_attempt_response)
|
60
|
+
|
61
|
+
assert_kind_of(Spreedly::Purchase, t)
|
62
|
+
assert_equal 'Btcyks35m4JLSNOs9ymJoNQLjeX', t.token
|
63
|
+
assert_equal 144, t.amount
|
64
|
+
assert t.on_test_gateway?
|
65
|
+
assert_equal Time.parse("2013-07-31 19:46:26 UTC"), t.created_at
|
66
|
+
assert_equal Time.parse("2013-07-31 19:46:32 UTC"), t.updated_at
|
67
|
+
assert_equal 'USD', t.currency_code
|
68
|
+
assert !t.succeeded?
|
69
|
+
assert_equal 'pending', t.state
|
70
|
+
assert_equal 'none', t.required_action
|
71
|
+
assert_equal 'http://challenge_url.test', t.challenge_url
|
72
|
+
assert_equal 'challenge form data', t.challenge_form
|
73
|
+
assert_equal 'device fingerprint form data', t.device_fingerprint_form
|
74
|
+
assert_equal '', t.order_id
|
75
|
+
assert_equal '', t.ip
|
76
|
+
assert_equal '4 Shardblades', t.description
|
77
|
+
assert_equal '', t.merchant_name_descriptor
|
78
|
+
assert_equal '', t.merchant_location_descriptor
|
79
|
+
assert_equal 'YOaCn5a9xRaBTGgmGAWbkgWUuqv', t.gateway_token
|
80
|
+
assert_equal '8xXXIPGXTaPXysDA5OUpgnjTEjK', t.payment_method.token
|
81
|
+
assert_equal "44", t.gateway_transaction_id
|
82
|
+
|
83
|
+
assert t.response.success
|
84
|
+
assert_equal 'Checked enrollment status', t.response.message
|
85
|
+
assert !t.response.pending
|
86
|
+
assert !t.response.fraud_review
|
87
|
+
assert_equal '', t.response.error_code
|
88
|
+
assert_equal Time.parse('2013-07-31T19:46:26Z'), t.response.created_at
|
89
|
+
assert_equal Time.parse('2013-07-31T19:46:27Z'), t.response.updated_at
|
90
|
+
|
91
|
+
assert_equal 'https://example.com/callback_url', t.callback_url
|
92
|
+
assert_equal 'https://example.com/redirect_url', t.redirect_url
|
93
|
+
assert_equal '', t.checkout_url
|
94
|
+
|
95
|
+
assert t.checkout_form.include?('<form action="https://core.spreedly.com/test/1234/auth/1234" method="POST">')
|
96
|
+
assert t.checkout_form.include?('<input name="PaReq" value="" type="hidden"/>')
|
97
|
+
assert t.checkout_form.include?('<input name="MD" value="" type="hidden"/>')
|
98
|
+
assert t.checkout_form.include?('<input name="TermUrl" value="https://core.spreedly.com/transaction/Btcyks35m4JLSNOs9ymJoNQLjeX/redirect" type="hidden"/>')
|
99
|
+
assert t.checkout_form.include?('<input name="Complete" value="Authorize Transaction" type="submit"/>')
|
100
|
+
|
101
|
+
assert_equal '', t.shipping_address.name
|
102
|
+
assert_equal '', t.shipping_address.address1
|
103
|
+
assert_equal '', t.shipping_address.address2
|
104
|
+
assert_equal '', t.shipping_address.city
|
105
|
+
assert_equal '', t.shipping_address.state
|
106
|
+
assert_equal '', t.shipping_address.zip
|
107
|
+
assert_equal '', t.shipping_address.country
|
108
|
+
assert_equal '', t.shipping_address.phone_number
|
109
|
+
end
|
110
|
+
|
57
111
|
def test_failed_purchase
|
58
112
|
t = purchase_using(failed_purchase_response)
|
59
113
|
|
@@ -94,7 +148,8 @@ class PurchaseTest < Test::Unit::TestCase
|
|
94
148
|
[ './ip', '183.128.100.103' ],
|
95
149
|
[ './merchant_name_descriptor', 'Real Stuff' ],
|
96
150
|
[ './merchant_location_descriptor', 'Raleigh' ],
|
97
|
-
[ './retain_on_success', 'true' ]
|
151
|
+
[ './retain_on_success', 'true' ],
|
152
|
+
[ './continue_caching', 'true']
|
98
153
|
end
|
99
154
|
|
100
155
|
|
@@ -112,7 +167,8 @@ class PurchaseTest < Test::Unit::TestCase
|
|
112
167
|
ip: "183.128.100.103",
|
113
168
|
merchant_name_descriptor: "Real Stuff",
|
114
169
|
merchant_location_descriptor: "Raleigh",
|
115
|
-
retain_on_success: true
|
170
|
+
retain_on_success: true,
|
171
|
+
continue_caching: true
|
116
172
|
}
|
117
173
|
end
|
118
174
|
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'unit/response_stubs/recache_payment_method_stubs'
|
3
|
+
|
4
|
+
class RecachePaymentMethodTest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
include RecachePaymentMethodStubs
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@environment = Spreedly::Environment.new("key", "secret")
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_successful_recache
|
13
|
+
t = recache_using(successful_recache_payment_method_response)
|
14
|
+
|
15
|
+
assert_kind_of(Spreedly::RecacheSensitiveData, t)
|
16
|
+
assert_equal '2BSe5T6FHpypph3ensF7m3Nb3qk', t.token
|
17
|
+
assert_equal Time.parse('2013-08-05 17:43:41 UTC'), t.created_at
|
18
|
+
assert_equal Time.parse('2013-08-05 17:43:41 UTC'), t.updated_at
|
19
|
+
assert t.succeeded?
|
20
|
+
assert_equal 'Succeeded!', t.message
|
21
|
+
assert_equal 'succeeded', t.state
|
22
|
+
assert_equal 'retained', t.payment_method.storage_state
|
23
|
+
assert_equal 'RvsxKgbAZBmiZHEPhhTcOQzJeC2', t.payment_method.token
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def recache_using(response)
|
29
|
+
@environment.stubs(:raw_ssl_request).returns(response)
|
30
|
+
@environment.recache_payment_method("IgnoredTokenSinceResponseIsStubbed", verification_value: 'VerificationValue')
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
data/test/unit/refund_test.rb
CHANGED
@@ -28,6 +28,7 @@ class RefundTest < Test::Unit::TestCase
|
|
28
28
|
assert_equal 'Tax Free Zone', t.merchant_location_descriptor
|
29
29
|
assert_equal 'XYI0V2l4KC1cAm6Y3c2kG5loJaA', t.gateway_token
|
30
30
|
assert_equal 'RkIAltzr49eXuWc7ajBjLLeKZt8', t.reference_token
|
31
|
+
assert_equal 'Credit', t.transaction_type
|
31
32
|
|
32
33
|
assert t.response.success
|
33
34
|
assert_equal 'Successful credit', t.response.message
|
@@ -26,8 +26,11 @@ module AuthorizationStubs
|
|
26
26
|
<application_fee>844</application_fee>
|
27
27
|
</stripe>
|
28
28
|
</gateway_specific_fields>
|
29
|
-
<
|
30
|
-
|
29
|
+
<gateway_specific_response_fields>
|
30
|
+
<stripe>
|
31
|
+
<card_funding>credit</card_funding>
|
32
|
+
</stripe>
|
33
|
+
</gateway_specific_response_fields>
|
31
34
|
<message key="messages.transaction_succeeded">Succeeded!</message>
|
32
35
|
<gateway_token>YjWxOjbpeieXsZFdAsbhM2DFgLe</gateway_token>
|
33
36
|
<gateway_transaction_id>44</gateway_transaction_id>
|
@@ -19,7 +19,11 @@ module CaptureStubs
|
|
19
19
|
<merchant_name_descriptor>My Writeoff Inc.</merchant_name_descriptor>
|
20
20
|
<merchant_location_descriptor>Tax Free Zone</merchant_location_descriptor>
|
21
21
|
<gateway_specific_fields nil="true"/>
|
22
|
-
<gateway_specific_response_fields
|
22
|
+
<gateway_specific_response_fields>
|
23
|
+
<stripe>
|
24
|
+
<card_funding>credit</card_funding>
|
25
|
+
</stripe>
|
26
|
+
</gateway_specific_response_fields>
|
23
27
|
<message key="messages.transaction_succeeded">Succeeded!</message>
|
24
28
|
<gateway_token>SoPblCOGDwaRyym68XGWeRiCy1C</gateway_token>
|
25
29
|
<gateway_transaction_id>44</gateway_transaction_id>
|
@@ -241,4 +241,109 @@ module PurchaseStubs
|
|
241
241
|
XML
|
242
242
|
end
|
243
243
|
|
244
|
+
def successful_purchase_3dsecure_attempt_response
|
245
|
+
StubResponse.succeeded <<-XML
|
246
|
+
<transaction>
|
247
|
+
<amount type="integer">144</amount>
|
248
|
+
<on_test_gateway type="boolean">true</on_test_gateway>
|
249
|
+
<created_at type="datetime">2013-07-31T19:46:26Z</created_at>
|
250
|
+
<updated_at type="datetime">2013-07-31T19:46:32Z</updated_at>
|
251
|
+
<currency_code>USD</currency_code>
|
252
|
+
<succeeded type="boolean">false</succeeded>
|
253
|
+
<state>pending</state>
|
254
|
+
<token>Btcyks35m4JLSNOs9ymJoNQLjeX</token>
|
255
|
+
<transaction_type>Purchase</transaction_type>
|
256
|
+
<order_id nil="true"/>
|
257
|
+
<ip nil="true"/>
|
258
|
+
<description>4 Shardblades</description>
|
259
|
+
<merchant_name_descriptor nil="true"/>
|
260
|
+
<merchant_location_descriptor nil="true"/>
|
261
|
+
<gateway_specific_fields nil="true"/>
|
262
|
+
<gateway_specific_response_fields nil="true"/>
|
263
|
+
<message key="messages.transaction_pending">Pending</message>
|
264
|
+
<required_action>none</required_action>
|
265
|
+
<challenge_url>http://challenge_url.test</challenge_url>
|
266
|
+
<challenge_form>challenge form data</challenge_form>
|
267
|
+
<device_fingerprint_form>device fingerprint form data</device_fingerprint_form>
|
268
|
+
<gateway_token>YOaCn5a9xRaBTGgmGAWbkgWUuqv</gateway_token>
|
269
|
+
<gateway_transaction_id>44</gateway_transaction_id>
|
270
|
+
<shipping_address>
|
271
|
+
<name nil="true"/>
|
272
|
+
<address1 nil="true"/>
|
273
|
+
<address2 nil="true"/>
|
274
|
+
<city nil="true"/>
|
275
|
+
<state nil="true"/>
|
276
|
+
<zip nil="true"/>
|
277
|
+
<country nil="true"/>
|
278
|
+
<phone_number nil="true"//>
|
279
|
+
</shipping_address>
|
280
|
+
<response>
|
281
|
+
<success type="boolean">true</success>
|
282
|
+
<message>Checked enrollment status</message>
|
283
|
+
<error_code nil="true"/>
|
284
|
+
<checkout_url nil="true"/>
|
285
|
+
<created_at type="datetime">2013-07-31T19:46:26Z</created_at>
|
286
|
+
<updated_at type="datetime">2013-07-31T19:46:27Z</updated_at>
|
287
|
+
</response>
|
288
|
+
<payment_method>
|
289
|
+
<token>8xXXIPGXTaPXysDA5OUpgnjTEjK</token>
|
290
|
+
<created_at type="datetime">2013-07-31T19:46:25Z</created_at>
|
291
|
+
<updated_at type="datetime">2013-07-31T19:46:26Z</updated_at>
|
292
|
+
<email>perrin@wot.com</email>
|
293
|
+
<data nil="true"/>
|
294
|
+
<storage_state>retained</storage_state>
|
295
|
+
<last_four_digits>4444</last_four_digits>
|
296
|
+
<first_six_digits>411111</first_six_digits>
|
297
|
+
<card_type>master</card_type>
|
298
|
+
<first_name>Perrin</first_name>
|
299
|
+
<last_name>Aybara</last_name>
|
300
|
+
<month type="integer">1</month>
|
301
|
+
<year type="integer">2019</year>
|
302
|
+
<address1 nil="true"/>
|
303
|
+
<address2 nil="true"/>
|
304
|
+
<city nil="true"/>
|
305
|
+
<state nil="true"/>
|
306
|
+
<zip nil="true"/>
|
307
|
+
<country nil="true"/>
|
308
|
+
<phone_number nil="true"/>
|
309
|
+
<company>Acme</company>
|
310
|
+
<full_name>Perrin Aybara</full_name>
|
311
|
+
<payment_method_type>credit_card</payment_method_type>
|
312
|
+
<eligible_for_card_updater type="boolean">true</eligible_for_card_updater>
|
313
|
+
<errors>
|
314
|
+
</errors>
|
315
|
+
<verification_value></verification_value>
|
316
|
+
<fingerprint>ac5579920013cc571e506805f1c8f3220eff</fingerprint>
|
317
|
+
<number>XXXX-XXXX-XXXX-4444</number>
|
318
|
+
</payment_method>
|
319
|
+
<api_urls>
|
320
|
+
<callback_conversations>https://core.spreedly.com/v1/callbacks/12345/conversations.xml</callback_conversations>
|
321
|
+
</api_urls>
|
322
|
+
<callback_url>https://example.com/callback_url</callback_url>
|
323
|
+
<redirect_url>https://example.com/redirect_url</redirect_url>
|
324
|
+
<checkout_url nil="true"/>
|
325
|
+
<checkout_form>
|
326
|
+
<![CDATA[
|
327
|
+
<form action="https://core.spreedly.com/test/1234/auth/1234" method="POST">
|
328
|
+
<div>
|
329
|
+
<input name="PaReq" value="" type="hidden"/>
|
330
|
+
<input name="MD" value="" type="hidden"/>
|
331
|
+
<input name="TermUrl" value="https://core.spreedly.com/transaction/Btcyks35m4JLSNOs9ymJoNQLjeX/redirect" type="hidden"/>
|
332
|
+
<input name="Complete" value="Authorize Transaction" type="submit"/>
|
333
|
+
</div>
|
334
|
+
</form>
|
335
|
+
]]>
|
336
|
+
</checkout_form>
|
337
|
+
<setup_response>
|
338
|
+
<success type="boolean">true</success>
|
339
|
+
<message>Checked enrollment status</message>
|
340
|
+
<error_code nil="true"/>
|
341
|
+
<checkout_url nil="true"/>
|
342
|
+
<created_at type="datetime">2013-07-31T19:46:26Z</created_at>
|
343
|
+
<updated_at type="datetime">2013-07-31T19:46:27Z</updated_at>
|
344
|
+
</setup_response>
|
345
|
+
</transaction>
|
346
|
+
XML
|
347
|
+
end
|
348
|
+
|
244
349
|
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module RecachePaymentMethodStubs
|
2
|
+
|
3
|
+
def successful_recache_payment_method_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>RecacheSensitiveData</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>retained</storage_state>
|
25
|
+
<last_four_digits>4444</last_four_digits>
|
26
|
+
<first_six_digits>411111</first_six_digits>
|
27
|
+
<card_type>master</card_type>
|
28
|
+
<first_name>Perrin</first_name>
|
29
|
+
<last_name>Aybara</last_name>
|
30
|
+
<month type="integer">1</month>
|
31
|
+
<year type="integer">2019</year>
|
32
|
+
<address1 nil="true"/>
|
33
|
+
<address2 nil="true"/>
|
34
|
+
<city nil="true"/>
|
35
|
+
<state nil="true"/>
|
36
|
+
<zip nil="true"/>
|
37
|
+
<country nil="true"/>
|
38
|
+
<phone_number nil="true"/>
|
39
|
+
<company>Acme</company>
|
40
|
+
<full_name>Perrin Aybara</full_name>
|
41
|
+
<payment_method_type>credit_card</payment_method_type>
|
42
|
+
<eligible_for_card_updater type="boolean">true</eligible_for_card_updater>
|
43
|
+
<errors>
|
44
|
+
</errors>
|
45
|
+
<verification_value></verification_value>
|
46
|
+
<fingerprint>ac5579920013cc571e506805f1c8f3220eff</fingerprint>
|
47
|
+
<number>XXXX-XXXX-XXXX-4444</number>
|
48
|
+
</payment_method>
|
49
|
+
</transaction>
|
50
|
+
XML
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
data/test/unit/verify_test.rb
CHANGED
@@ -26,6 +26,7 @@ class VerifyTest < Test::Unit::TestCase
|
|
26
26
|
assert_equal 'Tax Free Zone', t.merchant_location_descriptor
|
27
27
|
assert_equal 'LoxFMxQJD5E1ksAwFWykUamaCKE', t.gateway_token
|
28
28
|
assert_equal "49", t.gateway_transaction_id
|
29
|
+
assert_equal 'Verification', t.transaction_type
|
29
30
|
|
30
31
|
assert_equal '98626DYInHb4K86dp6GrocnZOW6', t.payment_method.token
|
31
32
|
assert_equal 'Aybara', t.payment_method.last_name
|
@@ -57,7 +58,8 @@ class VerifyTest < Test::Unit::TestCase
|
|
57
58
|
[ './ip', '183.128.100.102' ],
|
58
59
|
[ './merchant_name_descriptor', 'TRain' ],
|
59
60
|
[ './merchant_location_descriptor', 'British Colombia' ],
|
60
|
-
[ './retain_on_success', 'true' ]
|
61
|
+
[ './retain_on_success', 'true' ],
|
62
|
+
[ './continue_caching', 'true']
|
61
63
|
end
|
62
64
|
|
63
65
|
|
@@ -74,7 +76,8 @@ class VerifyTest < Test::Unit::TestCase
|
|
74
76
|
ip: "183.128.100.102",
|
75
77
|
merchant_name_descriptor: "TRain",
|
76
78
|
merchant_location_descriptor: "British Colombia",
|
77
|
-
retain_on_success: true
|
79
|
+
retain_on_success: true,
|
80
|
+
continue_caching: true
|
78
81
|
}
|
79
82
|
end
|
80
83
|
|
data/test/unit/void_test.rb
CHANGED
@@ -27,6 +27,7 @@ class VoidTest < Test::Unit::TestCase
|
|
27
27
|
assert_equal 'Somewhere', t.merchant_location_descriptor
|
28
28
|
assert_equal 'EuXlDMZEMZfrHSvE9tkRzaW8j0z', t.gateway_token
|
29
29
|
assert_equal 'CjedAratpuiT3CMmln4t3oZFvOS', t.reference_token
|
30
|
+
assert_equal 'Void', t.transaction_type
|
30
31
|
|
31
32
|
assert t.response.success?
|
32
33
|
assert_equal 'Successful void', t.response.message
|
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.19
|
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: 2019-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -25,21 +25,21 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: awesome_print
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: log_buddy
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: mocha
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
@@ -112,11 +112,14 @@ description: The Spreedly gem provides a convenient Ruby wrapper for the Spreedl
|
|
112
112
|
API.
|
113
113
|
email:
|
114
114
|
- duff@spreedly.com
|
115
|
+
- doug@spreedly.com
|
116
|
+
- jeremy@spreedly.com
|
115
117
|
executables: []
|
116
118
|
extensions: []
|
117
119
|
extra_rdoc_files: []
|
118
120
|
files:
|
119
121
|
- ".gitignore"
|
122
|
+
- CHANGELOG.md
|
120
123
|
- Gemfile
|
121
124
|
- HISTORY.md
|
122
125
|
- LICENSE.txt
|
@@ -162,7 +165,7 @@ files:
|
|
162
165
|
- lib/spreedly/urls.rb
|
163
166
|
- lib/spreedly/version.rb
|
164
167
|
- spreedly.gemspec
|
165
|
-
- test/credentials/credentials.yml
|
168
|
+
- test/credentials/credentials.yml.example
|
166
169
|
- test/credentials/test_credentials.rb
|
167
170
|
- test/helpers/assertions.rb
|
168
171
|
- test/helpers/communication_helper.rb
|
@@ -183,9 +186,11 @@ files:
|
|
183
186
|
- test/remote/remote_list_payment_methods_test.rb
|
184
187
|
- test/remote/remote_list_transactions_test.rb
|
185
188
|
- test/remote/remote_purchase_test.rb
|
189
|
+
- test/remote/remote_recache_payment_method_test.rb
|
186
190
|
- test/remote/remote_receiver_options_test.rb
|
187
191
|
- test/remote/remote_redact_gateway_test.rb
|
188
192
|
- test/remote/remote_redact_payment_method_test.rb
|
193
|
+
- test/remote/remote_redact_receiver_test.rb
|
189
194
|
- test/remote/remote_refund_test.rb
|
190
195
|
- test/remote/remote_retain_test.rb
|
191
196
|
- test/remote/remote_store_test.rb
|
@@ -210,6 +215,7 @@ files:
|
|
210
215
|
- test/unit/list_payment_methods_test.rb
|
211
216
|
- test/unit/list_transactions_test.rb
|
212
217
|
- test/unit/purchase_test.rb
|
218
|
+
- test/unit/recache_payment_method_test.rb
|
213
219
|
- test/unit/receiver_options_test.rb
|
214
220
|
- test/unit/redact_gateway_test.rb
|
215
221
|
- test/unit/redact_payment_method_test.rb
|
@@ -228,6 +234,7 @@ files:
|
|
228
234
|
- test/unit/response_stubs/list_payment_methods_stubs.rb
|
229
235
|
- test/unit/response_stubs/list_transactions_stubs.rb
|
230
236
|
- test/unit/response_stubs/purchase_stubs.rb
|
237
|
+
- test/unit/response_stubs/recache_payment_method_stubs.rb
|
231
238
|
- test/unit/response_stubs/receiver_options_stubs.rb
|
232
239
|
- test/unit/response_stubs/redact_gateway_stubs.rb
|
233
240
|
- test/unit/response_stubs/redact_payment_method_stubs.rb
|
@@ -263,12 +270,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
263
270
|
version: '0'
|
264
271
|
requirements: []
|
265
272
|
rubyforge_project:
|
266
|
-
rubygems_version: 2.
|
273
|
+
rubygems_version: 2.5.2
|
267
274
|
signing_key:
|
268
275
|
specification_version: 4
|
269
276
|
summary: Provides a Ruby wrapper for the Spreedly API.
|
270
277
|
test_files:
|
271
|
-
- test/credentials/credentials.yml
|
278
|
+
- test/credentials/credentials.yml.example
|
272
279
|
- test/credentials/test_credentials.rb
|
273
280
|
- test/helpers/assertions.rb
|
274
281
|
- test/helpers/communication_helper.rb
|
@@ -289,9 +296,11 @@ test_files:
|
|
289
296
|
- test/remote/remote_list_payment_methods_test.rb
|
290
297
|
- test/remote/remote_list_transactions_test.rb
|
291
298
|
- test/remote/remote_purchase_test.rb
|
299
|
+
- test/remote/remote_recache_payment_method_test.rb
|
292
300
|
- test/remote/remote_receiver_options_test.rb
|
293
301
|
- test/remote/remote_redact_gateway_test.rb
|
294
302
|
- test/remote/remote_redact_payment_method_test.rb
|
303
|
+
- test/remote/remote_redact_receiver_test.rb
|
295
304
|
- test/remote/remote_refund_test.rb
|
296
305
|
- test/remote/remote_retain_test.rb
|
297
306
|
- test/remote/remote_store_test.rb
|
@@ -316,6 +325,7 @@ test_files:
|
|
316
325
|
- test/unit/list_payment_methods_test.rb
|
317
326
|
- test/unit/list_transactions_test.rb
|
318
327
|
- test/unit/purchase_test.rb
|
328
|
+
- test/unit/recache_payment_method_test.rb
|
319
329
|
- test/unit/receiver_options_test.rb
|
320
330
|
- test/unit/redact_gateway_test.rb
|
321
331
|
- test/unit/redact_payment_method_test.rb
|
@@ -334,6 +344,7 @@ test_files:
|
|
334
344
|
- test/unit/response_stubs/list_payment_methods_stubs.rb
|
335
345
|
- test/unit/response_stubs/list_transactions_stubs.rb
|
336
346
|
- test/unit/response_stubs/purchase_stubs.rb
|
347
|
+
- test/unit/response_stubs/recache_payment_method_stubs.rb
|
337
348
|
- test/unit/response_stubs/receiver_options_stubs.rb
|
338
349
|
- test/unit/response_stubs/redact_gateway_stubs.rb
|
339
350
|
- test/unit/response_stubs/redact_payment_method_stubs.rb
|
@@ -1,9 +0,0 @@
|
|
1
|
-
# This file contains the Spreedly credentials to use when running remote tests.
|
2
|
-
# They're working credentials so the remote tests should simply run.
|
3
|
-
|
4
|
-
# You may instead choose to use your own credentials for your own Spreedly
|
5
|
-
# test environment by copying this file to the gitignored file named
|
6
|
-
# personal_credentials.yml located in the same directory as this file.
|
7
|
-
|
8
|
-
environment_key: "R7lHscqcYkZeDGGbthKp6GKMu15"
|
9
|
-
access_secret: "8sefxO5Q44sLWpmZpalQS3Qlqo03JbCemsqsWJR3YOLCuigOFRlaLSAn0WaL5dWU"
|