mangopay 3.0.23 → 3.0.25.pre.alpha.pre.20

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 (72) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +28 -26
  3. data/.rspec +2 -2
  4. data/.travis.yml +13 -0
  5. data/Gemfile +2 -2
  6. data/LICENSE +20 -20
  7. data/README.md +126 -123
  8. data/bin/mangopay +9 -9
  9. data/lib/generators/mangopay/install_generator.rb +60 -60
  10. data/lib/generators/templates/mangopay.rb.erb +5 -5
  11. data/lib/mangopay.rb +225 -158
  12. data/lib/mangopay/authorization_token.rb +88 -88
  13. data/lib/mangopay/bank_account.rb +38 -38
  14. data/lib/mangopay/card.rb +8 -8
  15. data/lib/mangopay/card_registration.rb +9 -9
  16. data/lib/mangopay/client.rb +74 -74
  17. data/lib/mangopay/dispute.rb +130 -130
  18. data/lib/mangopay/errors.rb +61 -61
  19. data/lib/mangopay/event.rb +18 -18
  20. data/lib/mangopay/filter_parameters.rb +46 -0
  21. data/lib/mangopay/hook.rb +9 -9
  22. data/lib/mangopay/http_calls.rb +85 -85
  23. data/lib/mangopay/json.rb +14 -14
  24. data/lib/mangopay/kyc_document.rb +70 -70
  25. data/lib/mangopay/legal_user.rb +15 -15
  26. data/lib/mangopay/mandate.rb +32 -32
  27. data/lib/mangopay/natural_user.rb +14 -14
  28. data/lib/mangopay/pay_in.rb +85 -73
  29. data/lib/mangopay/pay_out.rb +14 -14
  30. data/lib/mangopay/pre_authorization.rb +13 -13
  31. data/lib/mangopay/refund.rb +7 -7
  32. data/lib/mangopay/report.rb +17 -17
  33. data/lib/mangopay/resource.rb +21 -21
  34. data/lib/mangopay/temp.rb +74 -74
  35. data/lib/mangopay/transaction.rb +24 -24
  36. data/lib/mangopay/transfer.rb +9 -9
  37. data/lib/mangopay/user.rb +43 -35
  38. data/lib/mangopay/version.rb +3 -3
  39. data/lib/mangopay/wallet.rb +17 -17
  40. data/mangopay.gemspec +31 -30
  41. data/spec/mangopay/authorization_token_spec.rb +70 -70
  42. data/spec/mangopay/bank_account_spec.rb +97 -97
  43. data/spec/mangopay/card_registration_spec.rb +73 -73
  44. data/spec/mangopay/client_spec.rb +110 -110
  45. data/spec/mangopay/configuration_spec.rb +95 -18
  46. data/spec/mangopay/dispute_spec.rb +262 -262
  47. data/spec/mangopay/event_spec.rb +31 -31
  48. data/spec/mangopay/fetch_filters_spec.rb +63 -63
  49. data/spec/mangopay/hook_spec.rb +37 -37
  50. data/spec/mangopay/idempotency_spec.rb +41 -41
  51. data/spec/mangopay/kyc_document_spec.rb +103 -103
  52. data/spec/mangopay/log_requests_filter_spec.rb +25 -0
  53. data/spec/mangopay/mandate_spec.rb +92 -92
  54. data/spec/mangopay/payin_bankwire_direct_spec.rb +74 -74
  55. data/spec/mangopay/payin_card_direct_spec.rb +68 -68
  56. data/spec/mangopay/payin_card_web_spec.rb +38 -38
  57. data/spec/mangopay/payin_directdebit_direct_spec.rb +37 -37
  58. data/spec/mangopay/payin_directdebit_web_spec.rb +38 -38
  59. data/spec/mangopay/payin_paypal_web_spec.rb +38 -0
  60. data/spec/mangopay/payin_preauthorized_direct_spec.rb +68 -68
  61. data/spec/mangopay/payout_bankwire_spec.rb +54 -54
  62. data/spec/mangopay/preauthorization_spec.rb +42 -42
  63. data/spec/mangopay/refund_spec.rb +21 -21
  64. data/spec/mangopay/report_spec.rb +39 -39
  65. data/spec/mangopay/shared_resources.rb +381 -365
  66. data/spec/mangopay/temp_paymentcard_spec.rb +31 -31
  67. data/spec/mangopay/transaction_spec.rb +54 -54
  68. data/spec/mangopay/transfer_spec.rb +69 -69
  69. data/spec/mangopay/user_spec.rb +137 -122
  70. data/spec/mangopay/wallet_spec.rb +80 -80
  71. data/spec/spec_helper.rb +31 -31
  72. metadata +11 -5
@@ -1,80 +1,80 @@
1
- describe MangoPay::Wallet do
2
- include_context 'wallets'
3
- include_context 'payins'
4
- include_context 'payouts'
5
-
6
- describe 'CREATE' do
7
- it 'creates a wallet' do
8
- expect(new_wallet['Id']).to_not be_nil
9
- expect(new_wallet['Balance']['Currency']).to eq('EUR')
10
- expect(new_wallet['Balance']['Amount']).to eq(0)
11
- end
12
- end
13
-
14
- describe 'UPDATE' do
15
- it 'updates a wallet' do
16
- updated_wallet = MangoPay::Wallet.update(new_wallet['Id'], {
17
- Description: 'Updated Description',
18
- Tag: 'Updated Tag'
19
- })
20
- expect(updated_wallet['Description']).to eq('Updated Description')
21
- expect(updated_wallet['Tag']).to eq('Updated Tag')
22
- end
23
- end
24
-
25
- describe 'FETCH' do
26
- it 'fetches a wallet' do
27
- wallet = MangoPay::Wallet.fetch(new_wallet['Id'])
28
- expect(wallet['Id']).to eq(new_wallet['Id'])
29
- end
30
- end
31
-
32
- describe 'FETCH TRANSACTIONS' do
33
-
34
- it 'fetches empty list of transactions if no transactions done' do
35
- transactions = MangoPay::Wallet.transactions(new_wallet['Id'])
36
- expect(transactions).to be_kind_of(Array)
37
- expect(transactions).to be_empty
38
- end
39
-
40
- it 'fetches list with single transaction after payin done' do
41
- payin = new_payin_card_direct
42
- transactions = MangoPay::Wallet.transactions(new_wallet['Id'])
43
- expect(transactions).to be_kind_of(Array)
44
- expect(transactions.count).to eq 1
45
- expect(transactions.first['Id']).to eq payin['Id']
46
- end
47
-
48
- it 'fetches list with two transactions after payin and payout done' do
49
- payin = new_payin_card_direct
50
- payout = create_new_payout_bankwire(payin)
51
- transactions = MangoPay::Wallet.transactions(new_wallet['Id'])
52
-
53
- expect(transactions).to be_kind_of(Array)
54
- expect(transactions.count).to eq 2
55
-
56
- transactions_ids = transactions.map {|t| t['Id']}
57
- expect(transactions_ids).to include payin['Id']
58
- expect(transactions_ids).to include payout['Id']
59
- end
60
-
61
- it 'accepts filtering params' do
62
- payin = new_payin_card_direct
63
- payout = create_new_payout_bankwire(payin)
64
- wallet_id = new_wallet['Id']
65
-
66
- by_nature_reg = MangoPay::Wallet.transactions(wallet_id, {'Nature' => 'REGULAR'})
67
- by_nature_ref = MangoPay::Wallet.transactions(wallet_id, {'Nature' => 'REFUND'})
68
- expect(by_nature_reg.count).to eq 2
69
- expect(by_nature_ref.count).to eq 0
70
-
71
- by_type_pyin = MangoPay::Wallet.transactions(wallet_id, {'Type' => 'PAYIN'})
72
- by_type_pyout = MangoPay::Wallet.transactions(wallet_id, {'Type' => 'PAYOUT'})
73
- expect(by_type_pyin.count).to eq 1
74
- expect(by_type_pyout.count).to eq 1
75
- expect(by_type_pyin.first['Id']).to eq payin['Id']
76
- expect(by_type_pyout.first['Id']).to eq payout['Id']
77
- end
78
-
79
- end
80
- end
1
+ describe MangoPay::Wallet do
2
+ include_context 'wallets'
3
+ include_context 'payins'
4
+ include_context 'payouts'
5
+
6
+ describe 'CREATE' do
7
+ it 'creates a wallet' do
8
+ expect(new_wallet['Id']).to_not be_nil
9
+ expect(new_wallet['Balance']['Currency']).to eq('EUR')
10
+ expect(new_wallet['Balance']['Amount']).to eq(0)
11
+ end
12
+ end
13
+
14
+ describe 'UPDATE' do
15
+ it 'updates a wallet' do
16
+ updated_wallet = MangoPay::Wallet.update(new_wallet['Id'], {
17
+ Description: 'Updated Description',
18
+ Tag: 'Updated Tag'
19
+ })
20
+ expect(updated_wallet['Description']).to eq('Updated Description')
21
+ expect(updated_wallet['Tag']).to eq('Updated Tag')
22
+ end
23
+ end
24
+
25
+ describe 'FETCH' do
26
+ it 'fetches a wallet' do
27
+ wallet = MangoPay::Wallet.fetch(new_wallet['Id'])
28
+ expect(wallet['Id']).to eq(new_wallet['Id'])
29
+ end
30
+ end
31
+
32
+ describe 'FETCH TRANSACTIONS' do
33
+
34
+ it 'fetches empty list of transactions if no transactions done' do
35
+ transactions = MangoPay::Wallet.transactions(new_wallet['Id'])
36
+ expect(transactions).to be_kind_of(Array)
37
+ expect(transactions).to be_empty
38
+ end
39
+
40
+ it 'fetches list with single transaction after payin done' do
41
+ payin = new_payin_card_direct
42
+ transactions = MangoPay::Wallet.transactions(new_wallet['Id'])
43
+ expect(transactions).to be_kind_of(Array)
44
+ expect(transactions.count).to eq 1
45
+ expect(transactions.first['Id']).to eq payin['Id']
46
+ end
47
+
48
+ it 'fetches list with two transactions after payin and payout done' do
49
+ payin = new_payin_card_direct
50
+ payout = create_new_payout_bankwire(payin)
51
+ transactions = MangoPay::Wallet.transactions(new_wallet['Id'])
52
+
53
+ expect(transactions).to be_kind_of(Array)
54
+ expect(transactions.count).to eq 2
55
+
56
+ transactions_ids = transactions.map {|t| t['Id']}
57
+ expect(transactions_ids).to include payin['Id']
58
+ expect(transactions_ids).to include payout['Id']
59
+ end
60
+
61
+ it 'accepts filtering params' do
62
+ payin = new_payin_card_direct
63
+ payout = create_new_payout_bankwire(payin)
64
+ wallet_id = new_wallet['Id']
65
+
66
+ by_nature_reg = MangoPay::Wallet.transactions(wallet_id, {'Nature' => 'REGULAR'})
67
+ by_nature_ref = MangoPay::Wallet.transactions(wallet_id, {'Nature' => 'REFUND'})
68
+ expect(by_nature_reg.count).to eq 2
69
+ expect(by_nature_ref.count).to eq 0
70
+
71
+ by_type_pyin = MangoPay::Wallet.transactions(wallet_id, {'Type' => 'PAYIN'})
72
+ by_type_pyout = MangoPay::Wallet.transactions(wallet_id, {'Type' => 'PAYOUT'})
73
+ expect(by_type_pyin.count).to eq 1
74
+ expect(by_type_pyout.count).to eq 1
75
+ expect(by_type_pyin.first['Id']).to eq payin['Id']
76
+ expect(by_type_pyout.first['Id']).to eq payout['Id']
77
+ end
78
+
79
+ end
80
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,31 +1,31 @@
1
- require 'mangopay'
2
- require_relative 'mangopay/shared_resources'
3
-
4
-
5
- ################################################################################
6
- # mangopay test account config (re-called once in configuration_spec)
7
- def reset_mangopay_configuration
8
- MangoPay.configure do |c|
9
- c.preproduction = true
10
- c.client_id = 'sdk-unit-tests'
11
-
12
- # sandbox environment:
13
- c.root_url = 'https://api.sandbox.mangopay.com'
14
- c.client_passphrase = 'cqFfFrWfCcb7UadHNxx2C9Lo6Djw8ZduLi7J9USTmu8bhxxpju'
15
-
16
- c.temp_dir = File.expand_path('../tmp', __FILE__)
17
- require 'fileutils'
18
- FileUtils.mkdir_p(c.temp_dir) unless File.directory?(c.temp_dir)
19
- end
20
- end
21
- reset_mangopay_configuration
22
-
23
-
24
- ################################################################################
25
- # uncomment it for logging all http calls in tests
26
- # require 'pp'
27
- # require 'http_logger'
28
- # require 'logger'
29
- # HttpLogger.logger = Logger.new(STDOUT)
30
- # HttpLogger.colorize = true
31
- # HttpLogger.log_headers = true # false
1
+ require 'mangopay'
2
+ require_relative 'mangopay/shared_resources'
3
+
4
+
5
+ ################################################################################
6
+ # mangopay test account config (re-called once in configuration_spec)
7
+ def reset_mangopay_configuration
8
+ MangoPay.configure do |c|
9
+ c.preproduction = true
10
+ c.client_id = 'sdk-unit-tests'
11
+
12
+ # sandbox environment:
13
+ c.root_url = 'https://api.sandbox.mangopay.com'
14
+ c.client_passphrase = 'cqFfFrWfCcb7UadHNxx2C9Lo6Djw8ZduLi7J9USTmu8bhxxpju'
15
+
16
+ c.temp_dir = File.expand_path('../tmp', __FILE__)
17
+ require 'fileutils'
18
+ FileUtils.mkdir_p(c.temp_dir) unless File.directory?(c.temp_dir)
19
+ end
20
+ end
21
+ reset_mangopay_configuration
22
+
23
+
24
+ ################################################################################
25
+ # uncomment it for logging all http calls in tests
26
+ # require 'pp'
27
+ # require 'http_logger'
28
+ # require 'logger'
29
+ # HttpLogger.logger = Logger.new(STDOUT)
30
+ # HttpLogger.colorize = true
31
+ # HttpLogger.log_headers = true # false
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.23
4
+ version: 3.0.25.pre.alpha.pre.20
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: 2016-08-31 00:00:00.000000000 Z
12
+ date: 2016-12-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -65,6 +65,7 @@ extra_rdoc_files: []
65
65
  files:
66
66
  - ".gitignore"
67
67
  - ".rspec"
68
+ - ".travis.yml"
68
69
  - Gemfile
69
70
  - LICENSE
70
71
  - README.md
@@ -80,6 +81,7 @@ files:
80
81
  - lib/mangopay/dispute.rb
81
82
  - lib/mangopay/errors.rb
82
83
  - lib/mangopay/event.rb
84
+ - lib/mangopay/filter_parameters.rb
83
85
  - lib/mangopay/hook.rb
84
86
  - lib/mangopay/http_calls.rb
85
87
  - lib/mangopay/json.rb
@@ -114,12 +116,14 @@ files:
114
116
  - spec/mangopay/idempotency_spec.rb
115
117
  - spec/mangopay/kyc_document_spec.png
116
118
  - spec/mangopay/kyc_document_spec.rb
119
+ - spec/mangopay/log_requests_filter_spec.rb
117
120
  - spec/mangopay/mandate_spec.rb
118
121
  - spec/mangopay/payin_bankwire_direct_spec.rb
119
122
  - spec/mangopay/payin_card_direct_spec.rb
120
123
  - spec/mangopay/payin_card_web_spec.rb
121
124
  - spec/mangopay/payin_directdebit_direct_spec.rb
122
125
  - spec/mangopay/payin_directdebit_web_spec.rb
126
+ - spec/mangopay/payin_paypal_web_spec.rb
123
127
  - spec/mangopay/payin_preauthorized_direct_spec.rb
124
128
  - spec/mangopay/payout_bankwire_spec.rb
125
129
  - spec/mangopay/preauthorization_spec.rb
@@ -148,12 +152,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
148
152
  version: 1.9.2
149
153
  required_rubygems_version: !ruby/object:Gem::Requirement
150
154
  requirements:
151
- - - ">="
155
+ - - ">"
152
156
  - !ruby/object:Gem::Version
153
- version: '0'
157
+ version: 1.3.1
154
158
  requirements: []
155
159
  rubyforge_project:
156
- rubygems_version: 2.2.3
160
+ rubygems_version: 2.6.8
157
161
  signing_key:
158
162
  specification_version: 4
159
163
  summary: Ruby bindings for the version 2 of the MANGOPAY API
@@ -172,12 +176,14 @@ test_files:
172
176
  - spec/mangopay/idempotency_spec.rb
173
177
  - spec/mangopay/kyc_document_spec.png
174
178
  - spec/mangopay/kyc_document_spec.rb
179
+ - spec/mangopay/log_requests_filter_spec.rb
175
180
  - spec/mangopay/mandate_spec.rb
176
181
  - spec/mangopay/payin_bankwire_direct_spec.rb
177
182
  - spec/mangopay/payin_card_direct_spec.rb
178
183
  - spec/mangopay/payin_card_web_spec.rb
179
184
  - spec/mangopay/payin_directdebit_direct_spec.rb
180
185
  - spec/mangopay/payin_directdebit_web_spec.rb
186
+ - spec/mangopay/payin_paypal_web_spec.rb
181
187
  - spec/mangopay/payin_preauthorized_direct_spec.rb
182
188
  - spec/mangopay/payout_bankwire_spec.rb
183
189
  - spec/mangopay/preauthorization_spec.rb