braintree 2.92.0 → 2.93.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ee8dac5bb756fb408c50fa5acef0ad21bf4d10127ade82df57828bd7123484f
4
- data.tar.gz: adb2042d479a2418d62e8da23b6aeaa77490e46dea06daefbff0f4c19209c59c
3
+ metadata.gz: fe7e71dc2faed60283e8b70c632dcc9f60c5402897caed595cf7689b6d8152c1
4
+ data.tar.gz: aa6b2334db4ee60824c5fd84d0a665f4709f328337fae8ee3f081c9237093148
5
5
  SHA512:
6
- metadata.gz: 5a1b0f3e1a7600a0a699baa9a398585704960e6fa78958be8ec9e8a95fa191d234b73c91294b15cb8f99ce699e2aaec9af2c5c9c5f28778895be039782fc96a2
7
- data.tar.gz: 67f11e2d63c8ce0e0ca9bdd25a8b160ee0453c371495b9e9b4d83220c7c990963f496de28b08200852e8bfb76d9afad73a138136aeba0a22d303594a138008cb
6
+ metadata.gz: f50449f12b8e0c806a36a7111fd007c4d4bbc877a46dac3e50fe655e3258a6832983911f6354d0d361e59d4d2d9540b134f5f3fd45a0f6f8402b638a29b77229
7
+ data.tar.gz: f124d8089b885395f91fe95e88533fbe26e52e008a603cafd5ddb743b2abaee8b3416a6953c8a877a213503d8aeb95ffde7035694f67a8dd700e1af1fc7f06d7
@@ -345,6 +345,7 @@ module Braintree
345
345
  MerchantAccountDoesNotMatchIdealPaymentMerchantAccount = "915143"
346
346
  MerchantAccountDoesNotSupportMOTO = "91558"
347
347
  MerchantAccountDoesNotSupportRefunds = "91547"
348
+ MerchantAccountIdDoesNotMatchSubscription = "915180"
348
349
  MerchantAccountIdIsInvalid = "91513"
349
350
  MerchantAccountIsSuspended = "91514"
350
351
  OrderIdIsTooLong = "91501"
@@ -439,6 +440,53 @@ module Braintree
439
440
  LodgingCheckInDateIsInvalid = "93412"
440
441
  LodgingCheckOutDateIsInvalid = "93413"
441
442
  end
443
+
444
+ module TravelFlight
445
+ EmptyData = "93414"
446
+ UnknownDataField = "93415"
447
+ CustomerCodeIsTooLong = "93416"
448
+ FareAmountCannotBeNegative = "93417"
449
+ FareAmountFormatIsInvalid = "93418"
450
+ FareAmountIsTooLarge = "93419"
451
+ FeeAmountCannotBeNegative = "93420"
452
+ FeeAmountFormatIsInvalid = "93421"
453
+ FeeAmountIsTooLarge = "93422"
454
+ IssuedDateFormatIsInvalid = "93423"
455
+ IssuingCarrierCodeIsTooLong = "93424"
456
+ PassengerMiddleInitialIsTooLong = "93425"
457
+ RestrictedTicketIsRequired = "93426"
458
+ TaxAmountCannotBeNegative = "93427"
459
+ TaxAmountFormatIsInvalid = "93428"
460
+ TaxAmountIsTooLarge = "93429"
461
+ TicketNumberIsTooLong = "93430"
462
+ LegsExpected = "93431"
463
+ TooManyLegs = "93432"
464
+ end
465
+
466
+ module Leg
467
+ module TravelFlight
468
+ ArrivalAirportCodeIsTooLong = "96301"
469
+ ArrivalTimeFormatIsInvalid = "96302"
470
+ CarrierCodeIsTooLong = "96303"
471
+ ConjunctionTicketIsTooLong = "96304"
472
+ CouponNumberIsTooLong = "96305"
473
+ DepartureAirportCodeIsTooLong = "96306"
474
+ DepartureTimeFormatIsInvalid = "96307"
475
+ ExchangeTicketIsTooLong = "96308"
476
+ FareAmountCannotBeNegative = "96309"
477
+ FareAmountFormatIsInvalid = "96310"
478
+ FareAmountIsTooLarge = "96311"
479
+ FareBasisCodeIsTooLong = "96312"
480
+ FeeAmountCannotBeNegative = "96313"
481
+ FeeAmountFormatIsInvalid = "96314"
482
+ FeeAmountIsTooLarge = "96315"
483
+ ServiceClassIsTooLong = "96316"
484
+ TaxAmountCannotBeNegative = "96317"
485
+ TaxAmountFormatIsInvalid = "96318"
486
+ TaxAmountIsTooLarge = "96319"
487
+ TicketNumberIsTooLong = "96320"
488
+ end
489
+ end
442
490
  end
443
491
 
444
492
  module ExternalVault
@@ -5,13 +5,14 @@ module Braintree
5
5
  attr_reader :decision
6
6
  attr_reader :device_data_captured
7
7
  attr_reader :id
8
+ attr_reader :fraud_service_provider
8
9
 
9
10
  def initialize(attributes)
10
11
  set_instance_variables_from_hash attributes unless attributes.nil?
11
12
  end
12
13
 
13
14
  def inspect
14
- attr_order = [:id, :decision, :device_data_captured]
15
+ attr_order = [:id, :decision, :device_data_captured, :fraud_service_provider]
15
16
  formatted_attrs = attr_order.map do |attr|
16
17
  "#{attr}: #{send(attr).inspect}"
17
18
  end
@@ -58,6 +58,7 @@ module Braintree
58
58
  module IndustryType
59
59
  Lodging = "lodging"
60
60
  TravelAndCruise = "travel_cruise"
61
+ TravelAndFlight = "travel_flight"
61
62
 
62
63
  All = constants.map { |c| const_get(c) }
63
64
  end
@@ -232,8 +232,19 @@ module Braintree
232
232
  ]},
233
233
  {:custom_fields => :_any_key_},
234
234
  {:descriptor => [:name, :phone, :url]},
235
- {:paypal_account => [:email, :token, :paypal_data, :payee_id, :payee_email]},
236
- {:industry => [:industry_type, {:data => [:folio_number, :check_in_date, :check_out_date, :travel_package, :lodging_check_in_date, :lodging_check_out_date, :departure_date, :lodging_name, :room_rate]}]},
235
+ {:paypal_account => [:email, :token, :paypal_data, :payee_id, :payee_email, :payer_id, :payment_id]},
236
+ {:industry => [
237
+ :industry_type,
238
+ {:data => [
239
+ :folio_number, :check_in_date, :check_out_date, :travel_package, :lodging_check_in_date, :lodging_check_out_date, :departure_date, :lodging_name, :room_rate,
240
+ :passenger_first_name, :passenger_last_name, :passenger_middle_initial, :passenger_title, :issued_date, :travel_agency_name, :travel_agency_code, :ticket_number,
241
+ :issuing_carrier_code, :customer_code, :fare_amount, :fee_amount, :tax_amount, :restricted_ticket,
242
+ {:legs => [
243
+ :conjunction_ticket, :exchange_ticket, :coupon_number, :service_class, :carrier_code, :fare_basis_code, :flight_number, :departure_date, :departure_airport_code, :departure_time,
244
+ :arrival_airport_code, :arrival_time, :stopover_permitted, :fare_amount, :fee_amount, :tax_amount, :endorsement_or_restrictions,
245
+ ]},
246
+ ]},
247
+ ]},
237
248
  {:apple_pay_card => [:number, :cardholder_name, :cryptogram, :expiration_month, :expiration_year, :eci_indicator]},
238
249
  {:android_pay_card => [:number, :cryptogram, :google_transaction_id, :expiration_month, :expiration_year, :source_card_type, :source_card_last_four, :eci_indicator]}
239
250
  ]
@@ -1,7 +1,7 @@
1
1
  module Braintree
2
2
  module Version
3
3
  Major = 2
4
- Minor = 92
4
+ Minor = 93
5
5
  Tiny = 0
6
6
 
7
7
  String = "#{Major}.#{Minor}.#{Tiny}"
@@ -152,6 +152,7 @@ describe Braintree::CreditCard do
152
152
  verification.risk_data.should respond_to(:id)
153
153
  verification.risk_data.should respond_to(:decision)
154
154
  verification.risk_data.should respond_to(:device_data_captured)
155
+ verification.risk_data.should respond_to(:fraud_service_provider)
155
156
  end
156
157
  end
157
158
 
@@ -137,6 +137,7 @@ describe Braintree::Transaction do
137
137
  result.transaction.risk_data.should respond_to(:id)
138
138
  result.transaction.risk_data.should respond_to(:decision)
139
139
  result.transaction.risk_data.should respond_to(:device_data_captured)
140
+ result.transaction.risk_data.should respond_to(:fraud_service_provider)
140
141
  end
141
142
  end
142
143
  end
@@ -246,6 +247,105 @@ describe Braintree::Transaction do
246
247
  result.errors.for(:transaction).for(:industry).map { |e| e.code }.sort.should == [Braintree::ErrorCodes::Transaction::Industry::TravelCruise::TravelPackageIsInvalid]
247
248
  end
248
249
  end
250
+
251
+ context "for travel flight" do
252
+ it "accepts valid industry data" do
253
+ result = Braintree::Transaction.create(
254
+ :type => "sale",
255
+ :amount => 1_00,
256
+ :payment_method_nonce => Braintree::Test::Nonce::PayPalOneTimePayment,
257
+ :options => {
258
+ :submit_for_settlement => true
259
+ },
260
+ :industry => {
261
+ :industry_type => Braintree::Transaction::IndustryType::TravelAndFlight,
262
+ :data => {
263
+ :passenger_first_name => "John",
264
+ :passenger_last_name => "Doe",
265
+ :passenger_middle_initial => "M",
266
+ :passenger_title => "Mr.",
267
+ :issued_date => Date.new(2018, 1, 1),
268
+ :travel_agency_name => "Expedia",
269
+ :travel_agency_code => "12345678",
270
+ :ticket_number => "ticket-number",
271
+ :issuing_carrier_code => "AA",
272
+ :customer_code => "customer-code",
273
+ :fare_amount => 70_00,
274
+ :fee_amount => 10_00,
275
+ :tax_amount => 20_00,
276
+ :restricted_ticket => false,
277
+ :legs => [
278
+ {
279
+ :conjunction_ticket => "CJ0001",
280
+ :exchange_ticket => "ET0001",
281
+ :coupon_number => "1",
282
+ :service_class => "Y",
283
+ :carrier_code => "AA",
284
+ :fare_basis_code => "W",
285
+ :flight_number => "AA100",
286
+ :departure_date => Date.new(2018, 1, 2),
287
+ :departure_airport_code => "MDW",
288
+ :departure_time => "08:00",
289
+ :arrival_airport_code => "ATX",
290
+ :arrival_time => "10:00",
291
+ :stopover_permitted => false,
292
+ :fare_amount => 35_00,
293
+ :fee_amount => 5_00,
294
+ :tax_amount => 10_00,
295
+ :endorsement_or_restrictions => "NOT REFUNDABLE"
296
+ },
297
+ {
298
+ :conjunction_ticket => "CJ0002",
299
+ :exchange_ticket => "ET0002",
300
+ :coupon_number => "1",
301
+ :service_class => "Y",
302
+ :carrier_code => "AA",
303
+ :fare_basis_code => "W",
304
+ :flight_number => "AA200",
305
+ :departure_date => Date.new(2018, 1, 3),
306
+ :departure_airport_code => "ATX",
307
+ :departure_time => "12:00",
308
+ :arrival_airport_code => "MDW",
309
+ :arrival_time => "14:00",
310
+ :stopover_permitted => false,
311
+ :fare_amount => 35_00,
312
+ :fee_amount => 5_00,
313
+ :tax_amount => 10_00,
314
+ :endorsement_or_restrictions => "NOT REFUNDABLE"
315
+ }
316
+ ]
317
+ }
318
+ }
319
+ )
320
+ result.success?.should be(true)
321
+ end
322
+
323
+ it "returns errors if validations on industry data fails" do
324
+ result = Braintree::Transaction.create(
325
+ :type => "sale",
326
+ :amount => 1_00,
327
+ :payment_method_nonce => Braintree::Test::Nonce::PayPalOneTimePayment,
328
+ :options => {
329
+ :submit_for_settlement => true
330
+ },
331
+ :industry => {
332
+ :industry_type => Braintree::Transaction::IndustryType::TravelAndFlight,
333
+ :data => {
334
+ :fare_amount => -1_23,
335
+ :restricted_ticket => false,
336
+ :legs => [
337
+ {
338
+ :fare_amount => -1_23
339
+ }
340
+ ]
341
+ }
342
+ }
343
+ )
344
+ result.success?.should be(false)
345
+ result.errors.for(:transaction).for(:industry).map { |e| e.code }.sort.should == [Braintree::ErrorCodes::Transaction::Industry::TravelFlight::FareAmountCannotBeNegative]
346
+ result.errors.for(:transaction).for(:industry).for(:legs).for(:index_0).map { |e| e.code }.sort.should == [Braintree::ErrorCodes::Transaction::Industry::Leg::TravelFlight::FareAmountCannotBeNegative]
347
+ end
348
+ end
249
349
  end
250
350
 
251
351
  context "elo" do
@@ -777,12 +877,8 @@ describe Braintree::Transaction do
777
877
  }
778
878
  result = Braintree::Transaction.create(params[:transaction])
779
879
  result.success?.should == false
780
- result.errors.for(:transaction).on(:base).map{|error| error.code}.should include(Braintree::ErrorCodes::Transaction::PaymentMethodConflictWithVenmoSDK)
781
880
  result.errors.for(:transaction).on(:base).map{|error| error.code}.should include(Braintree::ErrorCodes::Transaction::PaymentMethodDoesNotBelongToCustomer)
782
- result.errors.for(:transaction).on(:amount)[0].code.should == Braintree::ErrorCodes::Transaction::AmountIsRequired
783
881
  result.errors.for(:transaction).on(:customer_id)[0].code.should == Braintree::ErrorCodes::Transaction::CustomerIdIsInvalid
784
- result.errors.for(:transaction).on(:order_id)[0].code.should == Braintree::ErrorCodes::Transaction::OrderIdIsTooLong
785
- result.errors.for(:transaction).on(:channel)[0].code.should == Braintree::ErrorCodes::Transaction::ChannelIsTooLong
786
882
  result.errors.for(:transaction).on(:payment_method_token)[0].code.should == Braintree::ErrorCodes::Transaction::PaymentMethodTokenIsInvalid
787
883
  result.errors.for(:transaction).on(:type)[0].code.should == Braintree::ErrorCodes::Transaction::TypeIsInvalid
788
884
  end
@@ -1636,6 +1732,24 @@ describe Braintree::Transaction do
1636
1732
  result.transaction.should_not be_nil
1637
1733
  end
1638
1734
 
1735
+ it "can create a transaction with local payment webhook content" do
1736
+ result = Braintree::Transaction.sale(
1737
+ :amount => "100",
1738
+ :options => {
1739
+ :submit_for_settlement => true
1740
+ },
1741
+ :paypal_account => {
1742
+ :payer_id => "PAYER-1234",
1743
+ :payment_id => "PAY-5678",
1744
+ }
1745
+ )
1746
+
1747
+ result.success?.should == true
1748
+ result.transaction.status.should == Braintree::Transaction::Status::Settling
1749
+ result.transaction.paypal_details.payer_id.should == "PAYER-1234"
1750
+ result.transaction.paypal_details.payment_id.should == "PAY-5678"
1751
+ end
1752
+
1639
1753
  it "can create a transaction with a payee id" do
1640
1754
  customer = Braintree::Customer.create!
1641
1755
  nonce = nonce_for_new_payment_method(
@@ -108,12 +108,14 @@ describe Braintree::CreditCardVerification do
108
108
  verification = Braintree::CreditCardVerification._new(:risk_data => {
109
109
  :id => "123",
110
110
  :decision => "WOO YOU WON $1000 dollars",
111
- :device_data_captured => true
111
+ :device_data_captured => true,
112
+ :fraud_service_provider => "kount"
112
113
  })
113
114
 
114
115
  verification.risk_data.id.should == "123"
115
116
  verification.risk_data.decision.should == "WOO YOU WON $1000 dollars"
116
117
  verification.risk_data.device_data_captured.should == true
118
+ verification.risk_data.fraud_service_provider.should == "kount"
117
119
  end
118
120
 
119
121
  it "handles a nil risk_data" do
@@ -3,10 +3,11 @@ require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
3
3
  describe Braintree::RiskData do
4
4
  describe "#initialize" do
5
5
  it "sets id, decision and device_data_captured" do
6
- risk_data = Braintree::RiskData.new(:id => "123", :decision => "YOU WON $1000 DOLLARS", :device_data_captured => true)
6
+ risk_data = Braintree::RiskData.new(:id => "123", :decision => "YOU WON $1000 DOLLARS", :device_data_captured => true, :fraud_service_provider => "kount")
7
7
  risk_data.id.should == "123"
8
8
  risk_data.decision.should == "YOU WON $1000 DOLLARS"
9
9
  risk_data.device_data_captured.should be_truthy
10
+ risk_data.fraud_service_provider.should == "kount"
10
11
  end
11
12
  end
12
13
 
@@ -15,9 +16,10 @@ describe Braintree::RiskData do
15
16
  details = Braintree::RiskData.new(
16
17
  :id => "123",
17
18
  :decision => "YOU WON $1000 DOLLARS",
18
- :device_data_captured => true
19
+ :device_data_captured => true,
20
+ :fraud_service_provider => "kount",
19
21
  )
20
- details.inspect.should == %(#<RiskData id: "123", decision: "YOU WON $1000 DOLLARS", device_data_captured: true>)
22
+ details.inspect.should == %(#<RiskData id: "123", decision: "YOU WON $1000 DOLLARS", device_data_captured: true, fraud_service_provider: "kount">)
21
23
  end
22
24
  end
23
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: braintree
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.92.0
4
+ version: 2.93.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Braintree
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-01 00:00:00.000000000 Z
11
+ date: 2018-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder
@@ -316,7 +316,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
316
316
  version: '0'
317
317
  requirements: []
318
318
  rubyforge_project: braintree
319
- rubygems_version: 2.7.7
319
+ rubygems_version: 2.7.8
320
320
  signing_key:
321
321
  specification_version: 4
322
322
  summary: Braintree Gateway Ruby Client Library