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