pensio_api 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +3 -0
- data/Gemfile.lock +57 -46
- data/README.md +2 -0
- data/lib/pensio_api.rb +2 -0
- data/lib/pensio_api/chargeback_event.rb +1 -1
- data/lib/pensio_api/funding_list.rb +1 -1
- data/lib/pensio_api/funding_list_request.rb +1 -1
- data/lib/pensio_api/mixins/request_defaults.rb +2 -1
- data/lib/pensio_api/request.rb +1 -1
- data/lib/pensio_api/responses/refund.rb +1 -1
- data/lib/pensio_api/responses/reservation_capture.rb +1 -1
- data/lib/pensio_api/transaction.rb +7 -4
- data/lib/pensio_api/version.rb +3 -0
- data/pensio_api.gemspec +5 -1
- data/spec/lib/pensio_api/callback_spec.rb +3 -3
- data/spec/lib/pensio_api/chargeback_event_spec.rb +1 -1
- data/spec/lib/pensio_api/ecommerce_spec.rb +12 -9
- data/spec/lib/pensio_api/errors/bad_request_spec.rb +1 -1
- data/spec/lib/pensio_api/errors/gateway_error_spec.rb +1 -1
- data/spec/lib/pensio_api/request_spec.rb +8 -8
- data/spec/lib/pensio_api/responses/base_spec.rb +2 -2
- data/spec/lib/pensio_api/responses/chargeback_callback_spec.rb +1 -1
- data/spec/lib/pensio_api/responses/funding_list_spec.rb +1 -1
- data/spec/lib/pensio_api/responses/refund_spec.rb +1 -1
- data/spec/lib/pensio_api/responses/reservation_capture_spec.rb +1 -1
- data/spec/lib/pensio_api/responses/subscription_charge_spec.rb +1 -1
- data/spec/lib/pensio_api/responses/subscription_failure_callback_spec.rb +1 -1
- data/spec/lib/pensio_api/responses/success_callback_spec.rb +1 -1
- data/spec/lib/pensio_api/responses/terminal_spec.rb +1 -1
- data/spec/lib/pensio_api/responses/transaction_spec.rb +1 -1
- data/spec/lib/pensio_api/transaction_spec.rb +4 -4
- data/spec/spec_helper.rb +0 -1
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 781ea82badd4f553a0041c19c1e6e0dca9caf62b971550c55b4aa932b24e2d80
|
4
|
+
data.tar.gz: 7699c92bd15352c2a54183e35f03362062295ccd0c840d94b8aed1dba9eba77c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06c96a50bc88c4d0e766c87909e7c787710b571d6221c3feed4e7c06c4f4567890639b63730243012e9f42d442e6026d57b127b663dab0a63efbf6c44a607bf8
|
7
|
+
data.tar.gz: 332ee83a97dc3a3eb8b9bac31fecf930dd4ef3bc2051d7da8e4e4be4177251f3ba4b2cda6ae7030cd904a23ea7a106a764d4dff1bfdccc3481029119fd676230
|
data/.gitignore
ADDED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
pensio_api (0.3.
|
4
|
+
pensio_api (0.3.4)
|
5
5
|
activesupport (>= 3.2)
|
6
6
|
httparty (>= 0.12.0)
|
7
7
|
multi_xml (>= 0.5.2)
|
@@ -9,64 +9,72 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://www.rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (
|
13
|
-
|
14
|
-
|
12
|
+
activesupport (5.2.4.4)
|
13
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
+
i18n (>= 0.7, < 2)
|
15
15
|
minitest (~> 5.1)
|
16
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
17
16
|
tzinfo (~> 1.1)
|
18
|
-
addressable (2.
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
17
|
+
addressable (2.7.0)
|
18
|
+
public_suffix (>= 2.0.2, < 5.0)
|
19
|
+
celluloid (0.16.0)
|
20
|
+
timers (~> 4.0.0)
|
21
|
+
coderay (1.1.3)
|
22
|
+
concurrent-ruby (1.1.7)
|
23
|
+
crack (0.4.4)
|
24
|
+
diff-lcs (1.4.4)
|
25
|
+
ffi (1.13.1)
|
26
|
+
formatador (0.2.5)
|
27
27
|
guard (2.2.5)
|
28
28
|
formatador (>= 0.2.4)
|
29
29
|
listen (~> 2.1)
|
30
30
|
lumberjack (~> 1.0)
|
31
31
|
pry (>= 0.9.12)
|
32
32
|
thor (>= 0.18.1)
|
33
|
-
guard-rspec (4.2.
|
33
|
+
guard-rspec (4.2.10)
|
34
34
|
guard (~> 2.1)
|
35
35
|
rspec (>= 2.14, < 4.0)
|
36
|
-
|
37
|
-
|
36
|
+
hitimes (2.0.0)
|
37
|
+
httparty (0.18.1)
|
38
|
+
mime-types (~> 3.0)
|
38
39
|
multi_xml (>= 0.5.2)
|
39
|
-
i18n (
|
40
|
-
|
41
|
-
listen (2.
|
42
|
-
celluloid (
|
40
|
+
i18n (1.8.5)
|
41
|
+
concurrent-ruby (~> 1.0)
|
42
|
+
listen (2.10.1)
|
43
|
+
celluloid (~> 0.16.0)
|
43
44
|
rb-fsevent (>= 0.9.3)
|
44
45
|
rb-inotify (>= 0.9)
|
45
|
-
lumberjack (1.
|
46
|
-
method_source (0.
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
rspec-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
46
|
+
lumberjack (1.2.8)
|
47
|
+
method_source (1.0.0)
|
48
|
+
mime-types (3.3.1)
|
49
|
+
mime-types-data (~> 3.2015)
|
50
|
+
mime-types-data (3.2020.0512)
|
51
|
+
minitest (5.14.2)
|
52
|
+
multi_xml (0.6.0)
|
53
|
+
pry (0.13.1)
|
54
|
+
coderay (~> 1.1)
|
55
|
+
method_source (~> 1.0)
|
56
|
+
public_suffix (4.0.6)
|
57
|
+
rb-fsevent (0.10.4)
|
58
|
+
rb-inotify (0.10.1)
|
59
|
+
ffi (~> 1.0)
|
60
|
+
rspec (3.10.0)
|
61
|
+
rspec-core (~> 3.10.0)
|
62
|
+
rspec-expectations (~> 3.10.0)
|
63
|
+
rspec-mocks (~> 3.10.0)
|
64
|
+
rspec-core (3.10.0)
|
65
|
+
rspec-support (~> 3.10.0)
|
66
|
+
rspec-expectations (3.10.0)
|
67
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
68
|
+
rspec-support (~> 3.10.0)
|
69
|
+
rspec-mocks (3.10.0)
|
70
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
71
|
+
rspec-support (~> 3.10.0)
|
72
|
+
rspec-support (3.10.0)
|
73
|
+
thor (1.0.1)
|
74
|
+
thread_safe (0.3.6)
|
75
|
+
timers (4.0.4)
|
76
|
+
hitimes
|
77
|
+
tzinfo (1.2.7)
|
70
78
|
thread_safe (~> 0.1)
|
71
79
|
webmock (1.16.1)
|
72
80
|
addressable (>= 2.2.7)
|
@@ -81,3 +89,6 @@ DEPENDENCIES
|
|
81
89
|
pensio_api!
|
82
90
|
rspec (>= 2.14)
|
83
91
|
webmock (~> 1.16.1)
|
92
|
+
|
93
|
+
BUNDLED WITH
|
94
|
+
2.1.4
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# PensioAPI
|
2
2
|
This gem covers most of the Merchant and eCommerce API functionality provided by AltaPay, formerly Pensio (https://altapay.com).
|
3
3
|
|
4
|
+
Ruby 2.4.x or later is recommended.
|
5
|
+
|
4
6
|
## Getting Started
|
5
7
|
|
6
8
|
First, register your Pensio credentials. For example, if you're using rails, create `config/initializers/pensio.rb` with the following contents:
|
data/lib/pensio_api.rb
CHANGED
@@ -13,7 +13,7 @@ module PensioAPI
|
|
13
13
|
@type = @raw['Type']
|
14
14
|
@reason_code = @raw['ReasonCode'].to_i
|
15
15
|
@reason = @raw['Reason']
|
16
|
-
@amount = BigDecimal
|
16
|
+
@amount = BigDecimal(@raw['Amount'])
|
17
17
|
@currency = @raw['Currency']
|
18
18
|
@acquirer_transaction_id = @raw['AcquirerTransactionId']
|
19
19
|
end
|
@@ -20,7 +20,7 @@ module PensioAPI
|
|
20
20
|
@acquirer = @raw['Acquirer']
|
21
21
|
@funding_date = Date.parse(@raw['FundingDate'])
|
22
22
|
@created_at = Date.parse(@raw['CreatedDate'])
|
23
|
-
@download_link = @raw['DownloadLink']
|
23
|
+
@download_link = @raw['DownloadLink'].strip
|
24
24
|
end
|
25
25
|
|
26
26
|
def download(options={})
|
@@ -9,7 +9,7 @@ module PensioAPI
|
|
9
9
|
def initialize(path, options={})
|
10
10
|
super(path, options)
|
11
11
|
|
12
|
-
@result = CSV.parse(@response.
|
12
|
+
@result = CSV.parse(@response.body, col_sep: ';', headers: true).reject(&:empty?)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -8,7 +8,8 @@ module PensioAPI
|
|
8
8
|
end
|
9
9
|
|
10
10
|
HEADERS = {
|
11
|
-
'Content-Type' => 'application/x-www-form-urlencoded; charset=utf-8'
|
11
|
+
'Content-Type' => 'application/x-www-form-urlencoded; charset=utf-8',
|
12
|
+
'x-altapay-client-version' => "RUBYSDK/#{PensioAPI::VERSION}"
|
12
13
|
}
|
13
14
|
|
14
15
|
def initialize(path, options={})
|
data/lib/pensio_api/request.rb
CHANGED
@@ -9,7 +9,7 @@ module PensioAPI
|
|
9
9
|
@transaction = PensioAPI::Transaction.new(
|
10
10
|
transactions['Transaction']
|
11
11
|
)
|
12
|
-
@refund_amount = BigDecimal
|
12
|
+
@refund_amount = BigDecimal(@raw['RefundedAmount'])
|
13
13
|
@refund_currency = @raw['RefundCurrency'].to_i
|
14
14
|
end
|
15
15
|
end
|
@@ -9,7 +9,7 @@ module PensioAPI
|
|
9
9
|
@transaction = PensioAPI::Transaction.new(
|
10
10
|
transactions['Transaction']
|
11
11
|
)
|
12
|
-
@capture_amount = BigDecimal
|
12
|
+
@capture_amount = BigDecimal(@raw['CaptureAmount'])
|
13
13
|
@capture_currency = @raw['CaptureCurrency'].to_i
|
14
14
|
end
|
15
15
|
end
|
@@ -15,6 +15,7 @@ module PensioAPI
|
|
15
15
|
attr_reader :order_id
|
16
16
|
attr_reader :merchant_currency
|
17
17
|
attr_reader :card_holder_currency
|
18
|
+
attr_reader :payment_source
|
18
19
|
attr_reader :chargeback_events
|
19
20
|
|
20
21
|
# constants for transaction statuses
|
@@ -31,10 +32,10 @@ module PensioAPI
|
|
31
32
|
|
32
33
|
@status = @raw['TransactionStatus']
|
33
34
|
|
34
|
-
@captured_amount = BigDecimal
|
35
|
-
@reserved_amount = BigDecimal
|
36
|
-
@refunded_amount = BigDecimal
|
37
|
-
@recurring_default_amount = BigDecimal
|
35
|
+
@captured_amount = BigDecimal(@raw['CapturedAmount'])
|
36
|
+
@reserved_amount = BigDecimal(@raw['ReservedAmount'])
|
37
|
+
@refunded_amount = BigDecimal(@raw['RefundedAmount'])
|
38
|
+
@recurring_default_amount = BigDecimal(@raw['RecurringDefaultAmount'])
|
38
39
|
|
39
40
|
@card_status = @raw['CardStatus']
|
40
41
|
@card_token = @raw['CreditCardToken']
|
@@ -45,6 +46,8 @@ module PensioAPI
|
|
45
46
|
@merchant_currency = @raw['MerchantCurrency'].to_i
|
46
47
|
@card_holder_currency = @raw['CardHolderCurrency'].to_i
|
47
48
|
|
49
|
+
@payment_source = @raw['PaymentSource']
|
50
|
+
|
48
51
|
map_chargeback_events
|
49
52
|
end
|
50
53
|
|
data/pensio_api.gemspec
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'pensio_api/version'
|
4
|
+
|
1
5
|
Gem::Specification.new do |s|
|
2
6
|
s.name = 'pensio_api'
|
3
|
-
s.version =
|
7
|
+
s.version = PensioAPI::VERSION
|
4
8
|
s.license = 'BSD-3-Clause'
|
5
9
|
s.summary = "Provides integration for the Pensio Merchant API"
|
6
10
|
s.authors = ['Michael Sell', 'Rory Sinclair']
|
@@ -6,7 +6,7 @@ describe PensioAPI::Callback do
|
|
6
6
|
let(:response) { PensioAPI::Callback.parse_success(file_fixture("success_callback.xml")) }
|
7
7
|
it "should return a SuccessCallback response" do
|
8
8
|
expect(response).to be_an_instance_of(PensioAPI::Responses::SuccessCallback)
|
9
|
-
expect(response.success?).to
|
9
|
+
expect(response.success?).to be true
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
@@ -14,7 +14,7 @@ describe PensioAPI::Callback do
|
|
14
14
|
let(:response) { PensioAPI::Callback.parse_failure(file_fixture("subscription_failure_callback.xml")) }
|
15
15
|
it "should return a SubscriptionFailureCallback response" do
|
16
16
|
expect(response).to be_an_instance_of(PensioAPI::Responses::SubscriptionFailureCallback)
|
17
|
-
expect(response.success?).to
|
17
|
+
expect(response.success?).to be true
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -22,7 +22,7 @@ describe PensioAPI::Callback do
|
|
22
22
|
let(:response) { PensioAPI::Callback.parse_chargeback(file_fixture("chargeback_callback.xml")) }
|
23
23
|
it "should return a ChargebackCallback response" do
|
24
24
|
expect(response).to be_an_instance_of(PensioAPI::Responses::ChargebackCallback)
|
25
|
-
expect(response.success?).to
|
25
|
+
expect(response.success?).to be true
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -11,7 +11,7 @@ describe PensioAPI::ChargebackEvent do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
describe 'reason_code' do
|
14
|
-
specify { expect(chargeback_event.reason_code).to be_an_instance_of(
|
14
|
+
specify { expect(chargeback_event.reason_code).to be_an_instance_of(Integer) }
|
15
15
|
end
|
16
16
|
|
17
17
|
describe 'reason' do
|
@@ -7,22 +7,25 @@ describe PensioAPI::Ecommerce do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
describe '.create_payment_request' do
|
10
|
-
let(:response) {
|
10
|
+
let(:response) {PensioAPI::Ecommerce.create_payment_request(reservation_arguments.merge({timeout: 10}))}
|
11
11
|
it 'returns an instance of PensioAPI::Responses::GatewayURL' do
|
12
12
|
expect(PensioAPI::Request).to receive(:post).with("/merchant/API/createPaymentRequest",
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
13
|
+
{:basic_auth => {:username => "test_user", :password => "password"},
|
14
|
+
:headers => {
|
15
|
+
"Content-Type" => "application/x-www-form-urlencoded; charset=utf-8",
|
16
|
+
'x-altapay-client-version' => "RUBYSDK/#{PensioAPI::VERSION}"
|
17
|
+
},
|
18
|
+
:body => {:terminal => "Pensio Test Terminal",
|
19
|
+
:shop_orderid => "Test Payment",
|
20
|
+
:amount => 123.45,
|
21
|
+
:currency => "eur"},
|
22
|
+
:timeout => 10}).and_call_original
|
20
23
|
expect(response).to be_an_instance_of(PensioAPI::Responses::GatewayURL)
|
21
24
|
end
|
22
25
|
end
|
23
26
|
|
24
27
|
describe '.create_multi_payment_request' do
|
25
|
-
let(:response) {
|
28
|
+
let(:response) {PensioAPI::Ecommerce.create_multi_payment_request(reservation_arguments)}
|
26
29
|
it 'returns an instance of PensioAPI::Responses::GatewayURL' do
|
27
30
|
expect(response).to be_an_instance_of(PensioAPI::Responses::GatewayURL)
|
28
31
|
end
|
@@ -31,7 +31,7 @@ describe PensioAPI::Errors::GatewayError do
|
|
31
31
|
|
32
32
|
describe 'object mapping' do
|
33
33
|
it 'maps transactions to transaction objects' do
|
34
|
-
expect(error.transactions.all? { |r| r.class == PensioAPI::Transaction }).to
|
34
|
+
expect(error.transactions.all? { |r| r.class == PensioAPI::Transaction }).to be true
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
@@ -3,12 +3,12 @@ require 'spec_helper'
|
|
3
3
|
describe PensioAPI::Request do
|
4
4
|
describe '.new' do
|
5
5
|
before :each do
|
6
|
-
PensioAPI::Request.
|
6
|
+
allow(PensioAPI::Request).to receive(:post).and_return(construct_response(nil))
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'POSTs to the given API path and passes in request options' do
|
10
10
|
request_options = PensioAPI::Request.new('/test').send(:request_options, {})
|
11
|
-
PensioAPI::Request.
|
11
|
+
expect(PensioAPI::Request).to receive(:post).with('/test', request_options)
|
12
12
|
PensioAPI::Request.new('/test')
|
13
13
|
end
|
14
14
|
end
|
@@ -16,7 +16,7 @@ describe PensioAPI::Request do
|
|
16
16
|
describe '.response_contains' do
|
17
17
|
context 'with a populated response body' do
|
18
18
|
before :each do
|
19
|
-
PensioAPI::Request.
|
19
|
+
allow(PensioAPI::Request).to receive(:post).and_return(
|
20
20
|
construct_response({
|
21
21
|
'Test' => 'true'
|
22
22
|
})
|
@@ -27,33 +27,33 @@ describe PensioAPI::Request do
|
|
27
27
|
|
28
28
|
context 'given a valid key' do
|
29
29
|
it 'returns true' do
|
30
|
-
expect(request.response_contains?('Test')).to
|
30
|
+
expect(request.response_contains?('Test')).to be true
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
34
|
context 'given an invalid key' do
|
35
35
|
it 'returns false' do
|
36
|
-
expect(request.response_contains?('OtherTest')).to
|
36
|
+
expect(request.response_contains?('OtherTest')).to be false
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
context 'with an empty response body' do
|
42
42
|
before :each do
|
43
|
-
PensioAPI::Request.
|
43
|
+
allow(PensioAPI::Request).to receive(:post).and_return(construct_response(nil))
|
44
44
|
end
|
45
45
|
|
46
46
|
let(:request) { PensioAPI::Request.new('/test') }
|
47
47
|
|
48
48
|
it 'returns false' do
|
49
|
-
expect(request.response_contains?('Test')).to
|
49
|
+
expect(request.response_contains?('Test')).to be false
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
54
|
describe '.request_options' do
|
55
55
|
before :each do
|
56
|
-
PensioAPI::Request.
|
56
|
+
allow(PensioAPI::Request).to receive(:post).and_return(construct_response(nil))
|
57
57
|
end
|
58
58
|
|
59
59
|
let(:p) { PensioAPI::Request.new('/test') }
|
@@ -40,7 +40,7 @@ describe PensioAPI::Responses::Base do
|
|
40
40
|
context 'with a successful response' do
|
41
41
|
context 'with success specified in the response body' do
|
42
42
|
it 'returns true' do
|
43
|
-
expect(response_object.success?).to
|
43
|
+
expect(response_object.success?).to be true
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
@@ -60,7 +60,7 @@ describe PensioAPI::Responses::Base do
|
|
60
60
|
let(:response_object) { PensioAPI::Responses::Base.new(test_data) }
|
61
61
|
|
62
62
|
it 'returns true' do
|
63
|
-
expect(response_object.success?).to
|
63
|
+
expect(response_object.success?).to be true
|
64
64
|
end
|
65
65
|
end
|
66
66
|
end
|
@@ -16,7 +16,7 @@ describe PensioAPI::Responses::FundingList do
|
|
16
16
|
|
17
17
|
describe '.page_count' do
|
18
18
|
it 'returns a number of pages' do
|
19
|
-
expect(funding_list.page_count).to be_an_instance_of(
|
19
|
+
expect(funding_list.page_count).to be_an_instance_of(Integer)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -12,7 +12,7 @@ describe PensioAPI::Responses::Refund do
|
|
12
12
|
|
13
13
|
describe 'readable attributes' do
|
14
14
|
specify { expect(response.transaction).to be_an_instance_of(PensioAPI::Transaction) }
|
15
|
-
specify { expect(response.refund_amount).to eq(BigDecimal
|
15
|
+
specify { expect(response.refund_amount).to eq(BigDecimal('0.12')) }
|
16
16
|
specify { expect(response.refund_currency).to eq(978) }
|
17
17
|
end
|
18
18
|
end
|
@@ -12,7 +12,7 @@ describe PensioAPI::Responses::ReservationCapture do
|
|
12
12
|
|
13
13
|
describe 'readable attributes' do
|
14
14
|
specify { expect(response.transaction).to be_an_instance_of(PensioAPI::Transaction) }
|
15
|
-
specify { expect(response.capture_amount).to eq(BigDecimal
|
15
|
+
specify { expect(response.capture_amount).to eq(BigDecimal('0.20')) }
|
16
16
|
specify { expect(response.capture_currency).to eq(978) }
|
17
17
|
end
|
18
18
|
end
|
@@ -5,7 +5,7 @@ describe PensioAPI::Responses::SubscriptionFailureCallback do
|
|
5
5
|
let(:response) { PensioAPI::Callback.parse_failure(file_fixture("subscription_failure_callback.xml")) }
|
6
6
|
|
7
7
|
it "succeeds" do
|
8
|
-
expect(response.success?).to
|
8
|
+
expect(response.success?).to be true
|
9
9
|
end
|
10
10
|
|
11
11
|
describe ".reservation" do
|
@@ -5,7 +5,7 @@ describe PensioAPI::Responses::SuccessCallback do
|
|
5
5
|
let(:response) { PensioAPI::Callback.parse_success(file_fixture("success_callback.xml")) }
|
6
6
|
|
7
7
|
it "succeeds" do
|
8
|
-
expect(response.success?).to
|
8
|
+
expect(response.success?).to be true
|
9
9
|
end
|
10
10
|
|
11
11
|
describe ".reservation" do
|
@@ -9,7 +9,7 @@ describe PensioAPI::Responses::Terminal do
|
|
9
9
|
|
10
10
|
describe 'object mapping' do
|
11
11
|
it 'maps terminals to terminal objects' do
|
12
|
-
expect(response.terminals.all? { |r| r.class == PensioAPI::Terminal }).to
|
12
|
+
expect(response.terminals.all? { |r| r.class == PensioAPI::Terminal }).to be true
|
13
13
|
end
|
14
14
|
|
15
15
|
specify { expect(response.terminals.length).to eq(2) }
|
@@ -9,7 +9,7 @@ describe PensioAPI::Responses::Transaction do
|
|
9
9
|
|
10
10
|
describe 'object mapping' do
|
11
11
|
it 'maps transactions to transaction objects' do
|
12
|
-
expect(response.transactions.all? { |r| r.class == PensioAPI::Transaction }).to
|
12
|
+
expect(response.transactions.all? { |r| r.class == PensioAPI::Transaction }).to be true
|
13
13
|
end
|
14
14
|
|
15
15
|
specify { expect(response.transactions.length).to eq(1) }
|
@@ -31,11 +31,11 @@ describe PensioAPI::Transaction do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
describe '.merchant_currency' do
|
34
|
-
specify { expect(transaction.merchant_currency).to be_an_instance_of(
|
34
|
+
specify { expect(transaction.merchant_currency).to be_an_instance_of(Integer) }
|
35
35
|
end
|
36
36
|
|
37
37
|
describe '.card_holder_currency' do
|
38
|
-
specify { expect(transaction.card_holder_currency).to be_an_instance_of(
|
38
|
+
specify { expect(transaction.card_holder_currency).to be_an_instance_of(Integer) }
|
39
39
|
end
|
40
40
|
|
41
41
|
describe '.chargeback_events' do
|
@@ -51,7 +51,7 @@ describe PensioAPI::Transaction do
|
|
51
51
|
end
|
52
52
|
|
53
53
|
it 'maps transactions to transaction objects' do
|
54
|
-
expect(response.all? { |r| r.class == PensioAPI::Transaction }).to
|
54
|
+
expect(response.all? { |r| r.class == PensioAPI::Transaction }).to be true
|
55
55
|
end
|
56
56
|
|
57
57
|
specify { expect(response.transactions.length).to eq(1) }
|
@@ -91,7 +91,7 @@ describe PensioAPI::Transaction do
|
|
91
91
|
|
92
92
|
context 'when the full reserved amount has not been captured' do
|
93
93
|
it 'returns false' do
|
94
|
-
transaction.
|
94
|
+
allow(transaction).to receive(:captured_amount).and_return(BigDecimal('0'))
|
95
95
|
expect(transaction).to_not be_captured
|
96
96
|
end
|
97
97
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pensio_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Sell
|
8
8
|
- Rory Sinclair
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-11-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -109,12 +109,13 @@ dependencies:
|
|
109
109
|
- - ">="
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: 0.5.2
|
112
|
-
description:
|
112
|
+
description:
|
113
113
|
email: michael@asw.com
|
114
114
|
executables: []
|
115
115
|
extensions: []
|
116
116
|
extra_rdoc_files: []
|
117
117
|
files:
|
118
|
+
- ".gitignore"
|
118
119
|
- ".rspec"
|
119
120
|
- Gemfile
|
120
121
|
- Gemfile.lock
|
@@ -155,6 +156,7 @@ files:
|
|
155
156
|
- lib/pensio_api/subscription.rb
|
156
157
|
- lib/pensio_api/terminal.rb
|
157
158
|
- lib/pensio_api/transaction.rb
|
159
|
+
- lib/pensio_api/version.rb
|
158
160
|
- pensio_api.gemspec
|
159
161
|
- spec/lib/pensio_api/billing_address_spec.rb
|
160
162
|
- spec/lib/pensio_api/callback_spec.rb
|
@@ -207,11 +209,11 @@ files:
|
|
207
209
|
- spec/support/fixtures/subscription_failure_callback.xml
|
208
210
|
- spec/support/fixtures/success_callback.xml
|
209
211
|
- spec/support/helpers.rb
|
210
|
-
homepage:
|
212
|
+
homepage:
|
211
213
|
licenses:
|
212
214
|
- BSD-3-Clause
|
213
215
|
metadata: {}
|
214
|
-
post_install_message:
|
216
|
+
post_install_message:
|
215
217
|
rdoc_options: []
|
216
218
|
require_paths:
|
217
219
|
- lib
|
@@ -226,9 +228,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
226
228
|
- !ruby/object:Gem::Version
|
227
229
|
version: '0'
|
228
230
|
requirements: []
|
229
|
-
|
230
|
-
|
231
|
-
signing_key:
|
231
|
+
rubygems_version: 3.0.3
|
232
|
+
signing_key:
|
232
233
|
specification_version: 4
|
233
234
|
summary: Provides integration for the Pensio Merchant API
|
234
235
|
test_files:
|