fat_zebra 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -119,7 +119,14 @@ module FatZebra
119
119
  #
120
120
  # Returns a new FatZebra::Models::Refund object
121
121
  def refund(transaction_id, amount, reference)
122
- raise "Sorry we haven't compelted this functionality yet."
122
+ params = {
123
+ :transaction_id => transaction_id,
124
+ :amount => amount,
125
+ :reference => reference
126
+ }
127
+
128
+ response = make_request(:post, "refunds", params)
129
+ FatZebra::Models::Response.new(response, :refund)
123
130
  end
124
131
 
125
132
  # Public: Pings the Fat Zebra service
@@ -6,6 +6,11 @@ module FatZebra
6
6
  def original_transaction
7
7
  @original_transaction ||= Purchase.find(self.original_transaction_id)
8
8
  end
9
+
10
+ def successful
11
+ self.refunded == "Approved"
12
+ end
13
+ alias successful? successful
9
14
  end
10
15
  end
11
16
  end
@@ -1,3 +1,3 @@
1
1
  module FatZebra
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/spec/gateway_spec.rb CHANGED
@@ -35,7 +35,13 @@ describe FatZebra::Gateway do
35
35
  purchase.id.should == result.purchase.id
36
36
  end
37
37
 
38
- it "should fetch a purchase within a date range" do
39
-
38
+ it "should fetch a purchase within a date range"
39
+
40
+ it "should refund a transaction" do
41
+ purchase = @gw.purchase(10000, {:card_holder => "Matthew Savage", :number => "5555555555554444", :expiry => "05/2013", :cvv => 123}, "TES#{rand}T", "1.2.3.4")
42
+ result = @gw.refund(purchase.result.id, 100, "REFUND-#{purchase.result.id}")
43
+
44
+ result.should be_successful
45
+ result.result.successful.should be_true
40
46
  end
41
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fat_zebra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-19 00:00:00.000000000 Z
12
+ date: 2012-03-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70327095777060 !ruby/object:Gem::Requirement
16
+ requirement: &70248297866120 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70327095777060
24
+ version_requirements: *70248297866120
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &70327095774860 !ruby/object:Gem::Requirement
27
+ requirement: &70248297864400 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70327095774860
35
+ version_requirements: *70248297864400
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: yard
38
- requirement: &70327095773300 !ruby/object:Gem::Requirement
38
+ requirement: &70248297880140 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70327095773300
46
+ version_requirements: *70248297880140
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: yard-tomdoc
49
- requirement: &70327095789000 !ruby/object:Gem::Requirement
49
+ requirement: &70248297879680 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70327095789000
57
+ version_requirements: *70248297879680
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rest-client
60
- requirement: &70327095788460 !ruby/object:Gem::Requirement
60
+ requirement: &70248297879180 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70327095788460
68
+ version_requirements: *70248297879180
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: json
71
- requirement: &70327095788020 !ruby/object:Gem::Requirement
71
+ requirement: &70248297878720 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70327095788020
79
+ version_requirements: *70248297878720
80
80
  description: Provides integration with the Fat Zebra internet payment gateway (www.fatzebra.com.au),
81
81
  including purchase, refund, auth, capture and recurring billing functionality.
82
82
  email:
@@ -119,7 +119,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
119
  version: '0'
120
120
  segments:
121
121
  - 0
122
- hash: 4143126144046579510
122
+ hash: 4534837890112680284
123
123
  required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  none: false
125
125
  requirements:
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  version: '0'
129
129
  segments:
130
130
  - 0
131
- hash: 4143126144046579510
131
+ hash: 4534837890112680284
132
132
  requirements: []
133
133
  rubyforge_project: fat_zebra
134
134
  rubygems_version: 1.8.10