mangopay 3.25.1 → 3.32.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: 4de0eaa7025d0d6788238c4f8a23d21b1c2d1eff469da6d24fe671f3e10e15cf
4
- data.tar.gz: fd221c8c6c05355a6c4d0f58bb04ffa0df81d5a17fd30865e25beab644e47eac
3
+ metadata.gz: c8e3054c801c2db4879dc5ee322b442204351fd2c96458345b865c7f30a8accf
4
+ data.tar.gz: e59f212b984b311a3999c1f768532798c072d60f40d692d1a90ae755a81a01d7
5
5
  SHA512:
6
- metadata.gz: 4349f6ed08748ddc4a88b893ac22b7e4c0d32b6cf2ae2dcfcf4616cf8a14508d450793218c1769e4ba5b53638a62b88d985fce3f9cec80a3dd34beccb8e20c2e
7
- data.tar.gz: c5b2cc5ceda45a3b87002e2c279799763e8815621834537aa3aa346dac765578e43366aed356ab45ec0f18d4404bc6c6bdc398fb5181dc3822290d9ec1e1c178
6
+ metadata.gz: 74ce73c93504fbecef0a12d7ff98bd5f192700b90cf0e555063af16fabf88ffbdf6cb88e973e705f642e870c239bf306c624d97f8c8cc021008e88638cd9d6a1
7
+ data.tar.gz: d48f4c254375d55ddd36e911fb7f84cd18f8eeb96ed28081501ed745249abacad3fd6a35ede4e6be972196c0611675e259fea41cdb8e0cee0687cd5d296e0a86
data/CHANGELOG.md CHANGED
@@ -1,3 +1,101 @@
1
+ ## [3.32.0] - 2025-04-16
2
+ ### Added
3
+
4
+ #### Recipients
5
+ - [GET View payout methods](/api-reference/recipients/view-payout-methods)
6
+ - [GET View the schema for a Recipient](/api-reference/recipients/view-recipient-schema)
7
+ - [POST Validate data for a Recipient](/api-reference/recipients/validate-recipient-data)
8
+ - [POST Create a Recipient](/api-reference/recipients/create-recipient)
9
+ - [GET View a Recipient](/api-reference/recipients/view-recipient)
10
+ - [GET List Recipients for a user](/api-reference/recipients/list-recipients-user)
11
+ - [PUT Deactivate a Recipient](/api-reference/recipients/deactivate-recipient)
12
+
13
+ #### Endpoints to close a user account
14
+ - [DELETE Close a Natural User](/api-reference/users/close-natural-user)
15
+ - [DELETE Close a Legal User](/api-reference/users/close-legal-user)
16
+
17
+ ## [3.31.0] - 2025-04-16
18
+ ### Added
19
+ - [POST Create a Pay by Bank PayIn](https://docs.mangopay.com/api-reference/pay-by-bank/create-pay-by-bank-payin)
20
+ - PayPal recurring payments, thanks to the `PaymentType` value `PAYPAL` on [Recurring PayIn Registrations](https://docs.mangopay.com/api-reference/recurring-payin-registrations/create-recurring-payin-registration-paypal) and new endpoints ([POST Create a Recurring PayPal PayIn (CIT)](https://docs.mangopay.com/api-reference/paypal/create-recurring-paypal-payin-cit) and [POST Create a Recurring PayPal PayIn (MIT)](https://docs.mangopay.com/api-reference/paypal/create-recurring-paypal-payin-mit)
21
+
22
+ ## [3.30.2] - 2025-04-02
23
+ ### Fixed
24
+ - Fixed the way User-Agent Header is built
25
+
26
+ ## [3.30.1] - 2025-04-02
27
+ ### Changed
28
+ - User-Agent Header value standardized on format: User-Agent: Mangopay-SDK/`SDKVersion` (`Language`/`LanguageVersion`)
29
+
30
+ ## [3.30.0] - 2025-03-24
31
+ ### Added
32
+
33
+ New endpoints for [strong customer authentication (SCA)](https://docs.mangopay.com/guides/users/sca) on Owner users:
34
+ - [POST Create a Natural User (SCA)](https://docs.mangopay.com/api-reference/users/create-natural-user-sca)
35
+ - [PUT Update a Natural User (SCA)](https://docs.mangopay.com/api-reference/users/update-natural-user-sca)
36
+ - [POST Create a Legal User (SCA)](https://docs.mangopay.com/api-reference/users/create-legal-user-sca)
37
+ - [PUT Update a Legal User (SCA)](https://docs.mangopay.com/api-reference/users/update-legal-user-sca)
38
+ - [PUT Categorize a Natural User (SCA)](https://docs.mangopay.com/api-reference/users/categorize-natural-user)
39
+ - [PUT Categorize a Legal User (SCA)](https://docs.mangopay.com/api-reference/users/categorize-legal-user)
40
+ - [POST Enroll a User in SCA](https://docs.mangopay.com/api-reference/users/enroll-user)
41
+
42
+ ## [3.29.0] - 2025-02-26
43
+ ### Added
44
+
45
+ Endpoints and webhooks for [hosted KYC/B solution](https://docs.mangopay.com/guides/users/verification/hosted) (in beta)
46
+
47
+ - Endpoints
48
+ - [Create an IDV Session](https://docs.mangopay.com/api-reference/idv-sessions/create-idv-session)
49
+ - [View an IDV Session](https://docs.mangopay.com/api-reference/idv-sessions/view-idv-session)
50
+ - [View Checks for an IDV Session](https://mangopay-idv.mintlify.app/api-reference/idv-sessions/view-idv-session-checks)
51
+
52
+ - Event types
53
+ - `IDENTITY_VERIFICATION_VALIDATED`
54
+ - `IDENTITY_VERIFICATION_FAILED`
55
+ - `IDENTITY_VERIFICATION_INCONCLUSIVE`
56
+ - `IDENTITY_VERIFICATION_OUTDATED`
57
+
58
+ ## [3.28.2] - 2025-02-13
59
+ ### Updated
60
+
61
+ #259 Added idempotency key to create conversion methods. Thank you for your contribution [@kaderate](https://github.com/kaderate)!
62
+
63
+ ## [3.28.1] - 2025-02-04
64
+ ### Updated
65
+
66
+ Revised tests to improve reliability and address any outdated tests.
67
+
68
+ ## [3.28.0] - 2024-11-15
69
+ ### Added
70
+
71
+ New endpoint for [The TWINT PayIn object](https://docs.mangopay.com/api-reference/twint/twint-payin-object#the-twint-payin-object):
72
+ - [Create a TWINT PayIn](https://docs.mangopay.com/api-reference/twint/create-twint-payin)
73
+ - [View a PayIn (TWINT)](https://docs.mangopay.com/api-reference/twint/view-payin-twint)
74
+
75
+ New endpoint for [The Swish PayIn object](https://docs.mangopay.com/api-reference/swish/swish-payin-object):
76
+ - [Create a Swish PayIn](https://docs.mangopay.com/api-reference/swish/create-swish-payin)
77
+ - [View a PayIn (Swish)](https://docs.mangopay.com/api-reference/swish/view-payin-swish)
78
+
79
+ ## [3.27.0] - 2024-10-29
80
+ ### Added
81
+
82
+ New endpoints for The Virtual Account object:
83
+ - [Create a Virtual Account]()
84
+ - [Deactivate a Virtual Account]()
85
+ - [View a Virtual Account]()
86
+ - [List Virtual Accounts for a Wallet]()
87
+ - [View Client Availabilities]()
88
+
89
+ ## [3.26.1] - 2024-10-03
90
+ ### Fixed
91
+
92
+ - Updated `RedirectURL` for the [Payconiq PayIn](https://docs.mangopay.com/api-reference/payconiq/payconiq-payin-object#the-payconiq-payin-object)
93
+
94
+ ## [3.26.0] - 2024-08-07
95
+ ### Added
96
+
97
+ - New endpoint: [Create a Bancontact PayIn](https://mangopay.com/docs/endpoints/bancontact#create-bancontact-payin)
98
+
1
99
  ## [3.25.1] - 2024-04-30
2
100
  ### Fixed
3
101
 
@@ -10,14 +10,14 @@ module MangoPay
10
10
  MangoPay.request(:get, url, params)
11
11
  end
12
12
 
13
- def create_instant_conversion(params)
13
+ def create_instant_conversion(params, idempotency_key = nil)
14
14
  url = "#{MangoPay.api_path}/conversions/instant-conversion"
15
- MangoPay.request(:post, url, params)
15
+ MangoPay.request(:post, url, params, {}, idempotency_key)
16
16
  end
17
17
 
18
- def create_quoted_conversion(params)
18
+ def create_quoted_conversion(params, idempotency_key = nil)
19
19
  url = "#{MangoPay.api_path}/conversions/quoted-conversion"
20
- MangoPay.request(:post, url, params)
20
+ MangoPay.request(:post, url, params, {}, idempotency_key)
21
21
  end
22
22
 
23
23
  def get(id, params)
@@ -25,9 +25,9 @@ module MangoPay
25
25
  MangoPay.request(:get, url, params)
26
26
  end
27
27
 
28
- def create_quote(params)
28
+ def create_quote(params, idempotency_key = nil)
29
29
  url = "#{MangoPay.api_path}/conversions/quote"
30
- MangoPay.request(:post, url, params)
30
+ MangoPay.request(:post, url, params, {}, idempotency_key)
31
31
  end
32
32
 
33
33
  def get_quote(id, params)
@@ -0,0 +1,16 @@
1
+ module MangoPay
2
+
3
+ class IdentityVerification < Resource
4
+ def self.create(params, user_id, idempotency_key = nil)
5
+ MangoPay.request(:post, "#{MangoPay.api_path}/users/#{user_id}/identity-verifications", params, {}, idempotency_key)
6
+ end
7
+
8
+ def self.get(identity_verification_id, filters = {})
9
+ MangoPay.request(:get, "#{MangoPay.api_path}/identity-verifications/#{identity_verification_id}", {}, filters)
10
+ end
11
+
12
+ def self.get_checks(identity_verification_id, filters = {})
13
+ MangoPay.request(:get, "#{MangoPay.api_path}/identity-verifications/#{identity_verification_id}/checks", {}, filters)
14
+ end
15
+ end
16
+ end
@@ -13,6 +13,9 @@ module MangoPay
13
13
  end
14
14
 
15
15
  class << self
16
+ def close(user_id)
17
+ MangoPay.request(:delete, url(user_id))
18
+ end
16
19
  end
17
20
  end
18
21
  end
@@ -0,0 +1,25 @@
1
+ module MangoPay
2
+
3
+ # See https://docs.mangopay.com/api-reference/users/legal-user-object-sca
4
+ class LegalUserSca < User
5
+
6
+ def self.url(id = nil)
7
+ if id
8
+ "#{MangoPay.api_path}/sca/users/legal/#{CGI.escape(id.to_s)}"
9
+ else
10
+ "#{MangoPay.api_path}/sca/users/legal"
11
+ end
12
+ end
13
+
14
+ class << self
15
+ def categorize(user_id, params)
16
+ url = "#{MangoPay.api_path}/sca/users/legal/#{user_id}/category"
17
+ MangoPay.request(:put, url, params)
18
+ end
19
+
20
+ def close(user_id)
21
+ MangoPay.request(:delete, url(user_id))
22
+ end
23
+ end
24
+ end
25
+ end
@@ -10,5 +10,11 @@ module MangoPay
10
10
  "#{MangoPay.api_path}/users/natural"
11
11
  end
12
12
  end
13
+
14
+ class << self
15
+ def close(user_id)
16
+ MangoPay.request(:delete, url(user_id))
17
+ end
18
+ end
13
19
  end
14
20
  end
@@ -0,0 +1,25 @@
1
+ module MangoPay
2
+
3
+ # See https://docs.mangopay.com/api-reference/users/natural-user-object-sca
4
+ class NaturalUserSca < User
5
+
6
+ def self.url(id = nil)
7
+ if id
8
+ "#{MangoPay.api_path}/sca/users/natural/#{CGI.escape(id.to_s)}"
9
+ else
10
+ "#{MangoPay.api_path}/sca/users/natural"
11
+ end
12
+ end
13
+
14
+ class << self
15
+ def categorize(user_id, params)
16
+ url = "#{MangoPay.api_path}/sca/users/natural/#{user_id}/category"
17
+ MangoPay.request(:put, url, params)
18
+ end
19
+
20
+ def close(user_id)
21
+ MangoPay.request(:delete, url(user_id))
22
+ end
23
+ end
24
+ end
25
+ end
@@ -137,7 +137,7 @@ module MangoPay
137
137
  include HTTPCalls::Create
138
138
 
139
139
  def self.url(*)
140
- "#{MangoPay.api_path}/payins/payconiq/#{CGI.escape(class_name.downcase)}"
140
+ "#{MangoPay.api_path}/payins/payment-methods/payconiq"
141
141
  end
142
142
  end
143
143
 
@@ -233,6 +233,46 @@ module MangoPay
233
233
  end
234
234
  end
235
235
 
236
+ module Bancontact
237
+ class Web < Resource
238
+ include HTTPCalls::Create
239
+
240
+ def self.url(*)
241
+ "#{MangoPay.api_path}/payins/payment-methods/bancontact"
242
+ end
243
+ end
244
+ end
245
+
246
+ module Twint
247
+ class Web < Resource
248
+ include HTTPCalls::Create
249
+
250
+ def self.url(*)
251
+ "#{MangoPay.api_path}/payins/payment-methods/twint"
252
+ end
253
+ end
254
+ end
255
+
256
+ module Swish
257
+ class Web < Resource
258
+ include HTTPCalls::Create
259
+
260
+ def self.url(*)
261
+ "#{MangoPay.api_path}/payins/payment-methods/swish"
262
+ end
263
+ end
264
+ end
265
+
266
+ module PayByBank
267
+ class Web < Resource
268
+ include HTTPCalls::Create
269
+
270
+ def self.url(*)
271
+ "#{MangoPay.api_path}/payins/payment-methods/openbanking"
272
+ end
273
+ end
274
+ end
275
+
236
276
  module RecurringPayments
237
277
  class Recurring < Resource
238
278
  include HTTPCalls::Create
@@ -263,6 +303,22 @@ module MangoPay
263
303
  "#{MangoPay.api_path}/payins/recurring/card/direct"
264
304
  end
265
305
  end
306
+
307
+ class PayPalCIT < Resource
308
+ include HTTPCalls::Create
309
+
310
+ def self.url(*)
311
+ "#{MangoPay.api_path}/payins/payment-methods/paypal/recurring"
312
+ end
313
+ end
314
+
315
+ class PayPalMIT < Resource
316
+ include HTTPCalls::Create
317
+
318
+ def self.url(*)
319
+ "#{MangoPay.api_path}/payins/payment-methods/paypal/recurring"
320
+ end
321
+ end
266
322
  end
267
323
 
268
324
  end
@@ -0,0 +1,35 @@
1
+ module MangoPay
2
+
3
+ class Recipient < Resource
4
+ def self.create(params, user_id, idempotency_key = nil)
5
+ MangoPay.request(:post, "#{MangoPay.api_path}/users/#{user_id}/recipients", params, {}, idempotency_key)
6
+ end
7
+
8
+ def self.get(recipient_id, filters = {})
9
+ MangoPay.request(:get, "#{MangoPay.api_path}/recipients/#{recipient_id}", {}, filters)
10
+ end
11
+
12
+ def self.get_user_recipients(user_id, filters = {})
13
+ MangoPay.request(:get, "#{MangoPay.api_path}/users/#{user_id}/recipients", {}, filters)
14
+ end
15
+
16
+ def self.get_schema(payout_method_type, recipient_type, currency, filters = {})
17
+ MangoPay.request(:get, "#{MangoPay.api_path}/recipients/schema?payoutMethodType=#{payout_method_type}&recipientType=#{recipient_type}&currency=#{currency}", {}, filters)
18
+ end
19
+
20
+ def self.get_payout_methods(country, currency, filters = {})
21
+ MangoPay.request(:get, "#{MangoPay.api_path}/recipients/payout-methods?country=#{country}&currency=#{currency}", {}, filters)
22
+ end
23
+
24
+ def self.validate(params, user_id, idempotency_key = nil)
25
+ MangoPay.request(:post, "#{MangoPay.api_path}/users/#{user_id}/recipients/validate", params, {}, idempotency_key)
26
+ end
27
+
28
+ def self.deactivate(recipient_id)
29
+ params = {
30
+ Status: 'DEACTIVATED'
31
+ }
32
+ MangoPay.request(:put, "#{MangoPay.api_path}/recipients/#{recipient_id}", params, {})
33
+ end
34
+ end
35
+ end
data/lib/mangopay/user.rb CHANGED
@@ -4,11 +4,19 @@ module MangoPay
4
4
  # See also children classes:
5
5
  # - MangoPay::NaturalUser
6
6
  # - MangoPay::LegalUser
7
+ # - MangoPay::NaturalUserSca
8
+ # - MangoPay::LegalUserSca
7
9
  class User < Resource
8
10
  include HTTPCalls::Create
9
11
  include HTTPCalls::Update
10
12
  include HTTPCalls::Fetch
11
13
  class << self
14
+ def enroll_sca(user_id)
15
+ url = "#{MangoPay.api_path}/sca/users/#{user_id}/enrollment"
16
+ MangoPay.request(:post, url, {}, {})
17
+ end
18
+
19
+
12
20
  # Fetches list of wallets belonging to the given +user_id+.
13
21
  # Optional +filters+ is a hash accepting following keys:
14
22
  # - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
@@ -74,6 +82,11 @@ module MangoPay
74
82
  def regulatory(user_id, filters = {})
75
83
  MangoPay.request(:get, url(user_id) + '/Regulatory', {}, filters)
76
84
  end
85
+
86
+ def fetch_sca(user_id)
87
+ url = "#{MangoPay.api_path}/sca/users/#{user_id}"
88
+ MangoPay.request(:get, url, {}, {})
89
+ end
77
90
  end
78
91
  end
79
92
  end
@@ -1,3 +1,3 @@
1
1
  module MangoPay
2
- VERSION = '3.25.1'
2
+ VERSION = '3.32.0'
3
3
  end
@@ -0,0 +1,44 @@
1
+ module MangoPay
2
+
3
+ class VirtualAccount < Resource
4
+ class << self
5
+ # Creates a new virtual account
6
+ def create(wallet_id, params, idempotency_key = nil)
7
+ url = "#{MangoPay.api_path}/wallets/#{wallet_id}/virtual-accounts"
8
+ MangoPay.request(:post, url, params, {}, idempotency_key)
9
+ end
10
+
11
+ # Updates:
12
+ # - irreversibly deactivates a virtual account with +virtual_account_id+
13
+ # see https://docs.mangopay.com/api-reference/virtual-accounts/deactivate-virtual-account
14
+ def deactivate(wallet_id, virtual_account_id, idempotency_key = nil)
15
+ url = "#{MangoPay.api_path}/wallets/#{wallet_id}/virtual-accounts/#{virtual_account_id}"
16
+ MangoPay.request(:put, url, {}, {}, idempotency_key)
17
+ end
18
+
19
+ # Fetches:
20
+ # - view a virtual account with +virtual_account_id+
21
+ # see https://docs.mangopay.com/api-reference/virtual-accounts/view-virtual-account
22
+ def fetch(wallet_id, virtual_account_id)
23
+ url = "#{MangoPay.api_path}/wallets/#{wallet_id}/virtual-accounts/#{virtual_account_id}"
24
+ MangoPay.request(:get, url, {})
25
+ end
26
+
27
+ # Fetches:
28
+ # - view virtual accounts for given +wallet_id+
29
+ # see https://docs.mangopay.com/api-reference/virtual-accounts/list-virtual-accounts-wallet
30
+ def fetch_all(wallet_id, filters = {})
31
+ url = "#{MangoPay.api_path}/wallets/#{wallet_id}/virtual-accounts"
32
+ MangoPay.request(:get, url, {}, filters)
33
+ end
34
+
35
+ # Fetches:
36
+ # Allows to check which account countries and currencies are available
37
+ # see https://docs.mangopay.com/api-reference/virtual-accounts/view-virtual-account-availabilities
38
+ def fetch_availabilities(filters = {})
39
+ url = "#{MangoPay.api_path}/virtual-accounts/availability"
40
+ MangoPay.request(:get, url, {}, filters)
41
+ end
42
+ end
43
+ end
44
+ end
data/lib/mangopay.rb CHANGED
@@ -19,6 +19,8 @@ module MangoPay
19
19
  autoload :Client, 'mangopay/client'
20
20
  autoload :User, 'mangopay/user'
21
21
  autoload :NaturalUser, 'mangopay/natural_user'
22
+ autoload :NaturalUserSca, 'mangopay/natural_user_sca'
23
+ autoload :LegalUserSca, 'mangopay/legal_user_sca'
22
24
  autoload :LegalUser, 'mangopay/legal_user'
23
25
  autoload :PayIn, 'mangopay/pay_in'
24
26
  autoload :PayOut, 'mangopay/pay_out'
@@ -47,6 +49,9 @@ module MangoPay
47
49
  autoload :Deposit, 'mangopay/deposit'
48
50
  autoload :Conversion, 'mangopay/conversion'
49
51
  autoload :PaymentMethodMetadata, 'mangopay/payment_method_metadata'
52
+ autoload :VirtualAccount, 'mangopay/virtual_account'
53
+ autoload :IdentityVerification, 'mangopay/identity_verification'
54
+ autoload :Recipient, 'mangopay/recipient'
50
55
 
51
56
  # temporary
52
57
  autoload :Temp, 'mangopay/temp'
@@ -228,7 +233,7 @@ module MangoPay
228
233
  raise MangoPay::ResponseError.new(uri, res.code, details)
229
234
  end
230
235
 
231
- unless res.is_a?(Net::HTTPOK)
236
+ unless res.is_a?(Net::HTTPOK) or res.is_a?(Net::HTTPCreated) or res.is_a?(Net::HTTPNoContent)
232
237
  raise MangoPay::ResponseError.new(uri, res.code, data)
233
238
  end
234
239
 
@@ -276,7 +281,7 @@ module MangoPay
276
281
  def request_headers
277
282
  auth_token = AuthorizationToken::Manager.get_token
278
283
  headers = {
279
- 'User-Agent' => "MangoPay V2 SDK Ruby Bindings #{VERSION}",
284
+ 'User-Agent' => "Mangopay-SDK/#{VERSION} (Ruby/#{RUBY_VERSION})",
280
285
  'Authorization' => "#{auth_token['token_type']} #{auth_token['access_token']}",
281
286
  'Content-Type' => 'application/json'
282
287
  }
@@ -45,13 +45,13 @@ describe MangoPay::Client do
45
45
  bts = File.open(fnm, 'rb') { |f| f.read }
46
46
  b64 = Base64.encode64(bts)
47
47
  ret = MangoPay::Client.upload_logo(b64)
48
- expect(ret).to be_nil
48
+ expect(ret).to_not be_nil
49
49
  end
50
50
 
51
51
  it 'accepts file path' do
52
52
  fnm = __FILE__.sub('.rb', '.png')
53
53
  ret = MangoPay::Client.upload_logo(nil, fnm)
54
- expect(ret).to be_nil
54
+ expect(ret).to_not be_nil
55
55
  end
56
56
 
57
57
  it 'fails when input string is not base64-encoded' do
@@ -104,6 +104,7 @@ describe MangoPay::Client do
104
104
 
105
105
  describe 'fetch_wallets_transactions' do
106
106
  it 'fetches transactions for all client wallets' do
107
+ pending("Endpoint removed")
107
108
  trns = MangoPay::Client.fetch_wallets_transactions
108
109
  expect(trns).to be_kind_of(Array)
109
110
  expect(trns).not_to be_empty
@@ -0,0 +1,52 @@
1
+ describe MangoPay::IdentityVerification do
2
+ include_context 'users'
3
+
4
+ describe 'CREATE' do
5
+ it 'creates a new identity verification' do
6
+ created = create_new_identity_verification
7
+ expect(created).not_to be_nil
8
+ expect(created['HostedUrl']).not_to be_nil
9
+ expect(created['ReturnUrl']).not_to be_nil
10
+ expect(created['Status']).to eq('PENDING')
11
+ end
12
+ end
13
+
14
+ describe 'GET' do
15
+ it 'fetches existing identity verification' do
16
+ created = create_new_identity_verification
17
+ fetched = MangoPay::IdentityVerification.get(created['Id'])
18
+
19
+ expect(fetched).not_to be_nil
20
+ expect(created['HostedUrl']).to eq(fetched['HostedUrl'])
21
+ expect(created['ReturnUrl']).to eq(fetched['ReturnUrl'])
22
+ expect(created['Status']).to eq(fetched['Status'])
23
+ end
24
+ end
25
+
26
+ # endpoint returning 404
27
+ # describe 'GET CHECKS' do
28
+ # it 'fetches checks for an existing identity verification' do
29
+ # created = create_new_identity_verification
30
+ # checks = MangoPay::IdentityVerification.get_checks(created['Id'])
31
+ #
32
+ # expect(checks).not_to be_nil
33
+ # expect(created['Id']).to eq(checks['SessionId'])
34
+ # expect(checks['Status']).not_to be_nil
35
+ # expect(checks['CreationDate']).not_to be_nil
36
+ # expect(checks['LastUpdate']).not_to be_nil
37
+ # expect(checks['Checks']).not_to be_nil
38
+ # end
39
+ # end
40
+
41
+ def create_new_identity_verification
42
+ user = new_natural_user
43
+ return MangoPay::IdentityVerification.create(
44
+ {
45
+ ReturnUrl: 'http://example.com',
46
+ Tag: 'created by the Ruby SDK'
47
+ },
48
+ user['Id']
49
+ )
50
+ end
51
+
52
+ end
@@ -59,12 +59,12 @@ describe MangoPay::KycDocument do
59
59
  expect(docs[0]['Id']).to eq doc3['Id']
60
60
 
61
61
  # fetch all docs ever
62
- docs = MangoPay::KycDocument.fetch_all()
62
+ docs = MangoPay::KycDocument.fetch_all(nil, {'afterdate' => doc1['CreationDate'] - 500, 'beforedate' => doc1['CreationDate'] + 500})
63
63
  expect(docs).to be_kind_of(Array)
64
64
  expect(docs.count).to be >= 3 # at least last 3 docs, but probably many more
65
65
 
66
66
  # fetch last 3 docs (sorting by date descending)
67
- docs = MangoPay::KycDocument.fetch_all(nil, filter = {'page' => 1, 'per_page' => 3, 'sort' => 'CreationDate:desc'})
67
+ docs = MangoPay::KycDocument.fetch_all(nil, filter = {'page' => 1, 'per_page' => 3, 'sort' => 'CreationDate:desc', 'afterdate' => doc1['CreationDate'] - 500, 'beforedate' => doc1['CreationDate'] + 500})
68
68
  expect(docs).to be_kind_of(Array)
69
69
  expect(docs.count).to eq 3
70
70
  # all 3 are at top as lastly created
@@ -86,13 +86,13 @@ describe MangoPay::KycDocument do
86
86
  bts = File.open(fnm, 'rb') { |f| f.read }
87
87
  b64 = Base64.encode64(bts)
88
88
  ret = create_page(b64)
89
- expect(ret).to be_nil
89
+ expect(ret).to_not be_nil
90
90
  end
91
91
 
92
92
  it 'accepts file path' do
93
93
  fnm = __FILE__.sub('.rb', '.png')
94
94
  ret = MangoPay::KycDocument.create_page(new_natural_user['Id'], new_document['Id'], nil, fnm)
95
- expect(ret).to be_nil
95
+ expect(ret).to_not be_nil
96
96
  end
97
97
 
98
98
  it 'fails when input string is not base64-encoded' do
@@ -0,0 +1,30 @@
1
+ describe MangoPay::PayIn::Bancontact::Web, type: :feature do
2
+ include_context 'wallets'
3
+ include_context 'payins'
4
+
5
+ def check_type_and_status(payin)
6
+ expect(payin['Type']).to eq('PAYIN')
7
+ expect(payin['Nature']).to eq('REGULAR')
8
+ expect(payin['PaymentType']).to eq('BCMC')
9
+ expect(payin['ExecutionType']).to eq('WEB')
10
+ expect(payin['Status']).to eq('CREATED')
11
+ end
12
+
13
+ describe 'CREATE' do
14
+ it 'creates a bancontact web payin' do
15
+ created = new_payin_bancontact_web
16
+ expect(created['Id']).not_to be_nil
17
+ check_type_and_status(created)
18
+ end
19
+ end
20
+
21
+ describe 'FETCH' do
22
+ it 'fetches a payin' do
23
+ created = new_payin_bancontact_web
24
+ fetched = MangoPay::PayIn.fetch(created['Id'])
25
+ expect(fetched['Id']).to eq(created['Id'])
26
+ check_type_and_status(created)
27
+ check_type_and_status(fetched)
28
+ end
29
+ end
30
+ end
@@ -21,7 +21,7 @@ describe MangoPay::PayIn::BankWire::ExternalInstruction, type: :feature do
21
21
  c.http_timeout = 10000
22
22
  end
23
23
 
24
- id = "66142029"
24
+ id = "payin_m_01JK6199ED4VGBP98ABRJVDS9D"
25
25
  payIn = MangoPay::PayIn.fetch(id)
26
26
  expect(payIn['Id']).to eq(id)
27
27
  check_type_and_status(payIn)
@@ -38,7 +38,7 @@ describe MangoPay::PayIn::BankWire::ExternalInstruction, type: :feature do
38
38
  c.http_timeout = 10000
39
39
  end
40
40
 
41
- payInId = "74980101"
41
+ payInId = "payin_m_01JK6199ED4VGBP98ABRJVDS9D"
42
42
  payIn = MangoPay::PayIn.fetch(payInId)
43
43
  expect(payIn).to_not be(nil)
44
44
  expect(payIn['Id']).to eq(payInId)
@@ -56,7 +56,7 @@ describe MangoPay::PayIn::BankWire::ExternalInstruction, type: :feature do
56
56
  c.http_timeout = 10000
57
57
  end
58
58
 
59
- payInId = "74981216"
59
+ payInId = "payin_m_01JK6199ED4VGBP98ABRJVDS9D"
60
60
  payIn = MangoPay::PayIn.fetch(payInId)
61
61
  expect(payIn).to_not be(nil)
62
62
  expect(payIn['Id']).to eq(payInId)
@@ -26,7 +26,7 @@ describe MangoPay::PayIn::Card::Web, type: :feature do
26
26
  it 'creates a card web payin with payline v2' do
27
27
  created = new_payin_card_web_payline
28
28
  expect(created['Id']).not_to be_nil
29
- expect(created['RedirectURL']).to include('https://www.maysite.com/payline_template/')
29
+ # expect(created['RedirectURL']).to include('https://www.maysite.com/payline_template/')
30
30
  check_type_and_status(created)
31
31
  end
32
32
  end