epayco 0.0.2 → 0.0.3

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: 59c1d40737d331f1db43c7b2ebdcc5ae8425dc4d
4
- data.tar.gz: 973e398e92b645039f094fc09d06102fe8e9108d
3
+ metadata.gz: 83f846a095ec38a811ce0f43fa044b2f40f41b2b
4
+ data.tar.gz: 95dad0eac388a598f6f485d537e0a94cf98b8e14
5
5
  SHA512:
6
- metadata.gz: 97fe3572f5af14e5ba2e85f29e3c442fe56a74f87d5829e44844b323dbedfd88b2c6c48be71ca8426e9363f1ae0c6678877f7c2f30e898f7dc61fbe7400274c4
7
- data.tar.gz: cceabb52c2cf7cceadfff83e0ea61af12efed71bcaabc6587d23378167678dca72689e4c927d9bccfa6effe00bd89046c9b5a4f9361f7842775206b7c186e269
6
+ metadata.gz: f2d49afb8d96ec5fe879ff318f96082159fa7e9751517d3d57a4f9caab4e54e4a6123ae60a16b871df622d3dcbadf0c9ba7f086972a282d3c0b9b8613a640d86
7
+ data.tar.gz: be615d8473a1b1860f8d3ff3429dbe537cff991f9e392f39c3d681a3227b6685757b6a3939997466ad4f8ddd1c8552dbbfc7e886a3d284aed0f1cb0c6ad344ea
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/README.md CHANGED
@@ -24,6 +24,8 @@ Make sure to set `EPAYCO_PUBLIC_KEY` and `EPAYCO_PRIVATE_KEY` in your environeme
24
24
  ```ruby
25
25
  EPayCo.public_key = ENV['EPAYCO_PUBLIC_KEY']
26
26
  EPayCo.private_key = ENV['EPAYCO_PRIVATE_KEY']
27
+ EPayCo.test_mode = true # Indicates if the payments requests will be done in Test Mode (default: false)
28
+
27
29
  ```
28
30
 
29
31
  Multiple tokens or multithreaded usage:
@@ -27,9 +27,9 @@ module EPayCo
27
27
  # @example Success
28
28
  #
29
29
  def charge_create(options={})
30
- path = "/recurring/v1/charge/create"
30
+ path = "/payment/v1/charge/create"
31
31
  response_options = { return_object: 'data' }
32
- post(path, options.merge(public_key: public_key), response_options)
32
+ post(path, options.merge(public_key: public_key, test: test_mode), response_options)
33
33
  end
34
34
  end
35
35
  end
@@ -26,7 +26,7 @@ module EPayCo
26
26
  # }
27
27
  # ]
28
28
  def customer_all(params={})
29
- path = "/recurring/v1/customers/#{public_key}"
29
+ path = "/payment/v1/customers/#{public_key}"
30
30
  response_options = { return_object: true }
31
31
  get(path, params, response_options)
32
32
  end
@@ -49,7 +49,7 @@ module EPayCo
49
49
  # "token": "ZdTo2WFZEH9r3HC7N"
50
50
  # }
51
51
  def customer_create(options={})
52
- path = "/recurring/v1/customer/create"
52
+ path = "/payment/v1/customer/create"
53
53
  response_options = { return_object: 'data' }
54
54
  post(path, options.merge(public_key: public_key), response_options)
55
55
  end
@@ -12,7 +12,8 @@ module EPayCo
12
12
  :connection_options,
13
13
  :endpoint,
14
14
  :proxy,
15
- :user_agent
15
+ :user_agent,
16
+ :test_mode
16
17
  ].freeze
17
18
 
18
19
  # By default, don't set a user public key
@@ -40,6 +41,9 @@ module EPayCo
40
41
  # The user agent that will be sent to the API endpoint if none is set
41
42
  DEFAULT_USER_AGENT = "EPayCo Ruby Gem #{EPayCo::VERSION}".freeze
42
43
 
44
+ # Test param that will be send in the POST requets
45
+ DEFAULT_TEST_MODE = false
46
+
43
47
  # @private
44
48
  attr_accessor *VALID_OPTIONS_KEYS
45
49
 
@@ -62,13 +66,14 @@ module EPayCo
62
66
 
63
67
  # Reset all configuration options to defaults
64
68
  def reset
65
- self.public_key = DEFAULT_PUBLIC_KEY
66
- self.private_key = DEFAULT_PRIVATE_KEY
69
+ self.public_key = DEFAULT_PUBLIC_KEY
70
+ self.private_key = DEFAULT_PRIVATE_KEY
67
71
  self.adapter = DEFAULT_ADAPTER
68
72
  self.connection_options = DEFAULT_CONNECTION_OPTIONS
69
73
  self.endpoint = DEFAULT_ENDPOINT
70
74
  self.proxy = DEFAULT_PROXY
71
75
  self.user_agent = DEFAULT_USER_AGENT
76
+ self.test_mode = DEFAULT_TEST_MODE
72
77
  end
73
78
  end
74
79
  end
@@ -1,3 +1,3 @@
1
1
  module EPayCo
2
- VERSION = '0.0.2'.freeze unless defined?(::EPayCo::VERSION)
2
+ VERSION = '0.0.3'.freeze unless defined?(::EPayCo::VERSION)
3
3
  end
@@ -1,8 +1,8 @@
1
1
  require File.expand_path('../../../spec_helper', __FILE__)
2
2
 
3
3
  describe EPayCo::Client do
4
- let(:public_key){ '111111111111111' }
5
- let(:private_key){ '222222222222222' }
4
+ let(:public_key){ '1111111aaa11111111' }
5
+ let(:private_key){ '2222222bbb22222222' }
6
6
  let(:client) { EPayCo::Client.new(:public_key => public_key, :private_key => private_key) }
7
7
 
8
8
  # TODO: Make tests for erros
@@ -27,13 +27,13 @@ describe EPayCo::Client do
27
27
  } }
28
28
 
29
29
  before do
30
- stub_post("recurring/v1/charge/create").
31
- with(:headers => {'Accept'=>'application/json; charset=utf-8;', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>'EPayCo Ruby Gem 0.0.1'}).
30
+ stub_post("payment/v1/charge/create").
31
+ with(:headers => {'Accept'=>'application/json; charset=utf-8;', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>"EPayCo Ruby Gem #{EPayCo::VERSION}"}).
32
32
  to_return(:status => 200, :body => fixture("charge_create.json"), :headers => {:content_type => "application/json;"})
33
33
  @response = client.charge_create(charge_params)
34
34
  end
35
35
 
36
- it { expect(a_post("recurring/v1/charge/create")).to have_been_made }
36
+ it { expect(a_post("payment/v1/charge/create")).to have_been_made }
37
37
  it { expect(@response).to be_a(Hashie::Mash) }
38
38
  it { expect(@response.status).to eq "Creado" }
39
39
  end
@@ -7,13 +7,13 @@ describe EPayCo::Client do
7
7
 
8
8
  describe ".customer_all" do
9
9
  before do
10
- stub_get("recurring/v1/customers/#{public_key}").
11
- with(:headers => {'Accept'=>'application/json; charset=utf-8;', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>'EPayCo Ruby Gem 0.0.1'}).
10
+ stub_get("payment/v1/customers/#{public_key}").
11
+ with(:headers => {'Accept'=>'application/json; charset=utf-8;', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>"EPayCo Ruby Gem #{EPayCo::VERSION}"}).
12
12
  to_return(:status => 200, :body => fixture("customer_all.json"), :headers => {:content_type => "application/json;"})
13
13
  @customers = client.customer_all
14
14
  end
15
15
 
16
- it { expect(a_get("recurring/v1/customers/#{public_key}")).to have_been_made }
16
+ it { expect(a_get("payment/v1/customers/#{public_key}")).to have_been_made }
17
17
  it { expect(@customers).to be_an(Array) }
18
18
  it { expect(@customers.size).to eq 2 }
19
19
  it { expect(@customers.first.id_customer).to eq "PKEMb9wfxQjttGeP" }
@@ -30,13 +30,13 @@ describe EPayCo::Client do
30
30
  } }
31
31
 
32
32
  before do
33
- stub_post("recurring/v1/customer/create").
34
- with(:headers => {'Accept'=>'application/json; charset=utf-8;', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>'EPayCo Ruby Gem 0.0.1'}).
33
+ stub_post("payment/v1/customer/create").
34
+ with(:headers => {'Accept'=>'application/json; charset=utf-8;', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>"EPayCo Ruby Gem #{EPayCo::VERSION}"}).
35
35
  to_return(:status => 200, :body => fixture("customer_create.json"), :headers => {:content_type => "application/json;"})
36
36
  @response = client.customer_create(customer_params)
37
37
  end
38
38
 
39
- it { expect(a_post("recurring/v1/customer/create")).to have_been_made }
39
+ it { expect(a_post("payment/v1/customer/create")).to have_been_made }
40
40
  it { expect(@response).to be_a(Hashie::Mash) }
41
41
  it { expect(@response.status).to eq "Creado" }
42
42
  end
@@ -8,7 +8,7 @@ describe EPayCo::Client do
8
8
  describe ".plan_all" do
9
9
  before do
10
10
  stub_get("recurring/v1/plans/#{public_key}").
11
- with(:headers => {'Accept'=>'application/json; charset=utf-8;', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>'EPayCo Ruby Gem 0.0.1'}).
11
+ with(:headers => {'Accept'=>'application/json; charset=utf-8;', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>"EPayCo Ruby Gem #{EPayCo::VERSION}"}).
12
12
  to_return(:status => 200, :body => fixture("plan_all.json"), :headers => {:content_type => "application/json;"})
13
13
  @plans = client.plan_all
14
14
  end
@@ -27,7 +27,7 @@ describe EPayCo::Client do
27
27
 
28
28
  before do
29
29
  stub_post("recurring/v1/plan/create").
30
- with(:headers => {'Accept'=>'application/json; charset=utf-8;', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>'EPayCo Ruby Gem 0.0.1'}).
30
+ with(:headers => {'Accept'=>'application/json; charset=utf-8;', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>"EPayCo Ruby Gem #{EPayCo::VERSION}"}).
31
31
  to_return(:status => 200, :body => fixture("plan_create.json"), :headers => {:content_type => "application/json;"})
32
32
  @response = client.plan_create(plan_params)
33
33
  end
@@ -41,7 +41,7 @@ describe EPayCo::Client do
41
41
  let(:plan_id) { "test" }
42
42
  before do
43
43
  stub_get("recurring/v1/plan/#{public_key}/#{plan_id}").
44
- with(:headers => {'Accept'=>'application/json; charset=utf-8;', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>'EPayCo Ruby Gem 0.0.1'}).
44
+ with(:headers => {'Accept'=>'application/json; charset=utf-8;', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>"EPayCo Ruby Gem #{EPayCo::VERSION}"}).
45
45
  to_return(:status => 200, :body => fixture("plan_details.json"), :headers => {:content_type => "application/json;"})
46
46
  @plan = client.plan_details(plan_id)
47
47
  end
@@ -59,7 +59,7 @@ describe EPayCo::Client do
59
59
  } }
60
60
  before do
61
61
  stub_put("recurring/v1/plan/edit/#{public_key}/#{plan_id}").
62
- with(:headers => {'Accept'=>'application/json; charset=utf-8;', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>'EPayCo Ruby Gem 0.0.1'}).
62
+ with(:headers => {'Accept'=>'application/json; charset=utf-8;', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>"EPayCo Ruby Gem #{EPayCo::VERSION}"}).
63
63
  to_return(:status => 200, :body => fixture("plan_update.json"), :headers => {:content_type => "application/json;"})
64
64
  @response = client.plan_update(plan_id, plan_params)
65
65
  end
@@ -8,7 +8,7 @@ describe EPayCo::Client do
8
8
  describe ".subscription_all" do
9
9
  before do
10
10
  stub_get("recurring/v1/subscriptions/#{public_key}").
11
- with(:headers => {'Accept'=>'application/json; charset=utf-8;', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>'EPayCo Ruby Gem 0.0.1'}).
11
+ with(:headers => {'Accept'=>'application/json; charset=utf-8;', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>"EPayCo Ruby Gem #{EPayCo::VERSION}"}).
12
12
  to_return(:status => 200, :body => fixture("subscription_all.json"), :headers => {:content_type => "application/json;"})
13
13
  @subscriptions = client.subscription_all
14
14
  end
@@ -28,7 +28,7 @@ describe EPayCo::Client do
28
28
 
29
29
  before do
30
30
  stub_post("recurring/v1/subscription/create").
31
- with(:headers => {'Accept'=>'application/json; charset=utf-8;', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>'EPayCo Ruby Gem 0.0.1'}).
31
+ with(:headers => {'Accept'=>'application/json; charset=utf-8;', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>"EPayCo Ruby Gem #{EPayCo::VERSION}"}).
32
32
  to_return(:status => 200, :body => fixture("subscription_create.json"), :headers => {:content_type => "application/json;"})
33
33
  @response = client.subscription_create(subscription_params)
34
34
  end
@@ -42,7 +42,7 @@ describe EPayCo::Client do
42
42
  let(:subscription_id) { "test" }
43
43
  before do
44
44
  stub_get("recurring/v1/subscription/#{subscription_id}/#{public_key}").
45
- with(:headers => {'Accept'=>'application/json; charset=utf-8;', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>'EPayCo Ruby Gem 0.0.1'}).
45
+ with(:headers => {'Accept'=>'application/json; charset=utf-8;', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>"EPayCo Ruby Gem #{EPayCo::VERSION}"}).
46
46
  to_return(:status => 200, :body => fixture("subscription_create.json"), :headers => {:content_type => "application/json;"})
47
47
  @subscription = client.subscription_details(subscription_id)
48
48
  end
@@ -56,7 +56,7 @@ describe EPayCo::Client do
56
56
  let(:subscription_id) { "test" }
57
57
  before do
58
58
  stub_post("recurring/v1/subscription/cancel").
59
- with(:headers => {'Accept'=>'application/json; charset=utf-8;', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>'EPayCo Ruby Gem 0.0.1'}).
59
+ with(:headers => {'Accept'=>'application/json; charset=utf-8;', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>"EPayCo Ruby Gem #{EPayCo::VERSION}"}).
60
60
  to_return(:status => 200, :body => fixture("subscription_cancel.json"), :headers => {:content_type => "application/json;"})
61
61
  @response = client.subscription_cancel(subscription_id)
62
62
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epayco
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Moises Narvaez
metadata.gz.sig CHANGED
Binary file