mangopay4-ruby-sdk 3.44.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 (126) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/ruby_cd.yml +34 -0
  3. data/.github/workflows/ruby_ci.yml +30 -0
  4. data/.gitignore +30 -0
  5. data/.rspec +3 -0
  6. data/CHANGELOG.md +640 -0
  7. data/Gemfile +2 -0
  8. data/LICENSE +20 -0
  9. data/README.md +162 -0
  10. data/Rakefile +5 -0
  11. data/bin/mangopay +9 -0
  12. data/lib/generators/mangopay/install_generator.rb +60 -0
  13. data/lib/generators/templates/mangopay.rb.erb +5 -0
  14. data/lib/mangopay/acquiring.rb +56 -0
  15. data/lib/mangopay/authorization_token.rb +89 -0
  16. data/lib/mangopay/bank_account.rb +49 -0
  17. data/lib/mangopay/bankingaliases.rb +29 -0
  18. data/lib/mangopay/bankingaliases_iban.rb +16 -0
  19. data/lib/mangopay/card.rb +54 -0
  20. data/lib/mangopay/card_registration.rb +9 -0
  21. data/lib/mangopay/client.rb +94 -0
  22. data/lib/mangopay/conversion.rb +49 -0
  23. data/lib/mangopay/deposit.rb +36 -0
  24. data/lib/mangopay/dispute.rb +152 -0
  25. data/lib/mangopay/errors.rb +66 -0
  26. data/lib/mangopay/event.rb +18 -0
  27. data/lib/mangopay/filter_parameters.rb +56 -0
  28. data/lib/mangopay/hook.rb +9 -0
  29. data/lib/mangopay/http_calls.rb +88 -0
  30. data/lib/mangopay/identity_verification.rb +16 -0
  31. data/lib/mangopay/json.rb +14 -0
  32. data/lib/mangopay/kyc_document.rb +83 -0
  33. data/lib/mangopay/legal_user.rb +21 -0
  34. data/lib/mangopay/legal_user_sca.rb +25 -0
  35. data/lib/mangopay/mandate.rb +42 -0
  36. data/lib/mangopay/natural_user.rb +20 -0
  37. data/lib/mangopay/natural_user_sca.rb +25 -0
  38. data/lib/mangopay/pay_in.rb +415 -0
  39. data/lib/mangopay/pay_out.rb +41 -0
  40. data/lib/mangopay/payment_method_metadata.rb +13 -0
  41. data/lib/mangopay/pre_authorization.rb +17 -0
  42. data/lib/mangopay/recipient.rb +35 -0
  43. data/lib/mangopay/refund.rb +19 -0
  44. data/lib/mangopay/regulatory.rb +22 -0
  45. data/lib/mangopay/report.rb +24 -0
  46. data/lib/mangopay/report_v2.rb +21 -0
  47. data/lib/mangopay/resource.rb +21 -0
  48. data/lib/mangopay/settlement.rb +21 -0
  49. data/lib/mangopay/transaction.rb +24 -0
  50. data/lib/mangopay/transfer.rb +20 -0
  51. data/lib/mangopay/ubo.rb +26 -0
  52. data/lib/mangopay/ubo_declaration.rb +32 -0
  53. data/lib/mangopay/user.rb +100 -0
  54. data/lib/mangopay/version.rb +3 -0
  55. data/lib/mangopay/virtual_account.rb +44 -0
  56. data/lib/mangopay/wallet.rb +17 -0
  57. data/lib/mangopay.rb +456 -0
  58. data/mangopay.gemspec +30 -0
  59. data/spec/mangopay/acquiring_spec.rb +176 -0
  60. data/spec/mangopay/authorization_token_spec.rb +70 -0
  61. data/spec/mangopay/bank_account_spec.rb +105 -0
  62. data/spec/mangopay/bankingaliases_spec.rb +29 -0
  63. data/spec/mangopay/card_registration_spec.rb +123 -0
  64. data/spec/mangopay/client_spec.png +0 -0
  65. data/spec/mangopay/client_spec.rb +213 -0
  66. data/spec/mangopay/configuration_spec.rb +249 -0
  67. data/spec/mangopay/conversion_spec.rb +96 -0
  68. data/spec/mangopay/deposit_spec.rb +107 -0
  69. data/spec/mangopay/dispute_spec.png +0 -0
  70. data/spec/mangopay/dispute_spec.rb +294 -0
  71. data/spec/mangopay/event_spec.rb +33 -0
  72. data/spec/mangopay/fetch_filters_spec.rb +63 -0
  73. data/spec/mangopay/hook_spec.rb +37 -0
  74. data/spec/mangopay/idempotency_spec.rb +41 -0
  75. data/spec/mangopay/identity_verification_spec.rb +47 -0
  76. data/spec/mangopay/kyc_document_spec.png +0 -0
  77. data/spec/mangopay/kyc_document_spec.rb +118 -0
  78. data/spec/mangopay/log_requests_filter_spec.rb +26 -0
  79. data/spec/mangopay/mandate_spec.rb +99 -0
  80. data/spec/mangopay/payin_applepay_direct_spec.rb +21 -0
  81. data/spec/mangopay/payin_bancontact_web_spec.rb +30 -0
  82. data/spec/mangopay/payin_bankwire_direct_spec.rb +74 -0
  83. data/spec/mangopay/payin_bankwire_external_instruction_spec.rb +104 -0
  84. data/spec/mangopay/payin_bizum_web_spec.rb +54 -0
  85. data/spec/mangopay/payin_blik_web_spec.rb +41 -0
  86. data/spec/mangopay/payin_card_direct_spec.rb +69 -0
  87. data/spec/mangopay/payin_card_web_spec.rb +64 -0
  88. data/spec/mangopay/payin_directdebit_direct_spec.rb +37 -0
  89. data/spec/mangopay/payin_directdebit_web_spec.rb +38 -0
  90. data/spec/mangopay/payin_giropay_web_spec.rb +30 -0
  91. data/spec/mangopay/payin_googlepay_direct_spec.rb +21 -0
  92. data/spec/mangopay/payin_ideal_web_spec.rb +30 -0
  93. data/spec/mangopay/payin_intent_spec.rb +151 -0
  94. data/spec/mangopay/payin_klarna_web_spec.rb +32 -0
  95. data/spec/mangopay/payin_mbway_web_spec.rb +32 -0
  96. data/spec/mangopay/payin_multibanco_web_spec.rb +31 -0
  97. data/spec/mangopay/payin_paybybank_web_spec.rb +56 -0
  98. data/spec/mangopay/payin_payconiq_web_spec.rb +31 -0
  99. data/spec/mangopay/payin_paypal_web_spec.rb +113 -0
  100. data/spec/mangopay/payin_preauthorized_direct_spec.rb +118 -0
  101. data/spec/mangopay/payin_satispay_web_spec.rb +32 -0
  102. data/spec/mangopay/payin_swish_web_spec.rb +30 -0
  103. data/spec/mangopay/payin_twint_web_spec.rb +30 -0
  104. data/spec/mangopay/payment_method_metadata_spec.rb +15 -0
  105. data/spec/mangopay/payout_bankwire_spec.rb +93 -0
  106. data/spec/mangopay/preauthorization_spec.rb +51 -0
  107. data/spec/mangopay/recipient_spec.rb +134 -0
  108. data/spec/mangopay/recurring_payin_spec.rb +222 -0
  109. data/spec/mangopay/refund_spec.rb +34 -0
  110. data/spec/mangopay/regulatory_spec.rb +26 -0
  111. data/spec/mangopay/report_spec.rb +40 -0
  112. data/spec/mangopay/report_v2_spec.rb +117 -0
  113. data/spec/mangopay/report_wallets_spec.rb +40 -0
  114. data/spec/mangopay/settlement_sample.csv +8 -0
  115. data/spec/mangopay/settlement_spec.rb +38 -0
  116. data/spec/mangopay/shared_resources.rb +1380 -0
  117. data/spec/mangopay/transaction_spec.rb +59 -0
  118. data/spec/mangopay/transfer_spec.rb +77 -0
  119. data/spec/mangopay/ubo_declaration_spec.rb +44 -0
  120. data/spec/mangopay/ubo_spec.rb +39 -0
  121. data/spec/mangopay/user_spec.rb +444 -0
  122. data/spec/mangopay/virtual_account_spec.rb +52 -0
  123. data/spec/mangopay/wallet_spec.rb +100 -0
  124. data/spec/spec_helper.rb +31 -0
  125. data/spec/tmp/.keep +0 -0
  126. metadata +280 -0
@@ -0,0 +1,249 @@
1
+ describe MangoPay::Configuration do
2
+
3
+ it 'fails when calling with wrong client credentials' do
4
+ expect {
5
+ c = MangoPay.configuration
6
+ c.client_id = 'test_asd'
7
+ c.client_apiKey = '00000'
8
+ MangoPay::User.fetch()
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
+ }
14
+ end
15
+
16
+ it 'fails when calling with wrong client credentials, but succeeds after applying a new (correct) config' do
17
+ # create a wrong configuration
18
+ wrong_config = MangoPay::Configuration.new
19
+ wrong_config.client_id = 'placeholder'
20
+ wrong_config.client_apiKey = '0000'
21
+ wrong_config.preproduction = true
22
+
23
+ # create a valid configuration
24
+ valid_config = MangoPay::Configuration.new
25
+ valid_config.client_id = 'sdk-unit-tests'
26
+ valid_config.client_apiKey = 'cqFfFrWfCcb7UadHNxx2C9Lo6Djw8ZduLi7J9USTmu8bhxxpju'
27
+ valid_config.preproduction = true
28
+
29
+ # add the 2 configs to the list of MangoPay configs
30
+ MangoPay.add_config('wrong', wrong_config)
31
+ MangoPay.add_config('valid', valid_config)
32
+
33
+ # apply wrong config
34
+ MangoPay.get_config('wrong').apply_configuration
35
+
36
+ expect {
37
+ MangoPay::User.fetch()
38
+ }.to raise_error { |err|
39
+ expect(err).to be_a MangoPay::ResponseError
40
+ expect(err.code).to eq '401'
41
+ expect(err.message).to eq 'invalid_client'
42
+ }
43
+
44
+ # apply valid configuration
45
+ MangoPay.get_config('valid').apply_configuration
46
+
47
+ # expect success
48
+ users = MangoPay::User.fetch()
49
+ expect(users).to be_kind_of(Array)
50
+ end
51
+
52
+ it 'fails when fetching a config that does not exist' do
53
+ expect {
54
+ MangoPay.get_config('placeholder')
55
+ }.to raise_error { |err|
56
+ expect(err).to be_a RuntimeError
57
+ expect(err.message).to eq "Could not find any configuration with name 'placeholder'"
58
+ }
59
+ end
60
+
61
+ it 'succeeds when removing config' do
62
+ wrong_config = MangoPay::Configuration.new
63
+ wrong_config.client_id = 'placeholder'
64
+ wrong_config.client_apiKey = '0000'
65
+ wrong_config.preproduction = true
66
+
67
+ MangoPay.add_config('wrong', wrong_config)
68
+
69
+ # pass when fetching config before removing it
70
+ MangoPay.get_config('wrong')
71
+
72
+ # remove config
73
+ MangoPay.remove_config('wrong')
74
+
75
+ # fail when trying to fetch after removal
76
+ expect {
77
+ MangoPay.get_config('wrong')
78
+ }.to raise_error { |err|
79
+ expect(err).to be_a RuntimeError
80
+ expect(err.message).to eq "Could not find any configuration with name 'wrong'"
81
+ }
82
+ end
83
+
84
+ it 'goes ok when calling with correct client credentials' do
85
+ reset_mangopay_configuration
86
+ users = MangoPay::User.fetch()
87
+ expect(users).to be_kind_of(Array)
88
+ end
89
+
90
+ describe '.use_ssl?' do
91
+ let(:configuration) { MangoPay::Configuration.new }
92
+
93
+ it 'defaults to true' do
94
+ expect(configuration.use_ssl?).to eq(true)
95
+ end
96
+
97
+ context 'when assigned to false in production' do
98
+ before do
99
+ configuration.use_ssl = false
100
+ configuration.preproduction = false
101
+ end
102
+
103
+ it 'uses true as value' do
104
+ expect(configuration.use_ssl?).to eq(true)
105
+ end
106
+ end
107
+
108
+ context 'when assigned to false in preproduction' do
109
+ before do
110
+ configuration.use_ssl = false
111
+ configuration.preproduction = true
112
+ end
113
+
114
+ it 'uses assigned as value' do
115
+ expect(configuration.use_ssl?).to eq(false)
116
+ end
117
+ end
118
+ end
119
+
120
+ describe 'logger' do
121
+ around(:each) do |example|
122
+ c = MangoPay.configuration
123
+ c.logger = logger
124
+ c.log_file = log_file
125
+ example.run
126
+ c.logger = nil
127
+ c.log_file = nil
128
+ MangoPay.instance_variable_set(:@logger, nil)
129
+ end
130
+
131
+ context 'when the logger is set' do
132
+ let(:logger) { Logger.new(STDOUT) }
133
+
134
+ context 'when the log_file is set' do
135
+ let(:log_file) { File.join(MangoPay.configuration.temp_dir, 'mangopay.log.tmp') }
136
+
137
+ it 'initializes the logger using the logger option' do
138
+ expect(MangoPay.send(:logger).instance_variable_get(:@logdev).dev).to(eq(STDOUT))
139
+ end
140
+ end
141
+
142
+ context 'when the log_file is not set' do
143
+ let(:log_file) { nil }
144
+
145
+ it 'initializes the logger using the logger option' do
146
+ expect(MangoPay.send(:logger).instance_variable_get(:@logdev).dev).to(eq(STDOUT))
147
+ end
148
+ end
149
+ end
150
+
151
+ context 'when the logger is not set' do
152
+ let(:logger) { nil }
153
+
154
+ context 'when the log_file is set' do
155
+ let(:log_file) { File.join(MangoPay.configuration.temp_dir, 'mangopay.log.tmp') }
156
+
157
+ it 'initializes the logger using the log file' do
158
+ expect(MangoPay.send(:logger).instance_variable_get(:@logdev).dev).to(be_an_instance_of(File))
159
+ end
160
+ end
161
+
162
+ context 'when the log_file is not set' do
163
+ let(:log_file) { nil }
164
+
165
+ it 'raises an error' do
166
+ expect{ MangoPay.send(:logger) }.to raise_error NotImplementedError
167
+ end
168
+ end
169
+ end
170
+ end
171
+
172
+ context 'with multithreading' do
173
+ after :all do
174
+ reset_mangopay_configuration
175
+ end
176
+
177
+ before :all do
178
+ MangoPay.configuration.client_id = 'default'
179
+
180
+ thread_a = Thread.new do
181
+ @default_client_id = MangoPay.configuration.client_id
182
+
183
+ MangoPay.configuration.client_id = 'a'
184
+
185
+ # Test #configuration= & #configuration
186
+ config = MangoPay::Configuration.new
187
+ config.client_id = 'a'
188
+ MangoPay.configuration = config
189
+ @before_client_id = MangoPay.configuration.client_id
190
+
191
+ # Test multithreading
192
+ sleep 1 # Waits for thread B to do its business
193
+ @after_client_id = MangoPay.configuration.client_id
194
+
195
+ # Test #configure
196
+ MangoPay.configure do |c|
197
+ c.client_id = 'configured'
198
+ end
199
+ @configured_client_id = MangoPay.configuration.client_id
200
+
201
+ # Test #with_config
202
+ @before_with_config_client_id = MangoPay.configuration.client_id
203
+ config = MangoPay::Configuration.new
204
+ config.client_id = 'with_config'
205
+ MangoPay.with_configuration(config) do
206
+ @with_config_client_id = MangoPay.configuration.client_id
207
+ end
208
+ @after_with_config_client_id = MangoPay.configuration.client_id
209
+ end
210
+
211
+ thread_b = Thread.new do
212
+ # Thread A does its business
213
+ sleep 0.5
214
+ @thread_b_default_client_id = MangoPay.configuration.client_id
215
+
216
+ # Will it impact the configuration in thread A ?
217
+ MangoPay.configuration.client_id = 'b'
218
+ end
219
+
220
+ # Wait for both threads to complete
221
+ thread_a.join
222
+ thread_b.join
223
+ end
224
+
225
+ it '#configuration & #configuration=' do
226
+ expect(@before_client_id).to eq('a')
227
+ end
228
+
229
+ it '#configure' do
230
+ expect(@configured_client_id).to eq('configured')
231
+ end
232
+
233
+ it '#with_configuration' do
234
+ expect(@with_config_client_id).to eq('with_config')
235
+ expect(@after_with_config_client_id).to eq(@before_with_config_client_id)
236
+ end
237
+
238
+ context "since configurations are thread-local," do
239
+ it 'threads get the last configuration set as default config.' do
240
+ expect(@default_client_id).to eq('default')
241
+ expect(@thread_b_default_client_id).to eq('a')
242
+ end
243
+
244
+ it "configurations are isolated from other threads' activity." do
245
+ expect(@after_client_id).to eq('a')
246
+ end
247
+ end
248
+ end
249
+ end
@@ -0,0 +1,96 @@
1
+ describe MangoPay::Conversion, type: :feature do
2
+ include_context 'instant_conversion'
3
+
4
+ describe 'GET CONVERSION RATE' do
5
+ it 'get a conversion rate' do
6
+ conversion_rate = get_conversion_rate('EUR','GBP')
7
+
8
+ expect(conversion_rate['ClientRate']).not_to be_nil
9
+ expect(conversion_rate['MarketRate']).not_to be_nil
10
+ end
11
+ end
12
+
13
+ describe 'CREATE INSTANT CONVERSION' do
14
+ it 'creates a new instant conversion' do
15
+ conversion = create_instant_conversion
16
+
17
+ expect(conversion['DebitedFunds']['Amount']).not_to be_nil
18
+ expect(conversion['CreditedFunds']['Amount']).not_to be_nil
19
+ expect(conversion['Fees']['Amount']).not_to be_nil
20
+ expect(conversion['Status']).equal? 'SUCCEEDED'
21
+ end
22
+ end
23
+
24
+ describe 'CREATE QUOTED CONVERSION' do
25
+ it 'creates a new quoted conversion' do
26
+ conversion = create_quoted_conversion
27
+
28
+ expect(conversion['DebitedFunds']['Amount']).not_to be_nil
29
+ expect(conversion['CreditedFunds']['Amount']).not_to be_nil
30
+ expect(conversion['Status']).equal? 'SUCCEEDED'
31
+ end
32
+ end
33
+
34
+ describe 'CREATE QUOTED CONVERSION BETWEEN CLIENT WALLETS' do
35
+ it 'creates a new quoted conversion' do
36
+ quote = create_conversion_quote
37
+
38
+ conversion = MangoPay::Conversion.create_client_wallets_quoted_conversion(
39
+ QuoteId: quote['Id'],
40
+ CreditedWalletType: 'CREDIT',
41
+ DebitedWalletType: 'FEES'
42
+ )
43
+
44
+ expect(conversion['Status']).equal? 'SUCCEEDED'
45
+ end
46
+ end
47
+
48
+ describe 'CREATE INSTANT CONVERSION BETWEEN CLIENT WALLETS' do
49
+ it 'creates a new quoted conversion' do
50
+ conversion = MangoPay::Conversion.create_client_wallets_instant_conversion(
51
+ CreditedWalletType: 'FEES',
52
+ DebitedWalletType: 'FEES',
53
+ DebitedFunds: {
54
+ Currency: 'GBP',
55
+ Amount: 79
56
+ },
57
+ CreditedFunds: {
58
+ Currency: 'EUR'
59
+ }
60
+ )
61
+
62
+ expect(conversion['Status']).equal? 'SUCCEEDED'
63
+ end
64
+ end
65
+
66
+ describe 'GET EXISTING CONVERSION' do
67
+ it 'get an existing conversion' do
68
+ conversion = create_instant_conversion
69
+ returned_conversion = get_conversion(conversion['Id'])
70
+
71
+ expect(returned_conversion['DebitedFunds']['Amount']).not_to be_nil
72
+ expect(returned_conversion['CreditedFunds']['Amount']).not_to be_nil
73
+ expect(conversion['Fees']['Amount']).not_to be_nil
74
+ expect(returned_conversion['Status']).equal? 'SUCCEEDED'
75
+ end
76
+ end
77
+
78
+ describe 'CREATE CONVERSION QUOTE' do
79
+ it 'create a conversion quote' do
80
+ conversion_quote = create_conversion_quote
81
+ expect(conversion_quote['DebitedFunds']).not_to be_nil
82
+ expect(conversion_quote['CreditedFunds']).not_to be_nil
83
+ expect(conversion_quote['Duration']).equal? 90
84
+ end
85
+ end
86
+
87
+ describe 'GET CONVERSION QUOTE' do
88
+ it 'get a conversion quote' do
89
+ conversion_quote = create_conversion_quote
90
+ returned_conversion_quote = get_conversion_quote(conversion_quote['Id'])
91
+ expect(returned_conversion_quote['DebitedFunds']).not_to be_nil
92
+ expect(returned_conversion_quote['CreditedFunds']).not_to be_nil
93
+ expect(returned_conversion_quote['Duration']).equal? 90
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,107 @@
1
+ describe MangoPay::Deposit do
2
+ include_context 'users'
3
+ include_context 'payins'
4
+
5
+ describe 'CREATE' do
6
+ it 'creates a new deposit' do
7
+ author = new_natural_user
8
+ card_registration = new_card_registration_completed
9
+ deposit = create_new_deposit(card_registration['CardId'], author['Id'])
10
+
11
+ assert_deposit(deposit, card_registration['CardId'], author["Id"])
12
+ end
13
+ end
14
+
15
+ describe 'GET' do
16
+ it 'get an existing deposit' do
17
+ author = new_natural_user
18
+ card_registration = new_card_registration_completed
19
+ deposit = create_new_deposit(card_registration['CardId'], author['Id'])
20
+
21
+ assert_deposit(deposit, card_registration['CardId'], author["Id"])
22
+
23
+ fetched_deposit = MangoPay::Deposit.get(deposit['Id'])
24
+
25
+ assert_deposit(fetched_deposit, card_registration['CardId'], author["Id"])
26
+ end
27
+
28
+ it 'gets all deposits for a user' do
29
+ author = new_natural_user
30
+ card_registration = new_card_registration_completed
31
+ create_new_deposit(card_registration['CardId'], author['Id'])
32
+
33
+ result = MangoPay::Deposit.get_all_for_user(author['Id'])
34
+ expect(result).to be_kind_of(Array)
35
+ expect(result.count).to be > 0
36
+ end
37
+
38
+ it 'gets all deposits for a card' do
39
+ author = new_natural_user
40
+ card_registration = new_card_registration_completed
41
+ create_new_deposit(card_registration['CardId'], author['Id'])
42
+
43
+ result = MangoPay::Deposit.get_all_for_card(card_registration['CardId'])
44
+ expect(result).to be_kind_of(Array)
45
+ expect(result.count).to be > 0
46
+ end
47
+
48
+ it 'fetches transactions for a deposit' do
49
+ author = new_natural_user
50
+ wallet = new_wallet
51
+ card_registration = new_card_registration_completed
52
+ deposit = create_new_deposit(card_registration['CardId'], author['Id'])
53
+ create_new_payin_pre_authorized_deposit_direct(deposit['Id'], author['Id'], wallet['Id'])
54
+
55
+ transactions = MangoPay::Deposit.get_transactions(deposit['Id'])
56
+ expect(transactions).to be_kind_of(Array)
57
+ expect(transactions.count).to be > 0
58
+ end
59
+ end
60
+
61
+ # the Cancel flow will be teste manually for now
62
+ =begin
63
+ describe 'CANCEL' do
64
+ it 'cancel an existing deposit' do
65
+ author = new_natural_user
66
+ card_registration = new_card_registration_completed
67
+ deposit = create_new_deposit(card_registration['CardId'], author['Id'])
68
+
69
+ assert_deposit(deposit, card_registration['CardId'], author["Id"])
70
+ expect(deposit['Status']).to eq('CREATED')
71
+ expect(deposit['PaymentStatus']).to eq('WAITING')
72
+
73
+ MangoPay::Deposit.cancel(deposit['Id'])
74
+
75
+ updated_deposit = MangoPay::Deposit.get(deposit['Id'])
76
+
77
+ assert_deposit(updated_deposit, card_registration['CardId'], author["Id"])
78
+ expect(updated_deposit['Status']).to eq('SUCCEEDED')
79
+ expect(updated_deposit['PaymentStatus']).to eq('CANCELED')
80
+ end
81
+ end
82
+ =end
83
+ end
84
+
85
+
86
+ def assert_deposit(deposit, card_reg_id, author_id)
87
+ expect(deposit['Id']).not_to be_nil
88
+ expect(deposit['CreationDate']).not_to be_nil
89
+ expect(deposit['ExpirationDate']).not_to be_nil
90
+ expect(deposit['AuthorId']).not_to be_nil
91
+ expect(deposit['DebitedFunds']).not_to be_nil
92
+ expect(deposit['Status']).not_to be_nil
93
+ expect(deposit['PaymentStatus']).not_to be_nil
94
+ expect(deposit['PayinsLinked']).not_to be_nil
95
+ expect(deposit['CardId']).not_to be_nil
96
+ expect(deposit['CardId']).to eq(card_reg_id)
97
+ expect(deposit['AuthorId']).to eq(author_id)
98
+ expect(deposit['SecureModeReturnURL']).not_to be_nil
99
+ expect(deposit['PaymentType']).not_to be_nil
100
+ expect(deposit['ExecutionType']).not_to be_nil
101
+ expect(deposit['StatementDescriptor']).not_to be_nil
102
+ expect(deposit['Culture']).not_to be_nil
103
+ expect(deposit['BrowserInfo']).not_to be_nil
104
+ expect(deposit['IpAddress']).not_to be_nil
105
+ expect(deposit['Billing']).not_to be_nil
106
+ expect(deposit['Shipping']).not_to be_nil
107
+ end
Binary file