spook_and_pay 0.2.5.alpha → 0.2.6.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: 46ed8c4d7cbf61f27ef71681008b27989b1df658
4
- data.tar.gz: e84f21e30c73572af7ad94297d82cbe0c8066aa3
3
+ metadata.gz: 5b1ff796137c7a459d6b8757e56e8c9ea52b76e3
4
+ data.tar.gz: 8b3dc5f18685220533a8718177c945f0ba7eaa76
5
5
  SHA512:
6
- metadata.gz: 85f6533caa49af68efd8337e9f3336f106d44b8d47988e9dbe5445ea3b205ee4a88af40c0c119acac968f9de17ec40fe5d3e59202f7ae65293278a238f9f7a12
7
- data.tar.gz: b8747bfd8185267878d063b642bc9cc2e2ceebe810b2732261b189b70e062ae287838a68ba95f6329e9302af4965f19950bd3c61a6b61092f1d6e6c7081af168
6
+ metadata.gz: 168c68ae8c2a3fe771938fe39dc87d06134d83494ec9e863a0a2e0f91d795b2f6d3f15f57833c3277df9f2b1e7705a1182b7bf22b3858c94611def2482f33c8c
7
+ data.tar.gz: bdf338598dcc6f21327bad76f9c87b91e6b28dd9c7e288ae5ddaca8dfe8133580177935b0265b4fdf55b5d6abf34b0657142b748c681c5dcff6296b5774c4c46
@@ -132,6 +132,15 @@ module SpookAndPay
132
132
  raise NotImplementedError
133
133
  end
134
134
 
135
+ # Checks to see if voiding is supported. This is dependent on the payment
136
+ # provider. The default implementation simply returns true. Specific
137
+ # implementations should over-ride this method.
138
+ #
139
+ # @return [true, false]
140
+ def supports_void?
141
+ true
142
+ end
143
+
135
144
  # Voids an authorization.
136
145
  #
137
146
  # This should not be called directly. Instead, use the #void! method
@@ -108,6 +108,19 @@ module SpookAndPay
108
108
  coerce_result(result)
109
109
  end
110
110
 
111
+ # This is a nasty little trick that makes the spreedly gateway class
112
+ # store the characteristics XML fragment from the server.
113
+ #
114
+ # @todo In later versions this might not be necessary. When updating the
115
+ # spreedly gem, check it.
116
+ ::Spreedly::Gateway.send(:field, :characteristics)
117
+
118
+ def supports_void?
119
+ gateway = spreedly.find_gateway(gateway_token)
120
+ node = Nokogiri::XML::DocumentFragment.parse(gateway.characteristics)
121
+ node.xpath(".//supports_void").inner_html.strip == 'true'
122
+ end
123
+
111
124
  def authorize_via_credit_card(id, amount)
112
125
  result = spreedly.authorize_on_gateway(gateway_token, credit_card_id(id), amount.to_f * 100)
113
126
  coerce_result(result)
@@ -112,7 +112,7 @@ module SpookAndPay
112
112
  #
113
113
  # @return [true, false]
114
114
  def can_void?
115
- status == :authorized or status == :settling
115
+ (status == :authorized or status == :settling) and provider.supports_void?
116
116
  end
117
117
 
118
118
  # Refunds the transaction. The related credit card will be credited for
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.5.alpha
4
+ version: 0.2.6.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: 2013-12-02 00:00:00.000000000 Z
12
+ date: 2013-12-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: braintree