twoctwop 0.1.4 → 0.1.5
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/twoctwop/config.rb +1 -11
- data/lib/twoctwop/request.rb +3 -7
- data/lib/twoctwop/version.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c2b7e6fac3c099e5034ba64d529c37342f799b1
|
4
|
+
data.tar.gz: 7bf98dce94a89051f901951ab1dfff42bdeddbaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2357800442e0a624d9888a82daebd7a0b0bcf228975829b99c3ba9a1a5a47cb91e2cb50123260382d7d5c83afae1d3c6f16fa7bca49f2416dd48bb38d0262f09
|
7
|
+
data.tar.gz: f7b45f0021abfdf0748270936c5696cc5be9ed820b6d631d77a2b88e84df901c742086249c27bc687d9f4f2263e2d5552270807724e881bc28ed9dfbc0b71e38
|
data/lib/twoctwop/config.rb
CHANGED
@@ -17,20 +17,10 @@ module Twoctwop
|
|
17
17
|
module Config
|
18
18
|
extend self
|
19
19
|
|
20
|
-
attr_accessor :merchant_id, :secret_key, :private_key, :certificate, :passphrase
|
20
|
+
attr_accessor :merchant_id, :secret_key, :private_key, :certificate, :passphrase, :endpoint
|
21
21
|
|
22
22
|
def configure
|
23
23
|
yield self
|
24
24
|
end
|
25
|
-
|
26
|
-
def env
|
27
|
-
@env ||= if defined? Rails
|
28
|
-
Rails.env
|
29
|
-
elsif ENV['RACK_ENV']
|
30
|
-
ENV['RACK_ENV']
|
31
|
-
else
|
32
|
-
'development'
|
33
|
-
end
|
34
|
-
end
|
35
25
|
end
|
36
26
|
end
|
data/lib/twoctwop/request.rb
CHANGED
@@ -7,14 +7,11 @@ require 'hashie'
|
|
7
7
|
module Twoctwop
|
8
8
|
class Request
|
9
9
|
|
10
|
-
attr_accessor :data, :
|
10
|
+
attr_accessor :data, :digest, :token
|
11
11
|
|
12
|
-
ENDPOINT = {
|
13
|
-
test: 'http://demo2.2c2p.com/2C2PFrontEnd/SecurePayment/Payment.aspx',
|
14
|
-
live: 'https://s.2c2p.com/SecurePayment/paymentauth.aspx'
|
15
|
-
}
|
16
12
|
|
17
13
|
def initialize(data: {}, token: nil)
|
14
|
+
raise "Set end point" if Twoctwop::Config.endpoint.nil?
|
18
15
|
raise "Merchant ID is nil" if Twoctwop::Config.merchant_id.nil?
|
19
16
|
raise "Secret key is nil" if Twoctwop::Config.secret_key.nil?
|
20
17
|
|
@@ -22,11 +19,10 @@ module Twoctwop
|
|
22
19
|
@digest = OpenSSL::Digest.new('sha1')
|
23
20
|
|
24
21
|
@data = data
|
25
|
-
@env = Twoctwop::Config.env == 'production' ? :live : :test
|
26
22
|
end
|
27
23
|
|
28
24
|
def endpoint
|
29
|
-
|
25
|
+
Twoctwop::Config.endpoint
|
30
26
|
end
|
31
27
|
|
32
28
|
def payload
|
data/lib/twoctwop/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -30,6 +30,7 @@ RSpec.configure do |config|
|
|
30
30
|
|
31
31
|
config.before(:all) do
|
32
32
|
Twoctwop::Config.configure do |c|
|
33
|
+
c.endpoint = 'https://s.2c2p.com/SecurePayment/paymentauth.aspx'
|
33
34
|
c.merchant_id = 'JT01'
|
34
35
|
c.secret_key = '7jYcp4FxFdf0'
|
35
36
|
c.private_key = File.read(File.join(config.certificate_path, 'demo2.pem'))
|