blockchyp 2.1.1 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +186 -0
- data/lib/blockchyp.rb +25 -0
- data/lib/blockchyp/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bafab639c7c49cc19c9dd99e655f9f3d3f1243722c545dc6c1151bc8e33cdb11
|
4
|
+
data.tar.gz: a71a85cf2cb5c656154a6903e4e8b80fba5488b69b8db34b7dd027a0796a5c6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6dfb3743c7c1a0b887b53fe06240af3ff003867bd255c3e5726bc261cc1a79715198ff2140057126291a8d61822116d97e80740d9cabb23670c602909f2a4380
|
7
|
+
data.tar.gz: 22dcd330545930b9f26c6620616f1cc2e4a613a0cc8359dc429398b87a5fd2dea749bfe5b080bea7d160b54fff9905ca781346dd7f4a8a08cc0008c1ed231551
|
data/README.md
CHANGED
@@ -753,6 +753,192 @@ response = blockchyp.captureSignature(request)
|
|
753
753
|
puts "Response: #{response.inspect}"
|
754
754
|
|
755
755
|
|
756
|
+
```
|
757
|
+
|
758
|
+
#### Update Customer
|
759
|
+
|
760
|
+
Updates or creates a customer record.
|
761
|
+
|
762
|
+
|
763
|
+
```ruby
|
764
|
+
# frozen_string_literal: true
|
765
|
+
|
766
|
+
require 'blockchyp'
|
767
|
+
|
768
|
+
blockchyp = BlockChyp::BlockChyp.new(
|
769
|
+
ENV['BC_API_KEY'],
|
770
|
+
ENV['BC_BEARER_TOKEN'],
|
771
|
+
ENV['BC_SIGNING_KEY']
|
772
|
+
)
|
773
|
+
|
774
|
+
# setup request object
|
775
|
+
request = {}
|
776
|
+
request['customer'] = new_customer
|
777
|
+
|
778
|
+
response = blockchyp.updateCustomer(request)
|
779
|
+
|
780
|
+
puts "Response: #{response.inspect}"
|
781
|
+
def new_customer
|
782
|
+
val = {}
|
783
|
+
val['id'] = 'ID of the customer to update'
|
784
|
+
val['customerRef'] = 'Customer reference string'
|
785
|
+
val['firstName'] = 'FirstName'
|
786
|
+
val['lastName'] = 'LastName'
|
787
|
+
val['companyName'] = 'Company Name'
|
788
|
+
val['emailAddress'] = 'support@blockchyp.com'
|
789
|
+
val['smsNumber'] = '(123) 123-1231'
|
790
|
+
val
|
791
|
+
end
|
792
|
+
|
793
|
+
|
794
|
+
|
795
|
+
```
|
796
|
+
|
797
|
+
#### Retrieve Customer
|
798
|
+
|
799
|
+
Retrieves a customer by id.
|
800
|
+
|
801
|
+
|
802
|
+
```ruby
|
803
|
+
# frozen_string_literal: true
|
804
|
+
|
805
|
+
require 'blockchyp'
|
806
|
+
|
807
|
+
blockchyp = BlockChyp::BlockChyp.new(
|
808
|
+
ENV['BC_API_KEY'],
|
809
|
+
ENV['BC_BEARER_TOKEN'],
|
810
|
+
ENV['BC_SIGNING_KEY']
|
811
|
+
)
|
812
|
+
|
813
|
+
# setup request object
|
814
|
+
request = {}
|
815
|
+
request['customerId'] = 'ID of the customer to retrieve'
|
816
|
+
|
817
|
+
response = blockchyp.customer(request)
|
818
|
+
|
819
|
+
puts "Response: #{response.inspect}"
|
820
|
+
|
821
|
+
|
822
|
+
```
|
823
|
+
|
824
|
+
#### Search Customer
|
825
|
+
|
826
|
+
Searches the customer database.
|
827
|
+
|
828
|
+
|
829
|
+
```ruby
|
830
|
+
# frozen_string_literal: true
|
831
|
+
|
832
|
+
require 'blockchyp'
|
833
|
+
|
834
|
+
blockchyp = BlockChyp::BlockChyp.new(
|
835
|
+
ENV['BC_API_KEY'],
|
836
|
+
ENV['BC_BEARER_TOKEN'],
|
837
|
+
ENV['BC_SIGNING_KEY']
|
838
|
+
)
|
839
|
+
|
840
|
+
# setup request object
|
841
|
+
request = {}
|
842
|
+
request['query'] = '(123) 123-1234'
|
843
|
+
|
844
|
+
response = blockchyp.customerSearch(request)
|
845
|
+
|
846
|
+
puts "Response: #{response.inspect}"
|
847
|
+
|
848
|
+
|
849
|
+
```
|
850
|
+
|
851
|
+
#### Transaction Status
|
852
|
+
|
853
|
+
Retrieves the current status of a transaction.
|
854
|
+
|
855
|
+
|
856
|
+
```ruby
|
857
|
+
# frozen_string_literal: true
|
858
|
+
|
859
|
+
require 'blockchyp'
|
860
|
+
|
861
|
+
blockchyp = BlockChyp::BlockChyp.new(
|
862
|
+
ENV['BC_API_KEY'],
|
863
|
+
ENV['BC_BEARER_TOKEN'],
|
864
|
+
ENV['BC_SIGNING_KEY']
|
865
|
+
)
|
866
|
+
|
867
|
+
# setup request object
|
868
|
+
request = {}
|
869
|
+
request['transactionId'] = 'ID of transaction to retrieve'
|
870
|
+
|
871
|
+
response = blockchyp.transactionStatus(request)
|
872
|
+
|
873
|
+
puts "Response: #{response.inspect}"
|
874
|
+
|
875
|
+
|
876
|
+
```
|
877
|
+
|
878
|
+
#### Send Payment Link
|
879
|
+
|
880
|
+
Creates and send a payment link to a customer.
|
881
|
+
|
882
|
+
|
883
|
+
```ruby
|
884
|
+
# frozen_string_literal: true
|
885
|
+
|
886
|
+
require 'blockchyp'
|
887
|
+
|
888
|
+
blockchyp = BlockChyp::BlockChyp.new(
|
889
|
+
ENV['BC_API_KEY'],
|
890
|
+
ENV['BC_BEARER_TOKEN'],
|
891
|
+
ENV['BC_SIGNING_KEY']
|
892
|
+
)
|
893
|
+
|
894
|
+
# setup request object
|
895
|
+
request = {}
|
896
|
+
request['amount'] = '199.99'
|
897
|
+
request['description'] = 'Widget'
|
898
|
+
request['subject'] = 'Widget invoice'
|
899
|
+
request['transaction'] = new_transaction_display_transaction
|
900
|
+
request['autoSend'] = true
|
901
|
+
request['customer'] = new_customer
|
902
|
+
|
903
|
+
response = blockchyp.sendPaymentLink(request)
|
904
|
+
|
905
|
+
puts "Response: #{response.inspect}"
|
906
|
+
def new_transaction_display_transaction
|
907
|
+
val = {}
|
908
|
+
val['subtotal'] = '195.00'
|
909
|
+
val['tax'] = '4.99'
|
910
|
+
val['total'] = '199.99'
|
911
|
+
val['items'] = new_transaction_display_items
|
912
|
+
val
|
913
|
+
end
|
914
|
+
|
915
|
+
def new_transaction_display_items
|
916
|
+
val = []
|
917
|
+
val = val.push(new_transaction_display_item_2)
|
918
|
+
val
|
919
|
+
end
|
920
|
+
|
921
|
+
def new_transaction_display_item_2
|
922
|
+
val = {}
|
923
|
+
val['description'] = 'Widget'
|
924
|
+
val['price'] = '195.00'
|
925
|
+
val['quantity'] = 1
|
926
|
+
val
|
927
|
+
end
|
928
|
+
|
929
|
+
def new_customer
|
930
|
+
val = {}
|
931
|
+
val['customerRef'] = 'Customer reference string'
|
932
|
+
val['firstName'] = 'FirstName'
|
933
|
+
val['lastName'] = 'LastName'
|
934
|
+
val['companyName'] = 'Company Name'
|
935
|
+
val['emailAddress'] = 'support@blockchyp.com'
|
936
|
+
val['smsNumber'] = '(123) 123-1231'
|
937
|
+
val
|
938
|
+
end
|
939
|
+
|
940
|
+
|
941
|
+
|
756
942
|
```
|
757
943
|
|
758
944
|
## Running Integration Tests
|
data/lib/blockchyp.rb
CHANGED
@@ -161,5 +161,30 @@ module BlockChyp
|
|
161
161
|
gateway_request('POST', '/api/void', request)
|
162
162
|
end
|
163
163
|
|
164
|
+
# Updates or creates a customer record.
|
165
|
+
def update_customer(request)
|
166
|
+
gateway_request('POST', '/api/update-customer', request)
|
167
|
+
end
|
168
|
+
|
169
|
+
# Retrieves a customer by id.
|
170
|
+
def customer(request)
|
171
|
+
gateway_request('POST', '/api/customer', request)
|
172
|
+
end
|
173
|
+
|
174
|
+
# Searches the customer database.
|
175
|
+
def customer_search(request)
|
176
|
+
gateway_request('POST', '/api/customer-search', request)
|
177
|
+
end
|
178
|
+
|
179
|
+
# Retrieves the current status of a transaction.
|
180
|
+
def transaction_status(request)
|
181
|
+
gateway_request('POST', '/api/tx-status', request)
|
182
|
+
end
|
183
|
+
|
184
|
+
# Creates and send a payment link to a customer.
|
185
|
+
def send_payment_link(request)
|
186
|
+
gateway_request('POST', '/api/send-payment-link', request)
|
187
|
+
end
|
188
|
+
|
164
189
|
end
|
165
190
|
end
|
data/lib/blockchyp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blockchyp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BlockChyp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|