paysio 1.0.4 → 1.0.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.
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/lib/paysio/actions/destroy.rb +1 -1
- data/lib/paysio/resources/charge.rb +5 -0
- data/lib/paysio/resources/coupon.rb +5 -0
- data/lib/paysio/version.rb +1 -1
- data/spec/resources/charge_spec.rb +18 -0
- data/spec/resources/coupon_spec.rb +9 -0
- data/spec/resources/customer_spec.rb +1 -0
- data/spec/resources/log_spec.rb +8 -0
- data/spec/resources/reward_spec.rb +1 -0
- data/spec/resources/wallet_spec.rb +1 -0
- data/spec/support/paysio_responses.rb +5 -0
- data/spec/support/test_matchers.rb +11 -0
- metadata +2 -2
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.5
|
@@ -10,5 +10,10 @@ module Paysio
|
|
10
10
|
response = Paysio::Client.request(:post, action_path(:refund), attrs)
|
11
11
|
refresh_from(response.to_hash)
|
12
12
|
end
|
13
|
+
|
14
|
+
def invoice
|
15
|
+
response = Paysio::Client.request(:get, action_path(:invoice))
|
16
|
+
Resource.build_from(response.to_hash)
|
17
|
+
end
|
13
18
|
end
|
14
19
|
end
|
data/lib/paysio/version.rb
CHANGED
@@ -10,4 +10,22 @@ describe Paysio::Charge do
|
|
10
10
|
c = Paysio::Charge.create
|
11
11
|
c.should be_a_kind_of(Paysio::Charge)
|
12
12
|
end
|
13
|
+
|
14
|
+
it "should be refundable" do
|
15
|
+
client = authorized_paysio_client
|
16
|
+
|
17
|
+
client.expects(:get).once.returns(test_response(test_charge))
|
18
|
+
client.expects(:post).once.returns(test_response(test_charge))
|
19
|
+
c = Paysio::Charge.retrieve('test_id')
|
20
|
+
c.refund
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should have an invoice" do
|
24
|
+
client = authorized_paysio_client
|
25
|
+
|
26
|
+
client.expects(:get).twice.returns(test_response(test_charge))
|
27
|
+
c = Paysio::Charge.retrieve('test_id')
|
28
|
+
invoice = c.invoice
|
29
|
+
invoice.should be_a_kind_of(Paysio::Charge)
|
30
|
+
end
|
13
31
|
end
|
@@ -2,6 +2,7 @@ require 'spec_helper'
|
|
2
2
|
describe Paysio::Coupon do
|
3
3
|
it { should be_listable_resource }
|
4
4
|
it { should be_updatable_resource }
|
5
|
+
it { should be_deleteable_resource }
|
5
6
|
|
6
7
|
it "should return coupon on create" do
|
7
8
|
client = authorized_paysio_client
|
@@ -10,4 +11,12 @@ describe Paysio::Coupon do
|
|
10
11
|
c = Paysio::Coupon.create
|
11
12
|
c.should be_a_kind_of(Paysio::Coupon)
|
12
13
|
end
|
14
|
+
|
15
|
+
it "should return coupon while checking code" do
|
16
|
+
client = authorized_paysio_client
|
17
|
+
|
18
|
+
client.expects(:get).once.returns(test_response(test_coupon))
|
19
|
+
c = Paysio::Coupon.check('test_code')
|
20
|
+
c.should be_a_kind_of(Paysio::Coupon)
|
21
|
+
end
|
13
22
|
end
|
data/spec/resources/log_spec.rb
CHANGED
@@ -1,4 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
describe Paysio::Log do
|
3
3
|
it { should be_listable_resource }
|
4
|
+
|
5
|
+
it "should have request post params" do
|
6
|
+
client = authorized_paysio_client
|
7
|
+
|
8
|
+
client.expects(:get).once.returns(test_response(test_log))
|
9
|
+
c = Paysio::Log.retrieve('someid')
|
10
|
+
c.request_post_params.should_not be_blank
|
11
|
+
end
|
4
12
|
end
|
@@ -32,6 +32,7 @@
|
|
32
32
|
def test_charge(params={})
|
33
33
|
{
|
34
34
|
:object => 'charge',
|
35
|
+
:id => "ch_BFyI4KoDVHzsfNoXpi4",
|
35
36
|
:merchant_id => 'm_12345',
|
36
37
|
:amount => 100,
|
37
38
|
:fee => 10,
|
@@ -88,6 +89,10 @@
|
|
88
89
|
:object => 'log',
|
89
90
|
:request_url => 'http://example.com',
|
90
91
|
:request_ip => '127.0.0.1',
|
92
|
+
:request_post_params => {
|
93
|
+
:email => "test@test.ru",
|
94
|
+
:description => "Test customer"
|
95
|
+
},
|
91
96
|
:livemode => false
|
92
97
|
}.merge(params)
|
93
98
|
end
|
@@ -24,4 +24,15 @@ RSpec::Matchers.define :be_updatable_resource do |expected|
|
|
24
24
|
c.save
|
25
25
|
c.name.should == "bar"
|
26
26
|
end
|
27
|
+
end
|
28
|
+
RSpec::Matchers.define :be_deleteable_resource do |expected|
|
29
|
+
match do |actual|
|
30
|
+
client = authorized_paysio_client
|
31
|
+
subject = actual.class
|
32
|
+
|
33
|
+
client.expects(:get).once.returns(test_response(test_customer({name: "foo"})))
|
34
|
+
client.expects(:delete).once.returns(test_response(test_customer({name: "bar"})))
|
35
|
+
c = subject.retrieve("resource_id")
|
36
|
+
c.delete
|
37
|
+
end
|
27
38
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paysio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|