blockchyp 2.0.0.pre.alpha7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7a9aa280f6f893a65d19ac1cc81c1fbb2787138110a4cf422e696cf196153322
4
+ data.tar.gz: afa2bebafe119454a5ce2ec9b39bd15686c7c5ebb215add0186197dee1489968
5
+ SHA512:
6
+ metadata.gz: b3a3e83881142f842869e0bf48aeb3fe37cd2e0f4a183f56624b8ff256472b4491af6a28cc4f56eeb73501b6ec0db2948fef77b8956ca52bdc022bc05193f028
7
+ data.tar.gz: 51d975d45c58bbbeb722027e3bb3fa5b63e75e969ef30bf2551891da2f3605d2b6aa4526465b49b80de2d42b983f3afd313d308d6ff9f619fa8b85dbb730361f
@@ -0,0 +1,38 @@
1
+ # Version config
2
+ TAG := $(shell git tag --points-at HEAD | sort --version-sort | tail -n 1)
3
+ LASTTAG := $(or $(shell git tag -l | sort -r -V | head -n 1),0.1.0)
4
+ SNAPINFO := $(shell date +%Y%m%d%H%M%S)git$(shell git log -1 --pretty=%h)
5
+ RELEASE := $(or $(BUILD_NUMBER), 1)
6
+ VERSION := $(or $(TAG:v%=%),$(LASTTAG:v%=%))-$(or $(BUILD_NUMBER), 1)$(if $(TAG),,.$(SNAPINFO))
7
+
8
+ # Executables
9
+ SED = sed
10
+
11
+ # Default target
12
+ .PHONY: all
13
+ all: clean build test
14
+
15
+ # Clean build artifacts
16
+ .PHONY: clean
17
+ clean:
18
+
19
+ # Build compiles the package
20
+ .PHONY: build
21
+ build:
22
+
23
+ # Runs unit tests
24
+ .PHONY: test
25
+ test:
26
+
27
+ # Runs integration tests
28
+ .PHONY: integration
29
+ integration:
30
+
31
+ # Performs any tasks necessary before a release build
32
+ .PHONY: stage
33
+ stage:
34
+ $(SED) -i "s/VERSION = '.*'/VERSION = '$(shell sed 's/-/.pre./' <<<$(VERSION))'/" lib/blockchyp/version.rb
35
+
36
+ # Publish
37
+ .PHONY: publish
38
+ publish:
@@ -0,0 +1,807 @@
1
+ # BlockChyp Ruby SDK
2
+
3
+ [![Build Status](https://circleci.com/gh/blockchyp/blockchyp-ruby/tree/master.svg?style=shield)](https://circleci.com/gh/blockchyp/blockchyp-ruby/tree/master)
4
+ [![Gem](https://img.shields.io/gem/v/blockchyp)](https://rubygems.org/gems/blockchyp)
5
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/blockchyp/blockchyp-ruby/blob/master/LICENSE)
6
+
7
+ This is the SDK for Ruby. Like all BlockChyp SDKs, it provides a full client
8
+ for the BlockChyp gateway and BlockChyp payment terminals.
9
+
10
+ ## Installation
11
+
12
+ This SDK is best consumed as a Ruby Gem. Type the following command to install
13
+ the BlockChyp Gem in your project.
14
+
15
+ ```
16
+ gem install blockchyp
17
+ ```
18
+
19
+ ## A Simple Example
20
+
21
+ Running your first transaction is easy. Make sure you have a BlockChyp terminal,
22
+ activate it, and generate a set of API keys. The sample code below show how
23
+ to run a basic terminal transaction.
24
+
25
+ ```ruby
26
+ require 'blockchyp'
27
+
28
+ blockchyp = BlockChyp.new("SPBXTSDAQVFFX5MGQMUMIRINVI", "7BXBTBUPSL3BP7I6Z2CFU6H3WQ", "bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e")
29
+
30
+ # setup request object
31
+ request = Hash.new
32
+ request["test"] = true
33
+ request["terminalName"] = "Test Terminal"
34
+ request["amount"] = "55.00"
35
+
36
+ response = blockchyp.charge(request)
37
+
38
+ if (response["approved"])
39
+ puts "Approved"
40
+ puts "authCode:" + response["authCode"]
41
+ puts "authorizedAmount:" + response["authorizedAmount"]
42
+ end
43
+ ```
44
+
45
+
46
+
47
+ ## The Rest APIs
48
+
49
+ All BlockChyp SDKs provide a convenient way of accessing the BlockChyp REST APIs.
50
+ You can checkout the REST API documentation via the links below.
51
+
52
+ [Terminal REST API Docs](https://docs.blockchyp.com/rest-api/terminal/index.html)
53
+
54
+ [Gateway REST API Docs](https://docs.blockchyp.com/rest-api/gateway/index.html)
55
+
56
+ ## Other SDKs
57
+
58
+ BlockChyp has officially supported SDKs for eight different development platforms and counting.
59
+ Here's the full list with links to their GitHub repositories.
60
+
61
+ [Go SDK](https://github.com/blockchyp/blockchyp-go)
62
+
63
+ [Node.js/JavaScript SDK](https://github.com/blockchyp/blockchyp-js)
64
+
65
+ [Java SDK](https://github.com/blockchyp/blockchyp-java)
66
+
67
+ [.net/C# SDK](https://github.com/blockchyp/blockchyp-csharp)
68
+
69
+ [Ruby SDK](https://github.com/blockchyp/blockchyp-ruby)
70
+
71
+ [PHP SDK](https://github.com/blockchyp/blockchyp-php)
72
+
73
+ [Python SDK](https://github.com/blockchyp/blockchyp-python)
74
+
75
+ [iOS (Objective-C/Swift) SDK](https://github.com/blockchyp/blockchyp-ios)
76
+
77
+ ## Getting a Developer Kit
78
+
79
+ In order to test your integration with real terminals, you'll need a BlockChyp
80
+ Developer Kit. Our kits include a fully functioning payment terminal with
81
+ test pin encryption keys. Every kit includes a comprehensive set of test
82
+ cards with test cards for every major card brand and entry method, including
83
+ Contactless and Contact EMV and mag stripe cards. Each kit also includes
84
+ test gift cards for our blockchain gift card system.
85
+
86
+ Access to BlockChyp's developer program is currently invite only, but you
87
+ can request an invitation by contacting our engineering team at **nerds@blockchyp.com**.
88
+
89
+ You can also view a number of long form demos and learn more about us on our [YouTube Channel](https://www.youtube.com/channel/UCE-iIVlJic_XArs_U65ZcJg).
90
+
91
+ ## Transaction Code Examples
92
+
93
+ You don't want to read words. You want examples. Here's a quick rundown of the
94
+ stuff you can do with the BlockChyp Ruby SDK and a few basic examples.
95
+
96
+ #### Charge
97
+
98
+ Executes a standard direct preauth and capture.
99
+
100
+ ```ruby
101
+ # frozen_string_literal: true
102
+
103
+ require 'blockchyp'
104
+
105
+ blockchyp = BlockChyp.new(
106
+ 'SPBXTSDAQVFFX5MGQMUMIRINVI',
107
+ '7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
108
+ 'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
109
+ )
110
+
111
+ # setup request object
112
+ request = {}
113
+ request['test'] = true
114
+ request['terminalName'] = 'Test Terminal'
115
+ request['amount'] = '55.00'
116
+
117
+ response = blockchyp.charge(request)
118
+
119
+ if response['approved']
120
+ puts 'Approved'
121
+ end
122
+
123
+ puts 'authCode:' + response['authCode']
124
+ puts 'authorizedAmount:' + response['authorizedAmount']
125
+
126
+
127
+ ```
128
+
129
+ #### Preauthorization
130
+
131
+ Executes a preauthorization intended to be captured later.
132
+
133
+ ```ruby
134
+ # frozen_string_literal: true
135
+
136
+ require 'blockchyp'
137
+
138
+ blockchyp = BlockChyp.new(
139
+ 'SPBXTSDAQVFFX5MGQMUMIRINVI',
140
+ '7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
141
+ 'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
142
+ )
143
+
144
+ # setup request object
145
+ request = {}
146
+ request['test'] = true
147
+ request['terminalName'] = 'Test Terminal'
148
+ request['amount'] = '27.00'
149
+
150
+ response = blockchyp.preauth(request)
151
+
152
+ if response['approved']
153
+ puts 'Approved'
154
+ end
155
+
156
+ puts 'authCode:' + response['authCode']
157
+ puts 'authorizedAmount:' + response['authorizedAmount']
158
+
159
+
160
+ ```
161
+
162
+ #### Terminal Ping
163
+
164
+ Tests connectivity with a payment terminal.
165
+
166
+ ```ruby
167
+ # frozen_string_literal: true
168
+
169
+ require 'blockchyp'
170
+
171
+ blockchyp = BlockChyp.new(
172
+ 'SPBXTSDAQVFFX5MGQMUMIRINVI',
173
+ '7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
174
+ 'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
175
+ )
176
+
177
+ # setup request object
178
+ request = {}
179
+ request['terminalName'] = 'Test Terminal'
180
+
181
+ response = blockchyp.ping(request)
182
+
183
+ if response['success']
184
+ puts 'Success'
185
+ end
186
+
187
+
188
+
189
+ ```
190
+
191
+ #### Balance
192
+
193
+ Checks the remaining balance on a payment method.
194
+
195
+ ```ruby
196
+ # frozen_string_literal: true
197
+
198
+ require 'blockchyp'
199
+
200
+ blockchyp = BlockChyp.new(
201
+ 'SPBXTSDAQVFFX5MGQMUMIRINVI',
202
+ '7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
203
+ 'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
204
+ )
205
+
206
+ # setup request object
207
+ request = {}
208
+ request['test'] = true
209
+ request['terminalName'] = 'Test Terminal'
210
+ request['cardType'] = CardType::EBT
211
+
212
+ response = blockchyp.balance(request)
213
+
214
+ if response['success']
215
+ puts 'Success'
216
+ end
217
+
218
+
219
+
220
+ ```
221
+
222
+ #### Terminal Clear
223
+
224
+ Clears the line item display and any in progress transaction.
225
+
226
+ ```ruby
227
+ # frozen_string_literal: true
228
+
229
+ require 'blockchyp'
230
+
231
+ blockchyp = BlockChyp.new(
232
+ 'SPBXTSDAQVFFX5MGQMUMIRINVI',
233
+ '7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
234
+ 'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
235
+ )
236
+
237
+ # setup request object
238
+ request = {}
239
+ request['test'] = true
240
+ request['terminalName'] = 'Test Terminal'
241
+
242
+ response = blockchyp.clear(request)
243
+
244
+ if response['success']
245
+ puts 'Success'
246
+ end
247
+
248
+
249
+
250
+ ```
251
+
252
+ #### Terms & Conditions Capture
253
+
254
+ Prompts the user to accept terms and conditions.
255
+
256
+ ```ruby
257
+ # frozen_string_literal: true
258
+
259
+ require 'blockchyp'
260
+
261
+ blockchyp = BlockChyp.new(
262
+ 'SPBXTSDAQVFFX5MGQMUMIRINVI',
263
+ '7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
264
+ 'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
265
+ )
266
+
267
+ # setup request object
268
+ request = {}
269
+ request['test'] = true
270
+ request['terminalName'] = 'Test Terminal'
271
+ request['tcAlias'] = 'hippa'
272
+ request['tcName'] = 'HIPPA Disclosure'
273
+ request['tcContent'] = 'Full contract text'
274
+ request['sigFormat'] = SignatureFormat::PNG
275
+ request['sigWidth'] = 200
276
+ request['sigRequired'] = true
277
+
278
+ response = blockchyp.termsAndConditions(request)
279
+
280
+ if response['success']
281
+ puts 'Success'
282
+ end
283
+
284
+ puts 'sig:' + response['sig']
285
+ puts 'sigFile:' + response['sigFile']
286
+
287
+
288
+ ```
289
+
290
+ #### Update Transaction Display
291
+
292
+ Appends items to an existing transaction display Subtotal, Tax, and Total are
293
+ overwritten by the request. Items with the same description are combined into
294
+ groups.
295
+
296
+ ```ruby
297
+ # frozen_string_literal: true
298
+
299
+ require 'blockchyp'
300
+
301
+ blockchyp = BlockChyp.new(
302
+ 'SPBXTSDAQVFFX5MGQMUMIRINVI',
303
+ '7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
304
+ 'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
305
+ )
306
+
307
+ # setup request object
308
+ request = {}
309
+ request['test'] = true
310
+ request['terminalName'] = 'Test Terminal'
311
+ request['transaction'] = new_transaction_display_transaction
312
+
313
+ response = blockchyp.updateTransactionDisplay(request)
314
+
315
+ if response['success']
316
+ puts 'Succeded'
317
+ end
318
+
319
+ def new_transaction_display_transaction
320
+ val = {}
321
+ val['subtotal'] = '60.00'
322
+ val['tax'] = '5.00'
323
+ val['total'] = '65.00'
324
+ val['items'] = new_transaction_display_items
325
+ val
326
+ end
327
+
328
+ def new_transaction_display_items
329
+ val = []
330
+ val = val.push(new_transaction_display_item_2)
331
+ val
332
+ end
333
+
334
+ def new_transaction_display_item_2
335
+ val = {}
336
+ val['description'] = 'Leki Trekking Poles'
337
+ val['price'] = '35.00'
338
+ val['quantity'] = 2
339
+ val['extended'] = '70.00'
340
+ val['discounts'] = new_transaction_display_discounts
341
+ val
342
+ end
343
+
344
+ def new_transaction_display_discounts
345
+ val = []
346
+ val = val.push(new_transaction_display_discount_2)
347
+ val
348
+ end
349
+
350
+ def new_transaction_display_discount_2
351
+ val = {}
352
+ val['description'] = 'memberDiscount'
353
+ val['amount'] = '10.00'
354
+ val
355
+ end
356
+
357
+
358
+
359
+
360
+ ```
361
+
362
+ #### New Transaction Display
363
+
364
+ Displays a new transaction on the terminal.
365
+
366
+ ```ruby
367
+ # frozen_string_literal: true
368
+
369
+ require 'blockchyp'
370
+
371
+ blockchyp = BlockChyp.new(
372
+ 'SPBXTSDAQVFFX5MGQMUMIRINVI',
373
+ '7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
374
+ 'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
375
+ )
376
+
377
+ # setup request object
378
+ request = {}
379
+ request['test'] = true
380
+ request['terminalName'] = 'Test Terminal'
381
+ request['transaction'] = new_transaction_display_transaction
382
+
383
+ response = blockchyp.newTransactionDisplay(request)
384
+
385
+ if response['success']
386
+ puts 'Succeded'
387
+ end
388
+
389
+ def new_transaction_display_transaction
390
+ val = {}
391
+ val['subtotal'] = '60.00'
392
+ val['tax'] = '5.00'
393
+ val['total'] = '65.00'
394
+ val['items'] = new_transaction_display_items
395
+ val
396
+ end
397
+
398
+ def new_transaction_display_items
399
+ val = []
400
+ val = val.push(new_transaction_display_item_2)
401
+ val
402
+ end
403
+
404
+ def new_transaction_display_item_2
405
+ val = {}
406
+ val['description'] = 'Leki Trekking Poles'
407
+ val['price'] = '35.00'
408
+ val['quantity'] = 2
409
+ val['extended'] = '70.00'
410
+ val['discounts'] = new_transaction_display_discounts
411
+ val
412
+ end
413
+
414
+ def new_transaction_display_discounts
415
+ val = []
416
+ val = val.push(new_transaction_display_discount_2)
417
+ val
418
+ end
419
+
420
+ def new_transaction_display_discount_2
421
+ val = {}
422
+ val['description'] = 'memberDiscount'
423
+ val['amount'] = '10.00'
424
+ val
425
+ end
426
+
427
+
428
+
429
+
430
+ ```
431
+
432
+ #### Text Prompt
433
+
434
+ Asks the consumer text based question.
435
+
436
+ ```ruby
437
+ # frozen_string_literal: true
438
+
439
+ require 'blockchyp'
440
+
441
+ blockchyp = BlockChyp.new(
442
+ 'SPBXTSDAQVFFX5MGQMUMIRINVI',
443
+ '7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
444
+ 'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
445
+ )
446
+
447
+ # setup request object
448
+ request = {}
449
+ request['test'] = true
450
+ request['terminalName'] = 'Test Terminal'
451
+ request['promptType'] = PromptType::EMAIL
452
+
453
+ response = blockchyp.textPrompt(request)
454
+
455
+ if response['success']
456
+ puts 'Success'
457
+ end
458
+
459
+ puts 'response:' + response['response']
460
+
461
+
462
+ ```
463
+
464
+ #### Boolean Prompt
465
+
466
+ Asks the consumer a yes/no question.
467
+
468
+ ```ruby
469
+ # frozen_string_literal: true
470
+
471
+ require 'blockchyp'
472
+
473
+ blockchyp = BlockChyp.new(
474
+ 'SPBXTSDAQVFFX5MGQMUMIRINVI',
475
+ '7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
476
+ 'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
477
+ )
478
+
479
+ # setup request object
480
+ request = {}
481
+ request['test'] = true
482
+ request['terminalName'] = 'Test Terminal'
483
+ request['prompt'] = 'Would you like to become a member?'
484
+ request['yesCaption'] = 'Yes'
485
+ request['noCaption'] = 'No'
486
+
487
+ response = blockchyp.booleanPrompt(request)
488
+
489
+ if response['success']
490
+ puts 'Success'
491
+ end
492
+
493
+ puts 'response:' + response['response']
494
+
495
+
496
+ ```
497
+
498
+ #### Display Message
499
+
500
+ Displays a short message on the terminal.
501
+
502
+ ```ruby
503
+ # frozen_string_literal: true
504
+
505
+ require 'blockchyp'
506
+
507
+ blockchyp = BlockChyp.new(
508
+ 'SPBXTSDAQVFFX5MGQMUMIRINVI',
509
+ '7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
510
+ 'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
511
+ )
512
+
513
+ # setup request object
514
+ request = {}
515
+ request['test'] = true
516
+ request['terminalName'] = 'Test Terminal'
517
+ request['message'] = 'Thank you for your business.'
518
+
519
+ response = blockchyp.message(request)
520
+
521
+ if response['success']
522
+ puts 'Success'
523
+ end
524
+
525
+
526
+
527
+ ```
528
+
529
+ #### Refund
530
+
531
+ Executes a refund.
532
+
533
+ ```ruby
534
+ # frozen_string_literal: true
535
+
536
+ require 'blockchyp'
537
+
538
+ blockchyp = BlockChyp.new(
539
+ 'SPBXTSDAQVFFX5MGQMUMIRINVI',
540
+ '7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
541
+ 'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
542
+ )
543
+
544
+ # setup request object
545
+ request = {}
546
+ request['terminalName'] = 'Test Terminal'
547
+ request['transactionId'] = '<PREVIOUS TRANSACTION ID>'
548
+ request['amount'] = '5.00'
549
+
550
+ response = blockchyp.refund(request)
551
+
552
+ if response['approved']
553
+ puts 'Approved'
554
+ end
555
+
556
+
557
+
558
+ ```
559
+
560
+ #### Enroll
561
+
562
+ Adds a new payment method to the token vault.
563
+
564
+ ```ruby
565
+ # frozen_string_literal: true
566
+
567
+ require 'blockchyp'
568
+
569
+ blockchyp = BlockChyp.new(
570
+ 'SPBXTSDAQVFFX5MGQMUMIRINVI',
571
+ '7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
572
+ 'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
573
+ )
574
+
575
+ # setup request object
576
+ request = {}
577
+ request['test'] = true
578
+ request['terminalName'] = 'Test Terminal'
579
+
580
+ response = blockchyp.enroll(request)
581
+
582
+ if response['approved']
583
+ puts 'Approved'
584
+ end
585
+
586
+ puts 'token:' + response['token']
587
+
588
+
589
+ ```
590
+
591
+ #### Gift Card Activation
592
+
593
+ Activates or recharges a gift card.
594
+
595
+ ```ruby
596
+ # frozen_string_literal: true
597
+
598
+ require 'blockchyp'
599
+
600
+ blockchyp = BlockChyp.new(
601
+ 'SPBXTSDAQVFFX5MGQMUMIRINVI',
602
+ '7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
603
+ 'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
604
+ )
605
+
606
+ # setup request object
607
+ request = {}
608
+ request['test'] = true
609
+ request['terminalName'] = 'Test Terminal'
610
+ request['amount'] = '50.00'
611
+
612
+ response = blockchyp.giftActivate(request)
613
+
614
+ if response['approved']
615
+ puts 'Approved'
616
+ end
617
+
618
+ puts 'amount:' + response['amount']
619
+ puts 'currentBalance:' + response['currentBalance']
620
+ puts 'publicKey:' + response['publicKey']
621
+
622
+
623
+ ```
624
+
625
+ #### Time Out Reversal
626
+
627
+ Executes a manual time out reversal.
628
+
629
+ We love time out reversals. Don't be afraid to use them whenever a request to a
630
+ BlockChyp terminal times out. You have up to two minutes to reverse any
631
+ transaction. The only caveat is that you must assign transactionRef values when
632
+ you build the original request. Otherwise, we have no real way of knowing which
633
+ transaction you're trying to reverse because we may not have assigned it an id
634
+ yet. And if we did assign it an id, you wouldn't know what it is because your
635
+ request to the terminal timed out before you got a response.
636
+
637
+ ```ruby
638
+ # frozen_string_literal: true
639
+
640
+ require 'blockchyp'
641
+
642
+ blockchyp = BlockChyp.new(
643
+ 'SPBXTSDAQVFFX5MGQMUMIRINVI',
644
+ '7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
645
+ 'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
646
+ )
647
+
648
+ # setup request object
649
+ request = {}
650
+ request['terminalName'] = 'Test Terminal'
651
+ request['transactionRef'] = '<LAST TRANSACTION REF>'
652
+
653
+ response = blockchyp.reverse(request)
654
+
655
+ if response['approved']
656
+ puts 'Approved'
657
+ end
658
+
659
+
660
+
661
+ ```
662
+
663
+ #### Capture Preauthorization
664
+
665
+ Captures a preauthorization.
666
+
667
+ ```ruby
668
+ # frozen_string_literal: true
669
+
670
+ require 'blockchyp'
671
+
672
+ blockchyp = BlockChyp.new(
673
+ 'SPBXTSDAQVFFX5MGQMUMIRINVI',
674
+ '7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
675
+ 'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
676
+ )
677
+
678
+ # setup request object
679
+ request = {}
680
+ request['test'] = true
681
+ request['transactionId'] = '<PREAUTH TRANSACTION ID>'
682
+
683
+ response = blockchyp.capture(request)
684
+
685
+ if response['approved']
686
+ puts 'Approved'
687
+ end
688
+
689
+
690
+
691
+ ```
692
+
693
+ #### Close Batch
694
+
695
+ Closes the current credit card batch.
696
+
697
+ ```ruby
698
+ # frozen_string_literal: true
699
+
700
+ require 'blockchyp'
701
+
702
+ blockchyp = BlockChyp.new(
703
+ 'SPBXTSDAQVFFX5MGQMUMIRINVI',
704
+ '7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
705
+ 'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
706
+ )
707
+
708
+ # setup request object
709
+ request = {}
710
+ request['test'] = true
711
+
712
+ response = blockchyp.closeBatch(request)
713
+
714
+ if response['success']
715
+ puts 'Success'
716
+ end
717
+
718
+ puts 'capturedTotal:' + response['capturedTotal']
719
+ puts 'openPreauths:' + response['openPreauths']
720
+
721
+
722
+ ```
723
+
724
+ #### Void Transaction
725
+
726
+ Discards a previous preauth transaction.
727
+
728
+ ```ruby
729
+ # frozen_string_literal: true
730
+
731
+ require 'blockchyp'
732
+
733
+ blockchyp = BlockChyp.new(
734
+ 'SPBXTSDAQVFFX5MGQMUMIRINVI',
735
+ '7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
736
+ 'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
737
+ )
738
+
739
+ # setup request object
740
+ request = {}
741
+ request['test'] = true
742
+ request['transactionId'] = '<PREVIOUS TRANSACTION ID>'
743
+
744
+ response = blockchyp.void(request)
745
+
746
+ if response['approved']
747
+ puts 'Approved'
748
+ end
749
+
750
+
751
+
752
+ ```
753
+
754
+ ## Running Integration Tests
755
+
756
+ If you'd like to run the integration tests, create a new file on your system
757
+ called `sdk-itest-config.json` with the API credentials you'll be using as
758
+ shown in the example below.
759
+
760
+ ```
761
+ {
762
+ "gatewayHost": "https://api.blockchyp.com",
763
+ "testGatewayHost": "https://test.blockchyp.com",
764
+ "apiKey": "PZZNEFK7HFULCB3HTLA7HRQDJU",
765
+ "bearerToken": "QUJCHIKNXOMSPGQ4QLT2UJX5DI",
766
+ "signingKey": "f88a72d8bc0965f193abc7006bbffa240663c10e4d1dc3ba2f81e0ca10d359f5"
767
+ }
768
+ ```
769
+
770
+ This file can be located in a few different places, but is usually located
771
+ at `<USER_HOME>/.config/blockchyp/sdk-itest-config.json`. All BlockChyp SDKs
772
+ use the same configuration file.
773
+
774
+ To run the integration test suite via `make`, type the following command:
775
+
776
+ `make integration`
777
+
778
+
779
+ ## Running Integration Tests Via Rake or Ruby
780
+
781
+ If you'd like to bypass make and run the integration test suite directly,
782
+ you can run the entire test suite with Rake using the following command:
783
+
784
+ `BC_TEST_DELAY=5 rake test`
785
+
786
+ You can run individual tests by adding executing them as normal Ruby files.
787
+
788
+ `ruby test/terminal_charge_test.rb`
789
+
790
+
791
+
792
+
793
+
794
+ ## Contributions
795
+
796
+ BlockChyp welcomes contributions from the open source community, but bear in mind
797
+ that this repository has been generated by our internal SDK Generator tool. If
798
+ we choose to accept a PR or contribution, your code will be moved into our SDK
799
+ Generator project, which is a private repository.
800
+
801
+ ## License
802
+
803
+ Copyright BlockChyp, Inc., 2019
804
+
805
+ Distributed under the terms of the [MIT] license, blockchyp-ruby is free and open source software.
806
+
807
+ [MIT]: https://github.com/blockchyp/blockchyp-ruby/blob/master/LICENSE