mangopay 3.2.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +28 -0
- data/lib/mangopay/client.rb +8 -2
- data/lib/mangopay/dispute.rb +8 -8
- data/lib/mangopay/http_calls.rb +2 -2
- data/lib/mangopay/kyc_document.rb +7 -7
- data/lib/mangopay/pay_out.rb +2 -2
- data/lib/mangopay/transaction.rb +3 -3
- data/lib/mangopay/ubo.rb +4 -4
- data/lib/mangopay/ubo_declaration.rb +6 -6
- data/lib/mangopay/version.rb +1 -1
- data/lib/mangopay/wallet.rb +2 -2
- data/spec/mangopay/client_spec.rb +4 -4
- data/spec/mangopay/log_requests_filter_spec.rb +1 -0
- data/spec/mangopay/shared_resources.rb +2 -2
- data/spec/mangopay/ubo_declaration_spec.rb +4 -4
- data/spec/mangopay/ubo_spec.rb +3 -3
- 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: 98ce43d5b86c9ebc7d2b4385da9ef113e4cac11ca6cacc3fe339afc2cf0c3197
|
4
|
+
data.tar.gz: 1879444087321901f562eb4e031a7fa5474fbfb63119908e69964a381bb5d03b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9daff7284d4b7f3720655a7933e0971ca34f80f945de6b8bcbef83b5ab83c46e42ca7bc23d804fcd35e982bfdb8afdf7d936c4a1e93c0f8ae190cc539f0cd9d2
|
7
|
+
data.tar.gz: edbde0cde8b2308e6d950a730f595cedfe53e50852a30baff92be7cf58869b99cc0817304095d723f0aa48e72812c88c7fdecb83c0bd78c6cc5199986a2f9730
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,31 @@
|
|
1
|
+
## [3.3.0]
|
2
|
+
## Fixed
|
3
|
+
|
4
|
+
### IBAN for testing purposes
|
5
|
+
|
6
|
+
⚠️ **IBAN provided for testing purpose should never be used outside of a testing environement!**
|
7
|
+
|
8
|
+
More information about how to test payments, click [here](https://docs.mangopay.com/guide/testing-payments).
|
9
|
+
|
10
|
+
### Others
|
11
|
+
|
12
|
+
- Adding missing json require in log requests filter spec. Thank you @Vin0uz
|
13
|
+
- Extend fetch_wallet and create_payout API. Thank you @peterb
|
14
|
+
|
15
|
+
## Added
|
16
|
+
|
17
|
+
Some of you use a lot the [PreAuthorization](https://docs.mangopay.com/endpoints/v2.01/preauthorizations#e183_the-preauthorization-object) feature of our API. To make your life easier, we have added three new events :
|
18
|
+
|
19
|
+
- PREAUTHORIZATION_CREATED
|
20
|
+
- PREAUTHORIZATION_SUCCEEDED
|
21
|
+
- PREAUTHORIZATION_FAILED
|
22
|
+
|
23
|
+
The goal is to help you monitor a PreAuthorization with a [webhook](https://docs.mangopay.com/endpoints/v2.01/hooks#e246_the-hook-object).
|
24
|
+
|
25
|
+
*Example: If a PreAuthorization is desynchronized, when the status is updated, you will be able to know it.*
|
26
|
+
|
27
|
+
|
28
|
+
|
1
29
|
## [3.2.0]
|
2
30
|
## Added
|
3
31
|
|
data/lib/mangopay/client.rb
CHANGED
@@ -47,7 +47,10 @@ module MangoPay
|
|
47
47
|
# +currency_iso_code+ is currncy ISO code
|
48
48
|
# see https://docs.mangopay.com/api-references/client-wallets/
|
49
49
|
def fetch_wallet(funds_type, currency_iso_code)
|
50
|
-
|
50
|
+
method = :get
|
51
|
+
path = url() + "/wallets/#{funds_type}/#{currency_iso_code}"
|
52
|
+
yield method, path if block_given?
|
53
|
+
MangoPay.request(method, path)
|
51
54
|
end
|
52
55
|
|
53
56
|
# Fetch transactions for all your client wallets.
|
@@ -79,7 +82,10 @@ module MangoPay
|
|
79
82
|
end
|
80
83
|
|
81
84
|
def create_payout(params)
|
82
|
-
|
85
|
+
method = :post
|
86
|
+
path = url() + "/payouts"
|
87
|
+
yield method, path, params if block_given?
|
88
|
+
MangoPay.request(method, path, params)
|
83
89
|
end
|
84
90
|
|
85
91
|
end
|
data/lib/mangopay/dispute.rb
CHANGED
@@ -8,9 +8,9 @@ module MangoPay
|
|
8
8
|
include HTTPCalls::Update
|
9
9
|
class << self
|
10
10
|
|
11
|
-
def close(dispute_id)
|
11
|
+
def close(dispute_id, idempotency_key = nil)
|
12
12
|
url = url(dispute_id) + "/close/"
|
13
|
-
MangoPay.request(:put, url)
|
13
|
+
MangoPay.request(:put, url, {}, {}, idempotency_key)
|
14
14
|
end
|
15
15
|
|
16
16
|
# +contested_funds+: Money hash
|
@@ -44,7 +44,7 @@ module MangoPay
|
|
44
44
|
url = "#{MangoPay.api_path}/disputes/pendingsettlement"
|
45
45
|
MangoPay.request(:get, url, {}, filters)
|
46
46
|
end
|
47
|
-
|
47
|
+
|
48
48
|
#####################################################
|
49
49
|
# repudiations / settlement transfers
|
50
50
|
#####################################################
|
@@ -66,7 +66,7 @@ module MangoPay
|
|
66
66
|
url = "#{MangoPay.api_path}/settlements/#{transfer_id}"
|
67
67
|
MangoPay.request(:get, url)
|
68
68
|
end
|
69
|
-
|
69
|
+
|
70
70
|
#####################################################
|
71
71
|
# documents
|
72
72
|
#####################################################
|
@@ -91,13 +91,13 @@ module MangoPay
|
|
91
91
|
# Fetches list of dispute documents:
|
92
92
|
# - for the particular dispute if +dispute_id+ is provided (not nil)
|
93
93
|
# - or for all disputes otherwise.
|
94
|
-
#
|
94
|
+
#
|
95
95
|
# Optional +filters+ is a hash accepting following keys:
|
96
96
|
# - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
97
97
|
# - filters such as +Type+ (e.g. 'REFUND_PROOF') and +Status+ (e.g. 'VALIDATED')
|
98
98
|
# - +BeforeDate+ (timestamp): filters documents with CreationDate _before_ this date
|
99
99
|
# - +AfterDate+ (timestamp): filters documents with CreationDate _after_ this date
|
100
|
-
#
|
100
|
+
#
|
101
101
|
# See https://docs.mangopay.com/api-references/disputes/dispute-documents/
|
102
102
|
#
|
103
103
|
def fetch_documents(dispute_id = nil, filters = {})
|
@@ -106,12 +106,12 @@ module MangoPay
|
|
106
106
|
end
|
107
107
|
|
108
108
|
# Adds the file page (attachment) to the given document.
|
109
|
-
#
|
109
|
+
#
|
110
110
|
# See https://docs.mangopay.com/api-references/disputes/dispute-document-pages/ :
|
111
111
|
# - Document have to be in 'CREATED' Status
|
112
112
|
# - You can create as many pages as needed
|
113
113
|
# - Change Status to 'VALIDATION_ASKED' to submit dispute documents
|
114
|
-
#
|
114
|
+
#
|
115
115
|
# The file_content_base64 param may be:
|
116
116
|
# - Base64 encoded file content
|
117
117
|
# - or nil: in this case pass the file path in the next param
|
data/lib/mangopay/http_calls.rb
CHANGED
@@ -52,9 +52,9 @@ module MangoPay
|
|
52
52
|
# MangoPay::User.fetch(filter = {'page' => 2, 'per_page' => 3})
|
53
53
|
# filter # => {"page"=>2, "per_page"=>3, "total_pages"=>1969, "total_items"=>5905}
|
54
54
|
#
|
55
|
-
def fetch(id_or_filters = nil)
|
55
|
+
def fetch(id_or_filters = nil, idempotency_key = nil)
|
56
56
|
id, filters = HTTPCalls::Fetch.parse_id_or_filters(id_or_filters)
|
57
|
-
response = MangoPay.request(:get, url(id), {}, filters)
|
57
|
+
response = MangoPay.request(:get, url(id), {}, filters, idempotency_key)
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
@@ -9,20 +9,20 @@ module MangoPay
|
|
9
9
|
MangoPay.request(:post, url(user_id), params, {}, idempotency_key)
|
10
10
|
end
|
11
11
|
|
12
|
-
def update(user_id, document_id, params = {})
|
13
|
-
MangoPay.request(:put, url(user_id, document_id), params)
|
12
|
+
def update(user_id, document_id, params = {}, idempotency_key = nil)
|
13
|
+
MangoPay.request(:put, url(user_id, document_id), params, {}, idempotency_key)
|
14
14
|
end
|
15
15
|
|
16
16
|
# Fetches the KYC document belonging to the given +user_id+, with the given +document_id+.
|
17
|
-
def fetch(user_id, document_id)
|
17
|
+
def fetch(user_id, document_id, idempotency_key = nil)
|
18
18
|
url = (user_id) ? url(user_id, document_id) : "#{MangoPay.api_path}/KYC/documents/#{CGI.escape(document_id.to_s)}"
|
19
|
-
MangoPay.request(:get, url)
|
19
|
+
MangoPay.request(:get, url, {}, {}, idempotency_key)
|
20
20
|
end
|
21
21
|
|
22
22
|
# Fetches list of KYC documents:
|
23
23
|
# - for the particular user if +user_id+ is provided (not nil)
|
24
24
|
# - or for all users otherwise.
|
25
|
-
#
|
25
|
+
#
|
26
26
|
# Optional +filters+ is a hash accepting following keys:
|
27
27
|
# - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
28
28
|
# - filters such as +Type+ (e.g. 'IDENTITY_PROOF') and +Status+ (e.g. 'VALIDATED')
|
@@ -35,12 +35,12 @@ module MangoPay
|
|
35
35
|
end
|
36
36
|
|
37
37
|
# Adds the file page (attachment) to the given document.
|
38
|
-
#
|
38
|
+
#
|
39
39
|
# See http://docs.mangopay.com/api-references/kyc/pages/ :
|
40
40
|
# - Document have to be in 'CREATED' Status
|
41
41
|
# - You can create as many pages as needed
|
42
42
|
# - Change Status to 'VALIDATION_ASKED' to submit KYC documents
|
43
|
-
#
|
43
|
+
#
|
44
44
|
# The file_content_base64 param may be:
|
45
45
|
# - Base64 encoded file content
|
46
46
|
# - or nil: in this case pass the file path in the next param
|
data/lib/mangopay/pay_out.rb
CHANGED
@@ -8,9 +8,9 @@ module MangoPay
|
|
8
8
|
# - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
9
9
|
# - +Status+: TransactionStatus {CREATED, SUCCEEDED, FAILED}
|
10
10
|
# - +ResultCode+: string representing the transaction result
|
11
|
-
def self.refunds(pay_out_id, filters = {})
|
11
|
+
def self.refunds(pay_out_id, filters = {}, idempotency_key = nil)
|
12
12
|
url = url(pay_out_id) + '/refunds'
|
13
|
-
MangoPay.request(:get, url, {}, filters)
|
13
|
+
MangoPay.request(:get, url, {}, filters, idempotency_key)
|
14
14
|
end
|
15
15
|
|
16
16
|
# See http://docs.mangopay.com/api-references/pay-out-bank-wire/
|
data/lib/mangopay/transaction.rb
CHANGED
@@ -3,7 +3,7 @@ module MangoPay
|
|
3
3
|
class << self
|
4
4
|
# Fetches list of transactions belonging to the given +wallet_id+.
|
5
5
|
# See also transactions for user: MangoPay::User#transactions
|
6
|
-
#
|
6
|
+
#
|
7
7
|
# Optional +filters+ is a hash accepting following keys:
|
8
8
|
# - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
9
9
|
# - +Status+: TransactionStatus {CREATED, SUCCEEDED, FAILED}
|
@@ -12,8 +12,8 @@ module MangoPay
|
|
12
12
|
# - +BeforeDate+ (timestamp): filters transactions with CreationDate _before_ this date
|
13
13
|
# - +AfterDate+ (timestamp): filters transactions with CreationDate _after_ this date
|
14
14
|
# See https://docs.mangopay.com/api-references/sort-lists/
|
15
|
-
def fetch(wallet_id, filters={})
|
16
|
-
MangoPay.request(:get, url(wallet_id), {}, filters)
|
15
|
+
def fetch(wallet_id, filters={}, headers = nil)
|
16
|
+
MangoPay.request(:get, url(wallet_id), {}, filters, headers)
|
17
17
|
end
|
18
18
|
|
19
19
|
def url(wallet_id)
|
data/lib/mangopay/ubo.rb
CHANGED
@@ -10,16 +10,16 @@ module MangoPay
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
def create(user_id, ubo_declaration_id, params)
|
14
|
-
MangoPay.request(:post, url(user_id, ubo_declaration_id), params)
|
13
|
+
def create(user_id, ubo_declaration_id, params, idempotency_key = nil)
|
14
|
+
MangoPay.request(:post, url(user_id, ubo_declaration_id), params, {}, idempotency_key)
|
15
15
|
end
|
16
16
|
|
17
17
|
def fetch(user_id, ubo_declaration_id, ubo_id)
|
18
18
|
MangoPay.request(:get, url(user_id, ubo_declaration_id, ubo_id))
|
19
19
|
end
|
20
20
|
|
21
|
-
def update(user_id, ubo_declaration_id, ubo_id, params)
|
22
|
-
MangoPay.request(:put, url(user_id, ubo_declaration_id, ubo_id), params)
|
21
|
+
def update(user_id, ubo_declaration_id, ubo_id, params, idempotency_key = nil)
|
22
|
+
MangoPay.request(:put, url(user_id, ubo_declaration_id, ubo_id), params, {}, idempotency_key)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -10,20 +10,20 @@ module MangoPay
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
def create(user_id)
|
14
|
-
MangoPay.request(:post, url(user_id))
|
13
|
+
def create(user_id, idempotency_key)
|
14
|
+
MangoPay.request(:post, url(user_id), {}, {}, idempotency_key)
|
15
15
|
end
|
16
16
|
|
17
|
-
def fetch(user_id, id)
|
18
|
-
MangoPay.request(:get, url(user_id, id))
|
17
|
+
def fetch(user_id, id, idempotency_key)
|
18
|
+
MangoPay.request(:get, url(user_id, id), {}, {}, idempotency_key)
|
19
19
|
end
|
20
20
|
|
21
|
-
def update(user_id, id, params = {})
|
21
|
+
def update(user_id, id, params = {}, idempotency_key)
|
22
22
|
request_params = {
|
23
23
|
Status: params['Status'],
|
24
24
|
Ubos: params['Ubos']
|
25
25
|
}
|
26
|
-
MangoPay.request(:put, url(user_id, id), request_params)
|
26
|
+
MangoPay.request(:put, url(user_id, id), request_params, {}, idempotency_key)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
data/lib/mangopay/version.rb
CHANGED
data/lib/mangopay/wallet.rb
CHANGED
@@ -10,8 +10,8 @@ module MangoPay
|
|
10
10
|
# Optional +filters+ is a hash accepting following keys:
|
11
11
|
# - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
12
12
|
# - other keys specific for transactions filtering (see MangoPay::Transaction.fetch)
|
13
|
-
def self.transactions(wallet_id, filters = {})
|
14
|
-
Transaction.fetch(wallet_id, filters)
|
13
|
+
def self.transactions(wallet_id, filters = {}, headers = nil)
|
14
|
+
Transaction.fetch(wallet_id, filters, headers)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -151,8 +151,8 @@ describe MangoPay::Client do
|
|
151
151
|
PostalCode: '75001',
|
152
152
|
Country: 'FR'
|
153
153
|
},
|
154
|
-
IBAN: '
|
155
|
-
BIC: '
|
154
|
+
IBAN: 'FR7630004000031234567890143',
|
155
|
+
BIC: 'BNPAFRPP',
|
156
156
|
Tag: 'Test bank account')
|
157
157
|
expect(bank_account).not_to be_nil
|
158
158
|
expect(bank_account['Id']).not_to be_nil
|
@@ -172,8 +172,8 @@ describe MangoPay::Client do
|
|
172
172
|
PostalCode: '75001',
|
173
173
|
Country: 'FR'
|
174
174
|
},
|
175
|
-
IBAN: '
|
176
|
-
BIC: '
|
175
|
+
IBAN: 'FR7630004000031234567890143',
|
176
|
+
BIC: 'BNPAFRPP',
|
177
177
|
Tag: 'Test bank account')
|
178
178
|
pay_out = MangoPay::Client.create_payout(BankAccountId: bank_account['Id'],
|
179
179
|
|
@@ -136,8 +136,8 @@ shared_context 'bank_accounts' do
|
|
136
136
|
PostalCode: '75001',
|
137
137
|
Country: 'FR'
|
138
138
|
},
|
139
|
-
IBAN: '
|
140
|
-
BIC: '
|
139
|
+
IBAN: 'FR7630004000031234567890143',
|
140
|
+
BIC: 'BNPAFRPP',
|
141
141
|
Tag: 'Test bank account')
|
142
142
|
end
|
143
143
|
end
|
@@ -6,9 +6,9 @@ describe MangoPay::UboDeclaration do
|
|
6
6
|
it 'can fetch a UBO declaration' do
|
7
7
|
legal_user = new_legal_user
|
8
8
|
|
9
|
-
ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'])
|
9
|
+
ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'], nil)
|
10
10
|
|
11
|
-
ubo_declaration_byId = MangoPay::UboDeclaration.fetch(legal_user['Id'], ubo_declaration['Id'])
|
11
|
+
ubo_declaration_byId = MangoPay::UboDeclaration.fetch(legal_user['Id'], ubo_declaration['Id'], nil)
|
12
12
|
|
13
13
|
expect(ubo_declaration).not_to be_nil
|
14
14
|
expect(ubo_declaration_byId).not_to be_nil
|
@@ -17,13 +17,13 @@ describe MangoPay::UboDeclaration do
|
|
17
17
|
describe 'UPDATE' do
|
18
18
|
it 'can update a UBO declaration' do
|
19
19
|
legal_user = new_legal_user
|
20
|
-
ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'])
|
20
|
+
ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'], nil)
|
21
21
|
ubo_declaration['Status'] = 'VALIDATION_ASKED'
|
22
22
|
|
23
23
|
ubo = new_ubo(legal_user, ubo_declaration)
|
24
24
|
|
25
25
|
ubo_declaration['Ubos'] = [ubo]
|
26
|
-
ubo_declaration = MangoPay::UboDeclaration.update(legal_user['Id'], ubo_declaration['Id'], ubo_declaration)
|
26
|
+
ubo_declaration = MangoPay::UboDeclaration.update(legal_user['Id'], ubo_declaration['Id'], ubo_declaration, nil)
|
27
27
|
|
28
28
|
expect(ubo_declaration).not_to be_nil
|
29
29
|
expect(ubo_declaration['Status']).to eq 'VALIDATION_ASKED'
|
data/spec/mangopay/ubo_spec.rb
CHANGED
@@ -5,7 +5,7 @@ describe MangoPay::Ubo do
|
|
5
5
|
describe 'FETCH' do
|
6
6
|
it 'can fetch a Ubo' do
|
7
7
|
legal_user = new_legal_user
|
8
|
-
ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'])
|
8
|
+
ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'], nil)
|
9
9
|
ubo = new_ubo(legal_user, ubo_declaration)
|
10
10
|
result = MangoPay::Ubo.fetch(legal_user['Id'], ubo_declaration['Id'], ubo['Id'])
|
11
11
|
expect(result).not_to be_nil
|
@@ -16,7 +16,7 @@ describe MangoPay::Ubo do
|
|
16
16
|
describe 'CREATE' do
|
17
17
|
it 'can create a new Ubo' do
|
18
18
|
legal_user = new_legal_user
|
19
|
-
ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'])
|
19
|
+
ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'], nil)
|
20
20
|
result = new_ubo(legal_user, ubo_declaration)
|
21
21
|
expect(result).not_to be_nil
|
22
22
|
end
|
@@ -25,7 +25,7 @@ describe MangoPay::Ubo do
|
|
25
25
|
describe 'UPDATE' do
|
26
26
|
it 'can update a Ubo' do
|
27
27
|
legal_user = new_legal_user
|
28
|
-
ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'])
|
28
|
+
ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'], nil)
|
29
29
|
ubo = new_ubo(legal_user, ubo_declaration)
|
30
30
|
ubo['FirstName'] = 'Santa'
|
31
31
|
ubo['LastName'] = 'Clause'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mangopay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geoffroy Lorieux
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-05-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|