mangopay 3.7.0 → 3.12.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/.github/workflows/ruby_ci.yml +3 -3
- data/CHANGELOG.md +67 -0
- data/lib/mangopay/deposit.rb +20 -0
- data/lib/mangopay/pay_in.rb +6 -0
- data/lib/mangopay/pay_out.rb +11 -0
- data/lib/mangopay/regulatory.rb +22 -0
- data/lib/mangopay/version.rb +1 -1
- data/lib/mangopay.rb +6 -0
- data/spec/mangopay/client_spec.rb +12 -12
- data/spec/mangopay/deposit_spec.rb +76 -0
- data/spec/mangopay/payin_applepay_direct_spec.rb +1 -1
- data/spec/mangopay/payin_preauthorized_direct_spec.rb +19 -1
- data/spec/mangopay/payout_bankwire_spec.rb +20 -0
- data/spec/mangopay/preauthorization_spec.rb +1 -1
- data/spec/mangopay/recurring_payin_spec.rb +17 -1
- data/spec/mangopay/regulatory_spec.rb +26 -0
- data/spec/mangopay/shared_resources.rb +143 -16
- data/spec/mangopay/user_spec.rb +14 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 913f73df1d1821cd5a933ee4a5c0bc7c776f1eeb512588b7488aa110706bf0b6
|
4
|
+
data.tar.gz: bda53a132d7e5b3a44739277405a9f79200dcb6bdab4e120ede7f6cae0e71a04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d29406640c31ef0d20e5c060582cb5860946ce8ff4b0f249412e7edc368d355efbaf94cd595885afa863607264a9facfb6af3912e814743969e424ac559ebfe8
|
7
|
+
data.tar.gz: 7f31702439cff0df222e723c363e5b6c6f242fa582f82986f5a26809db63291eb17f46c2a2a476ecf15a9caadbd9c807766b5f8707b41abb58658cffd571f878
|
@@ -21,11 +21,11 @@ jobs:
|
|
21
21
|
packages: write
|
22
22
|
|
23
23
|
steps:
|
24
|
-
- uses: actions/checkout@
|
24
|
+
- uses: actions/checkout@v3
|
25
25
|
- name: Set up Ruby 2.6
|
26
|
-
uses:
|
26
|
+
uses: ruby/setup-ruby@v1
|
27
27
|
with:
|
28
|
-
ruby-version: 2.6.
|
28
|
+
ruby-version: 2.6.10
|
29
29
|
- name: Install Rspec
|
30
30
|
run: |
|
31
31
|
gem install bundler
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,70 @@
|
|
1
|
+
## [3.12.0] - 2022-11-16
|
2
|
+
### New 30-day preauthorization feature
|
3
|
+
|
4
|
+
Preauthorizations can now hold funds for up to 30 days, therefore ensuring the solvency of a registered card for the same amount of time.
|
5
|
+
|
6
|
+
- The **Deposit** service has been added with methods for creating, fetching and canceling a deposit
|
7
|
+
- The **create_pre_authorized_deposit_pay_in** method has been added to the PayIn service
|
8
|
+
|
9
|
+
Thanks to 30-day preauthorizations, MANGOPAY can provide a simpler and more flexible payment experience for a wide range of use cases, especially for rentals.
|
10
|
+
|
11
|
+
## [3.11.1] - 2022-10-18
|
12
|
+
### Fixed
|
13
|
+
|
14
|
+
Tests has been fixed due to API evolution.
|
15
|
+
|
16
|
+
## [3.11.0] - 2022-09-08
|
17
|
+
##Added
|
18
|
+
**New country authorizations endpoints**
|
19
|
+
|
20
|
+
Country authorizations can now be viewed by using one of the following endpoints:
|
21
|
+
|
22
|
+
<a href="https://docs.mangopay.com/endpoints/v2.01/regulatory#e1061_the-country-authorizations-object">View a country's authorizations</a> <br>
|
23
|
+
<a href="https://docs.mangopay.com/endpoints/v2.01/regulatory#e1061_the-country-authorizations-object">View all countries' authorizations</a>
|
24
|
+
|
25
|
+
With these calls, it is possible to check which countries have:
|
26
|
+
|
27
|
+
- Blocked user creation
|
28
|
+
- Blocked bank account creation
|
29
|
+
- Blocked payout creation
|
30
|
+
|
31
|
+
Please refer to the <a href="https://docs.mangopay.com/guide/restrictions-by-country">Restrictions by country</a>
|
32
|
+
article for more information.
|
33
|
+
|
34
|
+
## [3.10.0] - 2022-06-29
|
35
|
+
##Added
|
36
|
+
**Recurring: €0 deadlines for CIT**
|
37
|
+
|
38
|
+
Setting free recurring payment deadlines is now possible for CIT (customer-initiated transactions) with the **FreeCycles** parameter.
|
39
|
+
|
40
|
+
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:
|
41
|
+
|
42
|
+
<a href="https://docs.mangopay.com/endpoints/v2.01/payins#e1051_create-a-recurring-payin-registration">Create a Recurring PayIn Registration</a><br>
|
43
|
+
<a href="https://docs.mangopay.com/endpoints/v2.01/payins#e1056_view-a-recurring-payin-registration">View a Recurring PayIn Registration</a><br>
|
44
|
+
|
45
|
+
This feature provides new automation capabilities for platforms with offers such as “Get the first month free” or “free trial” subscriptions.
|
46
|
+
|
47
|
+
Please refer to the <a href="https://docs.mangopay.com/guide/recurring-payments-introduction">Recurring payments overview</a> documentation for more information.
|
48
|
+
|
49
|
+
## [3.9.0] - 2022.03.31
|
50
|
+
### Added
|
51
|
+
|
52
|
+
#### Instant payment eligibility check
|
53
|
+
|
54
|
+
With the function
|
55
|
+
`PayOut::InstantPayoutEligibility::Reachability.create(params)`
|
56
|
+
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.
|
57
|
+
|
58
|
+
## [3.8.0] - 2021.10.20
|
59
|
+
## Added
|
60
|
+
|
61
|
+
You can now change the status to "ENDED" for a recurring payment.
|
62
|
+
|
63
|
+
## Fixed
|
64
|
+
|
65
|
+
- "Status" is now available in the response when you request a recurring payment registration.
|
66
|
+
|
67
|
+
|
1
68
|
## [3.7.0] - 2021.10.11
|
2
69
|
## Added
|
3
70
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module MangoPay
|
2
|
+
|
3
|
+
# See http://docs.mangopay.com/api-references/payins/preauthorized-payin/
|
4
|
+
class Deposit < Resource
|
5
|
+
def self.create(params, idempotency_key = nil)
|
6
|
+
MangoPay.request(:post, "#{MangoPay.api_path}/deposit-preauthorizations/card/direct", params, {}, idempotency_key)
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.get(deposit_id, filters = {})
|
10
|
+
MangoPay.request(:get, "#{MangoPay.api_path}/deposit-preauthorizations/#{deposit_id}", {}, filters)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.cancel(deposit_id)
|
14
|
+
params = {
|
15
|
+
PaymentStatus: 'CANCELED'
|
16
|
+
}
|
17
|
+
MangoPay.request(:put, "#{MangoPay.api_path}/deposit-preauthorizations/#{deposit_id}", params)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/mangopay/pay_in.rb
CHANGED
@@ -55,6 +55,10 @@ module MangoPay
|
|
55
55
|
def self.url(*)
|
56
56
|
"#{MangoPay.api_path}/payins/preauthorized/direct"
|
57
57
|
end
|
58
|
+
|
59
|
+
def self.create_pre_authorized_deposit_pay_in(params, idempotency_key = nil)
|
60
|
+
MangoPay.request(:post, "#{MangoPay.api_path}/payins/deposit-preauthorized/direct/full-capture", params, {}, idempotency_key)
|
61
|
+
end
|
58
62
|
end
|
59
63
|
|
60
64
|
end
|
@@ -140,6 +144,8 @@ module MangoPay
|
|
140
144
|
module RecurringPayments
|
141
145
|
class Recurring < Resource
|
142
146
|
include HTTPCalls::Create
|
147
|
+
include HTTPCalls::Fetch
|
148
|
+
include HTTPCalls::Update
|
143
149
|
|
144
150
|
def self.url(*args)
|
145
151
|
if args.any?
|
data/lib/mangopay/pay_out.rb
CHANGED
@@ -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
|
data/lib/mangopay/version.rb
CHANGED
data/lib/mangopay.rb
CHANGED
@@ -42,6 +42,8 @@ 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'
|
46
|
+
autoload :Deposit, 'mangopay/deposit'
|
45
47
|
|
46
48
|
# temporary
|
47
49
|
autoload :Temp, 'mangopay/temp'
|
@@ -74,6 +76,10 @@ module MangoPay
|
|
74
76
|
"/#{version_code}/#{MangoPay.configuration.client_id}"
|
75
77
|
end
|
76
78
|
|
79
|
+
def api_path_no_client
|
80
|
+
"/#{version_code}"
|
81
|
+
end
|
82
|
+
|
77
83
|
def api_uri(url='')
|
78
84
|
URI(configuration.root_url + url)
|
79
85
|
end
|
@@ -126,18 +126,18 @@ describe MangoPay::Client do
|
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
129
|
-
describe 'validate' do
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
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
|
@@ -0,0 +1,76 @@
|
|
1
|
+
describe MangoPay::Deposit do
|
2
|
+
include_context 'users'
|
3
|
+
include_context 'payins'
|
4
|
+
|
5
|
+
describe 'CREATE' do
|
6
|
+
it 'creates a new deposit' do
|
7
|
+
author = new_natural_user
|
8
|
+
card_registration = new_card_registration_completed_for_deposit
|
9
|
+
deposit = create_new_deposit(card_registration['CardId'], author['Id'])
|
10
|
+
|
11
|
+
assert_deposit(deposit, card_registration['CardId'], author["Id"])
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe 'GET' do
|
16
|
+
it 'get an existing deposit' do
|
17
|
+
author = new_natural_user
|
18
|
+
card_registration = new_card_registration_completed_for_deposit
|
19
|
+
deposit = create_new_deposit(card_registration['CardId'], author['Id'])
|
20
|
+
|
21
|
+
assert_deposit(deposit, card_registration['CardId'], author["Id"])
|
22
|
+
|
23
|
+
fetched_deposit = MangoPay::Deposit.get(deposit['Id'])
|
24
|
+
|
25
|
+
assert_deposit(fetched_deposit, card_registration['CardId'], author["Id"])
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# the Cancel flow will be teste manually for now
|
30
|
+
=begin
|
31
|
+
describe 'CANCEL' do
|
32
|
+
it 'cancel an existing deposit' do
|
33
|
+
author = new_natural_user
|
34
|
+
card_registration = new_card_registration_completed
|
35
|
+
deposit = create_new_deposit(card_registration['CardId'], author['Id'])
|
36
|
+
|
37
|
+
assert_deposit(deposit, card_registration['CardId'], author["Id"])
|
38
|
+
expect(deposit['Status']).to eq('CREATED')
|
39
|
+
expect(deposit['PaymentStatus']).to eq('WAITING')
|
40
|
+
|
41
|
+
MangoPay::Deposit.cancel(deposit['Id'])
|
42
|
+
|
43
|
+
updated_deposit = MangoPay::Deposit.get(deposit['Id'])
|
44
|
+
|
45
|
+
assert_deposit(updated_deposit, card_registration['CardId'], author["Id"])
|
46
|
+
expect(updated_deposit['Status']).to eq('SUCCEEDED')
|
47
|
+
expect(updated_deposit['PaymentStatus']).to eq('CANCELED')
|
48
|
+
end
|
49
|
+
end
|
50
|
+
=end
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
def assert_deposit(deposit, card_reg_id, author_id)
|
55
|
+
expect(deposit['Id']).not_to be_nil
|
56
|
+
expect(deposit['CreationDate']).not_to be_nil
|
57
|
+
expect(deposit['ExpirationDate']).not_to be_nil
|
58
|
+
expect(deposit['AuthorId']).not_to be_nil
|
59
|
+
expect(deposit['DebitedFunds']).not_to be_nil
|
60
|
+
expect(deposit['Status']).not_to be_nil
|
61
|
+
expect(deposit['PaymentStatus']).not_to be_nil
|
62
|
+
expect(deposit['PayinsLinked']).not_to be_nil
|
63
|
+
expect(deposit['CardId']).not_to be_nil
|
64
|
+
expect(deposit['CardId']).to eq(card_reg_id)
|
65
|
+
expect(deposit['AuthorId']).to eq(author_id)
|
66
|
+
expect(deposit['SecureModeReturnURL']).not_to be_nil
|
67
|
+
expect(deposit['SecureModeRedirectURL']).not_to be_nil
|
68
|
+
expect(deposit['PaymentType']).not_to be_nil
|
69
|
+
expect(deposit['ExecutionType']).not_to be_nil
|
70
|
+
expect(deposit['StatementDescriptor']).not_to be_nil
|
71
|
+
expect(deposit['Culture']).not_to be_nil
|
72
|
+
expect(deposit['BrowserInfo']).not_to be_nil
|
73
|
+
expect(deposit['IpAddress']).not_to be_nil
|
74
|
+
expect(deposit['Billing']).not_to be_nil
|
75
|
+
expect(deposit['Shipping']).not_to be_nil
|
76
|
+
end
|
@@ -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
|
-
|
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)
|
@@ -1,7 +1,8 @@
|
|
1
1
|
describe MangoPay::PayIn::PreAuthorized::Direct, type: :feature do
|
2
2
|
include_context 'wallets'
|
3
3
|
include_context 'payins'
|
4
|
-
|
4
|
+
include_context 'users'
|
5
|
+
|
5
6
|
def check_type_and_status(payin)
|
6
7
|
expect(payin['Type']).to eq('PAYIN')
|
7
8
|
expect(payin['Nature']).to eq('REGULAR')
|
@@ -67,4 +68,21 @@ describe MangoPay::PayIn::PreAuthorized::Direct, type: :feature do
|
|
67
68
|
end
|
68
69
|
end
|
69
70
|
|
71
|
+
# this flow is tested manually for the moment
|
72
|
+
=begin
|
73
|
+
describe 'CREATE AND VIEW PRE AUTHORIZED DEPOSIT' do
|
74
|
+
it 'creates a card direct pre authorized deposit payin' do
|
75
|
+
wallet = new_wallet
|
76
|
+
author = new_natural_user
|
77
|
+
card_registration = new_card_registration_completed
|
78
|
+
deposit = create_new_deposit(card_registration['CardId'], author['Id'])
|
79
|
+
|
80
|
+
created = create_new_payin_pre_authorized_deposit_direct(deposit['Id'], author['Id'], wallet['Id'])
|
81
|
+
|
82
|
+
expect(created['Id']).not_to be_nil
|
83
|
+
check_type_and_status(created)
|
84
|
+
expect(created['DepositId']).to eq(deposit['Id'])
|
85
|
+
end
|
86
|
+
end
|
87
|
+
=end
|
70
88
|
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
|
@@ -15,7 +15,7 @@ describe MangoPay::PreAuthorization do
|
|
15
15
|
expect(created['PaymentStatus']).to eq('WAITING')
|
16
16
|
expect(created['PaymentType']).to eq('CARD')
|
17
17
|
expect(created['ExecutionType']).to eq('DIRECT')
|
18
|
-
expect(created['Requested3DSVersion']).to eq('
|
18
|
+
expect(created['Requested3DSVersion']).to eq('V2_1')
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -37,9 +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
|
44
|
+
expect(recurring['Status']).not_to be_nil
|
45
|
+
expect(recurring['Id']).not_to be_nil
|
46
|
+
expect(recurring['FreeCycles']).not_to be_nil
|
47
|
+
|
48
|
+
id = recurring['Id']
|
49
|
+
|
50
|
+
get = MangoPay::PayIn::RecurringPayments::Recurring.fetch(id)
|
51
|
+
expect(get).not_to be_nil
|
52
|
+
expect(get['FreeCycles']).not_to be_nil
|
43
53
|
|
44
54
|
cit = MangoPay::PayIn::RecurringPayments::CIT.create(
|
45
55
|
RecurringPayinRegistrationId: recurring['Id'],
|
@@ -61,6 +71,12 @@ describe MangoPay::PayIn::RecurringPayments, type: :feature do
|
|
61
71
|
)
|
62
72
|
|
63
73
|
expect(cit).not_to be_nil
|
74
|
+
|
75
|
+
update = MangoPay::PayIn::RecurringPayments::Recurring.update(id, {
|
76
|
+
Status: 'Ended'
|
77
|
+
})
|
78
|
+
|
79
|
+
expect(update).not_to be_nil
|
64
80
|
end
|
65
81
|
end
|
66
82
|
end
|
@@ -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
|
@@ -221,13 +221,13 @@ shared_context 'payins' do
|
|
221
221
|
|
222
222
|
let(:new_payin_payconiq_web) do
|
223
223
|
MangoPay::PayIn::Payconiq::Web.create(
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
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
231
|
)
|
232
232
|
end
|
233
233
|
|
@@ -357,7 +357,7 @@ shared_context 'payins' do
|
|
357
357
|
data = {
|
358
358
|
data: cardreg['PreregistrationData'],
|
359
359
|
accessKeyRef: cardreg['AccessKey'],
|
360
|
-
cardNumber:
|
360
|
+
cardNumber: 4970105191923460,
|
361
361
|
cardExpirationDate: 1226,
|
362
362
|
cardCvx: 123}
|
363
363
|
|
@@ -377,11 +377,33 @@ shared_context 'payins' do
|
|
377
377
|
|
378
378
|
# 2nd step: tokenize by payline (fills-in RegistrationData)
|
379
379
|
data = {
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
380
|
+
data: cardreg['PreregistrationData'],
|
381
|
+
accessKeyRef: cardreg['AccessKey'],
|
382
|
+
cardNumber: 4970105191923460,
|
383
|
+
cardExpirationDate: 1224,
|
384
|
+
cardCvx: 123}
|
385
|
+
|
386
|
+
res = Net::HTTP.post_form(URI(cardreg['CardRegistrationURL']), data)
|
387
|
+
raise Exception, [res, res.body] unless res.is_a?(Net::HTTPOK) && res.body.start_with?('data=')
|
388
|
+
|
389
|
+
cardreg['RegistrationData'] = res.body
|
390
|
+
|
391
|
+
# 3rd step: update (fills-in CardId) and return it
|
392
|
+
MangoPay::CardRegistration.update(cardreg['Id'],
|
393
|
+
RegistrationData: cardreg['RegistrationData'])
|
394
|
+
end
|
395
|
+
|
396
|
+
let(:new_card_registration_completed_for_deposit) do
|
397
|
+
# 1st step: create
|
398
|
+
cardreg = new_card_registration
|
399
|
+
|
400
|
+
# 2nd step: tokenize by payline (fills-in RegistrationData)
|
401
|
+
data = {
|
402
|
+
data: cardreg['PreregistrationData'],
|
403
|
+
accessKeyRef: cardreg['AccessKey'],
|
404
|
+
cardNumber: 4970105181818183,
|
405
|
+
cardExpirationDate: 1226,
|
406
|
+
cardCvx: 123}
|
385
407
|
|
386
408
|
res = Net::HTTP.post_form(URI(cardreg['CardRegistrationURL']), data)
|
387
409
|
raise Exception, [res, res.body] unless res.is_a?(Net::HTTPOK) && res.body.start_with?('data=')
|
@@ -407,7 +429,19 @@ shared_context 'payins' do
|
|
407
429
|
CardId: cardreg['CardId'],
|
408
430
|
SecureModeReturnURL: 'http://test.com',
|
409
431
|
Tag: 'Test PayIn/Card/Direct',
|
410
|
-
Requested3DSVersion: '
|
432
|
+
Requested3DSVersion: 'V2_1',
|
433
|
+
BrowserInfo: {
|
434
|
+
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
435
|
+
JavaEnabled: true,
|
436
|
+
Language: "FR-FR",
|
437
|
+
ColorDepth: 4,
|
438
|
+
ScreenHeight: 1800,
|
439
|
+
ScreenWidth: 400,
|
440
|
+
JavascriptEnabled: true,
|
441
|
+
TimeZoneOffset: "+60",
|
442
|
+
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
443
|
+
},
|
444
|
+
IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C"
|
411
445
|
)
|
412
446
|
end
|
413
447
|
|
@@ -425,7 +459,19 @@ shared_context 'payins' do
|
|
425
459
|
SecureMode: 'DEFAULT',
|
426
460
|
SecureModeReturnURL: 'http://test.com',
|
427
461
|
Tag: 'Test Card PreAuthorization',
|
428
|
-
Requested3DSVersion: '
|
462
|
+
Requested3DSVersion: 'V2_1',
|
463
|
+
BrowserInfo: {
|
464
|
+
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
465
|
+
JavaEnabled: true,
|
466
|
+
Language: "FR-FR",
|
467
|
+
ColorDepth: 4,
|
468
|
+
ScreenHeight: 1800,
|
469
|
+
ScreenWidth: 400,
|
470
|
+
JavascriptEnabled: true,
|
471
|
+
TimeZoneOffset: "+60",
|
472
|
+
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
473
|
+
},
|
474
|
+
IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C"
|
429
475
|
)
|
430
476
|
end
|
431
477
|
|
@@ -440,7 +486,34 @@ shared_context 'payins' do
|
|
440
486
|
DebitedFunds: {Currency: 'EUR', Amount: amnt},
|
441
487
|
Fees: {Currency: 'EUR', Amount: 0},
|
442
488
|
PreauthorizationId: preauth['Id'],
|
443
|
-
Tag: 'Test PayIn/PreAuthorized/Direct'
|
489
|
+
Tag: 'Test PayIn/PreAuthorized/Direct',
|
490
|
+
BrowserInfo: {
|
491
|
+
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
492
|
+
JavaEnabled: true,
|
493
|
+
Language: "FR-FR",
|
494
|
+
ColorDepth: 4,
|
495
|
+
ScreenHeight: 1800,
|
496
|
+
ScreenWidth: 400,
|
497
|
+
JavascriptEnabled: true,
|
498
|
+
TimeZoneOffset: "+60",
|
499
|
+
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
500
|
+
},
|
501
|
+
IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C"
|
502
|
+
)
|
503
|
+
end
|
504
|
+
|
505
|
+
###############################################
|
506
|
+
# pre-authorized direct deposit
|
507
|
+
###############################################
|
508
|
+
|
509
|
+
def create_new_payin_pre_authorized_deposit_direct(deposit_id, author_id, credited_wallet_id)
|
510
|
+
MangoPay::PayIn::PreAuthorized::Direct.create_pre_authorized_deposit_pay_in(
|
511
|
+
AuthorId: author_id,
|
512
|
+
CreditedWalletId: credited_wallet_id,
|
513
|
+
DebitedFunds: {Currency: 'EUR', Amount: 500},
|
514
|
+
Fees: {Currency: 'EUR', Amount: 0},
|
515
|
+
DepositId: deposit_id,
|
516
|
+
Tag: 'lorem ipsum'
|
444
517
|
)
|
445
518
|
end
|
446
519
|
|
@@ -542,3 +615,57 @@ shared_context 'bankigaliases' do
|
|
542
615
|
}, new_wallet['Id'])
|
543
616
|
end
|
544
617
|
end
|
618
|
+
|
619
|
+
|
620
|
+
###############################################
|
621
|
+
# deposits
|
622
|
+
###############################################
|
623
|
+
|
624
|
+
def create_new_deposit(card_registration_id, author_id)
|
625
|
+
MangoPay::Deposit.create(
|
626
|
+
{
|
627
|
+
AuthorId: author_id,
|
628
|
+
DebitedFunds: {Currency: 'EUR', Amount: 1000},
|
629
|
+
CardId: card_registration_id,
|
630
|
+
SecureModeReturnURL: 'http://mangopay-sandbox-test.com',
|
631
|
+
StatementDescriptor: "lorem",
|
632
|
+
Culture: 'FR',
|
633
|
+
IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C",
|
634
|
+
BrowserInfo: {
|
635
|
+
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
636
|
+
JavaEnabled: true,
|
637
|
+
Language: "FR-FR",
|
638
|
+
ColorDepth: 4,
|
639
|
+
ScreenHeight: 1800,
|
640
|
+
ScreenWidth: 400,
|
641
|
+
JavascriptEnabled: true,
|
642
|
+
TimeZoneOffset: "+60",
|
643
|
+
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
644
|
+
},
|
645
|
+
Billing: {
|
646
|
+
Address: {
|
647
|
+
AddressLine1: 'AddressLine1',
|
648
|
+
AddressLine2: 'AddressLine2',
|
649
|
+
City: 'City',
|
650
|
+
Region: 'Region',
|
651
|
+
PostalCode: 'PostalCode',
|
652
|
+
Country: 'FR'
|
653
|
+
},
|
654
|
+
FirstName: 'Joe',
|
655
|
+
LastName: 'Blogs'
|
656
|
+
},
|
657
|
+
Shipping: {
|
658
|
+
Address: {
|
659
|
+
AddressLine1: 'AddressLine1',
|
660
|
+
AddressLine2: 'AddressLine2',
|
661
|
+
City: 'City',
|
662
|
+
Region: 'Region',
|
663
|
+
PostalCode: 'PostalCode',
|
664
|
+
Country: 'FR'
|
665
|
+
},
|
666
|
+
FirstName: 'Joe',
|
667
|
+
LastName: 'Blogs'
|
668
|
+
}
|
669
|
+
}
|
670
|
+
)
|
671
|
+
end
|
data/spec/mangopay/user_spec.rb
CHANGED
@@ -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.
|
4
|
+
version: 3.12.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:
|
12
|
+
date: 2022-11-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
@@ -82,6 +82,7 @@ files:
|
|
82
82
|
- lib/mangopay/card.rb
|
83
83
|
- lib/mangopay/card_registration.rb
|
84
84
|
- lib/mangopay/client.rb
|
85
|
+
- lib/mangopay/deposit.rb
|
85
86
|
- lib/mangopay/dispute.rb
|
86
87
|
- lib/mangopay/errors.rb
|
87
88
|
- lib/mangopay/event.rb
|
@@ -97,6 +98,7 @@ files:
|
|
97
98
|
- lib/mangopay/pay_out.rb
|
98
99
|
- lib/mangopay/pre_authorization.rb
|
99
100
|
- lib/mangopay/refund.rb
|
101
|
+
- lib/mangopay/regulatory.rb
|
100
102
|
- lib/mangopay/report.rb
|
101
103
|
- lib/mangopay/resource.rb
|
102
104
|
- lib/mangopay/transaction.rb
|
@@ -114,6 +116,7 @@ files:
|
|
114
116
|
- spec/mangopay/client_spec.png
|
115
117
|
- spec/mangopay/client_spec.rb
|
116
118
|
- spec/mangopay/configuration_spec.rb
|
119
|
+
- spec/mangopay/deposit_spec.rb
|
117
120
|
- spec/mangopay/dispute_spec.png
|
118
121
|
- spec/mangopay/dispute_spec.rb
|
119
122
|
- spec/mangopay/event_spec.rb
|
@@ -138,6 +141,7 @@ files:
|
|
138
141
|
- spec/mangopay/preauthorization_spec.rb
|
139
142
|
- spec/mangopay/recurring_payin_spec.rb
|
140
143
|
- spec/mangopay/refund_spec.rb
|
144
|
+
- spec/mangopay/regulatory_spec.rb
|
141
145
|
- spec/mangopay/report_spec.rb
|
142
146
|
- spec/mangopay/report_wallets_spec.rb
|
143
147
|
- spec/mangopay/shared_resources.rb
|
@@ -180,6 +184,7 @@ test_files:
|
|
180
184
|
- spec/mangopay/client_spec.png
|
181
185
|
- spec/mangopay/client_spec.rb
|
182
186
|
- spec/mangopay/configuration_spec.rb
|
187
|
+
- spec/mangopay/deposit_spec.rb
|
183
188
|
- spec/mangopay/dispute_spec.png
|
184
189
|
- spec/mangopay/dispute_spec.rb
|
185
190
|
- spec/mangopay/event_spec.rb
|
@@ -204,6 +209,7 @@ test_files:
|
|
204
209
|
- spec/mangopay/preauthorization_spec.rb
|
205
210
|
- spec/mangopay/recurring_payin_spec.rb
|
206
211
|
- spec/mangopay/refund_spec.rb
|
212
|
+
- spec/mangopay/regulatory_spec.rb
|
207
213
|
- spec/mangopay/report_spec.rb
|
208
214
|
- spec/mangopay/report_wallets_spec.rb
|
209
215
|
- spec/mangopay/shared_resources.rb
|