mangopay-v4 4.0.2 → 4.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ac8a71b128ce9bf0f6c8d732c600ee4f07379f9785d172c6a0ccbe1434d140b3
4
- data.tar.gz: c05c9c7dbe82369f3f4d467692290e9b07a278c7f2a303db083e8737135e1710
3
+ metadata.gz: a4cb6ee4ad9f81b7ba750f66da315b5e041dada7f5c915fea5a05e6a0d48c278
4
+ data.tar.gz: f7a54fd993ea0ccce6b5d483cf7c2bd7e201875f95fe284061853e9c87a68ff8
5
5
  SHA512:
6
- metadata.gz: 3ace06ef9846789a75dd5a94afc35033c8a874e8a3729fac2627e7a6695154e9bebdcece35d3a4c046a9969532752cce53ebfe5932a2910d4e96187980ed073c
7
- data.tar.gz: 3e2dcea20db213de57673d6287057155d268d2e35d77a19343a6098db8c93a9e3437fbecb0a858efbcb813e7a22720006a4722765d6cccc37be4bcd70bf6e1f3
6
+ metadata.gz: 38adaa0aa66d66db43344b5093de97bc0e65d46da244d1b3e4316bdeb722bce24771b937b51233580451a453d8758e3f88e0949c0de66423f89da71e6b745cd5
7
+ data.tar.gz: eb20ac29e6d973c4b9a988dda4c69205dff9c49d5259746dfb045b0fe360181e2d5616fd01e543af807d5bcc121739b1a4ab085e84999e9cadce14be85793afe
data/README.md CHANGED
@@ -15,12 +15,12 @@ For upgrading to v2.01 of the API, there is more information about the changes r
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 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).
24
24
 
25
25
  * Install the gem by either running ```gem install mangopay-v4```
26
26
  or by adding it to your Gemfile ```gem 'mangopay-v4'```
@@ -377,4 +377,4 @@ See the `MangoPay` module, the `Environment` and `Configuration` classes and doc
377
377
 
378
378
  ##### You can run all tests quickly with `rspec` command or configure RubyMine to run an RSpec configuration of all specs in folder `'spec/mangopay'`, or of a single file for targeted debugging.
379
379
 
380
- Specific tests can be run as well, by passing a `:focus` parameter along with the test's description string (see `'spec_helper.rb'` for more info)
380
+ Specific tests can be run as well, by passing a `:focus` parameter along with the test's description string (see `'spec_helper.rb'` for more info)
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.2'.freeze
11
+ VERSION = '4.1.0'.freeze
12
12
 
13
13
  SANDBOX_API_URL = 'https://api.sandbox.mangopay.com'.freeze
14
14
  MAIN_API_URL = 'https://api.mangopay.com'.freeze
@@ -14,6 +14,8 @@ module MangoApi
14
14
  update_user: %w[PUT %(users/#{_params[0]}/#{_params[1]})],
15
15
  get_user: %w[GET %(users/#{_params[0]})],
16
16
  get_users: %w[GET users],
17
+ get_user_block_status: %w[GET %(users/#{_params[0]}/blockStatus)],
18
+ get_user_regulatory: %w[GET %(users/#{_params[0]}/Regulatory)],
17
19
 
18
20
  create_account: %w[POST %(users/#{_params[0].user_id}/bankaccounts/#{_params[0].type.to_s.downcase})],
19
21
  deactivate_account: %w[PUT %(users/#{_params[0]}/bankaccounts/#{_params[1]})],
@@ -28,6 +30,8 @@ module MangoApi
28
30
  update_client: %w[PUT clients],
29
31
  get_client: %w[GET clients],
30
32
  upload_client_logo: %w[PUT clients/logo],
33
+ client_create_bank_account: %w[POST clients/bankaccounts/iban],
34
+ client_create_payout: %w[POST clients/payouts],
31
35
 
32
36
  get_client_wallet: %w[GET %(clients/wallets/#{_params[0].to_s}/#{_params[1].to_s})],
33
37
  get_client_wallets: %w[GET clients/wallets],
@@ -53,6 +53,18 @@ module MangoApi
53
53
  parse response
54
54
  end
55
55
 
56
+ def create_bank_account(bank_account)
57
+ uri = provide_uri(:client_create_bank_account)
58
+ response = HttpClient.post(uri, bank_account)
59
+ MangoModel::IbanBankAccount.new.dejsonify response
60
+ end
61
+
62
+ def create_payout(payout)
63
+ uri = provide_uri(:client_create_payout)
64
+ response = HttpClient.post(uri, payout)
65
+ MangoModel::PayOut.new.dejsonify response
66
+ end
67
+
56
68
  private
57
69
 
58
70
  # Parses a JSON-originating hash into the corresponding
@@ -123,6 +123,18 @@ module MangoApi
123
123
  parse_results results
124
124
  end
125
125
 
126
+ def get_block_status(id)
127
+ uri = provide_uri(:get_user_block_status, id)
128
+ response = HttpClient.get(uri)
129
+ parse response
130
+ end
131
+
132
+ def get_regulatory(id)
133
+ uri = provide_uri(:get_regulatory, id)
134
+ response = HttpClient.get(uri)
135
+ parse response
136
+ end
137
+
126
138
  private
127
139
 
128
140
  # Parses an array of JSON-originating hashes into the corresponding
@@ -30,6 +30,11 @@ module MangoPay
30
30
  require_relative '../model/entity/report'
31
31
  require_relative '../model/entity/banking_alias'
32
32
  require_relative '../model/declared_ubo'
33
+ require_relative '../model/entity/user_block_status'
34
+ require_relative '../model/scope_blocked'
35
+ require_relative '../model/shipping'
36
+ require_relative '../model/broswer_info'
37
+
33
38
  LOG = LogProvider.provide(self)
34
39
 
35
40
  # Serializes an object to a JSON string.
@@ -151,6 +156,10 @@ module MangoPay
151
156
  MangoModel::PlatformCategorization.new.dejsonify value
152
157
  when *MangoModel.fields_of_type(MangoModel::Billing)
153
158
  MangoModel::Billing.new.dejsonify value
159
+ when *MangoModel.fields_of_type(MangoModel::Shipping)
160
+ MangoModel::Shipping.new.dejsonify value
161
+ when *MangoModel.fields_of_type(MangoModel::BrowserInfo)
162
+ MangoModel::BrowserInfo.new.dejsonify value
154
163
  when *MangoModel.fields_of_type(MangoModel::SecurityInfo)
155
164
  MangoModel::SecurityInfo.new.dejsonify value
156
165
  when *MangoModel.fields_of_type(MangoModel::PersonType)
@@ -221,6 +230,8 @@ module MangoPay
221
230
  MangoModel::AvsResult.value_of value
222
231
  when *MangoModel.fields_of_type(DateTime)
223
232
  DateTime.parse value
233
+ when *MangoModel.fields_of_type(MangoModel::ScopeBlocked)
234
+ MangoModel::ScopeBlocked.value_of value
224
235
  else
225
236
  value
226
237
  end
@@ -6,6 +6,12 @@ module MangoModel
6
6
  class Billing
7
7
  include MangoPay::Jsonifier
8
8
 
9
+ # [String] FirstName
10
+ attr_accessor :first_name
11
+
12
+ # [String] FirstName
13
+ attr_accessor :last_name
14
+
9
15
  # [Address] The billing address
10
16
  attr_accessor :address
11
17
 
@@ -0,0 +1,36 @@
1
+ require_relative '../common/jsonifier'
2
+
3
+ module MangoModel
4
+
5
+ # Object that represents the browser info
6
+ class BrowserInfo
7
+ include MangoPay::Jsonifier
8
+
9
+ # [String] Accept Header
10
+ attr_accessor :accept_header
11
+
12
+ # [Boolean] Java Enabled
13
+ attr_accessor :java_enabled
14
+
15
+ # [Boolean] Javascript Enabled
16
+ attr_accessor :javascript_enabled
17
+
18
+ # [String] Language
19
+ attr_accessor :language
20
+
21
+ # [String] ColorDepth
22
+ attr_accessor :color_depth
23
+
24
+ # [String] ScreenHeight
25
+ attr_accessor :screen_height
26
+
27
+ # [String] ScreenWidth
28
+ attr_accessor :screen_width
29
+
30
+ # [String] TimeZoneOffset
31
+ attr_accessor :timezone_offset
32
+
33
+ # [String] UserAgent
34
+ attr_accessor :user_agent
35
+ end
36
+ end
@@ -38,5 +38,20 @@ module MangoModel
38
38
 
39
39
  # [CultureCode] The language to use for the payment page
40
40
  attr_accessor :culture
41
+
42
+ # [String] The ip address
43
+ attr_accessor :ip_address
44
+
45
+ # [Shipping] Shipping information
46
+ attr_accessor :shipping
47
+
48
+ # [BrowserInfo] Browser Info
49
+ attr_accessor :browser_info
50
+
51
+ # [String] Requested3DSVersion
52
+ attr_accessor :requested_3ds_version
53
+
54
+ # [String] Applied3DSVersion
55
+ attr_accessor :applied_3ds_version
41
56
  end
42
57
  end
@@ -33,5 +33,8 @@ module MangoModel
33
33
  # [String] The URL to redirect the user to for them to proceed
34
34
  # with the payment
35
35
  attr_accessor :redirect_url
36
+
37
+ # [Shipping] Shipping information
38
+ attr_accessor :shipping
36
39
  end
37
40
  end
@@ -16,6 +16,9 @@ module MangoModel
16
16
  # statement along with environment's Client name (max 12 chars)
17
17
  attr_accessor :bank_wire_ref
18
18
 
19
+ # [String] The new parameter "PayoutModeRequested" can take two different values : "INSTANT_PAYMENT" or "STANDARD"
20
+ attr_accessor :payout_mode_requested
21
+
19
22
  # [PayOutPaymentType] Its type
20
23
  attr_accessor :payment_type
21
24
  end
@@ -76,5 +76,20 @@ module MangoModel
76
76
 
77
77
  # [Money] Information about the remaining funds
78
78
  attr_accessor :remaining_funds
79
+
80
+ # [String] IpAddress
81
+ attr_accessor :ip_address
82
+
83
+ # [Shipping] Shipping information
84
+ attr_accessor :shipping
85
+
86
+ # [BrowserInfo] Browser Info
87
+ attr_accessor :browser_info
88
+
89
+ # [String] Requested3DSVersion
90
+ attr_accessor :requested_3ds_version
91
+
92
+ # [String] Applied3DSVersion
93
+ attr_accessor :applied_3ds_version
79
94
  end
80
95
  end
@@ -0,0 +1,13 @@
1
+ require_relative '../../common/jsonifier'
2
+
3
+ module MangoModel
4
+
5
+ # UserBlockStatus entity
6
+ class UserBlockStatus < EntityBase
7
+ include MangoPay::Jsonifier
8
+
9
+ attr_accessor :scope_blocked
10
+
11
+ attr_accessor :action_code
12
+ end
13
+ end
@@ -73,5 +73,10 @@ module MangoModel
73
73
  UBO_DECLARATION_VALIDATED = value 'UBO_DECLARATION_VALIDATED'
74
74
 
75
75
  USER_KYC_REGULAR = value 'USER_KYC_REGULAR'
76
+
77
+ USER_INFLOWS_BLOCKED = value 'USER_INFLOWS_BLOCKED'
78
+ USER_INFLOWS_UNBLOCKED = value 'USER_INFLOWS_UNBLOCKED'
79
+ USER_OUTFLOWS_BLOCKED = value 'USER_OUTFLOWS_BLOCKED'
80
+ USER_OUTFLOWS_UNBLOCKED = value 'USER_OUTFLOWS_UNBLOCKED'
76
81
  end
77
82
  end
@@ -12,5 +12,7 @@ module MangoModel
12
12
 
13
13
  # Force activation of the Secure Mode for a transaction
14
14
  FORCE = value 'FORCE'
15
+
16
+ NO_CHOICE = value 'NO_CHOICE'
15
17
  end
16
18
  end
@@ -0,0 +1,12 @@
1
+ require_relative '../common/jsonifier'
2
+
3
+ module MangoModel
4
+
5
+ class ScopeBlocked
6
+ include MangoPay::Jsonifier
7
+
8
+ attr_accessor :inflows
9
+
10
+ attr_accessor :outflows
11
+ end
12
+ end
@@ -0,0 +1,19 @@
1
+ require_relative '../common/jsonifier'
2
+
3
+ module MangoModel
4
+
5
+ # Shipping information
6
+ class Shipping
7
+ include MangoPay::Jsonifier
8
+
9
+ # [String] FirstName
10
+ attr_accessor :first_name
11
+
12
+ # [String] FirstName
13
+ attr_accessor :last_name
14
+
15
+ # [Address] The shipping address
16
+ attr_accessor :address
17
+
18
+ end
19
+ end
@@ -111,6 +111,8 @@ def build_card_direct_pay_in
111
111
  billing = MangoModel::Billing.new
112
112
  billing.address = build_address
113
113
  billing.address.postal_code = '68400'
114
+ billing.first_name = 'John'
115
+ billing.last_name = 'Doe'
114
116
  pay_in.billing = billing
115
117
  pay_in.culture = MangoModel::CultureCode::FR
116
118
  pay_in
@@ -27,6 +27,7 @@ def build_pay_out
27
27
  pay_out.bank_account_id = IBAN_ACCOUNT_PERSISTED.id
28
28
  pay_out.debited_wallet_id = WALLET_PERSISTED.id
29
29
  pay_out.bank_wire_ref = 'Invoice 7282'
30
+ pay_out.payout_mode_requested = 'STANDARD'
30
31
  pay_out
31
32
  end
32
33
 
@@ -28,7 +28,10 @@ def build_pre_authorization
28
28
  billing = MangoModel::Billing.new
29
29
  billing.address = build_address
30
30
  billing.address.postal_code = '68400'
31
+ billing.first_name = 'John'
32
+ billing.last_name = 'Doe'
31
33
  pre_auth.billing = billing
34
+ pre_auth.requested_3ds_version = 'V1'
32
35
  pre_auth
33
36
  end
34
37
 
@@ -1,5 +1,7 @@
1
1
  require_relative '../context/client_context'
2
2
  require_relative '../../lib/mangopay/api/service/clients'
3
+ require_relative '../../lib/mangopay/api/service/client_wallets'
4
+ require_relative '../../lib/mangopay/model/entity/client_wallet'
3
5
  require_relative '../../lib/mangopay/util/file_encoder'
4
6
 
5
7
  describe MangoApi::Clients do
@@ -54,4 +56,66 @@ describe MangoApi::Clients do
54
56
  end
55
57
  end
56
58
  end
59
+
60
+ describe '.create_bank_account' do
61
+ it "creates a new bank account" do
62
+ account = MangoModel::IbanBankAccount.new
63
+ account.owner_name = 'John'
64
+
65
+ address = MangoModel::Address.new
66
+ address.address_line1 = 'Le Palais Royal'
67
+ address.address_line2 = 'test'
68
+ address.city = 'Paris'
69
+ address.postal_code = '75001'
70
+ address.country = 'FR'
71
+ account.owner_address = address
72
+
73
+ account.iban = 'FR7618829754160173622224154'
74
+ account.bic = 'CMBRFR2BCME'
75
+ account.tag = 'custom meta'
76
+
77
+ created_account = MangoApi::Clients.create_bank_account(account)
78
+
79
+ expect(created_account).not_to be_nil
80
+ expect(created_account.id).not_to be_nil
81
+ end
82
+ end
83
+
84
+ describe '.create_payout' do
85
+ it "creates a new payout" do
86
+ account = MangoModel::IbanBankAccount.new
87
+ payout = MangoModel::PayOut.new
88
+ account.owner_name = 'John'
89
+
90
+ address = MangoModel::Address.new
91
+ address.address_line1 = 'Le Palais Royal'
92
+ address.address_line2 = 'test'
93
+ address.city = 'Paris'
94
+ address.postal_code = '75001'
95
+ address.country = 'FR'
96
+ account.owner_address = address
97
+
98
+ account.iban = 'FR7618829754160173622224154'
99
+ account.bic = 'CMBRFR2BCME'
100
+ account.tag = 'custom meta'
101
+
102
+ debited_funds = MangoModel::Money.new
103
+ debited_funds.currency = 'EUR'
104
+ debited_funds.amount = 12
105
+
106
+ created_account = MangoApi::Clients.create_bank_account(account)
107
+ wallets = MangoApi::ClientWallets.all
108
+
109
+ payout.debited_funds = debited_funds
110
+ payout.bank_account_id = created_account.id
111
+ payout.debited_wallet_id = wallets[0].id
112
+ payout.bank_wire_ref = 'invoice 7282'
113
+ payout.tag = 'bla'
114
+
115
+ created_payout = MangoApi::Clients.create_payout(payout)
116
+
117
+ expect(created_payout).not_to be_nil
118
+ expect(created_payout.id).not_to be_nil
119
+ end
120
+ end
57
121
  end
@@ -143,4 +143,23 @@ describe MangoApi::Users do
143
143
  end
144
144
  end
145
145
  end
146
+
147
+ =begin
148
+ describe '..get_block_status' do
149
+
150
+ describe '#BlockStatus' do
151
+ context "given an existing user's ID" do
152
+ created = NATURAL_USER_PERSISTED
153
+ id = created.id
154
+
155
+ it 'retrieves the block status' do
156
+ retrieved = MangoApi::Users.get_block_status id
157
+
158
+ expect(retrieved).not_to be_nil
159
+ expect(retrieved).to be_kind_of MangoModel::UserBlockStatus
160
+ end
161
+ end
162
+ end
163
+ end
164
+ =end
146
165
  end
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.2
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - MangoTeam
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-28 00:00:00.000000000 Z
11
+ date: 2021-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -116,6 +116,7 @@ files:
116
116
  - lib/mangopay/model/address.rb
117
117
  - lib/mangopay/model/billing.rb
118
118
  - lib/mangopay/model/birthplace.rb
119
+ - lib/mangopay/model/broswer_info.rb
119
120
  - lib/mangopay/model/declared_ubo.rb
120
121
  - lib/mangopay/model/dispute_reason.rb
121
122
  - lib/mangopay/model/document_page_consult.rb
@@ -162,6 +163,7 @@ files:
162
163
  - lib/mangopay/model/entity/user/legal_user.rb
163
164
  - lib/mangopay/model/entity/user/natural_user.rb
164
165
  - lib/mangopay/model/entity/user/user.rb
166
+ - lib/mangopay/model/entity/user_block_status.rb
165
167
  - lib/mangopay/model/entity/wallet.rb
166
168
  - lib/mangopay/model/enum/account_type.rb
167
169
  - lib/mangopay/model/enum/avs_result.rb
@@ -233,7 +235,9 @@ files:
233
235
  - lib/mangopay/model/request/submit_ubo_declaration_request.rb
234
236
  - lib/mangopay/model/request/upload_file_request.rb
235
237
  - lib/mangopay/model/response_replica.rb
238
+ - lib/mangopay/model/scope_blocked.rb
236
239
  - lib/mangopay/model/security_info.rb
240
+ - lib/mangopay/model/shipping.rb
237
241
  - lib/mangopay/util/custom_formatter.rb
238
242
  - lib/mangopay/util/custom_logger.rb
239
243
  - lib/mangopay/util/enum.rb