checkout_sdk 0.1.1 → 0.1.2
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 +5 -5
- metadata +5 -24
- data/.gitignore +0 -11
- data/.rspec +0 -3
- data/.travis.yml +0 -7
- data/Gemfile +0 -3
- data/Gemfile.lock +0 -43
- data/README.md +0 -63
- data/Rakefile +0 -6
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/checkout.gemspec +0 -29
- data/lib/checkout_sdk/api_resource.rb +0 -59
- data/lib/checkout_sdk/configuration.rb +0 -9
- data/lib/checkout_sdk/data/capture_payment.rb +0 -11
- data/lib/checkout_sdk/data/payment_request_source.rb +0 -144
- data/lib/checkout_sdk/data/payment_source.rb +0 -40
- data/lib/checkout_sdk/data/refund_payment.rb +0 -11
- data/lib/checkout_sdk/data/request_token.rb +0 -67
- data/lib/checkout_sdk/data/void_payment.rb +0 -10
- data/lib/checkout_sdk/version.rb +0 -3
- data/lib/checkout_sdk.rb +0 -22
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: b22fce47bec3da9a803c2697f80ab2284c8a615b
|
|
4
|
+
data.tar.gz: dba31fa4811255bed5e2b0bf2f025cca47430eb6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4ce5ab3b932d135553d09cdf556706dabc1b2f6b39899d2ff67cfe45c5ec3664977f7ce19dd86cb1fa42fcd4c1ad3840f828ac44fa75c6bc1da18b3d8edaae83
|
|
7
|
+
data.tar.gz: 5a589bb7a2f624b921757748c11272c4622aee2891db7404a8688def702ce6c7c9ea3c7b69cb789c0a8e4e1e5380ce36abe2f8c161ae31303aa994444066a818
|
metadata
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Khalid Jazaerly
|
|
8
8
|
autorequire:
|
|
9
|
-
bindir:
|
|
9
|
+
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
date: 2019-10-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
@@ -86,27 +86,7 @@ email:
|
|
|
86
86
|
executables: []
|
|
87
87
|
extensions: []
|
|
88
88
|
extra_rdoc_files: []
|
|
89
|
-
files:
|
|
90
|
-
- ".gitignore"
|
|
91
|
-
- ".rspec"
|
|
92
|
-
- ".travis.yml"
|
|
93
|
-
- Gemfile
|
|
94
|
-
- Gemfile.lock
|
|
95
|
-
- README.md
|
|
96
|
-
- Rakefile
|
|
97
|
-
- bin/console
|
|
98
|
-
- bin/setup
|
|
99
|
-
- checkout.gemspec
|
|
100
|
-
- lib/checkout_sdk.rb
|
|
101
|
-
- lib/checkout_sdk/api_resource.rb
|
|
102
|
-
- lib/checkout_sdk/configuration.rb
|
|
103
|
-
- lib/checkout_sdk/data/capture_payment.rb
|
|
104
|
-
- lib/checkout_sdk/data/payment_request_source.rb
|
|
105
|
-
- lib/checkout_sdk/data/payment_source.rb
|
|
106
|
-
- lib/checkout_sdk/data/refund_payment.rb
|
|
107
|
-
- lib/checkout_sdk/data/request_token.rb
|
|
108
|
-
- lib/checkout_sdk/data/void_payment.rb
|
|
109
|
-
- lib/checkout_sdk/version.rb
|
|
89
|
+
files: []
|
|
110
90
|
homepage: http://checkout.com
|
|
111
91
|
licenses: []
|
|
112
92
|
metadata: {}
|
|
@@ -125,7 +105,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
125
105
|
- !ruby/object:Gem::Version
|
|
126
106
|
version: '0'
|
|
127
107
|
requirements: []
|
|
128
|
-
|
|
108
|
+
rubyforge_project:
|
|
109
|
+
rubygems_version: 2.5.2.3
|
|
129
110
|
signing_key:
|
|
130
111
|
specification_version: 4
|
|
131
112
|
summary: A Ruby API wrapper for checkout.com.
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: .
|
|
3
|
-
specs:
|
|
4
|
-
checkout_sdk (0.1.0)
|
|
5
|
-
excon
|
|
6
|
-
|
|
7
|
-
GEM
|
|
8
|
-
remote: https://rubygems.org/
|
|
9
|
-
specs:
|
|
10
|
-
coderay (1.1.2)
|
|
11
|
-
diff-lcs (1.3)
|
|
12
|
-
excon (0.67.0)
|
|
13
|
-
method_source (0.9.2)
|
|
14
|
-
pry (0.12.2)
|
|
15
|
-
coderay (~> 1.1.0)
|
|
16
|
-
method_source (~> 0.9.0)
|
|
17
|
-
rake (10.5.0)
|
|
18
|
-
rspec (3.8.0)
|
|
19
|
-
rspec-core (~> 3.8.0)
|
|
20
|
-
rspec-expectations (~> 3.8.0)
|
|
21
|
-
rspec-mocks (~> 3.8.0)
|
|
22
|
-
rspec-core (3.8.2)
|
|
23
|
-
rspec-support (~> 3.8.0)
|
|
24
|
-
rspec-expectations (3.8.4)
|
|
25
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
26
|
-
rspec-support (~> 3.8.0)
|
|
27
|
-
rspec-mocks (3.8.1)
|
|
28
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
29
|
-
rspec-support (~> 3.8.0)
|
|
30
|
-
rspec-support (3.8.2)
|
|
31
|
-
|
|
32
|
-
PLATFORMS
|
|
33
|
-
ruby
|
|
34
|
-
|
|
35
|
-
DEPENDENCIES
|
|
36
|
-
bundler (~> 1.16)
|
|
37
|
-
checkout_sdk!
|
|
38
|
-
pry
|
|
39
|
-
rake (~> 10.0)
|
|
40
|
-
rspec (~> 3.0)
|
|
41
|
-
|
|
42
|
-
BUNDLED WITH
|
|
43
|
-
1.17.2
|
data/README.md
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# CheckoutSdk
|
|
2
|
-
|
|
3
|
-
You are reading documentation for version: 0.1.1
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
Add this line to your application's Gemfile:
|
|
8
|
-
|
|
9
|
-
```ruby
|
|
10
|
-
gem 'checkout_sdk'
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
And then execute:
|
|
14
|
-
|
|
15
|
-
$ bundle
|
|
16
|
-
|
|
17
|
-
Or install it yourself as:
|
|
18
|
-
|
|
19
|
-
$ gem install checkout_sdk
|
|
20
|
-
|
|
21
|
-
## Configuration
|
|
22
|
-
|
|
23
|
-
API keys must be configured in the gem setup. You can do this anywhere in your application before you make API calls using the gem.
|
|
24
|
-
|
|
25
|
-
```ruby
|
|
26
|
-
CheckoutSdk.configure do |config|
|
|
27
|
-
config.secret_key = ENV['SECRET_KEY']
|
|
28
|
-
config.public_key = ENV['PUBLIC_KEY']
|
|
29
|
-
config.base_url = ENV['BASE_URL']
|
|
30
|
-
end
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Usage
|
|
34
|
-
|
|
35
|
-
```ruby
|
|
36
|
-
p = CheckoutSdk::PaymentRequestSource.new
|
|
37
|
-
p.type = "card"
|
|
38
|
-
p.card_number = "4242424242424242"
|
|
39
|
-
p.card_expiry_month = 6
|
|
40
|
-
p.card_expiry_year = 2025
|
|
41
|
-
p.card_name = "Bruce Wayne"
|
|
42
|
-
p.card_cvv = "100"
|
|
43
|
-
p.amount = 2022
|
|
44
|
-
p.currency = "GBP"
|
|
45
|
-
p.capture = true
|
|
46
|
-
p.threeds_enabled = false
|
|
47
|
-
p.threeds_attempt_n3d = false
|
|
48
|
-
p.recipient_dob = "1992-04-06"
|
|
49
|
-
p.recipient_account_number = "1234567890"
|
|
50
|
-
p.recipient_zip = "12345"
|
|
51
|
-
p.recipient_last_name = "Elmo"
|
|
52
|
-
p.risk_enabled = true
|
|
53
|
-
p.billing_descriptor_name = "Nancy"
|
|
54
|
-
p.billing_descriptor_city = "Berlin"
|
|
55
|
-
p.processing_mid = "CheckoutSdk"
|
|
56
|
-
|
|
57
|
-
r = CheckoutSdk::ApiResource.new
|
|
58
|
-
r.request_payments(p)
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## Tests
|
|
62
|
-
|
|
63
|
-
$ rspec
|
data/Rakefile
DELETED
data/bin/console
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require "bundler/setup"
|
|
4
|
-
require "checkout_sdk"
|
|
5
|
-
|
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
-
|
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
-
# require "pry"
|
|
11
|
-
# Pry.start
|
|
12
|
-
|
|
13
|
-
require "irb"
|
|
14
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
data/checkout.gemspec
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
lib = File.expand_path("../lib", __FILE__)
|
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
|
-
require "checkout_sdk/version"
|
|
4
|
-
|
|
5
|
-
Gem::Specification.new do |spec|
|
|
6
|
-
spec.name = "checkout_sdk"
|
|
7
|
-
spec.version = CheckoutSdk::VERSION
|
|
8
|
-
spec.authors = ["Khalid Jazaerly"]
|
|
9
|
-
spec.email = ["khalid.jaz@gmail.com"]
|
|
10
|
-
|
|
11
|
-
spec.summary = %q{A Ruby API wrapper for checkout.com.}
|
|
12
|
-
spec.description = %q{A Ruby API wrapper for checkout.com.}
|
|
13
|
-
spec.homepage = "http://checkout.com"
|
|
14
|
-
|
|
15
|
-
# Specify which files should be added to the gem when it is released.
|
|
16
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
17
|
-
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
18
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
19
|
-
end
|
|
20
|
-
spec.bindir = "exe"
|
|
21
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
22
|
-
spec.require_paths = ["lib"]
|
|
23
|
-
|
|
24
|
-
spec.add_development_dependency "bundler", "~> 1.16"
|
|
25
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
|
26
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
|
27
|
-
spec.add_development_dependency "pry"
|
|
28
|
-
spec.add_dependency "excon"
|
|
29
|
-
end
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
require "excon"
|
|
2
|
-
|
|
3
|
-
class CheckoutSdk::ApiResource
|
|
4
|
-
attr_reader :checkout_connection
|
|
5
|
-
|
|
6
|
-
def initialize
|
|
7
|
-
@checkout_connection = Excon.new("#{CheckoutSdk.configuration.base_url}", persistent: true)
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def request_payments(data_object)
|
|
11
|
-
post_request("/payments", data_object.data)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def capture_payment(data_object)
|
|
15
|
-
post_request("/payments/#{data_object.id}/captures", data_object.data)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def refund_payment(data_object)
|
|
19
|
-
post_request("/payments/#{data_object.id}/refunds", data_object.data)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def void_payment(data_object)
|
|
23
|
-
post_request("/payments/#{data_object.id}/voids", data_object.data)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def add_payment_source(data_object)
|
|
27
|
-
post_request("/sources", data_object.data)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def request_token(data_object)
|
|
31
|
-
post_request("/tokens", data_object.data)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def get_payment_details(id)
|
|
35
|
-
get("/payments/#{id}")
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def get_payment_actions(id)
|
|
39
|
-
get("/payments/#{id}/actions")
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
private
|
|
43
|
-
|
|
44
|
-
def post_request(path, data_object)
|
|
45
|
-
checkout_connection.post(
|
|
46
|
-
path: path,
|
|
47
|
-
body: data_object.to_json,
|
|
48
|
-
headers: { "Content-Type" => "application/json",
|
|
49
|
-
"Authorization" => "#{CheckoutSdk.configuration.secret_key}" }
|
|
50
|
-
)
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def get(path)
|
|
54
|
-
checkout_connection.get(
|
|
55
|
-
path: path,
|
|
56
|
-
headers: { "Authorization" => "#{CheckoutSdk.configuration.secret_key}" }
|
|
57
|
-
)
|
|
58
|
-
end
|
|
59
|
-
end
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
class CheckoutSdk::PaymentRequestSource
|
|
2
|
-
attr_accessor :type, :token, :billing_address_line1, :billing_address_line2, :billing_city, :billing_state,
|
|
3
|
-
:billing_zip, :billing_country, :phone_country_code, :phone_number, :amount,
|
|
4
|
-
:currency, :payment_type, :reference, :description, :capture, :capture_on, :customer_id,
|
|
5
|
-
:customer_email, :customer_name, :billing_descriptor, :billing_descriptor_name,
|
|
6
|
-
:billing_descriptor_city, :shipping_address_line1, :shipping_address_line2, :shipping_city,
|
|
7
|
-
:shipping_state, :shipping_zip, :shipping_country, :shipping_phone_country_code,
|
|
8
|
-
:shipping_phone_number, :threeds_enabled, :threeds_attempt_n3d, :threeds_eci,
|
|
9
|
-
:threeds_cryptogram, :threeds_xid, :threeds_version, :previous_payment_id, :risk_enabled,
|
|
10
|
-
:success_url, :failure_url, :payment_ip, :recipient_dob, :recipient_account_number,
|
|
11
|
-
:recipient_zip, :recipient_last_name, :processing_mid, :metadata, :cvv, :id, :card_number,
|
|
12
|
-
:card_expiry_month, :card_expiry_year, :card_name, :card_cvv, :card_stored, :customer_id,
|
|
13
|
-
:customer_email
|
|
14
|
-
|
|
15
|
-
def data
|
|
16
|
-
{ source: source(type),
|
|
17
|
-
amount: amount,
|
|
18
|
-
currency: currency,
|
|
19
|
-
payment_type: payment_type,
|
|
20
|
-
reference: reference,
|
|
21
|
-
description: description,
|
|
22
|
-
capture: capture,
|
|
23
|
-
capture_on: capture_on,
|
|
24
|
-
customer: {
|
|
25
|
-
id: customer_id,
|
|
26
|
-
email: customer_email,
|
|
27
|
-
name: customer_name
|
|
28
|
-
},
|
|
29
|
-
billing_descriptor: {
|
|
30
|
-
name: billing_descriptor_name,
|
|
31
|
-
city: billing_descriptor_city
|
|
32
|
-
},
|
|
33
|
-
shipping: {
|
|
34
|
-
address: {
|
|
35
|
-
address_line1: shipping_address_line1,
|
|
36
|
-
address_line2: shipping_address_line2,
|
|
37
|
-
city: shipping_city,
|
|
38
|
-
state: shipping_state,
|
|
39
|
-
zip: shipping_zip,
|
|
40
|
-
country: shipping_country
|
|
41
|
-
},
|
|
42
|
-
phone: {
|
|
43
|
-
country_code: shipping_phone_country_code,
|
|
44
|
-
number: shipping_phone_number
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
"3ds" => {
|
|
48
|
-
enabled: threeds_enabled,
|
|
49
|
-
attempt_n3d: threeds_attempt_n3d,
|
|
50
|
-
eci: threeds_eci,
|
|
51
|
-
cryptogram: threeds_cryptogram,
|
|
52
|
-
xid: threeds_xid,
|
|
53
|
-
version: threeds_version
|
|
54
|
-
},
|
|
55
|
-
previous_payment_id: previous_payment_id,
|
|
56
|
-
risk: {
|
|
57
|
-
enabled: risk_enabled
|
|
58
|
-
},
|
|
59
|
-
success_url: success_url,
|
|
60
|
-
failure_url: failure_url,
|
|
61
|
-
payment_ip: payment_ip,
|
|
62
|
-
recipient: {
|
|
63
|
-
dob: recipient_dob,
|
|
64
|
-
account_number: recipient_account_number,
|
|
65
|
-
zip: recipient_zip,
|
|
66
|
-
last_name: recipient_last_name
|
|
67
|
-
},
|
|
68
|
-
processing: {
|
|
69
|
-
mid: processing_mid
|
|
70
|
-
},
|
|
71
|
-
metadata: metadata
|
|
72
|
-
}
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
private
|
|
76
|
-
|
|
77
|
-
def source(type)
|
|
78
|
-
case type
|
|
79
|
-
when "id" then id_type
|
|
80
|
-
when "token" then token_type
|
|
81
|
-
when "card" then card_type
|
|
82
|
-
when "customer" then customer_type
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
def token_type
|
|
87
|
-
{
|
|
88
|
-
type: type,
|
|
89
|
-
token: token,
|
|
90
|
-
billing_address: {
|
|
91
|
-
address_line1: billing_address_line1,
|
|
92
|
-
address_line2: billing_address_line2,
|
|
93
|
-
city: billing_city,
|
|
94
|
-
state: billing_state,
|
|
95
|
-
zip: billing_zip,
|
|
96
|
-
country: billing_country
|
|
97
|
-
},
|
|
98
|
-
phone: {
|
|
99
|
-
country_code: phone_country_code,
|
|
100
|
-
number: phone_number
|
|
101
|
-
},
|
|
102
|
-
}
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
def card_type
|
|
106
|
-
{
|
|
107
|
-
type: type,
|
|
108
|
-
number: card_number,
|
|
109
|
-
expiry_month: card_expiry_month,
|
|
110
|
-
expiry_year: card_expiry_year,
|
|
111
|
-
name: card_name,
|
|
112
|
-
cvv: card_cvv,
|
|
113
|
-
stored: card_stored,
|
|
114
|
-
billing_address: {
|
|
115
|
-
address_line1: billing_address_line1,
|
|
116
|
-
address_line2: billing_address_line2,
|
|
117
|
-
city: billing_city,
|
|
118
|
-
state: billing_state,
|
|
119
|
-
zip: billing_zip,
|
|
120
|
-
country: billing_country
|
|
121
|
-
},
|
|
122
|
-
phone: {
|
|
123
|
-
country_code: phone_country_code,
|
|
124
|
-
number: phone_number
|
|
125
|
-
},
|
|
126
|
-
}
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
def id_type
|
|
130
|
-
{
|
|
131
|
-
type: type,
|
|
132
|
-
id: id,
|
|
133
|
-
cvv: cvv
|
|
134
|
-
}
|
|
135
|
-
end
|
|
136
|
-
|
|
137
|
-
def customer_type
|
|
138
|
-
{
|
|
139
|
-
type: type,
|
|
140
|
-
id: customer_id,
|
|
141
|
-
email: customer_email
|
|
142
|
-
}
|
|
143
|
-
end
|
|
144
|
-
end
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
class CheckoutSdk::PaymentSource
|
|
2
|
-
attr_accessor :type, :reference, :billing_address_line1, :billing_address_line2,
|
|
3
|
-
:billing_city, :billing_state, :billing_zip, :billing_country,
|
|
4
|
-
:phone_country_code, :phone_number, :customer_id,
|
|
5
|
-
:customer_email, :customer_name, :source_data_first_name,
|
|
6
|
-
:source_data_last_name, :source_data_account_iban, :source_data_bic,
|
|
7
|
-
:source_data_billing_descriptor, :source_data_mandate_type
|
|
8
|
-
|
|
9
|
-
def data
|
|
10
|
-
{
|
|
11
|
-
type: type,
|
|
12
|
-
reference: reference,
|
|
13
|
-
billing_address: {
|
|
14
|
-
address_line1: billing_address_line1,
|
|
15
|
-
address_line2: billing_address_line2,
|
|
16
|
-
city: billing_city,
|
|
17
|
-
state: billing_state,
|
|
18
|
-
zip: billing_zip,
|
|
19
|
-
country: billing_country
|
|
20
|
-
},
|
|
21
|
-
phone: {
|
|
22
|
-
country_code: phone_country_code,
|
|
23
|
-
number: phone_number
|
|
24
|
-
},
|
|
25
|
-
customer: {
|
|
26
|
-
id: customer_id,
|
|
27
|
-
email: customer_email,
|
|
28
|
-
name: customer_name
|
|
29
|
-
},
|
|
30
|
-
source_data: {
|
|
31
|
-
first_name: source_data_first_name,
|
|
32
|
-
last_name: source_data_last_name,
|
|
33
|
-
account_iban: source_data_account_iban,
|
|
34
|
-
bic: source_data_bic,
|
|
35
|
-
billing_descriptor: source_data_billing_descriptor,
|
|
36
|
-
mandate_type: source_data_mandate_type
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
end
|
|
40
|
-
end
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
class CheckoutSdk::RequestToken
|
|
2
|
-
attr_accessor :type, :token_data_version, :token_data_data, :token_data_signature,
|
|
3
|
-
:token_data_header, :token_data_signature, :token_data_protocolVersion,
|
|
4
|
-
:token_data_signedMessage, :card_number, :card_expiry_month, :card_expiry_year,
|
|
5
|
-
:card_name, :card_cvv, :billing_address_line1, :billing_address_line2, :billing_city,
|
|
6
|
-
:billing_state, :billing_zip, :billing_country, :phone_country_code, :phone_number
|
|
7
|
-
|
|
8
|
-
def data
|
|
9
|
-
if type == "card"
|
|
10
|
-
card_type
|
|
11
|
-
else
|
|
12
|
-
{
|
|
13
|
-
type: type,
|
|
14
|
-
token_data: token_data(type)
|
|
15
|
-
}
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
private
|
|
20
|
-
|
|
21
|
-
def token_data(type)
|
|
22
|
-
case type
|
|
23
|
-
when "applepay" then applepay_type
|
|
24
|
-
when "googlepay" then googlepay_type
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def applepay_type
|
|
29
|
-
{
|
|
30
|
-
version: token_data_version,
|
|
31
|
-
data: token_data_data,
|
|
32
|
-
signature: token_data_signature,
|
|
33
|
-
header: token_data_header
|
|
34
|
-
}
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def googlepay_type
|
|
38
|
-
{
|
|
39
|
-
signature: token_data_signature,
|
|
40
|
-
protocolVersion: token_data_protocolVersion,
|
|
41
|
-
signedMessage: token_data_signedMessage
|
|
42
|
-
}
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def card_type
|
|
46
|
-
{
|
|
47
|
-
type: type,
|
|
48
|
-
number: card_number,
|
|
49
|
-
expiry_month: card_expiry_month,
|
|
50
|
-
expiry_year: card_expiry_year,
|
|
51
|
-
name: card_name,
|
|
52
|
-
cvv: card_cvv,
|
|
53
|
-
billing_address: {
|
|
54
|
-
address_line1: billing_address_line1,
|
|
55
|
-
address_line2: billing_address_line2,
|
|
56
|
-
city: billing_city,
|
|
57
|
-
state: billing_state,
|
|
58
|
-
zip: billing_zip,
|
|
59
|
-
country: billing_country
|
|
60
|
-
},
|
|
61
|
-
phone: {
|
|
62
|
-
country_code: phone_country_code,
|
|
63
|
-
number: phone_number
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
end
|
|
67
|
-
end
|
data/lib/checkout_sdk/version.rb
DELETED
data/lib/checkout_sdk.rb
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
require "checkout_sdk/configuration"
|
|
2
|
-
require "checkout_sdk/api_resource"
|
|
3
|
-
require "checkout_sdk/data/capture_payment"
|
|
4
|
-
require "checkout_sdk/data/payment_request_source"
|
|
5
|
-
|
|
6
|
-
module CheckoutSdk
|
|
7
|
-
class << self
|
|
8
|
-
attr_accessor :configuration
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def self.configuration
|
|
12
|
-
@configuration ||= Configuration.new
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def self.reset
|
|
16
|
-
@configuration = Configuration.new
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def self.configure
|
|
20
|
-
yield(configuration)
|
|
21
|
-
end
|
|
22
|
-
end
|