mangopay 3.0.32 → 3.0.33

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 12dc8e2f6ecc5798628cbc487075f3d9bf7100d0d5c17e1ec2bdb6c6ab4d0592
4
- data.tar.gz: 87aff78311a7331e52898938ce4824b5ce72f0b6338898a5b5f163ea012201bf
3
+ metadata.gz: 6aa62f07baf4f2f9a60c0477b5a7dea909afe7e8a65a35482b2739590c4059f1
4
+ data.tar.gz: 8c886e16b34503ddcdb574a09203acd0b27b301ddf5c334a94d2c2b11efe2dde
5
5
  SHA512:
6
- metadata.gz: a5c90e91c9dee7eb80e250d0f46d04b4af4995ae5cbe25e743eb5870e09b0dd6fa5f4055e5faa4770659a8b5296ba2421dc1d9883aaf4e31d841792ee3260fc8
7
- data.tar.gz: e93958461b0ee968f492d79ae4b7b2402364d9bf7657c07162dac3558a409ce44f6d1706c29b8bed3b623535680e92452cde44a801f3aad844291532eba5a147
6
+ metadata.gz: 2a6f3b71c8625444bb044cc110e00da1beb9e5337e68808b3e18b49e0607ca239d56e9837b269827a685c269c1d5cb4448c004e322c08888613ebd76266fafc6
7
+ data.tar.gz: b7565b1c8c65ff20e20b04eeab7b75acb1495cdb69b1d44ae806b170be4c237c44911a9d14cfaa1151cfaa7ee8bbe9a3c9203d3030f6b44efaf8eb7abedfbd8e
@@ -0,0 +1,20 @@
1
+ ## [Unreleased]
2
+ ### New v4 SDK version (available as a beta version here: https://rubygems.org/gems/mangopay-v4) - will be shortly merged on master.
3
+
4
+ ## [3.0.33] - 2019-09-23
5
+ ### Added
6
+ - ApplePay `Payin` functions are now available. More info about activation to come in the following weeks...
7
+ ### Changed
8
+ - 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)
9
+
10
+ ## [v3.0.32] - 2019-06-19
11
+ ### Added
12
+ - New UBO Declaration system (more info [here](https://docs.mangopay.com/endpoints/v2.01/ubo-declarations#e1024_the-ubo-declaration-object))
13
+ ### Changed
14
+ - Paypal buyer account email that has been used is now available for Payin Paypal
15
+ - Your `HeadquartersPhoneNumber` can now be updated for your client account directly from our API
16
+ ### BREAKING
17
+ - `APIKey` is now replacing `passphrase` property for credentials. You must update it by updating to 3.0.32 SDK version and upper ones.
18
+
19
+
20
+
data/README.md CHANGED
@@ -37,7 +37,7 @@ require 'mangopay'
37
37
  MangoPay.configure do |c|
38
38
  c.preproduction = true
39
39
  c.client_id = 'YOUR_CLIENT_ID'
40
- c.client_passphrase = 'YOUR_CLIENT_PASSWORD'
40
+ c.client_apiKey = 'YOUR_CLIENT_API_KEY'
41
41
  c.log_file = File.join('mypath', 'mangopay.log')
42
42
  c.http_timeout = 10000
43
43
  end
@@ -106,5 +106,15 @@ module MangoPay
106
106
 
107
107
  end
108
108
 
109
+ module ApplePay
110
+ class Direct < Resource
111
+ include HTTPCalls::Create
112
+
113
+ def self.url(*)
114
+ "#{MangoPay.api_path}/payins/applepay/#{CGI.escape(class_name.downcase)}"
115
+ end
116
+ end
117
+ end
118
+
109
119
  end
110
120
  end
@@ -12,7 +12,7 @@ module MangoPay
12
12
  # Fetches list of wallets belonging to the given +user_id+.
13
13
  # Optional +filters+ is a hash accepting following keys:
14
14
  # - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
15
- def wallets(user_id, filters={})
15
+ def wallets(user_id, filters = {})
16
16
  MangoPay.request(:get, url(user_id) + '/wallets', {}, filters)
17
17
  end
18
18
 
@@ -20,14 +20,14 @@ module MangoPay
20
20
  # Optional +filters+ is a hash accepting following keys:
21
21
  # - +page+, +per_page+, +sort+: pagination and sorting params
22
22
  # (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
23
- def bank_accounts(user_id, filters={})
23
+ def bank_accounts(user_id, filters = {})
24
24
  MangoPay.request(:get, url(user_id) + '/bankaccounts', {}, filters)
25
25
  end
26
26
 
27
27
  # Fetches list of cards belonging to the given +user_id+.
28
28
  # Optional +filters+ is a hash accepting following keys:
29
29
  # - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
30
- def cards(user_id, filters={})
30
+ def cards(user_id, filters = {})
31
31
  MangoPay.request(:get, url(user_id) + '/cards', {}, filters)
32
32
  end
33
33
 
@@ -35,7 +35,7 @@ module MangoPay
35
35
  # Optional +filters+ is a hash accepting following keys:
36
36
  # - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
37
37
  # - other keys specific for transactions filtering (see MangoPay::Transaction#fetch)
38
- def transactions(user_id, filters={})
38
+ def transactions(user_id, filters = {})
39
39
  MangoPay.request(:get, url(user_id) + '/transactions', {}, filters)
40
40
  end
41
41
 
@@ -43,21 +43,25 @@ module MangoPay
43
43
  # Optional +filters+ is a hash accepting following keys:
44
44
  # - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
45
45
  # - other keys specific for transactions filtering (see MangoPay::Transaction#fetch)
46
- def emoney(user_id, filters={})
47
- MangoPay.request(:get, url(user_id) + '/emoney', {}, filters)
46
+ def emoney(user_id, year, month = nil, filters = {})
47
+ if month
48
+ MangoPay.request(:get, url(user_id) + "/emoney/#{year}/#{month}", {}, filters)
49
+ else
50
+ MangoPay.request(:get, url(user_id) + "/emoney/#{year}", {}, filters)
51
+ end
48
52
  end
49
53
 
50
54
  # Fetches list of kyc documents belonging to the given +user_id+.
51
55
  # Optional +filters+ is a hash accepting following keys:
52
56
  # - +page+, +per_page+, +sort+, +BeforeDate+, +AfterDate+, +Status+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
53
- def kyc_documents(user_id, filters={})
57
+ def kyc_documents(user_id, filters = {})
54
58
  MangoPay.request(:get, url(user_id) + '/KYC/documents', {}, filters)
55
59
  end
56
60
 
57
61
  # Fetches list of pre-authorizations belonging to the given +user_id+.
58
62
  # Optional +filters+ is a hash accepting the following keys:
59
63
  # - +page+, +per_page+, +sort+, +Status+, +ResultCode+, +PaymentStatus+: pagination and sorting/filtering params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
60
- def pre_authorizations(user_id, filters={})
64
+ def pre_authorizations(user_id, filters = {})
61
65
  MangoPay.request(:get, url(user_id) + '/preauthorizations', {}, filters)
62
66
  end
63
67
  end
@@ -1,3 +1,3 @@
1
1
  module MangoPay
2
- VERSION = '3.0.32'
2
+ VERSION = '3.0.33'
3
3
  end
@@ -0,0 +1,20 @@
1
+ describe MangoPay::PayIn::ApplePay::Direct, type: :feature do
2
+ include_context 'payins'
3
+
4
+ def check_type_and_status(payin)
5
+ expect(payin['Type']).to eq('PAYIN')
6
+ expect(payin['Nature']).to eq('REGULAR')
7
+ expect(payin['PaymentType']).to eq('APPLEPAY')
8
+ expect(payin['ExecutionType']).to eq('DIRECT')
9
+ expect(payin['Status']).to eq('SUCCEEDED')
10
+ end
11
+
12
+ describe 'CREATE' do
13
+ it 'creates a applepay direct payin' do
14
+ created = new_payin_applepay_direct
15
+ expect(created['Id']).not_to be_nil
16
+ check_type_and_status(created)
17
+ end
18
+ end
19
+ end
20
+
@@ -3,6 +3,7 @@ shared_context 'users' do
3
3
  ###############################################
4
4
 
5
5
  let(:new_natural_user) { create_new_natural_user }
6
+
6
7
  def define_new_natural_user
7
8
  {
8
9
  Tag: 'Test natural user',
@@ -10,13 +11,13 @@ shared_context 'users' do
10
11
  FirstName: 'John',
11
12
  LastName: 'Doe',
12
13
  Address: {
13
- AddressLine1: 'Le Palais Royal',
14
- AddressLine2: '8 Rue de Montpensier',
15
- City: 'Paris',
16
- Region: '',
17
- PostalCode: '75001',
18
- Country: 'FR'
19
- },
14
+ AddressLine1: 'Le Palais Royal',
15
+ AddressLine2: '8 Rue de Montpensier',
16
+ City: 'Paris',
17
+ Region: '',
18
+ PostalCode: '75001',
19
+ Country: 'FR'
20
+ },
20
21
  Birthday: 1_300_186_358,
21
22
  Birthplace: 'Paris',
22
23
  Nationality: 'FR',
@@ -42,21 +43,22 @@ shared_context 'users' do
42
43
  Region: 'FR',
43
44
  PostalCode: '75004',
44
45
  Country: 'FR'
45
- },
46
+ },
46
47
  LegalRepresentativeFirstName: 'John',
47
48
  LegalRepresentativeLastName: 'Doe',
48
49
  LegalRepresentativeAdress: {
49
- AddressLine1: '38 Rue de Montpensier',
50
- AddressLine2: '',
51
- City: 'Paris',
52
- Region: '',
53
- PostalCode: '75001',
54
- Country: 'FR'
55
- },
50
+ AddressLine1: '38 Rue de Montpensier',
51
+ AddressLine2: '',
52
+ City: 'Paris',
53
+ Region: '',
54
+ PostalCode: '75001',
55
+ Country: 'FR'
56
+ },
56
57
  LegalRepresentativeEmail: 'john@doe.com',
57
58
  LegalRepresentativeBirthday: 1_300_186_358,
58
59
  LegalRepresentativeNationality: 'FR',
59
60
  LegalRepresentativeCountryOfResidence: 'FR',
61
+ CompanyNumber: 'LU123456789',
60
62
  Statute: '',
61
63
  ProofOfRegistration: '',
62
64
  ShareholderDeclaration: ''
@@ -71,12 +73,13 @@ shared_context 'wallets' do
71
73
 
72
74
  let(:new_wallet) { create_new_wallet(new_natural_user) }
73
75
  let(:new_wallet_legal) { create_new_wallet(new_legal_user) }
76
+
74
77
  def create_new_wallet(user)
75
78
  MangoPay::Wallet.create(
76
- Owners: [user['Id']],
77
- Description: 'A test wallet',
78
- Currency: 'EUR',
79
- Tag: 'Test wallet'
79
+ Owners: [user['Id']],
80
+ Description: 'A test wallet',
81
+ Currency: 'EUR',
82
+ Tag: 'Test wallet'
80
83
  )
81
84
  end
82
85
 
@@ -144,14 +147,14 @@ shared_context 'mandates' do
144
147
  ###############################################
145
148
  include_context 'bank_accounts'
146
149
 
147
- let(:new_mandate) {create_new_mandate}
150
+ let(:new_mandate) { create_new_mandate }
148
151
 
149
152
  def create_new_mandate
150
153
  MangoPay::Mandate.create(
151
- BankAccountId: new_bank_account['Id'],
152
- Culture: 'FR',
153
- ReturnURL: MangoPay.configuration.root_url,
154
- Tag: 'Test mandate'
154
+ BankAccountId: new_bank_account['Id'],
155
+ Culture: 'FR',
156
+ ReturnURL: MangoPay.configuration.root_url,
157
+ Tag: 'Test mandate'
155
158
  )
156
159
  end
157
160
  end
@@ -162,6 +165,7 @@ shared_context 'kyc_documents' do
162
165
  include_context 'users'
163
166
 
164
167
  let(:new_document) { create_new_document(new_natural_user) }
168
+
165
169
  def create_new_document(user)
166
170
  MangoPay::KycDocument.create(user['Id'],
167
171
  Type: 'IDENTITY_PROOF',
@@ -182,15 +186,15 @@ shared_context 'payins' do
182
186
 
183
187
  let(:new_payin_directdebit_web) do
184
188
  MangoPay::PayIn::DirectDebit::Web.create(
185
- AuthorId: new_natural_user['Id'],
186
- CreditedUserId: new_wallet['Owners'][0],
187
- CreditedWalletId: new_wallet['Id'],
188
- DebitedFunds: { Currency: 'EUR', Amount: 1000 },
189
- Fees: { Currency: 'EUR', Amount: 0 },
190
- DirectDebitType: 'GIROPAY',
191
- ReturnURL: MangoPay.configuration.root_url,
192
- Culture: 'FR',
193
- Tag: 'Test PayIn/DirectDebit/Web'
189
+ AuthorId: new_natural_user['Id'],
190
+ CreditedUserId: new_wallet['Owners'][0],
191
+ CreditedWalletId: new_wallet['Id'],
192
+ DebitedFunds: {Currency: 'EUR', Amount: 1000},
193
+ Fees: {Currency: 'EUR', Amount: 0},
194
+ DirectDebitType: 'GIROPAY',
195
+ ReturnURL: MangoPay.configuration.root_url,
196
+ Culture: 'FR',
197
+ Tag: 'Test PayIn/DirectDebit/Web'
194
198
  )
195
199
  end
196
200
 
@@ -200,13 +204,36 @@ shared_context 'payins' do
200
204
 
201
205
  let(:new_payin_paypal_web) do
202
206
  MangoPay::PayIn::PayPal::Web.create(
203
- AuthorId: new_natural_user['Id'],
204
- CreditedUserId: new_wallet['Owners'][0],
205
- CreditedWalletId: new_wallet['Id'],
206
- DebitedFunds: { Currency: 'EUR', Amount: 1000 },
207
- Fees: { Currency: 'EUR', Amount: 0 },
208
- ReturnURL: MangoPay.configuration.root_url,
209
- Tag: 'Test PayIn/PayPal/Web'
207
+ AuthorId: new_natural_user['Id'],
208
+ CreditedUserId: new_wallet['Owners'][0],
209
+ CreditedWalletId: new_wallet['Id'],
210
+ DebitedFunds: {Currency: 'EUR', Amount: 1000},
211
+ Fees: {Currency: 'EUR', Amount: 0},
212
+ ReturnURL: MangoPay.configuration.root_url,
213
+ Tag: 'Test PayIn/PayPal/Web'
214
+ )
215
+ end
216
+
217
+ ###############################################
218
+ # applepay/direct
219
+ ###############################################
220
+
221
+ let(:new_payin_applepay_direct) do
222
+ MangoPay::PayIn::ApplePay::Direct.create(
223
+ AuthorId: new_natural_user['Id'],
224
+ CreditedUserId: new_wallet['Owners'][0],
225
+ CreditedWalletId: new_wallet['Id'],
226
+ DebitedFunds: {Currency: 'EUR', Amount: 199},
227
+ Fees: {Currency: 'EUR', Amount: 1},
228
+ PaymentType: 'APPLEPAY',
229
+ PaymentData: {
230
+ TransactionId: '061EB32181A2D9CA42AD16031B476EEBAA62A9A095AD660E2759FBA52B51A61',
231
+ Network: 'VISA',
232
+ TokenData: "{\"version\":\"EC_v1\",\"data\":\"w4HMBVqNC9ghPP4zncTA\\/0oQAsduERfsx78oxgniynNjZLANTL6+0koEtkQnW\\/K38Zew8qV1GLp+fLHo+qCBpiKCIwlz3eoFBTbZU+8pYcjaeIYBX9SOxcwxXsNGrGLk+kBUqnpiSIPaAG1E+WPT8R1kjOCnGvtdombvricwRTQkGjtovPfzZo8LzD3ZQJnHMsWJ8QYDLyr\\/ZN9gtLAtsBAMvwManwiaG3pOIWpyeOQOb01YcEVO16EZBjaY4x4C\\/oyFLWDuKGvhbJwZqWh1d1o9JT29QVmvy3Oq2JEjq3c3NutYut4rwDEP4owqI40Nb7mP2ebmdNgnYyWfPmkRfDCRHIWtbMC35IPg5313B1dgXZ2BmyZRXD5p+mr67vAk7iFfjEpu3GieFqwZrTl3\\/pI5V8Sxe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AYwzBj8ezDDC55ZolyH1FL+Xc8fd93o=\",\"transactionId\":\"b061eb32181a2d9ca42ad16031b476eebaa62a9a095ad660e2759fba52b51a61\"}}"
233
+ },
234
+ StatementDescriptor: "php",
235
+ ReturnURL: MangoPay.configuration.root_url,
236
+ Tag: 'Test PayIn/ApplePay/Direct'
210
237
  )
211
238
  end
212
239
 
@@ -216,14 +243,14 @@ shared_context 'payins' do
216
243
 
217
244
  let(:new_payin_directdebit_direct) do
218
245
  MangoPay::PayIn::DirectDebit::Direct.create(
219
- AuthorId: new_natural_user['Id'],
220
- CreditedUserId: new_wallet['Owners'][0],
221
- CreditedWalletId: new_wallet['Id'],
222
- DebitedFunds: { Currency: 'EUR', Amount: 1000 },
223
- Fees: { Currency: 'EUR', Amount: 0 },
224
- MandateId: new_mandate['Id'],
225
- ReturnURL: MangoPay.configuration.root_url,
226
- Tag: 'Test PayIn/DirectDebit/Direct'
246
+ AuthorId: new_natural_user['Id'],
247
+ CreditedUserId: new_wallet['Owners'][0],
248
+ CreditedWalletId: new_wallet['Id'],
249
+ DebitedFunds: {Currency: 'EUR', Amount: 1000},
250
+ Fees: {Currency: 'EUR', Amount: 0},
251
+ MandateId: new_mandate['Id'],
252
+ ReturnURL: MangoPay.configuration.root_url,
253
+ Tag: 'Test PayIn/DirectDebit/Direct'
227
254
  )
228
255
  end
229
256
 
@@ -233,15 +260,15 @@ shared_context 'payins' do
233
260
 
234
261
  let(:new_payin_card_web) do
235
262
  MangoPay::PayIn::Card::Web.create(
236
- AuthorId: new_natural_user['Id'],
237
- CreditedUserId: new_wallet['Owners'][0],
238
- CreditedWalletId: new_wallet['Id'],
239
- DebitedFunds: { Currency: 'EUR', Amount: 1000 },
240
- Fees: { Currency: 'EUR', Amount: 0 },
241
- CardType: 'CB_VISA_MASTERCARD',
242
- ReturnURL: MangoPay.configuration.root_url,
243
- Culture: 'FR',
244
- Tag: 'Test PayIn/Card/Web'
263
+ AuthorId: new_natural_user['Id'],
264
+ CreditedUserId: new_wallet['Owners'][0],
265
+ CreditedWalletId: new_wallet['Id'],
266
+ DebitedFunds: {Currency: 'EUR', Amount: 1000},
267
+ Fees: {Currency: 'EUR', Amount: 0},
268
+ CardType: 'CB_VISA_MASTERCARD',
269
+ ReturnURL: MangoPay.configuration.root_url,
270
+ Culture: 'FR',
271
+ Tag: 'Test PayIn/Card/Web'
245
272
  )
246
273
  end
247
274
 
@@ -251,9 +278,9 @@ shared_context 'payins' do
251
278
 
252
279
  let(:new_card_registration) do
253
280
  MangoPay::CardRegistration.create(
254
- UserId: new_natural_user['Id'],
255
- Currency: 'EUR',
256
- Tag: 'Test Card Registration'
281
+ UserId: new_natural_user['Id'],
282
+ Currency: 'EUR',
283
+ Tag: 'Test Card Registration'
257
284
  )
258
285
  end
259
286
 
@@ -263,11 +290,11 @@ shared_context 'payins' do
263
290
 
264
291
  # 2nd step: tokenize by payline (fills-in RegistrationData)
265
292
  data = {
266
- data: cardreg['PreregistrationData'],
267
- accessKeyRef: cardreg['AccessKey'],
268
- cardNumber: 4970100000000154,
269
- cardExpirationDate: 1226,
270
- cardCvx: 123}
293
+ data: cardreg['PreregistrationData'],
294
+ accessKeyRef: cardreg['AccessKey'],
295
+ cardNumber: 4970100000000154,
296
+ cardExpirationDate: 1226,
297
+ cardCvx: 123}
271
298
 
272
299
  res = Net::HTTP.post_form(URI(cardreg['CardRegistrationURL']), data)
273
300
  raise Exception, [res, res.body] unless res.is_a?(Net::HTTPOK) && res.body.start_with?('data=')
@@ -280,18 +307,19 @@ shared_context 'payins' do
280
307
  end
281
308
 
282
309
  let(:new_payin_card_direct) { create_new_payin_card_direct(new_wallet) }
310
+
283
311
  def create_new_payin_card_direct(to_wallet, amnt = 1000)
284
312
  cardreg = new_card_registration_completed
285
313
  MangoPay::PayIn::Card::Direct.create(
286
- AuthorId: new_natural_user['Id'],
287
- CreditedUserId: to_wallet['Owners'][0],
288
- CreditedWalletId: to_wallet['Id'],
289
- DebitedFunds: { Currency: 'EUR', Amount: amnt },
290
- Fees: { Currency: 'EUR', Amount: 0 },
291
- CardType: 'CB_VISA_MASTERCARD',
292
- CardId: cardreg['CardId'],
293
- SecureModeReturnURL: 'http://test.com',
294
- Tag: 'Test PayIn/Card/Direct'
314
+ AuthorId: new_natural_user['Id'],
315
+ CreditedUserId: to_wallet['Owners'][0],
316
+ CreditedWalletId: to_wallet['Id'],
317
+ DebitedFunds: {Currency: 'EUR', Amount: amnt},
318
+ Fees: {Currency: 'EUR', Amount: 0},
319
+ CardType: 'CB_VISA_MASTERCARD',
320
+ CardId: cardreg['CardId'],
321
+ SecureModeReturnURL: 'http://test.com',
322
+ Tag: 'Test PayIn/Card/Direct'
295
323
  )
296
324
  end
297
325
 
@@ -300,28 +328,30 @@ shared_context 'payins' do
300
328
  ###############################################
301
329
 
302
330
  let(:new_card_preauthorization) { create_new_card_preauthorization(new_card_registration_completed) }
331
+
303
332
  def create_new_card_preauthorization(cardreg, amnt = 1000)
304
333
  MangoPay::PreAuthorization.create(
305
- AuthorId: new_natural_user['Id'],
306
- DebitedFunds: { Currency: 'EUR', Amount: amnt },
307
- CardId: cardreg['CardId'],
308
- SecureMode: 'DEFAULT',
309
- SecureModeReturnURL: 'http://test.com',
310
- Tag: 'Test Card PreAuthorization'
334
+ AuthorId: new_natural_user['Id'],
335
+ DebitedFunds: {Currency: 'EUR', Amount: amnt},
336
+ CardId: cardreg['CardId'],
337
+ SecureMode: 'DEFAULT',
338
+ SecureModeReturnURL: 'http://test.com',
339
+ Tag: 'Test Card PreAuthorization'
311
340
  )
312
341
  end
313
342
 
314
343
  let(:new_payin_preauthorized_direct) { create_new_payin_preauthorized_direct(new_wallet) }
344
+
315
345
  def create_new_payin_preauthorized_direct(to_wallet, amnt = 1000)
316
346
  preauth = new_card_preauthorization
317
347
  MangoPay::PayIn::PreAuthorized::Direct.create(
318
- AuthorId: new_natural_user['Id'],
319
- CreditedUserId: to_wallet['Owners'][0],
320
- CreditedWalletId: to_wallet['Id'],
321
- DebitedFunds: { Currency: 'EUR', Amount: amnt },
322
- Fees: { Currency: 'EUR', Amount: 0 },
323
- PreauthorizationId: preauth['Id'],
324
- Tag: 'Test PayIn/PreAuthorized/Direct'
348
+ AuthorId: new_natural_user['Id'],
349
+ CreditedUserId: to_wallet['Owners'][0],
350
+ CreditedWalletId: to_wallet['Id'],
351
+ DebitedFunds: {Currency: 'EUR', Amount: amnt},
352
+ Fees: {Currency: 'EUR', Amount: 0},
353
+ PreauthorizationId: preauth['Id'],
354
+ Tag: 'Test PayIn/PreAuthorized/Direct'
325
355
  )
326
356
  end
327
357
 
@@ -330,14 +360,15 @@ shared_context 'payins' do
330
360
  ###############################################
331
361
 
332
362
  let(:new_payin_bankwire_direct) { create_new_payin_bankwire_direct(new_wallet) }
363
+
333
364
  def create_new_payin_bankwire_direct(to_wallet, amnt = 1000)
334
365
  MangoPay::PayIn::BankWire::Direct.create(
335
- AuthorId: new_natural_user['Id'],
336
- CreditedUserId: to_wallet['Owners'][0],
337
- CreditedWalletId: to_wallet['Id'],
338
- DeclaredDebitedFunds: { Currency: 'EUR', Amount: amnt },
339
- DeclaredFees: { Currency: 'EUR', Amount: 0 },
340
- Tag: 'Test PayIn/BankWire/Direct'
366
+ AuthorId: new_natural_user['Id'],
367
+ CreditedUserId: to_wallet['Owners'][0],
368
+ CreditedWalletId: to_wallet['Id'],
369
+ DeclaredDebitedFunds: {Currency: 'EUR', Amount: amnt},
370
+ DeclaredFees: {Currency: 'EUR', Amount: 0},
371
+ Tag: 'Test PayIn/BankWire/Direct'
341
372
  )
342
373
  end
343
374
  end
@@ -348,15 +379,16 @@ shared_context 'payouts' do
348
379
  include_context 'bank_accounts'
349
380
 
350
381
  let(:new_payout_bankwire) { create_new_payout_bankwire(new_payin_card_direct) }
382
+
351
383
  def create_new_payout_bankwire(payin, amnt = 500)
352
384
  MangoPay::PayOut::BankWire.create(
353
- AuthorId: payin['CreditedUserId'],
354
- DebitedWalletId: payin['CreditedWalletId'],
355
- DebitedFunds: { Currency: 'EUR', Amount: amnt },
356
- Fees: { Currency: 'EUR', Amount: 0 },
357
- BankAccountId: new_bank_account['Id'],
358
- Communication: 'This is a test',
359
- Tag: 'Test PayOut/Bank/Wire'
385
+ AuthorId: payin['CreditedUserId'],
386
+ DebitedWalletId: payin['CreditedWalletId'],
387
+ DebitedFunds: {Currency: 'EUR', Amount: amnt},
388
+ Fees: {Currency: 'EUR', Amount: 0},
389
+ BankAccountId: new_bank_account['Id'],
390
+ Communication: 'This is a test',
391
+ Tag: 'Test PayOut/Bank/Wire'
360
392
  )
361
393
  end
362
394
  end
@@ -374,6 +406,7 @@ shared_context 'transfers' do
374
406
  create_new_payin_card_direct(wlt1, 1000) # feed wlt1 with money
375
407
  create_new_transfer(wlt1, wlt2, 500) # transfer wlt1 => wlt2
376
408
  end
409
+
377
410
  def create_new_transfer(from_wallet, to_wallet, amnt = 500)
378
411
  MangoPay::Transfer.create(
379
412
  AuthorId: from_wallet['Owners'][0],
@@ -394,9 +427,9 @@ shared_context 'hooks' do
394
427
  hooks = MangoPay::Hook.fetch('page' => 1, 'per_page' => 1)
395
428
  if hooks.empty?
396
429
  MangoPay::Hook.create(
397
- EventType: 'PAYIN_NORMAL_CREATED',
398
- Url: 'http://test.com',
399
- Tag: 'Test hook'
430
+ EventType: 'PAYIN_NORMAL_CREATED',
431
+ Url: 'http://test.com',
432
+ Tag: 'Test hook'
400
433
  )
401
434
  else
402
435
  hooks[0]
@@ -13,6 +13,10 @@ describe MangoPay::User do
13
13
  it 'creates a new legal user' do
14
14
  expect(new_legal_user["LegalRepresentativeFirstName"]).to eq('John')
15
15
  end
16
+
17
+ it 'creates a new legal user' do
18
+ expect(new_legal_user["CompanyNumber"]).to eq('LU123456789')
19
+ end
16
20
  end
17
21
 
18
22
  describe 'UPDATE' do
@@ -147,8 +151,17 @@ describe MangoPay::User do
147
151
  end
148
152
 
149
153
  describe 'FETCH EMONEY' do
150
- it 'fetches emoney for the user' do
151
- emoney = MangoPay::User.emoney(new_natural_user['Id'])
154
+ it 'fetches emoney for the user for year 2019' do
155
+ emoney = MangoPay::User.emoney(new_natural_user['Id'], 2019)
156
+ expect(emoney['UserId']).to eq new_natural_user['Id']
157
+ expect(emoney['CreditedEMoney']['Amount']).to eq 0
158
+ expect(emoney['CreditedEMoney']['Currency']).to eq 'EUR'
159
+ expect(emoney['DebitedEMoney']['Amount']).to eq 0
160
+ expect(emoney['DebitedEMoney']['Currency']).to eq 'EUR'
161
+ end
162
+
163
+ it 'fetches emoney for the user for date 08/2019' do
164
+ emoney = MangoPay::User.emoney(new_natural_user['Id'], 2019, 8)
152
165
  expect(emoney['UserId']).to eq new_natural_user['Id']
153
166
  expect(emoney['CreditedEMoney']['Amount']).to eq 0
154
167
  expect(emoney['CreditedEMoney']['Currency']).to eq 'EUR'
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.32
4
+ version: 3.0.33
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: 2019-06-19 00:00:00.000000000 Z
12
+ date: 2019-09-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -66,6 +66,7 @@ files:
66
66
  - ".gitignore"
67
67
  - ".rspec"
68
68
  - ".travis.yml"
69
+ - CHANGELOG.md
69
70
  - Gemfile
70
71
  - LICENSE
71
72
  - README.md
@@ -122,6 +123,7 @@ files:
122
123
  - spec/mangopay/kyc_document_spec.rb
123
124
  - spec/mangopay/log_requests_filter_spec.rb
124
125
  - spec/mangopay/mandate_spec.rb
126
+ - spec/mangopay/payin_applepay_direct_spec.rb
125
127
  - spec/mangopay/payin_bankwire_direct_spec.rb
126
128
  - spec/mangopay/payin_bankwire_external_instruction_spec.rb
127
129
  - spec/mangopay/payin_card_direct_spec.rb
@@ -163,7 +165,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
163
165
  - !ruby/object:Gem::Version
164
166
  version: '0'
165
167
  requirements: []
166
- rubygems_version: 3.0.4
168
+ rubyforge_project:
169
+ rubygems_version: 2.7.7
167
170
  signing_key:
168
171
  specification_version: 4
169
172
  summary: Ruby bindings for the version 2 of the MANGOPAY API
@@ -185,6 +188,7 @@ test_files:
185
188
  - spec/mangopay/kyc_document_spec.rb
186
189
  - spec/mangopay/log_requests_filter_spec.rb
187
190
  - spec/mangopay/mandate_spec.rb
191
+ - spec/mangopay/payin_applepay_direct_spec.rb
188
192
  - spec/mangopay/payin_bankwire_direct_spec.rb
189
193
  - spec/mangopay/payin_bankwire_external_instruction_spec.rb
190
194
  - spec/mangopay/payin_card_direct_spec.rb