mangopay 3.30.2 → 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 +4 -4
- data/CHANGELOG.md +21 -0
- data/lib/mangopay/legal_user.rb +3 -0
- data/lib/mangopay/legal_user_sca.rb +4 -0
- data/lib/mangopay/natural_user.rb +6 -0
- data/lib/mangopay/natural_user_sca.rb +4 -0
- data/lib/mangopay/pay_in.rb +26 -0
- data/lib/mangopay/recipient.rb +35 -0
- data/lib/mangopay/version.rb +1 -1
- data/lib/mangopay.rb +2 -1
- data/spec/mangopay/client_spec.rb +2 -2
- data/spec/mangopay/identity_verification_spec.rb +14 -13
- data/spec/mangopay/kyc_document_spec.rb +2 -2
- data/spec/mangopay/payin_paybybank_web_spec.rb +30 -0
- data/spec/mangopay/recipient_spec.rb +113 -0
- data/spec/mangopay/recurring_payin_spec.rb +140 -0
- data/spec/mangopay/shared_resources.rb +54 -0
- data/spec/mangopay/user_spec.rb +16 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8e3054c801c2db4879dc5ee322b442204351fd2c96458345b865c7f30a8accf
|
4
|
+
data.tar.gz: e59f212b984b311a3999c1f768532798c072d60f40d692d1a90ae755a81a01d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74ce73c93504fbecef0a12d7ff98bd5f192700b90cf0e555063af16fabf88ffbdf6cb88e973e705f642e870c239bf306c624d97f8c8cc021008e88638cd9d6a1
|
7
|
+
data.tar.gz: d48f4c254375d55ddd36e911fb7f84cd18f8eeb96ed28081501ed745249abacad3fd6a35ede4e6be972196c0611675e259fea41cdb8e0cee0687cd5d296e0a86
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,24 @@
|
|
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
|
+
|
1
22
|
## [3.30.2] - 2025-04-02
|
2
23
|
### Fixed
|
3
24
|
- Fixed the way User-Agent Header is built
|
data/lib/mangopay/legal_user.rb
CHANGED
data/lib/mangopay/pay_in.rb
CHANGED
@@ -263,6 +263,16 @@ module MangoPay
|
|
263
263
|
end
|
264
264
|
end
|
265
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
|
+
|
266
276
|
module RecurringPayments
|
267
277
|
class Recurring < Resource
|
268
278
|
include HTTPCalls::Create
|
@@ -293,6 +303,22 @@ module MangoPay
|
|
293
303
|
"#{MangoPay.api_path}/payins/recurring/card/direct"
|
294
304
|
end
|
295
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
|
296
322
|
end
|
297
323
|
|
298
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}¤cy=#{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}¤cy=#{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/version.rb
CHANGED
data/lib/mangopay.rb
CHANGED
@@ -51,6 +51,7 @@ module MangoPay
|
|
51
51
|
autoload :PaymentMethodMetadata, 'mangopay/payment_method_metadata'
|
52
52
|
autoload :VirtualAccount, 'mangopay/virtual_account'
|
53
53
|
autoload :IdentityVerification, 'mangopay/identity_verification'
|
54
|
+
autoload :Recipient, 'mangopay/recipient'
|
54
55
|
|
55
56
|
# temporary
|
56
57
|
autoload :Temp, 'mangopay/temp'
|
@@ -232,7 +233,7 @@ module MangoPay
|
|
232
233
|
raise MangoPay::ResponseError.new(uri, res.code, details)
|
233
234
|
end
|
234
235
|
|
235
|
-
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)
|
236
237
|
raise MangoPay::ResponseError.new(uri, res.code, data)
|
237
238
|
end
|
238
239
|
|
@@ -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).
|
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).
|
54
|
+
expect(ret).to_not be_nil
|
55
55
|
end
|
56
56
|
|
57
57
|
it 'fails when input string is not base64-encoded' do
|
@@ -23,19 +23,20 @@ describe MangoPay::IdentityVerification do
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
end
|
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
|
39
40
|
|
40
41
|
def create_new_identity_verification
|
41
42
|
user = new_natural_user
|
@@ -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).
|
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).
|
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::PayByBank::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('PAY_BY_BANK')
|
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 paybybank web payin' do
|
15
|
+
created = new_payin_paybybank_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_paybybank_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
|
@@ -0,0 +1,113 @@
|
|
1
|
+
describe MangoPay::Recipient do
|
2
|
+
include_context 'recipient'
|
3
|
+
|
4
|
+
describe 'CREATE' do
|
5
|
+
it 'creates a new recipient' do
|
6
|
+
recipient = new_recipient
|
7
|
+
assert_recipient(recipient)
|
8
|
+
expect(recipient['PendingUserAction']).not_to be_nil
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe 'GET' do
|
13
|
+
it 'fetches a recipient' do
|
14
|
+
recipient = new_recipient
|
15
|
+
fetched = MangoPay::Recipient.get(recipient['Id'])
|
16
|
+
assert_recipient(fetched)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe 'GET User Recipients' do
|
21
|
+
it 'fetches a recipient' do
|
22
|
+
john = create_new_natural_user_sca_owner
|
23
|
+
create_new_recipient(john['Id'])
|
24
|
+
fetched = MangoPay::Recipient.get_user_recipients(john['Id'])
|
25
|
+
expect(fetched).not_to be_nil
|
26
|
+
expect(fetched).to be_kind_of(Array)
|
27
|
+
expect(fetched).not_to be_empty
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe 'GET Schema' do
|
32
|
+
it 'fetches schema for LocalBankTransfer, Individual' do
|
33
|
+
schema = MangoPay::Recipient.get_schema('LocalBankTransfer', 'Individual', 'GBP')
|
34
|
+
expect(schema).not_to be_nil
|
35
|
+
expect(schema['DisplayName']).not_to be_nil
|
36
|
+
expect(schema['Currency']).not_to be_nil
|
37
|
+
expect(schema['RecipientType']).not_to be_nil
|
38
|
+
expect(schema['PayoutMethodType']).not_to be_nil
|
39
|
+
expect(schema['RecipientScope']).not_to be_nil
|
40
|
+
expect(schema['Tag']).not_to be_nil
|
41
|
+
expect(schema['IndividualRecipient']).not_to be_nil
|
42
|
+
expect(schema['LocalBankTransfer']).not_to be_nil
|
43
|
+
expect(schema['BusinessRecipient']).to be_nil
|
44
|
+
expect(schema['InternationalBankTransfer']).to be_nil
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'fetches schema for InternationalBankTransfer, Business' do
|
48
|
+
schema = MangoPay::Recipient.get_schema('InternationalBankTransfer', 'Business', 'GBP')
|
49
|
+
expect(schema).not_to be_nil
|
50
|
+
expect(schema['DisplayName']).not_to be_nil
|
51
|
+
expect(schema['Currency']).not_to be_nil
|
52
|
+
expect(schema['RecipientType']).not_to be_nil
|
53
|
+
expect(schema['PayoutMethodType']).not_to be_nil
|
54
|
+
expect(schema['RecipientScope']).not_to be_nil
|
55
|
+
expect(schema['Tag']).not_to be_nil
|
56
|
+
expect(schema['BusinessRecipient']).not_to be_nil
|
57
|
+
expect(schema['InternationalBankTransfer']).not_to be_nil
|
58
|
+
expect(schema['IndividualRecipient']).to be_nil
|
59
|
+
expect(schema['LocalBankTransfer']).to be_nil
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe 'GET Payout Methods' do
|
64
|
+
it 'fetches payout methods' do
|
65
|
+
payout_methods = MangoPay::Recipient.get_payout_methods('DE', 'EUR')
|
66
|
+
expect(payout_methods).not_to be_nil
|
67
|
+
expect(payout_methods['AvailablePayoutMethods']).to be_kind_of(Array)
|
68
|
+
expect(payout_methods['AvailablePayoutMethods']).not_to be_empty
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe 'VALIDATE' do
|
73
|
+
it 'validates a recipient' do
|
74
|
+
recipient = define_new_recipient
|
75
|
+
john = create_new_natural_user_sca_owner
|
76
|
+
# it should pass
|
77
|
+
MangoPay::Recipient.validate(recipient, john['Id'])
|
78
|
+
|
79
|
+
# it should throw error
|
80
|
+
recipient['Currency'] = nil
|
81
|
+
expect { MangoPay::Recipient.validate(recipient, john['Id']) }.to raise_error { |err|
|
82
|
+
expect(err).to be_a MangoPay::ResponseError
|
83
|
+
expect(err.code).to eq '400'
|
84
|
+
expect(err.type).to eq 'param_error'
|
85
|
+
}
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe 'DEACTIVATE' do
|
90
|
+
it 'deactivates a recipient' do
|
91
|
+
pending("a recipient needs to be manually activated before running the test")
|
92
|
+
john = create_new_natural_user_sca_owner
|
93
|
+
recipient = create_new_recipient(john['Id'])
|
94
|
+
deactivated = MangoPay::Recipient.deactivate(recipient['Id'])
|
95
|
+
fetched = MangoPay::Recipient.get(recipient['Id'])
|
96
|
+
expect(deactivated['Status']).to eq('DEACTIVATED')
|
97
|
+
expect(fetched['Status']).to eq('DEACTIVATED')
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
|
103
|
+
def assert_recipient(recipient)
|
104
|
+
expect(recipient).not_to be_nil
|
105
|
+
expect(recipient['Status']).not_to be_nil
|
106
|
+
expect(recipient['DisplayName']).not_to be_nil
|
107
|
+
expect(recipient['PayoutMethodType']).not_to be_nil
|
108
|
+
expect(recipient['RecipientType']).not_to be_nil
|
109
|
+
expect(recipient['IndividualRecipient']).not_to be_nil
|
110
|
+
expect(recipient['LocalBankTransfer']).not_to be_nil
|
111
|
+
expect(recipient['RecipientScope']).not_to be_nil
|
112
|
+
expect(recipient['UserId']).not_to be_nil
|
113
|
+
end
|
@@ -78,5 +78,145 @@ describe MangoPay::PayIn::RecurringPayments, type: :feature do
|
|
78
78
|
|
79
79
|
expect(update).not_to be_nil
|
80
80
|
end
|
81
|
+
|
82
|
+
it 'creates a recurring paypal payment CIT' do
|
83
|
+
wallet = new_wallet
|
84
|
+
recurring = MangoPay::PayIn::RecurringPayments::Recurring.create(
|
85
|
+
AuthorId: new_natural_user['Id'],
|
86
|
+
CreditedUserId: wallet['Owners'][0],
|
87
|
+
CreditedWalletId: wallet['Id'],
|
88
|
+
FirstTransactionDebitedFunds: {Currency: 'EUR', Amount: 1000},
|
89
|
+
FirstTransactionFees: {Currency: 'EUR', Amount: 0},
|
90
|
+
Billing: {
|
91
|
+
Address: {
|
92
|
+
AddressLine1: 'AddressLine1',
|
93
|
+
AddressLine2: 'AddressLine2',
|
94
|
+
City: 'City',
|
95
|
+
Region: 'Region',
|
96
|
+
PostalCode: 'PostalCode',
|
97
|
+
Country: 'FR'
|
98
|
+
},
|
99
|
+
FirstName: 'Joe',
|
100
|
+
LastName: 'Blogs'
|
101
|
+
},
|
102
|
+
Shipping: {
|
103
|
+
Address: {
|
104
|
+
AddressLine1: 'AddressLine1',
|
105
|
+
AddressLine2: 'AddressLine2',
|
106
|
+
City: 'City',
|
107
|
+
Region: 'Region',
|
108
|
+
PostalCode: 'PostalCode',
|
109
|
+
Country: 'FR'
|
110
|
+
},
|
111
|
+
FirstName: 'Joe',
|
112
|
+
LastName: 'Blogs'
|
113
|
+
},
|
114
|
+
PaymentType: 'PAYPAL'
|
115
|
+
)
|
116
|
+
expect(recurring).not_to be_nil
|
117
|
+
expect(recurring['Status']).not_to be_nil
|
118
|
+
expect(recurring['Id']).not_to be_nil
|
119
|
+
|
120
|
+
cit = MangoPay::PayIn::RecurringPayments::PayPalCIT.create(
|
121
|
+
{
|
122
|
+
"ReturnURL": "http://example.com",
|
123
|
+
"CancelURL": "http://example.net",
|
124
|
+
"LineItems": [
|
125
|
+
{
|
126
|
+
"Name": "Running shoes",
|
127
|
+
"Quantity": 1,
|
128
|
+
"UnitAmount": 1000,
|
129
|
+
"TaxAmount": 0,
|
130
|
+
"Description": "ID of Seller 1",
|
131
|
+
"Category": "PHYSICAL_GOODS"
|
132
|
+
}
|
133
|
+
],
|
134
|
+
"Tag": "Created using the Mangopay API Postman collection",
|
135
|
+
"RecurringPayinRegistrationId": recurring['Id'],
|
136
|
+
"ShippingPreference": "SET_PROVIDED_ADDRESS",
|
137
|
+
"Reference": "abcd-efgh-ijkl",
|
138
|
+
"StatementDescriptor": "Example123"
|
139
|
+
}
|
140
|
+
)
|
141
|
+
|
142
|
+
expect(cit).not_to be_nil
|
143
|
+
expect(cit['Status']).to eq('CREATED')
|
144
|
+
expect(cit['PaymentType']).to eq('PAYPAL')
|
145
|
+
expect(cit['ExecutionType']).to eq('WEB')
|
146
|
+
end
|
147
|
+
|
148
|
+
it 'creates a recurring paypal payment MIT' do
|
149
|
+
wallet = new_wallet
|
150
|
+
recurring = MangoPay::PayIn::RecurringPayments::Recurring.create(
|
151
|
+
AuthorId: new_natural_user['Id'],
|
152
|
+
CreditedUserId: wallet['Owners'][0],
|
153
|
+
CreditedWalletId: wallet['Id'],
|
154
|
+
FirstTransactionDebitedFunds: {Currency: 'EUR', Amount: 1000},
|
155
|
+
FirstTransactionFees: {Currency: 'EUR', Amount: 0},
|
156
|
+
Billing: {
|
157
|
+
Address: {
|
158
|
+
AddressLine1: 'AddressLine1',
|
159
|
+
AddressLine2: 'AddressLine2',
|
160
|
+
City: 'City',
|
161
|
+
Region: 'Region',
|
162
|
+
PostalCode: 'PostalCode',
|
163
|
+
Country: 'FR'
|
164
|
+
},
|
165
|
+
FirstName: 'Joe',
|
166
|
+
LastName: 'Blogs'
|
167
|
+
},
|
168
|
+
Shipping: {
|
169
|
+
Address: {
|
170
|
+
AddressLine1: 'AddressLine1',
|
171
|
+
AddressLine2: 'AddressLine2',
|
172
|
+
City: 'City',
|
173
|
+
Region: 'Region',
|
174
|
+
PostalCode: 'PostalCode',
|
175
|
+
Country: 'FR'
|
176
|
+
},
|
177
|
+
FirstName: 'Joe',
|
178
|
+
LastName: 'Blogs'
|
179
|
+
},
|
180
|
+
PaymentType: 'PAYPAL'
|
181
|
+
)
|
182
|
+
expect(recurring).not_to be_nil
|
183
|
+
expect(recurring['Status']).not_to be_nil
|
184
|
+
expect(recurring['Id']).not_to be_nil
|
185
|
+
|
186
|
+
cit = MangoPay::PayIn::RecurringPayments::PayPalMIT.create(
|
187
|
+
{
|
188
|
+
"ReturnURL": "http://example.com",
|
189
|
+
"CancelURL": "http://example.net",
|
190
|
+
"LineItems": [
|
191
|
+
{
|
192
|
+
"Name": "Running shoes",
|
193
|
+
"Quantity": 1,
|
194
|
+
"UnitAmount": 1000,
|
195
|
+
"TaxAmount": 0,
|
196
|
+
"Description": "ID of Seller 1",
|
197
|
+
"Category": "PHYSICAL_GOODS"
|
198
|
+
}
|
199
|
+
],
|
200
|
+
"Tag": "Created using the Mangopay API Postman collection",
|
201
|
+
"RecurringPayinRegistrationId": recurring['Id'],
|
202
|
+
"ShippingPreference": "SET_PROVIDED_ADDRESS",
|
203
|
+
"Reference": "abcd-efgh-ijkl",
|
204
|
+
"StatementDescriptor": "Example123",
|
205
|
+
"DebitedFunds": {
|
206
|
+
"Currency": "EUR",
|
207
|
+
"Amount": 1000
|
208
|
+
},
|
209
|
+
"Fees": {
|
210
|
+
"Currency": "EUR",
|
211
|
+
"Amount": 0
|
212
|
+
}
|
213
|
+
}
|
214
|
+
)
|
215
|
+
|
216
|
+
expect(cit).not_to be_nil
|
217
|
+
expect(cit['Status']).to eq('CREATED')
|
218
|
+
expect(cit['PaymentType']).to eq('PAYPAL')
|
219
|
+
expect(cit['ExecutionType']).to eq('WEB')
|
220
|
+
end
|
81
221
|
end
|
82
222
|
end
|
@@ -942,6 +942,25 @@ shared_context 'payins' do
|
|
942
942
|
MangoPay::Wallet.fetch(pay_in['CreditedWalletId'])
|
943
943
|
end
|
944
944
|
|
945
|
+
let(:new_payin_paybybank_web) do
|
946
|
+
MangoPay::PayIn::PayByBank::Web.create(
|
947
|
+
AuthorId: new_natural_user['Id'],
|
948
|
+
CreditedWalletId: create_new_custom_wallet(new_natural_user, 'EUR')['Id'],
|
949
|
+
DebitedFunds: { Currency: 'EUR', Amount: 400 },
|
950
|
+
Fees: { Currency: 'EUR', Amount: 0 },
|
951
|
+
ReturnURL: 'http://www.my-site.com/returnURL',
|
952
|
+
StatementDescriptor: "test",
|
953
|
+
Tag: 'Test PayIn/PayByBank/Web',
|
954
|
+
Country: 'DE',
|
955
|
+
IBAN: 'DE03500105177564668331',
|
956
|
+
BIC: 'AACSDE33',
|
957
|
+
Scheme: 'SEPA_INSTANT_CREDIT_TRANSFER',
|
958
|
+
BankName: 'de-demobank-open-banking-embedded-templates',
|
959
|
+
Culture: 'EN',
|
960
|
+
PaymentFlow: 'WEB'
|
961
|
+
)
|
962
|
+
end
|
963
|
+
|
945
964
|
end
|
946
965
|
|
947
966
|
###############################################
|
@@ -1186,4 +1205,39 @@ shared_context 'virtual_account' do
|
|
1186
1205
|
|
1187
1206
|
MangoPay::VirtualAccount.create(wallet_id, create_virtual_account)
|
1188
1207
|
end
|
1208
|
+
end
|
1209
|
+
|
1210
|
+
shared_context 'recipient' do
|
1211
|
+
include_context 'users'
|
1212
|
+
|
1213
|
+
let(:new_recipient) { create_new_recipient(create_new_natural_user_sca_owner['Id']) }
|
1214
|
+
|
1215
|
+
def create_new_recipient(user_id)
|
1216
|
+
MangoPay::Recipient.create(define_new_recipient, user_id)
|
1217
|
+
end
|
1218
|
+
|
1219
|
+
def define_new_recipient
|
1220
|
+
{
|
1221
|
+
"DisplayName": "Alex Smith GBP account",
|
1222
|
+
"PayoutMethodType": "LocalBankTransfer",
|
1223
|
+
"RecipientType": "Individual",
|
1224
|
+
"Currency": "GBP",
|
1225
|
+
"IndividualRecipient": {
|
1226
|
+
"FirstName": "Alex",
|
1227
|
+
"LastName": "Smith",
|
1228
|
+
"Address": {
|
1229
|
+
"AddressLine1": "10 Kingsway",
|
1230
|
+
"City": "London",
|
1231
|
+
"PostalCode": "WC2B 6LH",
|
1232
|
+
"Country": "GB"
|
1233
|
+
}
|
1234
|
+
},
|
1235
|
+
"LocalBankTransfer": {
|
1236
|
+
"GBP": {
|
1237
|
+
"SortCode": "200000",
|
1238
|
+
"AccountNumber": "55779911"
|
1239
|
+
}
|
1240
|
+
}
|
1241
|
+
}
|
1242
|
+
end
|
1189
1243
|
end
|
data/spec/mangopay/user_spec.rb
CHANGED
@@ -367,4 +367,20 @@ describe MangoPay::User do
|
|
367
367
|
end
|
368
368
|
end
|
369
369
|
=end
|
370
|
+
|
371
|
+
describe 'CLOSE' do
|
372
|
+
it 'closes a natural user' do
|
373
|
+
new_user = create_new_natural_user
|
374
|
+
MangoPay::NaturalUser.close(new_user['Id'])
|
375
|
+
closed = MangoPay::User.fetch(new_user['Id'])
|
376
|
+
expect(closed['UserStatus']).to eq('CLOSED')
|
377
|
+
end
|
378
|
+
|
379
|
+
it 'closes a legal user' do
|
380
|
+
new_user = new_legal_user
|
381
|
+
MangoPay::LegalUser.close(new_user['Id'])
|
382
|
+
closed = MangoPay::User.fetch(new_user['Id'])
|
383
|
+
expect(closed['UserStatus']).to eq('CLOSED')
|
384
|
+
end
|
385
|
+
end
|
370
386
|
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.
|
4
|
+
version: 3.32.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: 2025-04-
|
12
|
+
date: 2025-04-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
@@ -102,6 +102,7 @@ files:
|
|
102
102
|
- lib/mangopay/pay_out.rb
|
103
103
|
- lib/mangopay/payment_method_metadata.rb
|
104
104
|
- lib/mangopay/pre_authorization.rb
|
105
|
+
- lib/mangopay/recipient.rb
|
105
106
|
- lib/mangopay/refund.rb
|
106
107
|
- lib/mangopay/regulatory.rb
|
107
108
|
- lib/mangopay/report.rb
|
@@ -150,6 +151,7 @@ files:
|
|
150
151
|
- spec/mangopay/payin_klarna_web_spec.rb
|
151
152
|
- spec/mangopay/payin_mbway_web_spec.rb
|
152
153
|
- spec/mangopay/payin_multibanco_web_spec.rb
|
154
|
+
- spec/mangopay/payin_paybybank_web_spec.rb
|
153
155
|
- spec/mangopay/payin_payconiq_web_spec.rb
|
154
156
|
- spec/mangopay/payin_paypal_web_spec.rb
|
155
157
|
- spec/mangopay/payin_preauthorized_direct_spec.rb
|
@@ -159,6 +161,7 @@ files:
|
|
159
161
|
- spec/mangopay/payment_method_metadata_spec.rb
|
160
162
|
- spec/mangopay/payout_bankwire_spec.rb
|
161
163
|
- spec/mangopay/preauthorization_spec.rb
|
164
|
+
- spec/mangopay/recipient_spec.rb
|
162
165
|
- spec/mangopay/recurring_payin_spec.rb
|
163
166
|
- spec/mangopay/refund_spec.rb
|
164
167
|
- spec/mangopay/regulatory_spec.rb
|
@@ -233,6 +236,7 @@ test_files:
|
|
233
236
|
- spec/mangopay/payin_klarna_web_spec.rb
|
234
237
|
- spec/mangopay/payin_mbway_web_spec.rb
|
235
238
|
- spec/mangopay/payin_multibanco_web_spec.rb
|
239
|
+
- spec/mangopay/payin_paybybank_web_spec.rb
|
236
240
|
- spec/mangopay/payin_payconiq_web_spec.rb
|
237
241
|
- spec/mangopay/payin_paypal_web_spec.rb
|
238
242
|
- spec/mangopay/payin_preauthorized_direct_spec.rb
|
@@ -242,6 +246,7 @@ test_files:
|
|
242
246
|
- spec/mangopay/payment_method_metadata_spec.rb
|
243
247
|
- spec/mangopay/payout_bankwire_spec.rb
|
244
248
|
- spec/mangopay/preauthorization_spec.rb
|
249
|
+
- spec/mangopay/recipient_spec.rb
|
245
250
|
- spec/mangopay/recurring_payin_spec.rb
|
246
251
|
- spec/mangopay/refund_spec.rb
|
247
252
|
- spec/mangopay/regulatory_spec.rb
|