blockchyp 2.10.0 → 2.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2443 -480
- data/lib/blockchyp/version.rb +1 -1
- data/lib/blockchyp.rb +217 -3
- data/lib/blockchyp_client.rb +78 -0
- data/test/activate_terminal_test.rb +45 -0
- data/test/add_test_merchant_test.rb +56 -0
- data/test/batch_history_test.rb +10 -6
- data/test/boolean_prompt_test.rb +10 -4
- data/test/cancel_payment_link_test.rb +10 -6
- data/test/capture_signature_test.rb +10 -4
- data/test/deactivate_terminal_test.rb +42 -0
- data/test/delete_branding_asset_test.rb +50 -0
- data/test/delete_customer_test.rb +10 -6
- data/test/delete_media_asset_test.rb +53 -0
- data/test/delete_queued_transaction_test.rb +56 -0
- data/test/delete_slide_show_test.rb +50 -0
- data/test/delete_survey_question_test.rb +51 -0
- data/test/delete_test_merchant_test.rb +59 -0
- data/test/delete_token_test.rb +16 -7
- data/test/empty_branding_asset_test.rb +44 -0
- data/test/empty_slide_show_test.rb +45 -0
- data/test/gateway_timeout_test.rb +10 -3
- data/test/get_customer_test.rb +10 -6
- data/test/get_merchants_test.rb +52 -0
- data/test/invite_merchant_user_test.rb +45 -0
- data/test/link_token_test.rb +56 -0
- data/test/list_queued_transactions_test.rb +55 -0
- data/test/list_terminals_test.rb +42 -0
- data/test/media_asset_test.rb +57 -0
- data/test/media_test.rb +42 -0
- data/test/media_upload_test.rb +52 -0
- data/test/merchant_platforms_test.rb +59 -0
- data/test/merchant_profile_test.rb +10 -5
- data/test/merchant_users_test.rb +42 -0
- data/test/new_transaction_display_test.rb +10 -4
- data/test/pan_charge_test.rb +10 -4
- data/test/pan_enroll_test.rb +16 -5
- data/test/pan_preauth_test.rb +10 -4
- data/test/partial_refund_test.rb +10 -5
- data/test/search_customer_test.rb +10 -6
- data/test/send_payment_link_test.rb +10 -5
- data/test/simple_batch_close_test.rb +10 -6
- data/test/simple_capture_test.rb +10 -6
- data/test/simple_gift_activate_test.rb +10 -4
- data/test/simple_locate_test.rb +44 -0
- data/test/simple_message_test.rb +10 -4
- data/test/simple_ping_test.rb +11 -5
- data/test/simple_refund_test.rb +10 -5
- data/test/simple_reversal_test.rb +10 -6
- data/test/simple_void_test.rb +10 -6
- data/test/slide_show_test.rb +51 -0
- data/test/slide_shows_test.rb +49 -0
- data/test/survey_question_test.rb +48 -0
- data/test/survey_questions_test.rb +50 -0
- data/test/survey_results_test.rb +48 -0
- data/test/tc_delete_template_test.rb +51 -0
- data/test/tc_entry_test.rb +56 -0
- data/test/tc_log_test.rb +42 -0
- data/test/tc_template_test.rb +53 -0
- data/test/tc_template_update_test.rb +48 -0
- data/test/tc_templates_test.rb +42 -0
- data/test/terminal_branding_test.rb +42 -0
- data/test/terminal_charge_test.rb +11 -5
- data/test/terminal_clear_test.rb +10 -4
- data/test/terminal_ebt_balance_test.rb +10 -4
- data/test/terminal_ebt_charge_test.rb +10 -4
- data/test/terminal_enroll_test.rb +10 -4
- data/test/terminal_gift_card_balance_test.rb +10 -4
- data/test/terminal_keyed_charge_test.rb +10 -4
- data/test/terminal_manual_ebt_charge_test.rb +10 -4
- data/test/terminal_preauth_test.rb +10 -4
- data/test/terminal_queued_transaction_test.rb +51 -0
- data/test/terminal_status_test.rb +10 -4
- data/test/terminal_timeout_test.rb +10 -3
- data/test/terms_and_conditions_test.rb +10 -4
- data/test/test_helper.rb +0 -2
- data/test/testdata/aviato.png +0 -0
- data/test/text_prompt_test.rb +10 -4
- data/test/token_metadata_test.rb +55 -0
- data/test/transaction_history_test.rb +10 -6
- data/test/unlink_token_test.rb +56 -0
- data/test/update_branding_asset_test.rb +62 -0
- data/test/update_customer_test.rb +10 -5
- data/test/update_merchant_platforms_test.rb +61 -0
- data/test/update_merchant_test.rb +60 -0
- data/test/update_slide_show_test.rb +60 -0
- data/test/update_survey_question_test.rb +47 -0
- data/test/update_transaction_display_test.rb +10 -4
- data/test/upload_status_test.rb +53 -0
- metadata +46 -2
data/lib/blockchyp/version.rb
CHANGED
data/lib/blockchyp.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright 2019 BlockChyp, Inc. All rights reserved. Use of this code is
|
3
|
+
# Copyright 2019-2022 BlockChyp, Inc. All rights reserved. Use of this code is
|
4
4
|
# governed by a license that can be found in the LICENSE file.
|
5
5
|
#
|
6
|
-
# This file was generated automatically
|
7
|
-
# every time the code is regenerated.
|
6
|
+
# This file was generated automatically by the BlockChyp SDK Generator.
|
7
|
+
# Changes to this file will be lost every time the code is regenerated.
|
8
8
|
|
9
9
|
require_relative 'blockchyp_client'
|
10
10
|
|
@@ -13,6 +13,7 @@ module CardType
|
|
13
13
|
DEBIT = 1
|
14
14
|
EBT = 2
|
15
15
|
BLOCKCHAIN_GIFT = 3
|
16
|
+
HEALTHCARE = 4
|
16
17
|
end
|
17
18
|
|
18
19
|
module SignatureFormat
|
@@ -50,6 +51,14 @@ module CVMType
|
|
50
51
|
NO_CVM = 'No CVM'
|
51
52
|
end
|
52
53
|
|
54
|
+
module HealthcareType
|
55
|
+
HEALTHCARE = 'healthcare'
|
56
|
+
PRESCRIPTION = 'prescription'
|
57
|
+
VISION = 'vision'
|
58
|
+
CLINIC = 'clinic'
|
59
|
+
DENTAL = 'dental'
|
60
|
+
end
|
61
|
+
|
53
62
|
module BlockChyp
|
54
63
|
# the main autogenerated blockchyp client
|
55
64
|
class BlockChyp < BlockChypClient
|
@@ -149,7 +158,17 @@ module BlockChyp
|
|
149
158
|
def delete_queued_transaction(request)
|
150
159
|
route_terminal_request('POST', '/api/queue/delete', '/api/queue/delete', request)
|
151
160
|
end
|
161
|
+
|
162
|
+
# Reboot a payment terminal.
|
163
|
+
def reboot(request)
|
164
|
+
route_terminal_request('POST', '/api/reboot', '/api/terminal-reboot', request)
|
165
|
+
end
|
152
166
|
|
167
|
+
# Returns routing and location data for a payment terminal.
|
168
|
+
def locate(request)
|
169
|
+
gateway_request('POST', '/api/terminal-locate', request)
|
170
|
+
end
|
171
|
+
|
153
172
|
# Captures a preauthorization.
|
154
173
|
def capture(request)
|
155
174
|
gateway_request('POST', '/api/capture', request)
|
@@ -239,10 +258,205 @@ module BlockChyp
|
|
239
258
|
gateway_request('DELETE', '/api/customer/' + request[:customerId], request)
|
240
259
|
end
|
241
260
|
|
261
|
+
# Retrieves payment token metadata.
|
262
|
+
def token_metadata(request)
|
263
|
+
gateway_request('GET', '/api/token/' + request[:token], request)
|
264
|
+
end
|
265
|
+
|
266
|
+
# Links a token to a customer record.
|
267
|
+
def link_token(request)
|
268
|
+
gateway_request('POST', '/api/link-token', request)
|
269
|
+
end
|
270
|
+
|
271
|
+
# Removes a link between a customer and a token.
|
272
|
+
def unlink_token(request)
|
273
|
+
gateway_request('POST', '/api/unlink-token', request)
|
274
|
+
end
|
275
|
+
|
242
276
|
# Deletes a payment token.
|
243
277
|
def delete_token(request)
|
244
278
|
gateway_request('DELETE', '/api/token/' + request[:token], request)
|
245
279
|
end
|
246
280
|
|
281
|
+
|
282
|
+
# Adds a test merchant account.
|
283
|
+
def get_merchants(request)
|
284
|
+
dashboard_request('POST', '/api/get-merchants', request)
|
285
|
+
end
|
286
|
+
|
287
|
+
# Adds or updates a merchant account. Can be used to create or update test
|
288
|
+
# merchants. Only gateway partners may create new live merchants.
|
289
|
+
def update_merchant(request)
|
290
|
+
dashboard_request('POST', '/api/update-merchant', request)
|
291
|
+
end
|
292
|
+
|
293
|
+
# List all active users and pending invites for a merchant account.
|
294
|
+
def merchant_users(request)
|
295
|
+
dashboard_request('POST', '/api/merchant-users', request)
|
296
|
+
end
|
297
|
+
|
298
|
+
# Invites a user to join a merchant account.
|
299
|
+
def invite_merchant_user(request)
|
300
|
+
dashboard_request('POST', '/api/invite-merchant-user', request)
|
301
|
+
end
|
302
|
+
|
303
|
+
# Adds a test merchant account.
|
304
|
+
def add_test_merchant(request)
|
305
|
+
dashboard_request('POST', '/api/add-test-merchant', request)
|
306
|
+
end
|
307
|
+
|
308
|
+
# Deletes a test merchant account. Supports partner scoped API credentials
|
309
|
+
# only. Live merchant accounts cannot be deleted.
|
310
|
+
def delete_test_merchant(request)
|
311
|
+
dashboard_request('DELETE', '/api/test-merchant/' + request[:merchantId], request)
|
312
|
+
end
|
313
|
+
|
314
|
+
# List all merchant platforms configured for a gateway merchant.
|
315
|
+
def merchant_platforms(request)
|
316
|
+
dashboard_request('GET', '/api/plugin-configs/' + request[:merchantId], request)
|
317
|
+
end
|
318
|
+
|
319
|
+
# List all merchant platforms configured for a gateway merchant.
|
320
|
+
def update_merchant_platforms(request)
|
321
|
+
dashboard_request('POST', '/api/plugin-configs', request)
|
322
|
+
end
|
323
|
+
|
324
|
+
# Deletes a boarding platform configuration.
|
325
|
+
def delete_merchant_platforms(request)
|
326
|
+
dashboard_request('DELETE', '/api/plugin-config/' + request[:platformId], request)
|
327
|
+
end
|
328
|
+
|
329
|
+
# Returns all terminals associated with the merchant account.
|
330
|
+
def terminals(request)
|
331
|
+
dashboard_request('GET', '/api/terminals', request)
|
332
|
+
end
|
333
|
+
|
334
|
+
# Deactivates a terminal.
|
335
|
+
def deactivate_terminal(request)
|
336
|
+
dashboard_request('DELETE', '/api/terminal/' + request[:terminalId], request)
|
337
|
+
end
|
338
|
+
|
339
|
+
# Activates a terminal.
|
340
|
+
def activate_terminal(request)
|
341
|
+
dashboard_request('POST', '/api/terminal-activate', request)
|
342
|
+
end
|
343
|
+
|
344
|
+
# Returns a list of terms and conditions templates associated with a
|
345
|
+
# merchant account.
|
346
|
+
def tc_templates(request)
|
347
|
+
dashboard_request('GET', '/api/tc-templates', request)
|
348
|
+
end
|
349
|
+
|
350
|
+
# Returns a single terms and conditions template.
|
351
|
+
def tc_template(request)
|
352
|
+
dashboard_request('GET', '/api/tc-templates/' + request[:templateId], request)
|
353
|
+
end
|
354
|
+
|
355
|
+
# Updates or creates a terms and conditions template.
|
356
|
+
def tc_update_template(request)
|
357
|
+
dashboard_request('POST', '/api/tc-templates', request)
|
358
|
+
end
|
359
|
+
|
360
|
+
# Deletes a single terms and conditions template.
|
361
|
+
def tc_delete_template(request)
|
362
|
+
dashboard_request('DELETE', '/api/tc-templates/' + request[:templateId], request)
|
363
|
+
end
|
364
|
+
|
365
|
+
# Returns up to 250 entries from the Terms and Conditions log.
|
366
|
+
def tc_log(request)
|
367
|
+
dashboard_request('POST', '/api/tc-log', request)
|
368
|
+
end
|
369
|
+
|
370
|
+
# Returns a single detailed Terms and Conditions entry.
|
371
|
+
def tc_entry(request)
|
372
|
+
dashboard_request('GET', '/api/tc-entry/' + request[:logEntryId], request)
|
373
|
+
end
|
374
|
+
|
375
|
+
# Returns all survey questions for a given merchant.
|
376
|
+
def survey_questions(request)
|
377
|
+
dashboard_request('GET', '/api/survey-questions', request)
|
378
|
+
end
|
379
|
+
|
380
|
+
# Returns a single survey question with response data.
|
381
|
+
def survey_question(request)
|
382
|
+
dashboard_request('GET', '/api/survey-questions/' + request[:questionId], request)
|
383
|
+
end
|
384
|
+
|
385
|
+
# Updates or creates a survey question.
|
386
|
+
def update_survey_question(request)
|
387
|
+
dashboard_request('POST', '/api/survey-questions', request)
|
388
|
+
end
|
389
|
+
|
390
|
+
# Deletes a survey question.
|
391
|
+
def delete_survey_question(request)
|
392
|
+
dashboard_request('DELETE', '/api/survey-questions/' + request[:questionId], request)
|
393
|
+
end
|
394
|
+
|
395
|
+
# Returns results for a single survey question.
|
396
|
+
def survey_results(request)
|
397
|
+
dashboard_request('POST', '/api/survey-results', request)
|
398
|
+
end
|
399
|
+
|
400
|
+
# Returns the media library for a given partner, merchant, or
|
401
|
+
# organization.
|
402
|
+
def media(request)
|
403
|
+
dashboard_request('GET', '/api/media', request)
|
404
|
+
end
|
405
|
+
|
406
|
+
# Uploads a media asset to the media library.
|
407
|
+
def upload_media(request, file)
|
408
|
+
upload_request('/api/upload-media', request, file)
|
409
|
+
end
|
410
|
+
|
411
|
+
# Retrieves the current status of a file upload.
|
412
|
+
def upload_status(request)
|
413
|
+
dashboard_request('GET', '/api/media-upload/' + request[:uploadId], request)
|
414
|
+
end
|
415
|
+
|
416
|
+
# Returns the media details for a single media asset.
|
417
|
+
def media_asset(request)
|
418
|
+
dashboard_request('GET', '/api/media/' + request[:mediaId], request)
|
419
|
+
end
|
420
|
+
|
421
|
+
# Deletes a media asset.
|
422
|
+
def delete_media_asset(request)
|
423
|
+
dashboard_request('DELETE', '/api/media/' + request[:mediaId], request)
|
424
|
+
end
|
425
|
+
|
426
|
+
# Returns a collection of slide shows.
|
427
|
+
def slide_shows(request)
|
428
|
+
dashboard_request('GET', '/api/slide-shows', request)
|
429
|
+
end
|
430
|
+
|
431
|
+
# Returns a single slide show with slides.
|
432
|
+
def slide_show(request)
|
433
|
+
dashboard_request('GET', '/api/slide-shows/' + request[:slideShowId], request)
|
434
|
+
end
|
435
|
+
|
436
|
+
# Updates or creates a slide show.
|
437
|
+
def update_slide_show(request)
|
438
|
+
dashboard_request('POST', '/api/slide-shows', request)
|
439
|
+
end
|
440
|
+
|
441
|
+
# Deletes a single slide show.
|
442
|
+
def delete_slide_show(request)
|
443
|
+
dashboard_request('DELETE', '/api/slide-shows/' + request[:slideShowId], request)
|
444
|
+
end
|
445
|
+
|
446
|
+
# Returns the terminal branding stack for a given set of API credentials.
|
447
|
+
def terminal_branding(request)
|
448
|
+
dashboard_request('GET', '/api/terminal-branding', request)
|
449
|
+
end
|
450
|
+
|
451
|
+
# Updates a branding asset.
|
452
|
+
def update_branding_asset(request)
|
453
|
+
dashboard_request('POST', '/api/terminal-branding', request)
|
454
|
+
end
|
455
|
+
|
456
|
+
# Deletes a branding asset.
|
457
|
+
def delete_branding_asset(request)
|
458
|
+
dashboard_request('DELETE', '/api/terminal-branding/' + request[:assetId], request)
|
459
|
+
end
|
460
|
+
|
247
461
|
end
|
248
462
|
end
|
data/lib/blockchyp_client.rb
CHANGED
@@ -21,6 +21,7 @@ module BlockChyp
|
|
21
21
|
@signing_key = signing_key
|
22
22
|
@gateway_host = 'https://api.blockchyp.com'
|
23
23
|
@test_gateway_host = 'https://test.blockchyp.com'
|
24
|
+
@dashboard_host = 'https://dashboard.blockchyp.com'
|
24
25
|
@https = false
|
25
26
|
@route_cache_location = File.join(Dir.tmpdir, '.blockchyp_route')
|
26
27
|
@route_cache_ttl = 60
|
@@ -38,6 +39,7 @@ module BlockChyp
|
|
38
39
|
attr_reader :offline_fixed_key
|
39
40
|
attr_accessor :gateway_host
|
40
41
|
attr_accessor :test_gateway_host
|
42
|
+
attr_accessor :dashboard_host
|
41
43
|
attr_accessor :https
|
42
44
|
attr_accessor :route_cache_ttl
|
43
45
|
attr_accessor :gateway_timeout
|
@@ -72,6 +74,10 @@ module BlockChyp
|
|
72
74
|
URI.parse(path.nil? ? url : url + path)
|
73
75
|
end
|
74
76
|
|
77
|
+
def resolve_dashboard_uri(path, request)
|
78
|
+
URI.parse(dashboard_host + path)
|
79
|
+
end
|
80
|
+
|
75
81
|
def generate_error_response(msg)
|
76
82
|
{
|
77
83
|
success: false,
|
@@ -165,6 +171,78 @@ module BlockChyp
|
|
165
171
|
URI.parse(url + port + path)
|
166
172
|
end
|
167
173
|
|
174
|
+
def dashboard_request(method, path, request = nil)
|
175
|
+
uri = resolve_dashboard_uri(path, request)
|
176
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
177
|
+
http.use_ssl = uri.instance_of?(URI::HTTPS)
|
178
|
+
timeout = get_timeout(request, gateway_timeout)
|
179
|
+
http.open_timeout = timeout
|
180
|
+
http.read_timeout = timeout
|
181
|
+
|
182
|
+
req = get_http_request(method, uri)
|
183
|
+
|
184
|
+
req['User-Agent'] = user_agent
|
185
|
+
unless request.nil?
|
186
|
+
json = request.to_json
|
187
|
+
req['Content-Type'] = 'application/json'
|
188
|
+
req['Content-Length'] = json.length
|
189
|
+
req.body = json
|
190
|
+
end
|
191
|
+
|
192
|
+
headers = generate_gateway_headers
|
193
|
+
headers.each do |key, value|
|
194
|
+
req[key] = value
|
195
|
+
end
|
196
|
+
|
197
|
+
response = http.request(req)
|
198
|
+
|
199
|
+
if response.is_a?(Net::HTTPSuccess)
|
200
|
+
JSON.parse(response.body, symbolize_names: true)
|
201
|
+
else
|
202
|
+
raise response.message
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
def upload_request(path, request, content)
|
207
|
+
uri = resolve_dashboard_uri(path, request)
|
208
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
209
|
+
http.use_ssl = uri.instance_of?(URI::HTTPS)
|
210
|
+
timeout = get_timeout(request, gateway_timeout)
|
211
|
+
http.open_timeout = timeout
|
212
|
+
http.read_timeout = timeout
|
213
|
+
|
214
|
+
req = get_http_request("POST", uri)
|
215
|
+
req.body = content
|
216
|
+
req['User-Agent'] = user_agent
|
217
|
+
req['Content-Type'] = 'application/octet-stream'
|
218
|
+
|
219
|
+
if request[:fileName]
|
220
|
+
req['X-Upload-File-Name'] = request[:fileName]
|
221
|
+
end
|
222
|
+
|
223
|
+
if request[:uploadId]
|
224
|
+
req['X-Upload-ID'] = request[:uploadId]
|
225
|
+
end
|
226
|
+
|
227
|
+
if request[:fileSize]
|
228
|
+
req['X-File-Size'] = request[:fileSize]
|
229
|
+
req['Content-Length'] = request[:fileSize]
|
230
|
+
end
|
231
|
+
|
232
|
+
headers = generate_gateway_headers
|
233
|
+
headers.each do |key, value|
|
234
|
+
req[key] = value
|
235
|
+
end
|
236
|
+
|
237
|
+
response = http.request(req)
|
238
|
+
|
239
|
+
if response.is_a?(Net::HTTPSuccess)
|
240
|
+
JSON.parse(response.body, symbolize_names: true)
|
241
|
+
else
|
242
|
+
raise response.message
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
168
246
|
def gateway_request(method, path, request = nil, relay = false)
|
169
247
|
uri = resolve_gateway_uri(path, request)
|
170
248
|
http = Net::HTTP.new(uri.host, uri.port)
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2019-2022 BlockChyp, Inc. All rights reserved. Use of this code is
|
4
|
+
# governed by a license that can be found in the LICENSE file.
|
5
|
+
#
|
6
|
+
# This file was generated automatically by the BlockChyp SDK Generator.
|
7
|
+
# Changes to this file will be lost every time the code is regenerated.
|
8
|
+
|
9
|
+
require ::File.expand_path('test_helper', __dir__)
|
10
|
+
|
11
|
+
module BlockChyp
|
12
|
+
class ActivateTerminalTest < TestCase
|
13
|
+
def test_activate_terminal
|
14
|
+
|
15
|
+
puts "Running test_activate_terminal..."
|
16
|
+
|
17
|
+
config = load_test_config
|
18
|
+
|
19
|
+
blockchyp = BlockChyp.new(
|
20
|
+
config[:apiKey],
|
21
|
+
config[:bearerToken],
|
22
|
+
config[:signingKey]
|
23
|
+
)
|
24
|
+
blockchyp.gateway_host = config[:gatewayHost]
|
25
|
+
blockchyp.test_gateway_host = config[:testGatewayHost]
|
26
|
+
blockchyp.dashboard_host = config[:dashboardHost]
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
# Set request parameters
|
33
|
+
request = {
|
34
|
+
terminalName: 'Bad Terminal Code',
|
35
|
+
activationCode: 'XXXXXX'
|
36
|
+
}
|
37
|
+
|
38
|
+
response = blockchyp.activate_terminal(request)
|
39
|
+
assert_not_nil(response)
|
40
|
+
# response assertions
|
41
|
+
assert(!response[:success])
|
42
|
+
assert_equal('Invalid Activation Code', response[:error])
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2019-2022 BlockChyp, Inc. All rights reserved. Use of this code is
|
4
|
+
# governed by a license that can be found in the LICENSE file.
|
5
|
+
#
|
6
|
+
# This file was generated automatically by the BlockChyp SDK Generator.
|
7
|
+
# Changes to this file will be lost every time the code is regenerated.
|
8
|
+
|
9
|
+
require ::File.expand_path('test_helper', __dir__)
|
10
|
+
|
11
|
+
module BlockChyp
|
12
|
+
class AddTestMerchantTest < TestCase
|
13
|
+
def test_add_test_merchant
|
14
|
+
|
15
|
+
puts "Running test_add_test_merchant..."
|
16
|
+
|
17
|
+
config = load_test_config
|
18
|
+
|
19
|
+
blockchyp = BlockChyp.new(
|
20
|
+
config[:apiKey],
|
21
|
+
config[:bearerToken],
|
22
|
+
config[:signingKey]
|
23
|
+
)
|
24
|
+
blockchyp.gateway_host = config[:gatewayHost]
|
25
|
+
blockchyp.test_gateway_host = config[:testGatewayHost]
|
26
|
+
blockchyp.dashboard_host = config[:dashboardHost]
|
27
|
+
|
28
|
+
|
29
|
+
profile = config[:profiles][:partner]
|
30
|
+
blockchyp = BlockChyp.new(
|
31
|
+
profile[:apiKey],
|
32
|
+
profile[:bearerToken],
|
33
|
+
profile[:signingKey]
|
34
|
+
)
|
35
|
+
blockchyp.gateway_host = config[:gatewayHost]
|
36
|
+
blockchyp.test_gateway_host = config[:testGatewayHost]
|
37
|
+
blockchyp.dashboard_host = config[:dashboardHost]
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
# Set request parameters
|
42
|
+
request = {
|
43
|
+
dbaName: 'Test Merchant',
|
44
|
+
companyName: 'Test Merchant'
|
45
|
+
}
|
46
|
+
|
47
|
+
response = blockchyp.add_test_merchant(request)
|
48
|
+
assert_not_nil(response)
|
49
|
+
# response assertions
|
50
|
+
assert(response[:success])
|
51
|
+
assert_equal('Test Merchant', response[:dbaName])
|
52
|
+
assert_equal('Test Merchant', response[:companyName])
|
53
|
+
assert(response[:visa])
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
data/test/batch_history_test.rb
CHANGED
@@ -1,16 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright 2019 BlockChyp, Inc. All rights reserved. Use of this code is
|
3
|
+
# Copyright 2019-2022 BlockChyp, Inc. All rights reserved. Use of this code is
|
4
4
|
# governed by a license that can be found in the LICENSE file.
|
5
5
|
#
|
6
|
-
# This file was generated automatically
|
7
|
-
# every time the code is regenerated.
|
6
|
+
# This file was generated automatically by the BlockChyp SDK Generator.
|
7
|
+
# Changes to this file will be lost every time the code is regenerated.
|
8
8
|
|
9
9
|
require ::File.expand_path('test_helper', __dir__)
|
10
10
|
|
11
11
|
module BlockChyp
|
12
12
|
class BatchHistoryTest < TestCase
|
13
13
|
def test_batch_history
|
14
|
+
|
15
|
+
puts "Running test_batch_history..."
|
16
|
+
|
14
17
|
config = load_test_config
|
15
18
|
|
16
19
|
blockchyp = BlockChyp.new(
|
@@ -20,8 +23,11 @@ module BlockChyp
|
|
20
23
|
)
|
21
24
|
blockchyp.gateway_host = config[:gatewayHost]
|
22
25
|
blockchyp.test_gateway_host = config[:testGatewayHost]
|
26
|
+
blockchyp.dashboard_host = config[:dashboardHost]
|
27
|
+
|
28
|
+
|
29
|
+
|
23
30
|
|
24
|
-
test_delay(blockchyp, 'batch_history_test', config[:defaultTerminalName])
|
25
31
|
|
26
32
|
# Set request parameters
|
27
33
|
setup_request = {
|
@@ -32,7 +38,6 @@ module BlockChyp
|
|
32
38
|
test: true,
|
33
39
|
transactionRef: uuid
|
34
40
|
}
|
35
|
-
|
36
41
|
response = blockchyp.charge(setup_request)
|
37
42
|
|
38
43
|
# Set request parameters
|
@@ -41,7 +46,6 @@ module BlockChyp
|
|
41
46
|
}
|
42
47
|
|
43
48
|
response = blockchyp.batch_history(request)
|
44
|
-
|
45
49
|
assert_not_nil(response)
|
46
50
|
# response assertions
|
47
51
|
assert(response[:success])
|
data/test/boolean_prompt_test.rb
CHANGED
@@ -1,16 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright 2019 BlockChyp, Inc. All rights reserved. Use of this code is
|
3
|
+
# Copyright 2019-2022 BlockChyp, Inc. All rights reserved. Use of this code is
|
4
4
|
# governed by a license that can be found in the LICENSE file.
|
5
5
|
#
|
6
|
-
# This file was generated automatically
|
7
|
-
# every time the code is regenerated.
|
6
|
+
# This file was generated automatically by the BlockChyp SDK Generator.
|
7
|
+
# Changes to this file will be lost every time the code is regenerated.
|
8
8
|
|
9
9
|
require ::File.expand_path('test_helper', __dir__)
|
10
10
|
|
11
11
|
module BlockChyp
|
12
12
|
class BooleanPromptTest < TestCase
|
13
13
|
def test_boolean_prompt
|
14
|
+
|
15
|
+
puts "Running test_boolean_prompt..."
|
16
|
+
|
14
17
|
config = load_test_config
|
15
18
|
|
16
19
|
blockchyp = BlockChyp.new(
|
@@ -20,9 +23,13 @@ module BlockChyp
|
|
20
23
|
)
|
21
24
|
blockchyp.gateway_host = config[:gatewayHost]
|
22
25
|
blockchyp.test_gateway_host = config[:testGatewayHost]
|
26
|
+
blockchyp.dashboard_host = config[:dashboardHost]
|
23
27
|
|
24
28
|
test_delay(blockchyp, 'boolean_prompt_test', config[:defaultTerminalName])
|
25
29
|
|
30
|
+
|
31
|
+
|
32
|
+
|
26
33
|
# Set request parameters
|
27
34
|
request = {
|
28
35
|
test: true,
|
@@ -33,7 +40,6 @@ module BlockChyp
|
|
33
40
|
}
|
34
41
|
|
35
42
|
response = blockchyp.boolean_prompt(request)
|
36
|
-
|
37
43
|
assert_not_nil(response)
|
38
44
|
# response assertions
|
39
45
|
assert(response[:success])
|
@@ -1,16 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright 2019 BlockChyp, Inc. All rights reserved. Use of this code is
|
3
|
+
# Copyright 2019-2022 BlockChyp, Inc. All rights reserved. Use of this code is
|
4
4
|
# governed by a license that can be found in the LICENSE file.
|
5
5
|
#
|
6
|
-
# This file was generated automatically
|
7
|
-
# every time the code is regenerated.
|
6
|
+
# This file was generated automatically by the BlockChyp SDK Generator.
|
7
|
+
# Changes to this file will be lost every time the code is regenerated.
|
8
8
|
|
9
9
|
require ::File.expand_path('test_helper', __dir__)
|
10
10
|
|
11
11
|
module BlockChyp
|
12
12
|
class CancelPaymentLinkTest < TestCase
|
13
13
|
def test_cancel_payment_link
|
14
|
+
|
15
|
+
puts "Running test_cancel_payment_link..."
|
16
|
+
|
14
17
|
config = load_test_config
|
15
18
|
|
16
19
|
blockchyp = BlockChyp.new(
|
@@ -20,8 +23,11 @@ module BlockChyp
|
|
20
23
|
)
|
21
24
|
blockchyp.gateway_host = config[:gatewayHost]
|
22
25
|
blockchyp.test_gateway_host = config[:testGatewayHost]
|
26
|
+
blockchyp.dashboard_host = config[:dashboardHost]
|
27
|
+
|
28
|
+
|
29
|
+
|
23
30
|
|
24
|
-
test_delay(blockchyp, 'cancel_payment_link_test', config[:defaultTerminalName])
|
25
31
|
|
26
32
|
# Set request parameters
|
27
33
|
setup_request = {
|
@@ -50,7 +56,6 @@ module BlockChyp
|
|
50
56
|
smsNumber: '(123) 123-1231'
|
51
57
|
}
|
52
58
|
}
|
53
|
-
|
54
59
|
response = blockchyp.send_payment_link(setup_request)
|
55
60
|
|
56
61
|
# Set request parameters
|
@@ -59,7 +64,6 @@ module BlockChyp
|
|
59
64
|
}
|
60
65
|
|
61
66
|
response = blockchyp.cancel_payment_link(request)
|
62
|
-
|
63
67
|
assert_not_nil(response)
|
64
68
|
# response assertions
|
65
69
|
assert(response[:success])
|
@@ -1,16 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright 2019 BlockChyp, Inc. All rights reserved. Use of this code is
|
3
|
+
# Copyright 2019-2022 BlockChyp, Inc. All rights reserved. Use of this code is
|
4
4
|
# governed by a license that can be found in the LICENSE file.
|
5
5
|
#
|
6
|
-
# This file was generated automatically
|
7
|
-
# every time the code is regenerated.
|
6
|
+
# This file was generated automatically by the BlockChyp SDK Generator.
|
7
|
+
# Changes to this file will be lost every time the code is regenerated.
|
8
8
|
|
9
9
|
require ::File.expand_path('test_helper', __dir__)
|
10
10
|
|
11
11
|
module BlockChyp
|
12
12
|
class CaptureSignatureTest < TestCase
|
13
13
|
def test_capture_signature
|
14
|
+
|
15
|
+
puts "Running test_capture_signature..."
|
16
|
+
|
14
17
|
config = load_test_config
|
15
18
|
|
16
19
|
blockchyp = BlockChyp.new(
|
@@ -20,9 +23,13 @@ module BlockChyp
|
|
20
23
|
)
|
21
24
|
blockchyp.gateway_host = config[:gatewayHost]
|
22
25
|
blockchyp.test_gateway_host = config[:testGatewayHost]
|
26
|
+
blockchyp.dashboard_host = config[:dashboardHost]
|
23
27
|
|
24
28
|
test_delay(blockchyp, 'capture_signature_test', config[:defaultTerminalName])
|
25
29
|
|
30
|
+
|
31
|
+
|
32
|
+
|
26
33
|
# Set request parameters
|
27
34
|
request = {
|
28
35
|
terminalName: config[:defaultTerminalName],
|
@@ -31,7 +38,6 @@ module BlockChyp
|
|
31
38
|
}
|
32
39
|
|
33
40
|
response = blockchyp.capture_signature(request)
|
34
|
-
|
35
41
|
assert_not_nil(response)
|
36
42
|
# response assertions
|
37
43
|
assert(response[:success])
|