vaulted_billing 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -46,7 +46,7 @@ module VaultedBilling
46
46
  raise NotImplementedError
47
47
  end
48
48
 
49
- def refund(transaction_id, amount)
49
+ def refund(transaction_id, amount, options = {})
50
50
  raise NotImplementedError
51
51
  end
52
52
 
@@ -139,11 +139,14 @@ module VaultedBilling
139
139
  respond_with(new_transaction_from_response(result.body), result, :success => result.success?)
140
140
  end
141
141
 
142
- def refund(transaction_id, amount)
142
+ def refund(transaction_id, amount, options = {})
143
143
  result = post_data(build_request('createCustomerProfileTransactionRequest') { |xml|
144
144
  xml.transaction do
145
145
  xml.profileTransRefund do
146
146
  xml.amount amount
147
+ xml.customerProfileId options[:customer_vault_id] if options[:customer_vault_id]
148
+ xml.customerPaymentProfileId options[:credit_card_vault_id] if options[:credit_card_vault_id]
149
+ xml.creditCardNumberMasked mask_card_number(options[:masked_card_number]) if options[:masked_card_number]
147
150
  xml.transId transaction_id
148
151
  end
149
152
  end
@@ -241,7 +244,8 @@ module VaultedBilling
241
244
  :cvv_response => direct_response['cvv_response'],
242
245
  :authcode => direct_response['approval_code'],
243
246
  :message => direct_response['message'] || response[root]['messages']['text'],
244
- :code => response[root]['messages']['code']
247
+ :code => response[root]['messages']['code'],
248
+ :masked_card_number => direct_response['masked_card_number']
245
249
  })
246
250
  end
247
251
 
@@ -253,7 +257,8 @@ module VaultedBilling
253
257
  'approval_code' => fields[4],
254
258
  'avs_response' => fields[5],
255
259
  'transaction_id' => fields[6],
256
- 'cvv_response' => fields[39]
260
+ 'cvv_response' => fields[39],
261
+ 'masked_card_number' => fields[50]
257
262
  }
258
263
  end
259
264
 
@@ -269,6 +274,10 @@ module VaultedBilling
269
274
  end
270
275
  end
271
276
 
277
+ def mask_card_number(input)
278
+ "XXXX%04d" % [input.to_s[-4..-1].to_i]
279
+ end
280
+
272
281
  end
273
282
 
274
283
  end
@@ -48,7 +48,7 @@ module VaultedBilling
48
48
  transaction_response
49
49
  end
50
50
 
51
- def refund(transaction_id, amount)
51
+ def refund(transaction_id, amount, options = {})
52
52
  transaction_response
53
53
  end
54
54
 
@@ -63,7 +63,8 @@ module VaultedBilling
63
63
  def transaction_response
64
64
  respond_with VaultedBilling::Transaction.new({
65
65
  :id => new_identifier,
66
- :authcode => new_identifier[0..5]
66
+ :authcode => new_identifier[0..5],
67
+ :masked_card_number => "XXXX%04d" % [rand(9999)]
67
68
  })
68
69
  end
69
70
  end
@@ -102,7 +102,7 @@ module VaultedBilling
102
102
  :success => response.success?)
103
103
  end
104
104
 
105
- def refund(transaction_id, amount)
105
+ def refund(transaction_id, amount, options = {})
106
106
  response = post_data(transaction_data('refund', {
107
107
  :transactionid => transaction_id,
108
108
  :amount => amount
@@ -6,6 +6,7 @@ module VaultedBilling
6
6
  attr_accessor :cvv_response
7
7
  attr_accessor :code
8
8
  attr_accessor :message
9
+ attr_accessor :masked_card_number
9
10
 
10
11
  def initialize(attributes = {})
11
12
  attributes.each_pair do |key, value|
@@ -1,3 +1,3 @@
1
1
  module VaultedBilling
2
- Version = '0.0.12'
2
+ Version = '0.0.13'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vaulted_billing
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 12
10
- version: 0.0.12
9
+ - 13
10
+ version: 0.0.13
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nathaniel Bibler
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-18 00:00:00 -05:00
18
+ date: 2010-12-21 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency