braintree 2.17.0 → 2.18.0

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.
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.homepage = "http://www.braintreepayments.com/"
12
12
  s.rubyforge_project = "braintree"
13
13
  s.has_rdoc = false
14
- s.files = Dir.glob ["README.rdoc", "LICENSE", "{lib,spec}/**/*.rb", "lib/**/*.crt", "*.gemspec"]
14
+ s.files = Dir.glob ["README.rdoc", "LICENSE", "lib/**/*.{rb,crt}", "spec/**/*", "*.gemspec"]
15
15
  s.add_dependency "builder", ">= 2.0.0"
16
16
  end
17
17
 
@@ -26,14 +26,45 @@ module Braintree
26
26
  US = "us"
27
27
  end
28
28
 
29
+ module Commercial
30
+ Yes = "Yes"
31
+ No = "No"
32
+ Unknown = "Unknown"
33
+ end
34
+
35
+ module Debit
36
+ Yes = "Yes"
37
+ No = "No"
38
+ Unknown = "Unknown"
39
+ end
40
+
41
+ module DurbinRegulated
42
+ Yes = "Yes"
43
+ No = "No"
44
+ Unknown = "Unknown"
45
+ end
46
+
47
+ module Healthcare
48
+ Yes = "Yes"
49
+ No = "No"
50
+ Unknown = "Unknown"
51
+ end
52
+
53
+ module Payroll
54
+ Yes = "Yes"
55
+ No = "No"
56
+ Unknown = "Unknown"
57
+ end
58
+
29
59
  module Prepaid
30
60
  Yes = "Yes"
31
61
  No = "No"
32
62
  Unknown = "Unknown"
33
63
  end
34
64
 
35
- attr_reader :billing_address, :bin, :card_type, :cardholder_name, :created_at, :customer_id, :expiration_month,
36
- :expiration_year, :last_4, :prepaid, :unique_number_identifier, :subscriptions, :token, :updated_at
65
+ attr_reader :billing_address, :bin, :card_type, :cardholder_name, :commercial, :created_at,
66
+ :customer_id, :debit, :durbin_regulated, :expiration_month, :expiration_year, :healthcare,
67
+ :last_4, :payroll, :prepaid, :subscriptions, :token, :unique_number_identifier, :updated_at
37
68
 
38
69
  # See http://www.braintreepayments.com/docs/ruby/credit_cards/create
39
70
  def self.create(attributes)
@@ -233,7 +264,8 @@ module Braintree
233
264
  def self._attributes # :nodoc:
234
265
  [
235
266
  :billing_address, :bin, :card_type, :cardholder_name, :created_at, :customer_id, :expiration_month,
236
- :expiration_year, :last_4, :token, :updated_at, :prepaid
267
+ :expiration_year, :last_4, :token, :updated_at, :prepaid, :payroll, :commercial, :debit, :durbin_regulated,
268
+ :healthcare
237
269
  ]
238
270
  end
239
271
 
@@ -42,7 +42,7 @@ module Braintree
42
42
  end
43
43
 
44
44
  def _build_xml(params)
45
- return nil if params.nil?
45
+ return "" if params.nil?
46
46
  Braintree::Xml.hash_to_xml params
47
47
  end
48
48
 
@@ -6,6 +6,17 @@ module Braintree
6
6
  #
7
7
  # See http://www.braintreepayments.com/docs/ruby/reference/sandbox
8
8
  module CreditCardNumbers
9
+ module CardTypeIndicators
10
+ Prepaid = "4111111111111210"
11
+ Commercial = "4111111111131010"
12
+ Payroll = "4111111114101010"
13
+ Healthcare = "4111111510101010"
14
+ DurbinRegulated = "4111161010101010"
15
+ Debit = "4117101010101010"
16
+ Unknown = "4111111111112101"
17
+ No = "4111111111310101"
18
+ end
19
+
9
20
  AmExes = %w[378282246310005 371449635398431 378734493671000]
10
21
  CarteBlanches = %w[30569309025904] # :nodoc:
11
22
  DinersClubs = %w[38520000023237] # :nodoc:
@@ -61,6 +61,7 @@ module Braintree
61
61
  # The response text from the processor.
62
62
  attr_reader :processor_response_text
63
63
  attr_reader :purchase_order_number
64
+ attr_reader :recurring
64
65
  attr_reader :refund_ids, :refunded_transaction_id
65
66
  attr_reader :settlement_batch_id
66
67
  # See Transaction::Status
@@ -100,7 +100,7 @@ module Braintree
100
100
  def self._create_signature # :nodoc:
101
101
  [
102
102
  :amount, :customer_id, :merchant_account_id, :order_id, :payment_method_token,
103
- :purchase_order_number, :shipping_address_id, :type, :tax_amount, :tax_exempt,
103
+ :purchase_order_number, :recurring, :shipping_address_id, :type, :tax_amount, :tax_exempt,
104
104
  {:credit_card => [:token, :cardholder_name, :cvv, :expiration_date, :expiration_month, :expiration_year, :number]},
105
105
  {:customer => [:id, :company, :email, :fax, :first_name, :last_name, :phone, :website]},
106
106
  {
@@ -1,7 +1,7 @@
1
1
  module Braintree
2
2
  module Version
3
3
  Major = 2
4
- Minor = 17
4
+ Minor = 18
5
5
  Tiny = 0
6
6
 
7
7
  String = "#{Major}.#{Minor}.#{Tiny}"
@@ -0,0 +1 @@
1
+ 91525
@@ -244,40 +244,112 @@ describe Braintree::CreditCard do
244
244
  Braintree::CreditCard.find(card1.token).should_not be_default
245
245
  end
246
246
 
247
- it "sets the prepaid field if the card is prepaid" do
248
- customer = Braintree::Customer.create!
249
- result = Braintree::CreditCard.create(
250
- :customer_id => customer.id,
251
- :number => Braintree::Test::CreditCardNumbers::VisaPrepaid,
252
- :expiration_date => "05/2014",
253
- :options => {:verify_card => true}
254
- )
255
- credit_card = result.credit_card
256
- credit_card.prepaid.should == Braintree::CreditCard::Prepaid::Yes
257
- end
247
+ context "card type indicators" do
248
+ it "sets the prepaid field if the card is prepaid" do
249
+ customer = Braintree::Customer.create!
250
+ result = Braintree::CreditCard.create(
251
+ :customer_id => customer.id,
252
+ :number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::Prepaid,
253
+ :expiration_date => "05/2014",
254
+ :options => {:verify_card => true}
255
+ )
256
+ credit_card = result.credit_card
257
+ credit_card.prepaid.should == Braintree::CreditCard::Prepaid::Yes
258
+ end
258
259
 
259
- it "sets negative card type identifiers" do
260
- customer = Braintree::Customer.create!
261
- result = Braintree::CreditCard.create(
262
- :customer_id => customer.id,
263
- :number => Braintree::Test::CreditCardNumbers::Visa,
264
- :expiration_date => "05/2014",
265
- :options => {:verify_card => true}
266
- )
267
- credit_card = result.credit_card
268
- credit_card.prepaid.should == Braintree::CreditCard::Prepaid::No
269
- end
260
+ it "sets the healthcare field if the card is healthcare" do
261
+ customer = Braintree::Customer.create!
262
+ result = Braintree::CreditCard.create(
263
+ :customer_id => customer.id,
264
+ :number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::Healthcare,
265
+ :expiration_date => "05/2014",
266
+ :options => {:verify_card => true}
267
+ )
268
+ credit_card = result.credit_card
269
+ credit_card.healthcare.should == Braintree::CreditCard::Healthcare::Yes
270
+ end
270
271
 
271
- it "doesn't set the card type identifiers for an un-identified card" do
272
- customer = Braintree::Customer.create!
273
- result = Braintree::CreditCard.create(
274
- :customer_id => customer.id,
275
- :number => Braintree::Test::CreditCardNumbers::MasterCard,
276
- :expiration_date => "05/2014",
277
- :options => {:verify_card => true}
278
- )
279
- credit_card = result.credit_card
280
- credit_card.prepaid.should == Braintree::CreditCard::Prepaid::Unknown
272
+ it "sets the durbin regulated field if the card is durbin regulated" do
273
+ customer = Braintree::Customer.create!
274
+ result = Braintree::CreditCard.create(
275
+ :customer_id => customer.id,
276
+ :number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::DurbinRegulated,
277
+ :expiration_date => "05/2014",
278
+ :options => {:verify_card => true}
279
+ )
280
+ credit_card = result.credit_card
281
+ credit_card.durbin_regulated.should == Braintree::CreditCard::DurbinRegulated::Yes
282
+ end
283
+
284
+ it "sets the payroll field if the card is payroll" do
285
+ customer = Braintree::Customer.create!
286
+ result = Braintree::CreditCard.create(
287
+ :customer_id => customer.id,
288
+ :number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::Payroll,
289
+ :expiration_date => "05/2014",
290
+ :options => {:verify_card => true}
291
+ )
292
+ credit_card = result.credit_card
293
+ credit_card.payroll.should == Braintree::CreditCard::Payroll::Yes
294
+ end
295
+
296
+ it "sets the debit field if the card is debit" do
297
+ customer = Braintree::Customer.create!
298
+ result = Braintree::CreditCard.create(
299
+ :customer_id => customer.id,
300
+ :number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::Debit,
301
+ :expiration_date => "05/2014",
302
+ :options => {:verify_card => true}
303
+ )
304
+ credit_card = result.credit_card
305
+ credit_card.debit.should == Braintree::CreditCard::Debit::Yes
306
+ end
307
+
308
+ it "sets the commercial field if the card is commercial" do
309
+ customer = Braintree::Customer.create!
310
+ result = Braintree::CreditCard.create(
311
+ :customer_id => customer.id,
312
+ :number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::Commercial,
313
+ :expiration_date => "05/2014",
314
+ :options => {:verify_card => true}
315
+ )
316
+ credit_card = result.credit_card
317
+ credit_card.commercial.should == Braintree::CreditCard::Commercial::Yes
318
+ end
319
+
320
+ it "sets negative card type identifiers" do
321
+ customer = Braintree::Customer.create!
322
+ result = Braintree::CreditCard.create(
323
+ :customer_id => customer.id,
324
+ :number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::No,
325
+ :expiration_date => "05/2014",
326
+ :options => {:verify_card => true}
327
+ )
328
+ credit_card = result.credit_card
329
+ credit_card.prepaid.should == Braintree::CreditCard::Prepaid::No
330
+ credit_card.commercial.should == Braintree::CreditCard::Prepaid::No
331
+ credit_card.payroll.should == Braintree::CreditCard::Prepaid::No
332
+ credit_card.debit.should == Braintree::CreditCard::Prepaid::No
333
+ credit_card.durbin_regulated.should == Braintree::CreditCard::Prepaid::No
334
+ credit_card.healthcare.should == Braintree::CreditCard::Prepaid::No
335
+ end
336
+
337
+ it "doesn't set the card type identifiers for an un-identified card" do
338
+ customer = Braintree::Customer.create!
339
+ result = Braintree::CreditCard.create(
340
+ :customer_id => customer.id,
341
+ :number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::Unknown,
342
+ :expiration_date => "05/2014",
343
+ :options => {:verify_card => true}
344
+ )
345
+ credit_card = result.credit_card
346
+ credit_card.prepaid.should == Braintree::CreditCard::Prepaid::Unknown
347
+ credit_card.commercial.should == Braintree::CreditCard::Prepaid::Unknown
348
+ credit_card.payroll.should == Braintree::CreditCard::Prepaid::Unknown
349
+ credit_card.debit.should == Braintree::CreditCard::Prepaid::Unknown
350
+ credit_card.durbin_regulated.should == Braintree::CreditCard::Prepaid::Unknown
351
+ credit_card.healthcare.should == Braintree::CreditCard::Prepaid::Unknown
352
+ end
281
353
  end
282
354
 
283
355
  end
@@ -757,6 +757,22 @@ describe Braintree::Transaction do
757
757
  end
758
758
  end
759
759
 
760
+ context "recurring" do
761
+ it "marks a transaction as recurring" do
762
+ result = Braintree::Transaction.create(
763
+ :type => "sale",
764
+ :amount => Braintree::Test::TransactionAmounts::Authorize,
765
+ :credit_card => {
766
+ :number => Braintree::Test::CreditCardNumbers::Visa,
767
+ :expiration_date => "12/12",
768
+ },
769
+ :recurring => true
770
+ )
771
+ result.success?.should == true
772
+ result.transaction.recurring.should == true
773
+ end
774
+ end
775
+
760
776
  context "store_in_vault_on_success" do
761
777
  context "passed as true" do
762
778
  it "stores vault records when transaction succeeds" do
@@ -0,0 +1,4 @@
1
+ --format progress
2
+ --loadby mtime
3
+ --reverse
4
+ --backtrace
@@ -0,0 +1,17 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIICsDCCAhmgAwIBAgIJALYNz+IiqwdkMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV
3
+ BAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX
4
+ aWRnaXRzIFB0eSBMdGQwHhcNMDkxMjAyMjI1NTE3WhcNMTAxMjAyMjI1NTE3WjBF
5
+ MQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50
6
+ ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB
7
+ gQCrUO6cm5QqdJLLcMIygeIzyBUYl7iWiHqPy6fmxzj3SsFbTAY8tXT8C2jh3cWi
8
+ 0qNGXuxwSK6pClFwkPmW5znjCPbq9Ifa6mAU4+NoCzjTCAWxY3K1p6eW2s1gA82J
9
+ BJF9/X4umdx9NbkOeoZWselJa7K0hztjOSBZXjXNfMYOiQIDAQABo4GnMIGkMB0G
10
+ A1UdDgQWBBRhqocfWHXEx0mT/IEFR1I5fqCH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kpZlytXg8Y1SIHI9Cz8jRAkEA2CTGVWLuke/Z
8
+ T+40+TSAbxOpXt7zyq1CO/jp7NsAy3MLIv3GHgxVzcK8tsAEyvPvRSnmMFdciZCx
9
+ 5yTfFMHt1QJBAMroCmhLJWcwpjH5mO4kD/1eZNre1j5ZgGTt9fiIxo8Gns6kDLWX
10
+ 7iLZ5sAdqle9KUm4BZKvnBtwFkBAwf9Pk+UCQBbdhRHBXoWXvwCCrZ3zXObjSJad
11
+ tWKqg4g+o9iHroTXTcVM3WmOWoFi6X3XwGoL9jL15MEWbNastPVD5EmY3mUCQBj4
12
+ Pzegb8ToHrutrJ05wOH8OMsaeyEHIJ7LDeb85fp55Rcm5w192edeC2B/BhRwCeGx
13
+ jLYFeF+EBqj3jygdIeUCQGExaHBVu0nTHY9CnvJOjc2hs/I3TPwgXzm8rBisGm5W
14
+ g0eJhfZ1uJ+oHaKhoTRgB6OOUVnpugx83vYvYiKj+1M=
15
+ -----END RSA PRIVATE KEY-----
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: braintree
3
3
  version: !ruby/object:Gem::Version
4
- hash: 75
4
+ hash: 71
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
- - 17
8
+ - 18
9
9
  - 0
10
- version: 2.17.0
10
+ version: 2.18.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Braintree
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-09-13 00:00:00 -05:00
18
+ date: 2012-10-04 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -106,7 +106,11 @@ files:
106
106
  - lib/braintree/xml/rexml.rb
107
107
  - lib/braintree/xml.rb
108
108
  - lib/braintree.rb
109
+ - lib/ssl/sandbox_braintreegateway_com.ca.crt
110
+ - lib/ssl/securetrust_ca.crt
111
+ - lib/ssl/www_braintreegateway_com.ca.crt
109
112
  - spec/hacks/tcp_socket.rb
113
+ - spec/httpsd.pid
110
114
  - spec/integration/braintree/add_on_spec.rb
111
115
  - spec/integration/braintree/address_spec.rb
112
116
  - spec/integration/braintree/advanced_search_spec.rb
@@ -125,7 +129,11 @@ files:
125
129
  - spec/integration/braintree/transparent_redirect_spec.rb
126
130
  - spec/integration/spec_helper.rb
127
131
  - spec/script/httpsd.rb
132
+ - spec/spec.opts
128
133
  - spec/spec_helper.rb
134
+ - spec/ssl/certificate.crt
135
+ - spec/ssl/geotrust_global.crt
136
+ - spec/ssl/privateKey.key
129
137
  - spec/unit/braintree/address_spec.rb
130
138
  - spec/unit/braintree/base_module_spec.rb
131
139
  - spec/unit/braintree/configuration_spec.rb
@@ -156,9 +164,6 @@ files:
156
164
  - spec/unit/braintree/xml_spec.rb
157
165
  - spec/unit/braintree_spec.rb
158
166
  - spec/unit/spec_helper.rb
159
- - lib/ssl/sandbox_braintreegateway_com.ca.crt
160
- - lib/ssl/securetrust_ca.crt
161
- - lib/ssl/www_braintreegateway_com.ca.crt
162
167
  - braintree.gemspec
163
168
  has_rdoc: true
164
169
  homepage: http://www.braintreepayments.com/