blockchyp 2.1.1 → 2.2.4
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 +356 -178
- data/lib/blockchyp.rb +25 -0
- data/lib/blockchyp/version.rb +1 -1
- data/test/boolean_prompt_test.rb +8 -8
- data/test/capture_signature_test.rb +6 -6
- data/test/gateway_timeout_test.rb +8 -8
- data/test/get_customer_test.rb +51 -0
- data/test/new_transaction_display_test.rb +24 -44
- data/test/pan_charge_test.rb +7 -7
- data/test/pan_enroll_test.rb +5 -5
- data/test/pan_preauth_test.rb +6 -6
- data/test/search_customer_test.rb +51 -0
- data/test/send_payment_link_test.rb +62 -0
- data/test/simple_batch_close_test.rb +13 -11
- data/test/simple_capture_test.rb +13 -11
- data/test/simple_gift_activate_test.rb +6 -6
- data/test/simple_message_test.rb +6 -6
- data/test/simple_ping_test.rb +5 -5
- data/test/simple_refund_test.rb +14 -12
- data/test/simple_reversal_test.rb +14 -12
- data/test/simple_void_test.rb +14 -12
- data/test/terminal_charge_test.rb +6 -6
- data/test/terminal_clear_test.rb +5 -5
- data/test/terminal_ebt_balance_test.rb +6 -6
- data/test/terminal_ebt_charge_test.rb +7 -7
- data/test/terminal_enroll_test.rb +5 -5
- data/test/terminal_gift_card_balance_test.rb +5 -5
- data/test/terminal_keyed_charge_test.rb +7 -7
- data/test/terminal_manual_ebt_charge_test.rb +8 -8
- data/test/terminal_preauth_test.rb +6 -6
- data/test/terminal_status_test.rb +4 -4
- data/test/terminal_timeout_test.rb +7 -7
- data/test/terms_and_conditions_test.rb +10 -10
- data/test/text_prompt_test.rb +6 -6
- data/test/update_customer_test.rb +44 -0
- data/test/update_transaction_display_test.rb +24 -44
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4569f1fe2455fe98d3e09d7ed59c9d91f81bc366bcfc7b64dfbbaf1026443670
|
4
|
+
data.tar.gz: 6ce270e6356101d6afee6b72462e6c6580dc59e1203e74b288ef0d5db2cb5e2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24fd0fc590987fa3e552ac0ad9ad6574a01c06c9db34007f9db5432deb7db0ca5b83fbf7c5ebc99b46261eae269a15e379de4bd2e43c061a3465b1d98680ec40
|
7
|
+
data.tar.gz: f1df347d1baf97a3275971d0141464dbb980310cfd18ad03196813515fcb2ebc2074b3c9e336804c559b097de111ae01935e850725c9dd6f45da66e8654aa5a1
|
data/README.md
CHANGED
@@ -25,13 +25,18 @@ to run a basic terminal transaction.
|
|
25
25
|
```ruby
|
26
26
|
require 'blockchyp'
|
27
27
|
|
28
|
-
blockchyp = BlockChyp.new(
|
28
|
+
blockchyp = BlockChyp.new(
|
29
|
+
"SPBXTSDAQVFFX5MGQMUMIRINVI",
|
30
|
+
"7BXBTBUPSL3BP7I6Z2CFU6H3WQ",
|
31
|
+
"bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e"
|
32
|
+
)
|
29
33
|
|
30
|
-
#
|
31
|
-
request =
|
32
|
-
|
33
|
-
|
34
|
-
|
34
|
+
# Set request parameters
|
35
|
+
request = {
|
36
|
+
"test": true,
|
37
|
+
"terminalName": "Test Terminal",
|
38
|
+
"amount": "55.00"
|
39
|
+
}
|
35
40
|
|
36
41
|
response = blockchyp.charge(request)
|
37
42
|
|
@@ -109,11 +114,12 @@ blockchyp = BlockChyp::BlockChyp.new(
|
|
109
114
|
ENV['BC_SIGNING_KEY']
|
110
115
|
)
|
111
116
|
|
112
|
-
#
|
113
|
-
request = {
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
+
# Set request parameters
|
118
|
+
request = {
|
119
|
+
"test": true,
|
120
|
+
"terminalName": 'Test Terminal',
|
121
|
+
"amount": '55.00'
|
122
|
+
}
|
117
123
|
|
118
124
|
response = blockchyp.charge(request)
|
119
125
|
|
@@ -138,11 +144,12 @@ blockchyp = BlockChyp::BlockChyp.new(
|
|
138
144
|
ENV['BC_SIGNING_KEY']
|
139
145
|
)
|
140
146
|
|
141
|
-
#
|
142
|
-
request = {
|
143
|
-
|
144
|
-
|
145
|
-
|
147
|
+
# Set request parameters
|
148
|
+
request = {
|
149
|
+
"test": true,
|
150
|
+
"terminalName": 'Test Terminal',
|
151
|
+
"amount": '27.00'
|
152
|
+
}
|
146
153
|
|
147
154
|
response = blockchyp.preauth(request)
|
148
155
|
|
@@ -167,9 +174,10 @@ blockchyp = BlockChyp::BlockChyp.new(
|
|
167
174
|
ENV['BC_SIGNING_KEY']
|
168
175
|
)
|
169
176
|
|
170
|
-
#
|
171
|
-
request = {
|
172
|
-
|
177
|
+
# Set request parameters
|
178
|
+
request = {
|
179
|
+
"terminalName": 'Test Terminal'
|
180
|
+
}
|
173
181
|
|
174
182
|
response = blockchyp.ping(request)
|
175
183
|
|
@@ -194,11 +202,12 @@ blockchyp = BlockChyp::BlockChyp.new(
|
|
194
202
|
ENV['BC_SIGNING_KEY']
|
195
203
|
)
|
196
204
|
|
197
|
-
#
|
198
|
-
request = {
|
199
|
-
|
200
|
-
|
201
|
-
|
205
|
+
# Set request parameters
|
206
|
+
request = {
|
207
|
+
"test": true,
|
208
|
+
"terminalName": 'Test Terminal',
|
209
|
+
"cardType": CardType::EBT
|
210
|
+
}
|
202
211
|
|
203
212
|
response = blockchyp.balance(request)
|
204
213
|
|
@@ -223,10 +232,11 @@ blockchyp = BlockChyp::BlockChyp.new(
|
|
223
232
|
ENV['BC_SIGNING_KEY']
|
224
233
|
)
|
225
234
|
|
226
|
-
#
|
227
|
-
request = {
|
228
|
-
|
229
|
-
|
235
|
+
# Set request parameters
|
236
|
+
request = {
|
237
|
+
"test": true,
|
238
|
+
"terminalName": 'Test Terminal'
|
239
|
+
}
|
230
240
|
|
231
241
|
response = blockchyp.clear(request)
|
232
242
|
|
@@ -251,16 +261,30 @@ blockchyp = BlockChyp::BlockChyp.new(
|
|
251
261
|
ENV['BC_SIGNING_KEY']
|
252
262
|
)
|
253
263
|
|
254
|
-
#
|
255
|
-
request = {
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
+
# Set request parameters
|
265
|
+
request = {
|
266
|
+
"test": true,
|
267
|
+
"terminalName": 'Test Terminal',
|
268
|
+
|
269
|
+
# Alias for a Terms and Conditions template configured in the BlockChyp
|
270
|
+
# dashboard.
|
271
|
+
"tcAlias": 'hippa',
|
272
|
+
|
273
|
+
# Name of the contract or document if not using an alias.
|
274
|
+
"tcName": 'HIPPA Disclosure',
|
275
|
+
|
276
|
+
# Full text of the contract or disclosure if not using an alias.
|
277
|
+
"tcContent": 'Full contract text',
|
278
|
+
|
279
|
+
# File format for the signature image.
|
280
|
+
"sigFormat": SignatureFormat::PNG,
|
281
|
+
|
282
|
+
# Width of the signature image in pixels.
|
283
|
+
"sigWidth": 200,
|
284
|
+
|
285
|
+
# Whether or not a signature is required. Defaults to true.
|
286
|
+
"sigRequired": true
|
287
|
+
}
|
264
288
|
|
265
289
|
response = blockchyp.termsAndConditions(request)
|
266
290
|
|
@@ -287,53 +311,34 @@ blockchyp = BlockChyp::BlockChyp.new(
|
|
287
311
|
ENV['BC_SIGNING_KEY']
|
288
312
|
)
|
289
313
|
|
290
|
-
#
|
291
|
-
request = {
|
292
|
-
|
293
|
-
|
294
|
-
|
314
|
+
# Set request parameters
|
315
|
+
request = {
|
316
|
+
"test": true,
|
317
|
+
"terminalName": 'Test Terminal',
|
318
|
+
"transaction": {
|
319
|
+
"subtotal": '60.00',
|
320
|
+
"tax": '5.00',
|
321
|
+
"total": '65.00',
|
322
|
+
"items": [
|
323
|
+
{
|
324
|
+
"description": 'Leki Trekking Poles',
|
325
|
+
"price": '35.00',
|
326
|
+
"quantity": 2,
|
327
|
+
"extended": '70.00',
|
328
|
+
"discounts": [
|
329
|
+
{
|
330
|
+
"description": 'memberDiscount',
|
331
|
+
"amount": '10.00'
|
332
|
+
}
|
333
|
+
]
|
334
|
+
}
|
335
|
+
]
|
336
|
+
}
|
337
|
+
}
|
295
338
|
|
296
339
|
response = blockchyp.updateTransactionDisplay(request)
|
297
340
|
|
298
341
|
puts "Response: #{response.inspect}"
|
299
|
-
def new_transaction_display_transaction
|
300
|
-
val = {}
|
301
|
-
val['subtotal'] = '60.00'
|
302
|
-
val['tax'] = '5.00'
|
303
|
-
val['total'] = '65.00'
|
304
|
-
val['items'] = new_transaction_display_items
|
305
|
-
val
|
306
|
-
end
|
307
|
-
|
308
|
-
def new_transaction_display_items
|
309
|
-
val = []
|
310
|
-
val = val.push(new_transaction_display_item_2)
|
311
|
-
val
|
312
|
-
end
|
313
|
-
|
314
|
-
def new_transaction_display_item_2
|
315
|
-
val = {}
|
316
|
-
val['description'] = 'Leki Trekking Poles'
|
317
|
-
val['price'] = '35.00'
|
318
|
-
val['quantity'] = 2
|
319
|
-
val['extended'] = '70.00'
|
320
|
-
val['discounts'] = new_transaction_display_discounts
|
321
|
-
val
|
322
|
-
end
|
323
|
-
|
324
|
-
def new_transaction_display_discounts
|
325
|
-
val = []
|
326
|
-
val = val.push(new_transaction_display_discount_2)
|
327
|
-
val
|
328
|
-
end
|
329
|
-
|
330
|
-
def new_transaction_display_discount_2
|
331
|
-
val = {}
|
332
|
-
val['description'] = 'memberDiscount'
|
333
|
-
val['amount'] = '10.00'
|
334
|
-
val
|
335
|
-
end
|
336
|
-
|
337
342
|
|
338
343
|
|
339
344
|
```
|
@@ -354,53 +359,34 @@ blockchyp = BlockChyp::BlockChyp.new(
|
|
354
359
|
ENV['BC_SIGNING_KEY']
|
355
360
|
)
|
356
361
|
|
357
|
-
#
|
358
|
-
request = {
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
+
# Set request parameters
|
363
|
+
request = {
|
364
|
+
"test": true,
|
365
|
+
"terminalName": 'Test Terminal',
|
366
|
+
"transaction": {
|
367
|
+
"subtotal": '60.00',
|
368
|
+
"tax": '5.00',
|
369
|
+
"total": '65.00',
|
370
|
+
"items": [
|
371
|
+
{
|
372
|
+
"description": 'Leki Trekking Poles',
|
373
|
+
"price": '35.00',
|
374
|
+
"quantity": 2,
|
375
|
+
"extended": '70.00',
|
376
|
+
"discounts": [
|
377
|
+
{
|
378
|
+
"description": 'memberDiscount',
|
379
|
+
"amount": '10.00'
|
380
|
+
}
|
381
|
+
]
|
382
|
+
}
|
383
|
+
]
|
384
|
+
}
|
385
|
+
}
|
362
386
|
|
363
387
|
response = blockchyp.newTransactionDisplay(request)
|
364
388
|
|
365
389
|
puts "Response: #{response.inspect}"
|
366
|
-
def new_transaction_display_transaction
|
367
|
-
val = {}
|
368
|
-
val['subtotal'] = '60.00'
|
369
|
-
val['tax'] = '5.00'
|
370
|
-
val['total'] = '65.00'
|
371
|
-
val['items'] = new_transaction_display_items
|
372
|
-
val
|
373
|
-
end
|
374
|
-
|
375
|
-
def new_transaction_display_items
|
376
|
-
val = []
|
377
|
-
val = val.push(new_transaction_display_item_2)
|
378
|
-
val
|
379
|
-
end
|
380
|
-
|
381
|
-
def new_transaction_display_item_2
|
382
|
-
val = {}
|
383
|
-
val['description'] = 'Leki Trekking Poles'
|
384
|
-
val['price'] = '35.00'
|
385
|
-
val['quantity'] = 2
|
386
|
-
val['extended'] = '70.00'
|
387
|
-
val['discounts'] = new_transaction_display_discounts
|
388
|
-
val
|
389
|
-
end
|
390
|
-
|
391
|
-
def new_transaction_display_discounts
|
392
|
-
val = []
|
393
|
-
val = val.push(new_transaction_display_discount_2)
|
394
|
-
val
|
395
|
-
end
|
396
|
-
|
397
|
-
def new_transaction_display_discount_2
|
398
|
-
val = {}
|
399
|
-
val['description'] = 'memberDiscount'
|
400
|
-
val['amount'] = '10.00'
|
401
|
-
val
|
402
|
-
end
|
403
|
-
|
404
390
|
|
405
391
|
|
406
392
|
```
|
@@ -421,11 +407,15 @@ blockchyp = BlockChyp::BlockChyp.new(
|
|
421
407
|
ENV['BC_SIGNING_KEY']
|
422
408
|
)
|
423
409
|
|
424
|
-
#
|
425
|
-
request = {
|
426
|
-
|
427
|
-
|
428
|
-
|
410
|
+
# Set request parameters
|
411
|
+
request = {
|
412
|
+
"test": true,
|
413
|
+
"terminalName": 'Test Terminal',
|
414
|
+
|
415
|
+
# Type of prompt. Can be 'email', 'phone', 'customer-number', or
|
416
|
+
# 'rewards-number'.
|
417
|
+
"promptType": PromptType::EMAIL
|
418
|
+
}
|
429
419
|
|
430
420
|
response = blockchyp.textPrompt(request)
|
431
421
|
|
@@ -450,13 +440,14 @@ blockchyp = BlockChyp::BlockChyp.new(
|
|
450
440
|
ENV['BC_SIGNING_KEY']
|
451
441
|
)
|
452
442
|
|
453
|
-
#
|
454
|
-
request = {
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
443
|
+
# Set request parameters
|
444
|
+
request = {
|
445
|
+
"test": true,
|
446
|
+
"terminalName": 'Test Terminal',
|
447
|
+
"prompt": 'Would you like to become a member?',
|
448
|
+
"yesCaption": 'Yes',
|
449
|
+
"noCaption": 'No'
|
450
|
+
}
|
460
451
|
|
461
452
|
response = blockchyp.booleanPrompt(request)
|
462
453
|
|
@@ -481,11 +472,12 @@ blockchyp = BlockChyp::BlockChyp.new(
|
|
481
472
|
ENV['BC_SIGNING_KEY']
|
482
473
|
)
|
483
474
|
|
484
|
-
#
|
485
|
-
request = {
|
486
|
-
|
487
|
-
|
488
|
-
|
475
|
+
# Set request parameters
|
476
|
+
request = {
|
477
|
+
"test": true,
|
478
|
+
"terminalName": 'Test Terminal',
|
479
|
+
"message": 'Thank you for your business.'
|
480
|
+
}
|
489
481
|
|
490
482
|
response = blockchyp.message(request)
|
491
483
|
|
@@ -510,11 +502,14 @@ blockchyp = BlockChyp::BlockChyp.new(
|
|
510
502
|
ENV['BC_SIGNING_KEY']
|
511
503
|
)
|
512
504
|
|
513
|
-
#
|
514
|
-
request = {
|
515
|
-
|
516
|
-
|
517
|
-
|
505
|
+
# Set request parameters
|
506
|
+
request = {
|
507
|
+
"terminalName": 'Test Terminal',
|
508
|
+
"transactionId": '<PREVIOUS TRANSACTION ID>',
|
509
|
+
|
510
|
+
# Optional amount for partial refunds.
|
511
|
+
"amount": '5.00'
|
512
|
+
}
|
518
513
|
|
519
514
|
response = blockchyp.refund(request)
|
520
515
|
|
@@ -539,10 +534,11 @@ blockchyp = BlockChyp::BlockChyp.new(
|
|
539
534
|
ENV['BC_SIGNING_KEY']
|
540
535
|
)
|
541
536
|
|
542
|
-
#
|
543
|
-
request = {
|
544
|
-
|
545
|
-
|
537
|
+
# Set request parameters
|
538
|
+
request = {
|
539
|
+
"test": true,
|
540
|
+
"terminalName": 'Test Terminal'
|
541
|
+
}
|
546
542
|
|
547
543
|
response = blockchyp.enroll(request)
|
548
544
|
|
@@ -567,11 +563,12 @@ blockchyp = BlockChyp::BlockChyp.new(
|
|
567
563
|
ENV['BC_SIGNING_KEY']
|
568
564
|
)
|
569
565
|
|
570
|
-
#
|
571
|
-
request = {
|
572
|
-
|
573
|
-
|
574
|
-
|
566
|
+
# Set request parameters
|
567
|
+
request = {
|
568
|
+
"test": true,
|
569
|
+
"terminalName": 'Test Terminal',
|
570
|
+
"amount": '50.00'
|
571
|
+
}
|
575
572
|
|
576
573
|
response = blockchyp.giftActivate(request)
|
577
574
|
|
@@ -604,10 +601,11 @@ blockchyp = BlockChyp::BlockChyp.new(
|
|
604
601
|
ENV['BC_SIGNING_KEY']
|
605
602
|
)
|
606
603
|
|
607
|
-
#
|
608
|
-
request = {
|
609
|
-
|
610
|
-
|
604
|
+
# Set request parameters
|
605
|
+
request = {
|
606
|
+
"terminalName": 'Test Terminal',
|
607
|
+
"transactionRef": '<LAST TRANSACTION REF>'
|
608
|
+
}
|
611
609
|
|
612
610
|
response = blockchyp.reverse(request)
|
613
611
|
|
@@ -632,10 +630,11 @@ blockchyp = BlockChyp::BlockChyp.new(
|
|
632
630
|
ENV['BC_SIGNING_KEY']
|
633
631
|
)
|
634
632
|
|
635
|
-
#
|
636
|
-
request = {
|
637
|
-
|
638
|
-
|
633
|
+
# Set request parameters
|
634
|
+
request = {
|
635
|
+
"test": true,
|
636
|
+
"transactionId": '<PREAUTH TRANSACTION ID>'
|
637
|
+
}
|
639
638
|
|
640
639
|
response = blockchyp.capture(request)
|
641
640
|
|
@@ -660,9 +659,10 @@ blockchyp = BlockChyp::BlockChyp.new(
|
|
660
659
|
ENV['BC_SIGNING_KEY']
|
661
660
|
)
|
662
661
|
|
663
|
-
#
|
664
|
-
request = {
|
665
|
-
|
662
|
+
# Set request parameters
|
663
|
+
request = {
|
664
|
+
"test": true
|
665
|
+
}
|
666
666
|
|
667
667
|
response = blockchyp.closeBatch(request)
|
668
668
|
|
@@ -687,10 +687,11 @@ blockchyp = BlockChyp::BlockChyp.new(
|
|
687
687
|
ENV['BC_SIGNING_KEY']
|
688
688
|
)
|
689
689
|
|
690
|
-
#
|
691
|
-
request = {
|
692
|
-
|
693
|
-
|
690
|
+
# Set request parameters
|
691
|
+
request = {
|
692
|
+
"test": true,
|
693
|
+
"transactionId": '<PREVIOUS TRANSACTION ID>'
|
694
|
+
}
|
694
695
|
|
695
696
|
response = blockchyp.void(request)
|
696
697
|
|
@@ -715,9 +716,10 @@ blockchyp = BlockChyp::BlockChyp.new(
|
|
715
716
|
ENV['BC_SIGNING_KEY']
|
716
717
|
)
|
717
718
|
|
718
|
-
#
|
719
|
-
request = {
|
720
|
-
|
719
|
+
# Set request parameters
|
720
|
+
request = {
|
721
|
+
"terminalName": 'Test Terminal'
|
722
|
+
}
|
721
723
|
|
722
724
|
response = blockchyp.terminalStatus(request)
|
723
725
|
|
@@ -742,17 +744,193 @@ blockchyp = BlockChyp::BlockChyp.new(
|
|
742
744
|
ENV['BC_SIGNING_KEY']
|
743
745
|
)
|
744
746
|
|
745
|
-
#
|
746
|
-
request = {
|
747
|
-
|
748
|
-
|
749
|
-
|
747
|
+
# Set request parameters
|
748
|
+
request = {
|
749
|
+
"terminalName": 'Test Terminal',
|
750
|
+
|
751
|
+
# File format for the signature image.
|
752
|
+
"sigFormat": SignatureFormat::PNG,
|
753
|
+
|
754
|
+
# Width of the signature image in pixels.
|
755
|
+
"sigWidth": 200
|
756
|
+
}
|
750
757
|
|
751
758
|
response = blockchyp.captureSignature(request)
|
752
759
|
|
753
760
|
puts "Response: #{response.inspect}"
|
754
761
|
|
755
762
|
|
763
|
+
```
|
764
|
+
|
765
|
+
#### Update Customer
|
766
|
+
|
767
|
+
Updates or creates a customer record.
|
768
|
+
|
769
|
+
|
770
|
+
```ruby
|
771
|
+
# frozen_string_literal: true
|
772
|
+
|
773
|
+
require 'blockchyp'
|
774
|
+
|
775
|
+
blockchyp = BlockChyp::BlockChyp.new(
|
776
|
+
ENV['BC_API_KEY'],
|
777
|
+
ENV['BC_BEARER_TOKEN'],
|
778
|
+
ENV['BC_SIGNING_KEY']
|
779
|
+
)
|
780
|
+
|
781
|
+
# Set request parameters
|
782
|
+
request = {
|
783
|
+
"customer": {
|
784
|
+
"id": 'ID of the customer to update',
|
785
|
+
"customerRef": 'Customer reference string',
|
786
|
+
"firstName": 'FirstName',
|
787
|
+
"lastName": 'LastName',
|
788
|
+
"companyName": 'Company Name',
|
789
|
+
"emailAddress": 'support@blockchyp.com',
|
790
|
+
"smsNumber": '(123) 123-1231'
|
791
|
+
}
|
792
|
+
}
|
793
|
+
|
794
|
+
response = blockchyp.updateCustomer(request)
|
795
|
+
|
796
|
+
puts "Response: #{response.inspect}"
|
797
|
+
|
798
|
+
|
799
|
+
```
|
800
|
+
|
801
|
+
#### Retrieve Customer
|
802
|
+
|
803
|
+
Retrieves a customer by id.
|
804
|
+
|
805
|
+
|
806
|
+
```ruby
|
807
|
+
# frozen_string_literal: true
|
808
|
+
|
809
|
+
require 'blockchyp'
|
810
|
+
|
811
|
+
blockchyp = BlockChyp::BlockChyp.new(
|
812
|
+
ENV['BC_API_KEY'],
|
813
|
+
ENV['BC_BEARER_TOKEN'],
|
814
|
+
ENV['BC_SIGNING_KEY']
|
815
|
+
)
|
816
|
+
|
817
|
+
# Set request parameters
|
818
|
+
request = {
|
819
|
+
"customerId": 'ID of the customer to retrieve'
|
820
|
+
}
|
821
|
+
|
822
|
+
response = blockchyp.customer(request)
|
823
|
+
|
824
|
+
puts "Response: #{response.inspect}"
|
825
|
+
|
826
|
+
|
827
|
+
```
|
828
|
+
|
829
|
+
#### Search Customer
|
830
|
+
|
831
|
+
Searches the customer database.
|
832
|
+
|
833
|
+
|
834
|
+
```ruby
|
835
|
+
# frozen_string_literal: true
|
836
|
+
|
837
|
+
require 'blockchyp'
|
838
|
+
|
839
|
+
blockchyp = BlockChyp::BlockChyp.new(
|
840
|
+
ENV['BC_API_KEY'],
|
841
|
+
ENV['BC_BEARER_TOKEN'],
|
842
|
+
ENV['BC_SIGNING_KEY']
|
843
|
+
)
|
844
|
+
|
845
|
+
# Set request parameters
|
846
|
+
request = {
|
847
|
+
"query": '(123) 123-1234'
|
848
|
+
}
|
849
|
+
|
850
|
+
response = blockchyp.customerSearch(request)
|
851
|
+
|
852
|
+
puts "Response: #{response.inspect}"
|
853
|
+
|
854
|
+
|
855
|
+
```
|
856
|
+
|
857
|
+
#### Transaction Status
|
858
|
+
|
859
|
+
Retrieves the current status of a transaction.
|
860
|
+
|
861
|
+
|
862
|
+
```ruby
|
863
|
+
# frozen_string_literal: true
|
864
|
+
|
865
|
+
require 'blockchyp'
|
866
|
+
|
867
|
+
blockchyp = BlockChyp::BlockChyp.new(
|
868
|
+
ENV['BC_API_KEY'],
|
869
|
+
ENV['BC_BEARER_TOKEN'],
|
870
|
+
ENV['BC_SIGNING_KEY']
|
871
|
+
)
|
872
|
+
|
873
|
+
# Set request parameters
|
874
|
+
request = {
|
875
|
+
"transactionId": 'ID of transaction to retrieve'
|
876
|
+
}
|
877
|
+
|
878
|
+
response = blockchyp.transactionStatus(request)
|
879
|
+
|
880
|
+
puts "Response: #{response.inspect}"
|
881
|
+
|
882
|
+
|
883
|
+
```
|
884
|
+
|
885
|
+
#### Send Payment Link
|
886
|
+
|
887
|
+
Creates and send a payment link to a customer.
|
888
|
+
|
889
|
+
|
890
|
+
```ruby
|
891
|
+
# frozen_string_literal: true
|
892
|
+
|
893
|
+
require 'blockchyp'
|
894
|
+
|
895
|
+
blockchyp = BlockChyp::BlockChyp.new(
|
896
|
+
ENV['BC_API_KEY'],
|
897
|
+
ENV['BC_BEARER_TOKEN'],
|
898
|
+
ENV['BC_SIGNING_KEY']
|
899
|
+
)
|
900
|
+
|
901
|
+
# Set request parameters
|
902
|
+
request = {
|
903
|
+
"amount": '199.99',
|
904
|
+
"description": 'Widget',
|
905
|
+
"subject": 'Widget invoice',
|
906
|
+
"transaction": {
|
907
|
+
"subtotal": '195.00',
|
908
|
+
"tax": '4.99',
|
909
|
+
"total": '199.99',
|
910
|
+
"items": [
|
911
|
+
{
|
912
|
+
"description": 'Widget',
|
913
|
+
"price": '195.00',
|
914
|
+
"quantity": 1
|
915
|
+
}
|
916
|
+
]
|
917
|
+
},
|
918
|
+
"autoSend": true,
|
919
|
+
"customer": {
|
920
|
+
"customerRef": 'Customer reference string',
|
921
|
+
"firstName": 'FirstName',
|
922
|
+
"lastName": 'LastName',
|
923
|
+
"companyName": 'Company Name',
|
924
|
+
"emailAddress": 'support@blockchyp.com',
|
925
|
+
"smsNumber": '(123) 123-1231'
|
926
|
+
}
|
927
|
+
}
|
928
|
+
|
929
|
+
response = blockchyp.sendPaymentLink(request)
|
930
|
+
|
931
|
+
puts "Response: #{response.inspect}"
|
932
|
+
|
933
|
+
|
756
934
|
```
|
757
935
|
|
758
936
|
## Running Integration Tests
|