spook_and_pay 0.2.8.alpha → 0.2.9.alpha

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: f70f586a365434836344fda5f592ed44905cbb09
4
- data.tar.gz: 4749a977febe88ac2c2f4ea1b9cfc72f5da3eada
3
+ metadata.gz: 8dec687c5fd56572521f9a67215cafe750ddd734
4
+ data.tar.gz: 37fa7c477662ceb7a209c28c322d48f16a6324c3
5
5
  SHA512:
6
- metadata.gz: 735b374fc353bfd752d89622d0e237ce408c1998613eeaa9e59412558da1c63395060decd0edbc910a80e35f0e2b24351deac5e54abc4552fe4eb1663db10f71
7
- data.tar.gz: 813e6179d99ba8a8cf4a79120b08d3226c4dc80fe17300e8994062a8588a71c9bb65e9fbf5d0dcd9fcc0b48e803d45734d9945e02aa0727a3c1cd8752b82884c
6
+ metadata.gz: 1c7c9dfebbd6c024fd3ed9bf510a0fd3fbd694c64bd5df1bb547a09668983cb6d1903fd552b7343a374297b9b9cbe4aedd8c45927a6d37b4605fa2e9fc353703
7
+ data.tar.gz: 6a3fa4db6c39514f9bd2982b819cc45a0b85a87fe598e1b03c0f7e94801e42d18cb279995009e3f44853b6c986ba90ded10bb6e057c9eb437dadf2da6b890cd2
@@ -134,9 +134,9 @@ module SpookAndPay
134
134
  "81712" => [:credit_card, :invalid, :expiration_month],
135
135
  "81713" => [:credit_card, :invalid, :expiration_year],
136
136
  "81707" => [:credit_card, :invalid, :cvv],
137
- "91507" => [:transaction, :cannot_capture, :status],
138
- "91506" => [:transaction, :cannot_refund, :status],
139
- "91504" => [:transaction, :cannot_void, :status]
137
+ "91507" => [:transaction, :cannot_capture, :transaction],
138
+ "91506" => [:transaction, :cannot_refund, :transaction],
139
+ "91504" => [:transaction, :cannot_void, :transaction]
140
140
  }.freeze
141
141
 
142
142
  # Extracts errors from the collection returned by Brain tree and coerces
@@ -248,8 +248,13 @@ module SpookAndPay
248
248
  #
249
249
  # @param Spreedly::Transaction result
250
250
  # @return Array<SpookAndPay::SubmissionError>
251
+ # @todo Expand this to handle different errors
251
252
  def extract_transaction_errors(result)
252
- []
253
+ if result.succeeded
254
+ []
255
+ else
256
+ [SubmissionError.new(:transaction, :card_declined, :transaction, result.message)]
257
+ end
253
258
  end
254
259
 
255
260
  # Takes the response generated by the Spreedly lib and coerces it into a
@@ -28,7 +28,8 @@ module SpookAndPay
28
28
  :transaction => {
29
29
  :cannot_capture => "must be authorized in order to capture funds",
30
30
  :cannot_refund => "must be settled in order to refund",
31
- :cannot_void => "must be authorized or settled in order to void"
31
+ :cannot_void => "must be authorized or settled in order to void",
32
+ :card_declined => "cannot process transaction; card has been declined"
32
33
  },
33
34
  :unknown => {
34
35
  :unknown => "please refer to the #raw attribute of this error"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spook_and_pay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8.alpha
4
+ version: 0.2.9.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Sutton
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-01-26 00:00:00.000000000 Z
12
+ date: 2014-01-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: braintree