mangopay 3.15.0 → 3.17.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 +17 -0
- data/lib/mangopay/card.rb +5 -0
- data/lib/mangopay/client.rb +0 -5
- data/lib/mangopay/pay_in.rb +45 -7
- data/lib/mangopay/version.rb +1 -1
- data/lib/mangopay.rb +10 -2
- data/spec/mangopay/card_registration_spec.rb +9 -0
- data/spec/mangopay/configuration_spec.rb +30 -0
- data/spec/mangopay/payin_blik_web_spec.rb +32 -0
- data/spec/mangopay/payin_klarna_web_spec.rb +32 -0
- data/spec/mangopay/{payin_mbway_direct_spec.rb → payin_mbway_web_spec.rb} +5 -5
- data/spec/mangopay/payin_multibanco_web_spec.rb +31 -0
- data/spec/mangopay/payin_paypal_web_spec.rb +21 -0
- data/spec/mangopay/payin_satispay_web_spec.rb +32 -0
- data/spec/mangopay/shared_resources.rb +142 -7
- metadata +12 -6
- data/spec/mangopay/payin_paypal_direct_spec.rb +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afb1569667ffe29e931e6ffd8e29b965c6dd84e094741c8bfb307ff44f7e71d3
|
4
|
+
data.tar.gz: e77127572650d95af53a9564d9c7d845785d161c9043212e27baa4f36b171740
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c78c113e106af277a4e0ec63bc1e8602fa2ff120bc2016041c018031275beb8b9c225d93f27f53566ba9560032aaed4936a6d0f087f5593665ba87ba11d8fe8
|
7
|
+
data.tar.gz: 841cab6e5d7d41a4db88075121f597737c10d2dd113556e812d887547b86c65d79af296b2ec29f455d4011e400e420840b4a2908dc446fa4d31511bcbb753196
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
## [3.17.0] - 2023-09-20
|
2
|
+
### Added
|
3
|
+
|
4
|
+
- A new parameter for Paypal : ShippingPreference
|
5
|
+
- Klarna is now available as a payment method with Mangopay. This payment method is in private beta. Please contact support if you have any questions.
|
6
|
+
- #225 It's now possible to configure ssl_options. It's now possible to set to false in preproduction environment. Thanks to @mantaskujalis
|
7
|
+
|
8
|
+
## [3.16.0] - 2023-09-04
|
9
|
+
### Added
|
10
|
+
|
11
|
+
- Card validation endpoint management (Private beta)
|
12
|
+
- New MOPs added : Multibanco, Blik, Satispay (Private beta)
|
13
|
+
|
14
|
+
### Fixed
|
15
|
+
|
16
|
+
- Execution Type of MB Way and PayPal has been changed from Direct to Web
|
17
|
+
|
1
18
|
## [3.15.0] - 2023-07-07
|
2
19
|
### Added
|
3
20
|
|
data/lib/mangopay/card.rb
CHANGED
@@ -35,6 +35,11 @@ module MangoPay
|
|
35
35
|
def get_pre_authorizations(card_id, filters = {})
|
36
36
|
MangoPay.request(:get, "#{MangoPay.api_path}/cards/#{card_id}/preauthorizations")
|
37
37
|
end
|
38
|
+
|
39
|
+
def validate(card_id, params)
|
40
|
+
url = "#{MangoPay.api_path}/cards/#{card_id}/validation"
|
41
|
+
MangoPay.request(:post, url, params)
|
42
|
+
end
|
38
43
|
end
|
39
44
|
end
|
40
45
|
end
|
data/lib/mangopay/client.rb
CHANGED
@@ -72,11 +72,6 @@ module MangoPay
|
|
72
72
|
MangoPay.request(:get, url() + "/wallets/#{funds_type}/#{currency_iso_code}/transactions", {}, filters)
|
73
73
|
end
|
74
74
|
|
75
|
-
def validate(client_id, card_id)
|
76
|
-
url = "#{MangoPay.api_path}/cards/#{card_id}/validate"
|
77
|
-
MangoPay.request(:post, url)
|
78
|
-
end
|
79
|
-
|
80
75
|
def create_bank_account(params)
|
81
76
|
MangoPay.request(:post, url() + "/bankaccounts/iban", params)
|
82
77
|
end
|
data/lib/mangopay/pay_in.rb
CHANGED
@@ -101,18 +101,16 @@ module MangoPay
|
|
101
101
|
module PayPal
|
102
102
|
|
103
103
|
# See https://docs.mangopay.com/api-references/payins/paypal-payin/
|
104
|
-
# <b>DEPRECATED</b>:
|
104
|
+
# # <b>DEPRECATED</b>: 'create' function is now deprecated.
|
105
|
+
# Please use the 'create_v2' function - MangoPay::PayIn::PayPal::Web.create_new(params)
|
105
106
|
class Web < Resource
|
106
107
|
include HTTPCalls::Create
|
107
108
|
def self.url(*)
|
108
109
|
"#{MangoPay.api_path}/payins/paypal/#{CGI.escape(class_name.downcase)}"
|
109
110
|
end
|
110
|
-
end
|
111
111
|
|
112
|
-
|
113
|
-
|
114
|
-
def self.url(*)
|
115
|
-
"#{MangoPay.api_path}/payins/payment-methods/paypal"
|
112
|
+
def self.create_v2(params, idempotency_key = nil)
|
113
|
+
MangoPay.request(:post, "#{MangoPay.api_path}/payins/payment-methods/paypal", params, {}, idempotency_key)
|
116
114
|
end
|
117
115
|
end
|
118
116
|
|
@@ -150,7 +148,7 @@ module MangoPay
|
|
150
148
|
end
|
151
149
|
|
152
150
|
module Mbway
|
153
|
-
class
|
151
|
+
class Web < Resource
|
154
152
|
include HTTPCalls::Create
|
155
153
|
|
156
154
|
def self.url(*)
|
@@ -159,6 +157,46 @@ module MangoPay
|
|
159
157
|
end
|
160
158
|
end
|
161
159
|
|
160
|
+
module Multibanco
|
161
|
+
class Web < Resource
|
162
|
+
include HTTPCalls::Create
|
163
|
+
|
164
|
+
def self.url(*)
|
165
|
+
"#{MangoPay.api_path}/payins/payment-methods/multibanco"
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
module Blik
|
171
|
+
class Web < Resource
|
172
|
+
include HTTPCalls::Create
|
173
|
+
|
174
|
+
def self.url(*)
|
175
|
+
"#{MangoPay.api_path}/payins/payment-methods/blik"
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
module Satispay
|
181
|
+
class Web < Resource
|
182
|
+
include HTTPCalls::Create
|
183
|
+
|
184
|
+
def self.url(*)
|
185
|
+
"#{MangoPay.api_path}/payins/payment-methods/satispay"
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
module Klarna
|
191
|
+
class Web < Resource
|
192
|
+
include HTTPCalls::Create
|
193
|
+
|
194
|
+
def self.url(*)
|
195
|
+
"#{MangoPay.api_path}/payins/payment-methods/klarna"
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
162
200
|
module RecurringPayments
|
163
201
|
class Recurring < Resource
|
164
202
|
include HTTPCalls::Create
|
data/lib/mangopay/version.rb
CHANGED
data/lib/mangopay.rb
CHANGED
@@ -53,7 +53,7 @@ module MangoPay
|
|
53
53
|
:client_id, :client_apiKey,
|
54
54
|
:temp_dir, :log_file, :http_timeout,
|
55
55
|
:http_max_retries, :http_open_timeout,
|
56
|
-
:logger
|
56
|
+
:logger, :use_ssl
|
57
57
|
|
58
58
|
def preproduction
|
59
59
|
@preproduction || false
|
@@ -74,6 +74,14 @@ module MangoPay
|
|
74
74
|
def http_open_timeout
|
75
75
|
@http_open_timeout || 30
|
76
76
|
end
|
77
|
+
|
78
|
+
def use_ssl?
|
79
|
+
return true unless preproduction == true
|
80
|
+
return true unless defined?(@use_ssl)
|
81
|
+
return false if @use_ssl == false
|
82
|
+
|
83
|
+
true
|
84
|
+
end
|
77
85
|
end
|
78
86
|
|
79
87
|
class << self
|
@@ -150,7 +158,7 @@ module MangoPay
|
|
150
158
|
headers['Idempotency-Key'] = headers_or_idempotency_key if headers_or_idempotency_key != nil
|
151
159
|
end
|
152
160
|
|
153
|
-
res = Net::HTTP.start(uri.host, uri.port, use_ssl
|
161
|
+
res = Net::HTTP.start(uri.host, uri.port, :use_ssl => configuration.use_ssl?, :read_timeout => configuration.http_timeout,
|
154
162
|
:max_retries => configuration.http_max_retries,
|
155
163
|
:open_timeout => configuration.http_open_timeout, ssl_version: :TLSv1_2) do |http|
|
156
164
|
req = Net::HTTP::const_get(method.capitalize).new(uri.request_uri, headers)
|
@@ -92,4 +92,13 @@ describe MangoPay::CardRegistration do
|
|
92
92
|
expect(transactions).to be_an(Array)
|
93
93
|
end
|
94
94
|
end
|
95
|
+
|
96
|
+
describe 'VALIDATE CARD' do
|
97
|
+
it "validates a card" do
|
98
|
+
created = new_card_registration_completed
|
99
|
+
validated = create_card_validation(created['UserId'], created['CardId'])
|
100
|
+
|
101
|
+
expect(validated).to_not be_nil
|
102
|
+
end
|
103
|
+
end
|
95
104
|
end
|
@@ -19,6 +19,36 @@ describe MangoPay::Configuration do
|
|
19
19
|
expect(users).to be_kind_of(Array)
|
20
20
|
end
|
21
21
|
|
22
|
+
describe '.use_ssl?' do
|
23
|
+
let(:configuration) { MangoPay::Configuration.new }
|
24
|
+
|
25
|
+
it 'defaults to true' do
|
26
|
+
expect(configuration.use_ssl?).to eq(true)
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'when assigned to false in production' do
|
30
|
+
before do
|
31
|
+
configuration.use_ssl = false
|
32
|
+
configuration.preproduction = false
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'uses true as value' do
|
36
|
+
expect(configuration.use_ssl?).to eq(true)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context 'when assigned to false in preproduction' do
|
41
|
+
before do
|
42
|
+
configuration.use_ssl = false
|
43
|
+
configuration.preproduction = true
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'uses assigned as value' do
|
47
|
+
expect(configuration.use_ssl?).to eq(false)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
22
52
|
describe 'logger' do
|
23
53
|
around(:each) do |example|
|
24
54
|
c = MangoPay.configuration
|
@@ -0,0 +1,32 @@
|
|
1
|
+
describe MangoPay::PayIn::Blik::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('BLIK')
|
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 blik web payin' do
|
15
|
+
created = new_payin_blik_web
|
16
|
+
expect(created['Id']).not_to be_nil
|
17
|
+
expect(created['ReturnURL']).not_to be_nil
|
18
|
+
check_type_and_status(created)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe 'FETCH' do
|
23
|
+
it 'fetches a payin' do
|
24
|
+
created = new_payin_blik_web
|
25
|
+
fetched = MangoPay::PayIn.fetch(created['Id'])
|
26
|
+
expect(fetched['Id']).to eq(created['Id'])
|
27
|
+
check_type_and_status(created)
|
28
|
+
check_type_and_status(fetched)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
describe MangoPay::PayIn::Klarna::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('KLARNA')
|
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 klarna web payin' do
|
15
|
+
created = new_payin_klarna_web
|
16
|
+
expect(created['Id']).not_to be_nil
|
17
|
+
expect(created['ReturnURL']).not_to be_nil
|
18
|
+
check_type_and_status(created)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe 'FETCH' do
|
23
|
+
it 'fetches a payin' do
|
24
|
+
created = new_payin_klarna_web
|
25
|
+
fetched = MangoPay::PayIn.fetch(created['Id'])
|
26
|
+
expect(fetched['Id']).to eq(created['Id'])
|
27
|
+
check_type_and_status(created)
|
28
|
+
check_type_and_status(fetched)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
@@ -1,4 +1,4 @@
|
|
1
|
-
describe MangoPay::PayIn::Mbway::
|
1
|
+
describe MangoPay::PayIn::Mbway::Web, type: :feature do
|
2
2
|
include_context 'wallets'
|
3
3
|
include_context 'payins'
|
4
4
|
|
@@ -6,13 +6,13 @@ describe MangoPay::PayIn::Mbway::Direct, type: :feature do
|
|
6
6
|
expect(payin['Type']).to eq('PAYIN')
|
7
7
|
expect(payin['Nature']).to eq('REGULAR')
|
8
8
|
expect(payin['PaymentType']).to eq('MBWAY')
|
9
|
-
expect(payin['ExecutionType']).to eq('
|
9
|
+
expect(payin['ExecutionType']).to eq('WEB')
|
10
10
|
expect(payin['Status']).to eq('CREATED')
|
11
11
|
end
|
12
12
|
|
13
13
|
describe 'CREATE' do
|
14
|
-
it 'creates a mbway
|
15
|
-
created =
|
14
|
+
it 'creates a mbway web payin' do
|
15
|
+
created = new_payin_mbway_web
|
16
16
|
expect(created['Id']).not_to be_nil
|
17
17
|
expect(created['Phone']).not_to be_nil
|
18
18
|
check_type_and_status(created)
|
@@ -21,7 +21,7 @@ describe MangoPay::PayIn::Mbway::Direct, type: :feature do
|
|
21
21
|
|
22
22
|
describe 'FETCH' do
|
23
23
|
it 'fetches a payin' do
|
24
|
-
created =
|
24
|
+
created = new_payin_mbway_web
|
25
25
|
fetched = MangoPay::PayIn.fetch(created['Id'])
|
26
26
|
expect(fetched['Id']).to eq(created['Id'])
|
27
27
|
check_type_and_status(created)
|
@@ -0,0 +1,31 @@
|
|
1
|
+
describe MangoPay::PayIn::Multibanco::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('MULTIBANCO')
|
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 multibanco web payin' do
|
15
|
+
created = new_payin_multibanco_web
|
16
|
+
expect(created['Id']).not_to be_nil
|
17
|
+
expect(created['ReturnURL']).not_to be_nil
|
18
|
+
check_type_and_status(created)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe 'FETCH' do
|
23
|
+
it 'fetches a payin' do
|
24
|
+
created = new_payin_multibanco_web
|
25
|
+
fetched = MangoPay::PayIn.fetch(created['Id'])
|
26
|
+
expect(fetched['Id']).to eq(created['Id'])
|
27
|
+
check_type_and_status(created)
|
28
|
+
check_type_and_status(fetched)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -22,6 +22,14 @@ describe MangoPay::PayIn::PayPal::Web, type: :feature do
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
describe 'CREATE V2' do
|
26
|
+
it 'creates a paypal web v2 payin' do
|
27
|
+
created = new_payin_paypal_web_v2
|
28
|
+
expect(created['Id']).not_to be_nil
|
29
|
+
check_type_and_status(created)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
25
33
|
describe "FETCH" do
|
26
34
|
it 'FETCHES a payIn with PayPal account email' do
|
27
35
|
payin_id = "54088959"
|
@@ -47,4 +55,17 @@ describe MangoPay::PayIn::PayPal::Web, type: :feature do
|
|
47
55
|
end
|
48
56
|
end
|
49
57
|
|
58
|
+
describe 'FETCH V2' do
|
59
|
+
it 'fetches a payin' do
|
60
|
+
created = new_payin_paypal_web_v2
|
61
|
+
fetched = MangoPay::PayIn.fetch(created['Id'])
|
62
|
+
expect(fetched['Id']).to eq(created['Id'])
|
63
|
+
expect(fetched['CreationDate']).to eq(created['CreationDate'])
|
64
|
+
expect(fetched['CreditedFunds']).to eq(created['CreditedFunds'])
|
65
|
+
expect(fetched['CreditedWalletId']).to eq(created['CreditedWalletId'])
|
66
|
+
check_type_and_status(created)
|
67
|
+
check_type_and_status(fetched)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
50
71
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
describe MangoPay::PayIn::Satispay::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('SATISPAY')
|
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 satispay web payin' do
|
15
|
+
created = new_payin_satispay_web
|
16
|
+
expect(created['Id']).not_to be_nil
|
17
|
+
expect(created['Country']).not_to be_nil
|
18
|
+
check_type_and_status(created)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe 'FETCH' do
|
23
|
+
it 'fetches a payin' do
|
24
|
+
created = new_payin_satispay_web
|
25
|
+
fetched = MangoPay::PayIn.fetch(created['Id'])
|
26
|
+
expect(fetched['Id']).to eq(created['Id'])
|
27
|
+
check_type_and_status(created)
|
28
|
+
check_type_and_status(fetched)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -441,25 +441,138 @@ shared_context 'payins' do
|
|
441
441
|
let(:new_payin_card_direct) { create_new_payin_card_direct(new_wallet) }
|
442
442
|
|
443
443
|
###############################################
|
444
|
-
# MBWAY/
|
444
|
+
# MBWAY/web
|
445
445
|
###############################################
|
446
|
-
let(:
|
447
|
-
MangoPay::PayIn::Mbway::
|
446
|
+
let(:new_payin_mbway_web) do
|
447
|
+
MangoPay::PayIn::Mbway::Web.create(
|
448
448
|
AuthorId: new_natural_user['Id'],
|
449
449
|
CreditedWalletId: new_wallet['Id'],
|
450
450
|
DebitedFunds: {Currency: 'EUR', Amount: 199},
|
451
451
|
Fees: {Currency: 'EUR', Amount: 1},
|
452
452
|
StatementDescriptor: "ruby",
|
453
|
-
Tag: 'Test PayIn/Mbway/
|
453
|
+
Tag: 'Test PayIn/Mbway/Web',
|
454
454
|
Phone: '351#269458236'
|
455
455
|
)
|
456
456
|
end
|
457
457
|
|
458
458
|
###############################################
|
459
|
-
#
|
459
|
+
# MULTIBANCO/web
|
460
460
|
###############################################
|
461
|
-
let(:
|
462
|
-
MangoPay::PayIn::
|
461
|
+
let(:new_payin_multibanco_web) do
|
462
|
+
MangoPay::PayIn::Multibanco::Web.create(
|
463
|
+
AuthorId: new_natural_user['Id'],
|
464
|
+
DebitedFunds: {Currency: 'EUR', Amount: 199},
|
465
|
+
Fees: {Currency: 'EUR', Amount: 1},
|
466
|
+
CreditedWalletId: new_wallet['Id'],
|
467
|
+
StatementDescriptor: "ruby",
|
468
|
+
Tag: 'Test PayIn/Multibanco/Web',
|
469
|
+
ReturnURL: 'http://www.my-site.com/returnURL'
|
470
|
+
)
|
471
|
+
end
|
472
|
+
|
473
|
+
###############################################
|
474
|
+
# BLIK/web
|
475
|
+
###############################################
|
476
|
+
let(:new_payin_blik_web) do
|
477
|
+
user = new_natural_user
|
478
|
+
wallet = MangoPay::Wallet.create(
|
479
|
+
Owners: [user['Id']],
|
480
|
+
Description: 'A test wallet',
|
481
|
+
Currency: 'PLN',
|
482
|
+
Tag: 'Test wallet'
|
483
|
+
)
|
484
|
+
MangoPay::PayIn::Blik::Web.create(
|
485
|
+
AuthorId: user['Id'],
|
486
|
+
CreditedWalletId: wallet['Id'],
|
487
|
+
DebitedFunds: {Currency: 'PLN', Amount: 199},
|
488
|
+
Fees: {Currency: 'PLN', Amount: 1},
|
489
|
+
StatementDescriptor: "ruby",
|
490
|
+
Tag: 'Test PayIn/Blik/Web',
|
491
|
+
ReturnURL: 'https://example.com'
|
492
|
+
)
|
493
|
+
end
|
494
|
+
|
495
|
+
###############################################
|
496
|
+
# SATISPAY/web
|
497
|
+
###############################################
|
498
|
+
let(:new_payin_satispay_web) do
|
499
|
+
MangoPay::PayIn::Satispay::Web.create(
|
500
|
+
AuthorId: new_natural_user['Id'],
|
501
|
+
CreditedWalletId: new_wallet['Id'],
|
502
|
+
DebitedFunds: {Currency: 'EUR', Amount: 199},
|
503
|
+
Fees: {Currency: 'EUR', Amount: 1},
|
504
|
+
StatementDescriptor: "ruby",
|
505
|
+
Tag: 'Test PayIn/Mbway/Web',
|
506
|
+
Country: 'IT',
|
507
|
+
ReturnURL: 'http://www.my-site.com/returnURL'
|
508
|
+
)
|
509
|
+
end
|
510
|
+
|
511
|
+
###############################################
|
512
|
+
# KLARNA/web
|
513
|
+
###############################################
|
514
|
+
let(:new_payin_klarna_web) do
|
515
|
+
MangoPay::PayIn::Klarna::Web.create(
|
516
|
+
AuthorId: new_natural_user['Id'],
|
517
|
+
CreditedWalletId: new_wallet['Id'],
|
518
|
+
DebitedFunds: {Currency: 'EUR', Amount: 400},
|
519
|
+
Fees: {Currency: 'EUR', Amount: 10},
|
520
|
+
ReturnURL: 'http://www.my-site.com/returnURL',
|
521
|
+
LineItems: [
|
522
|
+
{
|
523
|
+
Name: "running shoes",
|
524
|
+
Quantity: 1,
|
525
|
+
UnitAmount: 200,
|
526
|
+
TaxAmount: 0,
|
527
|
+
Description: "seller1 ID"
|
528
|
+
},
|
529
|
+
{
|
530
|
+
Name: "running shoes",
|
531
|
+
Quantity: 1,
|
532
|
+
UnitAmount: 200,
|
533
|
+
TaxAmount: 0,
|
534
|
+
Description: "seller2 ID"
|
535
|
+
}
|
536
|
+
],
|
537
|
+
Country: 'FR',
|
538
|
+
Culture: 'FR',
|
539
|
+
Phone: '33#607080900',
|
540
|
+
Email: 'mango@mangopay.com',
|
541
|
+
AdditionalData: '{}',
|
542
|
+
Billing: {
|
543
|
+
Address: {
|
544
|
+
AddressLine1: 'AddressLine1',
|
545
|
+
AddressLine2: 'AddressLine2',
|
546
|
+
City: 'City',
|
547
|
+
Region: 'Region',
|
548
|
+
PostalCode: 'PostalCode',
|
549
|
+
Country: 'FR'
|
550
|
+
},
|
551
|
+
FirstName: 'Joe',
|
552
|
+
LastName: 'Blogs'
|
553
|
+
},
|
554
|
+
Shipping: {
|
555
|
+
Address: {
|
556
|
+
AddressLine1: 'AddressLine1',
|
557
|
+
AddressLine2: 'AddressLine2',
|
558
|
+
City: 'City',
|
559
|
+
Region: 'Region',
|
560
|
+
PostalCode: 'PostalCode',
|
561
|
+
Country: 'FR'
|
562
|
+
},
|
563
|
+
FirstName: 'Joe',
|
564
|
+
LastName: 'Blogs'
|
565
|
+
},
|
566
|
+
MerchantOrderId: 'afd48-879d-48fg',
|
567
|
+
Tag: 'Test PayIn/Klarna/Web'
|
568
|
+
)
|
569
|
+
end
|
570
|
+
|
571
|
+
###############################################
|
572
|
+
# PAYPAL/web V2
|
573
|
+
###############################################
|
574
|
+
let(:new_payin_paypal_web_v2) do
|
575
|
+
MangoPay::PayIn::PayPal::Web.create_v2(
|
463
576
|
AuthorId: new_natural_user['Id'],
|
464
577
|
DebitedFunds: { Currency: 'EUR', Amount: 400 },
|
465
578
|
Fees: { Currency: 'EUR', Amount: 0 },
|
@@ -493,6 +606,7 @@ shared_context 'payins' do
|
|
493
606
|
FirstName: 'Joe',
|
494
607
|
LastName: 'Blogs'
|
495
608
|
},
|
609
|
+
ShippingPreference: "GET_FROM_FILE",
|
496
610
|
StatementDescriptor: "ruby",
|
497
611
|
Tag: 'Test',
|
498
612
|
# Culture: 'FR'
|
@@ -584,6 +698,27 @@ shared_context 'payins' do
|
|
584
698
|
)
|
585
699
|
end
|
586
700
|
|
701
|
+
def create_card_validation(author_id, card_id)
|
702
|
+
params = {
|
703
|
+
AuthorId: author_id,
|
704
|
+
SecureModeReturnURL: "https://mangopay.com",
|
705
|
+
IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C",
|
706
|
+
Tag: "custom meta",
|
707
|
+
BrowserInfo: {
|
708
|
+
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
709
|
+
JavaEnabled: true,
|
710
|
+
Language: "FR-FR",
|
711
|
+
ColorDepth: 4,
|
712
|
+
ScreenHeight: 1800,
|
713
|
+
ScreenWidth: 400,
|
714
|
+
JavascriptEnabled: true,
|
715
|
+
TimeZoneOffset: "+60",
|
716
|
+
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
717
|
+
}
|
718
|
+
}
|
719
|
+
MangoPay::Card.validate(card_id, params)
|
720
|
+
end
|
721
|
+
|
587
722
|
###############################################
|
588
723
|
# pre-authorized direct deposit
|
589
724
|
###############################################
|
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.17.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: 2023-
|
12
|
+
date: 2023-09-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
@@ -130,16 +130,19 @@ files:
|
|
130
130
|
- spec/mangopay/payin_applepay_direct_spec.rb
|
131
131
|
- spec/mangopay/payin_bankwire_direct_spec.rb
|
132
132
|
- spec/mangopay/payin_bankwire_external_instruction_spec.rb
|
133
|
+
- spec/mangopay/payin_blik_web_spec.rb
|
133
134
|
- spec/mangopay/payin_card_direct_spec.rb
|
134
135
|
- spec/mangopay/payin_card_web_spec.rb
|
135
136
|
- spec/mangopay/payin_directdebit_direct_spec.rb
|
136
137
|
- spec/mangopay/payin_directdebit_web_spec.rb
|
137
138
|
- spec/mangopay/payin_googlepay_direct_spec.rb
|
138
|
-
- spec/mangopay/
|
139
|
+
- spec/mangopay/payin_klarna_web_spec.rb
|
140
|
+
- spec/mangopay/payin_mbway_web_spec.rb
|
141
|
+
- spec/mangopay/payin_multibanco_web_spec.rb
|
139
142
|
- spec/mangopay/payin_payconiq_web_spec.rb
|
140
|
-
- spec/mangopay/payin_paypal_direct_spec.rb
|
141
143
|
- spec/mangopay/payin_paypal_web_spec.rb
|
142
144
|
- spec/mangopay/payin_preauthorized_direct_spec.rb
|
145
|
+
- spec/mangopay/payin_satispay_web_spec.rb
|
143
146
|
- spec/mangopay/payout_bankwire_spec.rb
|
144
147
|
- spec/mangopay/preauthorization_spec.rb
|
145
148
|
- spec/mangopay/recurring_payin_spec.rb
|
@@ -201,16 +204,19 @@ test_files:
|
|
201
204
|
- spec/mangopay/payin_applepay_direct_spec.rb
|
202
205
|
- spec/mangopay/payin_bankwire_direct_spec.rb
|
203
206
|
- spec/mangopay/payin_bankwire_external_instruction_spec.rb
|
207
|
+
- spec/mangopay/payin_blik_web_spec.rb
|
204
208
|
- spec/mangopay/payin_card_direct_spec.rb
|
205
209
|
- spec/mangopay/payin_card_web_spec.rb
|
206
210
|
- spec/mangopay/payin_directdebit_direct_spec.rb
|
207
211
|
- spec/mangopay/payin_directdebit_web_spec.rb
|
208
212
|
- spec/mangopay/payin_googlepay_direct_spec.rb
|
209
|
-
- spec/mangopay/
|
213
|
+
- spec/mangopay/payin_klarna_web_spec.rb
|
214
|
+
- spec/mangopay/payin_mbway_web_spec.rb
|
215
|
+
- spec/mangopay/payin_multibanco_web_spec.rb
|
210
216
|
- spec/mangopay/payin_payconiq_web_spec.rb
|
211
|
-
- spec/mangopay/payin_paypal_direct_spec.rb
|
212
217
|
- spec/mangopay/payin_paypal_web_spec.rb
|
213
218
|
- spec/mangopay/payin_preauthorized_direct_spec.rb
|
219
|
+
- spec/mangopay/payin_satispay_web_spec.rb
|
214
220
|
- spec/mangopay/payout_bankwire_spec.rb
|
215
221
|
- spec/mangopay/preauthorization_spec.rb
|
216
222
|
- spec/mangopay/recurring_payin_spec.rb
|
@@ -1,38 +0,0 @@
|
|
1
|
-
describe MangoPay::PayIn::PayPal::Direct, 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('PAYPAL')
|
8
|
-
expect(payin['ExecutionType']).to eq('DIRECT')
|
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 paypal direct payin' do
|
19
|
-
created = new_payin_paypal_direct
|
20
|
-
expect(created['Id']).not_to be_nil
|
21
|
-
check_type_and_status(created)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
describe 'FETCH' do
|
26
|
-
it 'fetches a payin' do
|
27
|
-
created = new_payin_paypal_direct
|
28
|
-
fetched = MangoPay::PayIn.fetch(created['Id'])
|
29
|
-
expect(fetched['Id']).to eq(created['Id'])
|
30
|
-
expect(fetched['CreationDate']).to eq(created['CreationDate'])
|
31
|
-
expect(fetched['CreditedFunds']).to eq(created['CreditedFunds'])
|
32
|
-
expect(fetched['CreditedWalletId']).to eq(created['CreditedWalletId'])
|
33
|
-
check_type_and_status(created)
|
34
|
-
check_type_and_status(fetched)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|