mangopay-v4 4.0.1 → 4.0.2
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/lib/mangopay.rb +1 -1
- data/lib/mangopay/api/api_methods.rb +1 -0
- data/lib/mangopay/api/http_client.rb +2 -1
- data/lib/mangopay/api/service/cards.rb +10 -0
- data/lib/mangopay/model/entity/pre_authorization.rb +5 -0
- data/spec/mangopay/cards_spec.rb +13 -0
- data/spec/mangopay/oauth_tokens_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac8a71b128ce9bf0f6c8d732c600ee4f07379f9785d172c6a0ccbe1434d140b3
|
4
|
+
data.tar.gz: c05c9c7dbe82369f3f4d467692290e9b07a278c7f2a303db083e8737135e1710
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ace06ef9846789a75dd5a94afc35033c8a874e8a3729fac2627e7a6695154e9bebdcece35d3a4c046a9969532752cce53ebfe5932a2910d4e96187980ed073c
|
7
|
+
data.tar.gz: 3e2dcea20db213de57673d6287057155d268d2e35d77a19343a6098db8c93a9e3437fbecb0a858efbcb813e7a22720006a4722765d6cccc37be4bcd70bf6e1f3
|
data/lib/mangopay.rb
CHANGED
@@ -8,7 +8,7 @@ require_relative 'mangopay/api/api'
|
|
8
8
|
module MangoPay
|
9
9
|
LOG = LogProvider.provide(self)
|
10
10
|
|
11
|
-
VERSION = '4.0.
|
11
|
+
VERSION = '4.0.2'.freeze
|
12
12
|
|
13
13
|
SANDBOX_API_URL = 'https://api.sandbox.mangopay.com'.freeze
|
14
14
|
MAIN_API_URL = 'https://api.mangopay.com'.freeze
|
@@ -63,6 +63,7 @@ module MangoApi
|
|
63
63
|
get_cards_by_fingerprint: %w[GET %(cards/fingerprints/#{_params[0]})],
|
64
64
|
deactivate_card: %w[PUT %(cards/#{_params[0]})],
|
65
65
|
get_preauthorizations_for_card: %w[GET %(cards/#{_params[0]}/preauthorizations)],
|
66
|
+
card_validate: %w[POST %(cards/#{_params[0]}/validate)],
|
66
67
|
|
67
68
|
get_users_transactions: %w[GET %(users/#{_params[0]}/transactions)],
|
68
69
|
get_wallets_transactions: %w[GET %(wallets/#{_params[0]}/transactions)],
|
@@ -137,6 +137,7 @@ module MangoApi
|
|
137
137
|
response = Net::HTTP.start(uri.host,
|
138
138
|
uri.port,
|
139
139
|
use_ssl: true,
|
140
|
+
ssl_version: :TLSv1_2,
|
140
141
|
read_timeout: http_timeout) do |http|
|
141
142
|
request = http_method.new(uri.request_uri)
|
142
143
|
yield request if block_given?
|
@@ -287,7 +288,7 @@ module MangoApi
|
|
287
288
|
def initialize_headers
|
288
289
|
auth_token = MangoApi::AuthTokenManager.token
|
289
290
|
@default_headers = {
|
290
|
-
'User-Agent' => "
|
291
|
+
'User-Agent' => "MangoPay V2 SDK Ruby Bindings v4/#{MangoPay::VERSION}",
|
291
292
|
'Authorization' => "#{auth_token['token_type']} "\
|
292
293
|
"#{auth_token['access_token']}",
|
293
294
|
'Content-Type' => 'application/json'
|
@@ -117,6 +117,16 @@ module MangoApi
|
|
117
117
|
parse_card response
|
118
118
|
end
|
119
119
|
|
120
|
+
# Validates the card entity specified by an id.
|
121
|
+
#
|
122
|
+
# @param +id+ [String] ID of the card to validate
|
123
|
+
# @return [Card] the validated card entity object
|
124
|
+
def validate(id)
|
125
|
+
uri = provide_uri(:card_validate, id)
|
126
|
+
response = HttpClient.post(uri, nil)
|
127
|
+
parse_card response
|
128
|
+
end
|
129
|
+
|
120
130
|
private
|
121
131
|
|
122
132
|
# Parses a JSON-originating hash into the corresponding
|
@@ -71,5 +71,10 @@ module MangoModel
|
|
71
71
|
# [SecurityInfo] Security & validation information
|
72
72
|
attr_accessor :security_info
|
73
73
|
|
74
|
+
# [true/false] True if the Multi Capture was used
|
75
|
+
attr_accessor :multi_capture
|
76
|
+
|
77
|
+
# [Money] Information about the remaining funds
|
78
|
+
attr_accessor :remaining_funds
|
74
79
|
end
|
75
80
|
end
|
data/spec/mangopay/cards_spec.rb
CHANGED
@@ -24,6 +24,19 @@ describe MangoApi::Cards do
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
+
# describe '.validate_card' do
|
28
|
+
#
|
29
|
+
# context 'given a valid object' do
|
30
|
+
# it 'validates it' do
|
31
|
+
# card_registration = CARD_REGISTRATION_DATA
|
32
|
+
# retrieved = MangoApi::Cards.create_registration card_registration
|
33
|
+
# validate = MangoApi::Cards.validate(retrieved.id)
|
34
|
+
#
|
35
|
+
# expect(validate).not_to be_nil
|
36
|
+
# end
|
37
|
+
# end
|
38
|
+
# end
|
39
|
+
|
27
40
|
describe '.complete_registration' do
|
28
41
|
|
29
42
|
context 'given the registration data from Tokenization Server' do
|
@@ -16,7 +16,7 @@ describe MangoApi::OAuthTokens do
|
|
16
16
|
# noinspection RubyStringKeysInHashInspection
|
17
17
|
headers = {
|
18
18
|
'Authorization' => "#{token['token_type']} #{token['access_token']}",
|
19
|
-
'User-Agent' => "
|
19
|
+
'User-Agent' => "MangoPay V2 SDK Ruby Bindings v4/#{MangoPay::VERSION}",
|
20
20
|
'Content-Type' => 'application/json'
|
21
21
|
}
|
22
22
|
url = 'https://api.sandbox.mangopay.com/v2.01/sdk-unit-tests/users/natural'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mangopay-v4
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MangoTeam
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|