fat_zebra 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/fat_zebra/models/base.rb +2 -0
- data/lib/fat_zebra/models/purchase.rb +1 -1
- data/lib/fat_zebra/models/refund.rb +1 -1
- data/lib/fat_zebra/models/response.rb +3 -1
- data/lib/fat_zebra/version.rb +1 -1
- data/spec/models/purchase_spec.rb +31 -3
- data/spec/models/response_spec.rb +21 -1
- metadata +16 -16
@@ -2,7 +2,7 @@ module FatZebra
|
|
2
2
|
module Models
|
3
3
|
class Purchase < Base
|
4
4
|
attribute :id, :amount, :reference, :message, :authorization, :transaction_id, :card_number,
|
5
|
-
:card_holder, :card_expiry, :authorized, :successful
|
5
|
+
:card_holder, :card_expiry, :authorized, :successful, :card_token, :raw
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module FatZebra
|
2
2
|
module Models
|
3
3
|
class Refund < Base
|
4
|
-
attribute :amount, :reference, :refunded, :id, :message, :transaction_id, :original_transaction_id
|
4
|
+
attribute :amount, :reference, :refunded, :id, :message, :transaction_id, :original_transaction_id, :raw
|
5
5
|
|
6
6
|
def original_transaction
|
7
7
|
@original_transaction ||= Purchase.find(self.original_transaction_id)
|
@@ -1,11 +1,13 @@
|
|
1
1
|
module FatZebra
|
2
2
|
module Models
|
3
3
|
class Response
|
4
|
-
attr_accessor :successful, :result, :errors, :test
|
4
|
+
attr_accessor :successful, :result, :errors, :test, :raw
|
5
5
|
def initialize(response, type = :purchase)
|
6
|
+
self.raw = response.dup
|
6
7
|
self.test = response["test"]
|
7
8
|
self.successful = response["successful"]
|
8
9
|
self.errors = response["errors"]
|
10
|
+
|
9
11
|
case type
|
10
12
|
when :purchase
|
11
13
|
self.result = Purchase.new(response["response"])
|
data/lib/fat_zebra/version.rb
CHANGED
@@ -1,9 +1,37 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe FatZebra::Models::Purchase do
|
4
|
-
|
4
|
+
it "should make the raw response available" do
|
5
|
+
response = {
|
6
|
+
"authorization" => "55355",
|
7
|
+
"id" => "001-P-12345AA",
|
8
|
+
"card_number" => "XXXXXXXXXXXX1111",
|
9
|
+
"card_holder" => "John Smith",
|
10
|
+
"card_expiry" => "10/2011",
|
11
|
+
"card_token" => "a1bhj98j",
|
12
|
+
"amount" => 349,
|
13
|
+
"authorized" => true,
|
14
|
+
"reference" => "ABC123",
|
15
|
+
"message" => "Approved"
|
16
|
+
}
|
17
|
+
r = FatZebra::Models::Purchase.new(response)
|
18
|
+
r.raw.should == response
|
19
|
+
end
|
5
20
|
|
6
|
-
it "should be
|
7
|
-
|
21
|
+
it "should be possible to access the token" do
|
22
|
+
response = {
|
23
|
+
"authorization" => "55355",
|
24
|
+
"id" => "001-P-12345AA",
|
25
|
+
"card_number" => "XXXXXXXXXXXX1111",
|
26
|
+
"card_holder" => "John Smith",
|
27
|
+
"card_expiry" => "10/2011",
|
28
|
+
"card_token" => "a1bhj98j",
|
29
|
+
"amount" => 349,
|
30
|
+
"authorized" => true,
|
31
|
+
"reference" => "ABC123",
|
32
|
+
"message" => "Approved"
|
33
|
+
}
|
34
|
+
r = FatZebra::Models::Purchase.new(response)
|
35
|
+
r.card_token.should == "a1bhj98j"
|
8
36
|
end
|
9
37
|
end
|
@@ -1,5 +1,25 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe FatZebra::Models::Response do
|
4
|
-
|
4
|
+
it "should make the raw response available" do
|
5
|
+
response = {
|
6
|
+
"successful" => true,
|
7
|
+
"errors" => [],
|
8
|
+
"test" => false,
|
9
|
+
"response" => {
|
10
|
+
"authorization" => "55355",
|
11
|
+
"id" => "001-P-12345AA",
|
12
|
+
"card_number" => "XXXXXXXXXXXX1111",
|
13
|
+
"card_holder" => "John Smith",
|
14
|
+
"card_expiry" => "10/2011",
|
15
|
+
"card_token" => "a1bhj98j",
|
16
|
+
"amount" => 349,
|
17
|
+
"authorized" => true,
|
18
|
+
"reference" => "ABC123",
|
19
|
+
"message" => "Approved"
|
20
|
+
}
|
21
|
+
}
|
22
|
+
r = FatZebra::Models::Response.new(response)
|
23
|
+
r.raw.should == response
|
24
|
+
end
|
5
25
|
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: 1.0.
|
4
|
+
version: 1.0.2
|
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-
|
12
|
+
date: 2012-05-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70212724986440 !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: *
|
24
|
+
version_requirements: *70212724986440
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70212724985820 !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: *
|
35
|
+
version_requirements: *70212724985820
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: yard
|
38
|
-
requirement: &
|
38
|
+
requirement: &70212724985040 !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: *
|
46
|
+
version_requirements: *70212724985040
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: yard-tomdoc
|
49
|
-
requirement: &
|
49
|
+
requirement: &70212724984080 !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: *
|
57
|
+
version_requirements: *70212724984080
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rest-client
|
60
|
-
requirement: &
|
60
|
+
requirement: &70212724983620 !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: *
|
68
|
+
version_requirements: *70212724983620
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: json
|
71
|
-
requirement: &
|
71
|
+
requirement: &70212724982560 !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: *
|
79
|
+
version_requirements: *70212724982560
|
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:
|
@@ -120,7 +120,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
120
120
|
version: '0'
|
121
121
|
segments:
|
122
122
|
- 0
|
123
|
-
hash: -
|
123
|
+
hash: -4020829074121266006
|
124
124
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
125
|
none: false
|
126
126
|
requirements:
|
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
129
|
version: '0'
|
130
130
|
segments:
|
131
131
|
- 0
|
132
|
-
hash: -
|
132
|
+
hash: -4020829074121266006
|
133
133
|
requirements: []
|
134
134
|
rubyforge_project: fat_zebra
|
135
135
|
rubygems_version: 1.8.10
|