blockchyp 2.0.0.pre.alpha7 → 2.0.1.pre.rc8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Makefile +33 -0
- data/README.md +136 -161
- data/lib/blockchyp.rb +32 -21
- data/lib/blockchyp/version.rb +1 -1
- data/lib/blockchyp_client.rb +93 -83
- data/test/boolean_prompt_test.rb +10 -2
- data/test/gateway_timeout_test.rb +40 -0
- data/test/heartbeat_test.rb +2 -2
- data/test/new_transaction_display_test.rb +10 -2
- data/test/pan_charge_test.rb +10 -1
- data/test/pan_enroll_test.rb +10 -1
- data/test/pan_preauth_test.rb +10 -1
- data/test/simple_batch_close_test.rb +10 -2
- data/test/simple_capture_test.rb +10 -1
- data/test/simple_gift_activate_test.rb +11 -2
- data/test/simple_message_test.rb +9 -1
- data/test/simple_ping_test.rb +9 -1
- data/test/simple_refund_test.rb +10 -1
- data/test/simple_reversal_test.rb +10 -1
- data/test/simple_void_test.rb +10 -1
- data/test/terminal_charge_test.rb +10 -1
- data/test/terminal_clear_test.rb +9 -1
- data/test/terminal_ebt_balance_test.rb +9 -1
- data/test/terminal_ebt_charge_test.rb +10 -1
- data/test/terminal_enroll_test.rb +10 -1
- data/test/terminal_gift_card_balance_test.rb +9 -1
- data/test/terminal_keyed_charge_test.rb +10 -1
- data/test/terminal_manual_ebt_charge_test.rb +10 -1
- data/test/terminal_preauth_test.rb +10 -1
- data/test/terminal_status_test.rb +39 -0
- data/test/terminal_timeout_test.rb +39 -0
- data/test/terms_and_conditions_test.rb +10 -2
- data/test/test_helper.rb +1 -1
- data/test/text_prompt_test.rb +10 -2
- data/test/update_transaction_display_test.rb +10 -2
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4cfbc9a579219f0cf12513d527ca1811ad9ea462d3de1cb3dda0e18af1de6be
|
4
|
+
data.tar.gz: efbfbde71b79e73555f14962f2ff76ff7070c27a99023d50f16696f97c04a96d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84c1d4170dc3f0d3d7e3f0f12abea1192059eb0468a83787675ad7e3de62cfa35a18914dbe19edd1618dd0ab1f028b112013fa3ecf39546693a057fcf92e4009
|
7
|
+
data.tar.gz: 62677b578309e34f1946c775fbd13d59fbac2b0813f4f091e04f308ceec9b6674be32872f970381db8a761bf5dcc0cbcda4cbbe6636d51be0107745fffec2858
|
data/Makefile
CHANGED
@@ -6,8 +6,24 @@ RELEASE := $(or $(BUILD_NUMBER), 1)
|
|
6
6
|
VERSION := $(or $(TAG:v%=%),$(LASTTAG:v%=%))-$(or $(BUILD_NUMBER), 1)$(if $(TAG),,.$(SNAPINFO))
|
7
7
|
|
8
8
|
# Executables
|
9
|
+
DOCKER = docker
|
10
|
+
BUNDLE = bundle
|
9
11
|
SED = sed
|
10
12
|
|
13
|
+
# Integration test config
|
14
|
+
export BC_TEST_DELAY := 5
|
15
|
+
IMAGE := circleci/ruby
|
16
|
+
SCMROOT := $(shell git rev-parse --show-toplevel)
|
17
|
+
PWD := $(shell pwd)
|
18
|
+
CACHE := $(HOME)/.local/share/blockchyp/itest-cache
|
19
|
+
CONFIGFILE := $(HOME)/.config/blockchyp/sdk-itest-config.json
|
20
|
+
CACHEPATHS := $(dir $(CONFIGFILE)) $(HOME)/.bundle
|
21
|
+
ifeq ($(shell uname -s), Linux)
|
22
|
+
HOSTIP = $(shell ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')
|
23
|
+
else
|
24
|
+
HOSTIP = host.docker.internal
|
25
|
+
endif
|
26
|
+
|
11
27
|
# Default target
|
12
28
|
.PHONY: all
|
13
29
|
all: clean build test
|
@@ -15,10 +31,12 @@ all: clean build test
|
|
15
31
|
# Clean build artifacts
|
16
32
|
.PHONY: clean
|
17
33
|
clean:
|
34
|
+
$(RM) ./*.gem
|
18
35
|
|
19
36
|
# Build compiles the package
|
20
37
|
.PHONY: build
|
21
38
|
build:
|
39
|
+
$(BUNDLE) exec rake build
|
22
40
|
|
23
41
|
# Runs unit tests
|
24
42
|
.PHONY: test
|
@@ -27,6 +45,20 @@ test:
|
|
27
45
|
# Runs integration tests
|
28
46
|
.PHONY: integration
|
29
47
|
integration:
|
48
|
+
$(if $(LOCALBUILD), \
|
49
|
+
$(BUNDLE) exec rake test $(if $(TEST),TEST=$(TEST),,), \
|
50
|
+
$(foreach path,$(CACHEPATHS),mkdir -p $(CACHE)/$(path) ; ) \
|
51
|
+
sed 's/localhost/$(HOSTIP)/' $(CONFIGFILE) >$(CACHE)/$(CONFIGFILE) ; \
|
52
|
+
$(DOCKER) run \
|
53
|
+
-u $(shell id -u):$(shell id -g) \
|
54
|
+
-v $(SCMROOT):$(SCMROOT):Z \
|
55
|
+
-v /etc/passwd:/etc/passwd:ro \
|
56
|
+
$(foreach path,$(CACHEPATHS),-v $(CACHE)/$(path):$(path):Z) \
|
57
|
+
-e BC_TEST_DELAY=$(BC_TEST_DELAY) \
|
58
|
+
-e HOME=$(HOME) \
|
59
|
+
-w $(PWD) \
|
60
|
+
--rm -it $(IMAGE) \
|
61
|
+
bash -c "$(BUNDLE) install --path $(HOME)/.bundle/vendor && $(BUNDLE) exec rake test $(if $(TEST),TEST=$(TEST),)")
|
30
62
|
|
31
63
|
# Performs any tasks necessary before a release build
|
32
64
|
.PHONY: stage
|
@@ -36,3 +68,4 @@ stage:
|
|
36
68
|
# Publish
|
37
69
|
.PHONY: publish
|
38
70
|
publish:
|
71
|
+
$(BUNDLE) exec rake publish
|
data/README.md
CHANGED
@@ -97,15 +97,16 @@ stuff you can do with the BlockChyp Ruby SDK and a few basic examples.
|
|
97
97
|
|
98
98
|
Executes a standard direct preauth and capture.
|
99
99
|
|
100
|
+
|
100
101
|
```ruby
|
101
102
|
# frozen_string_literal: true
|
102
103
|
|
103
104
|
require 'blockchyp'
|
104
105
|
|
105
|
-
blockchyp = BlockChyp.new(
|
106
|
-
'
|
107
|
-
'
|
108
|
-
'
|
106
|
+
blockchyp = BlockChyp::BlockChyp.new(
|
107
|
+
ENV['BC_API_KEY'],
|
108
|
+
ENV['BC_BEARER_TOKEN'],
|
109
|
+
ENV['BC_SIGNING_KEY']
|
109
110
|
)
|
110
111
|
|
111
112
|
# setup request object
|
@@ -116,12 +117,7 @@ request['amount'] = '55.00'
|
|
116
117
|
|
117
118
|
response = blockchyp.charge(request)
|
118
119
|
|
119
|
-
|
120
|
-
puts 'Approved'
|
121
|
-
end
|
122
|
-
|
123
|
-
puts 'authCode:' + response['authCode']
|
124
|
-
puts 'authorizedAmount:' + response['authorizedAmount']
|
120
|
+
puts "Response: #{response.inspect}"
|
125
121
|
|
126
122
|
|
127
123
|
```
|
@@ -130,15 +126,16 @@ puts 'authorizedAmount:' + response['authorizedAmount']
|
|
130
126
|
|
131
127
|
Executes a preauthorization intended to be captured later.
|
132
128
|
|
129
|
+
|
133
130
|
```ruby
|
134
131
|
# frozen_string_literal: true
|
135
132
|
|
136
133
|
require 'blockchyp'
|
137
134
|
|
138
|
-
blockchyp = BlockChyp.new(
|
139
|
-
'
|
140
|
-
'
|
141
|
-
'
|
135
|
+
blockchyp = BlockChyp::BlockChyp.new(
|
136
|
+
ENV['BC_API_KEY'],
|
137
|
+
ENV['BC_BEARER_TOKEN'],
|
138
|
+
ENV['BC_SIGNING_KEY']
|
142
139
|
)
|
143
140
|
|
144
141
|
# setup request object
|
@@ -149,12 +146,7 @@ request['amount'] = '27.00'
|
|
149
146
|
|
150
147
|
response = blockchyp.preauth(request)
|
151
148
|
|
152
|
-
|
153
|
-
puts 'Approved'
|
154
|
-
end
|
155
|
-
|
156
|
-
puts 'authCode:' + response['authCode']
|
157
|
-
puts 'authorizedAmount:' + response['authorizedAmount']
|
149
|
+
puts "Response: #{response.inspect}"
|
158
150
|
|
159
151
|
|
160
152
|
```
|
@@ -163,15 +155,16 @@ puts 'authorizedAmount:' + response['authorizedAmount']
|
|
163
155
|
|
164
156
|
Tests connectivity with a payment terminal.
|
165
157
|
|
158
|
+
|
166
159
|
```ruby
|
167
160
|
# frozen_string_literal: true
|
168
161
|
|
169
162
|
require 'blockchyp'
|
170
163
|
|
171
|
-
blockchyp = BlockChyp.new(
|
172
|
-
'
|
173
|
-
'
|
174
|
-
'
|
164
|
+
blockchyp = BlockChyp::BlockChyp.new(
|
165
|
+
ENV['BC_API_KEY'],
|
166
|
+
ENV['BC_BEARER_TOKEN'],
|
167
|
+
ENV['BC_SIGNING_KEY']
|
175
168
|
)
|
176
169
|
|
177
170
|
# setup request object
|
@@ -180,10 +173,7 @@ request['terminalName'] = 'Test Terminal'
|
|
180
173
|
|
181
174
|
response = blockchyp.ping(request)
|
182
175
|
|
183
|
-
|
184
|
-
puts 'Success'
|
185
|
-
end
|
186
|
-
|
176
|
+
puts "Response: #{response.inspect}"
|
187
177
|
|
188
178
|
|
189
179
|
```
|
@@ -192,15 +182,16 @@ end
|
|
192
182
|
|
193
183
|
Checks the remaining balance on a payment method.
|
194
184
|
|
185
|
+
|
195
186
|
```ruby
|
196
187
|
# frozen_string_literal: true
|
197
188
|
|
198
189
|
require 'blockchyp'
|
199
190
|
|
200
|
-
blockchyp = BlockChyp.new(
|
201
|
-
'
|
202
|
-
'
|
203
|
-
'
|
191
|
+
blockchyp = BlockChyp::BlockChyp.new(
|
192
|
+
ENV['BC_API_KEY'],
|
193
|
+
ENV['BC_BEARER_TOKEN'],
|
194
|
+
ENV['BC_SIGNING_KEY']
|
204
195
|
)
|
205
196
|
|
206
197
|
# setup request object
|
@@ -211,10 +202,7 @@ request['cardType'] = CardType::EBT
|
|
211
202
|
|
212
203
|
response = blockchyp.balance(request)
|
213
204
|
|
214
|
-
|
215
|
-
puts 'Success'
|
216
|
-
end
|
217
|
-
|
205
|
+
puts "Response: #{response.inspect}"
|
218
206
|
|
219
207
|
|
220
208
|
```
|
@@ -223,15 +211,16 @@ end
|
|
223
211
|
|
224
212
|
Clears the line item display and any in progress transaction.
|
225
213
|
|
214
|
+
|
226
215
|
```ruby
|
227
216
|
# frozen_string_literal: true
|
228
217
|
|
229
218
|
require 'blockchyp'
|
230
219
|
|
231
|
-
blockchyp = BlockChyp.new(
|
232
|
-
'
|
233
|
-
'
|
234
|
-
'
|
220
|
+
blockchyp = BlockChyp::BlockChyp.new(
|
221
|
+
ENV['BC_API_KEY'],
|
222
|
+
ENV['BC_BEARER_TOKEN'],
|
223
|
+
ENV['BC_SIGNING_KEY']
|
235
224
|
)
|
236
225
|
|
237
226
|
# setup request object
|
@@ -241,10 +230,7 @@ request['terminalName'] = 'Test Terminal'
|
|
241
230
|
|
242
231
|
response = blockchyp.clear(request)
|
243
232
|
|
244
|
-
|
245
|
-
puts 'Success'
|
246
|
-
end
|
247
|
-
|
233
|
+
puts "Response: #{response.inspect}"
|
248
234
|
|
249
235
|
|
250
236
|
```
|
@@ -253,15 +239,16 @@ end
|
|
253
239
|
|
254
240
|
Prompts the user to accept terms and conditions.
|
255
241
|
|
242
|
+
|
256
243
|
```ruby
|
257
244
|
# frozen_string_literal: true
|
258
245
|
|
259
246
|
require 'blockchyp'
|
260
247
|
|
261
|
-
blockchyp = BlockChyp.new(
|
262
|
-
'
|
263
|
-
'
|
264
|
-
'
|
248
|
+
blockchyp = BlockChyp::BlockChyp.new(
|
249
|
+
ENV['BC_API_KEY'],
|
250
|
+
ENV['BC_BEARER_TOKEN'],
|
251
|
+
ENV['BC_SIGNING_KEY']
|
265
252
|
)
|
266
253
|
|
267
254
|
# setup request object
|
@@ -277,31 +264,27 @@ request['sigRequired'] = true
|
|
277
264
|
|
278
265
|
response = blockchyp.termsAndConditions(request)
|
279
266
|
|
280
|
-
|
281
|
-
puts 'Success'
|
282
|
-
end
|
283
|
-
|
284
|
-
puts 'sig:' + response['sig']
|
285
|
-
puts 'sigFile:' + response['sigFile']
|
267
|
+
puts "Response: #{response.inspect}"
|
286
268
|
|
287
269
|
|
288
270
|
```
|
289
271
|
|
290
272
|
#### Update Transaction Display
|
291
273
|
|
292
|
-
Appends items to an existing transaction display
|
274
|
+
Appends items to an existing transaction display. Subtotal, Tax, and Total are
|
293
275
|
overwritten by the request. Items with the same description are combined into
|
294
276
|
groups.
|
295
277
|
|
278
|
+
|
296
279
|
```ruby
|
297
280
|
# frozen_string_literal: true
|
298
281
|
|
299
282
|
require 'blockchyp'
|
300
283
|
|
301
|
-
blockchyp = BlockChyp.new(
|
302
|
-
'
|
303
|
-
'
|
304
|
-
'
|
284
|
+
blockchyp = BlockChyp::BlockChyp.new(
|
285
|
+
ENV['BC_API_KEY'],
|
286
|
+
ENV['BC_BEARER_TOKEN'],
|
287
|
+
ENV['BC_SIGNING_KEY']
|
305
288
|
)
|
306
289
|
|
307
290
|
# setup request object
|
@@ -312,10 +295,7 @@ request['transaction'] = new_transaction_display_transaction
|
|
312
295
|
|
313
296
|
response = blockchyp.updateTransactionDisplay(request)
|
314
297
|
|
315
|
-
|
316
|
-
puts 'Succeded'
|
317
|
-
end
|
318
|
-
|
298
|
+
puts "Response: #{response.inspect}"
|
319
299
|
def new_transaction_display_transaction
|
320
300
|
val = {}
|
321
301
|
val['subtotal'] = '60.00'
|
@@ -356,22 +336,22 @@ end
|
|
356
336
|
|
357
337
|
|
358
338
|
|
359
|
-
|
360
339
|
```
|
361
340
|
|
362
341
|
#### New Transaction Display
|
363
342
|
|
364
343
|
Displays a new transaction on the terminal.
|
365
344
|
|
345
|
+
|
366
346
|
```ruby
|
367
347
|
# frozen_string_literal: true
|
368
348
|
|
369
349
|
require 'blockchyp'
|
370
350
|
|
371
|
-
blockchyp = BlockChyp.new(
|
372
|
-
'
|
373
|
-
'
|
374
|
-
'
|
351
|
+
blockchyp = BlockChyp::BlockChyp.new(
|
352
|
+
ENV['BC_API_KEY'],
|
353
|
+
ENV['BC_BEARER_TOKEN'],
|
354
|
+
ENV['BC_SIGNING_KEY']
|
375
355
|
)
|
376
356
|
|
377
357
|
# setup request object
|
@@ -382,10 +362,7 @@ request['transaction'] = new_transaction_display_transaction
|
|
382
362
|
|
383
363
|
response = blockchyp.newTransactionDisplay(request)
|
384
364
|
|
385
|
-
|
386
|
-
puts 'Succeded'
|
387
|
-
end
|
388
|
-
|
365
|
+
puts "Response: #{response.inspect}"
|
389
366
|
def new_transaction_display_transaction
|
390
367
|
val = {}
|
391
368
|
val['subtotal'] = '60.00'
|
@@ -426,22 +403,22 @@ end
|
|
426
403
|
|
427
404
|
|
428
405
|
|
429
|
-
|
430
406
|
```
|
431
407
|
|
432
408
|
#### Text Prompt
|
433
409
|
|
434
|
-
Asks the consumer text based question.
|
410
|
+
Asks the consumer a text based question.
|
411
|
+
|
435
412
|
|
436
413
|
```ruby
|
437
414
|
# frozen_string_literal: true
|
438
415
|
|
439
416
|
require 'blockchyp'
|
440
417
|
|
441
|
-
blockchyp = BlockChyp.new(
|
442
|
-
'
|
443
|
-
'
|
444
|
-
'
|
418
|
+
blockchyp = BlockChyp::BlockChyp.new(
|
419
|
+
ENV['BC_API_KEY'],
|
420
|
+
ENV['BC_BEARER_TOKEN'],
|
421
|
+
ENV['BC_SIGNING_KEY']
|
445
422
|
)
|
446
423
|
|
447
424
|
# setup request object
|
@@ -452,11 +429,7 @@ request['promptType'] = PromptType::EMAIL
|
|
452
429
|
|
453
430
|
response = blockchyp.textPrompt(request)
|
454
431
|
|
455
|
-
|
456
|
-
puts 'Success'
|
457
|
-
end
|
458
|
-
|
459
|
-
puts 'response:' + response['response']
|
432
|
+
puts "Response: #{response.inspect}"
|
460
433
|
|
461
434
|
|
462
435
|
```
|
@@ -465,15 +438,16 @@ puts 'response:' + response['response']
|
|
465
438
|
|
466
439
|
Asks the consumer a yes/no question.
|
467
440
|
|
441
|
+
|
468
442
|
```ruby
|
469
443
|
# frozen_string_literal: true
|
470
444
|
|
471
445
|
require 'blockchyp'
|
472
446
|
|
473
|
-
blockchyp = BlockChyp.new(
|
474
|
-
'
|
475
|
-
'
|
476
|
-
'
|
447
|
+
blockchyp = BlockChyp::BlockChyp.new(
|
448
|
+
ENV['BC_API_KEY'],
|
449
|
+
ENV['BC_BEARER_TOKEN'],
|
450
|
+
ENV['BC_SIGNING_KEY']
|
477
451
|
)
|
478
452
|
|
479
453
|
# setup request object
|
@@ -486,11 +460,7 @@ request['noCaption'] = 'No'
|
|
486
460
|
|
487
461
|
response = blockchyp.booleanPrompt(request)
|
488
462
|
|
489
|
-
|
490
|
-
puts 'Success'
|
491
|
-
end
|
492
|
-
|
493
|
-
puts 'response:' + response['response']
|
463
|
+
puts "Response: #{response.inspect}"
|
494
464
|
|
495
465
|
|
496
466
|
```
|
@@ -499,15 +469,16 @@ puts 'response:' + response['response']
|
|
499
469
|
|
500
470
|
Displays a short message on the terminal.
|
501
471
|
|
472
|
+
|
502
473
|
```ruby
|
503
474
|
# frozen_string_literal: true
|
504
475
|
|
505
476
|
require 'blockchyp'
|
506
477
|
|
507
|
-
blockchyp = BlockChyp.new(
|
508
|
-
'
|
509
|
-
'
|
510
|
-
'
|
478
|
+
blockchyp = BlockChyp::BlockChyp.new(
|
479
|
+
ENV['BC_API_KEY'],
|
480
|
+
ENV['BC_BEARER_TOKEN'],
|
481
|
+
ENV['BC_SIGNING_KEY']
|
511
482
|
)
|
512
483
|
|
513
484
|
# setup request object
|
@@ -518,10 +489,7 @@ request['message'] = 'Thank you for your business.'
|
|
518
489
|
|
519
490
|
response = blockchyp.message(request)
|
520
491
|
|
521
|
-
|
522
|
-
puts 'Success'
|
523
|
-
end
|
524
|
-
|
492
|
+
puts "Response: #{response.inspect}"
|
525
493
|
|
526
494
|
|
527
495
|
```
|
@@ -530,15 +498,16 @@ end
|
|
530
498
|
|
531
499
|
Executes a refund.
|
532
500
|
|
501
|
+
|
533
502
|
```ruby
|
534
503
|
# frozen_string_literal: true
|
535
504
|
|
536
505
|
require 'blockchyp'
|
537
506
|
|
538
|
-
blockchyp = BlockChyp.new(
|
539
|
-
'
|
540
|
-
'
|
541
|
-
'
|
507
|
+
blockchyp = BlockChyp::BlockChyp.new(
|
508
|
+
ENV['BC_API_KEY'],
|
509
|
+
ENV['BC_BEARER_TOKEN'],
|
510
|
+
ENV['BC_SIGNING_KEY']
|
542
511
|
)
|
543
512
|
|
544
513
|
# setup request object
|
@@ -549,10 +518,7 @@ request['amount'] = '5.00'
|
|
549
518
|
|
550
519
|
response = blockchyp.refund(request)
|
551
520
|
|
552
|
-
|
553
|
-
puts 'Approved'
|
554
|
-
end
|
555
|
-
|
521
|
+
puts "Response: #{response.inspect}"
|
556
522
|
|
557
523
|
|
558
524
|
```
|
@@ -561,15 +527,16 @@ end
|
|
561
527
|
|
562
528
|
Adds a new payment method to the token vault.
|
563
529
|
|
530
|
+
|
564
531
|
```ruby
|
565
532
|
# frozen_string_literal: true
|
566
533
|
|
567
534
|
require 'blockchyp'
|
568
535
|
|
569
|
-
blockchyp = BlockChyp.new(
|
570
|
-
'
|
571
|
-
'
|
572
|
-
'
|
536
|
+
blockchyp = BlockChyp::BlockChyp.new(
|
537
|
+
ENV['BC_API_KEY'],
|
538
|
+
ENV['BC_BEARER_TOKEN'],
|
539
|
+
ENV['BC_SIGNING_KEY']
|
573
540
|
)
|
574
541
|
|
575
542
|
# setup request object
|
@@ -579,11 +546,7 @@ request['terminalName'] = 'Test Terminal'
|
|
579
546
|
|
580
547
|
response = blockchyp.enroll(request)
|
581
548
|
|
582
|
-
|
583
|
-
puts 'Approved'
|
584
|
-
end
|
585
|
-
|
586
|
-
puts 'token:' + response['token']
|
549
|
+
puts "Response: #{response.inspect}"
|
587
550
|
|
588
551
|
|
589
552
|
```
|
@@ -592,15 +555,16 @@ puts 'token:' + response['token']
|
|
592
555
|
|
593
556
|
Activates or recharges a gift card.
|
594
557
|
|
558
|
+
|
595
559
|
```ruby
|
596
560
|
# frozen_string_literal: true
|
597
561
|
|
598
562
|
require 'blockchyp'
|
599
563
|
|
600
|
-
blockchyp = BlockChyp.new(
|
601
|
-
'
|
602
|
-
'
|
603
|
-
'
|
564
|
+
blockchyp = BlockChyp::BlockChyp.new(
|
565
|
+
ENV['BC_API_KEY'],
|
566
|
+
ENV['BC_BEARER_TOKEN'],
|
567
|
+
ENV['BC_SIGNING_KEY']
|
604
568
|
)
|
605
569
|
|
606
570
|
# setup request object
|
@@ -611,13 +575,7 @@ request['amount'] = '50.00'
|
|
611
575
|
|
612
576
|
response = blockchyp.giftActivate(request)
|
613
577
|
|
614
|
-
|
615
|
-
puts 'Approved'
|
616
|
-
end
|
617
|
-
|
618
|
-
puts 'amount:' + response['amount']
|
619
|
-
puts 'currentBalance:' + response['currentBalance']
|
620
|
-
puts 'publicKey:' + response['publicKey']
|
578
|
+
puts "Response: #{response.inspect}"
|
621
579
|
|
622
580
|
|
623
581
|
```
|
@@ -634,15 +592,16 @@ transaction you're trying to reverse because we may not have assigned it an id
|
|
634
592
|
yet. And if we did assign it an id, you wouldn't know what it is because your
|
635
593
|
request to the terminal timed out before you got a response.
|
636
594
|
|
595
|
+
|
637
596
|
```ruby
|
638
597
|
# frozen_string_literal: true
|
639
598
|
|
640
599
|
require 'blockchyp'
|
641
600
|
|
642
|
-
blockchyp = BlockChyp.new(
|
643
|
-
'
|
644
|
-
'
|
645
|
-
'
|
601
|
+
blockchyp = BlockChyp::BlockChyp.new(
|
602
|
+
ENV['BC_API_KEY'],
|
603
|
+
ENV['BC_BEARER_TOKEN'],
|
604
|
+
ENV['BC_SIGNING_KEY']
|
646
605
|
)
|
647
606
|
|
648
607
|
# setup request object
|
@@ -652,10 +611,7 @@ request['transactionRef'] = '<LAST TRANSACTION REF>'
|
|
652
611
|
|
653
612
|
response = blockchyp.reverse(request)
|
654
613
|
|
655
|
-
|
656
|
-
puts 'Approved'
|
657
|
-
end
|
658
|
-
|
614
|
+
puts "Response: #{response.inspect}"
|
659
615
|
|
660
616
|
|
661
617
|
```
|
@@ -664,15 +620,16 @@ end
|
|
664
620
|
|
665
621
|
Captures a preauthorization.
|
666
622
|
|
623
|
+
|
667
624
|
```ruby
|
668
625
|
# frozen_string_literal: true
|
669
626
|
|
670
627
|
require 'blockchyp'
|
671
628
|
|
672
|
-
blockchyp = BlockChyp.new(
|
673
|
-
'
|
674
|
-
'
|
675
|
-
'
|
629
|
+
blockchyp = BlockChyp::BlockChyp.new(
|
630
|
+
ENV['BC_API_KEY'],
|
631
|
+
ENV['BC_BEARER_TOKEN'],
|
632
|
+
ENV['BC_SIGNING_KEY']
|
676
633
|
)
|
677
634
|
|
678
635
|
# setup request object
|
@@ -682,10 +639,7 @@ request['transactionId'] = '<PREAUTH TRANSACTION ID>'
|
|
682
639
|
|
683
640
|
response = blockchyp.capture(request)
|
684
641
|
|
685
|
-
|
686
|
-
puts 'Approved'
|
687
|
-
end
|
688
|
-
|
642
|
+
puts "Response: #{response.inspect}"
|
689
643
|
|
690
644
|
|
691
645
|
```
|
@@ -694,15 +648,16 @@ end
|
|
694
648
|
|
695
649
|
Closes the current credit card batch.
|
696
650
|
|
651
|
+
|
697
652
|
```ruby
|
698
653
|
# frozen_string_literal: true
|
699
654
|
|
700
655
|
require 'blockchyp'
|
701
656
|
|
702
|
-
blockchyp = BlockChyp.new(
|
703
|
-
'
|
704
|
-
'
|
705
|
-
'
|
657
|
+
blockchyp = BlockChyp::BlockChyp.new(
|
658
|
+
ENV['BC_API_KEY'],
|
659
|
+
ENV['BC_BEARER_TOKEN'],
|
660
|
+
ENV['BC_SIGNING_KEY']
|
706
661
|
)
|
707
662
|
|
708
663
|
# setup request object
|
@@ -711,12 +666,7 @@ request['test'] = true
|
|
711
666
|
|
712
667
|
response = blockchyp.closeBatch(request)
|
713
668
|
|
714
|
-
|
715
|
-
puts 'Success'
|
716
|
-
end
|
717
|
-
|
718
|
-
puts 'capturedTotal:' + response['capturedTotal']
|
719
|
-
puts 'openPreauths:' + response['openPreauths']
|
669
|
+
puts "Response: #{response.inspect}"
|
720
670
|
|
721
671
|
|
722
672
|
```
|
@@ -725,15 +675,16 @@ puts 'openPreauths:' + response['openPreauths']
|
|
725
675
|
|
726
676
|
Discards a previous preauth transaction.
|
727
677
|
|
678
|
+
|
728
679
|
```ruby
|
729
680
|
# frozen_string_literal: true
|
730
681
|
|
731
682
|
require 'blockchyp'
|
732
683
|
|
733
|
-
blockchyp = BlockChyp.new(
|
734
|
-
'
|
735
|
-
'
|
736
|
-
'
|
684
|
+
blockchyp = BlockChyp::BlockChyp.new(
|
685
|
+
ENV['BC_API_KEY'],
|
686
|
+
ENV['BC_BEARER_TOKEN'],
|
687
|
+
ENV['BC_SIGNING_KEY']
|
737
688
|
)
|
738
689
|
|
739
690
|
# setup request object
|
@@ -743,10 +694,34 @@ request['transactionId'] = '<PREVIOUS TRANSACTION ID>'
|
|
743
694
|
|
744
695
|
response = blockchyp.void(request)
|
745
696
|
|
746
|
-
|
747
|
-
|
748
|
-
|
697
|
+
puts "Response: #{response.inspect}"
|
698
|
+
|
699
|
+
|
700
|
+
```
|
701
|
+
|
702
|
+
#### Terminal Status
|
703
|
+
|
704
|
+
Returns the current status of a terminal.
|
705
|
+
|
706
|
+
|
707
|
+
```ruby
|
708
|
+
# frozen_string_literal: true
|
709
|
+
|
710
|
+
require 'blockchyp'
|
711
|
+
|
712
|
+
blockchyp = BlockChyp::BlockChyp.new(
|
713
|
+
ENV['BC_API_KEY'],
|
714
|
+
ENV['BC_BEARER_TOKEN'],
|
715
|
+
ENV['BC_SIGNING_KEY']
|
716
|
+
)
|
717
|
+
|
718
|
+
# setup request object
|
719
|
+
request = {}
|
720
|
+
request['terminalName'] = 'Test Terminal'
|
721
|
+
|
722
|
+
response = blockchyp.terminalStatus(request)
|
749
723
|
|
724
|
+
puts "Response: #{response.inspect}"
|
750
725
|
|
751
726
|
|
752
727
|
```
|