mangopay 3.0.38 → 3.5.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: cf7447c17143576fc551c5360bd879c107d30c8311b684d7a6e85fbbd924634f
4
- data.tar.gz: b7fba691a647737ffc2a055214fe78c5b9b54c4c1b44b6796dd3333d1e6b6172
3
+ metadata.gz: b84828fb11033157bfa54765cb99dc5e9ba1c0a00fe7b9351dd8bf4d747d29f2
4
+ data.tar.gz: 9f83683c46d13b2e6cf18532e4948ccd6daee09bdf4fdf590aee1d9da57e87f8
5
5
  SHA512:
6
- metadata.gz: ebba688cb4bdec07a07bc7bd56076e381282cfc0d32dd8c619bdab17d300eb545cc95a4961a72a24fff3674d96c6046aa5cd706af2aabb6b894c1e800501785f
7
- data.tar.gz: 6b15d0fc47ed468ac522bdda90542839de2ec6d9759ce2568386b9c1c6a45c285280a73ce7a7de9ec642c66228a79867b53e15051d229d582e073a662e6a6976
6
+ metadata.gz: e593d8cbe199ef24f65ca3a4388015a5cfca4e8b71012fdc3960389ede99e6eef9ad7a424cd136162d581bdc81fb344becf1cced30a5300f09ad1d4aefc49830
7
+ data.tar.gz: 5d06c7d08de2d7fb8edb1d3ba28bd20643bc3f28c823e535af889b7b270316883134fe95af0fb573811173cbb311fde3ed716249f69269d7927d7350c19ff044
data/.travis.yml CHANGED
@@ -6,7 +6,8 @@ rvm:
6
6
  # - 2.3
7
7
  # - 2.4
8
8
  - 2.5
9
- script: bundle exec rspec
9
+ script:
10
+ - if [ $TRAVIS_BRANCH != "release" ]; then bundle exec rspec; fi
10
11
  deploy:
11
12
  provider: rubygems
12
13
  api_key:
data/CHANGELOG.md CHANGED
@@ -1,8 +1,118 @@
1
- ## [3.0.38] - 2020-12-11
2
- - Added 'Regulatory' endpoint to allow checks of User Block Status
3
- - Added support for Regulatory -> Blocked Status Hooks
4
- - Removed sensitive data from logs, such as OwnerName, OwnerAddress BIC
1
+ ## [3.5.0] - 2021.06.10
2
+ ## Added
5
3
 
4
+ 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.
5
+
6
+ You can start testing in sandbox, to help you define your workflow. This release provides the first elements of the full feature.
7
+
8
+ - [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
9
+ - [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
10
+ - [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
11
+
12
+ This feature is not yet available in production and you need to contact the Support team to request access.
13
+
14
+ ## Accepted PRs
15
+
16
+ - Add support for refund creation
17
+ - Allow to fetch UBO Declaration without User ID
18
+
19
+
20
+
21
+ ## [3.4.0] - 2021.05.27
22
+ ## Added
23
+
24
+ ### Instant payment
25
+
26
+ Mangopay introduces the instant payment mode. It allows payouts (transfer from wallet to user bank account) to be processed within 25 seconds, rather than the 48 hours for a standard payout.
27
+
28
+ You can now use this new type of payout with the Ruby SDK.
29
+
30
+ Example :
31
+
32
+ ```ruby
33
+ bankwire = MangoPay::PayOut::BankWire.get_bankwire(payout['Id'])
34
+ # where payout['Id'] is the id of an existing payout
35
+ ```
36
+
37
+ Please note that this feature must be authorized and activated by MANGOPAY. More information [here](https://docs.mangopay.com/guide/instant-payment-payout).
38
+
39
+ ### Accepted PRs
40
+
41
+ - Add support to create refunds for PayIn, Transfer and PayOut transactions.
42
+ - ResponseError object improvement
43
+
44
+ ## [3.3.0]
45
+ ## Fixed
46
+
47
+ ### IBAN for testing purposes
48
+
49
+ ⚠️ **IBAN provided for testing purpose should never be used outside of a testing environement!**
50
+
51
+ More information about how to test payments, click [here](https://docs.mangopay.com/guide/testing-payments).
52
+
53
+ ### Others
54
+
55
+ - Adding missing json require in log requests filter spec. Thank you @Vin0uz
56
+ - Extend fetch_wallet and create_payout API. Thank you @peterb
57
+
58
+ ## Added
59
+
60
+ Some of you use a lot the [PreAuthorization](https://docs.mangopay.com/endpoints/v2.01/preauthorizations#e183_the-preauthorization-object) feature of our API. To make your life easier, we have added three new events :
61
+
62
+ - PREAUTHORIZATION_CREATED
63
+ - PREAUTHORIZATION_SUCCEEDED
64
+ - PREAUTHORIZATION_FAILED
65
+
66
+ The goal is to help you monitor a PreAuthorization with a [webhook](https://docs.mangopay.com/endpoints/v2.01/hooks#e246_the-hook-object).
67
+
68
+ *Example: If a PreAuthorization is desynchronized, when the status is updated, you will be able to know it.*
69
+
70
+
71
+
72
+ ## [3.2.0]
73
+ ## Added
74
+
75
+ ### On demand feature for 3DSv2
76
+
77
+ > **This on-demand feature is for testing purposes only and will not be available in production**
78
+
79
+ #### Request
80
+
81
+ We've added a new parameter `Requested3DSVersion` (not mandatory) that allows you to choose between versions of 3DS protocols (managed by the parameter `SecureMode`). Two values are available:
82
+ * `V1`
83
+ * `V2_1`
84
+
85
+ If nothing is sent, the flow will be 3DS V1.
86
+
87
+ The `Requested3DSVersion` may be included on all calls to the following endpoints:
88
+ * `/preauthorizations/card/direct`
89
+ * `/payins/card/direct`
90
+
91
+ #### Response
92
+
93
+ In the API response, the `Requested3DSVersion` will show the value you requested:
94
+ * `V1`
95
+ * `V2_1`
96
+ * `null` – indicates that nothing was requested
97
+
98
+ The parameter `Applied3DSVersion` shows you the version of the 3DS protocol used. Two values are possible:
99
+ * `V1`
100
+ * `V2_1`
101
+
102
+
103
+
104
+
105
+ ## [3.1.0]
106
+ - 3DS2 integration with Shipping and Billing objects, including FirstName and LastName fields
107
+ The objects Billing and Shipping may be included on all calls to the following endpoints:
108
+ - /preauthorizations/card/direct
109
+ - /payins/card/direct
110
+ - /payins/card/web
111
+ - Enable Instant Payment for payouts by adding a new parameter PayoutModeRequested on the following endpoint /payouts/bankwire
112
+ - The new parameter PayoutModeRequested can take two differents values : "INSTANT_PAYMENT" or "STANDARD" (STANDARD = the way we procede normaly a payout request)
113
+ - This new parameter is not mandatory and if empty or not present, the payout will be "STANDARD" by default
114
+ - Instant Payment is in beta all over Europe - SEPA region
115
+ - Add test on new payout mode PayoutModeRequested
6
116
  ## [3.0.37] - 2020-10-30
7
117
  - Card Validation endpoint fully activated
8
118
  - added pre authorizations transactions method
data/README.md CHANGED
@@ -15,12 +15,12 @@ Since [v3.0.17](https://github.com/Mangopay/mangopay2-ruby-sdk/releases/tag/v3.0
15
15
 
16
16
  Account creation
17
17
  -------------------------------------------------
18
- You can get yourself a [free sandbox account](https://www.mangopay.com/signup/create-sandbox/) or sign up for a [production account](https://www.mangopay.com/signup/production-account/) (note that validation of your production account can take a few days, so think about doing it in advance of when you actually want to go live).
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
19
 
20
20
  ## Usage
21
21
 
22
22
  ### Install
23
- * You can get yourself a [free sandbox account](https://www.mangopay.com/get-started/create-sandbox/) or sign up for a [production account](https://www.mangopay.com/signup/production-account/) (note that validation of your production account can take a few days, so think about doing it in advance of when you actually want to go live).
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).
24
24
 
25
25
  * Install the gem by either running ```gem install mangopay```
26
26
  or by adding it to your Gemfile ```gem 'mangopay'```
@@ -47,7 +47,10 @@ module MangoPay
47
47
  # +currency_iso_code+ is currncy ISO code
48
48
  # see https://docs.mangopay.com/api-references/client-wallets/
49
49
  def fetch_wallet(funds_type, currency_iso_code)
50
- MangoPay.request(:get, url() + "/wallets/#{funds_type}/#{currency_iso_code}")
50
+ method = :get
51
+ path = url() + "/wallets/#{funds_type}/#{currency_iso_code}"
52
+ yield method, path if block_given?
53
+ MangoPay.request(method, path)
51
54
  end
52
55
 
53
56
  # Fetch transactions for all your client wallets.
@@ -79,7 +82,10 @@ module MangoPay
79
82
  end
80
83
 
81
84
  def create_payout(params)
82
- MangoPay.request(:post, url() + "/payouts", params)
85
+ method = :post
86
+ path = url() + "/payouts"
87
+ yield method, path, params if block_given?
88
+ MangoPay.request(method, path, params)
83
89
  end
84
90
 
85
91
  end
@@ -8,9 +8,9 @@ module MangoPay
8
8
  include HTTPCalls::Update
9
9
  class << self
10
10
 
11
- def close(dispute_id)
11
+ def close(dispute_id, idempotency_key = nil)
12
12
  url = url(dispute_id) + "/close/"
13
- MangoPay.request(:put, url)
13
+ MangoPay.request(:put, url, {}, {}, idempotency_key)
14
14
  end
15
15
 
16
16
  # +contested_funds+: Money hash
@@ -44,7 +44,7 @@ module MangoPay
44
44
  url = "#{MangoPay.api_path}/disputes/pendingsettlement"
45
45
  MangoPay.request(:get, url, {}, filters)
46
46
  end
47
-
47
+
48
48
  #####################################################
49
49
  # repudiations / settlement transfers
50
50
  #####################################################
@@ -66,7 +66,7 @@ module MangoPay
66
66
  url = "#{MangoPay.api_path}/settlements/#{transfer_id}"
67
67
  MangoPay.request(:get, url)
68
68
  end
69
-
69
+
70
70
  #####################################################
71
71
  # documents
72
72
  #####################################################
@@ -91,13 +91,13 @@ module MangoPay
91
91
  # Fetches list of dispute documents:
92
92
  # - for the particular dispute if +dispute_id+ is provided (not nil)
93
93
  # - or for all disputes otherwise.
94
- #
94
+ #
95
95
  # Optional +filters+ is a hash accepting following keys:
96
96
  # - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
97
97
  # - filters such as +Type+ (e.g. 'REFUND_PROOF') and +Status+ (e.g. 'VALIDATED')
98
98
  # - +BeforeDate+ (timestamp): filters documents with CreationDate _before_ this date
99
99
  # - +AfterDate+ (timestamp): filters documents with CreationDate _after_ this date
100
- #
100
+ #
101
101
  # See https://docs.mangopay.com/api-references/disputes/dispute-documents/
102
102
  #
103
103
  def fetch_documents(dispute_id = nil, filters = {})
@@ -106,12 +106,12 @@ module MangoPay
106
106
  end
107
107
 
108
108
  # Adds the file page (attachment) to the given document.
109
- #
109
+ #
110
110
  # See https://docs.mangopay.com/api-references/disputes/dispute-document-pages/ :
111
111
  # - Document have to be in 'CREATED' Status
112
112
  # - You can create as many pages as needed
113
113
  # - Change Status to 'VALIDATION_ASKED' to submit dispute documents
114
- #
114
+ #
115
115
  # The file_content_base64 param may be:
116
116
  # - Base64 encoded file content
117
117
  # - or nil: in this case pass the file path in the next param
@@ -49,12 +49,17 @@ module MangoPay
49
49
  end
50
50
 
51
51
  def type; @details['Type']; end
52
- def errors; @details['errors']; end
52
+ def error; @details['error']; end
53
+ def errors; @details['errors'] || error; end
53
54
 
54
55
  def message;
55
- msg = @details['Message']
56
- msg += errors.sort.map {|k,v| " #{k}: #{v}"}.join if (errors && errors.is_a?(Hash))
57
- msg
56
+ if error
57
+ msg = error
58
+ else
59
+ msg = @details['Message']
60
+ msg += errors.sort.map {|k,v| " #{k}: #{v}"}.join if (errors && errors.is_a?(Hash))
61
+ msg
62
+ end
58
63
  end
59
64
 
60
65
  end
@@ -52,9 +52,9 @@ module MangoPay
52
52
  # MangoPay::User.fetch(filter = {'page' => 2, 'per_page' => 3})
53
53
  # filter # => {"page"=>2, "per_page"=>3, "total_pages"=>1969, "total_items"=>5905}
54
54
  #
55
- def fetch(id_or_filters = nil)
55
+ def fetch(id_or_filters = nil, idempotency_key = nil)
56
56
  id, filters = HTTPCalls::Fetch.parse_id_or_filters(id_or_filters)
57
- response = MangoPay.request(:get, url(id), {}, filters)
57
+ response = MangoPay.request(:get, url(id), {}, filters, idempotency_key)
58
58
  end
59
59
  end
60
60
 
@@ -9,20 +9,20 @@ module MangoPay
9
9
  MangoPay.request(:post, url(user_id), params, {}, idempotency_key)
10
10
  end
11
11
 
12
- def update(user_id, document_id, params = {})
13
- MangoPay.request(:put, url(user_id, document_id), params)
12
+ def update(user_id, document_id, params = {}, idempotency_key = nil)
13
+ MangoPay.request(:put, url(user_id, document_id), params, {}, idempotency_key)
14
14
  end
15
15
 
16
16
  # Fetches the KYC document belonging to the given +user_id+, with the given +document_id+.
17
- def fetch(user_id, document_id)
17
+ def fetch(user_id, document_id, idempotency_key = nil)
18
18
  url = (user_id) ? url(user_id, document_id) : "#{MangoPay.api_path}/KYC/documents/#{CGI.escape(document_id.to_s)}"
19
- MangoPay.request(:get, url)
19
+ MangoPay.request(:get, url, {}, {}, idempotency_key)
20
20
  end
21
21
 
22
22
  # Fetches list of KYC documents:
23
23
  # - for the particular user if +user_id+ is provided (not nil)
24
24
  # - or for all users otherwise.
25
- #
25
+ #
26
26
  # Optional +filters+ is a hash accepting following keys:
27
27
  # - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
28
28
  # - filters such as +Type+ (e.g. 'IDENTITY_PROOF') and +Status+ (e.g. 'VALIDATED')
@@ -35,12 +35,12 @@ module MangoPay
35
35
  end
36
36
 
37
37
  # Adds the file page (attachment) to the given document.
38
- #
38
+ #
39
39
  # See http://docs.mangopay.com/api-references/kyc/pages/ :
40
40
  # - Document have to be in 'CREATED' Status
41
41
  # - You can create as many pages as needed
42
42
  # - Change Status to 'VALIDATION_ASKED' to submit KYC documents
43
- #
43
+ #
44
44
  # The file_content_base64 param may be:
45
45
  # - Base64 encoded file content
46
46
  # - or nil: in this case pass the file path in the next param
@@ -126,5 +126,31 @@ module MangoPay
126
126
  end
127
127
  end
128
128
 
129
+ module RecurringPayments
130
+ class Recurring < Resource
131
+ include HTTPCalls::Create
132
+
133
+ def self.url(*)
134
+ "#{MangoPay.api_path}/recurringpayinregistrations"
135
+ end
136
+ end
137
+
138
+ class CIT < Resource
139
+ include HTTPCalls::Create
140
+
141
+ def self.url(*)
142
+ "#{MangoPay.api_path}/payins/recurring/card/direct"
143
+ end
144
+ end
145
+
146
+ class MIT < Resource
147
+ include HTTPCalls::Create
148
+
149
+ def self.url(*)
150
+ "#{MangoPay.api_path}/payins/recurring/card/direct"
151
+ end
152
+ end
153
+ end
154
+
129
155
  end
130
156
  end
@@ -8,9 +8,9 @@ module MangoPay
8
8
  # - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
9
9
  # - +Status+: TransactionStatus {CREATED, SUCCEEDED, FAILED}
10
10
  # - +ResultCode+: string representing the transaction result
11
- def self.refunds(pay_out_id, filters = {})
11
+ def self.refunds(pay_out_id, filters = {}, idempotency_key = nil)
12
12
  url = url(pay_out_id) + '/refunds'
13
- MangoPay.request(:get, url, {}, filters)
13
+ MangoPay.request(:get, url, {}, filters, idempotency_key)
14
14
  end
15
15
 
16
16
  # See http://docs.mangopay.com/api-references/pay-out-bank-wire/
@@ -20,6 +20,11 @@ module MangoPay
20
20
  def self.url(*)
21
21
  "#{MangoPay.api_path}/payouts/bankwire"
22
22
  end
23
+
24
+ def self.get_bankwire(pay_out_id)
25
+ url = self.url() + "/" + pay_out_id
26
+ MangoPay.request(:get, url);
27
+ end
23
28
  end
24
29
  end
25
30
  end
@@ -2,6 +2,7 @@ module MangoPay
2
2
 
3
3
  # See http://docs.mangopay.com/api-references/refund/
4
4
  class Refund < Resource
5
+ include HTTPCalls::Create
5
6
  include HTTPCalls::Fetch
6
7
 
7
8
  # Fetches list of refunds belonging to given +repudiation_id+
@@ -3,7 +3,7 @@ module MangoPay
3
3
  class << self
4
4
  # Fetches list of transactions belonging to the given +wallet_id+.
5
5
  # See also transactions for user: MangoPay::User#transactions
6
- #
6
+ #
7
7
  # Optional +filters+ is a hash accepting following keys:
8
8
  # - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
9
9
  # - +Status+: TransactionStatus {CREATED, SUCCEEDED, FAILED}
@@ -12,8 +12,8 @@ module MangoPay
12
12
  # - +BeforeDate+ (timestamp): filters transactions with CreationDate _before_ this date
13
13
  # - +AfterDate+ (timestamp): filters transactions with CreationDate _after_ this date
14
14
  # See https://docs.mangopay.com/api-references/sort-lists/
15
- def fetch(wallet_id, filters={})
16
- MangoPay.request(:get, url(wallet_id), {}, filters)
15
+ def fetch(wallet_id, filters={}, headers = nil)
16
+ MangoPay.request(:get, url(wallet_id), {}, filters, headers)
17
17
  end
18
18
 
19
19
  def url(wallet_id)
data/lib/mangopay/ubo.rb CHANGED
@@ -10,16 +10,16 @@ module MangoPay
10
10
  end
11
11
  end
12
12
 
13
- def create(user_id, ubo_declaration_id, params)
14
- MangoPay.request(:post, url(user_id, ubo_declaration_id), params)
13
+ def create(user_id, ubo_declaration_id, params, idempotency_key = nil)
14
+ MangoPay.request(:post, url(user_id, ubo_declaration_id), params, {}, idempotency_key)
15
15
  end
16
16
 
17
17
  def fetch(user_id, ubo_declaration_id, ubo_id)
18
18
  MangoPay.request(:get, url(user_id, ubo_declaration_id, ubo_id))
19
19
  end
20
20
 
21
- def update(user_id, ubo_declaration_id, ubo_id, params)
22
- MangoPay.request(:put, url(user_id, ubo_declaration_id, ubo_id), params)
21
+ def update(user_id, ubo_declaration_id, ubo_id, params, idempotency_key = nil)
22
+ MangoPay.request(:put, url(user_id, ubo_declaration_id, ubo_id), params, {}, idempotency_key)
23
23
  end
24
24
  end
25
25
  end
@@ -10,20 +10,22 @@ module MangoPay
10
10
  end
11
11
  end
12
12
 
13
- def create(user_id)
14
- MangoPay.request(:post, url(user_id))
13
+ def create(user_id, idempotency_key)
14
+ MangoPay.request(:post, url(user_id), {}, {}, idempotency_key)
15
15
  end
16
16
 
17
- def fetch(user_id, id)
18
- MangoPay.request(:get, url(user_id, id))
17
+ # Fetches the Ubo declaration belonging to the given +user_id+ if given, with the given +id+.
18
+ def fetch(user_id, id, idempotency_key)
19
+ url = (user_id) ? url(user_id, id) : "#{MangoPay.api_path}/kyc/ubodeclarations/#{CGI.escape(id.to_s)}"
20
+ MangoPay.request(:get, url, {}, {}, idempotency_key)
19
21
  end
20
22
 
21
- def update(user_id, id, params = {})
23
+ def update(user_id, id, params = {}, idempotency_key)
22
24
  request_params = {
23
25
  Status: params['Status'],
24
26
  Ubos: params['Ubos']
25
27
  }
26
- MangoPay.request(:put, url(user_id, id), request_params)
28
+ MangoPay.request(:put, url(user_id, id), request_params, {}, idempotency_key)
27
29
  end
28
30
  end
29
31
  end
@@ -1,3 +1,3 @@
1
1
  module MangoPay
2
- VERSION = '3.0.38'
2
+ VERSION = '3.5.0'
3
3
  end
@@ -10,8 +10,8 @@ module MangoPay
10
10
  # Optional +filters+ is a hash accepting following keys:
11
11
  # - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
12
12
  # - other keys specific for transactions filtering (see MangoPay::Transaction.fetch)
13
- def self.transactions(wallet_id, filters = {})
14
- Transaction.fetch(wallet_id, filters)
13
+ def self.transactions(wallet_id, filters = {}, headers = nil)
14
+ Transaction.fetch(wallet_id, filters, headers)
15
15
  end
16
16
  end
17
17
  end
Binary file
@@ -151,8 +151,8 @@ describe MangoPay::Client do
151
151
  PostalCode: '75001',
152
152
  Country: 'FR'
153
153
  },
154
- IBAN: 'FR7618829754160173622224154',
155
- BIC: 'CMBRFR2BCME',
154
+ IBAN: 'FR7630004000031234567890143',
155
+ BIC: 'BNPAFRPP',
156
156
  Tag: 'Test bank account')
157
157
  expect(bank_account).not_to be_nil
158
158
  expect(bank_account['Id']).not_to be_nil
@@ -172,8 +172,8 @@ describe MangoPay::Client do
172
172
  PostalCode: '75001',
173
173
  Country: 'FR'
174
174
  },
175
- IBAN: 'FR7618829754160173622224154',
176
- BIC: 'CMBRFR2BCME',
175
+ IBAN: 'FR7630004000031234567890143',
176
+ BIC: 'BNPAFRPP',
177
177
  Tag: 'Test bank account')
178
178
  pay_out = MangoPay::Client.create_payout(BankAccountId: bank_account['Id'],
179
179
 
@@ -183,6 +183,7 @@ describe MangoPay::Client do
183
183
  },
184
184
  DebitedWalletId: wallets[0]['Id'],
185
185
  BankWireRef: 'invoice 7282',
186
+ PayoutModeRequested: 'STANDARD',
186
187
  Tag: 'bla')
187
188
 
188
189
  expect(pay_out).not_to be_nil
@@ -6,7 +6,11 @@ describe MangoPay::Configuration do
6
6
  c.client_id = 'test_asd'
7
7
  c.client_apiKey = '00000'
8
8
  MangoPay::User.fetch()
9
- }.to raise_error(MangoPay::ResponseError)
9
+ }.to raise_error { |err|
10
+ expect(err).to be_a MangoPay::ResponseError
11
+ expect(err.code).to eq '401'
12
+ expect(err.message).to eq 'invalid_client'
13
+ }
10
14
  end
11
15
 
12
16
  it 'goes ok when calling with correct client credentials' do
Binary file
Binary file
@@ -1,6 +1,7 @@
1
1
  describe MangoPay do
2
2
  include_context 'users'
3
3
  include_context 'payins'
4
+ require 'json'
4
5
 
5
6
  describe 'requests log file' do
6
7
 
@@ -11,6 +11,7 @@ describe MangoPay::PayIn::ApplePay::Direct, type: :feature do
11
11
 
12
12
  describe 'CREATE' do
13
13
  it 'creates a applepay direct payin' do
14
+ #pending("no cards to test for")
14
15
  created = new_payin_applepay_direct
15
16
  expect(created['Id']).not_to be_nil
16
17
  check_type_and_status(created)
@@ -19,6 +19,7 @@ describe MangoPay::PayIn::Card::Direct, type: :feature do
19
19
  it 'creates a card direct payin' do
20
20
  created = new_payin_card_direct
21
21
  expect(created['Id']).not_to be_nil
22
+ expect(created['Requested3DSVersion']).not_to be_nil
22
23
  check_type_and_status(created)
23
24
  end
24
25
  end
@@ -40,6 +40,15 @@ describe MangoPay::PayOut::BankWire, type: :feature do
40
40
  end
41
41
  end
42
42
 
43
+ describe 'Get Bankwire' do
44
+ it 'gets a bankwire' do
45
+ created = new_payout_bankwire
46
+ fetched = MangoPay::PayOut::BankWire.get_bankwire(created['Id'])
47
+ expect(fetched['Id']).to eq(created['Id'])
48
+ expect(fetched['CreationDate']).to eq(created['CreationDate'])
49
+ end
50
+ end
51
+
43
52
  describe 'FETCH' do
44
53
  it 'fetches a payout' do
45
54
  created = new_payout_bankwire
@@ -15,6 +15,7 @@ describe MangoPay::PreAuthorization do
15
15
  expect(created['PaymentStatus']).to eq('WAITING')
16
16
  expect(created['PaymentType']).to eq('CARD')
17
17
  expect(created['ExecutionType']).to eq('DIRECT')
18
+ expect(created['Requested3DSVersion']).to eq('V1')
18
19
  end
19
20
  end
20
21
 
@@ -0,0 +1,66 @@
1
+ describe MangoPay::PayIn::RecurringPayments, type: :feature do
2
+ include_context 'wallets'
3
+ include_context 'users'
4
+ include_context 'payins'
5
+
6
+ describe 'CREATE' do
7
+ it 'creates a recurring payment' do
8
+ cardreg = new_card_registration_3dsecure_completed
9
+ wallet = new_wallet
10
+ recurring = MangoPay::PayIn::RecurringPayments::Recurring.create(
11
+ AuthorId: new_natural_user['Id'],
12
+ CardId: cardreg['CardId'],
13
+ CreditedUserId: wallet['Owners'][0],
14
+ CreditedWalletId: wallet['Id'],
15
+ FirstTransactionDebitedFunds: {Currency: 'EUR', Amount: 10},
16
+ FirstTransactionFees: {Currency: 'EUR', Amount: 1},
17
+ Billing: {
18
+ Address: {
19
+ AddressLine1: 'AddressLine1',
20
+ AddressLine2: 'AddressLine2',
21
+ City: 'City',
22
+ Region: 'Region',
23
+ PostalCode: 'PostalCode',
24
+ Country: 'FR'
25
+ },
26
+ FirstName: 'Joe',
27
+ LastName: 'Blogs'
28
+ },
29
+ Shipping: {
30
+ Address: {
31
+ AddressLine1: 'AddressLine1',
32
+ AddressLine2: 'AddressLine2',
33
+ City: 'City',
34
+ Region: 'Region',
35
+ PostalCode: 'PostalCode',
36
+ Country: 'FR'
37
+ },
38
+ FirstName: 'Joe',
39
+ LastName: 'Blogs'
40
+ }
41
+ )
42
+ expect(recurring).not_to be_nil
43
+
44
+ cit = MangoPay::PayIn::RecurringPayments::CIT.create(
45
+ RecurringPayinRegistrationId: recurring['Id'],
46
+ IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C",
47
+ SecureModeReturnURL: "http://www.my-site.com/returnurl",
48
+ StatementDescriptor: "lorem",
49
+ Tag: "custom meta",
50
+ BrowserInfo: {
51
+ AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
52
+ JavaEnabled: true,
53
+ Language: "FR-FR",
54
+ ColorDepth: 4,
55
+ ScreenHeight: 1800,
56
+ ScreenWidth: 400,
57
+ JavascriptEnabled: true,
58
+ TimeZoneOffset: "+60",
59
+ UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
60
+ }
61
+ )
62
+
63
+ expect(cit).not_to be_nil
64
+ end
65
+ end
66
+ end
@@ -136,8 +136,8 @@ shared_context 'bank_accounts' do
136
136
  PostalCode: '75001',
137
137
  Country: 'FR'
138
138
  },
139
- IBAN: 'FR7618829754160173622224154',
140
- BIC: 'CMBRFR2BCME',
139
+ IBAN: 'FR7630004000031234567890143',
140
+ BIC: 'BNPAFRPP',
141
141
  Tag: 'Test bank account')
142
142
  end
143
143
  end
@@ -355,6 +355,28 @@ shared_context 'payins' do
355
355
  RegistrationData: cardreg['RegistrationData'])
356
356
  end
357
357
 
358
+ let(:new_card_registration_3dsecure_completed) do
359
+ # 1st step: create
360
+ cardreg = new_card_registration
361
+
362
+ # 2nd step: tokenize by payline (fills-in RegistrationData)
363
+ data = {
364
+ data: cardreg['PreregistrationData'],
365
+ accessKeyRef: cardreg['AccessKey'],
366
+ cardNumber: 4970105191923460,
367
+ cardExpirationDate: 1224,
368
+ cardCvx: 123}
369
+
370
+ res = Net::HTTP.post_form(URI(cardreg['CardRegistrationURL']), data)
371
+ raise Exception, [res, res.body] unless res.is_a?(Net::HTTPOK) && res.body.start_with?('data=')
372
+
373
+ cardreg['RegistrationData'] = res.body
374
+
375
+ # 3rd step: update (fills-in CardId) and return it
376
+ MangoPay::CardRegistration.update(cardreg['Id'],
377
+ RegistrationData: cardreg['RegistrationData'])
378
+ end
379
+
358
380
  let(:new_payin_card_direct) { create_new_payin_card_direct(new_wallet) }
359
381
 
360
382
  def create_new_payin_card_direct(to_wallet, amnt = 1000)
@@ -368,7 +390,8 @@ shared_context 'payins' do
368
390
  CardType: 'CB_VISA_MASTERCARD',
369
391
  CardId: cardreg['CardId'],
370
392
  SecureModeReturnURL: 'http://test.com',
371
- Tag: 'Test PayIn/Card/Direct'
393
+ Tag: 'Test PayIn/Card/Direct',
394
+ Requested3DSVersion: 'V1'
372
395
  )
373
396
  end
374
397
 
@@ -385,7 +408,8 @@ shared_context 'payins' do
385
408
  CardId: cardreg['CardId'],
386
409
  SecureMode: 'DEFAULT',
387
410
  SecureModeReturnURL: 'http://test.com',
388
- Tag: 'Test Card PreAuthorization'
411
+ Tag: 'Test Card PreAuthorization',
412
+ Requested3DSVersion: 'V1'
389
413
  )
390
414
  end
391
415
 
@@ -437,7 +461,8 @@ shared_context 'payouts' do
437
461
  Fees: {Currency: 'EUR', Amount: 0},
438
462
  BankAccountId: new_bank_account['Id'],
439
463
  Communication: 'This is a test',
440
- Tag: 'Test PayOut/Bank/Wire'
464
+ Tag: 'Test PayOut/Bank/Wire',
465
+ PayoutModeRequested: 'Standard'
441
466
  )
442
467
  end
443
468
  end
@@ -6,9 +6,20 @@ describe MangoPay::UboDeclaration do
6
6
  it 'can fetch a UBO declaration' do
7
7
  legal_user = new_legal_user
8
8
 
9
- ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'])
9
+ ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'], nil)
10
10
 
11
- ubo_declaration_byId = MangoPay::UboDeclaration.fetch(legal_user['Id'], ubo_declaration['Id'])
11
+ ubo_declaration_byId = MangoPay::UboDeclaration.fetch(legal_user['Id'], ubo_declaration['Id'], nil)
12
+
13
+ expect(ubo_declaration).not_to be_nil
14
+ expect(ubo_declaration_byId).not_to be_nil
15
+ end
16
+
17
+ it 'fetches ubo declaration just by id' do
18
+ legal_user = new_legal_user
19
+
20
+ ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'], nil)
21
+
22
+ ubo_declaration_byId = MangoPay::UboDeclaration.fetch(nil, ubo_declaration['Id'], nil)
12
23
 
13
24
  expect(ubo_declaration).not_to be_nil
14
25
  expect(ubo_declaration_byId).not_to be_nil
@@ -17,13 +28,13 @@ describe MangoPay::UboDeclaration do
17
28
  describe 'UPDATE' do
18
29
  it 'can update a UBO declaration' do
19
30
  legal_user = new_legal_user
20
- ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'])
31
+ ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'], nil)
21
32
  ubo_declaration['Status'] = 'VALIDATION_ASKED'
22
33
 
23
34
  ubo = new_ubo(legal_user, ubo_declaration)
24
35
 
25
36
  ubo_declaration['Ubos'] = [ubo]
26
- ubo_declaration = MangoPay::UboDeclaration.update(legal_user['Id'], ubo_declaration['Id'], ubo_declaration)
37
+ ubo_declaration = MangoPay::UboDeclaration.update(legal_user['Id'], ubo_declaration['Id'], ubo_declaration, nil)
27
38
 
28
39
  expect(ubo_declaration).not_to be_nil
29
40
  expect(ubo_declaration['Status']).to eq 'VALIDATION_ASKED'
@@ -5,7 +5,7 @@ describe MangoPay::Ubo do
5
5
  describe 'FETCH' do
6
6
  it 'can fetch a Ubo' do
7
7
  legal_user = new_legal_user
8
- ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'])
8
+ ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'], nil)
9
9
  ubo = new_ubo(legal_user, ubo_declaration)
10
10
  result = MangoPay::Ubo.fetch(legal_user['Id'], ubo_declaration['Id'], ubo['Id'])
11
11
  expect(result).not_to be_nil
@@ -16,7 +16,7 @@ describe MangoPay::Ubo do
16
16
  describe 'CREATE' do
17
17
  it 'can create a new Ubo' do
18
18
  legal_user = new_legal_user
19
- ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'])
19
+ ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'], nil)
20
20
  result = new_ubo(legal_user, ubo_declaration)
21
21
  expect(result).not_to be_nil
22
22
  end
@@ -25,7 +25,7 @@ describe MangoPay::Ubo do
25
25
  describe 'UPDATE' do
26
26
  it 'can update a Ubo' do
27
27
  legal_user = new_legal_user
28
- ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'])
28
+ ubo_declaration = MangoPay::UboDeclaration.create(legal_user['Id'], nil)
29
29
  ubo = new_ubo(legal_user, ubo_declaration)
30
30
  ubo['FirstName'] = 'Santa'
31
31
  ubo['LastName'] = 'Clause'
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.0.38
4
+ version: 3.5.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: 2020-12-16 00:00:00.000000000 Z
12
+ date: 2021-06-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -134,6 +134,7 @@ files:
134
134
  - spec/mangopay/payin_preauthorized_direct_spec.rb
135
135
  - spec/mangopay/payout_bankwire_spec.rb
136
136
  - spec/mangopay/preauthorization_spec.rb
137
+ - spec/mangopay/recurring_payin_spec.rb
137
138
  - spec/mangopay/refund_spec.rb
138
139
  - spec/mangopay/report_spec.rb
139
140
  - spec/mangopay/report_wallets_spec.rb
@@ -198,6 +199,7 @@ test_files:
198
199
  - spec/mangopay/payin_preauthorized_direct_spec.rb
199
200
  - spec/mangopay/payout_bankwire_spec.rb
200
201
  - spec/mangopay/preauthorization_spec.rb
202
+ - spec/mangopay/recurring_payin_spec.rb
201
203
  - spec/mangopay/refund_spec.rb
202
204
  - spec/mangopay/report_spec.rb
203
205
  - spec/mangopay/report_wallets_spec.rb