checkout_sdk 0.1.3 → 0.1.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/Gemfile.lock +1 -1
- data/LICENSE +21 -0
- data/README.md +37 -24
- data/checkout_sdk.gemspec +1 -0
- data/lib/checkout_sdk/api_resource.rb +8 -2
- data/lib/checkout_sdk/version.rb +1 -1
- data/spec/checkout_sdk/api_resource_spec.rb +3 -3
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7591e018711ebd2cdb259c0e30f41d35ebb40fba79eca4417784c57311daa9fe
|
4
|
+
data.tar.gz: d9e7b078f08c69b592936f17ebf96413deb572140d714da37963043b1b13c58b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b27186569eb0cf3d28280b07a91bca36d8e7320a0d8a0bd5b39cefc5870bfc0b03bf46d63754208a87b1bf2ef3bc454c88b5054a21710de8e609c692023ec810
|
7
|
+
data.tar.gz: 6fab6f773252974e82e824311359c0997c321054164d3595846fad8bc558f3c4e16d6c2c3d8f92e635e97aa76acbc61c8780d616474c78ec0e714b01f1243279
|
data/Gemfile.lock
CHANGED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2019 Checkout.com
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# CheckoutSdk
|
2
2
|
|
3
|
-
You are reading documentation for version: 0.1.
|
3
|
+
You are reading documentation for version: 0.1.4
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -33,29 +33,42 @@ end
|
|
33
33
|
## Usage
|
34
34
|
|
35
35
|
```ruby
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
36
|
+
payment_request_source = CheckoutSdk::PaymentRequestSource.new
|
37
|
+
payment_request_source.type = "card"
|
38
|
+
payment_request_source.card_number = "4242424242424242"
|
39
|
+
payment_request_source.card_expiry_month = 6
|
40
|
+
payment_request_source.card_expiry_year = 2025
|
41
|
+
payment_request_source.card_name = "Bruce Wayne"
|
42
|
+
payment_request_source.card_cvv = "100"
|
43
|
+
payment_request_source.amount = 2022
|
44
|
+
payment_request_source.currency = "GBP"
|
45
|
+
payment_request_source.capture = true
|
46
|
+
payment_request_source.threeds_enabled = false
|
47
|
+
payment_request_source.threeds_attempt_n3d = false
|
48
|
+
payment_request_source.recipient_dob = "1992-04-06"
|
49
|
+
payment_request_source.recipient_account_number = "1234567890"
|
50
|
+
payment_request_source.recipient_zip = "12345"
|
51
|
+
payment_request_source.recipient_last_name = "Elmo"
|
52
|
+
payment_request_source.risk_enabled = true
|
53
|
+
payment_request_source.billing_descriptor_name = "Nancy"
|
54
|
+
payment_request_source.billing_descriptor_city = "Berlin"
|
55
|
+
payment_request_source.processing_mid = "CheckoutSdk"
|
56
|
+
|
57
|
+
|
58
|
+
api_resource = CheckoutSdk::ApiResource.new
|
59
|
+
|
60
|
+
# Send API call
|
61
|
+
response = api_resource.request_payments(payment_request_source)
|
62
|
+
|
63
|
+
# response parsing
|
64
|
+
response.data # => {...}
|
65
|
+
response.body # => "..."
|
66
|
+
response.headers # => {...}
|
67
|
+
response.remote_ip # => "..."
|
68
|
+
response.status # => 200
|
69
|
+
response.remote_ip # => "..."
|
70
|
+
response.local_port # => 51601
|
71
|
+
response.local_address # => "..."
|
59
72
|
```
|
60
73
|
|
61
74
|
## Tests
|
data/checkout_sdk.gemspec
CHANGED
@@ -13,6 +13,7 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.homepage = "http://checkout.com"
|
14
14
|
spec.files = `git ls-files`.split("\n")
|
15
15
|
spec.require_paths = ["lib"]
|
16
|
+
spec.license = "MIT"
|
16
17
|
|
17
18
|
spec.add_development_dependency "bundler", "~> 1.16"
|
18
19
|
spec.add_development_dependency "rake", "~> 10.0"
|
@@ -42,10 +42,10 @@ class CheckoutSdk::ApiResource
|
|
42
42
|
|
43
43
|
private
|
44
44
|
|
45
|
-
def post_request(path,
|
45
|
+
def post_request(path, data)
|
46
46
|
checkout_connection.post(
|
47
47
|
path: path,
|
48
|
-
body: MultiJson.dump(
|
48
|
+
body: MultiJson.dump(delete_blank(data)),
|
49
49
|
headers: { "Content-Type" => "application/json",
|
50
50
|
"Authorization" => "#{CheckoutSdk.configuration.secret_key}" }
|
51
51
|
)
|
@@ -57,4 +57,10 @@ class CheckoutSdk::ApiResource
|
|
57
57
|
headers: { "Authorization" => "#{CheckoutSdk.configuration.secret_key}" }
|
58
58
|
)
|
59
59
|
end
|
60
|
+
|
61
|
+
def delete_blank(data_hash)
|
62
|
+
data_hash.delete_if do |k, v|
|
63
|
+
(v.respond_to?(:empty?) ? v.empty? : !v) or v.instance_of?(Hash) && delete_blank(v).empty?
|
64
|
+
end
|
65
|
+
end
|
60
66
|
end
|
data/lib/checkout_sdk/version.rb
CHANGED
@@ -30,7 +30,7 @@ RSpec.describe CheckoutSdk::ApiResource do
|
|
30
30
|
capture_payment.id = 1
|
31
31
|
|
32
32
|
expect(api_resource.checkout_connection).to receive(:post)
|
33
|
-
.with({ body:"{
|
33
|
+
.with({ body:"{}",
|
34
34
|
headers:{"Authorization"=>"sk_test", "Content-Type"=>"application/json"},
|
35
35
|
path:"/payments/1/captures" })
|
36
36
|
|
@@ -45,7 +45,7 @@ RSpec.describe CheckoutSdk::ApiResource do
|
|
45
45
|
refund_payment.id = 1
|
46
46
|
|
47
47
|
expect(api_resource.checkout_connection).to receive(:post)
|
48
|
-
.with({ body:"{
|
48
|
+
.with({ body:"{}",
|
49
49
|
headers:{"Authorization"=>"sk_test", "Content-Type"=>"application/json"},
|
50
50
|
path:"/payments/1/refunds" })
|
51
51
|
|
@@ -60,7 +60,7 @@ RSpec.describe CheckoutSdk::ApiResource do
|
|
60
60
|
void_payment.id = 1
|
61
61
|
|
62
62
|
expect(api_resource.checkout_connection).to receive(:post)
|
63
|
-
.with({ body:"{
|
63
|
+
.with({ body:"{}",
|
64
64
|
headers:{"Authorization"=>"sk_test", "Content-Type"=>"application/json"},
|
65
65
|
path:"/payments/1/voids" })
|
66
66
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: checkout_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Khalid Jazaerly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- ".travis.yml"
|
107
107
|
- Gemfile
|
108
108
|
- Gemfile.lock
|
109
|
+
- LICENSE
|
109
110
|
- README.md
|
110
111
|
- Rakefile
|
111
112
|
- bin/console
|
@@ -127,7 +128,8 @@ files:
|
|
127
128
|
- spec/checkout_sdk_spec.rb
|
128
129
|
- spec/spec_helper.rb
|
129
130
|
homepage: http://checkout.com
|
130
|
-
licenses:
|
131
|
+
licenses:
|
132
|
+
- MIT
|
131
133
|
metadata: {}
|
132
134
|
post_install_message:
|
133
135
|
rdoc_options: []
|