mangopay 3.15.0 → 3.16.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: 202974d7cf1a5592a21a8c4bdeb77f5b30d701832f30bcfb81370f7ecba899cf
4
- data.tar.gz: 6223cb0b60c1879400244935a36703b340e848a1d79ae31dc32b6b046b0d336f
3
+ metadata.gz: ee564c11b6f6937ee8e1736000f571f999effa0e65946cbbdf73a7fd2671c4ef
4
+ data.tar.gz: 004c55f7857d52c18dedff47a44777d1f311739f6e039cd8953fa2ac49340cbc
5
5
  SHA512:
6
- metadata.gz: 847b4ff7fb5334910c45613e5ffb9bb54be337f13f8fb72761e9011a763bb05790f208eb8bf1e34d28fa0e71500b50dd5fad4c189b46ad17d6bc395ad8ee4cab
7
- data.tar.gz: 6b99e0af648f75578e03adaab4cc3f1887709b14a057a24fe60ee6c6a9dc9b5bff77624cfeb11fc6d63e6791306641be4c06e704bfd46b1e6186992f1ea60ceb
6
+ metadata.gz: d3bbdd4eb6cef6ca0093da5f10a84e9250272118725ffa9f99cc45959807ba38b441ec0799904d33787ef0a9769df9a08099a452748a4aba36e85dded23ab663
7
+ data.tar.gz: 8bbb4cbca2206df01fc7a02687bbed28b531a1fa469e74b763318d36a95a40ebed000667bd7e1873626245c96483cffa4577be231e5275570b323828443d6998
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## [3.16.0] - 2023-09-04
2
+ ### Added
3
+
4
+ - Card validation endpoint management (Private beta)
5
+ - New MOPs added : Multibanco, Blik, Satispay (Private beta)
6
+
7
+ ### Fixed
8
+
9
+ - Execution Type of MB Way and PayPal has been changed from Direct to Web
10
+
1
11
  ## [3.15.0] - 2023-07-07
2
12
  ### Added
3
13
 
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
@@ -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
@@ -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>: Please use the Direct payment method. Web will be removed in a future version.
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
- class Direct < Resource
113
- include HTTPCalls::Create
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 Direct < Resource
151
+ class Web < Resource
154
152
  include HTTPCalls::Create
155
153
 
156
154
  def self.url(*)
@@ -159,6 +157,36 @@ 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
+
162
190
  module RecurringPayments
163
191
  class Recurring < Resource
164
192
  include HTTPCalls::Create
@@ -1,3 +1,3 @@
1
1
  module MangoPay
2
- VERSION = '3.15.0'
2
+ VERSION = '3.16.0'
3
3
  end
@@ -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
@@ -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
@@ -1,4 +1,4 @@
1
- describe MangoPay::PayIn::Mbway::Direct, type: :feature do
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('DIRECT')
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 direct payin' do
15
- created = new_payin_mbway_direct
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 = new_payin_mbway_direct
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,32 @@
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
+
32
+ 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,78 @@ shared_context 'payins' do
441
441
  let(:new_payin_card_direct) { create_new_payin_card_direct(new_wallet) }
442
442
 
443
443
  ###############################################
444
- # MBWAY/direct
444
+ # MBWAY/web
445
445
  ###############################################
446
- let(:new_payin_mbway_direct) do
447
- MangoPay::PayIn::Mbway::Direct.create(
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/Direct',
453
+ Tag: 'Test PayIn/Mbway/Web',
454
454
  Phone: '351#269458236'
455
455
  )
456
456
  end
457
457
 
458
+ ###############################################
459
+ # MULTIBANCO/web
460
+ ###############################################
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
+
458
511
  ###############################################
459
512
  # PAYPAL/direct
460
513
  ###############################################
461
- let(:new_payin_paypal_direct) do
462
- MangoPay::PayIn::PayPal::Direct.create(
514
+ let(:new_payin_paypal_web_v2) do
515
+ MangoPay::PayIn::PayPal::Web.create_v2(
463
516
  AuthorId: new_natural_user['Id'],
464
517
  DebitedFunds: { Currency: 'EUR', Amount: 400 },
465
518
  Fees: { Currency: 'EUR', Amount: 0 },
@@ -584,6 +637,27 @@ shared_context 'payins' do
584
637
  )
585
638
  end
586
639
 
640
+ def create_card_validation(author_id, card_id)
641
+ params = {
642
+ AuthorId: author_id,
643
+ SecureModeReturnURL: "https://mangopay.com",
644
+ IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C",
645
+ Tag: "custom meta",
646
+ BrowserInfo: {
647
+ AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
648
+ JavaEnabled: true,
649
+ Language: "FR-FR",
650
+ ColorDepth: 4,
651
+ ScreenHeight: 1800,
652
+ ScreenWidth: 400,
653
+ JavascriptEnabled: true,
654
+ TimeZoneOffset: "+60",
655
+ UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
656
+ }
657
+ }
658
+ MangoPay::Card.validate(card_id, params)
659
+ end
660
+
587
661
  ###############################################
588
662
  # pre-authorized direct deposit
589
663
  ###############################################
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.15.0
4
+ version: 3.16.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-07-07 00:00:00.000000000 Z
12
+ date: 2023-09-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -130,16 +130,18 @@ 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/payin_mbway_direct_spec.rb
139
+ - spec/mangopay/payin_mbway_web_spec.rb
140
+ - spec/mangopay/payin_multibanco_web_spec.rb
139
141
  - spec/mangopay/payin_payconiq_web_spec.rb
140
- - spec/mangopay/payin_paypal_direct_spec.rb
141
142
  - spec/mangopay/payin_paypal_web_spec.rb
142
143
  - spec/mangopay/payin_preauthorized_direct_spec.rb
144
+ - spec/mangopay/payin_satispay_web_spec.rb
143
145
  - spec/mangopay/payout_bankwire_spec.rb
144
146
  - spec/mangopay/preauthorization_spec.rb
145
147
  - spec/mangopay/recurring_payin_spec.rb
@@ -201,16 +203,18 @@ test_files:
201
203
  - spec/mangopay/payin_applepay_direct_spec.rb
202
204
  - spec/mangopay/payin_bankwire_direct_spec.rb
203
205
  - spec/mangopay/payin_bankwire_external_instruction_spec.rb
206
+ - spec/mangopay/payin_blik_web_spec.rb
204
207
  - spec/mangopay/payin_card_direct_spec.rb
205
208
  - spec/mangopay/payin_card_web_spec.rb
206
209
  - spec/mangopay/payin_directdebit_direct_spec.rb
207
210
  - spec/mangopay/payin_directdebit_web_spec.rb
208
211
  - spec/mangopay/payin_googlepay_direct_spec.rb
209
- - spec/mangopay/payin_mbway_direct_spec.rb
212
+ - spec/mangopay/payin_mbway_web_spec.rb
213
+ - spec/mangopay/payin_multibanco_web_spec.rb
210
214
  - spec/mangopay/payin_payconiq_web_spec.rb
211
- - spec/mangopay/payin_paypal_direct_spec.rb
212
215
  - spec/mangopay/payin_paypal_web_spec.rb
213
216
  - spec/mangopay/payin_preauthorized_direct_spec.rb
217
+ - spec/mangopay/payin_satispay_web_spec.rb
214
218
  - spec/mangopay/payout_bankwire_spec.rb
215
219
  - spec/mangopay/preauthorization_spec.rb
216
220
  - 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