mangopay 3.4.0 → 3.26.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.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby_cd.yml +34 -0
  3. data/.github/workflows/ruby_ci.yml +30 -0
  4. data/CHANGELOG.md +249 -4
  5. data/README.md +19 -0
  6. data/lib/mangopay/authorization_token.rb +1 -1
  7. data/lib/mangopay/bankingaliases_iban.rb +2 -2
  8. data/lib/mangopay/card.rb +10 -0
  9. data/lib/mangopay/client.rb +0 -5
  10. data/lib/mangopay/conversion.rb +39 -0
  11. data/lib/mangopay/deposit.rb +20 -0
  12. data/lib/mangopay/dispute.rb +2 -2
  13. data/lib/mangopay/errors.rb +2 -2
  14. data/lib/mangopay/filter_parameters.rb +7 -2
  15. data/lib/mangopay/pay_in.rb +150 -1
  16. data/lib/mangopay/pay_out.rb +11 -0
  17. data/lib/mangopay/payment_method_metadata.rb +13 -0
  18. data/lib/mangopay/refund.rb +1 -0
  19. data/lib/mangopay/regulatory.rb +22 -0
  20. data/lib/mangopay/ubo_declaration.rb +6 -4
  21. data/lib/mangopay/version.rb +1 -1
  22. data/lib/mangopay.rb +102 -8
  23. data/spec/mangopay/bankingaliases_spec.rb +1 -1
  24. data/spec/mangopay/card_registration_spec.rb +17 -2
  25. data/spec/mangopay/client_spec.rb +12 -12
  26. data/spec/mangopay/configuration_spec.rb +98 -0
  27. data/spec/mangopay/conversion_spec.rb +64 -0
  28. data/spec/mangopay/deposit_spec.rb +75 -0
  29. data/spec/mangopay/kyc_document_spec.rb +1 -0
  30. data/spec/mangopay/payin_applepay_direct_spec.rb +1 -1
  31. data/spec/mangopay/payin_bancontact_web_spec.rb +30 -0
  32. data/spec/mangopay/payin_blik_web_spec.rb +32 -0
  33. data/spec/mangopay/payin_giropay_web_spec.rb +30 -0
  34. data/spec/mangopay/payin_googlepay_direct_spec.rb +21 -0
  35. data/spec/mangopay/payin_ideal_web_spec.rb +30 -0
  36. data/spec/mangopay/payin_klarna_web_spec.rb +32 -0
  37. data/spec/mangopay/payin_mbway_web_spec.rb +32 -0
  38. data/spec/mangopay/payin_multibanco_web_spec.rb +31 -0
  39. data/spec/mangopay/payin_payconiq_web_spec.rb +25 -0
  40. data/spec/mangopay/payin_paypal_web_spec.rb +21 -0
  41. data/spec/mangopay/payin_preauthorized_direct_spec.rb +21 -1
  42. data/spec/mangopay/payin_satispay_web_spec.rb +32 -0
  43. data/spec/mangopay/payment_method_metadata_spec.rb +15 -0
  44. data/spec/mangopay/payout_bankwire_spec.rb +20 -0
  45. data/spec/mangopay/preauthorization_spec.rb +1 -2
  46. data/spec/mangopay/recurring_payin_spec.rb +82 -0
  47. data/spec/mangopay/regulatory_spec.rb +26 -0
  48. data/spec/mangopay/shared_resources.rb +714 -219
  49. data/spec/mangopay/transaction_spec.rb +5 -0
  50. data/spec/mangopay/ubo_declaration_spec.rb +14 -3
  51. data/spec/mangopay/ubo_spec.rb +3 -3
  52. data/spec/mangopay/user_spec.rb +16 -1
  53. data/spec/mangopay/wallet_spec.rb +5 -0
  54. metadata +39 -4
  55. data/.travis.yml +0 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f3be9c170462d86c30e551361cb135196086b166a5b4da755002635e6dffa367
4
- data.tar.gz: f6cba5c6f4a1f3eacaa4fed0ffb484dacbf71e3d8b8f6a8cc16deca7387188ec
3
+ metadata.gz: 8947a3cfb998752c602955c3d1eb8585e0e8ea9337c39eb141d5c40d90488c6b
4
+ data.tar.gz: 14067f5dfa5c2c5f31d269a6a0a82a27337efd2f06c4234758c5c8cf325a5a56
5
5
  SHA512:
6
- metadata.gz: 50f20f836d5eb42c7122b2e5865d20dc6a566ad1433915eef235d9cc0dfef4d4cde39f949c050de0bfafa9510c8aa263d6091ebf7df126e77a222160db8250b2
7
- data.tar.gz: 11a3cc3fb9ed24f8b791c331f2113bf35e388082f18f78063c3c2ded7c74d1d8cffe53016d0a4f4fc5ccb03f2a296b09fb73246801bf45b6a1011a065a78d2a0
6
+ metadata.gz: 0dfcd029183048dc8af4ec10953695d0c125b2d21091d3b0152917876247663e9c47ec31113b16986bce59627de25bf235882b3f71897fed1d37352c65560f9e
7
+ data.tar.gz: 445e13d574b812491959e370281f83289eae63d07849ce51bd7abb86d1521976105d31d35db0a405e4bdd48ff2795932fdcaa90302e86f672265f173c4e98e6e
@@ -0,0 +1,34 @@
1
+ name: mangopay2-net-ruby-cd
2
+
3
+ on:
4
+ push:
5
+ # Sequence of patterns matched against refs/tags
6
+ tags:
7
+ # It pushes any tags that contain a v. ex: v1.16.1
8
+ - '*'
9
+
10
+ jobs:
11
+ build:
12
+ name: Build + Publish
13
+ runs-on: ubuntu-latest
14
+ permissions:
15
+ contents: read
16
+ packages: write
17
+
18
+ steps:
19
+ - uses: actions/checkout@v3
20
+ - name: Set up Ruby 2.6
21
+ uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: 2.6.10
24
+
25
+ - name: Publish to RubyGems
26
+ run: |
27
+ mkdir -p $HOME/.gem
28
+ touch $HOME/.gem/credentials
29
+ chmod 0600 $HOME/.gem/credentials
30
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
31
+ gem build *.gemspec
32
+ gem push *.gem
33
+ env:
34
+ GEM_HOST_API_KEY: "${{secrets.GEM_HOST_API_KEY}}"
@@ -0,0 +1,30 @@
1
+ name: mangopay2-net-ruby-ci
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ # push on master branch
7
+ - master
8
+ pull_request:
9
+ branches: [ master ]
10
+
11
+ jobs:
12
+ build:
13
+ name: Build
14
+ runs-on: ubuntu-latest
15
+ permissions:
16
+ contents: read
17
+ packages: write
18
+
19
+ steps:
20
+ - uses: actions/checkout@v3
21
+ - name: Set up Ruby 2.6
22
+ uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: 2.6.10
25
+ - name: Install Rspec
26
+ run: |
27
+ gem install bundler -v 2.4.22
28
+ bundler install
29
+ - name: Test
30
+ run: bundle exec rspec
data/CHANGELOG.md CHANGED
@@ -1,3 +1,248 @@
1
+ ## [3.26.0] - 2024-08-07
2
+ ### Added
3
+
4
+ - New endpoint: [Create a Bancontact PayIn](https://mangopay.com/docs/endpoints/bancontact#create-bancontact-payin)
5
+
6
+ ## [3.25.1] - 2024-04-30
7
+ ### Fixed
8
+
9
+ - Updated tests for [Look up metadata for a payment method](https://mangopay.com/docs/endpoints/payment-method-metadata#lookup-payment-method-metadata).
10
+
11
+ ## [3.25.0] - 2024-04-16
12
+ ### Added
13
+
14
+ - Add trace header logging : Introduced the `log_trace_headers` boolean configuration key. Set it to true to enable logging of `x_mangopay_trace-id` and `IdempotencyKey` in the log of the http requests.
15
+
16
+ ## [3.24.1] - 2024-04-10
17
+ ### Fixed
18
+
19
+ - #249 Improve error handling when logging is enabled
20
+ - #226 MultiJson::ParseError is thrown on HTTP error 5XX
21
+
22
+ ## [3.24.0] - 2024-04-02
23
+ ### Added
24
+
25
+ - New endpoint [Add tracking to Paypal payin](https://mangopay.com/docs/endpoints/paypal#add-tracking-paypal-payin)
26
+
27
+ ## [3.23.0] - 2024-03-08
28
+ ### Fixed
29
+
30
+ - Conversions endpoint spelling
31
+
32
+ ### Added
33
+
34
+ - The optional Fees parameter is now available on instant conversions, allowing platforms to charge users for FX services. More information [here](https://mangopay.com/docs/release-notes/millefeuille).
35
+ - Platforms can now use a quote to secure the rate for a conversion between two currencies for a set amount of time. More information [here](https://mangopay.com/docs/release-notes/millefeuille).
36
+ - Introduced the `uk_header_flag` boolean configuration key. Platforms partnered with Mangopay's UK entity should set this key to true for proper configuration.
37
+
38
+ ## [3.22.0] - 2024-02-08
39
+ ### Added
40
+
41
+ - New endpoint to look up metadata from BIN or Google Pay token. More information [here](https://mangopay.com/docs/release-notes/kisale)
42
+
43
+ ## [3.21.0] - 2024-01-23
44
+ ### Added
45
+
46
+ - The endpoint [View a card Validation](https://mangopay.com/docs/endpoints/card-validations#view-card-validation) is now available
47
+
48
+ ## [3.20.0] - 2023-11-15
49
+ ### Added
50
+
51
+ Now, our SDK enables seamless integration with multiple clientIDs, offering enhanced flexibility and customization.
52
+
53
+ You can effortlessly create multiple configuration objects tailored to your specific needs:
54
+
55
+ ```
56
+ config = MangoPay::Configuration.new
57
+ config.client_id = 'your-client-id'
58
+ config.client_apiKey = 'your-api-key'
59
+ config.preproduction = true
60
+ ```
61
+ add them using :
62
+
63
+ `MangoPay.add_config('config1', config)`
64
+
65
+ and perform a call with them using :
66
+
67
+ `MangoPay.get_config('config1').apply_configuration`
68
+
69
+ The previous method configure() is still working.
70
+
71
+ ## [3.19.0] - 2023-11-02
72
+ ### Updated
73
+
74
+ - Giropay and Ideal integrations with Mangopay have been improved.
75
+ - Klarna param "MerchantOrderId" has been renamed to "Reference"
76
+
77
+ ## [3.18.0] - 2023-09-29
78
+ ### Added
79
+ - Instantly convert funds between 2 wallets of different currencies owned by the same user with the new SPOT FX endpoints
80
+
81
+ ## [3.17.0] - 2023-09-20
82
+ ### Added
83
+
84
+ - A new parameter for Paypal : ShippingPreference
85
+ - Klarna is now available as a payment method with Mangopay. This payment method is in private beta. Please contact support if you have any questions.
86
+ - #225 It's now possible to configure ssl_options. It's now possible to set to false in preproduction environment. Thanks to @mantaskujalis
87
+
88
+ ## [3.16.0] - 2023-09-04
89
+ ### Added
90
+
91
+ - Card validation endpoint management (Private beta)
92
+ - New MOPs added : Multibanco, Blik, Satispay (Private beta)
93
+
94
+ ### Fixed
95
+
96
+ - Execution Type of MB Way and PayPal has been changed from Direct to Web
97
+
98
+ ## [3.15.0] - 2023-07-07
99
+ ### Added
100
+
101
+ - Google Pay is now available as a payment method with Mangopay. This payment method is in private beta. Please contact support if you have any questions.
102
+ - Paypal integration with Mangopay has been improved. This payment method is in private beta. Please contact support if you have any questions.
103
+
104
+ ### Fixed
105
+
106
+ - `Phone` parameter instead of `PhoneNumber` for MBWay
107
+ - Timeout should be in secondes instead of milliseconds in the configuration
108
+ ## [3.14.0] - 2023-06-21
109
+ ### Added
110
+
111
+ - MB WAY is now available as a payment method with Mangopay. This payment method is in private beta. Please contact support if you have any questions.
112
+
113
+ ## [3.13.2] - 2023-05-18
114
+ ### Fixes
115
+
116
+ - fixed GitHub Actions CD pipeline
117
+
118
+ ## [3.13.1] - 2023-05-18
119
+ ### Fixes
120
+
121
+ - typo fixed in test context name (@batistadasilva)
122
+
123
+ ## [3.13.0] - 2023-05-17
124
+ ### Added
125
+
126
+ - Possibility to configure HTTP `max_retries (http_max_retries)` (default value = 1) and `open_timeout (http_open_timeout)` (default value = 60 seconds)
127
+ - Increased default `read_timeout` to 30 seconds
128
+
129
+
130
+ ## [3.12.0] - 2022-11-16
131
+ ### New 30-day preauthorization feature
132
+
133
+ Preauthorizations can now hold funds for up to 30 days, therefore ensuring the solvency of a registered card for the same amount of time.
134
+
135
+ - The **Deposit** service has been added with methods for creating, fetching and canceling a deposit
136
+ - The **create_pre_authorized_deposit_pay_in** method has been added to the PayIn service
137
+
138
+ Thanks to 30-day preauthorizations, MANGOPAY can provide a simpler and more flexible payment experience for a wide range of use cases, especially for rentals.
139
+
140
+ ## [3.11.1] - 2022-10-18
141
+ ### Fixed
142
+
143
+ Tests has been fixed due to API evolution.
144
+
145
+ ## [3.11.0] - 2022-09-08
146
+ ##Added
147
+ **New country authorizations endpoints**
148
+
149
+ Country authorizations can now be viewed by using one of the following endpoints:
150
+
151
+ <a href="https://docs.mangopay.com/endpoints/v2.01/regulatory#e1061_the-country-authorizations-object">View a country's authorizations</a> <br>
152
+ <a href="https://docs.mangopay.com/endpoints/v2.01/regulatory#e1061_the-country-authorizations-object">View all countries' authorizations</a>
153
+
154
+ With these calls, it is possible to check which countries have:
155
+
156
+ - Blocked user creation
157
+ - Blocked bank account creation
158
+ - Blocked payout creation
159
+
160
+ Please refer to the <a href="https://docs.mangopay.com/guide/restrictions-by-country">Restrictions by country</a>
161
+ article for more information.
162
+
163
+ ## [3.10.0] - 2022-06-29
164
+ ##Added
165
+ **Recurring: €0 deadlines for CIT**
166
+
167
+ Setting free recurring payment deadlines is now possible for CIT (customer-initiated transactions) with the **FreeCycles** parameter.
168
+
169
+ The **FreeCycles** parameter allows platforms to define the number of consecutive deadlines that will be free. The following endpoints have been updated to take into account this new parameter:
170
+
171
+ <a href="https://docs.mangopay.com/endpoints/v2.01/payins#e1051_create-a-recurring-payin-registration">Create a Recurring PayIn Registration</a><br>
172
+ <a href="https://docs.mangopay.com/endpoints/v2.01/payins#e1056_view-a-recurring-payin-registration">View a Recurring PayIn Registration</a><br>
173
+
174
+ This feature provides new automation capabilities for platforms with offers such as “Get the first month free” or “free trial” subscriptions.
175
+
176
+ Please refer to the <a href="https://docs.mangopay.com/guide/recurring-payments-introduction">Recurring payments overview</a> documentation for more information.
177
+
178
+ ## [3.9.0] - 2022.03.31
179
+ ### Added
180
+
181
+ #### Instant payment eligibility check
182
+
183
+ With the function
184
+ `PayOut::InstantPayoutEligibility::Reachability.create(params)`
185
+ the destination bank reachability can now be verified prior to making an instant payout. This results in a better user experience, as this preliminary check will allow the platform to propose the instant payout option only to end users whose bank is eligible.
186
+
187
+ ## [3.8.0] - 2021.10.20
188
+ ## Added
189
+
190
+ You can now change the status to "ENDED" for a recurring payment.
191
+
192
+ ## Fixed
193
+
194
+ - "Status" is now available in the response when you request a recurring payment registration.
195
+
196
+
197
+ ## [3.7.0] - 2021.10.11
198
+ ## Added
199
+
200
+ ### Payconiq
201
+
202
+ As requested by numerous clients, we are now providing [Payconiq](https://www.payconiq.be) as a new mean-of-payment. To request access, please contact MANGOPAY.
203
+
204
+ ### Flags for KYC documents
205
+
206
+ **We provide more information regarding refused KYC documents.** Therefore it will be easier for you to adapt your app behavior and help your end user.
207
+
208
+ You are now able to see the exact explanation thanks to a new parameter called “Flags”.
209
+
210
+ It has been added to
211
+
212
+ `$this->_api->KycDocuments->Get($kycDocument->Id);`
213
+
214
+ It will display one or several error codes that provide the reason(s) why your document validation has failed. These error codes description are available [here](https://docs.mangopay.com/guide/kyc-document).
215
+
216
+ ## Fixed
217
+
218
+ Idempotency key is not required anymore for UBO declarations
219
+
220
+ ## [3.6.0] - 2021.08.10
221
+ ## Added
222
+
223
+ - You can now update and view a Recurring PayIn Registration object. To know more about this feature, please consult the documentation [here](https://docs.mangopay.com/guide/recurring-payments-introduction).
224
+ - To improve recurring payments, we have added new parameters for CIT : DebitedFunds & Fees. To know more about this feature, please consult the documentation [here](https://docs.mangopay.com/endpoints/v2.01/payins#e1053_create-a-recurring-payin-cit)
225
+
226
+ ## [3.5.0] - 2021.06.10
227
+ ## Added
228
+
229
+ We have added a new feature **[recurring payments](https://docs.mangopay.com/guide/recurring-payments)** dedicated to clients needing to charge a card repeatedly, such as subscriptions or payments installments.
230
+
231
+ You can start testing in sandbox, to help you define your workflow. This release provides the first elements of the full feature.
232
+
233
+ - [Create a Recurring PayIn Registration object](https://docs.mangopay.com/endpoints/v2.01/payins#e1051_create-a-recurring-payin-registration), containing all the information to define the recurring payment
234
+ - [Initiate your recurring payment flow](https://docs.mangopay.com/endpoints/v2.01/payins#e1053_create-a-recurring-payin-cit) with an authenticated transaction (CIT) using the Card Recurring PayIn endpoint
235
+ - [Continue your recurring payment flow](https://docs.mangopay.com/endpoints/v2.01/payins#e1054_create-a-recurring-payin-mit) with an non-authenticated transaction (MIT) using the Card Recurring PayIn endpoint
236
+
237
+ This feature is not yet available in production and you need to contact the Support team to request access.
238
+
239
+ ## Accepted PRs
240
+
241
+ - Add support for refund creation
242
+ - Allow to fetch UBO Declaration without User ID
243
+
244
+
245
+
1
246
  ## [3.4.0] - 2021.05.27
2
247
  ## Added
3
248
 
@@ -84,7 +329,7 @@ The parameter `Applied3DSVersion` shows you the version of the 3DS protocol used
84
329
 
85
330
  ## [3.1.0]
86
331
  - 3DS2 integration with Shipping and Billing objects, including FirstName and LastName fields
87
- The objects Billing and Shipping may be included on all calls to the following endpoints:
332
+ The objects Billing and Shipping may be included on all calls to the following endpoints:
88
333
  - /preauthorizations/card/direct
89
334
  - /payins/card/direct
90
335
  - /payins/card/web
@@ -105,7 +350,7 @@ The objects Billing and Shipping may be included on all calls to the following e
105
350
  ## [3.0.35] - 2020-08-24
106
351
  - Improvement to Net::ReadTimeout handling
107
352
  - "User-agent" format in the headers changed, aligned to other assets 👤
108
-
353
+
109
354
  ## [3.0.34] - 2020-06-25
110
355
  ### Added
111
356
  - This SDK is now GooglePay-ready ! Feel free to ask our lovely support for more infos about its activation.
@@ -123,7 +368,7 @@ The objects Billing and Shipping may be included on all calls to the following e
123
368
 
124
369
  ## [3.0.33] - 2019-09-23
125
370
  ### Added
126
- - ApplePay `Payin` functions are now available. More info about activation to come in the following weeks...
371
+ - ApplePay `Payin` functions are now available. More info about activation to come in the following weeks...
127
372
  ### Changed
128
373
  - GET EMoney method now supports year and month parameters. More info on our [docs](https://docs.mangopay.com/endpoints/v2.01/user-emoney#e895_view-a-users-emoney)
129
374
 
@@ -137,4 +382,4 @@ The objects Billing and Shipping may be included on all calls to the following e
137
382
  - `APIKey` is now replacing `passphrase` property for credentials. You must update it by updating to 3.0.32 SDK version and upper ones.
138
383
 
139
384
 
140
-
385
+
data/README.md CHANGED
@@ -85,6 +85,25 @@ rescue MangoPay::ResponseError => ex
85
85
  end
86
86
  ```
87
87
 
88
+ ### Using multiple clientIDs
89
+ You can effortlessly create multiple configuration objects tailored to your specific needs:
90
+
91
+ ```
92
+ config = MangoPay::Configuration.new
93
+ config.client_id = 'your-client-id'
94
+ config.client_apiKey = 'your-api-key'
95
+ config.preproduction = true
96
+ ```
97
+ add them using :
98
+
99
+ `MangoPay.add_config('config1', config)`
100
+
101
+ and perform a call with them using :
102
+
103
+ `MangoPay.get_config('config1').apply_configuration`
104
+
105
+ The previous method configure() is still working.
106
+
88
107
  ### Accessing RateLimit Headers
89
108
  Along with each request, the rate limiting headers are automatically updated in MangoPay object:
90
109
 
@@ -73,7 +73,7 @@ module MangoPay
73
73
  end
74
74
 
75
75
  def store(token)
76
- File.open(file_path, File::RDWR|File::CREAT, 0644) do |f|
76
+ File.open(file_path, File::RDWR | File::CREAT, 0644) do |f|
77
77
  f.flock(File::LOCK_EX)
78
78
  f.truncate(0)
79
79
  f.rewind
@@ -3,9 +3,9 @@ module MangoPay
3
3
  # See parent class MangoPay::BankingAliases
4
4
  class BankingAliasesIBAN < BankingAliases
5
5
 
6
- def self.create(params, wallet_id)
6
+ def self.create(params, wallet_id, headers_or_idempotency_key = nil)
7
7
  url = "#{MangoPay.api_path}/wallets/#{wallet_id}/bankingaliases/iban"
8
- MangoPay.request(:post, url, params, {})
8
+ MangoPay.request(:post, url, params, {}, headers_or_idempotency_key)
9
9
  end
10
10
 
11
11
  def self.url(id = nil)
data/lib/mangopay/card.rb CHANGED
@@ -35,6 +35,16 @@ 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
43
+
44
+ def get_card_validation(card_id, validation_id)
45
+ url = "#{MangoPay.api_path}/cards/#{card_id}/validation/#{validation_id}"
46
+ MangoPay.request(:get, url)
47
+ end
38
48
  end
39
49
  end
40
50
  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
@@ -0,0 +1,39 @@
1
+ module MangoPay
2
+
3
+ class Conversion < Resource
4
+ include HTTPCalls::Fetch
5
+ include HTTPCalls::Update
6
+
7
+ class << self
8
+ def get_rate(debited_currency, credited_currency, params)
9
+ url = "#{MangoPay.api_path}/conversions/rate/#{debited_currency}/#{credited_currency}"
10
+ MangoPay.request(:get, url, params)
11
+ end
12
+
13
+ def create_instant_conversion(params)
14
+ url = "#{MangoPay.api_path}/conversions/instant-conversion"
15
+ MangoPay.request(:post, url, params)
16
+ end
17
+
18
+ def create_quoted_conversion(params)
19
+ url = "#{MangoPay.api_path}/conversions/quoted-conversion"
20
+ MangoPay.request(:post, url, params)
21
+ end
22
+
23
+ def get(id, params)
24
+ url = "#{MangoPay.api_path}/conversions/#{id}"
25
+ MangoPay.request(:get, url, params)
26
+ end
27
+
28
+ def create_quote(params)
29
+ url = "#{MangoPay.api_path}/conversions/quote"
30
+ MangoPay.request(:post, url, params)
31
+ end
32
+
33
+ def get_quote(id, params)
34
+ url = "#{MangoPay.api_path}/conversions/quote/#{id}"
35
+ MangoPay.request(:get, url, params)
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,20 @@
1
+ module MangoPay
2
+
3
+ # See http://docs.mangopay.com/api-references/payins/preauthorized-payin/
4
+ class Deposit < Resource
5
+ def self.create(params, idempotency_key = nil)
6
+ MangoPay.request(:post, "#{MangoPay.api_path}/deposit-preauthorizations/card/direct", params, {}, idempotency_key)
7
+ end
8
+
9
+ def self.get(deposit_id, filters = {})
10
+ MangoPay.request(:get, "#{MangoPay.api_path}/deposit-preauthorizations/#{deposit_id}", {}, filters)
11
+ end
12
+
13
+ def self.cancel(deposit_id)
14
+ params = {
15
+ PaymentStatus: 'CANCELED'
16
+ }
17
+ MangoPay.request(:put, "#{MangoPay.api_path}/deposit-preauthorizations/#{deposit_id}", params)
18
+ end
19
+ end
20
+ end
@@ -50,9 +50,9 @@ module MangoPay
50
50
  #####################################################
51
51
 
52
52
  # see https://docs.mangopay.com/api-references/disputes/repudiations/
53
- def fetch_repudiation(repudiation_id)
53
+ def fetch_repudiation(repudiation_id, idempotency_key = nil)
54
54
  url = "#{MangoPay.api_path}/repudiations/#{repudiation_id}"
55
- MangoPay.request(:get, url)
55
+ MangoPay.request(:get, url, {}, {}, idempotency_key)
56
56
  end
57
57
 
58
58
  # +params+: hash; see https://docs.mangopay.com/api-references/disputes/settlement-transfers/
@@ -48,7 +48,7 @@ module MangoPay
48
48
  super(message) if message
49
49
  end
50
50
 
51
- def type; @details['Type']; end
51
+ def type; @details['Type'] || @details['type']; end
52
52
  def error; @details['error']; end
53
53
  def errors; @details['errors'] || error; end
54
54
 
@@ -56,7 +56,7 @@ module MangoPay
56
56
  if error
57
57
  msg = error
58
58
  else
59
- msg = @details['Message']
59
+ msg = @details['Message'] || @details['message']
60
60
  msg += errors.sort.map {|k,v| " #{k}: #{v}"}.join if (errors && errors.is_a?(Hash))
61
61
  msg
62
62
  end
@@ -39,12 +39,17 @@ module MangoPay
39
39
  @@res_confidential_params ||= [
40
40
  'access_token', 'AccessKey', 'IBAN', 'CardRegistrationURL',
41
41
  'PreregistrationData', 'RedirectURL', 'RegistrationData',
42
- 'SecureModeRedirectUrl', 'OwnerName', 'OwnerAddress', 'BIC'
42
+ 'SecureModeRedirectUrl', 'OwnerName', 'OwnerAddress', 'BIC',
43
+ 'FirstName', 'LastName', 'Email', 'AddressLine1',
44
+ 'AddressLine2',
43
45
  ].freeze
44
46
  end
45
47
 
46
48
  def self.req_confidential_params
47
- @@req_confidential_params ||= ['File', 'IBAN', 'OwnerName', 'OwnerAddress', 'BIC'].freeze
49
+ @@req_confidential_params ||= [
50
+ 'File', 'IBAN', 'OwnerName', 'OwnerAddress', 'BIC', 'FirstName',
51
+ 'LastName', 'Email', 'AddressLine1', 'AddressLine2',
52
+ ].freeze
48
53
  end
49
54
 
50
55
  end