fat_zebra 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YjQwNDkxMDlhMzhjYmM0YTUxOWVjYjU5NDM1OGVlYjkwN2YwM2Q0YQ==
5
- data.tar.gz: !binary |-
6
- MjhmNjdkODhiMTE0MTcwODAzZWE0Y2ZlMDhlN2U5YjJlYzEyYWQzNw==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- N2RkZTcyYzliMTA1MmE5NzY5OGMwMzliYzZmYjFlOTczM2ZmYjNiNzE4NjJl
10
- YmViZTgwN2ZkNTNiN2RhOWExMmNmN2IzZTRkZGM0YzY3OWViNzRkNWFkZjQx
11
- MmI3ZTFhZjk2ODJhYWU3MWJhNjUzNGJmODFiMGU4MmU1MTU3MTE=
12
- data.tar.gz: !binary |-
13
- MjQ2NzA2N2ViNzI0YzQzYmJkNWQ0Mzc2MmFhMGJjZTE2NTFhZDY4YzMyNDI3
14
- OWY1MjFjOTBhNGNhNjA2NDQ4Mjg0ZGQ3ODM4ZjM5ZTJjNTBjYTE3NjIxOGZj
15
- MjI4NzY2M2JjM2M3NGI4MDg2OWFhOGE4YzEzNDVjMTBiNWM0NjM=
2
+ SHA1:
3
+ metadata.gz: 55ba03265cbd6993f4e0475096a419470df20121
4
+ data.tar.gz: 9f346b14d906f734c0af030407628107052e7352
5
+ SHA512:
6
+ metadata.gz: e9c0d698fd0bdb5664e2de293889e22a1acbd8dc8db63aae2eba432c3eedc99c5bd69555674ff837ba817276cc1ee64b2b6e75955cc4d6b45b46d47ff4f5d061
7
+ data.tar.gz: c1d213469e4fe0fb069484b37a27aa97229d64fd7078227903ffea27e20d6d3ca4883f9680f2e08f1270df2479cb74533e15199d65d824a5ddb1efa2db480f3e
data/.travis.yml CHANGED
@@ -1,5 +1,4 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.2
4
3
  - 1.9.3
5
- - 1.8.7
4
+ - 2.0.0
data/FatZebra.gemspec CHANGED
@@ -23,10 +23,9 @@ Gem::Specification.new do |s|
23
23
  s.add_development_dependency "rake"
24
24
  s.add_development_dependency "yard"
25
25
  s.add_development_dependency "yard-tomdoc"
26
- s.add_development_dependency "ZenTest"
27
26
 
28
27
 
29
28
  s.add_runtime_dependency "rest-client"
30
29
  s.add_runtime_dependency "json"
31
- s.add_runtime_dependency "activesupport"
30
+ s.add_runtime_dependency "activesupport", ">= 3.2"
32
31
  end
data/README.markdown CHANGED
@@ -8,7 +8,7 @@ A Ruby client for the [Fat Zebra](https://www.fatzebra.com.au) Online Payment Ga
8
8
  Dependencies
9
9
  ------------
10
10
 
11
- * Ruby (tested on 1.9.2, 1.9.3)
11
+ * Ruby (tested on 1.9.3, 2.0.0)
12
12
  * Rest Client
13
13
  * JSON
14
14
 
@@ -1,7 +1,7 @@
1
1
  module FatZebra
2
- module Models
3
- class Card < Base
4
- attribute :token, :card_holder, :card_number, :card_expiry, :transaction_count, :raw
2
+ module Models
3
+ class Card < Base
4
+ attribute :token, :card_holder, :card_number, :card_expiry, :transaction_count, :raw
5
5
 
6
6
  def successful; true; end
7
7
 
@@ -12,9 +12,10 @@ module FatZebra
12
12
  # @param [String] the card number
13
13
  # @param [String] the credit card expiry date (mm/yyyy)
14
14
  # @param [String] the card CVV
15
+ # @param [Hash] optional any additional data which should be merged into the request
15
16
  #
16
17
  # @return Response
17
- def create(card_holder, card_number, expiry, cvv)
18
+ def create(card_holder, card_number, expiry, cvv, optional = {})
18
19
  params = {
19
20
  :card_holder => card_holder,
20
21
  :card_number => card_number,
@@ -22,10 +23,12 @@ module FatZebra
22
23
  :cvv => cvv
23
24
  }
24
25
 
26
+ params.merge!(optional)
27
+
25
28
  response = FatZebra.gateway.make_request(:post, "credit_cards", params)
26
29
  Response.new(response, :card)
27
30
  end
28
31
  end
29
- end
32
+ end
30
33
  end
31
34
  end
@@ -1,9 +1,10 @@
1
1
  module FatZebra
2
2
  module Models
3
- class Purchase < Base
4
- attribute :id, :amount, :reference, :message, :authorization, :transaction_id, :card_number,
5
- :card_holder, :card_expiry, :authorized, :successful, :card_token, :currency, :raw
6
-
3
+ class Purchase < Base
4
+ attribute :id, :amount, :reference, :message, :authorization, :transaction_id, :card_number,
5
+ :card_holder, :card_expiry, :authorized, :successful, :card_token, :currency, :raw, :captured,
6
+ :response_code, :rrn, :cvv_match, :fraud_result, :fraud_messages
7
+
7
8
  # Refunds the current transaction
8
9
  #
9
10
  # @param [Integer] the amount to be refunded
@@ -14,6 +15,32 @@ module FatZebra
14
15
  Refund.create(self.id, amount, reference)
15
16
  end
16
17
 
18
+ # Returns the record as a Hash
19
+ #
20
+ # @return [Hash]
21
+ def to_hash
22
+ {
23
+ id: self.id,
24
+ amount: self.amount,
25
+ reference: self.reference,
26
+ message: self.message,
27
+ authorization: self.authorization,
28
+ card_number: self.card_number,
29
+ card_holder: self.card_holder,
30
+ card_expiry: self.card_expiry,
31
+ card_token: self.card_token,
32
+ currency: self.currency,
33
+ authorized: self.authorized,
34
+ successful: self.successful,
35
+ captured: self.captured,
36
+ response_code: self.response_code,
37
+ cvv_match: self.cvv_match,
38
+ rrn: self.rrn,
39
+ fraud_result: self.fraud_result,
40
+ fraud_messages: self.fraud_messages
41
+ }
42
+ end
43
+
17
44
  class << self
18
45
  # Performs a purchase transaction against the gateway
19
46
  #
@@ -26,9 +53,10 @@ module FatZebra
26
53
  # @param [String] a reference for the purchase
27
54
  # @param [String] the customers IP address (for fraud prevention)
28
55
  # @param [String] currency code ("AUD", "USD", etc)
56
+ # @param [Hash] optional any optional parameters to be included in the payload
29
57
  #
30
58
  # @return [Response] response (purchase) object
31
- def create(amount, card_data, reference, customer_ip, currency = "AUD")
59
+ def create(amount, card_data, reference, customer_ip, currency = "AUD", optional = {})
32
60
  params = {
33
61
  :amount => amount,
34
62
  :card_holder => card_data.delete(:card_holder),
@@ -43,6 +71,7 @@ module FatZebra
43
71
 
44
72
  params.delete_if {|key, value| value.nil? } # If token is nil, remove, otherwise, remove card values
45
73
  validate_params!(params)
74
+ params.merge!(optional)
46
75
  response = FatZebra.gateway.make_request(:post, "purchases", params)
47
76
  Response.new(response)
48
77
  end
@@ -50,13 +79,13 @@ module FatZebra
50
79
  # Retrieves purchases specified by the options hash
51
80
  #
52
81
  # @param [Hash] options for lookup
53
- # includes:
54
- # - id (unique purchase ID)
55
- # - reference (merchant reference)
56
- # - from (Date)
57
- # - to (Date)
58
- # - offset (defaults to 0) - for pagination
59
- # - limit (defaults to 10) for pagination
82
+ # @option options [String] id the unique purchase ID
83
+ # @option options [String] reference the merchant reference
84
+ # @option options [DateTime] from the start date to search from
85
+ # @option options [DateTime] to the end date time to search to
86
+ # @option options [Integer] offset the start page for pagination
87
+ # @option options [Integer] limit the maximum number of records to return in the query. Maximum 10
88
+ #
60
89
  # @return [Array<Purchase>] array of purchases
61
90
  def find(options = {})
62
91
  id = options.delete(:id)
@@ -123,6 +152,6 @@ module FatZebra
123
152
  raise FatZebra::RequestError.new("The following errors prevent the transaction from being submitted: #{@errors.to_sentence}") if @errors.any?
124
153
  end
125
154
  end
126
- end
155
+ end
127
156
  end
128
157
  end
@@ -1,3 +1,3 @@
1
1
  module FatZebra
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fat_zebra
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Savage
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-14 00:00:00.000000000 Z
11
+ date: 2014-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -66,20 +66,6 @@ dependencies:
66
66
  - - ! '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: ZenTest
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ! '>='
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ! '>='
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: rest-client
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -114,14 +100,14 @@ dependencies:
114
100
  requirements:
115
101
  - - ! '>='
116
102
  - !ruby/object:Gem::Version
117
- version: '0'
103
+ version: '3.2'
118
104
  type: :runtime
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
107
  requirements:
122
108
  - - ! '>='
123
109
  - !ruby/object:Gem::Version
124
- version: '0'
110
+ version: '3.2'
125
111
  description: Provides integration with the Fat Zebra internet payment gateway (www.fatzebra.com.au),
126
112
  including purchase, refund, auth, capture and recurring billing functionality.
127
113
  email:
@@ -174,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
160
  version: '0'
175
161
  requirements: []
176
162
  rubyforge_project: fat_zebra
177
- rubygems_version: 2.0.7
163
+ rubygems_version: 2.2.2
178
164
  signing_key:
179
165
  specification_version: 4
180
166
  summary: Fat Zebra payments gem - integrate your ruby app with Fat Zebra