coinqvest_merchant_sdk 0.0.6 → 0.0.7
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/lib/coinqvest_merchant_sdk/config.rb +1 -1
- metadata +19 -20
- data/examples/example.rb +0 -116
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1f2c89f18ad8f70f4c61369c781a50732d2efd22c2850bc7536c0328cdcc534
|
4
|
+
data.tar.gz: c74560b7d441604ba276e8e7ce3221aae9901d0c46764f1a1eb016078cfc31d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 965d4e9bcdb64931aa68d61e7cb087bf59fc5baa72847c29a8ba9a0544963e5faad3dd3bf69da0747f494952117ce48fa88faefb81f3e928669f26c3f32ed844
|
7
|
+
data.tar.gz: 94a9cecbae20979d5392b613728dfd75b3f0dbd29352ac423a8aee9b3df68e2e33f4cdf044262e49dfcbd003e083f719bfe503d5b61742c4c98e1931940bbdf8
|
metadata
CHANGED
@@ -1,56 +1,56 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coinqvest_merchant_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- COINQVEST Ltd.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '2.1'
|
20
17
|
- - ">="
|
21
18
|
- !ruby/object:Gem::Version
|
22
19
|
version: 2.1.0
|
20
|
+
- - "~>"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '2.1'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - "~>"
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '2.1'
|
30
27
|
- - ">="
|
31
28
|
- !ruby/object:Gem::Version
|
32
29
|
version: 2.1.0
|
30
|
+
- - "~>"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2.1'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: json
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "~>"
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '2.3'
|
40
37
|
- - ">="
|
41
38
|
- !ruby/object:Gem::Version
|
42
39
|
version: 2.3.0
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '2.3'
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- - "~>"
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: '2.3'
|
50
47
|
- - ">="
|
51
48
|
- !ruby/object:Gem::Version
|
52
49
|
version: 2.3.0
|
53
|
-
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '2.3'
|
53
|
+
description:
|
54
54
|
email:
|
55
55
|
- service@coinqvest.com
|
56
56
|
executables: []
|
@@ -60,7 +60,6 @@ files:
|
|
60
60
|
- ".gitignore"
|
61
61
|
- Gemfile
|
62
62
|
- coinqvest_merchant_sdk.gemspec
|
63
|
-
- examples/example.rb
|
64
63
|
- lib/coinqvest_merchant_sdk.rb
|
65
64
|
- lib/coinqvest_merchant_sdk/client.rb
|
66
65
|
- lib/coinqvest_merchant_sdk/config.rb
|
@@ -68,7 +67,7 @@ homepage: https://www.coinqvest.com
|
|
68
67
|
licenses:
|
69
68
|
- Apache-2.0
|
70
69
|
metadata: {}
|
71
|
-
post_install_message:
|
70
|
+
post_install_message:
|
72
71
|
rdoc_options: []
|
73
72
|
require_paths:
|
74
73
|
- lib
|
@@ -83,8 +82,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
82
|
- !ruby/object:Gem::Version
|
84
83
|
version: '0'
|
85
84
|
requirements: []
|
86
|
-
rubygems_version: 3.3.
|
87
|
-
signing_key:
|
85
|
+
rubygems_version: 3.0.3.1
|
86
|
+
signing_key:
|
88
87
|
specification_version: 4
|
89
88
|
summary: Ruby Merchant SDK for COINQVEST. Programmatically accept and settle payments
|
90
89
|
in digital currencies.
|
data/examples/example.rb
DELETED
@@ -1,116 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'coinqvest_merchant_sdk/client'
|
3
|
-
|
4
|
-
# This file contains examples on how to interact with the COINQVEST Merchant API.
|
5
|
-
# All endpoints of the API are documented here: https://www.coinqvest.com/en/api-docs
|
6
|
-
|
7
|
-
# Create a COINQVEST Merchant API client
|
8
|
-
# The constructor takes your API Key, API Secret and an optional log file location as parameters
|
9
|
-
# Your API Key and Secret can be obtained here: https://www.coinqvest.com/en/api-settings
|
10
|
-
client = CoinqvestMerchantSDK::Client.new(
|
11
|
-
'YOUR-API-KEY',
|
12
|
-
'YOUR-API-SECRET',
|
13
|
-
'/var/log/coinqvest-ruby.log' # an optional log file location
|
14
|
-
)
|
15
|
-
|
16
|
-
# Invoke a request to GET /auth-test (https://www.coinqvest.com/en/api-docs#get-auth-test) to see if everything worked
|
17
|
-
response = client.get('/auth-test')
|
18
|
-
|
19
|
-
# The API should return an HTTP status code of 200 if the request was successfully processed, let's have a look.
|
20
|
-
print "Status Code: " + response.code.to_s + "\n"
|
21
|
-
print "Response Body: " + response.body + "\n"
|
22
|
-
|
23
|
-
# Check our USD wallet balance using GET /wallet (https://www.coinqvest.com/en/api-docs#get-wallet)
|
24
|
-
response = client.get('/wallet', {:assetCode => 'USD'})
|
25
|
-
print "Status Code: " + response.code.to_s + "\n"
|
26
|
-
print "Response Body: " + response.body + "\n"
|
27
|
-
|
28
|
-
# Create a checkout and get paid in two easy steps!
|
29
|
-
#
|
30
|
-
# It's good practice to associate payments with a customer, let's create one!
|
31
|
-
# Invoke POST /customer (https://www.coinqvest.com/en/api-docs#post-customer) to create a new customer object.
|
32
|
-
# Tip: At a minimum a customer needs an email address, but it's better to provide a full billing address for invoices.
|
33
|
-
response = client.post('/customer', {:customer => {
|
34
|
-
:email => 'john@tester-1.com',
|
35
|
-
:firstname => 'John',
|
36
|
-
:lastname => 'Doe',
|
37
|
-
:company => 'ACME Inc.',
|
38
|
-
:adr1 => '810 Beach St',
|
39
|
-
:adr2 => 'Finance Department',
|
40
|
-
:zip => 'CA 94103',
|
41
|
-
:city => 'San Francisco',
|
42
|
-
:countrycode => 'US'
|
43
|
-
}})
|
44
|
-
print "Status Code: " + response.code.to_s + "\n"
|
45
|
-
print "Response Body: " + response.body + "\n"
|
46
|
-
|
47
|
-
if response.code != 200
|
48
|
-
# something went wrong, let's abort and debug by looking at our log file specified above in the client.
|
49
|
-
print "Could not create customer, please check the logs."
|
50
|
-
exit 1
|
51
|
-
end
|
52
|
-
|
53
|
-
# the customer was created
|
54
|
-
data = JSON.parse(response.body)
|
55
|
-
# data now contains an object as specified in the success response here: https://www.coinqvest.com/en/api-docs#post-customer
|
56
|
-
# extract the customer id to use it in our checkout below
|
57
|
-
customer_id = data["customerId"]
|
58
|
-
|
59
|
-
# We now have a customer. Let's create a checkout for him/her.
|
60
|
-
# This creates a hosted checkout, which will provide a payment interface hosted on COINQVEST servers
|
61
|
-
response = client.post('/checkout/hosted', {
|
62
|
-
:charge => {
|
63
|
-
:customerId => customer_id, # associates this charge with a customer
|
64
|
-
:currency => 'USD', # specifies the billing currency
|
65
|
-
:lineItems => [{ # a list of line items included in this charge
|
66
|
-
:description => 'T-Shirt',
|
67
|
-
:netAmount => 10, # denominated in the currency specified above
|
68
|
-
:quantity => 1
|
69
|
-
}],
|
70
|
-
:discountItems => [{ # an optional list of discounts
|
71
|
-
:description => 'Loyalty Discount',
|
72
|
-
:netAmount => 0.5
|
73
|
-
}],
|
74
|
-
:shippingCostItems => [{ # an optional list of shipping and handling costs
|
75
|
-
:description => 'Shipping and Handling',
|
76
|
-
:netAmount => 3.99,
|
77
|
-
:taxable => FALSE # sometimes shipping costs are taxable
|
78
|
-
}],
|
79
|
-
:taxItems => [{ # an optional list of taxes
|
80
|
-
:name => 'CA Sales Tax',
|
81
|
-
:percent => 0.0825 # 8.25% CA sales tax
|
82
|
-
}]
|
83
|
-
},
|
84
|
-
:settlementCurrency => 'EUR' # specifies in which currency you want to settle
|
85
|
-
})
|
86
|
-
print "Status Code: " + response.code.to_s + "\n"
|
87
|
-
print "Response Body: " + response.body + "\n"
|
88
|
-
|
89
|
-
if response.code != 200
|
90
|
-
# something went wrong, let's abort and debug by looking at our log file specified above in the client.
|
91
|
-
print "Could not create checkout, please check the logs."
|
92
|
-
exit 1
|
93
|
-
end
|
94
|
-
|
95
|
-
# the checkout was created
|
96
|
-
data = JSON.parse(response.body)
|
97
|
-
# data now contains an object as specified in the success response here: https://www.coinqvest.com/en/api-docs#post-checkout
|
98
|
-
checkout_id = data["checkoutId"] # store this persistently in your database
|
99
|
-
url = data["url"] # redirect your customer to this URL to complete the payment
|
100
|
-
|
101
|
-
# you can update a customer object like this
|
102
|
-
response = client.put('/customer', {:customer => {
|
103
|
-
:id => customer_id,
|
104
|
-
:email => 'john@tester-2.com',
|
105
|
-
:firstname => 'John',
|
106
|
-
:lastname => 'Doe'
|
107
|
-
}})
|
108
|
-
print "Status Code: " + response.code.to_s + "\n"
|
109
|
-
print "Response Body: " + response.body + "\n"
|
110
|
-
|
111
|
-
# delete a customer when not needed anymore
|
112
|
-
response = client.delete('/customer', {
|
113
|
-
:id => customer_id
|
114
|
-
})
|
115
|
-
print "Status Code: " + response.code.to_s + "\n"
|
116
|
-
print "Response Body: " + response.body + "\n"
|