mangopay 3.27.0 → 3.28.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: 9aacfa6dd021ce341e9f435dcca6b77eed14b6a85d9c9e4907bad599f4bcb313
4
- data.tar.gz: 22ad8f7d5179689c6841537d73729a4dd3430fb9cf42b9d9caca55658ef31be0
3
+ metadata.gz: cc9a455fb7af8971bada1a74b9bd9b95e1eeffcb0c564ff8730e545328a176e5
4
+ data.tar.gz: 988e0bcd0efcdf4b606fd5702b14b057e20e074629bb131b6bd0a9ba3bf8e7db
5
5
  SHA512:
6
- metadata.gz: da2fa47b3367011d9c7ead37af5646aea23ef4b2fab2fb6859ce770a913774d601e7b9b22877ede7709735a502667f626e154aeb10d3637e4dd650fe46029b2d
7
- data.tar.gz: afb180e3d2040d91e9827cce7eba960332d6132a316924dcbea3e6aafa990ab7139262abaad98ea9d53c70ada3d43e865b6b91afc849443ef6c319b05fd3345b
6
+ metadata.gz: 0a12f03e94a555fec121e7eadc4d594a49d9a0398c78629fee555c8e9361569a33f9eed5998b0872474cf92ffcd617a6f0ac7d5412e4d934208480baf4c17c0d
7
+ data.tar.gz: 6cdbbc86797db65b537fd839015e4c7cfec85e5cea26c42a53bfe8856dbbc3b6857dc78aa0d6a43a47a0010eb587597ca32c7288a529d51a8ef5419df2b624ac
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## [3.28.0] - 2024-11-15
2
+ ### Added
3
+
4
+ New endpoint for [The TWINT PayIn object](https://docs.mangopay.com/api-reference/twint/twint-payin-object#the-twint-payin-object):
5
+ - [Create a TWINT PayIn](https://docs.mangopay.com/api-reference/twint/create-twint-payin)
6
+ - [View a PayIn (TWINT)](https://docs.mangopay.com/api-reference/twint/view-payin-twint)
7
+
8
+ New endpoint for [The Swish PayIn object](https://docs.mangopay.com/api-reference/swish/swish-payin-object):
9
+ - [Create a Swish PayIn](https://docs.mangopay.com/api-reference/swish/create-swish-payin)
10
+ - [View a PayIn (Swish)](https://docs.mangopay.com/api-reference/swish/view-payin-swish)
11
+
1
12
  ## [3.27.0] - 2024-10-29
2
13
  ### Added
3
14
 
@@ -243,6 +243,26 @@ module MangoPay
243
243
  end
244
244
  end
245
245
 
246
+ module Twint
247
+ class Web < Resource
248
+ include HTTPCalls::Create
249
+
250
+ def self.url(*)
251
+ "#{MangoPay.api_path}/payins/payment-methods/twint"
252
+ end
253
+ end
254
+ end
255
+
256
+ module Swish
257
+ class Web < Resource
258
+ include HTTPCalls::Create
259
+
260
+ def self.url(*)
261
+ "#{MangoPay.api_path}/payins/payment-methods/swish"
262
+ end
263
+ end
264
+ end
265
+
246
266
  module RecurringPayments
247
267
  class Recurring < Resource
248
268
  include HTTPCalls::Create
@@ -1,3 +1,3 @@
1
1
  module MangoPay
2
- VERSION = '3.27.0'
2
+ VERSION = '3.28.0'
3
3
  end
@@ -0,0 +1,30 @@
1
+ describe MangoPay::PayIn::Swish::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('SWISH')
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 swish web payin' do
15
+ created = new_payin_swish_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_swish_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,30 @@
1
+ describe MangoPay::PayIn::Twint::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('TWINT')
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 twint web payin' do
15
+ created = new_payin_twint_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_twint_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
@@ -83,6 +83,15 @@ shared_context 'wallets' do
83
83
  )
84
84
  end
85
85
 
86
+ def create_new_custom_wallet(user, currency)
87
+ MangoPay::Wallet.create(
88
+ Owners: [user['Id']],
89
+ Description: 'A test wallet',
90
+ Currency: currency,
91
+ Tag: 'Test wallet'
92
+ )
93
+ end
94
+
86
95
  def wallets_check_amounts(wlt1, amnt1, wlt2 = nil, amnt2 = nil)
87
96
  expect(wlt1['Balance']['Amount']).to eq amnt1
88
97
  expect(wlt2['Balance']['Amount']).to eq amnt2 if wlt2
@@ -570,6 +579,36 @@ shared_context 'payins' do
570
579
  )
571
580
  end
572
581
 
582
+ ###############################################
583
+ # Twint/web
584
+ ###############################################
585
+ let(:new_payin_twint_web) do
586
+ MangoPay::PayIn::Twint::Web.create(
587
+ AuthorId: new_natural_user['Id'],
588
+ CreditedWalletId: create_new_custom_wallet(new_natural_user, 'CHF')['Id'],
589
+ DebitedFunds: { Currency: 'CHF', Amount: 50 },
590
+ Fees: { Currency: 'CHF', Amount: 10 },
591
+ ReturnURL: 'http://www.my-site.com/returnURL',
592
+ StatementDescriptor: "test",
593
+ Tag: 'Test PayIn/Twint/Web'
594
+ )
595
+ end
596
+
597
+ ###############################################
598
+ # Swish/web
599
+ ###############################################
600
+ let(:new_payin_swish_web) do
601
+ MangoPay::PayIn::Swish::Web.create(
602
+ AuthorId: new_natural_user['Id'],
603
+ CreditedWalletId: create_new_custom_wallet(new_natural_user, 'SEK')['Id'],
604
+ DebitedFunds: { Currency: 'SEK', Amount: 400 },
605
+ Fees: { Currency: 'SEK', Amount: 10 },
606
+ ReturnURL: 'http://www.my-site.com/returnURL',
607
+ StatementDescriptor: "test",
608
+ Tag: 'Test PayIn/Swish/Web'
609
+ )
610
+ end
611
+
573
612
  ###############################################
574
613
  # PAYPAL/web V2
575
614
  ###############################################
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.27.0
4
+ version: 3.28.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: 2024-10-29 00:00:00.000000000 Z
12
+ date: 2024-11-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -150,6 +150,8 @@ files:
150
150
  - spec/mangopay/payin_paypal_web_spec.rb
151
151
  - spec/mangopay/payin_preauthorized_direct_spec.rb
152
152
  - spec/mangopay/payin_satispay_web_spec.rb
153
+ - spec/mangopay/payin_swish_web_spec.rb
154
+ - spec/mangopay/payin_twint_web_spec.rb
153
155
  - spec/mangopay/payment_method_metadata_spec.rb
154
156
  - spec/mangopay/payout_bankwire_spec.rb
155
157
  - spec/mangopay/preauthorization_spec.rb
@@ -230,6 +232,8 @@ test_files:
230
232
  - spec/mangopay/payin_paypal_web_spec.rb
231
233
  - spec/mangopay/payin_preauthorized_direct_spec.rb
232
234
  - spec/mangopay/payin_satispay_web_spec.rb
235
+ - spec/mangopay/payin_swish_web_spec.rb
236
+ - spec/mangopay/payin_twint_web_spec.rb
233
237
  - spec/mangopay/payment_method_metadata_spec.rb
234
238
  - spec/mangopay/payout_bankwire_spec.rb
235
239
  - spec/mangopay/preauthorization_spec.rb