mangopay 3.0.36 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8cd7631afb582279a222aeb5c81d6f8a507e47bc7a0a6e23e171f34c9e519034
4
- data.tar.gz: 472287e318eb7470c7020a09a889e9b9d630c98db2c095c7a8dd628cdffab223
3
+ metadata.gz: 98ce43d5b86c9ebc7d2b4385da9ef113e4cac11ca6cacc3fe339afc2cf0c3197
4
+ data.tar.gz: 1879444087321901f562eb4e031a7fa5474fbfb63119908e69964a381bb5d03b
5
5
  SHA512:
6
- metadata.gz: 8748baa780499d4881d9f9a8c9abcbaf5c804a5b9f5bbe78821bc79ea6e26773b40dbb056f6e459ab238e06f21328d87688db12e84cb6a78afb25f6b94f4f818
7
- data.tar.gz: 4e0360de8ff724d8ea0c22796fd719235e5effeea7cce897c6d0a177ebc9589b59d70846d7d7fa18257ce91447fa3bce6789a6dd0856795128ca1f45e69698b7
6
+ metadata.gz: 9daff7284d4b7f3720655a7933e0971ca34f80f945de6b8bcbef83b5ab83c46e42ca7bc23d804fcd35e982bfdb8afdf7d936c4a1e93c0f8ae190cc539f0cd9d2
7
+ data.tar.gz: edbde0cde8b2308e6d950a730f595cedfe53e50852a30baff92be7cf58869b99cc0817304095d723f0aa48e72812c88c7fdecb83c0bd78c6cc5199986a2f9730
data/.travis.yml CHANGED
@@ -1,12 +1,13 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.0.0
4
- - 2.1
5
- - 2.2
6
- - 2.3
7
- - 2.4
3
+ # - 2.0.0
4
+ # - 2.1
5
+ # - 2.2
6
+ # - 2.3
7
+ # - 2.4
8
8
  - 2.5
9
- script: bundle exec rspec
9
+ script:
10
+ - if [ $TRAVIS_BRANCH != "release" ]; then bundle exec rspec; fi
10
11
  deploy:
11
12
  provider: rubygems
12
13
  api_key:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,81 @@
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
+
29
+ ## [3.2.0]
30
+ ## Added
31
+
32
+ ### On demand feature for 3DSv2
33
+
34
+ > **This on-demand feature is for testing purposes only and will not be available in production**
35
+
36
+ #### Request
37
+
38
+ We've added a new parameter `Requested3DSVersion` (not mandatory) that allows you to choose between versions of 3DS protocols (managed by the parameter `SecureMode`). Two values are available:
39
+ * `V1`
40
+ * `V2_1`
41
+
42
+ If nothing is sent, the flow will be 3DS V1.
43
+
44
+ The `Requested3DSVersion` may be included on all calls to the following endpoints:
45
+ * `/preauthorizations/card/direct`
46
+ * `/payins/card/direct`
47
+
48
+ #### Response
49
+
50
+ In the API response, the `Requested3DSVersion` will show the value you requested:
51
+ * `V1`
52
+ * `V2_1`
53
+ * `null` – indicates that nothing was requested
54
+
55
+ The parameter `Applied3DSVersion` shows you the version of the 3DS protocol used. Two values are possible:
56
+ * `V1`
57
+ * `V2_1`
58
+
59
+
60
+
61
+
62
+ ## [3.1.0]
63
+ - 3DS2 integration with Shipping and Billing objects, including FirstName and LastName fields
64
+ The objects Billing and Shipping may be included on all calls to the following endpoints:
65
+ - /preauthorizations/card/direct
66
+ - /payins/card/direct
67
+ - /payins/card/web
68
+ - Enable Instant Payment for payouts by adding a new parameter PayoutModeRequested on the following endpoint /payouts/bankwire
69
+ - The new parameter PayoutModeRequested can take two differents values : "INSTANT_PAYMENT" or "STANDARD" (STANDARD = the way we procede normaly a payout request)
70
+ - This new parameter is not mandatory and if empty or not present, the payout will be "STANDARD" by default
71
+ - Instant Payment is in beta all over Europe - SEPA region
72
+ - Add test on new payout mode PayoutModeRequested
73
+ ## [3.0.37] - 2020-10-30
74
+ - Card Validation endpoint fully activated
75
+ - added pre authorizations transactions method
76
+ - added new methods for client bank accounts and payouts
77
+ - Send headers for different api calls
78
+
1
79
  ## [3.0.36] - 2020-08-28
2
80
  - Forces TLS version to 1.2
3
81
 
data/README.md CHANGED
@@ -15,12 +15,12 @@ Since [v3.0.17](https://github.com/Mangopay/mangopay2-ruby-sdk/releases/tag/v3.0
15
15
 
16
16
  Account creation
17
17
  -------------------------------------------------
18
- You can get yourself a [free sandbox account](https://www.mangopay.com/signup/create-sandbox/) or sign up for a [production account](https://www.mangopay.com/signup/production-account/) (note that validation of your production account can take a few days, so think about doing it in advance of when you actually want to go live).
18
+ You can get yourself a free sandbox account or sign up for a production account by [registering on the Mangopay site](https://www.mangopay.com/start/) (note that validation of your production account involves several steps, so think about doing it in advance of when you actually want to go live).
19
19
 
20
20
  ## Usage
21
21
 
22
22
  ### Install
23
- * You can get yourself a [free sandbox account](https://www.mangopay.com/get-started/create-sandbox/) or sign up for a [production account](https://www.mangopay.com/signup/production-account/) (note that validation of your production account can take a few days, so think about doing it in advance of when you actually want to go live).
23
+ * You can get yourself a free sandbox account or sign up for a production account [on the Mangopay site](https://www.mangopay.com/start/) (note that validation of your production account will involve several steps, so think about doing it in advance of when you actually want to go live).
24
24
 
25
25
  * Install the gem by either running ```gem install mangopay```
26
26
  or by adding it to your Gemfile ```gem 'mangopay'```
@@ -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
- MangoPay.request(:get, url() + "/wallets/#{funds_type}/#{currency_iso_code}")
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.
@@ -69,6 +72,22 @@ module MangoPay
69
72
  MangoPay.request(:get, url() + "/wallets/#{funds_type}/#{currency_iso_code}/transactions", {}, filters)
70
73
  end
71
74
 
75
+ def validate(client_id, card_id)
76
+ url = "#{MangoPay.api_path}/cards/#{card_id}/validate"
77
+ MangoPay.request(:post, url)
78
+ end
79
+
80
+ def create_bank_account(params)
81
+ MangoPay.request(:post, url() + "/bankaccounts/iban", params)
82
+ end
83
+
84
+ def create_payout(params)
85
+ method = :post
86
+ path = url() + "/payouts"
87
+ yield method, path, params if block_given?
88
+ MangoPay.request(method, path, params)
89
+ end
90
+
72
91
  end
73
92
  end
74
93
  end
@@ -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
@@ -39,12 +39,12 @@ module MangoPay
39
39
  @@res_confidential_params ||= [
40
40
  'access_token', 'AccessKey', 'IBAN', 'CardRegistrationURL',
41
41
  'PreregistrationData', 'RedirectURL', 'RegistrationData',
42
- 'SecureModeRedirectUrl'
42
+ 'SecureModeRedirectUrl', 'OwnerName', 'OwnerAddress', 'BIC'
43
43
  ].freeze
44
44
  end
45
45
 
46
46
  def self.req_confidential_params
47
- @@req_confidential_params ||= ['File', 'IBAN'].freeze
47
+ @@req_confidential_params ||= ['File', 'IBAN', 'OwnerName', 'OwnerAddress', 'BIC'].freeze
48
48
  end
49
49
 
50
50
  end
@@ -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
@@ -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/
@@ -9,5 +9,9 @@ module MangoPay
9
9
  MangoPay.request(:post, "#{url}/card/direct", params, {}, idempotency_key)
10
10
  end
11
11
 
12
+ def self.transactions(pre_authorization_id, filters = {})
13
+ MangoPay.request(:get, "#{url}/#{pre_authorization_id}/transactions", {}, filters)
14
+ end
15
+
12
16
  end
13
17
  end
@@ -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/user.rb CHANGED
@@ -64,6 +64,16 @@ module MangoPay
64
64
  def pre_authorizations(user_id, filters = {})
65
65
  MangoPay.request(:get, url(user_id) + '/preauthorizations', {}, filters)
66
66
  end
67
+
68
+ # Fetches User Block Status
69
+ def block_status(user_id, filters = {})
70
+ MangoPay.request(:get, url(user_id) + '/blockStatus', {}, filters)
71
+ end
72
+
73
+ # Fetches User Regulatory
74
+ def regulatory(user_id, filters = {})
75
+ MangoPay.request(:get, url(user_id) + '/Regulatory', {}, filters)
76
+ end
67
77
  end
68
78
  end
69
79
  end
@@ -1,3 +1,3 @@
1
1
  module MangoPay
2
- VERSION = '3.0.36'
2
+ VERSION = '3.3.0'
3
3
  end
@@ -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
@@ -1,4 +1,6 @@
1
1
  describe MangoPay::Client do
2
+ include_context 'users'
3
+ include_context 'payins'
2
4
 
3
5
  describe 'FETCH' do
4
6
  it 'fetches the current client details' do
@@ -40,7 +42,7 @@ describe MangoPay::Client do
40
42
  describe 'UPLOAD LOGO' do
41
43
  it 'accepts Base64 encoded file content' do
42
44
  fnm = __FILE__.sub('.rb', '.png')
43
- bts = File.open(fnm, 'rb') {|f| f.read}
45
+ bts = File.open(fnm, 'rb') { |f| f.read }
44
46
  b64 = Base64.encode64(bts)
45
47
  ret = MangoPay::Client.upload_logo(b64)
46
48
  expect(ret).to be_nil
@@ -54,7 +56,7 @@ describe MangoPay::Client do
54
56
 
55
57
  it 'fails when input string is not base64-encoded' do
56
58
  file = 'any file content...'
57
- expect {MangoPay::Client.upload_logo(file)}.to raise_error {|err|
59
+ expect { MangoPay::Client.upload_logo(file) }.to raise_error { |err|
58
60
  expect(err).to be_a MangoPay::ResponseError
59
61
  expect(err.code).to eq '400'
60
62
  expect(err.type).to eq 'param_error'
@@ -73,14 +75,14 @@ describe MangoPay::Client do
73
75
  wlts = MangoPay::Client.fetch_wallets('fees')
74
76
  expect(wlts).to be_kind_of(Array)
75
77
  expect(wlts).not_to be_empty
76
- expect((wlts.map {|m| m['FundsType']}).uniq).to eq(['FEES'])
78
+ expect((wlts.map { |m| m['FundsType'] }).uniq).to eq(['FEES'])
77
79
  end
78
80
 
79
81
  it 'fetches all client credit wallets' do
80
82
  wlts = MangoPay::Client.fetch_wallets('credit')
81
83
  expect(wlts).to be_kind_of(Array)
82
84
  expect(wlts).not_to be_empty
83
- expect((wlts.map {|m| m['FundsType']}).uniq).to eq(['CREDIT'])
85
+ expect((wlts.map { |m| m['FundsType'] }).uniq).to eq(['CREDIT'])
84
86
  end
85
87
  end
86
88
 
@@ -124,4 +126,69 @@ describe MangoPay::Client do
124
126
  end
125
127
  end
126
128
 
129
+ describe 'validate' do
130
+ it 'validates card' do
131
+ client = MangoPay::Client.fetch
132
+ completed = new_card_registration_completed
133
+ card_id = completed['CardId']
134
+ client_id = client['ClientId']
135
+
136
+ card = MangoPay::Client.validate(client_id, card_id)
137
+ expect(client).not_to be_nil
138
+ expect(card).not_to be_nil
139
+ end
140
+ end
141
+
142
+ describe 'create_bank_account' do
143
+ it 'creates a new bank account' do
144
+ bank_account = MangoPay::Client.create_bank_account(Type: 'IBAN',
145
+ OwnerName: 'John',
146
+ OwnerAddress: {
147
+ AddressLine1: 'Le Palais Royal',
148
+ AddressLine2: '8 Rue de Montpensier',
149
+ City: 'Paris',
150
+ Region: '',
151
+ PostalCode: '75001',
152
+ Country: 'FR'
153
+ },
154
+ IBAN: 'FR7630004000031234567890143',
155
+ BIC: 'BNPAFRPP',
156
+ Tag: 'Test bank account')
157
+ expect(bank_account).not_to be_nil
158
+ expect(bank_account['Id']).not_to be_nil
159
+ end
160
+ end
161
+
162
+ describe 'create_payout' do
163
+ it 'creates a new payout' do
164
+ wallets = MangoPay::Client.fetch_wallets('FEES')
165
+ bank_account = MangoPay::Client.create_bank_account(Type: 'IBAN',
166
+ OwnerName: 'John',
167
+ OwnerAddress: {
168
+ AddressLine1: 'Le Palais Royal',
169
+ AddressLine2: '8 Rue de Montpensier',
170
+ City: 'Paris',
171
+ Region: '',
172
+ PostalCode: '75001',
173
+ Country: 'FR'
174
+ },
175
+ IBAN: 'FR7630004000031234567890143',
176
+ BIC: 'BNPAFRPP',
177
+ Tag: 'Test bank account')
178
+ pay_out = MangoPay::Client.create_payout(BankAccountId: bank_account['Id'],
179
+
180
+ DebitedFunds: {
181
+ Currency: 'EUR',
182
+ Amount: 12
183
+ },
184
+ DebitedWalletId: wallets[0]['Id'],
185
+ BankWireRef: 'invoice 7282',
186
+ PayoutModeRequested: 'STANDARD',
187
+ Tag: 'bla')
188
+
189
+ expect(pay_out).not_to be_nil
190
+ expect(pay_out['Id']).not_to be_nil
191
+ end
192
+ end
193
+
127
194
  end
@@ -1,6 +1,7 @@
1
1
  describe MangoPay do
2
2
  include_context 'users'
3
3
  include_context 'payins'
4
+ require 'json'
4
5
 
5
6
  describe 'requests log file' do
6
7
 
@@ -11,6 +11,7 @@ describe MangoPay::PayIn::ApplePay::Direct, type: :feature do
11
11
 
12
12
  describe 'CREATE' do
13
13
  it 'creates a applepay direct payin' do
14
+ #pending("no cards to test for")
14
15
  created = new_payin_applepay_direct
15
16
  expect(created['Id']).not_to be_nil
16
17
  check_type_and_status(created)
@@ -19,6 +19,7 @@ describe MangoPay::PayIn::Card::Direct, type: :feature do
19
19
  it 'creates a card direct payin' do
20
20
  created = new_payin_card_direct
21
21
  expect(created['Id']).not_to be_nil
22
+ expect(created['Requested3DSVersion']).not_to be_nil
22
23
  check_type_and_status(created)
23
24
  end
24
25
  end
@@ -18,7 +18,9 @@ describe MangoPay::PayIn::PreAuthorized::Direct, type: :feature do
18
18
  describe 'CREATE' do
19
19
  it 'creates a preauthorized direct payin' do
20
20
  created = new_payin_preauthorized_direct
21
+ transactions = MangoPay::PreAuthorization.transactions(created['PreauthorizationId'])
21
22
  expect(created['Id']).not_to be_nil
23
+ expect(transactions[0]['Status']).to eq('SUCCEEDED')
22
24
  check_type_and_status(created)
23
25
  end
24
26
  end
@@ -15,6 +15,7 @@ describe MangoPay::PreAuthorization do
15
15
  expect(created['PaymentStatus']).to eq('WAITING')
16
16
  expect(created['PaymentType']).to eq('CARD')
17
17
  expect(created['ExecutionType']).to eq('DIRECT')
18
+ expect(created['Requested3DSVersion']).to eq('V1')
18
19
  end
19
20
  end
20
21
 
@@ -136,8 +136,8 @@ shared_context 'bank_accounts' do
136
136
  PostalCode: '75001',
137
137
  Country: 'FR'
138
138
  },
139
- IBAN: 'FR7618829754160173622224154',
140
- BIC: 'CMBRFR2BCME',
139
+ IBAN: 'FR7630004000031234567890143',
140
+ BIC: 'BNPAFRPP',
141
141
  Tag: 'Test bank account')
142
142
  end
143
143
  end
@@ -368,7 +368,8 @@ shared_context 'payins' do
368
368
  CardType: 'CB_VISA_MASTERCARD',
369
369
  CardId: cardreg['CardId'],
370
370
  SecureModeReturnURL: 'http://test.com',
371
- Tag: 'Test PayIn/Card/Direct'
371
+ Tag: 'Test PayIn/Card/Direct',
372
+ Requested3DSVersion: 'V1'
372
373
  )
373
374
  end
374
375
 
@@ -385,7 +386,8 @@ shared_context 'payins' do
385
386
  CardId: cardreg['CardId'],
386
387
  SecureMode: 'DEFAULT',
387
388
  SecureModeReturnURL: 'http://test.com',
388
- Tag: 'Test Card PreAuthorization'
389
+ Tag: 'Test Card PreAuthorization',
390
+ Requested3DSVersion: 'V1'
389
391
  )
390
392
  end
391
393
 
@@ -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'
@@ -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'
@@ -208,4 +208,14 @@ describe MangoPay::User do
208
208
  expect(pre_authorizations).to be_an(Array)
209
209
  end
210
210
  end
211
+
212
+ =begin
213
+ describe 'FETCH Block Status' do
214
+ it "fetches user's block status" do
215
+ legal_user = new_legal_user
216
+ block_status = MangoPay::User.block_status(legal_user['Id'])
217
+ expect(block_status).to_not be_nil
218
+ end
219
+ end
220
+ =end
211
221
  end
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.0.36
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: 2020-08-28 00:00:00.000000000 Z
12
+ date: 2021-05-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json