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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ac6690b547bc6f8abdf629d5a817bfbd700bdc1a
4
- data.tar.gz: 197465a04a77caf3959f15db5623287b354ee606
3
+ metadata.gz: 2c2b7e6fac3c099e5034ba64d529c37342f799b1
4
+ data.tar.gz: 7bf98dce94a89051f901951ab1dfff42bdeddbaf
5
5
  SHA512:
6
- metadata.gz: bc643efd7d883271fad97c5676eb242ae13d31aa297bf32ee7d74684edb2cc349a9b7cad6cc02c2029110f42bff0f9b8aa9133b5f0caf5115c00331cf2f3a063
7
- data.tar.gz: 83d15d219ada178c7f80ff6ceb6cf0f89d702a56ea91fba41ca800765baf7d600b36ec956f947a06d6610af96108e6919780e6a4499a70fb9dcf0196218137c7
6
+ metadata.gz: 2357800442e0a624d9888a82daebd7a0b0bcf228975829b99c3ba9a1a5a47cb91e2cb50123260382d7d5c83afae1d3c6f16fa7bca49f2416dd48bb38d0262f09
7
+ data.tar.gz: f7b45f0021abfdf0748270936c5696cc5be9ed820b6d631d77a2b88e84df901c742086249c27bc687d9f4f2263e2d5552270807724e881bc28ed9dfbc0b71e38
@@ -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
@@ -7,14 +7,11 @@ require 'hashie'
7
7
  module Twoctwop
8
8
  class Request
9
9
 
10
- attr_accessor :data, :env, :digest, :token
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
- ENDPOINT[env]
25
+ Twoctwop::Config.endpoint
30
26
  end
31
27
 
32
28
  def payload
@@ -1,3 +1,3 @@
1
1
  module Twoctwop
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -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'))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twoctwop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zack Siri