mangopay 3.8.0 → 3.11.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: 16def874b468b39fb00308d965802ef6a6fdb42ba9cb7d18a3a422a687d1d1fa
4
- data.tar.gz: 18f0e0c679919c7e5849ac5052fb2490bc619142901c11fee81ccc4e3dd46e33
3
+ metadata.gz: f1fdfc923ff995412c8aaf53d8bb4684f35dbae82937532bb5c5682e54888462
4
+ data.tar.gz: 2c7930a03a8e10a5ed13e35bb9bd3834fa1a738ca45232546b81935b5ec29dcb
5
5
  SHA512:
6
- metadata.gz: b0678869fba9e64e0cbf5ed3c4ca2d9fb579aa99b99ade388e2e314d32ee277c53d49f784f225e098a1dda540ace70f08dbd0da2fe4a08e62d8d639db4a912c6
7
- data.tar.gz: aac5ed97bc8e8e7aef927489c221a9428c54683e037c4059083f64b2003757761f511a74d84776c0a54e492754843d79eec2332a8c712768f3ec6e1863d5103d
6
+ metadata.gz: 76ec1a6e0bbeca5e530f1e994501eed2471a4e2af1f6761e538ce9639873172b8a4a0d6278ecd45e146ae7e2b0a459828cb4a2958374e36b369fa756422bf210
7
+ data.tar.gz: bfac13d78271a3dc3466f4f8bba3f3287baef8786528b7794a5af204f5bf7e6d4154a960f3b1dac41ebe4f60a735b4398d91ecdd1f67f22d0cb72b2d97de14f0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,45 @@
1
+ ## [3.11.0] - 2022-09-08
2
+ ##Added
3
+ **New country authorizations endpoints**
4
+
5
+ Country authorizations can now be viewed by using one of the following endpoints:
6
+
7
+ <a href="https://docs.mangopay.com/endpoints/v2.01/regulatory#e1061_the-country-authorizations-object">View a country's authorizations</a> <br>
8
+ <a href="https://docs.mangopay.com/endpoints/v2.01/regulatory#e1061_the-country-authorizations-object">View all countries' authorizations</a>
9
+
10
+ With these calls, it is possible to check which countries have:
11
+
12
+ - Blocked user creation
13
+ - Blocked bank account creation
14
+ - Blocked payout creation
15
+
16
+ Please refer to the <a href="https://docs.mangopay.com/guide/restrictions-by-country">Restrictions by country</a>
17
+ article for more information.
18
+
19
+ ## [3.10.0] - 2022-06-29
20
+ ##Added
21
+ **Recurring: €0 deadlines for CIT**
22
+
23
+ Setting free recurring payment deadlines is now possible for CIT (customer-initiated transactions) with the **FreeCycles** parameter.
24
+
25
+ The **FreeCycles** parameter allows platforms to define the number of consecutive deadlines that will be free. The following endpoints have been updated to take into account this new parameter:
26
+
27
+ <a href="https://docs.mangopay.com/endpoints/v2.01/payins#e1051_create-a-recurring-payin-registration">Create a Recurring PayIn Registration</a><br>
28
+ <a href="https://docs.mangopay.com/endpoints/v2.01/payins#e1056_view-a-recurring-payin-registration">View a Recurring PayIn Registration</a><br>
29
+
30
+ This feature provides new automation capabilities for platforms with offers such as “Get the first month free” or “free trial” subscriptions.
31
+
32
+ Please refer to the <a href="https://docs.mangopay.com/guide/recurring-payments-introduction">Recurring payments overview</a> documentation for more information.
33
+
34
+ ## [3.9.0] - 2022.03.31
35
+ ### Added
36
+
37
+ #### Instant payment eligibility check
38
+
39
+ With the function
40
+ `PayOut::InstantPayoutEligibility::Reachability.create(params)`
41
+ the destination bank reachability can now be verified prior to making an instant payout. This results in a better user experience, as this preliminary check will allow the platform to propose the instant payout option only to end users whose bank is eligible.
42
+
1
43
  ## [3.8.0] - 2021.10.20
2
44
  ## Added
3
45
 
@@ -26,5 +26,16 @@ module MangoPay
26
26
  MangoPay.request(:get, url);
27
27
  end
28
28
  end
29
+
30
+ # See https://docs.mangopay.com/endpoints/v2.01/payouts#e1058_check-instant-payout-eligibility
31
+ module InstantPayoutEligibility
32
+ class Reachability < Resource
33
+ include HTTPCalls::Create
34
+
35
+ def self.url(*)
36
+ "#{MangoPay.api_path}/payouts/reachability"
37
+ end
38
+ end
39
+ end
29
40
  end
30
41
  end
@@ -0,0 +1,22 @@
1
+ module MangoPay
2
+ # Provides API methods for the UBO entity.
3
+ class Regulatory < Resource
4
+ class << self
5
+ def one_country_url(country_iso)
6
+ "#{MangoPay.api_path_no_client}/countries/#{country_iso}/authorizations"
7
+ end
8
+
9
+ def all_countries_url
10
+ "#{MangoPay.api_path_no_client}/countries/authorizations"
11
+ end
12
+
13
+ def get_country_authorizations(country_iso)
14
+ MangoPay.request(:get, one_country_url(country_iso))
15
+ end
16
+
17
+ def get_all_countries_authorizations
18
+ MangoPay.request(:get, all_countries_url)
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,3 +1,3 @@
1
1
  module MangoPay
2
- VERSION = '3.8.0'
2
+ VERSION = '3.11.0'
3
3
  end
data/lib/mangopay.rb CHANGED
@@ -42,6 +42,7 @@ module MangoPay
42
42
  autoload :BankingAliasesIBAN, 'mangopay/bankingaliases_iban'
43
43
  autoload :UboDeclaration, 'mangopay/ubo_declaration'
44
44
  autoload :Ubo, 'mangopay/ubo'
45
+ autoload :Regulatory, 'mangopay/regulatory'
45
46
 
46
47
  # temporary
47
48
  autoload :Temp, 'mangopay/temp'
@@ -74,6 +75,10 @@ module MangoPay
74
75
  "/#{version_code}/#{MangoPay.configuration.client_id}"
75
76
  end
76
77
 
78
+ def api_path_no_client
79
+ "/#{version_code}"
80
+ end
81
+
77
82
  def api_uri(url='')
78
83
  URI(configuration.root_url + url)
79
84
  end
@@ -126,18 +126,18 @@ describe MangoPay::Client do
126
126
  end
127
127
  end
128
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
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
141
 
142
142
  describe 'create_bank_account' do
143
143
  it 'creates a new bank account' do
@@ -11,7 +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
+ pending("no cards to test for")
15
15
  created = new_payin_applepay_direct
16
16
  expect(created['Id']).not_to be_nil
17
17
  check_type_and_status(created)
@@ -49,6 +49,26 @@ describe MangoPay::PayOut::BankWire, type: :feature do
49
49
  end
50
50
  end
51
51
 
52
+ describe 'Check Eligibility' do
53
+ it 'checks the eligibility of a payout' do
54
+ created = new_payout_bankwire
55
+
56
+ eligibility = MangoPay::PayOut::InstantPayoutEligibility::Reachability.create(
57
+ AuthorId: created['AuthorId'],
58
+ DebitedFunds: {
59
+ Amount: 10,
60
+ Currency: 'EUR'
61
+ },
62
+ PayoutModeRequested: 'INSTANT_PAYMENT',
63
+ BankAccountId: created['BankAccountId'],
64
+ DebitedWalletId: created['DebitedWalletId']
65
+ )
66
+
67
+ expect(created).not_to be_nil
68
+ expect(eligibility).not_to be_nil
69
+ end
70
+ end
71
+
52
72
  describe 'FETCH' do
53
73
  it 'fetches a payout' do
54
74
  created = new_payout_bankwire
@@ -37,15 +37,19 @@ describe MangoPay::PayIn::RecurringPayments, type: :feature do
37
37
  },
38
38
  FirstName: 'Joe',
39
39
  LastName: 'Blogs'
40
- }
40
+ },
41
+ FreeCycles: 0
41
42
  )
42
43
  expect(recurring).not_to be_nil
43
44
  expect(recurring['Status']).not_to be_nil
44
45
  expect(recurring['Id']).not_to be_nil
46
+ expect(recurring['FreeCycles']).not_to be_nil
47
+
45
48
  id = recurring['Id']
46
49
 
47
50
  get = MangoPay::PayIn::RecurringPayments::Recurring.fetch(id)
48
51
  expect(get).not_to be_nil
52
+ expect(get['FreeCycles']).not_to be_nil
49
53
 
50
54
  cit = MangoPay::PayIn::RecurringPayments::CIT.create(
51
55
  RecurringPayinRegistrationId: recurring['Id'],
@@ -0,0 +1,26 @@
1
+ describe MangoPay::Regulatory do
2
+
3
+ describe 'GET Country Authorizations' do
4
+ it 'can get country authorizations' do
5
+ country_authorizations = MangoPay::Regulatory.get_country_authorizations('FR')
6
+
7
+ expect(country_authorizations).not_to be_nil
8
+ expect(country_authorizations['CountryCode']).not_to be_nil
9
+ expect(country_authorizations['CountryName']).not_to be_nil
10
+ expect(country_authorizations['Authorization']).not_to be_nil
11
+ expect(country_authorizations['LastUpdate']).not_to be_nil
12
+ end
13
+ end
14
+
15
+ describe 'GET All Countries Authorizations' do
16
+ it 'can get all countries authorizations' do
17
+ country_authorizations = MangoPay::Regulatory.get_all_countries_authorizations
18
+
19
+ expect(country_authorizations).not_to be_nil
20
+ expect(country_authorizations[0]['CountryCode']).not_to be_nil
21
+ expect(country_authorizations[0]['CountryName']).not_to be_nil
22
+ expect(country_authorizations[0]['Authorization']).not_to be_nil
23
+ expect(country_authorizations[0]['LastUpdate']).not_to be_nil
24
+ end
25
+ end
26
+ end
@@ -33,6 +33,20 @@ describe MangoPay::User do
33
33
  })
34
34
  expect(updated_user['LegalRepresentativeFirstName']).to eq('Jack')
35
35
  end
36
+
37
+ it 'updates a natural user terms and conditions accepted' do
38
+ updated_user = MangoPay::NaturalUser.update(new_natural_user['Id'] ,{
39
+ TermsAndConditionsAccepted: true
40
+ })
41
+ expect(updated_user['TermsAndConditionsAccepted']).to eq(true)
42
+ end
43
+
44
+ it 'updates a legal user terms and conditions accepted' do
45
+ updated_user = MangoPay::LegalUser.update(new_legal_user['Id'], {
46
+ TermsAndConditionsAccepted: true
47
+ })
48
+ expect(updated_user['TermsAndConditionsAccepted']).to eq(true)
49
+ end
36
50
  end
37
51
 
38
52
  describe 'FETCH' do
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.8.0
4
+ version: 3.11.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-10-20 00:00:00.000000000 Z
12
+ date: 2022-09-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -97,6 +97,7 @@ files:
97
97
  - lib/mangopay/pay_out.rb
98
98
  - lib/mangopay/pre_authorization.rb
99
99
  - lib/mangopay/refund.rb
100
+ - lib/mangopay/regulatory.rb
100
101
  - lib/mangopay/report.rb
101
102
  - lib/mangopay/resource.rb
102
103
  - lib/mangopay/transaction.rb
@@ -138,6 +139,7 @@ files:
138
139
  - spec/mangopay/preauthorization_spec.rb
139
140
  - spec/mangopay/recurring_payin_spec.rb
140
141
  - spec/mangopay/refund_spec.rb
142
+ - spec/mangopay/regulatory_spec.rb
141
143
  - spec/mangopay/report_spec.rb
142
144
  - spec/mangopay/report_wallets_spec.rb
143
145
  - spec/mangopay/shared_resources.rb
@@ -204,6 +206,7 @@ test_files:
204
206
  - spec/mangopay/preauthorization_spec.rb
205
207
  - spec/mangopay/recurring_payin_spec.rb
206
208
  - spec/mangopay/refund_spec.rb
209
+ - spec/mangopay/regulatory_spec.rb
207
210
  - spec/mangopay/report_spec.rb
208
211
  - spec/mangopay/report_wallets_spec.rb
209
212
  - spec/mangopay/shared_resources.rb