mangopay 3.6.0 → 3.9.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: bdb36f26dc6032401dfe30606b77d8368da58389fdae346d1a787971d0963357
4
- data.tar.gz: 4d6ad1805512bfd56f6289bb2e482653b1b3167006d7d99d95cf7bb030724eb0
3
+ metadata.gz: fc045823d669fd8b24b86394f37b4da942dfdcd2ffec8c766c969bef6c8109d2
4
+ data.tar.gz: e699732cf7cbeb8e9e54e918298913908ac0a88b2103d09b6e5086b1b8464907
5
5
  SHA512:
6
- metadata.gz: 1344508c23d8b559c672ff2ff6e3e8739d53b7e9d6690f3a5cfdde733b0af8803e4a4adadeb3fe300e373ab0fc2d638707c4d68a48dfb355301db074cea1732e
7
- data.tar.gz: 4dab1cab255b3eb58def8ac300c64551541f7ba3f96b3eda1e7bf690439e7ffe6f46167fd7ae80b715bcdc9d4f04bcb969c8c1a290c0f97ed66c3da8dd3cb8b9
6
+ metadata.gz: c97ac50d3dd3adb9848871d84e385dc22940a431ef85a942c37380ea8403737375ab9054e88f2bce8632ff00237ce4063288ee224db96d89e3edbe4657631414
7
+ data.tar.gz: 2eae8cc1edb4423c31461acaf7f0d8cd5ab9226e84209d3be12236cc2d1cd0ded88fd1c18166f8810628b684915c966de7b68d7208b93f4a55f65819bc6199e0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,45 @@
1
+ ## [3.9.0] - 2022.03.31
2
+ ### Added
3
+
4
+ #### Instant payment eligibility check
5
+
6
+ With the function
7
+ `PayOut::InstantPayoutEligibility::Reachability.create(params)`
8
+ 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.
9
+
10
+ ## [3.8.0] - 2021.10.20
11
+ ## Added
12
+
13
+ You can now change the status to "ENDED" for a recurring payment.
14
+
15
+ ## Fixed
16
+
17
+ - "Status" is now available in the response when you request a recurring payment registration.
18
+
19
+
20
+ ## [3.7.0] - 2021.10.11
21
+ ## Added
22
+
23
+ ### Payconiq
24
+
25
+ As requested by numerous clients, we are now providing [Payconiq](https://www.payconiq.be) as a new mean-of-payment. To request access, please contact MANGOPAY.
26
+
27
+ ### Flags for KYC documents
28
+
29
+ **We provide more information regarding refused KYC documents.** Therefore it will be easier for you to adapt your app behavior and help your end user.
30
+
31
+ You are now able to see the exact explanation thanks to a new parameter called “Flags”.
32
+
33
+ It has been added to
34
+
35
+ `$this->_api->KycDocuments->Get($kycDocument->Id);`
36
+
37
+ It will display one or several error codes that provide the reason(s) why your document validation has failed. These error codes description are available [here](https://docs.mangopay.com/guide/kyc-document).
38
+
39
+ ## Fixed
40
+
41
+ Idempotency key is not required anymore for UBO declarations
42
+
1
43
  ## [3.6.0] - 2021.08.10
2
44
  ## Added
3
45
 
@@ -106,6 +106,17 @@ module MangoPay
106
106
 
107
107
  end
108
108
 
109
+ module Payconiq
110
+
111
+ class Web < Resource
112
+ include HTTPCalls::Create
113
+ def self.url(*)
114
+ "#{MangoPay.api_path}/payins/payconiq/#{CGI.escape(class_name.downcase)}"
115
+ end
116
+ end
117
+
118
+ end
119
+
109
120
  module ApplePay
110
121
  class Direct < Resource
111
122
  include HTTPCalls::Create
@@ -129,6 +140,8 @@ module MangoPay
129
140
  module RecurringPayments
130
141
  class Recurring < Resource
131
142
  include HTTPCalls::Create
143
+ include HTTPCalls::Fetch
144
+ include HTTPCalls::Update
132
145
 
133
146
  def self.url(*args)
134
147
  if args.any?
@@ -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
@@ -10,17 +10,17 @@ module MangoPay
10
10
  end
11
11
  end
12
12
 
13
- def create(user_id, idempotency_key)
13
+ def create(user_id, idempotency_key = nil)
14
14
  MangoPay.request(:post, url(user_id), {}, {}, idempotency_key)
15
15
  end
16
16
 
17
17
  # Fetches the Ubo declaration belonging to the given +user_id+ if given, with the given +id+.
18
- def fetch(user_id, id, idempotency_key)
18
+ def fetch(user_id, id, idempotency_key = nil)
19
19
  url = (user_id) ? url(user_id, id) : "#{MangoPay.api_path}/kyc/ubodeclarations/#{CGI.escape(id.to_s)}"
20
20
  MangoPay.request(:get, url, {}, {}, idempotency_key)
21
21
  end
22
22
 
23
- def update(user_id, id, params = {}, idempotency_key)
23
+ def update(user_id, id, params = {}, idempotency_key = nil)
24
24
  request_params = {
25
25
  Status: params['Status'],
26
26
  Ubos: params['Ubos']
@@ -1,3 +1,3 @@
1
1
  module MangoPay
2
- VERSION = '3.6.0'
2
+ VERSION = '3.9.0'
3
3
  end
@@ -8,6 +8,7 @@ describe MangoPay::KycDocument do
8
8
  expect(new_document['Status']).to eq('CREATED')
9
9
  expect(new_document['RefusedReasonType']).to be_nil
10
10
  expect(new_document['RefusedReasonMessage']).to be_nil
11
+ expect(new_document['Flags']).to match_array([])
11
12
  end
12
13
  end
13
14
 
@@ -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)
@@ -0,0 +1,25 @@
1
+ describe MangoPay::PayIn::Payconiq::Web, type: :feature do
2
+ include_context 'payins'
3
+
4
+ def check_type_and_status(payin)
5
+ expect(payin['Type']).to eq('PAYIN')
6
+ expect(payin['Nature']).to eq('REGULAR')
7
+ expect(payin['PaymentType']).to eq('PAYCONIQ')
8
+ expect(payin['ExecutionType']).to eq('WEB')
9
+
10
+ # not SUCCEEDED yet: waiting for processing
11
+ expect(payin['Status']).to eq('CREATED')
12
+ expect(payin['ResultCode']).to be_nil
13
+ expect(payin['ResultMessage']).to be_nil
14
+ expect(payin['ExecutionDate']).to be_nil
15
+ end
16
+
17
+ describe 'CREATE' do
18
+ it 'creates a payconiq web payin' do
19
+ created = new_payin_payconiq_web
20
+ expect(created['Id']).not_to be_nil
21
+ check_type_and_status(created)
22
+ end
23
+ end
24
+
25
+ end
@@ -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
@@ -40,6 +40,12 @@ describe MangoPay::PayIn::RecurringPayments, type: :feature do
40
40
  }
41
41
  )
42
42
  expect(recurring).not_to be_nil
43
+ expect(recurring['Status']).not_to be_nil
44
+ expect(recurring['Id']).not_to be_nil
45
+ id = recurring['Id']
46
+
47
+ get = MangoPay::PayIn::RecurringPayments::Recurring.fetch(id)
48
+ expect(get).not_to be_nil
43
49
 
44
50
  cit = MangoPay::PayIn::RecurringPayments::CIT.create(
45
51
  RecurringPayinRegistrationId: recurring['Id'],
@@ -61,6 +67,12 @@ describe MangoPay::PayIn::RecurringPayments, type: :feature do
61
67
  )
62
68
 
63
69
  expect(cit).not_to be_nil
70
+
71
+ update = MangoPay::PayIn::RecurringPayments::Recurring.update(id, {
72
+ Status: 'Ended'
73
+ })
74
+
75
+ expect(update).not_to be_nil
64
76
  end
65
77
  end
66
78
  end
@@ -215,6 +215,22 @@ shared_context 'payins' do
215
215
  )
216
216
  end
217
217
 
218
+ ###############################################
219
+ # payconiq/web
220
+ ###############################################
221
+
222
+ let(:new_payin_payconiq_web) do
223
+ MangoPay::PayIn::Payconiq::Web.create(
224
+ AuthorId: new_natural_user['Id'],
225
+ CreditedWalletId: new_wallet['Id'],
226
+ DebitedFunds: {Currency: 'EUR', Amount: 100},
227
+ Fees: {Currency: 'EUR', Amount: 0},
228
+ ReturnURL: MangoPay.configuration.root_url,
229
+ Country: "BE",
230
+ Tag: 'Custom Meta'
231
+ )
232
+ end
233
+
218
234
  ###############################################
219
235
  # applepay/direct
220
236
  ###############################################
@@ -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'], nil)
9
+ ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'])
10
10
 
11
- ubo_declaration_byId = MangoPay::UboDeclaration.fetch(legal_user['Id'], ubo_declaration['Id'], nil)
11
+ ubo_declaration_byId = MangoPay::UboDeclaration.fetch(legal_user['Id'], ubo_declaration['Id'])
12
12
 
13
13
  expect(ubo_declaration).not_to be_nil
14
14
  expect(ubo_declaration_byId).not_to be_nil
@@ -28,13 +28,13 @@ describe MangoPay::UboDeclaration do
28
28
  describe 'UPDATE' do
29
29
  it 'can update a UBO declaration' do
30
30
  legal_user = new_legal_user
31
- ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'], nil)
31
+ ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'])
32
32
  ubo_declaration['Status'] = 'VALIDATION_ASKED'
33
33
 
34
34
  ubo = new_ubo(legal_user, ubo_declaration)
35
35
 
36
36
  ubo_declaration['Ubos'] = [ubo]
37
- ubo_declaration = MangoPay::UboDeclaration.update(legal_user['Id'], ubo_declaration['Id'], ubo_declaration, nil)
37
+ ubo_declaration = MangoPay::UboDeclaration.update(legal_user['Id'], ubo_declaration['Id'], ubo_declaration)
38
38
 
39
39
  expect(ubo_declaration).not_to be_nil
40
40
  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'], nil)
8
+ ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'])
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'], nil)
19
+ ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'])
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'], nil)
28
+ ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'])
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.6.0
4
+ version: 3.9.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-08-10 00:00:00.000000000 Z
12
+ date: 2022-03-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -131,6 +131,7 @@ files:
131
131
  - spec/mangopay/payin_card_web_spec.rb
132
132
  - spec/mangopay/payin_directdebit_direct_spec.rb
133
133
  - spec/mangopay/payin_directdebit_web_spec.rb
134
+ - spec/mangopay/payin_payconiq_web_spec.rb
134
135
  - spec/mangopay/payin_paypal_web_spec.rb
135
136
  - spec/mangopay/payin_preauthorized_direct_spec.rb
136
137
  - spec/mangopay/payout_bankwire_spec.rb
@@ -196,6 +197,7 @@ test_files:
196
197
  - spec/mangopay/payin_card_web_spec.rb
197
198
  - spec/mangopay/payin_directdebit_direct_spec.rb
198
199
  - spec/mangopay/payin_directdebit_web_spec.rb
200
+ - spec/mangopay/payin_payconiq_web_spec.rb
199
201
  - spec/mangopay/payin_paypal_web_spec.rb
200
202
  - spec/mangopay/payin_preauthorized_direct_spec.rb
201
203
  - spec/mangopay/payout_bankwire_spec.rb