wire4_auth 1.0.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock DELETED
@@ -1,47 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- wire4_auth (1.0.1)
5
- oauth2 (~> 1.4, >= 1.4.2)
6
- wire4_client (~> 1.0.0, >= 1.0)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- ethon (0.12.0)
12
- ffi (>= 1.3.0)
13
- faraday (0.17.1)
14
- multipart-post (>= 1.2, < 3)
15
- ffi (1.12.1)
16
- json (2.3.0)
17
- jwt (2.2.1)
18
- multi_json (1.14.1)
19
- multi_xml (0.6.0)
20
- multipart-post (2.1.1)
21
- oauth2 (1.4.2)
22
- faraday (>= 0.8, < 2.0)
23
- jwt (>= 1.0, < 3.0)
24
- multi_json (~> 1.3)
25
- multi_xml (~> 0.5)
26
- rack (>= 1.2, < 3)
27
- power_assert (1.1.3)
28
- rack (2.0.7)
29
- test-unit (3.3.5)
30
- power_assert
31
- typhoeus (1.3.1)
32
- ethon (>= 0.9.0)
33
- wire4_client (1.0.0)
34
- json (~> 2.1, >= 2.1.0)
35
- typhoeus (~> 1.0, >= 1.0.1)
36
-
37
- PLATFORMS
38
- ruby
39
-
40
- DEPENDENCIES
41
- oauth2 (~> 1.4.2)
42
- test-unit (~> 3.3, >= 3.3.0)
43
- wire4_auth!
44
- wire4_client (~> 1.0)
45
-
46
- BUNDLED WITH
47
- 1.17.3
@@ -1,1139 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # -*- encoding: utf-8 -*-
3
-
4
- # COPYRIGHT © 2017. TCPIP.
5
- # PATENT PENDING. ALL RIGHTS RESERVED.
6
- # SPEI GATEWAY IS REGISTERED TRADEMARKS OF TCPIP.
7
- #
8
- # This software is confidential and proprietary information of TCPIP.
9
- # You shall not disclose such Confidential Information and shall use it only
10
- # in accordance with the company policy.
11
-
12
- =begin
13
- #Wire4Auth
14
-
15
- Fecha de creación: 11 de diciembre, 2019
16
- author: Saintiago García
17
- version: 1.0
18
- =end
19
-
20
- require 'test/unit'
21
- require 'wire4_auth/auth/oauth_wire4'
22
- require 'wire4_auth/webhook_verification_signature/utils_compute'
23
- require 'wire4_client'
24
-
25
- #noinspection RubyTooManyMethodsInspection
26
- class Wire4ExamplesTest < Test::Unit::TestCase
27
-
28
- CLIENT_ID = "FxUWmqYGZuv8O1qjxstvIyJothMa"
29
-
30
- CLIENT_SECRET = "kjwbkrPVgXsnaUGzthj55dsFhx4a"
31
-
32
- USER_KEY = "071e2b59b354186b3a0158de493536@sandbox.wire4.mx"
33
-
34
- SECRET_KEY = "0d1e33e94604f01b4e00d2fcb6b48f"
35
-
36
- SUBSCRIPTION = "f1504fea-3a8f-475a-a50a-90d3c40efc59"
37
-
38
- def test_send_contact
39
- omit('Reason')
40
- # Create the authenticator to obtain access token
41
- # The token URL and Service URL are defined for this environment enum value.
42
- # e.g. for Sandbox environment: Wire4Auth::EnvironmentEnum::SANDBOX
43
- oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID, CLIENT_SECRET, Wire4Auth::EnvironmentEnum::SANDBOX)
44
-
45
- begin
46
- # Obtain an access token use application flow and scope "general" and add to request
47
- oauth_wire4.config_default_api_client
48
- authorization = oauth_wire4.obtain_access_token_app('general')
49
- rescue Wire4Client::ApiError => e
50
- puts "Exception to obtain access token #{e}"
51
- # Optional manage exception in access token flow
52
- return
53
- end
54
-
55
- # create an instance of the API class
56
- api_instance = Wire4Client::ContactoApi.new
57
-
58
- # build body with info (check references for more info: types, required fields, etc.)
59
- body = Wire4Client::ContactRequest.new
60
- body.address = "Calle Falsa 123, Col Fantasía"
61
- body.company = "Compu Mundo Hiper Mega Red"
62
- body.contact_person = "Homer J Simpson"
63
- body.email = "homer.simpson@compumundohipermegared.com"
64
- body.phone_number = "4422102030"
65
-
66
- begin
67
- # Call the API
68
- response = api_instance.send_contact_using_post_with_http_info(authorization, body)
69
- p response
70
- rescue Wire4Client::ApiError => e
71
- puts "Exception to obtain access token #{e}"
72
- # Optional manage exception in access token flow
73
- return
74
- end
75
- end
76
-
77
- def test_obtain_cep
78
- omit('Reason')
79
- # Create the authenticator to obtain access token
80
- # The token URL and Service URL are defined for this environment enum value.
81
- # e.g. for Sandbox environment: Wire4Auth::EnvironmentEnum::SANDBOX
82
- oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID, CLIENT_SECRET, Wire4Auth::EnvironmentEnum::SANDBOX)
83
-
84
- begin
85
- # Obtain an access token use application flow and scope "general" and add to request
86
- oauth_wire4.config_default_api_client
87
- authorization = oauth_wire4.obtain_access_token_app('general')
88
- rescue Wire4Client::ApiError => e
89
- puts "Exception to obtain access token #{e}"
90
- # Optional manage exception in access token flow
91
- return
92
- end
93
-
94
- # create an instance of the API class
95
- api_instance = Wire4Client::ComprobanteElectrnicoDePagoCEPApi.new
96
-
97
- # build body with info (check references for more info: types, required fields, etc.)
98
- cep_data = Wire4Client::CepSearchBanxico.new # CepSearchBanxico | Información para buscar un CEP
99
- cep_data.amount = 8963.25
100
- cep_data.beneficiary_account = '072680004657656853'
101
- cep_data.beneficiary_bank_key = '40072'
102
- cep_data.clave_rastreo = '58735618'
103
- cep_data.operation_date = '05-12-2018'
104
- cep_data.reference = '1122334'
105
- cep_data.sender_account = '112680000156896531'
106
- cep_data.sender_bank_key = '40112'
107
-
108
- begin
109
- # Call the API
110
- response = api_instance.obtain_transaction_cep_using_post(authorization, cep_data)
111
- p response
112
- rescue Wire4Client::ApiError => e
113
- puts "Exception when calling the API: #{e}"
114
- # Optional manage exception in call API
115
- return
116
- end
117
- end
118
-
119
- def test_make_pre_subscription
120
- omit('Reason')
121
- # Create the authenticator to obtain access token
122
- # The token URL and Service URL are defined for this environment enum value.
123
- # e.g. for Sandbox environment: Wire4Auth::EnvironmentEnum::SANDBOX
124
- oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID, CLIENT_SECRET, Wire4Auth::EnvironmentEnum::SANDBOX)
125
-
126
- begin
127
- # Obtain an access token use application flow and scope "general" and add to request
128
- oauth_wire4.config_default_api_client
129
- authorization = oauth_wire4.obtain_access_token_app('general')
130
- rescue Wire4Client::ApiError => e
131
- puts "Exception to obtain access token #{e}"
132
- # Optional manage exception in access token flow
133
- return
134
- end
135
-
136
- # create an instance of the API class
137
- api_instance = Wire4Client::SuscripcionesApi.new
138
-
139
- # build body with info (check references for more info: types, required fields, etc.)
140
- body = Wire4Client::PreEnrollmentData.new
141
- body.cancel_return_url = "https://your-app-url.mx/return"
142
- body.return_url = "https://your-app-url.mx/cancel"
143
-
144
- begin
145
- # Call the API
146
- response = api_instance.pre_enrollment_monex_user_using_post(authorization, body)
147
- p response
148
- rescue Wire4Client::ApiError => e
149
- puts "Exception when calling the API: #{e}"
150
- # Optional manage exception in call API
151
- return
152
- end
153
- end
154
-
155
- def test_delete_pre_subscription
156
- omit('Reason')
157
- # Create the authenticator to obtain access token
158
- # The token URL and Service URL are defined for this environment enum value.
159
- # e.g. for Sandbox environment: Wire4Auth::EnvironmentEnum::SANDBOX
160
- oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID, CLIENT_SECRET, Wire4Auth::EnvironmentEnum::SANDBOX)
161
-
162
- begin
163
- # Obtain an access token use application flow and scope "general" and add to request
164
- oauth_wire4.config_default_api_client
165
- authorization = oauth_wire4.obtain_access_token_app('general')
166
- rescue Wire4Client::ApiError => e
167
- puts "Exception to obtain access token #{e}"
168
- # Optional manage exception in access token flow
169
- return
170
- end
171
-
172
- # create an instance of the API class
173
- api_instance = Wire4Client::SuscripcionesApi.new
174
-
175
- # build body with info (check references for more info, types, required fields)
176
- subscription = "55af515a-43ec-4537-96a4-489d1deef127"
177
-
178
- begin
179
- # Call the API
180
- response = api_instance.remove_subscription_pending_status_using_delete_with_http_info(authorization, subscription)
181
- p response
182
- rescue Wire4Client::ApiError => e
183
- puts "Exception when calling the API: #{e}"
184
- # Optional manage exception in call API
185
- return
186
- end
187
- end
188
-
189
- #noinspection RubyLocalVariableNamingConvention
190
- def test_delete_subscription
191
- omit('Reason')
192
- subscription_to_remove_user_key = "e7446202e95421dbb3c1b914e15c74@sandbox.wire4.mx"
193
- subscription_to_remove_user_secret = "8617fa525ca4140b545b66c5adcbb1"
194
-
195
- # Create the authenticator to obtain access token
196
- # The token URL and Service URL are defined for this environment enum value.
197
- # e.g. for Sandbox environment: Wire4Auth::EnvironmentEnum::SANDBOX
198
- oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID, CLIENT_SECRET, Wire4Auth::EnvironmentEnum::SANDBOX)
199
-
200
- begin
201
- # Obtain an access token use application flow and scope "spei_admin" and add to request
202
- oauth_wire4.config_default_api_client
203
- authorization = oauth_wire4.obtain_access_token_app_user(subscription_to_remove_user_key,
204
- subscription_to_remove_user_secret, 'spei_admin')
205
- rescue Wire4Client::ApiError => e
206
- puts "Exception to obtain access token #{e}"
207
- # Optional manage exception in access token flow
208
- return
209
- end
210
-
211
- # create an instance of the API class
212
- api_instance = Wire4Client::SuscripcionesApi.new
213
-
214
- # build body with info (check references for more info, types, required fields)
215
- subscription = "5873240b-cf69-456a-ab5a-88f5e79ab4b8"
216
-
217
- begin
218
- # Call the API
219
- response = api_instance.remove_enrollment_user_using_delete_with_http_info(authorization, subscription)
220
- p response
221
- rescue Wire4Client::ApiError => e
222
- puts "Exception when calling the API: #{e}"
223
- # Optional manage exception in call API
224
- return
225
- end
226
- end
227
-
228
- def test_obtain_relationships
229
- omit('Reason')
230
- # Create the authenticator to obtain access token
231
- # The token URL and Service URL are defined for this environment enum value.
232
- # e.g. for Sandbox environment: Wire4Auth::EnvironmentEnum::SANDBOX
233
- oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID, CLIENT_SECRET, Wire4Auth::EnvironmentEnum::SANDBOX)
234
-
235
- begin
236
- # Obtain an access token use application flow and scope "spei_admin" and add to request
237
- oauth_wire4.config_default_api_client
238
- authorization = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY, 'spei_admin')
239
- rescue Wire4Client::ApiError => e
240
- puts "Exception to obtain access token #{e}"
241
- # Optional manage exception in access token flow
242
- return
243
- end
244
-
245
- # create an instance of the API class
246
- api_instance = Wire4Client::CuentasDeBeneficiariosSPEIApi.new
247
-
248
- # build body with info (check references for more info, types, required fields)
249
- subscription = SUBSCRIPTION
250
-
251
- begin
252
- # Call the API
253
- response = api_instance.get_available_relationships_monex_using_get(authorization, subscription)
254
- p response
255
- rescue Wire4Client::ApiError => e
256
- puts "Exception when calling the API: #{e}"
257
- # Optional manage exception in call API
258
- return
259
- end
260
- end
261
-
262
- #noinspection RubyInstanceMethodNamingConvention
263
- def test_pre_register_beneficiaries
264
- omit('Reason')
265
- # Create the authenticator to obtain access token
266
- # The token URL and Service URL are defined for this environment enum value.
267
- # e.g. for Sandbox environment: Wire4Auth::EnvironmentEnum::SANDBOX
268
- oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID, CLIENT_SECRET, Wire4Auth::EnvironmentEnum::SANDBOX)
269
-
270
- begin
271
- # Obtain an access token use application flow and scope "spei_admin" and add to request
272
- oauth_wire4.config_default_api_client
273
- authorization = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY, 'spei_admin')
274
- rescue Wire4Client::ApiError => e
275
- puts "Exception to obtain access token #{e}"
276
- # Optional manage exception in access token flow
277
- return
278
- end
279
-
280
- # create an instance of the API class
281
- api_instance = Wire4Client::CuentasDeBeneficiariosSPEIApi.new
282
-
283
- # build body with info (check references for more info: types, required fields, etc.)
284
- subscription = SUBSCRIPTION
285
- body = Wire4Client::AccountRequest.new
286
- body.return_url = "https://your-app-url.mx/return"
287
- body.cancel_return_url = "https://your-app-url.mx/cancel"
288
- account = Wire4Client::Account.new
289
- account.amount_limit = 10000.00
290
- account.beneficiary_account = "112680000156896531"
291
- account.email = ["beneficiary@wire4.mx"]
292
- account.kind_of_relationship = "RECURRENTE"
293
- account.numeric_reference_spei = "1234567"
294
- account.payment_concept_spei = "concept spei"
295
- person = Wire4Client::Person.new
296
- person.last_name = "Simpson"
297
- person.middle_name = "Jay"
298
- person.name = "Bartolomeo"
299
- account.person = person
300
- account.relationship = "ACREEDOR"
301
- account.rfc = "SJBA920125AB1"
302
- body.accounts = [account]
303
-
304
- begin
305
- # Call the API
306
- response = api_instance.pre_register_accounts_using_post(authorization, body, subscription)
307
- p response
308
- rescue Wire4Client::ApiError => e
309
- puts "Exception when calling the API: #{e}"
310
- # Optional manage exception in call API
311
- return
312
- end
313
- end
314
-
315
- #noinspection RubyInstanceMethodNamingConvention
316
- def test_remove_beneficiaries_pending
317
- omit('Reason')
318
- # Create the authenticator to obtain access token
319
- # The token URL and Service URL are defined for this environment enum value.
320
- # e.g. for Sandbox environment: Wire4Auth::EnvironmentEnum::SANDBOX
321
- oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID, CLIENT_SECRET, Wire4Auth::EnvironmentEnum::SANDBOX)
322
-
323
- begin
324
- # Obtain an access token use application flow and scope "spei_admin" and add to request
325
- oauth_wire4.config_default_api_client
326
- authorization = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY, 'spei_admin')
327
- rescue Wire4Client::ApiError => e
328
- puts "Exception to obtain access token #{e}"
329
- # Optional manage exception in access token flow
330
- return
331
- end
332
-
333
- # create an instance of the API class
334
- api_instance = Wire4Client::CuentasDeBeneficiariosSPEIApi.new
335
-
336
- # build body with info (check references for more info: types, required fields, etc.)
337
- subscription = SUBSCRIPTION
338
- request_id = "b782a20b-d92c-4fd9-a5cc-33a88e9b0a79"
339
-
340
- begin
341
- # Call the API
342
- response = api_instance.remove_beneficiaries_pending_using_delete_with_http_info(authorization, request_id, subscription)
343
- p response
344
- rescue Wire4Client::ApiError => e
345
- puts "Exception when calling the API: #{e}"
346
- # Optional manage exception in call API
347
- return
348
- end
349
- end
350
-
351
- def test_obtain_beneficiaries
352
- omit('Reason')
353
- # Create the authenticator to obtain access token
354
- # The token URL and Service URL are defined for this environment enum value.
355
- # e.g. for Sandbox environment: Wire4Auth::EnvironmentEnum::SANDBOX
356
- oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID, CLIENT_SECRET, Wire4Auth::EnvironmentEnum::SANDBOX)
357
-
358
- begin
359
- # Obtain an access token use application flow and scope "spei_admin" and add to request
360
- oauth_wire4.config_default_api_client
361
- authorization = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY, 'spei_admin')
362
- rescue Wire4Client::ApiError => e
363
- puts "Exception to obtain access token #{e}"
364
- # Optional manage exception in access token flow
365
- return
366
- end
367
-
368
- # create an instance of the API class
369
- api_instance = Wire4Client::CuentasDeBeneficiariosSPEIApi.new
370
-
371
- # build body with info (check references for more info: types, required fields, etc.)
372
- subscription = SUBSCRIPTION
373
-
374
- begin
375
- # Call the API
376
- # response = api_instance.get_beneficiaries_for_account_using_get(subscription, rfc: "RFCE010980AR3")
377
- # response = api_instance.get_beneficiaries_for_account_using_get(subscription, account: "RFCE010980AR3")
378
- # response = api_instance.get_beneficiaries_for_account_using_get(subscription, rfc: "RFCE010980AR3, account: "RFCE010980AR3")
379
- response = api_instance.get_beneficiaries_for_account_using_get(authorization, subscription)
380
- p response
381
- rescue Wire4Client::ApiError => e
382
- puts "Exception when calling the API: #{e}"
383
- # Optional manage exception in call API
384
- return
385
- end
386
- end
387
-
388
- #noinspection RubyInstanceMethodNamingConvention
389
- def test_change_amount_limit_beneficiary
390
- omit('Reason')
391
- # Create the authenticator to obtain access token
392
- # The token URL and Service URL are defined for this environment enum value.
393
- # e.g. for Sandbox environment: Wire4Auth::EnvironmentEnum::SANDBOX
394
- oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID, CLIENT_SECRET, Wire4Auth::EnvironmentEnum::SANDBOX)
395
-
396
- begin
397
- # Obtain an access token use application flow and scope "spei_admin" and add to request
398
- oauth_wire4.config_default_api_client
399
- authorization = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY, 'spei_admin')
400
- rescue Wire4Client::ApiError => e
401
- puts "Exception to obtain access token #{e}"
402
- # Optional manage exception in access token flow
403
- return
404
- end
405
-
406
- # create an instance of the API class
407
- api_instance = Wire4Client::CuentasDeBeneficiariosSPEIApi.new
408
-
409
- # build body with info (check references for more info: types, required fields, etc.)
410
- subscription = SUBSCRIPTION
411
- account = "112680000156896531"
412
- body = Wire4Client::AmountRequest.new
413
- body.amount_limit = 20000.00
414
- body.currency_code = "MXP"
415
- body.previous_amount_limit = 10000.00
416
-
417
- begin
418
- # Call the API
419
- response = api_instance.update_amount_limit_account_using_put_with_http_info(authorization, account, body, subscription)
420
- p response
421
- rescue Wire4Client::ApiError => e
422
- puts "Exception when calling the API: #{e}"
423
- # Optional manage exception in call API
424
- return
425
- end
426
- end
427
-
428
- def test_delete_beneficiary
429
- # Create the authenticator to obtain access token
430
- # The token URL and Service URL are defined for this environment enum value.
431
- # e.g. for Sandbox environment: Wire4Auth::EnvironmentEnum::SANDBOX
432
- oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID, CLIENT_SECRET, Wire4Auth::EnvironmentEnum::SANDBOX)
433
-
434
- begin
435
- # Obtain an access token use application flow and scope "spei_admin" and add to request
436
- oauth_wire4.config_default_api_client
437
- authorization = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY, 'spei_admin')
438
- rescue Wire4Client::ApiError => e
439
- puts "Exception to obtain access token #{e}"
440
- # Optional manage exception in access token flow
441
- return
442
- end
443
-
444
- # create an instance of the API class
445
- api_instance = Wire4Client::CuentasDeBeneficiariosSPEIApi.new
446
-
447
- # build body with info (check references for more info: types, required fields, etc.)
448
- subscription = SUBSCRIPTION
449
- account = "112680000156896531"
450
-
451
- begin
452
- # Call the API
453
- response = api_instance.delete_account_using_delete_with_http_info(authorization, account, subscription)
454
- p response
455
- rescue Wire4Client::ApiError => e
456
- puts "Exception when calling the API: #{e}"
457
- # Optional manage exception in call API
458
- return
459
- end
460
- end
461
-
462
- def test_obtain_institutions
463
- omit('Reason')
464
- # Create the authenticator to obtain access token
465
- # The token URL and Service URL are defined for this environment enum value.
466
- # e.g. for Sandbox environment: Wire4Auth::EnvironmentEnum::SANDBOX
467
- oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID, CLIENT_SECRET, Wire4Auth::EnvironmentEnum::SANDBOX)
468
-
469
- begin
470
- # Obtain an access token use application flow and scope "general" and add to request
471
- oauth_wire4.config_default_api_client
472
- authorization = oauth_wire4.obtain_access_token_app('general')
473
- rescue Wire4Client::ApiError => e
474
- puts "Exception to obtain access token #{e}"
475
- # Optional manage exception in access token flow
476
- return
477
- end
478
-
479
- # create an instance of the API class
480
- api_instance = Wire4Client::InstitucionesApi.new
481
-
482
- begin
483
- # Call the API
484
- response = api_instance.get_all_institutions_using_get(authorization)
485
- p response
486
- rescue Wire4Client::ApiError => e
487
- puts "Exception when calling the API: #{e}"
488
- # Optional manage exception in call API
489
- return
490
- end
491
- end
492
-
493
- def test_obtain_balance
494
- omit('Reason')
495
- # Create the authenticator to obtain access token
496
- # The token URL and Service URL are defined for this environment enum value.
497
- # e.g. for Sandbox environment: Wire4Auth::EnvironmentEnum::SANDBOX
498
- oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID, CLIENT_SECRET, Wire4Auth::EnvironmentEnum::SANDBOX)
499
-
500
- begin
501
- # Obtain an access token use application flow and scope "spei_admin" and add to request
502
- oauth_wire4.config_default_api_client
503
- authorization = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY, 'spei_admin')
504
- rescue Wire4Client::ApiError => e
505
- puts "Exception to obtain access token #{e}"
506
- # Optional manage exception in access token flow
507
- return
508
- end
509
-
510
- # create an instance of the API class
511
- api_instance = Wire4Client::SaldoApi.new
512
-
513
- # build body with info (check references for more info, types, required fields)
514
- subscription = SUBSCRIPTION
515
-
516
- begin
517
- # Call the API
518
- response = api_instance.get_balance_using_get(authorization, subscription)
519
- p response
520
- rescue Wire4Client::ApiError => e
521
- puts "Exception when calling the API: #{e}"
522
- # Optional manage exception in call API
523
- return
524
- end
525
- end
526
-
527
- #noinspection RubyInstanceMethodNamingConvention
528
- def test_obtain_SPID_classifications
529
- omit('Reason')
530
- # Create the authenticator to obtain access token
531
- # The token URL and Service URL are defined for this environment enum value.
532
- # e.g. for Sandbox environment: Wire4Auth::EnvironmentEnum::SANDBOX
533
- oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID, CLIENT_SECRET, Wire4Auth::EnvironmentEnum::SANDBOX)
534
-
535
- begin
536
- # Obtain an access token use application flow and scope "spid_admin" and add to request
537
- oauth_wire4.config_default_api_client
538
- authorization = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY, 'spid_admin')
539
- rescue Wire4Client::ApiError => e
540
- puts "Exception to obtain access token #{e}"
541
- # Optional manage exception in access token flow
542
- return
543
- end
544
-
545
- # create an instance of the API class
546
- api_instance = Wire4Client::TransferenciasSPIDApi.new
547
-
548
- # build body with info (check references for more info, types, required fields)
549
- subscription = SUBSCRIPTION
550
-
551
- begin
552
- # Call the API
553
- response = api_instance.get_spid_classifications_using_get(authorization, subscription)
554
- p response
555
- rescue Wire4Client::ApiError => e
556
- puts "Exception when calling the API: #{e}"
557
- # Optional manage exception in call API
558
- return
559
- end
560
- end
561
-
562
- #noinspection RubyInstanceMethodNamingConvention
563
- def test_pre_register_beneficiaries_SPID
564
- omit('Reason')
565
- # Create the authenticator to obtain access token
566
- # The token URL and Service URL are defined for this environment enum value.
567
- # e.g. for Sandbox environment: Wire4Auth::EnvironmentEnum::SANDBOX
568
- oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID, CLIENT_SECRET, Wire4Auth::EnvironmentEnum::SANDBOX)
569
-
570
- begin
571
- # Obtain an access token use application flow and scope "spid_admin" and add to request
572
- oauth_wire4.config_default_api_client
573
- authorization = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY, 'spid_admin')
574
- rescue Wire4Client::ApiError => e
575
- puts "Exception to obtain access token #{e}"
576
- # Optional manage exception in access token flow
577
- return
578
- end
579
-
580
- # create an instance of the API class
581
- api_instance = Wire4Client::CuentasDeBeneficiariosSPIDApi.new
582
-
583
- # build body with info (check references for more info: types, required fields, etc.)
584
- subscription = SUBSCRIPTION
585
- body = Wire4Client::AccountSpid.new
586
- body.return_url = "https://your-app-url.mx/return"
587
- body.cancel_return_url = "https://your-app-url.mx/cancel"
588
- body.amount_limit = 10000.00
589
- body.beneficiary_account = "112680000156896531"
590
- body.email = ["beneficiary.spid@wire4.mx"]
591
- body.institution = Wire4Client::BeneficiaryInstitution.new(name: "BMONEX")
592
- body.kind_of_relationship = "RECURRENTE"
593
- body.numeric_reference = "1234567"
594
- body.payment_concept = "concept spei"
595
- body.relationship = "ACREEDOR"
596
- body.rfc = "SJBA920125AB1"
597
-
598
- begin
599
- # Call the API
600
- response = api_instance.pre_register_accounts_using_post1(authorization, body, subscription)
601
- p response
602
- rescue Wire4Client::ApiError => e
603
- puts "Exception when calling the API: #{e}"
604
- # Optional manage exception in call API
605
- return
606
- end
607
- end
608
-
609
- def test_obtain_beneficiaries_spid
610
- omit('Reason')
611
- # Create the authenticator to obtain access token
612
- # The token URL and Service URL are defined for this environment enum value.
613
- # e.g. for Sandbox environment: Wire4Auth::EnvironmentEnum::SANDBOX
614
- oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID, CLIENT_SECRET, Wire4Auth::EnvironmentEnum::SANDBOX)
615
-
616
- begin
617
- # Obtain an access token use application flow and scope "spei_admin" and add to request
618
- oauth_wire4.config_default_api_client
619
- authorization = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY, 'spid_admin')
620
- rescue Wire4Client::ApiError => e
621
- puts "Exception to obtain access token #{e}"
622
- # Optional manage exception in access token flow
623
- return
624
- end
625
-
626
- # create an instance of the API class
627
- api_instance = Wire4Client::CuentasDeBeneficiariosSPIDApi.new
628
-
629
- # build body with info (check references for more info: types, required fields, etc.)
630
- subscription = SUBSCRIPTION
631
-
632
- begin
633
- # Call the API
634
- # response = api_instance.get_beneficiaries_for_account_using_get(subscription, rfc: "RFCE010980AR3")
635
- # response = api_instance.get_beneficiaries_for_account_using_get(subscription, account: "RFCE010980AR3")
636
- # response = api_instance.get_beneficiaries_for_account_using_get(subscription, rfc: "RFCE010980AR3, account: "RFCE010980AR3")
637
- response = api_instance.get_spid_beneficiaries_for_account(authorization, subscription)
638
- p response
639
- rescue Wire4Client::ApiError => e
640
- puts "Exception when calling the API: #{e}"
641
- # Optional manage exception in call API
642
- return
643
- end
644
- end
645
-
646
- def test_get_depositants
647
- omit('Reason')
648
- # Create the authenticator to obtain access token
649
- # The token URL and Service URL are defined for this environment enum value.
650
- # e.g. for Sandbox environment: Wire4Auth::EnvironmentEnum::SANDBOX
651
- oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID, CLIENT_SECRET, Wire4Auth::EnvironmentEnum::SANDBOX)
652
-
653
- begin
654
- # Obtain an access token use application flow and scope "spei_admin" and add to request
655
- oauth_wire4.config_default_api_client
656
- authorization = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY, 'spei_admin')
657
- rescue Wire4Client::ApiError => e
658
- puts "Exception to obtain access token #{e}"
659
- # Optional manage exception in access token flow
660
- return
661
- end
662
-
663
- # create an instance of the API class
664
- api_instance = Wire4Client::DepositantesApi.new
665
-
666
- # build body with info (check references for more info: types, required fields, etc.)
667
- subscription = SUBSCRIPTION
668
-
669
- begin
670
- # Call the API
671
- response = api_instance.get_depositants_using_get(authorization, subscription)
672
- p response
673
- rescue Wire4Client::ApiError => e
674
- puts "Exception when calling the API: #{e}"
675
- # Optional manage exception in call API
676
- return
677
- end
678
- end
679
-
680
- def test_register_depositants
681
- omit('Reason')
682
- # Create the authenticator to obtain access token
683
- # The token URL and Service URL are defined for this environment enum value.
684
- # e.g. for Sandbox environment: Wire4Auth::EnvironmentEnum::SANDBOX
685
- oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID, CLIENT_SECRET, Wire4Auth::EnvironmentEnum::SANDBOX)
686
-
687
- begin
688
- # Obtain an access token use application flow and scope "spei_admin" and add to request
689
- oauth_wire4.config_default_api_client
690
- authorization = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY, 'spei_admin')
691
- rescue Wire4Client::ApiError => e
692
- puts "Exception to obtain access token #{e}"
693
- # Optional manage exception in access token flow
694
- return
695
- end
696
-
697
- # create an instance of the API class
698
- api_instance = Wire4Client::DepositantesApi.new
699
-
700
- # build body with info (check references for more info: types, required fields, etc.)
701
- subscription = SUBSCRIPTION
702
- body = Wire4Client::DepositantsRegister.new
703
- body._alias = "Depositant 0292921"
704
- body.currency_code = "MXP"
705
- body.email = ["depositant@wire4.mx"]
706
- body.name = "Marge Bouvier"
707
-
708
- begin
709
- # Call the API
710
- response = api_instance.register_depositants_using_post(authorization, body, subscription)
711
- p response
712
- rescue Wire4Client::ApiError => e
713
- puts "Exception when calling the API: #{e}"
714
- # Optional manage exception in call API
715
- return
716
- end
717
- end
718
-
719
- #noinspection RubyInstanceMethodNamingConvention
720
- def test_incoming_SPEI_transactions_report
721
- omit('Reason')
722
- # Create the authenticator to obtain access token
723
- # The token URL and Service URL are defined for this environment enum value.
724
- # e.g. for Sandbox environment: Wire4Auth::EnvironmentEnum::SANDBOX
725
- oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID, CLIENT_SECRET, Wire4Auth::EnvironmentEnum::SANDBOX)
726
-
727
- begin
728
- # Obtain an access token use application flow and scope "spei_admin" and add to request
729
- oauth_wire4.config_default_api_client
730
- authorization = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY, 'spei_admin')
731
- rescue Wire4Client::ApiError => e
732
- puts "Exception to obtain access token #{e}"
733
- # Optional manage exception in access token flow
734
- return
735
- end
736
-
737
- # create an instance of the API class
738
- api_instance = Wire4Client::TransferenciasSPEIApi.new
739
-
740
- # build body with info (check references for more info: types, required fields, etc.)
741
- subscription = SUBSCRIPTION
742
-
743
- begin
744
- # Call the API
745
- response = api_instance.incoming_spei_transactions_report_using_get(authorization, subscription)
746
- p response
747
- rescue Wire4Client::ApiError => e
748
- puts "Exception when calling the API: #{e}"
749
- # Optional manage exception in call API
750
- return
751
- end
752
- end
753
-
754
- #noinspection RubyInstanceMethodNamingConvention
755
- def test_outgoing_SPEI_transactions_report
756
- omit('Reason')
757
- # Create the authenticator to obtain access token
758
- # The token URL and Service URL are defined for this environment enum value.
759
- # e.g. for Sandbox environment: Wire4Auth::EnvironmentEnum::SANDBOX
760
- oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID, CLIENT_SECRET, Wire4Auth::EnvironmentEnum::SANDBOX)
761
-
762
- begin
763
- # Obtain an access token use application flow and scope "spei_admin" and add to request
764
- oauth_wire4.config_default_api_client
765
- authorization = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY, 'spei_admin')
766
- rescue Wire4Client::ApiError => e
767
- puts "Exception to obtain access token #{e}"
768
- # Optional manage exception in access token flow
769
- return
770
- end
771
-
772
- # create an instance of the API class
773
- api_instance = Wire4Client::TransferenciasSPEIApi.new
774
-
775
- # build body with info (check references for more info: types, required fields, etc.)
776
- subscription = SUBSCRIPTION
777
-
778
- begin
779
- # Call the API
780
- response = api_instance.outgoing_spei_transactions_report_using_get(authorization, subscription)
781
- p response
782
- rescue Wire4Client::ApiError => e
783
- puts "Exception when calling the API: #{e}"
784
- # Optional manage exception in call API
785
- return
786
- end
787
- end
788
-
789
- #noinspection RubyInstanceMethodNamingConvention
790
- def test_out_comming_spei_request_id_transactions_report_using_get
791
- omit('Reason')
792
- # Create the authenticator to obtain access token
793
- # The token URL and Service URL are defined for this environment enum value.
794
- # e.g. for Sandbox environment: Wire4Auth::EnvironmentEnum::SANDBOX
795
- oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID, CLIENT_SECRET, Wire4Auth::EnvironmentEnum::SANDBOX)
796
-
797
- begin
798
- # Obtain an access token use application flow and scope "spei_admin" and add to request
799
- oauth_wire4.config_default_api_client
800
- authorization = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY, 'spei_admin')
801
- rescue Wire4Client::ApiError => e
802
- puts "Exception to obtain access token #{e}"
803
- # Optional manage exception in access token flow
804
- return
805
- end
806
-
807
- # create an instance of the API class
808
- api_instance = Wire4Client::TransferenciasSPEIApi.new
809
-
810
- # build body with info (check references for more info: types, required fields, etc.)
811
- subscription = SUBSCRIPTION
812
- request_id = '6a9efe39-a795-4e09-8f7f-197e647a0f8b'
813
-
814
- begin
815
- # Call the API
816
- response = api_instance.out_comming_spei_request_id_transactions_report_using_get(authorization, request_id, subscription)
817
- p response
818
- rescue Wire4Client::ApiError => e
819
- puts "Exception when calling TransferenciasSPEIApi->out_comming_spei_request_id_transactions_report_using_get: #{e}"
820
- # Optional manage exception in call API
821
- return
822
- end
823
- end
824
-
825
- #noinspection RubyInstanceMethodNamingConvention
826
- def test_register_outgoing_SPEI_transaction
827
- omit('Reason')
828
- # Create the authenticator to obtain access token
829
- # The token URL and Service URL are defined for this environment enum value.
830
- # e.g. for Sandbox environment: Wire4Auth::EnvironmentEnum::SANDBOX
831
- oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID, CLIENT_SECRET, Wire4Auth::EnvironmentEnum::SANDBOX)
832
-
833
- begin
834
- # Obtain an access token use application flow and scope "spei_admin" and add to request
835
- oauth_wire4.config_default_api_client
836
- authorization = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY, 'spei_admin')
837
- rescue Wire4Client::ApiError => e
838
- puts "Exception to obtain access token #{e}"
839
- # Optional manage exception in access token flow
840
- return
841
- end
842
-
843
- # create an instance of the API class
844
- api_instance = Wire4Client::TransferenciasSPEIApi.new
845
-
846
- # build body with info (check references for more info: types, required fields, etc.)
847
- subscription = SUBSCRIPTION
848
- body = Wire4Client::TransactionsOutgoingRegister.new
849
- body.return_url = "https://your-app-url.mx/return"
850
- body.cancel_return_url = "https://your-app-url.mx/cancel"
851
- transaction = Wire4Client::TransactionOutgoing.new
852
- transaction.order_id = "137f14a4-9e12-4a98-bbd1-ab347753e68a"
853
- transaction.amount = 1259.69
854
- transaction.beneficiary_account = "112680000156896531"
855
- transaction.currency_code = "MXP"
856
- transaction.email = ["notificar@wire4.mx"]
857
- transaction.reference = 1234567
858
- transaction.concept = "Transfer out test 1"
859
- body.transactions = [transaction]
860
-
861
- begin
862
- # Call the API
863
- response = api_instance.register_outgoing_spei_transaction_using_post(authorization, subscription, body)
864
- p response
865
- rescue Wire4Client::ApiError => e
866
- puts "Exception when calling the API: #{e}"
867
- # Optional manage exception in call API
868
- return
869
- end
870
- end
871
-
872
- #noinspection RubyInstanceMethodNamingConvention
873
- def test_delete_outgoing_pending_SPEI_transaction
874
- omit('Reason')
875
- # Create the authenticator to obtain access token
876
- # The token URL and Service URL are defined for this environment enum value.
877
- # e.g. for Sandbox environment: Wire4Auth::EnvironmentEnum::SANDBOX
878
- oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID, CLIENT_SECRET, Wire4Auth::EnvironmentEnum::SANDBOX)
879
-
880
- begin
881
- # Obtain an access token use application flow and scope "spei_admin" and add to request
882
- oauth_wire4.config_default_api_client
883
- authorization = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY, 'spei_admin')
884
- rescue Wire4Client::ApiError => e
885
- puts "Exception to obtain access token #{e}"
886
- # Optional manage exception in access token flow
887
- return
888
- end
889
-
890
- # create an instance of the API class
891
- api_instance = Wire4Client::TransferenciasSPEIApi.new
892
-
893
- # build body with info (check references for more info: types, required fields, etc.)
894
- subscription = SUBSCRIPTION
895
- request_id = "8abc184f-c3ac-4abd-9045-a9b4a501f007"
896
-
897
- begin
898
- # Call the API
899
- response = api_instance.drop_transactions_pending_using_delete_with_http_info(authorization, request_id, subscription)
900
- p response
901
- rescue Wire4Client::ApiError => e
902
- puts "Exception when calling the API: #{e}"
903
- # Optional manage exception in call API
904
- return
905
- end
906
- end
907
-
908
- #noinspection RubyInstanceMethodNamingConvention
909
- def test_register_outgoing_SPID_transaction
910
- omit('Reason')
911
- # Create the authenticator to obtain access token
912
- # The token URL and Service URL are defined for this environment enum value.
913
- # e.g. for Sandbox environment: Wire4Auth::EnvironmentEnum::SANDBOX
914
- oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID, CLIENT_SECRET, Wire4Auth::EnvironmentEnum::SANDBOX)
915
-
916
- begin
917
- # Obtain an access token use application flow and scope "spid_admin" and add to request
918
- oauth_wire4.config_default_api_client
919
- authorization = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY, 'spid_admin')
920
- rescue Wire4Client::ApiError => e
921
- puts "Exception to obtain access token #{e}"
922
- # Optional manage exception in access token flow
923
- return
924
- end
925
-
926
- # create an instance of the API class
927
- api_instance = Wire4Client::TransferenciasSPIDApi.new
928
-
929
- # build body with info (check references for more info: types, required fields, etc.)
930
- subscription = SUBSCRIPTION
931
- body = Wire4Client::TransactionOutgoingSpid.new
932
- body.return_url = "https://your-app-url.mx/return"
933
- body.cancel_return_url = "https://your-app-url.mx/cancel"
934
- body.amount = 1259.69
935
- body.beneficiary_account = "112680000156896531"
936
- body.classification_id = "01"
937
- body.currency_code = "USD"
938
- body.email = ["notificar@wire4.mx"]
939
- body.numeric_reference_spid = 1234567
940
- body.order_id = "77baa78f-be22-4f6a-b79e-60b20a198324"
941
- body.payment_concept_spid = "Transfer out test 1"
942
-
943
- begin
944
- # Call the API
945
- response = api_instance.register_outgoing_spid_transaction_using_post(authorization, subscription, body)
946
- p response
947
- rescue Wire4Client::ApiError => e
948
- puts "Exception when calling the API: #{e}"
949
- # Optional manage exception in call API
950
- return
951
- end
952
- end
953
-
954
- def test_register_web_hook
955
- omit('Reason')
956
- # Create the authenticator to obtain access token
957
- # The token URL and Service URL are defined for this environment enum value.
958
- # e.g. for Sandbox environment: Wire4Auth::EnvironmentEnum::SANDBOX
959
- oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID, CLIENT_SECRET, Wire4Auth::EnvironmentEnum::SANDBOX)
960
-
961
- begin
962
- # Obtain an access token use application flow and scope "general" and add to request
963
- oauth_wire4.config_default_api_client
964
- authorization = oauth_wire4.obtain_access_token_app('general')
965
- rescue Wire4Client::ApiError => e
966
- puts "Exception to obtain access token #{e}"
967
- # Optional manage exception in access token flow
968
- return
969
- end
970
-
971
- # create an instance of the API class
972
- api_instance = Wire4Client::WebhooksApi.new
973
-
974
- # build body with info (check references for more info: types, required fields, etc.)
975
- body = Wire4Client::WebhookRequest.new # CepSearchBanxico | Información para buscar un CEP
976
- body.events = %w(ACCOUNT.CREATED TRANSACTION.OUTGOING.RECEIVED ENROLLMENT.CREATED)
977
- body.name = "RUBY TEST SDK WEBHOOK-REGISTER"
978
- body.url = "https://www.webhook.site/39034a03-8faf-424e-bb4a-7c3fee2bbfd3"
979
-
980
- begin
981
- # Call the API
982
- response = api_instance.register_webhook(authorization, body)
983
- p response
984
- rescue Wire4Client::ApiError => e
985
- puts "Exception when calling the API: #{e}"
986
- # Optional manage exception in call API
987
- return
988
- end
989
- end
990
-
991
- def test_get_web_hooks
992
- omit('Reason')
993
- # Create the authenticator to obtain access token
994
- # The token URL and Service URL are defined for this environment enum value.
995
- # e.g. for Sandbox environment: Wire4Auth::EnvironmentEnum::SANDBOX
996
- oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID, CLIENT_SECRET, Wire4Auth::EnvironmentEnum::SANDBOX)
997
-
998
- begin
999
- # Obtain an access token use application flow and scope "general" and add to request
1000
- oauth_wire4.config_default_api_client
1001
- authorization = oauth_wire4.obtain_access_token_app('general')
1002
- rescue Wire4Client::ApiError => e
1003
- puts "Exception to obtain access token #{e}"
1004
- # Optional manage exception in access token flow
1005
- return
1006
- end
1007
-
1008
- # create an instance of the API class
1009
- api_instance = Wire4Client::WebhooksApi.new
1010
-
1011
- begin
1012
- # Call the API
1013
- response = api_instance.get_webhooks(authorization)
1014
- p response
1015
- rescue Wire4Client::ApiError => e
1016
- puts "Exception when calling the API: #{e}"
1017
- # Optional manage exception in call API
1018
- return
1019
- end
1020
- end
1021
-
1022
- def test_get_web_hook_by_id
1023
- omit('Reason')
1024
- # Create the authenticator to obtain access token
1025
- # The token URL and Service URL are defined for this environment enum value.
1026
- # e.g. for Sandbox environment: Wire4Auth::EnvironmentEnum::SANDBOX
1027
- oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID, CLIENT_SECRET, Wire4Auth::EnvironmentEnum::SANDBOX)
1028
-
1029
- begin
1030
- # Obtain an access token use application flow and scope "general" and add to request
1031
- oauth_wire4.config_default_api_client
1032
- authorization = oauth_wire4.obtain_access_token_app('general')
1033
- rescue Wire4Client::ApiError => e
1034
- puts "Exception to obtain access token #{e}"
1035
- # Optional manage exception in access token flow
1036
- return
1037
- end
1038
-
1039
- # create an instance of the API class
1040
- api_instance = Wire4Client::WebhooksApi.new
1041
-
1042
- begin
1043
- # Call the API
1044
- response = api_instance.get_webhook(authorization, "wh_3fe3e5f4849f4cabb147804fd55c86fc")
1045
- p response
1046
- rescue Wire4Client::ApiError => e
1047
- puts "Exception when calling the API: #{e}"
1048
- # Optional manage exception in call API
1049
- return
1050
- end
1051
- end
1052
-
1053
- def test_get_facturas
1054
- omit('Reason')
1055
- # Create the authenticator to obtain access token
1056
- # The token URL and Service URL are defined for this environment enum value.
1057
- # e.g. for Sandbox environment: Wire4Auth::EnvironmentEnum::SANDBOX
1058
-
1059
- #oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID, CLIENT_SECRET, Wire4Auth::EnvironmentEnum::SANDBOX)
1060
- oauth_wire4 = Wire4Auth::OAuthWire4.new("kIinyEIYWUIF3pflFxhRdKft2_ga",
1061
- "gca6FwUE_9Dk23UhWoM81pZkNgEa", Wire4Auth::EnvironmentEnum::DEVELOPMENT)
1062
-
1063
- begin
1064
- # Obtain an access token use application flow and scope "general" and add to request
1065
- oauth_wire4.config_default_api_client
1066
- authorization = oauth_wire4.obtain_access_token_app('general')
1067
- rescue Wire4Client::ApiError => e
1068
- puts "Exception to obtain access token #{e}"
1069
- # Optional manage exception in access token flow
1070
- return
1071
- end
1072
-
1073
- # create an instance of the API class
1074
- api_instance = Wire4Client::FacturasApi.new
1075
-
1076
- begin
1077
- # Call the API
1078
- response = api_instance.billings_report_using_get(authorization, period: "2019-10")
1079
- p response
1080
- rescue Wire4Client::ApiError => e
1081
- puts "Exception when calling the API: #{e}"
1082
- # Optional manage exception in call API
1083
- return
1084
- end
1085
- end
1086
-
1087
- def test_get_facturas_by_id
1088
- omit('Reason')
1089
- # Create the authenticator to obtain access token
1090
- # The token URL and Service URL are defined for this environment enum value.
1091
- # e.g. for Sandbox environment: Wire4Auth::EnvironmentEnum::SANDBOX
1092
-
1093
- oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID, CLIENT_SECRET, Wire4Auth::EnvironmentEnum::SANDBOX)
1094
- #oauth_wire4 = Wire4Auth::OAuthWire4.new("kIinyEIYWUIF3pflFxhRdKft2_ga",
1095
- # "gca6FwUE_9Dk23UhWoM81pZkNgEa", Wire4Auth::EnvironmentEnum::DEVELOPMENT)
1096
-
1097
- begin
1098
- # Obtain an access token use application flow and scope "general" and add to request
1099
- oauth_wire4.config_default_api_client
1100
- authorization = oauth_wire4.obtain_access_token_app('general')
1101
- rescue Wire4Client::ApiError => e
1102
- puts "Exception to obtain access token #{e}"
1103
- # Optional manage exception in access token flow
1104
- return
1105
- end
1106
-
1107
- # create an instance of the API class
1108
- api_instance = Wire4Client::FacturasApi.new
1109
-
1110
- begin
1111
- # Call the API
1112
- response = api_instance.billings_report_by_id_using_get(authorization, "834BA74A-BBBB-43C4-8400-A4528153C2BD")
1113
- p response
1114
- rescue Wire4Client::ApiError => e
1115
- puts "Exception when calling the API: #{e}"
1116
- # Optional manage exception in call API
1117
- return
1118
- end
1119
- end
1120
-
1121
- def test_check_web_hook_sign
1122
-
1123
- omit('Reason')
1124
- puts `cd .. && cd .. && find *`.split("\n").uniq.sort.select { |f| !f.empty? }
1125
-
1126
- payload = "{ \"responseCode\":0, \n" + \
1127
- " \"message\":\"Ya existe este beneficiario de pago a ctas nacionales en el contrato\",\n" + \
1128
- " \"statusCode\":\"ERROR\",\n" + \
1129
- " \"externalReference\":\"8939TR\"\n" + \
1130
- "}"
1131
- expected_key = "8e63e88434679473bdb28546d7d91537601f4588e801972376d5c5addcb8fd706e6c92421b73151de3c1945ce000a8a" + \
1132
- +"5aa1d5cc3cdd73f2769ee9980db420db9"
1133
-
1134
- result = Wire4Auth::UtilsCompute.compare_webhook_msg_signatures(payload, "9ie93030?=", expected_key)
1135
- puts "WebHook signature verification, correct: #{result}"
1136
-
1137
- assert result
1138
- end
1139
- end