judopay 2.1.0 → 2.1.3
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 +5 -5
- data/.gitignore +24 -23
- data/.rspec +1 -1
- data/.rubocop.yml +54 -51
- data/.travis.yml +6 -6
- data/CHANGELOG.md +17 -17
- data/Gemfile +4 -4
- data/LICENSE +21 -21
- data/README.md +96 -94
- data/Rakefile +22 -22
- data/judopay.gemspec +38 -38
- data/lib/certs/digicert_sha256_ca.pem +49 -49
- data/lib/certs/rapidssl_ca.crt +63 -63
- data/lib/faraday/judo_mashify.rb +11 -11
- data/lib/faraday/raise_http_exception.rb +19 -19
- data/lib/judopay.rb +70 -70
- data/lib/judopay/api.rb +10 -10
- data/lib/judopay/connection.rb +77 -77
- data/lib/judopay/core_ext/hash.rb +29 -29
- data/lib/judopay/core_ext/string.rb +32 -32
- data/lib/judopay/error.rb +117 -115
- data/lib/judopay/mash.rb +11 -11
- data/lib/judopay/model.rb +134 -134
- data/lib/judopay/models/android_payment.rb +26 -26
- data/lib/judopay/models/android_preauth.rb +8 -8
- data/lib/judopay/models/apple_payment.rb +26 -26
- data/lib/judopay/models/apple_preauth.rb +9 -9
- data/lib/judopay/models/card_address.rb +11 -11
- data/lib/judopay/models/card_payment.rb +33 -33
- data/lib/judopay/models/card_preauth.rb +11 -11
- data/lib/judopay/models/collection.rb +16 -16
- data/lib/judopay/models/encrypt_details.rb +18 -0
- data/lib/judopay/models/inner/pk_payment.rb +17 -17
- data/lib/judopay/models/inner/pk_payment_token.rb +13 -13
- data/lib/judopay/models/inner/transmitted_field.rb +39 -39
- data/lib/judopay/models/inner/wallet.rb +30 -30
- data/lib/judopay/models/market/collection.rb +10 -10
- data/lib/judopay/models/market/payment.rb +10 -10
- data/lib/judopay/models/market/preauth.rb +10 -10
- data/lib/judopay/models/market/refund.rb +10 -10
- data/lib/judopay/models/market/transaction.rb +10 -10
- data/lib/judopay/models/one_use_token_payment.rb +29 -0
- data/lib/judopay/models/payment.rb +8 -8
- data/lib/judopay/models/preauth.rb +8 -8
- data/lib/judopay/models/refund.rb +16 -16
- data/lib/judopay/models/register_card.rb +27 -27
- data/lib/judopay/models/save_card.rb +24 -25
- data/lib/judopay/models/token_payment.rb +30 -30
- data/lib/judopay/models/token_preauth.rb +10 -10
- data/lib/judopay/models/transaction.rb +8 -8
- data/lib/judopay/models/void.rb +19 -19
- data/lib/judopay/models/web_payments/payment.rb +28 -28
- data/lib/judopay/models/web_payments/preauth.rb +10 -10
- data/lib/judopay/models/web_payments/transaction.rb +19 -19
- data/lib/judopay/models/web_payments/web_payment_operation.rb +8 -8
- data/lib/judopay/null_logger.rb +9 -11
- data/lib/judopay/request.rb +50 -50
- data/lib/judopay/response.rb +7 -7
- data/lib/judopay/serializer.rb +27 -27
- data/lib/judopay/version.rb +4 -4
- data/spec/factories.rb +227 -208
- data/spec/faraday/response_spec.rb +27 -27
- data/spec/fixtures/card_payments/create.json +21 -21
- data/spec/fixtures/card_payments/create_3dsecure.json +7 -7
- data/spec/fixtures/card_payments/create_bad_request.json +12 -12
- data/spec/fixtures/card_payments/create_declined.json +23 -23
- data/spec/fixtures/card_payments/validate.json +4 -4
- data/spec/fixtures/token_payments/create.json +21 -21
- data/spec/fixtures/transactions/all.json +237 -237
- data/spec/fixtures/transactions/android_payment.json +26 -26
- data/spec/fixtures/transactions/apple_payment.json +26 -26
- data/spec/fixtures/transactions/find.json +22 -22
- data/spec/fixtures/transactions/find_not_found.json +4 -4
- data/spec/fixtures/transactions/register_card.json +28 -28
- data/spec/fixtures/transactions/save_card.json +27 -27
- data/spec/fixtures/transactions/void.json +26 -26
- data/spec/fixtures/web_payments/payments/create.json +3 -3
- data/spec/fixtures/web_payments/payments/find.json +38 -38
- data/spec/judopay/android_payment_spec.rb +74 -74
- data/spec/judopay/apple_payment_spec.rb +80 -80
- data/spec/judopay/card_address_spec.rb +10 -10
- data/spec/judopay/card_payment_spec.rb +51 -63
- data/spec/judopay/card_preauth_spec.rb +35 -35
- data/spec/judopay/collection_spec.rb +26 -26
- data/spec/judopay/core_ext/hash_spec.rb +24 -24
- data/spec/judopay/core_ext/string_spec.rb +16 -16
- data/spec/judopay/error_spec.rb +70 -70
- data/spec/judopay/judopay_spec.rb +19 -19
- data/spec/judopay/market/collection_spec.rb +26 -26
- data/spec/judopay/market/payment_spec.rb +14 -14
- data/spec/judopay/market/preauth_spec.rb +14 -14
- data/spec/judopay/market/refund_spec.rb +26 -26
- data/spec/judopay/market/transaction_spec.rb +14 -14
- data/spec/judopay/payment_spec.rb +14 -14
- data/spec/judopay/preauth_spec.rb +14 -14
- data/spec/judopay/refund_spec.rb +26 -26
- data/spec/judopay/register_card_spec.rb +24 -24
- data/spec/judopay/save_card_spec.rb +23 -23
- data/spec/judopay/token_payment_spec.rb +22 -22
- data/spec/judopay/token_preauth_spec.rb +22 -22
- data/spec/judopay/transaction_spec.rb +51 -51
- data/spec/judopay/void_spec.rb +24 -24
- data/spec/judopay/web_payments/payment_spec.rb +16 -16
- data/spec/judopay/web_payments/preauth_spec.rb +16 -16
- data/spec/judopay/web_payments/transaction_spec.rb +15 -15
- data/spec/spec_helper.rb +41 -41
- data/test/additions_payment_test.rb +30 -0
- data/test/authentication_test.rb +23 -23
- data/test/base/integration_base.rb +20 -20
- data/test/base/payments_tests.rb +47 -47
- data/test/base/token_payment_tests.rb +98 -98
- data/test/card_details_test.rb +21 -21
- data/test/configuration_test.rb +35 -35
- data/test/helper/assertion_helper.rb +29 -29
- data/test/payment_test.rb +10 -10
- data/test/preauth_test.rb +10 -10
- data/test/register_card_test.rb +42 -42
- data/test/save_card_test.rb +23 -0
- data/test/token_payment_test.rb +10 -10
- data/test/token_preauth_test.rb +10 -10
- data/test/void_test.rb +45 -45
- metadata +18 -12
@@ -1,16 +1,16 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require_relative '../../../lib/judopay/core_ext/string'
|
3
|
-
|
4
|
-
describe String do
|
5
|
-
it 'should convert an underscored string to camel case' do
|
6
|
-
expect('judo_pay'.camel_case).to eq('judoPay')
|
7
|
-
end
|
8
|
-
|
9
|
-
it 'should convert an camel case string to underscored format' do
|
10
|
-
expect('JudoPay'.underscore).to eq('judo_pay')
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'should uncapitalize a word' do
|
14
|
-
expect('JudoPay'.uncapitalize).to eq('judoPay')
|
15
|
-
end
|
16
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
require_relative '../../../lib/judopay/core_ext/string'
|
3
|
+
|
4
|
+
describe String do
|
5
|
+
it 'should convert an underscored string to camel case' do
|
6
|
+
expect('judo_pay'.camel_case).to eq('judoPay')
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should convert an camel case string to underscored format' do
|
10
|
+
expect('JudoPay'.underscore).to eq('judo_pay')
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should uncapitalize a word' do
|
14
|
+
expect('JudoPay'.uncapitalize).to eq('judoPay')
|
15
|
+
end
|
16
|
+
end
|
data/spec/judopay/error_spec.rb
CHANGED
@@ -1,70 +1,70 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require_relative '../../lib/judopay/error'
|
3
|
-
require 'active_model'
|
4
|
-
|
5
|
-
describe Judopay::FieldError do
|
6
|
-
it 'returns fields that was set in message' do
|
7
|
-
e = Judopay::FieldError.new('msg', 123, 'field', 'detail')
|
8
|
-
expect(e.to_s).to eq('Field "field" (code 123): msg')
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
describe Judopay::ValidationError do
|
13
|
-
it 'returns fields that was set' do
|
14
|
-
errors = ActiveModel::Errors.new(nil)
|
15
|
-
errors['some_field'] = 'some error'
|
16
|
-
e = Judopay::ValidationError.new('Error', errors)
|
17
|
-
expect(e.to_s).to eq("Error\nField errors:\nsome_field: some error")
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
describe Judopay::APIError do
|
22
|
-
it 'returns the fields that was set' do
|
23
|
-
message = 'An explicitly set message'
|
24
|
-
|
25
|
-
e = Judopay::APIError.new(message, 1, 12, 23, [])
|
26
|
-
expect(e.message).to eq(message)
|
27
|
-
expect(e.error_code).to eq(1)
|
28
|
-
expect(e.status_code).to eq(12)
|
29
|
-
expect(e.category).to eq(23)
|
30
|
-
expect(e.field_errors).to eq([])
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'return class name when there is no message and field errors' do
|
34
|
-
expect(Judopay::APIError.new(nil).message).to eq('Judopay::APIError')
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'creates valid APIError from response using factory method' do
|
38
|
-
stub_post('/transactions/payments').
|
39
|
-
to_return(:status => 400,
|
40
|
-
:body => lambda { |_request| fixture('card_payments/create_bad_request.json') },
|
41
|
-
:headers => { 'Content-Type' => 'application/json' })
|
42
|
-
|
43
|
-
payment = build(:card_payment)
|
44
|
-
|
45
|
-
begin
|
46
|
-
payment.create
|
47
|
-
rescue Judopay::APIError => e
|
48
|
-
expect(e.status_code).to eq(400)
|
49
|
-
expect(e.field_errors).to be_a_kind_of(Array)
|
50
|
-
expect(e.field_errors[0]).to be_a_kind_of(Judopay::FieldError)
|
51
|
-
expect(e.field_errors[0].code).to eq(46)
|
52
|
-
expect(e.error_code).to eq(1)
|
53
|
-
expect(e.category).to eq(2)
|
54
|
-
expect(e.message).to eq("Sorry, we're unable to process your request. Please check your details and try again.\n\
|
55
|
-
Fields errors:\nField \"ExpiryDate\" (code 46): Sorry, but the expiry date entered is in the past. \
|
56
|
-
Please check your details and try again.")
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'makes error information available on the exception object for validation errors' do
|
61
|
-
payment = Judopay::CardPayment.new
|
62
|
-
|
63
|
-
begin
|
64
|
-
payment.create
|
65
|
-
rescue Judopay::ValidationError => e
|
66
|
-
expect(e.model_errors).to be_a_kind_of(Hash)
|
67
|
-
expect(e.message).to include('Missing required fields')
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
require_relative '../../lib/judopay/error'
|
3
|
+
require 'active_model'
|
4
|
+
|
5
|
+
describe Judopay::FieldError do
|
6
|
+
it 'returns fields that was set in message' do
|
7
|
+
e = Judopay::FieldError.new('msg', 123, 'field', 'detail')
|
8
|
+
expect(e.to_s).to eq('Field "field" (code 123): msg')
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe Judopay::ValidationError do
|
13
|
+
it 'returns fields that was set' do
|
14
|
+
errors = ActiveModel::Errors.new(nil)
|
15
|
+
errors['some_field'] = 'some error'
|
16
|
+
e = Judopay::ValidationError.new('Error', errors)
|
17
|
+
expect(e.to_s).to eq("Error\nField errors:\nsome_field: some error")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe Judopay::APIError do
|
22
|
+
it 'returns the fields that was set' do
|
23
|
+
message = 'An explicitly set message'
|
24
|
+
|
25
|
+
e = Judopay::APIError.new(message, 1, 12, 23, [])
|
26
|
+
expect(e.message).to eq(message)
|
27
|
+
expect(e.error_code).to eq(1)
|
28
|
+
expect(e.status_code).to eq(12)
|
29
|
+
expect(e.category).to eq(23)
|
30
|
+
expect(e.field_errors).to eq([])
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'return class name when there is no message and field errors' do
|
34
|
+
expect(Judopay::APIError.new(nil).message).to eq('Judopay::APIError')
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'creates valid APIError from response using factory method' do
|
38
|
+
stub_post('/transactions/payments').
|
39
|
+
to_return(:status => 400,
|
40
|
+
:body => lambda { |_request| fixture('card_payments/create_bad_request.json') },
|
41
|
+
:headers => { 'Content-Type' => 'application/json' })
|
42
|
+
|
43
|
+
payment = build(:card_payment)
|
44
|
+
|
45
|
+
begin
|
46
|
+
payment.create
|
47
|
+
rescue Judopay::APIError => e
|
48
|
+
expect(e.status_code).to eq(400)
|
49
|
+
expect(e.field_errors).to be_a_kind_of(Array)
|
50
|
+
expect(e.field_errors[0]).to be_a_kind_of(Judopay::FieldError)
|
51
|
+
expect(e.field_errors[0].code).to eq(46)
|
52
|
+
expect(e.error_code).to eq(1)
|
53
|
+
expect(e.category).to eq(2)
|
54
|
+
expect(e.message).to eq("Sorry, we're unable to process your request. Please check your details and try again.\n\
|
55
|
+
Fields errors:\nField \"ExpiryDate\" (code 46): Sorry, but the expiry date entered is in the past. \
|
56
|
+
Please check your details and try again.")
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'makes error information available on the exception object for validation errors' do
|
61
|
+
payment = Judopay::CardPayment.new
|
62
|
+
|
63
|
+
begin
|
64
|
+
payment.create
|
65
|
+
rescue Judopay::ValidationError => e
|
66
|
+
expect(e.model_errors).to be_a_kind_of(Hash)
|
67
|
+
expect(e.message).to include('Missing required fields')
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -1,19 +1,19 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require_relative '../../lib/judopay/models/preauth'
|
3
|
-
|
4
|
-
describe Judopay do
|
5
|
-
it 'should use the production endpoint if use_production is true' do
|
6
|
-
expect(Judopay.configuration.endpoint_url).to include('sandbox')
|
7
|
-
|
8
|
-
Judopay.configure do |config|
|
9
|
-
config.use_production = true
|
10
|
-
end
|
11
|
-
|
12
|
-
expect(Judopay.configuration.endpoint_url).to_not include('sandbox')
|
13
|
-
|
14
|
-
# Reset to sandbox for other tests
|
15
|
-
Judopay.configure do |config|
|
16
|
-
config.use_production = false
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
require_relative '../../lib/judopay/models/preauth'
|
3
|
+
|
4
|
+
describe Judopay do
|
5
|
+
it 'should use the production endpoint if use_production is true' do
|
6
|
+
expect(Judopay.configuration.endpoint_url).to include('sandbox')
|
7
|
+
|
8
|
+
Judopay.configure do |config|
|
9
|
+
config.use_production = true
|
10
|
+
end
|
11
|
+
|
12
|
+
expect(Judopay.configuration.endpoint_url).to_not include('sandbox')
|
13
|
+
|
14
|
+
# Reset to sandbox for other tests
|
15
|
+
Judopay.configure do |config|
|
16
|
+
config.use_production = false
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -1,26 +1,26 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require_relative '../../../lib/judopay/models/market/collection'
|
3
|
-
|
4
|
-
describe Judopay::Market::Collection do
|
5
|
-
it 'should list all transactions' do
|
6
|
-
stub_get('/market/transactions/collections').
|
7
|
-
to_return(:status => 200,
|
8
|
-
:body => lambda { |_request| fixture('transactions/all.json') })
|
9
|
-
|
10
|
-
transactions = Judopay::Market::Collection.all
|
11
|
-
expect(transactions).to be_a(Hash)
|
12
|
-
expect(transactions.results[0].amount).to eq(1.01)
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'should create a new collection given a valid payment reference' do
|
16
|
-
stub_post('/market/transactions/collections').
|
17
|
-
to_return(:status => 200,
|
18
|
-
:body => lambda { |_request| fixture('card_payments/create.json') })
|
19
|
-
|
20
|
-
collection = build(:market_collection)
|
21
|
-
response = collection.create
|
22
|
-
|
23
|
-
expect(response).to be_a(Hash)
|
24
|
-
expect(response.result).to eq('Success')
|
25
|
-
end
|
26
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
require_relative '../../../lib/judopay/models/market/collection'
|
3
|
+
|
4
|
+
describe Judopay::Market::Collection do
|
5
|
+
it 'should list all transactions' do
|
6
|
+
stub_get('/market/transactions/collections').
|
7
|
+
to_return(:status => 200,
|
8
|
+
:body => lambda { |_request| fixture('transactions/all.json') })
|
9
|
+
|
10
|
+
transactions = Judopay::Market::Collection.all
|
11
|
+
expect(transactions).to be_a(Hash)
|
12
|
+
expect(transactions.results[0].amount).to eq(1.01)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should create a new collection given a valid payment reference' do
|
16
|
+
stub_post('/market/transactions/collections').
|
17
|
+
to_return(:status => 200,
|
18
|
+
:body => lambda { |_request| fixture('card_payments/create.json') })
|
19
|
+
|
20
|
+
collection = build(:market_collection)
|
21
|
+
response = collection.create
|
22
|
+
|
23
|
+
expect(response).to be_a(Hash)
|
24
|
+
expect(response.result).to eq('Success')
|
25
|
+
end
|
26
|
+
end
|
@@ -1,14 +1,14 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require_relative '../../../lib/judopay/models/market/payment'
|
3
|
-
|
4
|
-
describe Judopay::Market::Payment do
|
5
|
-
it 'should list all transactions' do
|
6
|
-
stub_get('/market/transactions/payments').
|
7
|
-
to_return(:status => 200,
|
8
|
-
:body => lambda { |_request| fixture('transactions/all.json') })
|
9
|
-
|
10
|
-
transactions = Judopay::Market::Payment.all
|
11
|
-
expect(transactions).to be_a(Hash)
|
12
|
-
expect(transactions.results[0].amount).to eq(1.01)
|
13
|
-
end
|
14
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
require_relative '../../../lib/judopay/models/market/payment'
|
3
|
+
|
4
|
+
describe Judopay::Market::Payment do
|
5
|
+
it 'should list all transactions' do
|
6
|
+
stub_get('/market/transactions/payments').
|
7
|
+
to_return(:status => 200,
|
8
|
+
:body => lambda { |_request| fixture('transactions/all.json') })
|
9
|
+
|
10
|
+
transactions = Judopay::Market::Payment.all
|
11
|
+
expect(transactions).to be_a(Hash)
|
12
|
+
expect(transactions.results[0].amount).to eq(1.01)
|
13
|
+
end
|
14
|
+
end
|
@@ -1,14 +1,14 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require_relative '../../../lib/judopay/models/market/preauth'
|
3
|
-
|
4
|
-
describe Judopay::Market::Preauth do
|
5
|
-
it 'should list all transactions' do
|
6
|
-
stub_get('/market/transactions/preauths').
|
7
|
-
to_return(:status => 200,
|
8
|
-
:body => lambda { |_request| fixture('transactions/all.json') })
|
9
|
-
|
10
|
-
transactions = Judopay::Market::Preauth.all
|
11
|
-
expect(transactions).to be_a(Hash)
|
12
|
-
expect(transactions.results[0].amount).to eq(1.01)
|
13
|
-
end
|
14
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
require_relative '../../../lib/judopay/models/market/preauth'
|
3
|
+
|
4
|
+
describe Judopay::Market::Preauth do
|
5
|
+
it 'should list all transactions' do
|
6
|
+
stub_get('/market/transactions/preauths').
|
7
|
+
to_return(:status => 200,
|
8
|
+
:body => lambda { |_request| fixture('transactions/all.json') })
|
9
|
+
|
10
|
+
transactions = Judopay::Market::Preauth.all
|
11
|
+
expect(transactions).to be_a(Hash)
|
12
|
+
expect(transactions.results[0].amount).to eq(1.01)
|
13
|
+
end
|
14
|
+
end
|
@@ -1,26 +1,26 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require_relative '../../../lib/judopay/models/market/refund'
|
3
|
-
|
4
|
-
describe Judopay::Market::Refund do
|
5
|
-
it 'should list all transactions' do
|
6
|
-
stub_get('/market/transactions/refunds').
|
7
|
-
to_return(:status => 200,
|
8
|
-
:body => lambda { |_request| fixture('transactions/all.json') })
|
9
|
-
|
10
|
-
transactions = Judopay::Market::Refund.all
|
11
|
-
expect(transactions).to be_a(Hash)
|
12
|
-
expect(transactions.results[0].amount).to eq(1.01)
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'should create a new refund given a valid payment reference' do
|
16
|
-
stub_post('/market/transactions/refunds').
|
17
|
-
to_return(:status => 200,
|
18
|
-
:body => lambda { |_request| fixture('card_payments/create.json') })
|
19
|
-
|
20
|
-
refund = build(:market_refund)
|
21
|
-
response = refund.create
|
22
|
-
|
23
|
-
expect(response).to be_a(Hash)
|
24
|
-
expect(response.result).to eq('Success')
|
25
|
-
end
|
26
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
require_relative '../../../lib/judopay/models/market/refund'
|
3
|
+
|
4
|
+
describe Judopay::Market::Refund do
|
5
|
+
it 'should list all transactions' do
|
6
|
+
stub_get('/market/transactions/refunds').
|
7
|
+
to_return(:status => 200,
|
8
|
+
:body => lambda { |_request| fixture('transactions/all.json') })
|
9
|
+
|
10
|
+
transactions = Judopay::Market::Refund.all
|
11
|
+
expect(transactions).to be_a(Hash)
|
12
|
+
expect(transactions.results[0].amount).to eq(1.01)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should create a new refund given a valid payment reference' do
|
16
|
+
stub_post('/market/transactions/refunds').
|
17
|
+
to_return(:status => 200,
|
18
|
+
:body => lambda { |_request| fixture('card_payments/create.json') })
|
19
|
+
|
20
|
+
refund = build(:market_refund)
|
21
|
+
response = refund.create
|
22
|
+
|
23
|
+
expect(response).to be_a(Hash)
|
24
|
+
expect(response.result).to eq('Success')
|
25
|
+
end
|
26
|
+
end
|
@@ -1,14 +1,14 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require_relative '../../../lib/judopay/models/market/transaction'
|
3
|
-
|
4
|
-
describe Judopay::Market::Transaction do
|
5
|
-
it 'should list all transactions' do
|
6
|
-
stub_get('/market/transactions').
|
7
|
-
to_return(:status => 200,
|
8
|
-
:body => lambda { |_request| fixture('transactions/all.json') })
|
9
|
-
|
10
|
-
transactions = Judopay::Market::Transaction.all
|
11
|
-
expect(transactions).to be_a(Hash)
|
12
|
-
expect(transactions.results[0].amount).to eq(1.01)
|
13
|
-
end
|
14
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
require_relative '../../../lib/judopay/models/market/transaction'
|
3
|
+
|
4
|
+
describe Judopay::Market::Transaction do
|
5
|
+
it 'should list all transactions' do
|
6
|
+
stub_get('/market/transactions').
|
7
|
+
to_return(:status => 200,
|
8
|
+
:body => lambda { |_request| fixture('transactions/all.json') })
|
9
|
+
|
10
|
+
transactions = Judopay::Market::Transaction.all
|
11
|
+
expect(transactions).to be_a(Hash)
|
12
|
+
expect(transactions.results[0].amount).to eq(1.01)
|
13
|
+
end
|
14
|
+
end
|
@@ -1,14 +1,14 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require_relative '../../lib/judopay/models/payment'
|
3
|
-
|
4
|
-
describe Judopay::Payment do
|
5
|
-
it 'should list all payments' do
|
6
|
-
stub_get('/transactions').
|
7
|
-
to_return(:status => 200,
|
8
|
-
:body => lambda { |_request| fixture('transactions/all.json') })
|
9
|
-
|
10
|
-
transactions = Judopay::Payment.all
|
11
|
-
expect(transactions).to be_a(Hash)
|
12
|
-
expect(transactions.results[0].amount).to eq(1.01)
|
13
|
-
end
|
14
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
require_relative '../../lib/judopay/models/payment'
|
3
|
+
|
4
|
+
describe Judopay::Payment do
|
5
|
+
it 'should list all payments' do
|
6
|
+
stub_get('/transactions').
|
7
|
+
to_return(:status => 200,
|
8
|
+
:body => lambda { |_request| fixture('transactions/all.json') })
|
9
|
+
|
10
|
+
transactions = Judopay::Payment.all
|
11
|
+
expect(transactions).to be_a(Hash)
|
12
|
+
expect(transactions.results[0].amount).to eq(1.01)
|
13
|
+
end
|
14
|
+
end
|
@@ -1,14 +1,14 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require_relative '../../lib/judopay/models/preauth'
|
3
|
-
|
4
|
-
describe Judopay::Preauth do
|
5
|
-
it 'should list all transactions' do
|
6
|
-
stub_get('/transactions/preauths').
|
7
|
-
to_return(:status => 200,
|
8
|
-
:body => lambda { |_request| fixture('transactions/all.json') })
|
9
|
-
|
10
|
-
transactions = Judopay::Preauth.all
|
11
|
-
expect(transactions).to be_a(Hash)
|
12
|
-
expect(transactions.results[0].amount).to eq(1.01)
|
13
|
-
end
|
14
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
require_relative '../../lib/judopay/models/preauth'
|
3
|
+
|
4
|
+
describe Judopay::Preauth do
|
5
|
+
it 'should list all transactions' do
|
6
|
+
stub_get('/transactions/preauths').
|
7
|
+
to_return(:status => 200,
|
8
|
+
:body => lambda { |_request| fixture('transactions/all.json') })
|
9
|
+
|
10
|
+
transactions = Judopay::Preauth.all
|
11
|
+
expect(transactions).to be_a(Hash)
|
12
|
+
expect(transactions.results[0].amount).to eq(1.01)
|
13
|
+
end
|
14
|
+
end
|