braintree 2.42.0 → 2.43.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2b9a50fd8348652499c6b7efe50df517ad913c6d
4
+ data.tar.gz: 390ebabadbd1ddd4953ee67e6eb3b2abacb7c1f7
5
+ SHA512:
6
+ metadata.gz: 28366957919ee3525ec01792309464eb87dbda2f31469b4339360e135df3e49e7e016b41a7a6b51efdd889588d69b47c873fd61898fd76fedd01b3d91954c7a2
7
+ data.tar.gz: ce9a9172e019fffec235d6da9e2b1195c26d1da4e7f160c5ba4196f84fdd136b364218636a80bdac940104c2859bf402c9024cf5d3ae1a5f9cda8733562c65a2
@@ -66,6 +66,7 @@ require "braintree/paypal_account_gateway"
66
66
  require "braintree/plan"
67
67
  require "braintree/plan_gateway"
68
68
  require "braintree/risk_data"
69
+ require "braintree/three_d_secure_info"
69
70
  require "braintree/settlement_batch_summary"
70
71
  require "braintree/settlement_batch_summary_gateway"
71
72
  require "braintree/resource_collection"
@@ -3,10 +3,28 @@ module Braintree
3
3
  API_VERSION = "4" # :nodoc:
4
4
  DEFAULT_ENDPOINT = "api" # :nodoc:
5
5
 
6
+ READABLE_ATTRIBUTES = [
7
+ :merchant_id,
8
+ :public_key,
9
+ :private_key,
10
+ ]
11
+
12
+ WRITABLE_ATTRIBUTES = [
13
+ :custom_user_agent,
14
+ :endpoint,
15
+ :http_open_timeout,
16
+ :http_read_timeout,
17
+ :logger,
18
+ :merchant_id,
19
+ :public_key,
20
+ :private_key,
21
+ :environment,
22
+ ]
23
+
6
24
  class << self
7
- attr_writer :custom_user_agent, :endpoint, :logger, :merchant_id, :public_key, :private_key
25
+ attr_writer *WRITABLE_ATTRIBUTES
8
26
  end
9
- attr_reader :merchant_id, :public_key, :private_key
27
+ attr_reader *READABLE_ATTRIBUTES
10
28
 
11
29
  def self.expectant_reader(*attributes) # :nodoc:
12
30
  attributes.each do |attribute|
@@ -17,7 +35,7 @@ module Braintree
17
35
  end
18
36
  end
19
37
  end
20
- expectant_reader :environment, :merchant_id, :public_key, :private_key
38
+ expectant_reader *([:environment] + READABLE_ATTRIBUTES)
21
39
 
22
40
  # Sets the Braintree environment to use. Valid values are <tt>:sandbox</tt> and <tt>:production</tt>
23
41
  def self.environment=(env)
@@ -36,6 +54,8 @@ module Braintree
36
54
  :custom_user_agent => @custom_user_agent,
37
55
  :endpoint => @endpoint,
38
56
  :environment => environment,
57
+ :http_open_timeout => http_open_timeout,
58
+ :http_read_timeout => http_read_timeout,
39
59
  :logger => logger,
40
60
  :merchant_id => merchant_id,
41
61
  :private_key => private_key,
@@ -43,6 +63,14 @@ module Braintree
43
63
  )
44
64
  end
45
65
 
66
+ def self.http_open_timeout
67
+ @http_open_timeout ||= 60
68
+ end
69
+
70
+ def self.http_read_timeout
71
+ @http_read_timeout ||= 60
72
+ end
73
+
46
74
  def self.logger
47
75
  @logger ||= _default_logger
48
76
  end
@@ -56,7 +84,7 @@ module Braintree
56
84
  end
57
85
 
58
86
  def initialize(options = {})
59
- [:endpoint, :environment, :public_key, :private_key, :custom_user_agent, :logger].each do |attr|
87
+ WRITABLE_ATTRIBUTES.each do |attr|
60
88
  instance_variable_set "@#{attr}", options[attr]
61
89
  end
62
90
 
@@ -104,6 +132,14 @@ module Braintree
104
132
  ssl? ? "https" : "http"
105
133
  end
106
134
 
135
+ def http_open_timeout
136
+ @http_open_timeout
137
+ end
138
+
139
+ def http_read_timeout
140
+ @http_read_timeout
141
+ end
142
+
107
143
  def server # :nodoc:
108
144
  case @environment
109
145
  when :development
@@ -4,13 +4,13 @@ module Braintree
4
4
  # The error messages returned from the server may change, but the codes will remain the same.
5
5
  module ErrorCodes
6
6
  module Address
7
+ CannotBeBlank = "81801"
7
8
  CompanyIsInvalid = "91821"
8
- CountryNameIsNotAccepted = "91803"
9
+ CompanyIsTooLong = "81802"
9
10
  CountryCodeAlpha2IsNotAccepted = "91814"
10
11
  CountryCodeAlpha3IsNotAccepted = "91816"
11
12
  CountryCodeNumericIsNotAccepted = "91817"
12
- CannotBeBlank = "81801"
13
- CompanyIsTooLong = "81802"
13
+ CountryNameIsNotAccepted = "91803"
14
14
  ExtendedAddressIsInvalid = "91823"
15
15
  ExtendedAddressIsTooLong = "81804"
16
16
  FirstNameIsInvalid = "91819"
@@ -26,6 +26,7 @@ module Braintree
26
26
  PostalCodeIsTooLong = "81809"
27
27
  RegionIsInvalid = "91825"
28
28
  RegionIsTooLong = "81810"
29
+ StateIsInvalidForSellerProtection = "81827"
29
30
  StreetAddressIsInvalid = "91822"
30
31
  StreetAddressIsRequired = "81811"
31
32
  StreetAddressIsTooLong = "81812"
@@ -59,6 +60,7 @@ module Braintree
59
60
 
60
61
  module CreditCard
61
62
  BillingAddressConflict = "91701"
63
+ BillingAddressFormatIsInvalid = "91744"
62
64
  BillingAddressIdIsInvalid = "91702"
63
65
  CannotUpdateCardUsingPaymentMethodNonce = "91735"
64
66
  CardholderNameIsTooLong = "81723"
@@ -69,7 +71,6 @@ module Braintree
69
71
  CvvIsInvalid = "81707"
70
72
  CvvIsRequired = "81706"
71
73
  CvvVerificationFailed = "81736"
72
- PostalCodeVerificationFailed = "81737"
73
74
  DuplicateCardExists = "81724"
74
75
  ExpirationDateConflict = "91708"
75
76
  ExpirationDateIsInvalid = "81710"
@@ -77,6 +78,7 @@ module Braintree
77
78
  ExpirationDateYearIsInvalid = "81711"
78
79
  ExpirationMonthIsInvalid = "81712"
79
80
  ExpirationYearIsInvalid = "81713"
81
+ InvalidParamsForCreditCardUpdate = "91745"
80
82
  InvalidVenmoSDKPaymentMethodCode = "91727"
81
83
  NumberIsInvalid = "81715"
82
84
  NumberIsRequired = "81714"
@@ -88,6 +90,7 @@ module Braintree
88
90
  PaymentMethodNonceConsumed = "91731"
89
91
  PaymentMethodNonceLocked = "91733"
90
92
  PaymentMethodNonceUnknown = "91732"
93
+ PostalCodeVerificationFailed = "81737"
91
94
  TokenFormatIsInvalid = "91718"
92
95
  TokenIsInUse = "91719"
93
96
  TokenIsNotAllowed = "91721"
@@ -97,34 +100,37 @@ module Braintree
97
100
  VerificationNotSupportedOnThisMerchantAccount = "91730"
98
101
 
99
102
  module Options
100
- UseBillingForShippingDisabled = "91572"
101
103
  UpdateExistingTokenIsInvalid = "91723"
102
104
  UpdateExistingTokenNotAllowed = "91729"
103
- VerificationMerchantAccountIdIsInvalid = "91728"
105
+ UseBillingForShippingDisabled = "91572"
104
106
  VerificationAmountCannotBeNegative = "91739"
105
107
  VerificationAmountFormatIsInvalid = "91740"
106
108
  VerificationAmountNotSupportedByProcessor = "91741"
109
+ VerificationMerchantAccountIdIsInvalid = "91728"
110
+ VerificationMerchantAccountIsForbidden = "91743"
111
+ VerificationMerchantAccountIsSuspended = "91742"
107
112
  end
108
113
  end
109
114
 
110
115
  module Customer
111
- CustomFieldIsInvalid = "91602"
112
- IdIsInUse = "91609"
113
- IdIsInvalid = "91610"
114
- IdIsNotAllowed = "91611"
115
- IdIsRequired = "91613"
116
- IdIsTooLong = "91612"
117
116
  CompanyIsTooLong = "81601"
117
+ CustomFieldIsInvalid = "91602"
118
118
  CustomFieldIsTooLong = "81603"
119
119
  EmailFormatIsInvalid = "81604"
120
- EmailIsTooLong = "81605"
121
120
  EmailIsRequired = "81606"
121
+ EmailIsTooLong = "81605"
122
122
  FaxIsTooLong = "81607"
123
123
  FirstNameIsTooLong = "81608"
124
+ IdIsInUse = "91609"
125
+ IdIsInvalid = "91610"
126
+ IdIsNotAllowed = "91611"
127
+ IdIsRequired = "91613"
128
+ IdIsTooLong = "91612"
124
129
  LastNameIsTooLong = "81613"
125
130
  PhoneIsTooLong = "81614"
126
- WebsiteIsTooLong = "81615"
131
+ VaultedPaymentInstrumentNonceBelongsToDifferentCustomer = "91617"
127
132
  WebsiteFormatIsInvalid = "81616"
133
+ WebsiteIsTooLong = "81615"
128
134
  end
129
135
 
130
136
  module Descriptor
@@ -137,21 +143,22 @@ module Braintree
137
143
  end
138
144
 
139
145
  module PayPalAccount
140
- CannotVaultOneTimeUsePayPalAccount = "82902"
146
+ AuthExpired = "92911"
141
147
  CannotHaveBothAccessTokenAndConsentCode = "82903"
148
+ CannotHaveFundingSourceWithoutAccessToken = "92912"
149
+ CannotUpdatePayPalAccountUsingPaymentMethodNonce = "92914"
150
+ CannotVaultOneTimeUsePayPalAccount = "82902"
142
151
  ConsentCodeOrAccessTokenIsRequired = "82901"
143
152
  CustomerIdIsRequiredForVaulting = "82905"
144
153
  IncompletePayPalAccount = "82901"
154
+ InvalidFundingSourceSelection = "92913"
155
+ InvalidParamsForPayPalAccountUpdate = "92915"
156
+ PayPalAccountsAreNotAccepted = "82904"
157
+ PayPalCommunicationError = "92910"
145
158
  PaymentMethodNonceConsumed = "92907"
146
159
  PaymentMethodNonceLocked = "92909"
147
160
  PaymentMethodNonceUnknown = "92908"
148
- PayPalAccountsAreNotAccepted = "82904"
149
- PayPalCommunicationError = "92910"
150
161
  TokenIsInUse = "92906"
151
- AuthExpired = "92911"
152
- CannotHaveFundingSourceWithoutAccessToken = "92912"
153
- InvalidFundingSourceSelection = "92913"
154
- CannotUpdatePayPalAccountUsingPaymentMethodNonce = "92914"
155
162
  end
156
163
 
157
164
  module EuropeBankAccount
@@ -191,6 +198,7 @@ module Braintree
191
198
  InconsistentNumberOfBillingCycles = "91908"
192
199
  InconsistentStartDate = "91917"
193
200
  InvalidRequestFormat = "91921"
201
+ MerchantAccountDoesNotSupportInstrumentType = "91930"
194
202
  MerchantAccountIdIsInvalid = "91901"
195
203
  MismatchCurrencyISOCode = "91923"
196
204
  NumberOfBillingCyclesCannotBeBlank = "91912"
@@ -198,10 +206,12 @@ module Braintree
198
206
  NumberOfBillingCyclesMustBeGreaterThanZero = "91907"
199
207
  NumberOfBillingCyclesMustBeNumeric = "91906"
200
208
  PaymentMethodNonceCardTypeIsNotAccepted = "91924"
209
+ PaymentMethodNonceInstrumentTypeDoesNotSupportSubscriptions = "91929"
201
210
  PaymentMethodNonceIsInvalid = "91925"
202
211
  PaymentMethodNonceNotAssociatedWithCustomer = "91926"
203
212
  PaymentMethodNonceUnvaultedCardIsNotAccepted = "91927"
204
213
  PaymentMethodTokenCardTypeIsNotAccepted = "91902"
214
+ PaymentMethodTokenInstrumentTypeDoesNotSupportSubscriptions = "91928"
205
215
  PaymentMethodTokenIsInvalid = "91903"
206
216
  PaymentMethodTokenNotAssociatedWithCustomer = "91905"
207
217
  PlanBillingFrequencyCannotBeUpdated = "91922"
@@ -242,6 +252,7 @@ module Braintree
242
252
 
243
253
  module Transaction
244
254
  AmountCannotBeNegative = "81501"
255
+ AmountDoesNotMatch3DSecureAmount = "91585"
245
256
  AmountFormatIsInvalid = "81503" # Keep for backwards compatibility
246
257
  AmountIsInvalid = "81503" # Keep for backwards compatibility
247
258
  AmountIsRequired = "81502"
@@ -258,9 +269,9 @@ module Braintree
258
269
  CannotHoldInEscrow = "91560"
259
270
  CannotPartiallyRefundEscrowedTransaction = "91563"
260
271
  CannotRefundCredit = "91505"
272
+ CannotRefundSettlingTransaction = "91574"
261
273
  CannotRefundUnlessSettled = "91506"
262
274
  CannotRefundWithPendingMerchantAccount = "91559"
263
- CannotRefundSettlingTransaction = "91574"
264
275
  CannotRefundWithSuspendedMerchantAccount = "91538"
265
276
  CannotReleaseFromEscrow = "91561"
266
277
  CannotSimulateTransactionSettlement = "91575"
@@ -273,24 +284,27 @@ module Braintree
273
284
  CustomerDoesNotHaveCreditCard = "91511"
274
285
  CustomerIdIsInvalid = "91510"
275
286
  HasAlreadyBeenRefunded = "91512"
287
+ MerchantAccountDoesNotMatch3DSecureMerchantAccount = "91584"
276
288
  MerchantAccountDoesNotSupportMOTO = "91558"
277
289
  MerchantAccountDoesNotSupportRefunds = "91547"
278
290
  MerchantAccountIdIsInvalid = "91513"
279
291
  MerchantAccountIsSuspended = "91514"
280
292
  OrderIdIsTooLong = "91501"
293
+ PayPalAuthExpired = "91579"
294
+ PayPalNotEnabled = "91576"
295
+ PayPalVaultRecordMissingData = "91583"
296
+ PaymentInstrumentNotSupportedByMerchantAccount = "91577"
281
297
  PaymentMethodConflict = "91515"
282
298
  PaymentMethodConflictWithVenmoSDK = "91549"
283
299
  PaymentMethodDoesNotBelongToCustomer = "91516"
284
300
  PaymentMethodDoesNotBelongToSubscription = "91527"
285
301
  PaymentMethodNonceCardTypeIsNotAccepted = "91567"
286
302
  PaymentMethodNonceConsumed = "91564"
303
+ PaymentMethodNonceHasNoValidPaymentInstrumentType = "91569"
287
304
  PaymentMethodNonceLocked = "91566"
288
305
  PaymentMethodNonceUnknown = "91565"
289
306
  PaymentMethodTokenCardTypeIsNotAccepted = "91517"
290
307
  PaymentMethodTokenIsInvalid = "91518"
291
- PaymentInstrumentNotSupportedByMerchantAccount = "91577"
292
- PayPalAuthExpired = "91579"
293
- PayPalNotEnabled = "91576"
294
308
  ProcessorAuthorizationCodeCannotBeSet = "91519"
295
309
  ProcessorAuthorizationCodeIsInvalid = "81520"
296
310
  ProcessorDoesNotSupportCredits = "91546"
@@ -323,6 +337,7 @@ module Braintree
323
337
 
324
338
  module Options
325
339
  SubmitForSettlementIsRequiredForCloning = "91544"
340
+ SubmitForSettlementIsRequiredForPayPalUnilateral = "91582"
326
341
  VaultIsDisabled = "91525"
327
342
 
328
343
  module PayPal
@@ -353,6 +368,21 @@ module Braintree
353
368
  end
354
369
  end
355
370
 
371
+ module Merchant
372
+ CountryCannotBeBlank = "83603"
373
+ CountryCodeAlpha2IsInvalid = "93607"
374
+ CountryCodeAlpha2IsNotAccepted = "93606"
375
+ CountryCodeAlpha3IsInvalid = "93605"
376
+ CountryCodeAlpha3IsNotAccepted = "93604"
377
+ CountryCodeNumericIsInvalid = "93609"
378
+ CountryCodeNumericIsNotAccepted = "93608"
379
+ CountryNameIsInvalid = "93611"
380
+ CountryNameIsNotAccepted = "93610"
381
+ EmailFormatIsInvalid = "93602"
382
+ EmailIsRequired = "83601"
383
+ InconsistentCountry = "93612"
384
+ end
385
+
356
386
  module MerchantAccount
357
387
  IdIsTooLong = "82602"
358
388
  IdFormatIsInvalid = "82603"
@@ -60,8 +60,8 @@ module Braintree
60
60
 
61
61
  def _http_do(http_verb, path, body = nil)
62
62
  connection = Net::HTTP.new(@config.server, @config.port)
63
- connection.open_timeout = 60
64
- connection.read_timeout = 60
63
+ connection.open_timeout = @config.http_open_timeout
64
+ connection.read_timeout = @config.http_read_timeout
65
65
  if @config.ssl?
66
66
  connection.use_ssl = true
67
67
  connection.verify_mode = OpenSSL::SSL::VERIFY_PEER
@@ -6,11 +6,17 @@ module Braintree
6
6
  Configuration.gateway.payment_method_nonce.create(payment_method)
7
7
  end
8
8
 
9
- attr_reader :nonce
9
+ def self.find(payment_method_nonce)
10
+ Configuration.gateway.payment_method_nonce.find(payment_method_nonce)
11
+ end
12
+
13
+ attr_reader :nonce, :three_d_secure_info, :type
10
14
 
11
15
  def initialize(gateway, attributes) # :nodoc:
12
16
  @gateway = gateway
13
17
  @nonce = attributes.fetch(:nonce)
18
+ @type = attributes.fetch(:type)
19
+ @three_d_secure_info = ThreeDSecureInfo.new(attributes[:three_d_secure_info]) if attributes[:three_d_secure_info]
14
20
  end
15
21
 
16
22
  def to_s # :nodoc:
@@ -10,5 +10,11 @@ module Braintree
10
10
  payment_method_nonce = PaymentMethodNonce._new(@gateway, response.fetch(:payment_method_nonce))
11
11
  SuccessfulResult.new(:payment_method_nonce => payment_method_nonce)
12
12
  end
13
+
14
+ def find(payment_method_nonce)
15
+ response = @config.http.get "/payment_method_nonces/#{payment_method_nonce}"
16
+ payment_method_nonce = PaymentMethodNonce._new(@gateway, response.fetch(:payment_method_nonce))
17
+ SuccessfulResult.new(:payment_method_nonce => payment_method_nonce)
18
+ end
13
19
  end
14
20
  end
@@ -0,0 +1,21 @@
1
+ module Braintree
2
+ class ThreeDSecureInfo # :nodoc:
3
+ include BaseModule
4
+
5
+ attr_reader :enrolled, :liability_shifted, :liability_shift_possible, :status
6
+ alias_method :liability_shifted?, :liability_shifted
7
+ alias_method :liability_shift_possible?, :liability_shift_possible
8
+
9
+ def initialize(attributes)
10
+ set_instance_variables_from_hash attributes unless attributes.nil?
11
+ end
12
+
13
+ def inspect
14
+ attr_order = [:enrolled, :liability_shifted, :liability_shift_possible, :status]
15
+ formatted_attrs = attr_order.map do |attr|
16
+ "#{attr}: #{send(attr).inspect}"
17
+ end
18
+ "#<ThreeDSecureInfo #{formatted_attrs.join(", ")}>"
19
+ end
20
+ end
21
+ end
@@ -114,6 +114,7 @@ module Braintree
114
114
  attr_reader :add_ons, :discounts
115
115
  attr_reader :payment_instrument_type
116
116
  attr_reader :risk_data
117
+ attr_reader :three_d_secure_info
117
118
 
118
119
  def self.create(attributes)
119
120
  Configuration.gateway.transaction.create(attributes)
@@ -238,6 +239,7 @@ module Braintree
238
239
  discounts.map! { |attrs| Discount._new(attrs) } if discounts
239
240
  @payment_instrument_type = attributes[:payment_instrument_type]
240
241
  @risk_data = RiskData.new(attributes[:risk_data]) if attributes[:risk_data]
242
+ @three_d_secure_info = ThreeDSecureInfo.new(attributes[:three_d_secure_info]) if attributes[:three_d_secure_info]
241
243
  end
242
244
 
243
245
  # True if <tt>other</tt> is a Braintree::Transaction with the same id.
@@ -1,7 +1,7 @@
1
1
  module Braintree
2
2
  module Version
3
3
  Major = 2
4
- Minor = 42
4
+ Minor = 43
5
5
  Tiny = 0
6
6
 
7
7
  String = "#{Major}.#{Minor}.#{Tiny}"
@@ -1 +1 @@
1
- 21452
1
+ 18128
@@ -2,28 +2,19 @@ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
2
  require File.expand_path(File.dirname(__FILE__) + "/client_api/spec_helper")
3
3
 
4
4
  describe Braintree::PaymentMethodNonce do
5
+ let(:config) { Braintree::Configuration.instantiate }
6
+
5
7
  describe "self.create" do
6
8
  it "creates a payment method nonce from a vaulted credit card" do
7
- config = Braintree::Configuration.instantiate
8
9
  customer = Braintree::Customer.create.customer
9
- raw_client_token = Braintree::ClientToken.generate(:customer_id => customer.id)
10
- client_token = decode_client_token(raw_client_token)
11
- authorization_fingerprint = client_token["authorizationFingerprint"]
12
- http = ClientApiHttp.new(
13
- config,
14
- :authorization_fingerprint => authorization_fingerprint,
15
- :shared_customer_identifier => "fake_identifier",
16
- :shared_customer_identifier_type => "testing"
17
- )
18
-
19
- response = http.create_credit_card(
20
- :number => 4111111111111111,
21
- :expirationMonth => 12,
22
- :expirationYear => 2020
10
+ nonce = nonce_for_new_payment_method(
11
+ :credit_card => {
12
+ :number => "4111111111111111",
13
+ :expiration_month => "11",
14
+ :expiration_year => "2099",
15
+ }
23
16
  )
24
- response.code.should == "201"
25
17
 
26
- nonce = JSON.parse(response.body)["creditCards"].first["nonce"]
27
18
  result = Braintree::PaymentMethod.create(
28
19
  :payment_method_nonce => nonce,
29
20
  :customer_id => customer.id
@@ -44,7 +35,43 @@ describe Braintree::PaymentMethodNonce do
44
35
 
45
36
  it "correctly raises and exception for a non existent token" do
46
37
  expect do
47
- result = Braintree::PaymentMethodNonce.create("not_a_token")
38
+ Braintree::PaymentMethodNonce.create("not_a_token")
39
+ end.to raise_error(Braintree::NotFoundError)
40
+ end
41
+ end
42
+
43
+ describe "self.find" do
44
+ it "finds and returns the nonce if one was found" do
45
+ result = Braintree::PaymentMethodNonce.find("threedsecurednonce")
46
+
47
+ nonce = result.payment_method_nonce
48
+
49
+ result.should be_success
50
+ nonce.nonce.should == "threedsecurednonce"
51
+ nonce.type.should == "CreditCard"
52
+ nonce.three_d_secure_info.liability_shifted.should == true
53
+ end
54
+
55
+ it "returns null 3ds_info if there isn't any" do
56
+ nonce = nonce_for_new_payment_method(
57
+ :credit_card => {
58
+ :number => "4111111111111111",
59
+ :expiration_month => "11",
60
+ :expiration_year => "2099",
61
+ }
62
+ )
63
+
64
+ result = Braintree::PaymentMethodNonce.find(nonce)
65
+
66
+ nonce = result.payment_method_nonce
67
+
68
+ result.should be_success
69
+ nonce.three_d_secure_info.should be_nil
70
+ end
71
+
72
+ it "correctly raises and exception for a non existent token" do
73
+ expect do
74
+ Braintree::PaymentMethodNonce.find("not_a_nonce")
48
75
  end.to raise_error(Braintree::NotFoundError)
49
76
  end
50
77
  end
@@ -2785,6 +2785,23 @@ describe Braintree::Transaction do
2785
2785
  end
2786
2786
  end
2787
2787
 
2788
+ context "three_d_secure_info" do
2789
+ it "returns all the three_d_secure_info" do
2790
+ transaction = Braintree::Transaction.find("threedsecuredtransaction")
2791
+
2792
+ transaction.three_d_secure_info.enrolled.should == "Y"
2793
+ transaction.three_d_secure_info.should be_liability_shifted
2794
+ transaction.three_d_secure_info.should be_liability_shift_possible
2795
+ transaction.three_d_secure_info.status.should == "authenticate_successful"
2796
+ end
2797
+
2798
+ it "is nil if the transaction wasn't 3d secured" do
2799
+ transaction = Braintree::Transaction.find("settledtransaction")
2800
+
2801
+ transaction.three_d_secure_info.should be_nil
2802
+ end
2803
+ end
2804
+
2788
2805
  context "paypal" do
2789
2806
  it "returns all the required paypal fields" do
2790
2807
  transaction = Braintree::Transaction.find("settledtransaction")
@@ -0,0 +1,41 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
2
+
3
+ describe Braintree::ThreeDSecureInfo do
4
+ let(:three_d_secure_info) {
5
+ Braintree::ThreeDSecureInfo.new(
6
+ :enrolled => "Y",
7
+ :liability_shifted => true,
8
+ :liability_shift_possible => true,
9
+ :cavv => "cavvvalue",
10
+ :xid => "xidvalue",
11
+ :status => "authenticate_successful"
12
+ )
13
+ }
14
+
15
+ describe "#initialize" do
16
+ it "sets attributes" do
17
+ three_d_secure_info.enrolled.should == "Y"
18
+ three_d_secure_info.status.should == "authenticate_successful"
19
+ three_d_secure_info.liability_shifted.should == true
20
+ three_d_secure_info.liability_shift_possible.should == true
21
+ end
22
+ end
23
+
24
+ describe "inspect" do
25
+ it "prints the attributes" do
26
+ three_d_secure_info.inspect.should == %(#<ThreeDSecureInfo enrolled: "Y", liability_shifted: true, liability_shift_possible: true, status: "authenticate_successful">)
27
+ end
28
+ end
29
+
30
+ describe "liability_shifted" do
31
+ it "is aliased to liability_shifted?" do
32
+ three_d_secure_info.liability_shifted?.should == true
33
+ end
34
+ end
35
+
36
+ describe "liability_shift_possible" do
37
+ it "is aliased to liability_shift_possible?" do
38
+ three_d_secure_info.liability_shift_possible?.should == true
39
+ end
40
+ end
41
+ end
@@ -143,6 +143,23 @@ describe Braintree::Transaction do
143
143
  transaction.credit_card_details.issuing_bank.should == "Mr Tumnus"
144
144
  end
145
145
 
146
+ it "sets up three_d_secure_info" do
147
+ transaction = Braintree::Transaction._new(
148
+ :gateway,
149
+ :three_d_secure_info => {
150
+ :enrolled => "Y",
151
+ :liability_shifted => true,
152
+ :liability_shift_possible => true,
153
+ :status => "authenticate_successful",
154
+ }
155
+ )
156
+
157
+ transaction.three_d_secure_info.enrolled.should == "Y"
158
+ transaction.three_d_secure_info.status.should == "authenticate_successful"
159
+ transaction.three_d_secure_info.liability_shifted.should == true
160
+ transaction.three_d_secure_info.liability_shift_possible.should == true
161
+ end
162
+
146
163
  it "sets up history attributes in status_history" do
147
164
  time = Time.utc(2010,1,14)
148
165
  transaction = Braintree::Transaction._new(
metadata CHANGED
@@ -1,30 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: braintree
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.42.0
5
- prerelease:
4
+ version: 2.43.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Braintree
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2015-04-20 00:00:00.000000000 Z
11
+ date: 2015-05-07 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: builder
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: 2.0.0
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: 2.0.0
30
27
  description: Ruby library for integrating with the Braintree Gateway
@@ -35,212 +32,213 @@ extra_rdoc_files: []
35
32
  files:
36
33
  - README.rdoc
37
34
  - LICENSE
38
- - lib/braintree/customer_search.rb
39
- - lib/braintree/descriptor.rb
40
- - lib/braintree/merchant_account.rb
41
- - lib/braintree/credit_card.rb
42
- - lib/braintree/disbursement.rb
43
- - lib/braintree/payment_method_gateway.rb
44
- - lib/braintree/test/merchant_account.rb
35
+ - lib/braintree.rb
36
+ - lib/braintree/transparent_redirect_gateway.rb
37
+ - lib/braintree/credit_card_verification.rb
38
+ - lib/braintree/address.rb
39
+ - lib/braintree/settlement_batch_summary.rb
40
+ - lib/braintree/resource_collection.rb
41
+ - lib/braintree/three_d_secure_info.rb
42
+ - lib/braintree/webhook_testing.rb
43
+ - lib/braintree/payment_instrument_type.rb
44
+ - lib/braintree/validation_error.rb
45
+ - lib/braintree/base_module.rb
45
46
  - lib/braintree/test/credit_card.rb
47
+ - lib/braintree/test/nonce.rb
48
+ - lib/braintree/test/merchant_account.rb
46
49
  - lib/braintree/test/venmo_sdk.rb
47
50
  - lib/braintree/test/transaction_amounts.rb
48
- - lib/braintree/test/nonce.rb
49
- - lib/braintree/transaction.rb
50
- - lib/braintree/version.rb
51
- - lib/braintree/credit_card_verification_search.rb
51
+ - lib/braintree/europe_bank_account.rb
52
+ - lib/braintree/subscription_search.rb
53
+ - lib/braintree/credit_card_gateway.rb
54
+ - lib/braintree/digest.rb
55
+ - lib/braintree/risk_data.rb
56
+ - lib/braintree/settlement_batch.rb
57
+ - lib/braintree/payment_method_nonce_gateway.rb
58
+ - lib/braintree/transparent_redirect.rb
59
+ - lib/braintree/paypal_account.rb
60
+ - lib/braintree/dispute/transaction_details.rb
61
+ - lib/braintree/testing_gateway.rb
62
+ - lib/braintree/merchant_account/individual_details.rb
63
+ - lib/braintree/merchant_account/business_details.rb
64
+ - lib/braintree/merchant_account/funding_details.rb
65
+ - lib/braintree/merchant_account/address_details.rb
66
+ - lib/braintree/credit_card.rb
67
+ - lib/braintree/validation_error_collection.rb
68
+ - lib/braintree/test_transaction.rb
52
69
  - lib/braintree/transaction_search.rb
70
+ - lib/braintree/disbursement.rb
71
+ - lib/braintree/util.rb
72
+ - lib/braintree/errors.rb
73
+ - lib/braintree/webhook_notification_gateway.rb
74
+ - lib/braintree/credit_card_verification_search.rb
75
+ - lib/braintree/subscription.rb
53
76
  - lib/braintree/exceptions.rb
54
- - lib/braintree/risk_data.rb
77
+ - lib/braintree/payment_method_gateway.rb
78
+ - lib/braintree/merchant_account_gateway.rb
79
+ - lib/braintree/discount.rb
80
+ - lib/braintree/xml/generator.rb
81
+ - lib/braintree/xml/rexml.rb
82
+ - lib/braintree/xml/libxml.rb
83
+ - lib/braintree/xml/parser.rb
84
+ - lib/braintree/xml.rb
85
+ - lib/braintree/transaction.rb
86
+ - lib/braintree/successful_result.rb
87
+ - lib/braintree/version.rb
88
+ - lib/braintree/client_token.rb
55
89
  - lib/braintree/address/country_names.rb
56
- - lib/braintree/address_gateway.rb
57
- - lib/braintree/dispute.rb
58
- - lib/braintree/advanced_search.rb
59
- - lib/braintree/webhook_notification_gateway.rb
60
- - lib/braintree/customer_gateway.rb
90
+ - lib/braintree/unknown_payment_method.rb
91
+ - lib/braintree/descriptor.rb
92
+ - lib/braintree/webhook_notification.rb
93
+ - lib/braintree/credit_card_verification_gateway.rb
61
94
  - lib/braintree/apple_pay_card.rb
62
- - lib/braintree/paypal_account.rb
63
- - lib/braintree/europe_bank_account.rb
64
- - lib/braintree/transaction/subscription_details.rb
65
95
  - lib/braintree/transaction/disbursement_details.rb
96
+ - lib/braintree/transaction/credit_card_details.rb
66
97
  - lib/braintree/transaction/address_details.rb
98
+ - lib/braintree/transaction/subscription_details.rb
67
99
  - lib/braintree/transaction/customer_details.rb
68
100
  - lib/braintree/transaction/coinbase_details.rb
69
101
  - lib/braintree/transaction/apple_pay_details.rb
70
102
  - lib/braintree/transaction/status_details.rb
71
- - lib/braintree/transaction/credit_card_details.rb
72
103
  - lib/braintree/transaction/paypal_details.rb
73
- - lib/braintree/client_token.rb
74
- - lib/braintree/xml.rb
75
- - lib/braintree/add_on.rb
76
- - lib/braintree/add_on_gateway.rb
104
+ - lib/braintree/transaction_gateway.rb
105
+ - lib/braintree/merchant_account.rb
106
+ - lib/braintree/advanced_search.rb
77
107
  - lib/braintree/europe_bank_account_gateway.rb
78
- - lib/braintree/settlement_batch_summary.rb
79
- - lib/braintree/payment_method_nonce.rb
80
- - lib/braintree/subscription.rb
81
- - lib/braintree/http.rb
82
- - lib/braintree/modification.rb
83
- - lib/braintree/dispute/transaction_details.rb
108
+ - lib/braintree/webhook_testing_gateway.rb
84
109
  - lib/braintree/gateway.rb
85
- - lib/braintree/subscription_search.rb
86
- - lib/braintree/credit_card_gateway.rb
87
- - lib/braintree/payment_method.rb
88
- - lib/braintree/base_module.rb
89
- - lib/braintree/discount.rb
90
- - lib/braintree/transparent_redirect.rb
91
- - lib/braintree/transparent_redirect_gateway.rb
92
- - lib/braintree/validation_error_collection.rb
93
- - lib/braintree/paypal_account_gateway.rb
94
- - lib/braintree/digest.rb
95
- - lib/braintree/test_transaction.rb
96
- - lib/braintree/subscription_gateway.rb
110
+ - lib/braintree/add_on_gateway.rb
111
+ - lib/braintree/subscription/status_details.rb
112
+ - lib/braintree/add_on.rb
113
+ - lib/braintree/discount_gateway.rb
97
114
  - lib/braintree/customer.rb
98
- - lib/braintree/xml/generator.rb
99
- - lib/braintree/xml/rexml.rb
100
- - lib/braintree/xml/libxml.rb
101
- - lib/braintree/xml/parser.rb
102
- - lib/braintree/webhook_notification.rb
103
- - lib/braintree/error_codes.rb
104
- - lib/braintree/webhook_testing_gateway.rb
105
- - lib/braintree/address.rb
106
- - lib/braintree/merchant_account/individual_details.rb
107
- - lib/braintree/merchant_account/address_details.rb
108
- - lib/braintree/merchant_account/funding_details.rb
109
- - lib/braintree/merchant_account/business_details.rb
115
+ - lib/braintree/address_gateway.rb
116
+ - lib/braintree/dispute.rb
117
+ - lib/braintree/modification.rb
118
+ - lib/braintree/client_token_gateway.rb
119
+ - lib/braintree/customer_search.rb
110
120
  - lib/braintree/configuration.rb
111
- - lib/braintree/credit_card_verification_gateway.rb
112
- - lib/braintree/coinbase_account.rb
113
- - lib/braintree/validation_error.rb
114
- - lib/braintree/unknown_payment_method.rb
115
- - lib/braintree/signature_service.rb
121
+ - lib/braintree/payment_method_nonce.rb
116
122
  - lib/braintree/error_result.rb
117
- - lib/braintree/credit_card_verification.rb
118
- - lib/braintree/successful_result.rb
119
- - lib/braintree/settlement_batch_summary_gateway.rb
120
- - lib/braintree/resource_collection.rb
121
- - lib/braintree/plan.rb
122
- - lib/braintree/subscription/status_details.rb
123
- - lib/braintree/payment_method_nonce_gateway.rb
124
- - lib/braintree/util.rb
125
- - lib/braintree/errors.rb
126
- - lib/braintree/discount_gateway.rb
127
- - lib/braintree/settlement_batch.rb
128
- - lib/braintree/testing_gateway.rb
129
- - lib/braintree/webhook_testing.rb
130
- - lib/braintree/merchant_account_gateway.rb
123
+ - lib/braintree/paypal_account_gateway.rb
131
124
  - lib/braintree/sha256_digest.rb
132
- - lib/braintree/client_token_gateway.rb
125
+ - lib/braintree/subscription_gateway.rb
126
+ - lib/braintree/coinbase_account.rb
127
+ - lib/braintree/http.rb
128
+ - lib/braintree/settlement_batch_summary_gateway.rb
129
+ - lib/braintree/signature_service.rb
133
130
  - lib/braintree/plan_gateway.rb
134
- - lib/braintree/payment_instrument_type.rb
135
- - lib/braintree/transaction_gateway.rb
136
- - lib/braintree.rb
137
- - lib/ssl/www_braintreegateway_com.ca.crt
138
- - lib/ssl/api_braintreegateway_com.ca.crt
131
+ - lib/braintree/customer_gateway.rb
132
+ - lib/braintree/plan.rb
133
+ - lib/braintree/error_codes.rb
134
+ - lib/braintree/payment_method.rb
139
135
  - lib/ssl/securetrust_ca.crt
140
136
  - lib/ssl/sandbox_braintreegateway_com.ca.crt
141
- - spec/hacks/tcp_socket.rb
137
+ - lib/ssl/www_braintreegateway_com.ca.crt
138
+ - lib/ssl/api_braintreegateway_com.ca.crt
142
139
  - spec/httpsd.pid
143
- - spec/integration/braintree/test_transaction_spec.rb
144
- - spec/integration/braintree/subscription_spec.rb
145
- - spec/integration/braintree/test/transaction_amounts_spec.rb
146
- - spec/integration/braintree/plan_spec.rb
147
- - spec/integration/braintree/add_on_spec.rb
148
- - spec/integration/braintree/client_api/spec_helper.rb
149
- - spec/integration/braintree/client_api/client_token_spec.rb
150
- - spec/integration/braintree/advanced_search_spec.rb
151
- - spec/integration/braintree/customer_spec.rb
152
- - spec/integration/braintree/transaction_spec.rb
153
- - spec/integration/braintree/address_spec.rb
154
- - spec/integration/braintree/settlement_batch_summary_spec.rb
155
- - spec/integration/braintree/coinbase_spec.rb
156
- - spec/integration/braintree/merchant_account_spec.rb
157
- - spec/integration/braintree/customer_search_spec.rb
140
+ - spec/spec.opts
141
+ - spec/script/httpsd.rb
158
142
  - spec/integration/braintree/disbursement_spec.rb
159
- - spec/integration/braintree/error_codes_spec.rb
160
- - spec/integration/braintree/payment_method_nonce_spec.rb
161
- - spec/integration/braintree/payment_method_spec.rb
162
- - spec/integration/braintree/credit_card_verification_search_spec.rb
163
143
  - spec/integration/braintree/http_spec.rb
144
+ - spec/integration/braintree/test/transaction_amounts_spec.rb
145
+ - spec/integration/braintree/payment_method_spec.rb
164
146
  - spec/integration/braintree/transparent_redirect_spec.rb
147
+ - spec/integration/braintree/address_spec.rb
148
+ - spec/integration/braintree/merchant_account_spec.rb
165
149
  - spec/integration/braintree/paypal_account_spec.rb
166
- - spec/integration/braintree/credit_card_verification_spec.rb
150
+ - spec/integration/braintree/subscription_spec.rb
167
151
  - spec/integration/braintree/discount_spec.rb
152
+ - spec/integration/braintree/advanced_search_spec.rb
153
+ - spec/integration/braintree/error_codes_spec.rb
154
+ - spec/integration/braintree/add_on_spec.rb
168
155
  - spec/integration/braintree/credit_card_spec.rb
156
+ - spec/integration/braintree/settlement_batch_summary_spec.rb
157
+ - spec/integration/braintree/payment_method_nonce_spec.rb
169
158
  - spec/integration/braintree/transaction_search_spec.rb
159
+ - spec/integration/braintree/plan_spec.rb
160
+ - spec/integration/braintree/customer_search_spec.rb
161
+ - spec/integration/braintree/client_api/client_token_spec.rb
162
+ - spec/integration/braintree/client_api/spec_helper.rb
163
+ - spec/integration/braintree/transaction_spec.rb
164
+ - spec/integration/braintree/credit_card_verification_spec.rb
165
+ - spec/integration/braintree/credit_card_verification_search_spec.rb
166
+ - spec/integration/braintree/coinbase_spec.rb
167
+ - spec/integration/braintree/test_transaction_spec.rb
168
+ - spec/integration/braintree/customer_spec.rb
170
169
  - spec/integration/spec_helper.rb
171
- - spec/spec.opts
172
- - spec/unit/braintree_spec.rb
173
- - spec/unit/braintree/subscription_spec.rb
170
+ - spec/hacks/tcp_socket.rb
171
+ - spec/ssl/geotrust_global.crt
172
+ - spec/ssl/certificate.crt
173
+ - spec/ssl/privateKey.key
174
+ - spec/spec_helper.rb
175
+ - spec/unit/braintree/disbursement_spec.rb
176
+ - spec/unit/braintree/http_spec.rb
174
177
  - spec/unit/braintree/error_result_spec.rb
175
- - spec/unit/braintree/transaction/deposit_details_spec.rb
178
+ - spec/unit/braintree/util_spec.rb
179
+ - spec/unit/braintree/webhook_notification_spec.rb
180
+ - spec/unit/braintree/payment_method_spec.rb
181
+ - spec/unit/braintree/transparent_redirect_spec.rb
182
+ - spec/unit/braintree/address_spec.rb
183
+ - spec/unit/braintree/configuration_spec.rb
184
+ - spec/unit/braintree/subscription_search_spec.rb
185
+ - spec/unit/braintree/merchant_account_spec.rb
186
+ - spec/unit/braintree/paypal_account_spec.rb
187
+ - spec/unit/braintree/subscription_spec.rb
188
+ - spec/unit/braintree/xml/libxml_spec.rb
189
+ - spec/unit/braintree/xml/parser_spec.rb
190
+ - spec/unit/braintree/xml/rexml_spec.rb
191
+ - spec/unit/braintree/credit_card_spec.rb
192
+ - spec/unit/braintree/resource_collection_spec.rb
193
+ - spec/unit/braintree/successful_result_spec.rb
194
+ - spec/unit/braintree/transaction_search_spec.rb
195
+ - spec/unit/braintree/client_token_spec.rb
196
+ - spec/unit/braintree/risk_data_spec.rb
176
197
  - spec/unit/braintree/transaction/customer_details_spec.rb
177
198
  - spec/unit/braintree/transaction/credit_card_details_spec.rb
199
+ - spec/unit/braintree/transaction/deposit_details_spec.rb
178
200
  - spec/unit/braintree/validation_error_collection_spec.rb
201
+ - spec/unit/braintree/digest_spec.rb
202
+ - spec/unit/braintree/base_module_spec.rb
179
203
  - spec/unit/braintree/errors_spec.rb
204
+ - spec/unit/braintree/signature_service_spec.rb
205
+ - spec/unit/braintree/dispute_spec.rb
180
206
  - spec/unit/braintree/apple_pay_card_spec.rb
181
- - spec/unit/braintree/modification_spec.rb
182
207
  - spec/unit/braintree/sha256_digest_spec.rb
183
- - spec/unit/braintree/customer_spec.rb
208
+ - spec/unit/braintree/validation_error_spec.rb
209
+ - spec/unit/braintree/xml_spec.rb
184
210
  - spec/unit/braintree/unknown_payment_method_spec.rb
211
+ - spec/unit/braintree/three_d_secure_info_spec.rb
185
212
  - spec/unit/braintree/transaction_spec.rb
186
- - spec/unit/braintree/address_spec.rb
187
- - spec/unit/braintree/base_module_spec.rb
188
- - spec/unit/braintree/configuration_spec.rb
189
- - spec/unit/braintree/xml_spec.rb
190
- - spec/unit/braintree/resource_collection_spec.rb
191
- - spec/unit/braintree/digest_spec.rb
192
- - spec/unit/braintree/xml/parser_spec.rb
193
- - spec/unit/braintree/xml/rexml_spec.rb
194
- - spec/unit/braintree/xml/libxml_spec.rb
195
- - spec/unit/braintree/util_spec.rb
196
- - spec/unit/braintree/client_token_spec.rb
197
- - spec/unit/braintree/merchant_account_spec.rb
198
- - spec/unit/braintree/signature_service_spec.rb
199
- - spec/unit/braintree/disbursement_spec.rb
200
- - spec/unit/braintree/payment_method_spec.rb
201
- - spec/unit/braintree/credit_card_verification_search_spec.rb
202
- - spec/unit/braintree/http_spec.rb
203
- - spec/unit/braintree/validation_error_spec.rb
204
- - spec/unit/braintree/transparent_redirect_spec.rb
205
- - spec/unit/braintree/paypal_account_spec.rb
206
- - spec/unit/braintree/subscription_search_spec.rb
207
- - spec/unit/braintree/webhook_notification_spec.rb
208
- - spec/unit/braintree/dispute_spec.rb
209
213
  - spec/unit/braintree/credit_card_verification_spec.rb
210
- - spec/unit/braintree/risk_data_spec.rb
211
- - spec/unit/braintree/successful_result_spec.rb
212
- - spec/unit/braintree/credit_card_spec.rb
213
- - spec/unit/braintree/transaction_search_spec.rb
214
+ - spec/unit/braintree/credit_card_verification_search_spec.rb
215
+ - spec/unit/braintree/modification_spec.rb
216
+ - spec/unit/braintree/customer_spec.rb
214
217
  - spec/unit/spec_helper.rb
215
- - spec/script/httpsd.rb
216
- - spec/spec_helper.rb
217
- - spec/ssl/geotrust_global.crt
218
- - spec/ssl/privateKey.key
219
- - spec/ssl/certificate.crt
218
+ - spec/unit/braintree_spec.rb
220
219
  - braintree.gemspec
221
220
  homepage: http://www.braintreepayments.com/
222
221
  licenses:
223
222
  - MIT
223
+ metadata: {}
224
224
  post_install_message:
225
225
  rdoc_options: []
226
226
  require_paths:
227
227
  - lib
228
228
  required_ruby_version: !ruby/object:Gem::Requirement
229
- none: false
230
229
  requirements:
231
- - - ! '>='
230
+ - - '>='
232
231
  - !ruby/object:Gem::Version
233
232
  version: '0'
234
233
  required_rubygems_version: !ruby/object:Gem::Requirement
235
- none: false
236
234
  requirements:
237
- - - ! '>='
235
+ - - '>='
238
236
  - !ruby/object:Gem::Version
239
237
  version: '0'
240
238
  requirements: []
241
239
  rubyforge_project: braintree
242
- rubygems_version: 1.8.24
240
+ rubygems_version: 2.1.11
243
241
  signing_key:
244
- specification_version: 3
242
+ specification_version: 4
245
243
  summary: Braintree Gateway Ruby Client Library
246
244
  test_files: []