mangopay 3.35.1 → 3.37.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: 15264b27e3c6d9543eb22df8793bb0fb37870aa19d6c12c5d9c41f7ae3e37f7a
4
- data.tar.gz: 8333f909cf729a462acd645a4b68aa03a048a6490fe16881eb675a818e25a0c8
3
+ metadata.gz: ab053280c45aa0899adbc045b9448a52439934da351049f226ebd2eb1815354b
4
+ data.tar.gz: e9abd7fadd084609d8820bd1147baa2ca12a3ccc4bc52cb559441d3af259c61f
5
5
  SHA512:
6
- metadata.gz: 2522a4843d777f4db554b7df2ab8c331d592155288fd641deaf17e19de28e426df70eeca7041e8007c9732aae4663c1fe93677d1c9a71fcb8244b7b8cf766490
7
- data.tar.gz: 607684d9029548a5798d1274938f74d8c0fad61591d3ca68bf56a8a90247741d475a34ddb0dbe06c20def8f06810d6d3cdd6ceb47a75221086baf480cb30ec3b
6
+ metadata.gz: 7f418382b075cee36e01da7c7e6b766d6538561c082a78ba7c7f31dad0998f0deb77dccfffe7088530183ad80aaac85fe509452192f5564abebb840d404078e0
7
+ data.tar.gz: 36d54dd71d50dab4a573e0c06775a902471d24e904c0b6621634677309e4115f6e2d631ccde8e8b08525ad80f2acbb7342d9a0e330d0ff1768059f0a8b86d306
data/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ ## [3.37.0] - 2025-06-24
2
+ ### Changed
3
+ - `multi_json` library version updated to 1.15.0 (latest, release 2020) to enable compatibility with later versions of Ruby
4
+
5
+ > ⚠️ **Caution - Breaking change**
6
+ >
7
+ > If you use version 1.7.7 (2013) of the `multi_json` [gem](https://rubygems.org/gems/multi_json/versions/1.15.0) in your project, you need to update to 1.15.0 to use this version v3.37.0 of the Mangopay Ruby SDK
8
+
9
+ ## [3.36.0] - 2025-06-24
10
+ ### Added
11
+
12
+ [New Reporting Service](https://docs.mangopay.com/release-notes/api/2025-06-05) endpoints (#287 ):
13
+ - [POST Create a Report](https://docs.mangopay.com/api-reference/reporting/create-report)
14
+ - [GET View a Report](https://docs.mangopay.com/api-reference/reporting/view-report)
15
+ - [GET List all Reports](https://docs.mangopay.com/api-reference/reporting/list-reports)
16
+
17
+ Support for:
18
+ - [GET List Disputes for a PayIn](https://docs.mangopay.com/api-reference/disputes/list-disputes-payin) (#287)
19
+ - [GET List Transactions for a Card Fingerprint](https://docs.mangopay.com/api-reference/transactions/list-transactions-card-fingerprint) (#289)
20
+
1
21
  ## [3.35.1] - 2025-06-05
2
22
  ### Added
3
23
  - Support for `RecipientScope` query parameter on [GET List Recipients for a User](https://docs.mangopay.com/api-reference/recipients/list-recipients-user)
data/README.md CHANGED
@@ -1,33 +1,25 @@
1
- # Mangopay Ruby SDK [![Build Status](https://travis-ci.org/Mangopay/mangopay2-ruby-sdk.svg?branch=master)](https://travis-ci.org/Mangopay/mangopay2-ruby-sdk)
1
+ # Mangopay Ruby SDK
2
2
 
3
- The gem for interacting with the version 2 of the Mangopay API.
4
- See the [API documentation](http://docs.mangopay.com/api-references/)
5
- for more details on the API.
3
+ [![Gem Version](https://badge.fury.io/rb/mangopay.svg)](https://rubygems.org/gems/mangopay)
6
4
 
7
- Tested on the following versions of Ruby: 1.9.2, 1.9.3, 2.0.0 and 2.x up to 2.5
5
+ Official [Mangopay Gem](https://rubygems.org/gems/mangopay) to access the [Mangopay API](https://docs.mangopay.com/api-reference) from applications written in Ruby.
8
6
 
9
- ## NEWS
7
+ See the [Mangopay API documentation](https://docs.mangopay.com/) for Ruby samples and details on product features. See the [SDK tests](#tests) for further usage examples.
10
8
 
11
- ### Version 3.*
12
- **BREAKING CHANGES:** This version (3.\*) of the gem is targeting the Mangopay API Version 2. It has a brand new structure to make the api calls easier to use and is not backward compatible with 2.\* series.
9
+ ## Prerequisites
10
+ - * A `ClientId` and an API key if you don't have these, <a href="https://mangopay.com/contact" target="_blank">contact Sales</a> to get access to the <a href="https://hub.mangopay.com/" target="_blank">Mangopay Dashboard</a>
11
+ - Ruby 1.9.2 or higher (tested from 1.9.2 up to 3.4.4)
13
12
 
14
- Since [v3.0.17](https://github.com/Mangopay/mangopay2-ruby-sdk/releases/tag/v3.0.17) of the SDK, you must be using at least v2.01 of the API (more information about the changes required [here](https://docs.mangopay.com/api-v2-01-overview/))
13
+ Since SDK [v3.0.17](https://github.com/Mangopay/mangopay2-ruby-sdk/releases/tag/v3.0.17), the library uses v2.01 of the API. The older API version (v2) is no longer available.
15
14
 
16
- Account creation
17
- -------------------------------------------------
18
- You can get yourself a free sandbox account or sign up for a production account by [registering on the Mangopay site](https://www.mangopay.com/start/) (note that validation of your production account involves several steps, so think about doing it in advance of when you actually want to go live).
19
-
20
- ## Usage
21
-
22
- ### Install
23
- * You can get yourself a free sandbox account or sign up for a production account [on the Mangopay site](https://www.mangopay.com/start/) (note that validation of your production account will involve several steps, so think about doing it in advance of when you actually want to go live).
15
+ ## Installation
24
16
 
25
17
  * Install the gem by either running ```gem install mangopay```
26
18
  or by adding it to your Gemfile ```gem 'mangopay'```
27
19
 
28
- * Using the credential info from the signup process above, call ```MangoPay.configure``` in your script as shown in the snippet below.
20
+ * Call ```MangoPay.configure``` in your script as shown in the snippet below.
29
21
 
30
- ### Examples
22
+ ### Usage
31
23
 
32
24
  ```ruby
33
25
  require 'mangopay'
@@ -85,8 +77,8 @@ rescue MangoPay::ResponseError => ex
85
77
  end
86
78
  ```
87
79
 
88
- ### Using multiple clientIDs
89
- You can effortlessly create multiple configuration objects tailored to your specific needs:
80
+ ### Using multiple Client IDs
81
+ The Ruby SDK offers the option to create multiple configuration objects tailored to your specific needs:
90
82
 
91
83
  ```
92
84
  config = MangoPay::Configuration.new
@@ -94,18 +86,19 @@ config.client_id = 'your-client-id'
94
86
  config.client_apiKey = 'your-api-key'
95
87
  config.preproduction = true
96
88
  ```
97
- add them using :
89
+
90
+ Add them using:
98
91
 
99
92
  `MangoPay.add_config('config1', config)`
100
93
 
101
- and perform a call with them using :
94
+ And perform a call with them using:
102
95
 
103
96
  `MangoPay.get_config('config1').apply_configuration`
104
97
 
105
- The previous method configure() is still working.
98
+ The previous method `configure()` is still working.
106
99
 
107
- ### Accessing RateLimit Headers
108
- Along with each request, the rate limiting headers are automatically updated in MangoPay object:
100
+ ### Accessing rate limiting headers
101
+ The API returns rate limiting headers which are automatically updated in the `MangoPay` object:
109
102
 
110
103
  * X-RateLimit-Limit
111
104
  * X-RateLimit-Remaining
@@ -121,18 +114,28 @@ Along with each request, the rate limiting headers are automatically updated in
121
114
  }
122
115
  ```
123
116
 
124
- Read more about rate limiting on [our documentation](https://docs.mangopay.com/guide/rate-limiting).
117
+ For more information, see the [rate limiting](https://docs.mangopay.com/api-reference/overview/rate-limiting) article on the Mangopay docs.
125
118
 
126
119
  ### Log requests and responses
127
- You can easily enable logs by setting the ```log_file``` configuration option (see the section **configuration** above). If you don't want logs, remove the ```log_file``` line.
120
+ You can enable logs by setting the ```log_file``` configuration option (see [usage](#usage) above). If you don't want logs, remove the ```log_file``` line.
128
121
 
129
122
  Requests and responses are filtered, so confidential data is not saved in logs.
130
123
 
131
124
  ### Tests
132
- Make sure that you have run: ```bundle install```
133
- Then you just have to run rspec ```rspec``` to run all the test suite.
134
- Feel free to report any test failure by creating an issue
135
- on the [Gem's Github](https://github.com/Mangopay/mangopay2-ruby-sdk/issues)
125
+ Make sure that you have run:
126
+ ```
127
+ bundle install
128
+ ```
129
+ Then to run the test suite, run:
130
+ ```
131
+ rspec
132
+ ```
133
+
134
+ ## Issues
135
+
136
+ Create a [GitHub issue](https://github.com/Mangopay/mangopay2-ruby-sdk/issues) to report any problems or request features.
137
+
138
+ We aim to reply to issues and contributions in a timely manner. For additional followup or anything that can't be shared over GitHub, please get in touch with our Support teams via the <a href="https://hub.mangopay.com/" target="_blank">Mangopay Dashboard</a>.
136
139
 
137
140
  ## Contributing
138
141
 
@@ -149,10 +152,6 @@ a test!
149
152
 
150
153
  5. Push to your fork and submit a pull request.
151
154
 
152
- At this point you're waiting on us. We like to at least comment on, if not
153
- accept, pull requests within three business days (and, typically, one business
154
- day). We may suggest some changes or improvements or alternatives.
155
-
156
155
  Syntax:
157
156
 
158
157
  * Two spaces, no tabs.
@@ -160,9 +159,4 @@ Syntax:
160
159
  * Prefer &&/|| over and/or.
161
160
  * MyClass.my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
162
161
  * a = b and not a=b.
163
- * Follow the conventions you see used in the source already.
164
-
165
- A contribution can also be as simple as a +1 on issues tickets to show us
166
- what you would like to see in this gem.
167
-
168
- That's it for now. Good Hacking...
162
+ * Follow the conventions you see used in the source already.
data/lib/mangopay/card.rb CHANGED
@@ -45,6 +45,10 @@ module MangoPay
45
45
  url = "#{MangoPay.api_path}/cards/#{card_id}/validation/#{validation_id}"
46
46
  MangoPay.request(:get, url)
47
47
  end
48
+
49
+ def get_transactions_by_fingerprint(fingerprint, filters = {})
50
+ MangoPay.request(:get, "#{fingerprint_url(fingerprint)}/transactions", {}, filters)
51
+ end
48
52
  end
49
53
  end
50
54
  end
@@ -40,6 +40,11 @@ module MangoPay
40
40
  MangoPay.request(:get, url, {}, filters)
41
41
  end
42
42
 
43
+ def fetch_for_pay_in(pay_in_id, filters = {})
44
+ url = "#{MangoPay.api_path}/payins/#{pay_in_id}/disputes"
45
+ MangoPay.request(:get, url, {}, filters)
46
+ end
47
+
43
48
  def fetch_pending_settlement(filters = {})
44
49
  url = "#{MangoPay.api_path}/disputes/pendingsettlement"
45
50
  MangoPay.request(:get, url, {}, filters)
@@ -0,0 +1,21 @@
1
+ module MangoPay
2
+
3
+ # See https://docs.mangopay.com/endpoints/v2.01/reporting
4
+ class ReportV2 < Resource
5
+
6
+ class << self
7
+ def create(params, idempotency_key = nil)
8
+ MangoPay.request(:post, "#{MangoPay.api_path}/reporting/reports", params, {}, idempotency_key)
9
+ end
10
+
11
+ def get(id)
12
+ MangoPay.request(:get, "#{MangoPay.api_path}/reporting/reports/#{id}")
13
+ end
14
+
15
+ def get_all(params = nil)
16
+ MangoPay.request(:get, "#{MangoPay.api_path}/reporting/reports", params)
17
+ end
18
+
19
+ end
20
+ end
21
+ end
@@ -1,3 +1,3 @@
1
1
  module MangoPay
2
- VERSION = '3.35.1'
2
+ VERSION = '3.37.0'
3
3
  end
data/lib/mangopay.rb CHANGED
@@ -38,6 +38,7 @@ module MangoPay
38
38
  autoload :Dispute, 'mangopay/dispute'
39
39
  autoload :Mandate, 'mangopay/mandate'
40
40
  autoload :Report, 'mangopay/report'
41
+ autoload :ReportV2, 'mangopay/report_v2'
41
42
  autoload :JSON, 'mangopay/json'
42
43
  autoload :AuthorizationToken, 'mangopay/authorization_token'
43
44
  autoload :FilterParameters, 'mangopay/filter_parameters'
data/mangopay.gemspec CHANGED
@@ -18,10 +18,10 @@ Gem::Specification.new do |s|
18
18
 
19
19
  s.required_ruby_version = '>= 1.9.2'
20
20
 
21
- s.add_dependency('multi_json', '>= 1.7.7')
21
+ s.add_dependency('multi_json', '>= 1.15.0')
22
22
 
23
- s.add_development_dependency('rake', '>= 10.1.0')
24
- s.add_development_dependency('rspec', '>= 3.0.0')
23
+ s.add_development_dependency('rake', '>= 13.2.1')
24
+ s.add_development_dependency('rspec', '>= 3.13.0')
25
25
 
26
26
  s.files = `git ls-files`.split("\n")
27
27
  s.test_files = `git ls-files -- spec/*`.split("\n")
@@ -107,4 +107,17 @@ describe MangoPay::CardRegistration do
107
107
  expect(card_validation['Id']).equal? fetched_card_validation['Id']
108
108
  end
109
109
  end
110
+
111
+ describe 'Get transactions by card fingerprint' do
112
+ it 'retrieves list of transactions for a fingerprint' do
113
+ completed = new_card_registration_completed
114
+ card_id = completed['CardId']
115
+ card = MangoPay::Card.fetch(card_id)
116
+ fingerprint = card['Fingerprint']
117
+ result = MangoPay::Card.get_transactions_by_fingerprint(fingerprint)
118
+
119
+ expect(result).to be_kind_of(Array)
120
+ expect(result.count).to be > 0
121
+ end
122
+ end
110
123
  end
@@ -49,14 +49,17 @@ and it's infact not suitable like that
49
49
  expect(disputes).not_to be_empty
50
50
  end
51
51
  it 'fetches disputes for wallet' do
52
- dispute = @disputes.find {|disp| disp['InitialTransactionId'] != nil}
53
- expect(dispute).not_to be_nil, "Cannot test fetching disputes for wallet because there's no disputes with transaction ID in the disputes list."
54
- payin = MangoPay::PayIn.fetch(dispute['InitialTransactionId'])
52
+ payin = MangoPay::PayIn.fetch("133379281")
55
53
  wallet_id = payin['CreditedWalletId']
56
54
  disputes = MangoPay::Dispute.fetch_for_wallet(wallet_id, {'per_page' => 1})
57
55
  expect(disputes).to be_kind_of(Array)
58
56
  expect(disputes).not_to be_empty
59
57
  end
58
+ it 'fetches disputes for payin' do
59
+ disputes = MangoPay::Dispute.fetch_for_pay_in("133379281", {'per_page' => 1})
60
+ expect(disputes).to be_kind_of(Array)
61
+ expect(disputes).not_to be_empty
62
+ end
60
63
  end
61
64
 
62
65
  describe 'UPDATE' do
@@ -5,7 +5,7 @@ describe MangoPay::Recipient do
5
5
  it 'creates a new recipient' do
6
6
  recipient = new_recipient
7
7
  assert_recipient(recipient)
8
- expect(recipient['PendingUserAction']).not_to be_nil
8
+ expect(recipient['Status']).to eq('PENDING')
9
9
  end
10
10
  end
11
11
 
@@ -19,7 +19,7 @@ describe MangoPay::Recipient do
19
19
 
20
20
  describe 'GET User Recipients' do
21
21
  it 'fetches recipients without query param' do
22
- john = create_new_natural_user_sca_owner
22
+ john = create_new_natural_user_sca_payer
23
23
  create_new_recipient(john['Id'])
24
24
  fetched = MangoPay::Recipient.get_user_recipients(john['Id'])
25
25
  expect(fetched).not_to be_nil
@@ -28,7 +28,7 @@ describe MangoPay::Recipient do
28
28
  end
29
29
 
30
30
  it 'fetches recipients with scope PAYOUT' do
31
- john = create_new_natural_user_sca_owner
31
+ john = create_new_natural_user_sca_payer
32
32
  create_new_recipient(john['Id'])
33
33
  fetched = MangoPay::Recipient.get_user_recipients(john['Id'], {RecipientScope: "PAYOUT"})
34
34
  expect(fetched).not_to be_nil
@@ -37,7 +37,7 @@ describe MangoPay::Recipient do
37
37
  end
38
38
 
39
39
  it 'fetches recipients with scope PAYIN' do
40
- john = create_new_natural_user_sca_owner
40
+ john = create_new_natural_user_sca_payer
41
41
  create_new_recipient(john['Id'])
42
42
  fetched = MangoPay::Recipient.get_user_recipients(john['Id'], {RecipientScope: "PAYIN"})
43
43
  expect(fetched).not_to be_nil
@@ -92,7 +92,7 @@ describe MangoPay::Recipient do
92
92
  describe 'VALIDATE' do
93
93
  it 'validates a recipient' do
94
94
  recipient = define_new_recipient
95
- john = create_new_natural_user_sca_owner
95
+ john = create_new_natural_user_sca_payer
96
96
  # it should pass
97
97
  MangoPay::Recipient.validate(recipient, john['Id'])
98
98
 
@@ -0,0 +1,38 @@
1
+ describe MangoPay::ReportV2 do
2
+
3
+ def create
4
+ params = {
5
+ "Tag": "Created using the Mangopay API Postman collection",
6
+ "DownloadFormat": "CSV",
7
+ "ReportType": "COLLECTED_FEES",
8
+ "AfterDate": 1740787200,
9
+ "BeforeDate": 1743544740
10
+ }
11
+ MangoPay::ReportV2.create(params)
12
+ end
13
+
14
+ describe 'CREATE' do
15
+ it 'creates a report v2' do
16
+ created = create
17
+ expect(created['Id']).to_not be_nil
18
+ expect(created['Status']).to eq("PENDING")
19
+ end
20
+ end
21
+
22
+ describe 'GET' do
23
+
24
+ it 'gets a report' do
25
+ created = create
26
+ fetched = MangoPay::ReportV2.get(created['Id'])
27
+ expect(fetched['Id']).to eq(created['Id'])
28
+ end
29
+
30
+ it 'gets all the reports' do
31
+ reports = MangoPay::ReportV2.get_all
32
+ expect(reports).to be_kind_of(Array)
33
+ expect(reports).not_to be_empty
34
+ end
35
+
36
+ end
37
+
38
+ end
@@ -1273,7 +1273,7 @@ end
1273
1273
  shared_context 'recipient' do
1274
1274
  include_context 'users'
1275
1275
 
1276
- let(:new_recipient) { create_new_recipient(create_new_natural_user_sca_owner['Id']) }
1276
+ let(:new_recipient) { create_new_recipient(create_new_natural_user_sca_payer['Id']) }
1277
1277
 
1278
1278
  def create_new_recipient(user_id)
1279
1279
  MangoPay::Recipient.create(define_new_recipient, user_id)
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.35.1
4
+ version: 3.37.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-06-05 00:00:00.000000000 Z
12
+ date: 2025-06-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -17,42 +17,42 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 1.7.7
20
+ version: 1.15.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: 1.7.7
27
+ version: 1.15.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: 10.1.0
34
+ version: 13.2.1
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - ">="
40
40
  - !ruby/object:Gem::Version
41
- version: 10.1.0
41
+ version: 13.2.1
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rspec
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - ">="
47
47
  - !ruby/object:Gem::Version
48
- version: 3.0.0
48
+ version: 3.13.0
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: 3.0.0
55
+ version: 3.13.0
56
56
  description: |2
57
57
  The mangopay Gem makes interacting with MANGOPAY Services much easier.
58
58
  For any questions regarding the use of MANGOPAY's Services feel free to contact us at http://www.mangopay.com/get-started-2/
@@ -106,6 +106,7 @@ files:
106
106
  - lib/mangopay/refund.rb
107
107
  - lib/mangopay/regulatory.rb
108
108
  - lib/mangopay/report.rb
109
+ - lib/mangopay/report_v2.rb
109
110
  - lib/mangopay/resource.rb
110
111
  - lib/mangopay/transaction.rb
111
112
  - lib/mangopay/transfer.rb
@@ -166,6 +167,7 @@ files:
166
167
  - spec/mangopay/refund_spec.rb
167
168
  - spec/mangopay/regulatory_spec.rb
168
169
  - spec/mangopay/report_spec.rb
170
+ - spec/mangopay/report_v2_spec.rb
169
171
  - spec/mangopay/report_wallets_spec.rb
170
172
  - spec/mangopay/shared_resources.rb
171
173
  - spec/mangopay/transaction_spec.rb
@@ -251,6 +253,7 @@ test_files:
251
253
  - spec/mangopay/refund_spec.rb
252
254
  - spec/mangopay/regulatory_spec.rb
253
255
  - spec/mangopay/report_spec.rb
256
+ - spec/mangopay/report_v2_spec.rb
254
257
  - spec/mangopay/report_wallets_spec.rb
255
258
  - spec/mangopay/shared_resources.rb
256
259
  - spec/mangopay/transaction_spec.rb