mangopay 3.39.1 → 3.40.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: a4c2003d85e74cce6405114e6b2bb1951ff8dc5f2b192b93d72e58818d73384a
4
- data.tar.gz: e1843f824d66bf29919284dff8564b47bde5e9f98d5b78528c3249fc8238a580
3
+ metadata.gz: a00bf00099f0f11432b94342e5c0d8a2b6ad7e6d2d1faead123624685d60f1e5
4
+ data.tar.gz: d1b6aa8272cf91db8e456652c8e6da8a1004534a23d664ec245d22a07e80e2f5
5
5
  SHA512:
6
- metadata.gz: 40a8c923ddb2552df9f374ae06619154fad6343b8ee0eaf468c20aecd27a1c6a28cede96d21aab6ef0516fbd25d4e53cb3f67db74ce7166203f6f9b5c16e64ae
7
- data.tar.gz: 371a822b8dcff55c874229dcac58688065944422ee834e38769be7bde7e56d926f03a1b0cefc5fc9facf6255a32ff8fb93383d7903a979ec4f3e29ecc9f634d8
6
+ metadata.gz: c6c2f7f2bfb84e5127248b1e15e058fc5badd8600abe1193766bf114c4894ef9f2378b43720c9870102b9b9577b550e028df7a2f83d1c14dc3900176fb7d9683
7
+ data.tar.gz: 9e99f71081327534e55c5bf1d6a32aaa37b1db8b958604976cb42c22e2cc2e0e3294c5f8848a0b9d7a3d3da8022019d87712e19b7cc0b5bca3eddfa6bdd1c498
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [3.40.0] - 2025-08-07
2
+ ### Added
3
+ Support for new Splits endpoints for Echo (#294 , [API release note](https://docs.mangopay.com/release-notes/api/2025-07-16)):
4
+ - [PUT Update a Split of an Intent](https://docs.mangopay.com/api-reference/intents/update-intent-split)
5
+ - [POST Execute a Split of an Intent](https://docs.mangopay.com/api-reference/intents/execute-intent-split)
6
+ - [POST Reverse the Split of an Intent](https://docs.mangopay.com/api-reference/intents/reverse-intent-split)
7
+ - [GET View a Split of an Intent](https://docs.mangopay.com/api-reference/intents/view-intent-split)
8
+
9
+ New `ReportTypes` for Echo (#295, [API release note](https://docs.mangopay.com/release-notes/api/2025-08-06))):
10
+ - `ECHO_INTENT`
11
+ - `ECHO_INTENT_ACTION`
12
+ - `ECHO_SETTLEMENT`
13
+ - `ECHO_SPLIT`
14
+
1
15
  ## [3.39.1] - 2025-07-28
2
16
  ### Added
3
17
  - 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
@@ -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.0'
3
3
  end
@@ -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.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: 2025-07-28 00:00:00.000000000 Z
12
+ date: 2025-08-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json