braintree 2.95.0 → 2.96.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: a6885baaa1cf0362ea29a6c57834122bfef5ef5e4f022527e7d8d25fa4c748b6
4
- data.tar.gz: b2bff8e8cc234fcab9ee20a37c53f5977da827ab74b3634f4ac1e7f044423ca3
3
+ metadata.gz: 05a36d5ea5b0870293e17db6baa85393f97e0a8aa8ba495ee34ec2f30d64f29a
4
+ data.tar.gz: d7291802e13bfdecf5e3258b0f9cac7bb15654fd4f6249faf0e96444de55576e
5
5
  SHA512:
6
- metadata.gz: f79c7a60e1eeb0ad4ae677d8402eb0aa1538f55d6a29e2b324acb0db6506b8ec43e04e32ca8a5b3de20ced19f383c99038435d9a1a525fad3d8cf2b7aeb5d6df
7
- data.tar.gz: 109bbdea462fddac547448a411f1d99a020ef46833313608846cb1d04c49eca0aa508a4221ac044cde8bb8a03251dcdf26002050d1499b857fe83b90f74a3a03
6
+ metadata.gz: d5bee8dcbe48df9d0c752d150dd3c18ae3c4232a31aa3e850ac5ab1a8ef4a85f292515b96489dbf736a2bde1d4780bb1f5f1edfb4eeaeacde6b983e8c72d4825
7
+ data.tar.gz: 5065e4ad5cde4db02b5bfdee866425a8d837604ff50b69d4c1f721915e6483cec41ef8ff9e53f03c3ce2290d1e27f13a346c01bb9a277ffd0b179284ed4fba9d
@@ -76,6 +76,7 @@ require "braintree/ideal_payment"
76
76
  require "braintree/ideal_payment_gateway"
77
77
  require "braintree/transaction/ideal_payment_details"
78
78
  require "braintree/local_payment_completed"
79
+ require "braintree/transaction/local_payment_details"
79
80
  require "braintree/merchant"
80
81
  require "braintree/merchant_gateway"
81
82
  require "braintree/merchant_account"
@@ -72,6 +72,8 @@ module Braintree
72
72
  UsBankAccountGateway.new(self)
73
73
  end
74
74
 
75
+ # NEXT_MAJOR_VERSION Remove this class as legacy Ideal has been removed/disabled in the Braintree Gateway
76
+ # DEPRECATED If you're looking to accept iDEAL as a payment method contact accounts@braintreepayments.com for a solution.
75
77
  def ideal_payment
76
78
  IdealPaymentGateway.new(self)
77
79
  end
@@ -1,4 +1,6 @@
1
1
  module Braintree
2
+ # NEXT_MAJOR_VERSION Remove this class as legacy Ideal has been removed/disabled in the Braintree Gateway
3
+ # DEPRECATED If you're looking to accept iDEAL as a payment method contact accounts@braintreepayments.com for a solution.
2
4
  class IdealPayment
3
5
  include BaseModule
4
6
 
@@ -1,4 +1,6 @@
1
1
  module Braintree
2
+ # NEXT_MAJOR_VERSION Remove this class as legacy Ideal has been removed/disabled in the Braintree Gateway
3
+ # DEPRECATED If you're looking to accept iDEAL as a payment method contact accounts@braintreepayments.com for a solution.
2
4
  class IdealPaymentGateway
3
5
  def initialize(gateway)
4
6
  @gateway = gateway
@@ -4,9 +4,12 @@ module Braintree
4
4
 
5
5
  attr_reader :payment_id
6
6
  attr_reader :payer_id
7
+ attr_reader :payment_method_nonce
8
+ attr_reader :transaction
7
9
 
8
10
  def initialize(attributes) # :nodoc:
9
11
  set_instance_variables_from_hash(attributes)
12
+ @transaction = Transaction._new(Configuration.gateway, transaction)
10
13
  end
11
14
 
12
15
  class << self
@@ -8,9 +8,9 @@ module Braintree
8
8
  AndroidPayCard = 'android_pay_card'
9
9
  VenmoAccount = 'venmo_account'
10
10
  UsBankAccount = 'us_bank_account'
11
- IdealPayment = 'ideal_payment'
12
11
  VisaCheckoutCard = 'visa_checkout_card'
13
12
  MasterpassCard = 'masterpass_card'
14
13
  SamsungPayCard = 'samsung_pay_card'
14
+ LocalPayment = 'local_payment'
15
15
  end
16
16
  end
@@ -8,6 +8,7 @@ module Braintree
8
8
  attr_reader :email
9
9
  attr_reader :image_url
10
10
  attr_reader :payer_id
11
+ attr_reader :revoked_at
11
12
  attr_reader :subscriptions
12
13
  attr_reader :token
13
14
  attr_reader :updated_at
@@ -6,6 +6,7 @@ module Braintree
6
6
  PayPalOneTimePayment = "fake-paypal-one-time-nonce"
7
7
  PayPalFuturePayment = "fake-paypal-future-nonce"
8
8
  PayPalBillingAgreement = "fake-paypal-billing-agreement-nonce"
9
+ LocalPayment = "fake-local-payment-nonce"
9
10
  ApplePayVisa = "fake-apple-pay-visa-nonce"
10
11
  ApplePayMasterCard = "fake-apple-pay-mastercard-nonce"
11
12
  ApplePayAmEx = "fake-apple-pay-amex-nonce"
@@ -18,6 +19,7 @@ module Braintree
18
19
  AndroidPayAmEx = "fake-android-pay-amex-nonce"
19
20
  AmexExpressCheckout = "fake-amex-express-checkout-nonce"
20
21
  VenmoAccount = "fake-venmo-account-nonce"
22
+ VenmoAccountTokenIssuanceError = "fake-token-issuance-error-venmo-account-nonce"
21
23
  TransactableVisa = "fake-valid-visa-nonce"
22
24
  TransactableAmEx = "fake-valid-amex-nonce"
23
25
  TransactableMasterCard = "fake-valid-mastercard-nonce"
@@ -26,6 +26,7 @@ module Braintree
26
26
  Duplicate = "duplicate"
27
27
  Fraud = "fraud"
28
28
  ThreeDSecure = "three_d_secure"
29
+ TokenIssuance = "token_issuance"
29
30
  Unrecognized = "unrecognized"
30
31
  end
31
32
 
@@ -108,7 +109,10 @@ module Braintree
108
109
  attr_reader :facilitator_details
109
110
  attr_reader :gateway_rejection_reason
110
111
  attr_reader :id
112
+ # NEXT_MAJOR_VERSION Remove this class as legacy Ideal has been removed/disabled in the Braintree Gateway
113
+ # DEPRECATED If you're looking to accept iDEAL as a payment method contact accounts@braintreepayments.com for a solution.
111
114
  attr_reader :ideal_payment_details
115
+ attr_reader :local_payment_details
112
116
  attr_reader :masterpass_card_details
113
117
  attr_reader :merchant_account_id
114
118
  attr_reader :network_transaction_id
@@ -282,6 +286,7 @@ module Braintree
282
286
  @status_history = attributes[:status_history] ? attributes[:status_history].map { |s| StatusDetails.new(s) } : []
283
287
  @tax_amount = Util.to_big_decimal(tax_amount)
284
288
  @descriptor = Descriptor.new(@descriptor)
289
+ @local_payment_details = LocalPaymentDetails.new(@local_payment)
285
290
  @paypal_details = PayPalDetails.new(@paypal)
286
291
  @apple_pay_details = ApplePayDetails.new(@apple_pay)
287
292
  @android_pay_details = AndroidPayDetails.new(@android_pay_card)
@@ -15,6 +15,16 @@ module Braintree
15
15
  attr_reader :token
16
16
  attr_reader :virtual_card_last_4
17
17
  attr_reader :virtual_card_type
18
+ attr_reader :prepaid
19
+ attr_reader :healthcare
20
+ attr_reader :debit
21
+ attr_reader :durbin_regulated
22
+ attr_reader :commercial
23
+ attr_reader :payroll
24
+ attr_reader :issuing_bank
25
+ attr_reader :country_of_issuance
26
+ attr_reader :product_id
27
+ attr_reader :global_id
18
28
 
19
29
  def initialize(attributes)
20
30
  set_instance_variables_from_hash attributes unless attributes.nil?
@@ -12,6 +12,16 @@ module Braintree
12
12
  attr_reader :payment_instrument_name
13
13
  attr_reader :source_description
14
14
  attr_reader :token
15
+ attr_reader :prepaid
16
+ attr_reader :healthcare
17
+ attr_reader :debit
18
+ attr_reader :durbin_regulated
19
+ attr_reader :commercial
20
+ attr_reader :payroll
21
+ attr_reader :issuing_bank
22
+ attr_reader :country_of_issuance
23
+ attr_reader :product_id
24
+ attr_reader :global_id
15
25
 
16
26
  def initialize(attributes)
17
27
  set_instance_variables_from_hash attributes unless attributes.nil?
@@ -1,4 +1,6 @@
1
1
  module Braintree
2
+ # NEXT_MAJOR_VERSION Remove this class as legacy Ideal has been removed/disabled in the Braintree Gateway
3
+ # DEPRECATED If you're looking to accept iDEAL as a payment method contact accounts@braintreepayments.com for a solution.
2
4
  class Transaction
3
5
  class IdealPaymentDetails # :nodoc:
4
6
  include BaseModule
@@ -0,0 +1,17 @@
1
+ module Braintree
2
+ class Transaction
3
+ class LocalPaymentDetails
4
+ include BaseModule
5
+
6
+ attr_reader :custom_field
7
+ attr_reader :description
8
+ attr_reader :funding_source
9
+ attr_reader :payer_id
10
+ attr_reader :payment_id
11
+
12
+ def initialize(attributes)
13
+ set_instance_variables_from_hash attributes unless attributes.nil?
14
+ end
15
+ end
16
+ end
17
+ end
@@ -9,14 +9,16 @@ module Braintree
9
9
  attr_reader :debug_id
10
10
  attr_reader :description
11
11
  attr_reader :image_url
12
- attr_reader :payee_id
13
12
  attr_reader :payee_email
13
+ attr_reader :payee_id
14
14
  attr_reader :payer_email
15
15
  attr_reader :payer_first_name
16
16
  attr_reader :payer_id
17
17
  attr_reader :payer_last_name
18
18
  attr_reader :payer_status
19
19
  attr_reader :payment_id
20
+ attr_reader :refund_from_transaction_fee_amount
21
+ attr_reader :refund_from_transaction_fee_currency_iso_code
20
22
  attr_reader :refund_id
21
23
  attr_reader :seller_protection_status
22
24
  attr_reader :token
@@ -1,7 +1,7 @@
1
1
  module Braintree
2
2
  module Version
3
3
  Major = 2
4
- Minor = 95
4
+ Minor = 96
5
5
  Tiny = 0
6
6
 
7
7
  String = "#{Major}.#{Minor}.#{Tiny}"
@@ -33,6 +33,8 @@ module Braintree
33
33
 
34
34
  AccountUpdaterDailyReport = "account_updater_daily_report"
35
35
 
36
+ # NEXT_MAJOR_VERSION Remove this class as legacy Ideal has been removed/disabled in the Braintree Gateway
37
+ # DEPRECATED If you're looking to accept iDEAL as a payment method contact accounts@braintreepayments.com for a solution.
36
38
  IdealPaymentComplete = "ideal_payment_complete"
37
39
  IdealPaymentFailed = "ideal_payment_failed"
38
40
 
@@ -46,6 +48,7 @@ module Braintree
46
48
  GrantorUpdatedGrantedPaymentMethod = "grantor_updated_granted_payment_method"
47
49
  RecipientUpdatedGrantedPaymentMethod = "recipient_updated_granted_payment_method"
48
50
  GrantedPaymentInstrumentRevoked = "granted_payment_instrument_revoked"
51
+ PaymentMethodRevokedByCustomer = "payment_method_revoked_by_customer"
49
52
 
50
53
  LocalPaymentCompleted = "local_payment_completed"
51
54
  end
@@ -91,7 +94,7 @@ module Braintree
91
94
  @connected_merchant_status_transitioned = ConnectedMerchantStatusTransitioned._new(@subject[:connected_merchant_status_transitioned]) if @subject.has_key?(:connected_merchant_status_transitioned)
92
95
  @connected_merchant_paypal_status_changed = ConnectedMerchantPayPalStatusChanged._new(@subject[:connected_merchant_paypal_status_changed]) if @subject.has_key?(:connected_merchant_paypal_status_changed)
93
96
  @granted_payment_instrument_update = GrantedPaymentInstrumentUpdate._new(@subject[:granted_payment_instrument_update]) if @subject.has_key?(:granted_payment_instrument_update)
94
- @revoked_payment_method_metadata = RevokedPaymentMethodMetadata._new(gateway, @subject) if @kind == Kind::GrantedPaymentInstrumentRevoked
97
+ @revoked_payment_method_metadata = RevokedPaymentMethodMetadata._new(gateway, @subject) if [Kind::GrantedPaymentInstrumentRevoked, Kind::PaymentMethodRevokedByCustomer].include?(@kind)
95
98
  @local_payment_completed = LocalPaymentCompleted._new(@subject[:local_payment]) if @subject.has_key?(:local_payment)
96
99
  end
97
100
 
@@ -72,8 +72,12 @@ module Braintree
72
72
  _auth_status_transitioned_sample_xml(id)
73
73
  when Braintree::WebhookNotification::Kind::ConnectedMerchantPayPalStatusChanged
74
74
  _auth_paypal_status_changed_sample_xml(id)
75
+ # NEXT_MAJOR_VERSION Remove this class as legacy Ideal has been removed/disabled in the Braintree Gateway
76
+ # DEPRECATED If you're looking to accept iDEAL as a payment method contact accounts@braintreepayments.com for a solution.
75
77
  when Braintree::WebhookNotification::Kind::IdealPaymentComplete
76
78
  _ideal_payment_complete_sample_xml(id)
79
+ # NEXT_MAJOR_VERSION Remove this class as legacy Ideal has been removed/disabled in the Braintree Gateway
80
+ # DEPRECATED If you're looking to accept iDEAL as a payment method contact accounts@braintreepayments.com for a solution.
77
81
  when Braintree::WebhookNotification::Kind::IdealPaymentFailed
78
82
  _ideal_payment_failed_sample_xml(id)
79
83
  # NEXT_MAJOR_VERSION remove GrantedPaymentInstrumentUpdate
@@ -83,6 +87,8 @@ module Braintree
83
87
  _granted_payment_instrument_update_sample_xml(id)
84
88
  when Braintree::WebhookNotification::Kind::RecipientUpdatedGrantedPaymentMethod
85
89
  _granted_payment_instrument_update_sample_xml(id)
90
+ when Braintree::WebhookNotification::Kind::PaymentMethodRevokedByCustomer
91
+ _payment_method_revoked_by_customer_sample_xml(id)
86
92
  when Braintree::WebhookNotification::Kind::LocalPaymentCompleted
87
93
  _local_payment_completed_sample_xml(id)
88
94
  else
@@ -669,11 +675,40 @@ module Braintree
669
675
  XML
670
676
  end
671
677
 
678
+ def _payment_method_revoked_by_customer_sample_xml(id)
679
+ <<-XML
680
+ <paypal-account>
681
+ <billing-agreement-id>a-billing-agreement-id</billing-agreement-id>
682
+ <created-at type="datetime">2019-01-01T12:00:00Z</created-at>
683
+ <customer-id>a-customer-id</customer-id>
684
+ <default type="boolean">true</default>
685
+ <email>name@email.com</email>
686
+ <global-id>cGF5bWVudG1ldGhvZF9jaDZieXNz</global-id>
687
+ <image-url>https://assets.braintreegateway.com/payment_method_logo/paypal.png?environment=test</image-url>
688
+ <subscriptions type="array"/>
689
+ <token>#{id}</token>
690
+ <updated-at type="datetime">2019-01-02T12:00:00Z</updated-at>
691
+ <is-channel-initiated nil="true"/>
692
+ <payer-id>a-payer-id</payer-id>
693
+ <payer-info nil="true"/>
694
+ <limited-use-order-id nil="true"/>
695
+ <revoked-at type="datetime">2019-01-02T12:00:00Z</revoked-at>
696
+ </paypal-account>
697
+ XML
698
+ end
699
+
672
700
  def _local_payment_completed_sample_xml(id)
673
701
  <<-XML
674
702
  <local-payment>
675
703
  <payment-id>PAY-XYZ123</payment-id>
676
704
  <payer-id>ABCPAYER</payer-id>
705
+ <payment-method-nonce>ee257d98-de40-47e8-96b3-a6954ea7a9a4</payment-method-nonce>
706
+ <transaction>
707
+ <id>#{id}</id>
708
+ <status>authorized</status>
709
+ <amount>49.99</amount>
710
+ <order-id>order4567</order-id>
711
+ </transaction>
677
712
  </local-payment>
678
713
  XML
679
714
  end
@@ -25,6 +25,7 @@ describe Braintree::PayPalAccount do
25
25
  paypal_account.created_at.should_not be_nil
26
26
  paypal_account.updated_at.should_not be_nil
27
27
  paypal_account.customer_id.should == customer.id
28
+ paypal_account.revoked_at.should be_nil
28
29
  end
29
30
 
30
31
  it "returns a PayPalAccount with a billing agreement id" do
@@ -345,6 +345,21 @@ describe Braintree::Transaction, "search" do
345
345
  collection.first.payment_instrument_type.should == Braintree::PaymentInstrumentType::PayPalAccount
346
346
  end
347
347
 
348
+ it "searches by payment instrument type LocalPaymentDetail" do
349
+ transaction = Braintree::Transaction.sale!(
350
+ :amount => Braintree::Test::TransactionAmounts::Authorize,
351
+ :payment_method_nonce => Braintree::Test::Nonce::LocalPayment
352
+ )
353
+
354
+ collection = Braintree::Transaction.search do |search|
355
+ search.id.is transaction.id
356
+ search.payment_instrument_type.in ["LocalPaymentDetail"]
357
+ end
358
+
359
+ collection.first.id.should == transaction.id
360
+ collection.first.payment_instrument_type.should == Braintree::PaymentInstrumentType::LocalPayment
361
+ end
362
+
348
363
  it "searches by payment instrument type ApplePay" do
349
364
  transaction = Braintree::Transaction.sale!(
350
365
  :amount => Braintree::Test::TransactionAmounts::Authorize,
@@ -201,7 +201,7 @@ describe Braintree::Transaction do
201
201
  result.success?.should be(false)
202
202
  invalid_folio = Braintree::ErrorCodes::Transaction::Industry::Lodging::FolioNumberIsInvalid
203
203
  check_out_date_must_follow_check_in_date = Braintree::ErrorCodes::Transaction::Industry::Lodging::CheckOutDateMustFollowCheckInDate
204
- result.errors.for(:transaction).for(:industry).map { |e| e.code }.sort.should == [invalid_folio, check_out_date_must_follow_check_in_date]
204
+ result.errors.for(:transaction).for(:industry).map { |e| e.code }.sort.should include *[invalid_folio, check_out_date_must_follow_check_in_date]
205
205
  end
206
206
  end
207
207
 
@@ -766,6 +766,16 @@ describe Braintree::Transaction do
766
766
  result.success?.should == false
767
767
  result.transaction.gateway_rejection_reason.should == Braintree::Transaction::GatewayRejectionReason::Fraud
768
768
  end
769
+
770
+ it "exposes the token issuance gateway rejection reason" do
771
+ result = Braintree::Transaction.sale(
772
+ :amount => Braintree::Test::TransactionAmounts::Authorize,
773
+ :merchant_account_id => SpecHelper::FakeVenmoAccountMerchantAccountId,
774
+ :payment_method_nonce => Braintree::Test::Nonce::VenmoAccountTokenIssuanceError,
775
+ )
776
+ result.success?.should == false
777
+ result.transaction.gateway_rejection_reason.should == Braintree::Transaction::GatewayRejectionReason::TokenIssuance
778
+ end
769
779
  end
770
780
 
771
781
  it "accepts credit card expiration month and expiration year" do
@@ -1575,6 +1585,13 @@ describe Braintree::Transaction do
1575
1585
  apple_pay_details.cardholder_name.should_not be_nil
1576
1586
  apple_pay_details.image_url.should_not be_nil
1577
1587
  apple_pay_details.token.should be_nil
1588
+ apple_pay_details.prepaid.should_not be_nil
1589
+ apple_pay_details.healthcare.should_not be_nil
1590
+ apple_pay_details.debit.should_not be_nil
1591
+ apple_pay_details.durbin_regulated.should_not be_nil
1592
+ apple_pay_details.commercial.should_not be_nil
1593
+ apple_pay_details.payroll.should_not be_nil
1594
+ apple_pay_details.product_id.should_not be_nil
1578
1595
  end
1579
1596
 
1580
1597
  it "can create a vaulted transaction with a fake apple pay nonce" do
@@ -1620,6 +1637,13 @@ describe Braintree::Transaction do
1620
1637
  android_pay_details.google_transaction_id.should == "google_transaction_id"
1621
1638
  android_pay_details.image_url.should_not be_nil
1622
1639
  android_pay_details.token.should be_nil
1640
+ android_pay_details.prepaid.should_not be_nil
1641
+ android_pay_details.healthcare.should_not be_nil
1642
+ android_pay_details.debit.should_not be_nil
1643
+ android_pay_details.durbin_regulated.should_not be_nil
1644
+ android_pay_details.commercial.should_not be_nil
1645
+ android_pay_details.payroll.should_not be_nil
1646
+ android_pay_details.product_id.should_not be_nil
1623
1647
  end
1624
1648
 
1625
1649
  it "can create a vaulted transaction with a fake android pay proxy card nonce" do
@@ -2098,7 +2122,7 @@ describe Braintree::Transaction do
2098
2122
 
2099
2123
  it "returns an error for transaction with three_d_secure_pass_thru when processor settings do not support 3DS for card type" do
2100
2124
  result = Braintree::Transaction.create(
2101
- :merchant_account_id => "adyen_ma",
2125
+ :merchant_account_id => "heartland_ma",
2102
2126
  :type => "sale",
2103
2127
  :amount => Braintree::Test::TransactionAmounts::Authorize,
2104
2128
  :credit_card => {
@@ -2239,6 +2263,21 @@ describe Braintree::Transaction do
2239
2263
  end
2240
2264
  end
2241
2265
 
2266
+ context "local payments" do
2267
+ it "can create a local payment transaction with a nonce" do
2268
+ result = Braintree::Transaction.create(
2269
+ :type => "sale",
2270
+ :amount => Braintree::Test::TransactionAmounts::Authorize,
2271
+ :payment_method_nonce => Braintree::Test::Nonce::LocalPayment
2272
+ )
2273
+
2274
+ result.should be_success
2275
+ result.transaction.local_payment_details.should_not be_nil
2276
+ result.transaction.local_payment_details.funding_source.should_not be_nil
2277
+ result.transaction.local_payment_details.payment_id.should_not be_nil
2278
+ end
2279
+ end
2280
+
2242
2281
  context "onetime" do
2243
2282
  it "can create a paypal transaction with a nonce" do
2244
2283
  result = Braintree::Transaction.create(
@@ -2439,53 +2478,6 @@ describe Braintree::Transaction do
2439
2478
  end
2440
2479
  end
2441
2480
 
2442
- context "ideal payment nonce" do
2443
- it "returns a successful result for tansacting on an ideal payment nonce" do
2444
- valid_ideal_payment_id = generate_valid_ideal_payment_nonce
2445
- result = Braintree::Transaction.create(
2446
- :type => "sale",
2447
- :order_id => SpecHelper::DefaultOrderId,
2448
- :amount => Braintree::Test::TransactionAmounts::Authorize,
2449
- :merchant_account_id => SpecHelper::IdealMerchantAccountId,
2450
- :payment_method_nonce => valid_ideal_payment_id,
2451
- :options => {
2452
- :submit_for_settlement => true,
2453
- }
2454
- )
2455
- result.success?.should == true
2456
- result.transaction.id.should =~ /^\w{6,}$/
2457
- result.transaction.type.should == "sale"
2458
- result.transaction.payment_instrument_type.should == Braintree::PaymentInstrumentType::IdealPayment
2459
- result.transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
2460
- result.transaction.status.should == Braintree::Transaction::Status::Settled
2461
- result.transaction.ideal_payment_details.ideal_payment_id.should =~ /^idealpayment_\w{6,}$/
2462
- result.transaction.ideal_payment_details.ideal_transaction_id.should =~ /^\d{16,}$/
2463
- result.transaction.ideal_payment_details.image_url.should start_with("https://")
2464
- result.transaction.ideal_payment_details.masked_iban.should_not be_empty
2465
- result.transaction.ideal_payment_details.bic.should_not be_empty
2466
- end
2467
-
2468
- it "returns a failure if ideal payment is not complete" do
2469
- expired_payment_amount = "3.00"
2470
-
2471
- incomplete_payment_id = generate_valid_ideal_payment_nonce(expired_payment_amount)
2472
-
2473
- result = Braintree::Transaction.create(
2474
- :type => "sale",
2475
- :order_id => SpecHelper::DefaultOrderId,
2476
- :amount => expired_payment_amount,
2477
- :merchant_account_id => SpecHelper::IdealMerchantAccountId,
2478
- :payment_method_nonce => incomplete_payment_id,
2479
- :options => {
2480
- :submit_for_settlement => true,
2481
- }
2482
- )
2483
-
2484
- result.success?.should == false
2485
- result.errors.for(:transaction).on(:payment_method_nonce)[0].code.should == Braintree::ErrorCodes::Transaction::IdealPaymentNotComplete
2486
- end
2487
- end
2488
-
2489
2481
  context "line items" do
2490
2482
  it "allows creation with empty line items and returns none" do
2491
2483
  result = Braintree::Transaction.create(
@@ -5863,6 +5855,8 @@ describe Braintree::Transaction do
5863
5855
  transaction.paypal_details.refund_id.should_not be_nil
5864
5856
  transaction.paypal_details.transaction_fee_amount.should_not be_nil
5865
5857
  transaction.paypal_details.transaction_fee_currency_iso_code.should_not be_nil
5858
+ transaction.paypal_details.refund_from_transaction_fee_amount.should_not be_nil
5859
+ transaction.paypal_details.refund_from_transaction_fee_currency_iso_code.should_not be_nil
5866
5860
  end
5867
5861
  end
5868
5862
  end
@@ -41,7 +41,6 @@ unless defined?(SPEC_HELPER_LOADED)
41
41
  FakeVenmoAccountMerchantAccountId = "fake_first_data_venmo_account"
42
42
  UsBankMerchantAccountId = "us_bank_merchant_account"
43
43
  AnotherUsBankMerchantAccountId = "another_us_bank_merchant_account"
44
- IdealMerchantAccountId = "ideal_merchant_account"
45
44
  AdyenMerchantAccountId = "adyen_ma"
46
45
  HiperBRLMerchantAccountId = "hiper_brl"
47
46
 
@@ -14,11 +14,23 @@ describe Braintree::LocalPaymentCompleted do
14
14
  params = {
15
15
  payment_id: "a-payment-id",
16
16
  payer_id: "a-payer-id",
17
+ payment_method_nonce: "a-nonce",
18
+ transaction: {
19
+ id: "a-transaction-id",
20
+ amount: "31.00",
21
+ order_id: "an-order-id",
22
+ status: Braintree::Transaction::Status::Authorized,
23
+ },
17
24
  }
18
25
  local_payment_completed = Braintree::LocalPaymentCompleted._new(params)
19
26
 
20
27
  local_payment_completed.payment_id.should eq("a-payment-id")
21
28
  local_payment_completed.payer_id.should eq("a-payer-id")
29
+ local_payment_completed.payment_method_nonce.should eq("a-nonce")
30
+ local_payment_completed.transaction.id.should eq("a-transaction-id")
31
+ local_payment_completed.transaction.amount.should eq(31.0)
32
+ local_payment_completed.transaction.order_id.should eq("an-order-id")
33
+ local_payment_completed.transaction.status.should eq(Braintree::Transaction::Status::Authorized)
22
34
  end
23
35
  end
24
36
  end
@@ -305,44 +305,6 @@ describe Braintree::WebhookNotification do
305
305
  end
306
306
  end
307
307
 
308
- context "ideal payments" do
309
- it "builds a sample notification for a ideal_payment_complete complete webhook" do
310
- sample_notification = Braintree::WebhookTesting.sample_notification(
311
- Braintree::WebhookNotification::Kind::IdealPaymentComplete,
312
- "my_id"
313
- )
314
-
315
- notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
316
- notification.kind.should == Braintree::WebhookNotification::Kind::IdealPaymentComplete
317
- ideal_payment = notification.ideal_payment
318
-
319
- ideal_payment.id.should == "my_id"
320
- ideal_payment.status.should == "COMPLETE"
321
- ideal_payment.order_id.should == "ORDERABC"
322
- ideal_payment.amount.should == "10.00"
323
- ideal_payment.approval_url.should == "https://example.com"
324
- ideal_payment.ideal_transaction_id.should == "1234567890"
325
- end
326
-
327
- it "builds a sample notification for a ideal_payment_failed webhook" do
328
- sample_notification = Braintree::WebhookTesting.sample_notification(
329
- Braintree::WebhookNotification::Kind::IdealPaymentFailed,
330
- "my_id"
331
- )
332
-
333
- notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
334
- notification.kind.should == Braintree::WebhookNotification::Kind::IdealPaymentFailed
335
- ideal_payment = notification.ideal_payment
336
-
337
- ideal_payment.id.should == "my_id"
338
- ideal_payment.status.should == "FAILED"
339
- ideal_payment.order_id.should == "ORDERABC"
340
- ideal_payment.amount.should == "10.00"
341
- ideal_payment.approval_url.should == "https://example.com"
342
- ideal_payment.ideal_transaction_id.should == "1234567890"
343
- end
344
- end
345
-
346
308
  context "merchant account" do
347
309
  it "builds a sample notification for a merchant account approved webhook" do
348
310
  sample_notification = Braintree::WebhookTesting.sample_notification(
@@ -604,6 +566,23 @@ describe Braintree::WebhookNotification do
604
566
  end
605
567
  end
606
568
 
569
+ context "payment_method_revoked_by_customer" do
570
+ it "builds a sample notification for a payment_method_revoked_by_customer webhook" do
571
+ sample_notification = Braintree::WebhookTesting.sample_notification(
572
+ Braintree::WebhookNotification::Kind::PaymentMethodRevokedByCustomer,
573
+ "my_payment_method_token"
574
+ )
575
+
576
+ notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
577
+ notification.kind.should == Braintree::WebhookNotification::Kind::PaymentMethodRevokedByCustomer
578
+
579
+ metadata = notification.revoked_payment_method_metadata
580
+ metadata.token.should == "my_payment_method_token"
581
+ metadata.revoked_payment_method.class.should == Braintree::PayPalAccount
582
+ metadata.revoked_payment_method.revoked_at.should_not be_nil
583
+ end
584
+ end
585
+
607
586
  context "local_payment_completed" do
608
587
  it "builds a sample notification for a local_payment webhook" do
609
588
  sample_notification = Braintree::WebhookTesting.sample_notification(
@@ -615,8 +594,13 @@ describe Braintree::WebhookNotification do
615
594
  notification.kind.should == Braintree::WebhookNotification::Kind::LocalPaymentCompleted
616
595
 
617
596
  local_payment_completed = notification.local_payment_completed
618
- local_payment_completed.payment_id.should == 'PAY-XYZ123'
619
- local_payment_completed.payer_id.should == 'ABCPAYER'
597
+ local_payment_completed.payment_id.should == "PAY-XYZ123"
598
+ local_payment_completed.payer_id.should == "ABCPAYER"
599
+ local_payment_completed.payment_method_nonce.should == "ee257d98-de40-47e8-96b3-a6954ea7a9a4"
600
+ local_payment_completed.transaction.id.should == "my_id"
601
+ local_payment_completed.transaction.status.should == Braintree::Transaction::Status::Authorized
602
+ local_payment_completed.transaction.amount.should == 49.99
603
+ local_payment_completed.transaction.order_id.should == "order4567"
620
604
  end
621
605
  end
622
606
 
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.95.0
4
+ version: 2.96.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Braintree
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-28 00:00:00.000000000 Z
11
+ date: 2019-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder
@@ -151,6 +151,7 @@ files:
151
151
  - lib/braintree/transaction/customer_details.rb
152
152
  - lib/braintree/transaction/disbursement_details.rb
153
153
  - lib/braintree/transaction/ideal_payment_details.rb
154
+ - lib/braintree/transaction/local_payment_details.rb
154
155
  - lib/braintree/transaction/masterpass_card_details.rb
155
156
  - lib/braintree/transaction/paypal_details.rb
156
157
  - lib/braintree/transaction/samsung_pay_card_details.rb
@@ -213,7 +214,6 @@ files:
213
214
  - spec/integration/braintree/error_codes_spec.rb
214
215
  - spec/integration/braintree/graphql_client_spec.rb
215
216
  - spec/integration/braintree/http_spec.rb
216
- - spec/integration/braintree/ideal_payment_spec.rb
217
217
  - spec/integration/braintree/masterpass_card_spec.rb
218
218
  - spec/integration/braintree/merchant_account_spec.rb
219
219
  - spec/integration/braintree/merchant_spec.rb
@@ -318,8 +318,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
318
318
  - !ruby/object:Gem::Version
319
319
  version: '0'
320
320
  requirements: []
321
- rubyforge_project: braintree
322
- rubygems_version: 2.7.9
321
+ rubygems_version: 3.0.3
323
322
  signing_key:
324
323
  specification_version: 4
325
324
  summary: Braintree Gateway Ruby Client Library
@@ -1,87 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
- require File.expand_path(File.dirname(__FILE__) + "/client_api/spec_helper")
3
-
4
- describe Braintree::IdealPayment do
5
- context "self.sale" do
6
- it "creates a transaction using an Ideal payment token and returns a result object" do
7
- ideal_payment_id = generate_valid_ideal_payment_nonce
8
-
9
- result = Braintree::IdealPayment.sale(
10
- ideal_payment_id,
11
- :order_id => SpecHelper::DefaultOrderId,
12
- :merchant_account_id => "ideal_merchant_account",
13
- :amount => Braintree::Test::TransactionAmounts::Authorize
14
- )
15
-
16
- result.success?.should == true
17
- result.transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
18
- result.transaction.type.should == "sale"
19
- ideal_payment_details = result.transaction.ideal_payment_details
20
- ideal_payment_details.ideal_payment_id.should =~ /^idealpayment_\w{6,}$/
21
- ideal_payment_details.ideal_transaction_id.should =~ /^\d{16,}$/
22
- ideal_payment_details.image_url.should start_with("https://")
23
- ideal_payment_details.masked_iban.should_not be_empty
24
- ideal_payment_details.bic.should_not be_empty
25
- end
26
- end
27
-
28
- context "self.sale!" do
29
- it "creates a transaction using an ideal payment and returns a result object" do
30
- ideal_payment_id = generate_valid_ideal_payment_nonce
31
-
32
- transaction = Braintree::IdealPayment.sale!(
33
- ideal_payment_id,
34
- :order_id => SpecHelper::DefaultOrderId,
35
- :merchant_account_id => "ideal_merchant_account",
36
- :amount => Braintree::Test::TransactionAmounts::Authorize
37
- )
38
-
39
- transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
40
- transaction.type.should == "sale"
41
- ideal_payment_details = transaction.ideal_payment_details
42
- ideal_payment_details.ideal_payment_id.should =~ /^idealpayment_\w{6,}$/
43
- ideal_payment_details.ideal_transaction_id.should =~ /^\d{16,}$/
44
- ideal_payment_details.image_url.should start_with("https://")
45
- ideal_payment_details.masked_iban.should_not be_empty
46
- ideal_payment_details.bic.should_not be_empty
47
- end
48
-
49
- it "does not create a transaction using an ideal payment and returns raises an exception" do
50
- expect do
51
- Braintree::IdealPayment.sale!(
52
- "invalid_nonce",
53
- :merchant_account_id => "ideal_merchant_account",
54
- :amount => Braintree::Test::TransactionAmounts::Authorize
55
- )
56
- end.to raise_error(Braintree::ValidationsFailed)
57
- end
58
- end
59
-
60
- context "self.find" do
61
- it "finds the Ideal payment with an id" do
62
- ideal_payment_id = generate_valid_ideal_payment_nonce
63
- ideal_payment = Braintree::IdealPayment.find(ideal_payment_id)
64
-
65
- ideal_payment.id.should =~ /^idealpayment_\w{6,}$/
66
- ideal_payment.ideal_transaction_id.should =~ /^\d{16,}$/
67
- ideal_payment.currency.should_not be_empty
68
- ideal_payment.amount.should_not be_empty
69
- ideal_payment.status.should_not be_empty
70
- ideal_payment.order_id.should_not be_empty
71
- ideal_payment.issuer.should_not be_empty
72
- ideal_payment.approval_url.should start_with("https://")
73
- ideal_payment.iban_bank_account.account_holder_name.should_not be_empty
74
- ideal_payment.iban_bank_account.bic.should_not be_empty
75
- ideal_payment.iban_bank_account.masked_iban.should_not be_empty
76
- ideal_payment.iban_bank_account.iban_account_number_last_4.should =~ /^\d{4}$/
77
- ideal_payment.iban_bank_account.iban_country.should_not be_empty
78
- ideal_payment.iban_bank_account.description.should_not be_empty
79
- end
80
-
81
- it "raises if the Ideal payment is not found" do
82
- expect do
83
- Braintree::IdealPayment.find("idealpayment_nxyqkq_s654wq_92jr64_mnr4kr_yjz")
84
- end.to raise_error(Braintree::NotFoundError)
85
- end
86
- end
87
- end