mangopay 3.39.1 → 3.40.1

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: a4c2003d85e74cce6405114e6b2bb1951ff8dc5f2b192b93d72e58818d73384a
4
- data.tar.gz: e1843f824d66bf29919284dff8564b47bde5e9f98d5b78528c3249fc8238a580
3
+ metadata.gz: a1c8d67898ce4b5f2ab2bb30376ee664be4e12d8850574b57364f6fee62c2815
4
+ data.tar.gz: 64552c37742aaddcf2ac3c914ee9f9236bc46c0cd3fda4bf739d567b8e660719
5
5
  SHA512:
6
- metadata.gz: 40a8c923ddb2552df9f374ae06619154fad6343b8ee0eaf468c20aecd27a1c6a28cede96d21aab6ef0516fbd25d4e53cb3f67db74ce7166203f6f9b5c16e64ae
7
- data.tar.gz: 371a822b8dcff55c874229dcac58688065944422ee834e38769be7bde7e56d926f03a1b0cefc5fc9facf6255a32ff8fb93383d7903a979ec4f3e29ecc9f634d8
6
+ metadata.gz: d76edc12a1d0a945b31a410bb15b9da7a13353bffec96a27d703cf7fd8e5abade6895400bd0b2a989d4269ff6d97016cf3491148f958b9197f55a02167f113fc
7
+ data.tar.gz: 2979794bccedb3f9c1e14f3c6ea0bdcf94cff9db8d67538aff1c58095c83b3c9dbebe9587b0cc7309527467017f68497fd265e00ec77a4c7dc97e4e3e6ea97b9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ ## [3.40.1] - 2025-08-14
2
+ ### Added
3
+ - Support for [POST Create a Quoted Conversion between Client Wallets](https://docs.mangopay.com/api-reference/conversions/create-quoted-conversion-client-wallets) and [POST Create an Instant Conversion between Client Wallets](https://docs.mangopay.com/api-reference/conversions/create-instant-conversion-client-wallets) #297
4
+ - Support for [POST Create a Bank Wire to the Repudiation Wallet](https://docs.mangopay.com/api-reference/dispute-settlement/create-bank-wire-payin-to-repudiation-wallet) #299
5
+
6
+ ## [3.40.0] - 2025-08-07
7
+ ### Added
8
+ Support for new Splits endpoints for Echo (#294 , [API release note](https://docs.mangopay.com/release-notes/api/2025-07-16)):
9
+ - [PUT Update a Split of an Intent](https://docs.mangopay.com/api-reference/intents/update-intent-split)
10
+ - [POST Execute a Split of an Intent](https://docs.mangopay.com/api-reference/intents/execute-intent-split)
11
+ - [POST Reverse the Split of an Intent](https://docs.mangopay.com/api-reference/intents/reverse-intent-split)
12
+ - [GET View a Split of an Intent](https://docs.mangopay.com/api-reference/intents/view-intent-split)
13
+
14
+ New `ReportTypes` for Echo (#295, [API release note](https://docs.mangopay.com/release-notes/api/2025-08-06))):
15
+ - `ECHO_INTENT`
16
+ - `ECHO_INTENT_ACTION`
17
+ - `ECHO_SETTLEMENT`
18
+ - `ECHO_SPLIT`
19
+
1
20
  ## [3.39.1] - 2025-07-28
2
21
  ### Added
3
22
  - support for new endpoint [View supported banks for Pay by Bank](https://docs.mangopay.com/api-reference/pay-by-bank/view-supported-banks-pay-by-bank), to enable presentation of banks to user before Pay by Bank payment request
@@ -83,6 +83,10 @@ module MangoPay
83
83
  MangoPay.request(method, path, params)
84
84
  end
85
85
 
86
+ def create_bank_wire_direct_pay_in(params, idempotency_key = nil)
87
+ MangoPay.request(:post, url() + "/payins/bankwire/direct", params, {}, idempotency_key)
88
+ end
89
+
86
90
  end
87
91
  end
88
92
  end
@@ -34,6 +34,16 @@ module MangoPay
34
34
  url = "#{MangoPay.api_path}/conversions/quote/#{id}"
35
35
  MangoPay.request(:get, url, params)
36
36
  end
37
+
38
+ def create_client_wallets_quoted_conversion(params, idempotency_key = nil)
39
+ url = "#{MangoPay.api_path}/clients/conversions/quoted-conversion"
40
+ MangoPay.request(:post, url, params, {}, idempotency_key)
41
+ end
42
+
43
+ def create_client_wallets_instant_conversion(params, idempotency_key = nil)
44
+ url = "#{MangoPay.api_path}/clients/conversions/instant-conversion"
45
+ MangoPay.request(:post, url, params, {}, idempotency_key)
46
+ end
37
47
  end
38
48
  end
39
49
  end
@@ -383,6 +383,22 @@ module MangoPay
383
383
  def create(intent_id, params, idempotency_key = nil)
384
384
  MangoPay.request(:post, "#{MangoPay.api_path_v3}/payins/intents/#{intent_id}/splits", params, {}, idempotency_key)
385
385
  end
386
+
387
+ def execute(intent_id, split_id, idempotency_key = nil)
388
+ MangoPay.request(:post, "#{MangoPay.api_path_v3}/payins/intents/#{intent_id}/splits/#{split_id}/execute", {}, {}, idempotency_key)
389
+ end
390
+
391
+ def reverse(intent_id, split_id, idempotency_key = nil)
392
+ MangoPay.request(:post, "#{MangoPay.api_path_v3}/payins/intents/#{intent_id}/splits/#{split_id}/reverse", {}, {}, idempotency_key)
393
+ end
394
+
395
+ def get(intent_id, split_id)
396
+ MangoPay.request(:get, "#{MangoPay.api_path_v3}/payins/intents/#{intent_id}/splits/#{split_id}")
397
+ end
398
+
399
+ def update(intent_id, split_id, params)
400
+ MangoPay.request(:put, "#{MangoPay.api_path_v3}/payins/intents/#{intent_id}/splits/#{split_id}", params)
401
+ end
386
402
  end
387
403
  end
388
404
  end
@@ -1,3 +1,3 @@
1
1
  module MangoPay
2
- VERSION = '3.39.1'
2
+ VERSION = '3.40.1'
3
3
  end
@@ -192,4 +192,22 @@ describe MangoPay::Client do
192
192
  end
193
193
  end
194
194
 
195
+ describe 'create payin bankwire direct' do
196
+ it 'creates the payin' do
197
+ dto = {
198
+ "CreditedWalletId": "CREDIT_EUR",
199
+ "DeclaredDebitedFunds": {
200
+ "Currency": "EUR",
201
+ "Amount": 1000
202
+ }
203
+ }
204
+ created = MangoPay::Client.create_bank_wire_direct_pay_in(dto)
205
+ expect(created).not_to be_nil
206
+ expect(created['Id']).not_to be_nil
207
+ expect(created['Type']).to eq('PAYIN')
208
+ expect(created['Status']).to eq('CREATED')
209
+ expect(created['PaymentType']).to eq('BANK_WIRE')
210
+ expect(created['ExecutionType']).to eq('DIRECT')
211
+ end
212
+ end
195
213
  end
@@ -31,6 +31,38 @@ describe MangoPay::Conversion, type: :feature do
31
31
  end
32
32
  end
33
33
 
34
+ describe 'CREATE QUOTED CONVERSION BETWEEN CLIENT WALLETS' do
35
+ it 'creates a new quoted conversion' do
36
+ quote = create_conversion_quote
37
+
38
+ conversion = MangoPay::Conversion.create_client_wallets_quoted_conversion(
39
+ QuoteId: quote['Id'],
40
+ CreditedWalletType: 'CREDIT',
41
+ DebitedWalletType: 'FEES'
42
+ )
43
+
44
+ expect(conversion['Status']).equal? 'SUCCEEDED'
45
+ end
46
+ end
47
+
48
+ describe 'CREATE INSTANT CONVERSION BETWEEN CLIENT WALLETS' do
49
+ it 'creates a new quoted conversion' do
50
+ conversion = MangoPay::Conversion.create_client_wallets_instant_conversion(
51
+ CreditedWalletType: 'FEES',
52
+ DebitedWalletType: 'FEES',
53
+ DebitedFunds: {
54
+ Currency: 'GBP',
55
+ Amount: 79
56
+ },
57
+ CreditedFunds: {
58
+ Currency: 'EUR'
59
+ }
60
+ )
61
+
62
+ expect(conversion['Status']).equal? 'SUCCEEDED'
63
+ end
64
+ end
65
+
34
66
  describe 'GET EXISTING CONVERSION' do
35
67
  it 'get an existing conversion' do
36
68
  conversion = create_instant_conversion
@@ -75,31 +75,77 @@ describe MangoPay::PayIn::PayInIntent, type: :feature do
75
75
  # end
76
76
  # end
77
77
 
78
- describe 'CREATE SPLITS' do
78
+ describe 'SPLITS' do
79
79
  it 'creates a split' do
80
80
  intent = new_payin_intent_authorization
81
- full_capture = {
82
- "ExternalData": {
83
- "ExternalProcessingDate": "01-10-2029",
84
- "ExternalProviderReference": SecureRandom.uuid,
85
- "ExternalMerchantReference": "Order-xyz-35e8490e-2ec9-4c82-978e-c712a3f5ba16",
86
- "ExternalProviderName": "Stripe",
87
- "ExternalProviderPaymentMethod": "PAYPAL"
88
- }
89
- }
90
- MangoPay::PayIn::PayInIntent::Capture.create(intent['Id'], full_capture)
91
- split = {
92
- "Splits": [
93
- {
94
- "LineItemId": intent['LineItems'][0]['Id'],
95
- "SplitAmount": 10
96
- }
97
- ]
98
- }
99
- created = MangoPay::PayIn::PayInIntent::Split.create(intent['Id'], split)
81
+ created = create_new_splits(intent)
100
82
  expect(created['Splits']).to be_kind_of(Array)
101
83
  expect(created['Splits']).not_to be_empty
102
84
  expect(created['Splits'][0]['Status']).to eq('CREATED')
103
85
  end
86
+
87
+ it 'executes split' do
88
+ intent = new_payin_intent_authorization
89
+ split = create_new_splits(intent)['Splits'][0]
90
+ expect {
91
+ MangoPay::PayIn::PayInIntent::Split.execute(intent['Id'], split['Id'])
92
+ }.to raise_error { |err|
93
+ expect(err).to be_a MangoPay::ResponseError
94
+ expect(err.code).to eq '400'
95
+ expect(err.details['Type']).to eq 'param_error'
96
+ }
97
+ end
98
+
99
+ it 'reverses split' do
100
+ intent = new_payin_intent_authorization
101
+ split = create_new_splits(intent)['Splits'][0]
102
+ expect {
103
+ MangoPay::PayIn::PayInIntent::Split.reverse(intent['Id'], split['Id'])
104
+ }.to raise_error { |err|
105
+ expect(err).to be_a MangoPay::ResponseError
106
+ expect(err.code).to eq '400'
107
+ expect(err.details['Type']).to eq 'param_error'
108
+ }
109
+ end
110
+
111
+ it 'fetches split' do
112
+ intent = new_payin_intent_authorization
113
+ split = create_new_splits(intent)['Splits'][0]
114
+ fetched = MangoPay::PayIn::PayInIntent::Split.get(intent['Id'], split['Id'])
115
+ expect(fetched['Status']).to eq('CREATED')
116
+ end
117
+
118
+ it 'updates split' do
119
+ intent = new_payin_intent_authorization
120
+ split = create_new_splits(intent)['Splits'][0]
121
+ params = {
122
+ LineItemId: split['LineItemId'],
123
+ Description: 'updated split'
124
+ }
125
+ updated = MangoPay::PayIn::PayInIntent::Split.update(intent['Id'], split['Id'], params)
126
+ expect(updated['Description']).to eq('updated split')
127
+ end
128
+ end
129
+
130
+ def create_new_splits(intent)
131
+ full_capture = {
132
+ "ExternalData": {
133
+ "ExternalProcessingDate": "01-10-2029",
134
+ "ExternalProviderReference": SecureRandom.uuid,
135
+ "ExternalMerchantReference": "Order-xyz-35e8490e-2ec9-4c82-978e-c712a3f5ba16",
136
+ "ExternalProviderName": "Stripe",
137
+ "ExternalProviderPaymentMethod": "PAYPAL"
138
+ }
139
+ }
140
+ MangoPay::PayIn::PayInIntent::Capture.create(intent['Id'], full_capture)
141
+ split = {
142
+ "Splits": [
143
+ {
144
+ "LineItemId": intent['LineItems'][0]['Id'],
145
+ "SplitAmount": 10
146
+ }
147
+ ]
148
+ }
149
+ return MangoPay::PayIn::PayInIntent::Split.create(intent['Id'], split)
104
150
  end
105
151
  end
@@ -73,7 +73,7 @@ describe MangoPay::PayIn::RecurringPayments, type: :feature do
73
73
  expect(cit).not_to be_nil
74
74
 
75
75
  update = MangoPay::PayIn::RecurringPayments::Recurring.update(id, {
76
- Status: 'Ended'
76
+ Status: 'ENDED'
77
77
  })
78
78
 
79
79
  expect(update).not_to be_nil
@@ -17,10 +17,90 @@ describe MangoPay::ReportV2 do
17
17
  expect(created['Id']).to_not be_nil
18
18
  expect(created['Status']).to eq("PENDING")
19
19
  end
20
+
21
+ it 'creates an intent report' do
22
+ params = {
23
+ "DownloadFormat": "CSV",
24
+ "ReportType": "ECHO_INTENT",
25
+ "AfterDate": 1748782023,
26
+ "BeforeDate": 1753102013,
27
+ "Filters": {
28
+ "PaymentMethod": "PAYPAL",
29
+ "Status": "CAPTURED",
30
+ "Type": "PAYIN"
31
+ },
32
+ "Columns": %w[Id Status Amount Currency FeesAmount FeesCurrency Type PaymentMethod BuyerId SellerId]
33
+ }
34
+
35
+ created = MangoPay::ReportV2.create(params)
36
+ expect(created['Id']).to_not be_nil
37
+ expect(created['Status']).to eq("PENDING")
38
+ expect(created['ReportType']).to eq("ECHO_INTENT")
39
+ end
40
+
41
+ it 'creates an intent actions report' do
42
+ params = {
43
+ "DownloadFormat": "CSV",
44
+ "ReportType": "ECHO_INTENT_ACTION",
45
+ "AfterDate": 1748782023,
46
+ "BeforeDate": 1753102013,
47
+ "Filters": {
48
+ "PaymentMethod": "PAYPAL",
49
+ "Status": "CAPTURED",
50
+ "Type": "PAYIN"
51
+ },
52
+ "Columns": %w[IntentId Id ExternalProcessingDate ExternalProviderReference ExternalMerchantReference Status Amount Currency FeesAmount FeesCurrency Type PaymentMethod BuyerId SellerId]
53
+ }
54
+
55
+ created = MangoPay::ReportV2.create(params)
56
+ expect(created['Id']).to_not be_nil
57
+ expect(created['Status']).to eq("PENDING")
58
+ expect(created['ReportType']).to eq("ECHO_INTENT_ACTION")
59
+ end
60
+
61
+ it 'creates settlement report' do
62
+ params = {
63
+ "Tag": "Creating a report using new Mangopay system",
64
+ "DownloadFormat": "CSV",
65
+ "ReportType": "ECHO_SETTLEMENT",
66
+ "AfterDate": 1748782023,
67
+ "BeforeDate": 1753102013,
68
+ "Filters": {
69
+ "Status": "RECONCILED",
70
+ "ExternalProviderName": "PAYPAL"
71
+ },
72
+ "Columns": %w[Id CreationDate FileName SettlementCurrency Status SettledTransactionCount UnsettledTransactionCount SettledAmount DeclaredAmount DeficitAmount]
73
+ }
74
+
75
+ created = MangoPay::ReportV2.create(params)
76
+ expect(created['Id']).to_not be_nil
77
+ expect(created['Status']).to eq("PENDING")
78
+ expect(created['ReportType']).to eq("ECHO_SETTLEMENT")
79
+ end
20
80
  end
21
81
 
22
- describe 'GET' do
82
+ it 'creates split report' do
83
+ params = {
84
+ "Tag": "Creating a report using new Mangopay system",
85
+ "DownloadFormat": "CSV",
86
+ "ReportType": "ECHO_SPLIT",
87
+ "AfterDate": 1748782023,
88
+ "BeforeDate": 1753102013,
89
+ "Filters": {
90
+ "Status": "COMPLETED",
91
+ "IntentId": "int_0197f975-63f6-714e-8fc6-4451e128170f",
92
+ "Scheduled": false
93
+ },
94
+ "Columns": %w[Id IntentId AuthorId Amount Currency FeesAmount FeesCurrency Status Description CreditedWalletId DebitedWalletId Scheduled CreationDate ExecutionDate]
95
+ }
96
+
97
+ created = MangoPay::ReportV2.create(params)
98
+ expect(created['Id']).to_not be_nil
99
+ expect(created['Status']).to eq("PENDING")
100
+ expect(created['ReportType']).to eq("ECHO_SPLIT")
101
+ end
23
102
 
103
+ describe 'GET' do
24
104
  it 'gets a report' do
25
105
  created = create
26
106
  fetched = MangoPay::ReportV2.get(created['Id'])
@@ -32,7 +112,6 @@ describe MangoPay::ReportV2 do
32
112
  expect(reports).to be_kind_of(Array)
33
113
  expect(reports).not_to be_empty
34
114
  end
35
-
36
115
  end
37
116
 
38
117
  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.39.1
4
+ version: 3.40.1
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-07-28 00:00:00.000000000 Z
12
+ date: 2025-08-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json