braintree 4.0.0 → 4.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a48854f74d17f7c0f06f437ab9cf144f6787cdb634cb4585b96cbf0e8b3eb316
4
- data.tar.gz: e278599e9a4fe1ec55ed4c25a0c2941c256815adff6240f24d7326dda3c7979b
3
+ metadata.gz: d934c307cf9a97cf867edc42477230eba5680d7183c73ce691aef287abbb01d6
4
+ data.tar.gz: b817ec7febb2c2e050c2ed3a19820e67b93890a34211fc5364ba4fc0f1487778
5
5
  SHA512:
6
- metadata.gz: dbe42e3ee49bffddde129c228d9dc9ea9a8e7615140d184211378d58add503f13a666f2aaf8c393fafbb330db77685a5953b10344c712da5719c630f1ab64e5a
7
- data.tar.gz: ae8af00364f7853fb0e6eb82f585ebc30015f0b6ac7014f41eccdfe732348f3b3f715b474afc516b17b913550f9ae339b587a53296cc823bb30c5954ecbda146
6
+ metadata.gz: d527fd7a32ac2240f108531ad040d6525ecc7a87fd23e18b5de3e4674ebc1daf7197ccb260ecad6e58bd6ed77132aac25249ed90f1d3e630054c3995eb28171e
7
+ data.tar.gz: 2e8ff42991a0120a0aef55705780b0659576b550cb62c6f499f44011c5b7bab441d64f3d6ad3ee27dd6f16b2787e24f849d01d8429c7bcf415d356e621cee81f
data/braintree.gemspec CHANGED
@@ -12,6 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.homepage = "https://www.braintreepayments.com/"
13
13
  s.files = Dir.glob ["README.rdoc", "LICENSE", "lib/**/*.{rb,crt}", "spec/**/*", "*.gemspec"]
14
14
  s.add_dependency "builder", ">= 3.2.4"
15
+ s.add_dependency "rexml", ">= 3.1.9" # Use rexml version associated with minimum supported Ruby version
15
16
  s.required_ruby_version = ">=2.6.0"
16
17
  s.metadata = {
17
18
  "bug_tracker_uri" => "https://github.com/braintree/braintree_ruby/issues",
@@ -79,7 +79,17 @@ module Braintree
79
79
 
80
80
  def self._signature(type) # :nodoc:
81
81
  billing_address_params = AddressGateway._shared_signature
82
- options = [:make_default, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type,:verification_currency_iso_code]
82
+ options = [
83
+ :fail_on_duplicate_payment_method,
84
+ :make_default,
85
+ :skip_advanced_fraud_checking,
86
+ :venmo_sdk_session,
87
+ :verification_account_type,
88
+ :verification_amount,
89
+ :verification_currency_iso_code,
90
+ :verification_merchant_account_id,
91
+ :verify_card
92
+ ]
83
93
  signature = [
84
94
  :billing_address_id, :cardholder_name, :cvv, :expiration_date, :expiration_month,
85
95
  :expiration_year, :number, :token, :venmo_sdk_payment_method_code, :device_data,
@@ -703,13 +703,13 @@ module Braintree
703
703
  end
704
704
 
705
705
  module PaymentMethod
706
- CannotForwardPaymentMethodType = "93107"
706
+ CannotForwardPaymentMethodType = "93106"
707
707
  CustomerIdIsInvalid = "93105"
708
708
  CustomerIdIsRequired = "93104"
709
709
  NonceIsInvalid = "93102"
710
710
  NonceIsRequired = "93103"
711
711
  PaymentMethodNoLongerSupported = "93117"
712
- PaymentMethodNonceConsumed = "93106"
712
+ PaymentMethodNonceConsumed = "93107"
713
713
  PaymentMethodNonceLocked = "93109"
714
714
  PaymentMethodNonceUnknown = "93108"
715
715
  PaymentMethodParamsAreRequired = "93101"
@@ -148,10 +148,15 @@ module Braintree
148
148
  billing_address_params = AddressGateway._shared_signature
149
149
  paypal_options_shipping_signature = AddressGateway._shared_signature
150
150
  options = [
151
- :make_default, :verification_merchant_account_id, :verify_card, :venmo_sdk_session,
152
- :verification_amount, :us_bank_account_verification_method,
151
+ :make_default,
152
+ :skip_advanced_fraud_checking,
153
+ :us_bank_account_verification_method,
154
+ :venmo_sdk_session,
153
155
  :verification_account_type,
156
+ :verification_amount,
154
157
  :verification_currency_iso_code,
158
+ :verification_merchant_account_id,
159
+ :verify_card,
155
160
  :paypal => [
156
161
  :payee_email,
157
162
  :order_id,
@@ -195,7 +195,7 @@ module Braintree
195
195
  :sca_exemption, :currency_iso_code,
196
196
  {:line_items => [:quantity, :name, :description, :kind, :unit_amount, :unit_tax_amount, :total_amount, :discount_amount, :tax_amount, :unit_of_measure, :product_code, :commodity_code, :url]},
197
197
  {:risk_data => [:customer_browser, :customer_device_id, :customer_ip, :customer_location_zip, :customer_tenure]},
198
- {:credit_card => [:token, :cardholder_name, :cvv, :expiration_date, :expiration_month, :expiration_year, :number]},
198
+ {:credit_card => [:token, :cardholder_name, :cvv, :expiration_date, :expiration_month, :expiration_year, :number, {:payment_reader_card_details => [:encrypted_card_data, :key_serial_number]}]},
199
199
  {:customer => [:id, :company, :email, :fax, :first_name, :last_name, :phone, :website]},
200
200
  {
201
201
  :billing => AddressGateway._shared_signature
@@ -1,7 +1,7 @@
1
1
  module Braintree
2
2
  module Version
3
3
  Major = 4
4
- Minor = 0
4
+ Minor = 1
5
5
  Tiny = 0
6
6
 
7
7
  String = "#{Major}.#{Minor}.#{Tiny}"
@@ -25,6 +25,7 @@ module Braintree
25
25
  GrantedPaymentInstrumentRevoked = "granted_payment_instrument_revoked"
26
26
 
27
27
  GrantorUpdatedGrantedPaymentMethod = "grantor_updated_granted_payment_method"
28
+ GrantedPaymentMethodRevoked = "granted_payment_method_revoked"
28
29
 
29
30
  LocalPaymentCompleted = "local_payment_completed"
30
31
  LocalPaymentReversed = "local_payment_reversed"
@@ -95,7 +96,7 @@ module Braintree
95
96
  @connected_merchant_status_transitioned = ConnectedMerchantStatusTransitioned._new(@subject[:connected_merchant_status_transitioned]) if @subject.has_key?(:connected_merchant_status_transitioned)
96
97
  @connected_merchant_paypal_status_changed = ConnectedMerchantPayPalStatusChanged._new(@subject[:connected_merchant_paypal_status_changed]) if @subject.has_key?(:connected_merchant_paypal_status_changed)
97
98
  @granted_payment_instrument_update = GrantedPaymentInstrumentUpdate._new(@subject[:granted_payment_instrument_update]) if @subject.has_key?(:granted_payment_instrument_update)
98
- @revoked_payment_method_metadata = RevokedPaymentMethodMetadata._new(gateway, @subject) if [Kind::GrantedPaymentInstrumentRevoked, Kind::PaymentMethodRevokedByCustomer].include?(@kind)
99
+ @revoked_payment_method_metadata = RevokedPaymentMethodMetadata._new(gateway, @subject) if [Kind::GrantedPaymentInstrumentRevoked, Kind::PaymentMethodRevokedByCustomer, Kind::GrantedPaymentMethodRevoked].include?(@kind)
99
100
  @local_payment_completed = LocalPaymentCompleted._new(@subject[:local_payment]) if @subject.has_key?(:local_payment) && Kind::LocalPaymentCompleted == @kind
100
101
  @local_payment_reversed = LocalPaymentReversed._new(@subject[:local_payment_reversed]) if @subject.has_key?(:local_payment_reversed) && Kind::LocalPaymentReversed == @kind
101
102
  end
@@ -82,6 +82,8 @@ module Braintree
82
82
  _granted_payment_instrument_update_sample_xml(id)
83
83
  when Braintree::WebhookNotification::Kind::RecipientUpdatedGrantedPaymentMethod
84
84
  _granted_payment_instrument_update_sample_xml(id)
85
+ when Braintree::WebhookNotification::Kind::GrantedPaymentMethodRevoked
86
+ _granted_payment_method_revoked_xml(id)
85
87
  when Braintree::WebhookNotification::Kind::PaymentMethodRevokedByCustomer
86
88
  _payment_method_revoked_by_customer_sample_xml(id)
87
89
  when Braintree::WebhookNotification::Kind::LocalPaymentCompleted
@@ -877,6 +879,24 @@ module Braintree
877
879
  XML
878
880
  end
879
881
 
882
+ def _granted_payment_method_revoked_xml(id)
883
+ <<-XML
884
+ <venmo-account>
885
+ <created-at type='dateTime'>2018-10-11T21:28:37Z</created-at>
886
+ <updated-at type='dateTime'>2018-10-11T21:28:37Z</updated-at>
887
+ <default type='boolean'>true</default>
888
+ <image-url>https://assets.braintreegateway.com/payment_method_logo/venmo.png?environment=test</image-url>
889
+ <token>#{id}</token>
890
+ <source-description>Venmo Account: venmojoe</source-description>
891
+ <username>venmojoe</username>
892
+ <venmo-user-id>456</venmo-user-id>
893
+ <subscriptions type='array'/>
894
+ <customer-id>venmo_customer_id</customer-id>
895
+ <global-id>cGF5bWVudG1ldGhvZF92ZW5tb2FjY291bnQ</global-id>
896
+ </venmo-account>
897
+ XML
898
+ end
899
+
880
900
  def _payment_method_revoked_by_customer_sample_xml(id)
881
901
  <<-XML
882
902
  <paypal-account>
@@ -157,6 +157,48 @@ describe Braintree::CreditCard do
157
157
  end
158
158
  end
159
159
 
160
+ it "includes risk data when skip_advanced_fraud_checking is false" do
161
+ with_fraud_protection_enterprise_merchant do
162
+ customer = Braintree::Customer.create!
163
+ result = Braintree::CreditCard.create(
164
+ :cardholder_name => "Original Holder",
165
+ :customer_id => customer.id,
166
+ :cvv => "123",
167
+ :number => Braintree::Test::CreditCardNumbers::Visa,
168
+ :expiration_date => "05/2020",
169
+ :options => {
170
+ :skip_advanced_fraud_checking => false,
171
+ :verify_card => true,
172
+ },
173
+ )
174
+
175
+ expect(result).to be_success
176
+ verification = result.credit_card.verification
177
+ expect(verification.risk_data).not_to be_nil
178
+ end
179
+ end
180
+
181
+ it "does not include risk data when skip_advanced_fraud_checking is true" do
182
+ with_fraud_protection_enterprise_merchant do
183
+ customer = Braintree::Customer.create!
184
+ result = Braintree::CreditCard.create(
185
+ :cardholder_name => "Original Holder",
186
+ :customer_id => customer.id,
187
+ :cvv => "123",
188
+ :number => Braintree::Test::CreditCardNumbers::Visa,
189
+ :expiration_date => "05/2020",
190
+ :options => {
191
+ :skip_advanced_fraud_checking => true,
192
+ :verify_card => true,
193
+ },
194
+ )
195
+
196
+ expect(result).to be_success
197
+ verification = result.credit_card.verification
198
+ expect(verification.risk_data).to be_nil
199
+ end
200
+ end
201
+
160
202
  it "exposes the gateway rejection reason on verification" do
161
203
  old_merchant = Braintree::Configuration.merchant_id
162
204
  old_public_key = Braintree::Configuration.public_key
@@ -852,7 +894,54 @@ describe Braintree::CreditCard do
852
894
  )
853
895
 
854
896
  result.success?.should == true
897
+ end
855
898
 
899
+ it "includes risk data when skip_advanced_fraud_checking is false" do
900
+ with_fraud_protection_enterprise_merchant do
901
+ customer = Braintree::Customer.create!
902
+ credit_card = Braintree::CreditCard.create!(
903
+ :cardholder_name => "Original Holder",
904
+ :customer_id => customer.id,
905
+ :cvv => "123",
906
+ :number => Braintree::Test::CreditCardNumbers::Visa,
907
+ :expiration_date => "05/2020",
908
+ )
909
+ updated_result = Braintree::CreditCard.update(credit_card.token,
910
+ :expiration_date => "05/2021",
911
+ :options => {
912
+ :verify_card => true,
913
+ :skip_advanced_fraud_checking => false,
914
+ },
915
+ )
916
+
917
+ expect(updated_result).to be_success
918
+ verification = updated_result.credit_card.verification
919
+ expect(verification.risk_data).not_to be_nil
920
+ end
921
+ end
922
+
923
+ it "does not include risk data when skip_advanced_fraud_checking is true" do
924
+ with_fraud_protection_enterprise_merchant do
925
+ customer = Braintree::Customer.create!
926
+ credit_card = Braintree::CreditCard.create!(
927
+ :cardholder_name => "Original Holder",
928
+ :customer_id => customer.id,
929
+ :cvv => "123",
930
+ :number => Braintree::Test::CreditCardNumbers::Visa,
931
+ :expiration_date => "05/2020",
932
+ )
933
+ updated_result = Braintree::CreditCard.update(credit_card.token,
934
+ :expiration_date => "05/2021",
935
+ :options => {
936
+ :verify_card => true,
937
+ :skip_advanced_fraud_checking => true,
938
+ },
939
+ )
940
+
941
+ expect(updated_result).to be_success
942
+ verification = updated_result.credit_card.verification
943
+ expect(verification.risk_data).to be_nil
944
+ end
856
945
  end
857
946
 
858
947
  context "billing address" do
@@ -115,6 +115,46 @@ describe Braintree::Customer do
115
115
  result.should be_success
116
116
  end
117
117
 
118
+ it "includes risk data when skip_advanced_fraud_checking is false" do
119
+ with_fraud_protection_enterprise_merchant do
120
+ result = Braintree::Customer.create(
121
+ :credit_card => {
122
+ :number => Braintree::Test::CreditCardNumbers::MasterCard,
123
+ :expiration_date => "05/2010",
124
+ :cvv => "100",
125
+ :options => {
126
+ :skip_advanced_fraud_checking => false,
127
+ :verify_card => true,
128
+ },
129
+ },
130
+ )
131
+
132
+ expect(result).to be_success
133
+ verification = result.customer.credit_cards.first.verification
134
+ expect(verification.risk_data).not_to be_nil
135
+ end
136
+ end
137
+
138
+ it "does not include risk data when skip_advanced_fraud_checking is true" do
139
+ with_fraud_protection_enterprise_merchant do
140
+ result = Braintree::Customer.create(
141
+ :credit_card => {
142
+ :number => Braintree::Test::CreditCardNumbers::MasterCard,
143
+ :expiration_date => "05/2010",
144
+ :cvv => "100",
145
+ :options => {
146
+ :skip_advanced_fraud_checking => true,
147
+ :verify_card => true,
148
+ },
149
+ },
150
+ )
151
+
152
+ expect(result).to be_success
153
+ verification = result.customer.credit_cards.first.verification
154
+ expect(verification.risk_data).to be_nil
155
+ end
156
+ end
157
+
118
158
  it "supports creation with tax_identifiers" do
119
159
  result = Braintree::Customer.create(
120
160
  :tax_identifiers => [
@@ -1345,6 +1385,56 @@ describe Braintree::Customer do
1345
1385
  result.success?.should == true
1346
1386
  end
1347
1387
 
1388
+ it "includes risk data when skip_advanced_fraud_checking is false" do
1389
+ with_fraud_protection_enterprise_merchant do
1390
+ customer = Braintree::Customer.create!(
1391
+ :first_name => "Joe",
1392
+ )
1393
+
1394
+ updated_result = Braintree::Customer.update(
1395
+ customer.id,
1396
+ :credit_card => {
1397
+ :cardholder_name => "New Joe Cardholder",
1398
+ :number => Braintree::Test::CreditCardNumbers::Visa,
1399
+ :expiration_date => "12/2009",
1400
+ :options => {
1401
+ :skip_advanced_fraud_checking => false,
1402
+ :verify_card => true,
1403
+ },
1404
+ },
1405
+ )
1406
+
1407
+ expect(updated_result).to be_success
1408
+ verification = updated_result.customer.credit_cards.first.verification
1409
+ expect(verification.risk_data).not_to be_nil
1410
+ end
1411
+ end
1412
+
1413
+ it "does not include risk data when skip_advanced_fraud_checking is true" do
1414
+ with_fraud_protection_enterprise_merchant do
1415
+ customer = Braintree::Customer.create!(
1416
+ :first_name => "Joe",
1417
+ )
1418
+
1419
+ updated_result = Braintree::Customer.update(
1420
+ customer.id,
1421
+ :credit_card => {
1422
+ :cardholder_name => "New Joe Cardholder",
1423
+ :number => Braintree::Test::CreditCardNumbers::Visa,
1424
+ :expiration_date => "12/2009",
1425
+ :options => {
1426
+ :skip_advanced_fraud_checking => true,
1427
+ :verify_card => true,
1428
+ },
1429
+ },
1430
+ )
1431
+
1432
+ expect(updated_result).to be_success
1433
+ verification = updated_result.customer.credit_cards.first.verification
1434
+ expect(verification.risk_data).to be_nil
1435
+ end
1436
+ end
1437
+
1348
1438
  it "can update a tax_identifier" do
1349
1439
  customer = Braintree::Customer.create!(
1350
1440
  :tax_identifiers => [
@@ -527,6 +527,58 @@ describe Braintree::PaymentMethod do
527
527
  found_credit_card.billing_address.street_address.should == "456 Xyz Way"
528
528
  end
529
529
 
530
+ it "includes risk data when skip_advanced_fraud_checking is false" do
531
+ with_fraud_protection_enterprise_merchant do
532
+ customer = Braintree::Customer.create!
533
+
534
+ nonce = nonce_for_new_payment_method(
535
+ :credit_card => {
536
+ :cvv => "123",
537
+ :number => Braintree::Test::CreditCardNumbers::Visa,
538
+ :expiration_date => "05/2009",
539
+ },
540
+ )
541
+ result = Braintree::PaymentMethod.create(
542
+ :payment_method_nonce => nonce,
543
+ :customer_id => customer.id,
544
+ :options => {
545
+ :verify_card => true,
546
+ :skip_advanced_fraud_checking => false,
547
+ },
548
+ )
549
+
550
+ expect(result).to be_success
551
+ verification = result.payment_method.verification
552
+ expect(verification.risk_data).not_to be_nil
553
+ end
554
+ end
555
+
556
+ it "does not include risk data when skip_advanced_fraud_checking is true" do
557
+ with_fraud_protection_enterprise_merchant do
558
+ customer = Braintree::Customer.create!
559
+
560
+ nonce = nonce_for_new_payment_method(
561
+ :credit_card => {
562
+ :cvv => "123",
563
+ :number => Braintree::Test::CreditCardNumbers::Visa,
564
+ :expiration_date => "05/2009",
565
+ },
566
+ )
567
+ result = Braintree::PaymentMethod.create(
568
+ :payment_method_nonce => nonce,
569
+ :customer_id => customer.id,
570
+ :options => {
571
+ :verify_card => true,
572
+ :skip_advanced_fraud_checking => true,
573
+ },
574
+ )
575
+
576
+ expect(result).to be_success
577
+ verification = result.payment_method.verification
578
+ expect(verification.risk_data).to be_nil
579
+ end
580
+ end
581
+
530
582
  context "account_type" do
531
583
  it "verifies card with account_type debit" do
532
584
  nonce = nonce_for_new_payment_method(
@@ -1368,6 +1420,58 @@ describe Braintree::PaymentMethod do
1368
1420
  updated_credit_card.expiration_date.should == "06/2013"
1369
1421
  end
1370
1422
 
1423
+ it "includes risk data when skip_advanced_fraud_checking is false" do
1424
+ with_fraud_protection_enterprise_merchant do
1425
+ customer = Braintree::Customer.create!
1426
+ credit_card = Braintree::CreditCard.create!(
1427
+ :customer_id => customer.id,
1428
+ :cvv => "123",
1429
+ :number => Braintree::Test::CreditCardNumbers::Visa,
1430
+ :expiration_date => "05/2012",
1431
+ )
1432
+ update_result = Braintree::PaymentMethod.update(
1433
+ credit_card.token,
1434
+ :cvv => "456",
1435
+ :number => Braintree::Test::CreditCardNumbers::MasterCard,
1436
+ :expiration_date => "06/2013",
1437
+ :options => {
1438
+ :verify_card => true,
1439
+ :skip_advanced_fraud_checking => false
1440
+ },
1441
+ )
1442
+
1443
+ expect(update_result).to be_success
1444
+ verification = update_result.payment_method.verification
1445
+ expect(verification.risk_data).not_to be_nil
1446
+ end
1447
+ end
1448
+
1449
+ it "does not include risk data when skip_advanced_fraud_checking is true" do
1450
+ with_fraud_protection_enterprise_merchant do
1451
+ customer = Braintree::Customer.create!
1452
+ credit_card = Braintree::CreditCard.create!(
1453
+ :customer_id => customer.id,
1454
+ :cvv => "123",
1455
+ :number => Braintree::Test::CreditCardNumbers::Visa,
1456
+ :expiration_date => "05/2012",
1457
+ )
1458
+ update_result = Braintree::PaymentMethod.update(
1459
+ credit_card.token,
1460
+ :cvv => "456",
1461
+ :number => Braintree::Test::CreditCardNumbers::MasterCard,
1462
+ :expiration_date => "06/2013",
1463
+ :options => {
1464
+ :verify_card => true,
1465
+ :skip_advanced_fraud_checking => true
1466
+ },
1467
+ )
1468
+
1469
+ expect(update_result).to be_success
1470
+ verification = update_result.payment_method.verification
1471
+ expect(verification.risk_data).to be_nil
1472
+ end
1473
+ end
1474
+
1371
1475
  context "verification_currency_iso_code" do
1372
1476
  it "validates verification_currency_iso_code and updates the credit card " do
1373
1477
  customer = Braintree::Customer.create!
@@ -4386,7 +4386,7 @@ describe Braintree::Transaction do
4386
4386
  :amount => "10.00",
4387
4387
  )
4388
4388
  result.success?.should == true
4389
- result.transaction.network_transaction_id.should be_nil
4389
+ result.transaction.network_transaction_id.should_not be_nil
4390
4390
  end
4391
4391
 
4392
4392
  it "accepts blank previous_network_transaction_id" do
@@ -4403,7 +4403,7 @@ describe Braintree::Transaction do
4403
4403
  :amount => "10.00",
4404
4404
  )
4405
4405
  result.success?.should == true
4406
- result.transaction.network_transaction_id.should be_nil
4406
+ result.transaction.network_transaction_id.should_not be_nil
4407
4407
  end
4408
4408
  end
4409
4409
  end
@@ -6984,6 +6984,42 @@ describe Braintree::Transaction do
6984
6984
  end
6985
6985
  end
6986
6986
 
6987
+ describe "Manual Key Entry" do
6988
+ context "with correct encrypted payment reader card details" do
6989
+ it "returns a success response" do
6990
+ result = Braintree::Transaction.sale(
6991
+ :amount => "10.00",
6992
+ :credit_card => {
6993
+ :payment_reader_card_details => {
6994
+ :encrypted_card_data => "8F34DFB312DC79C24FD5320622F3E11682D79E6B0C0FD881",
6995
+ :key_serial_number => "FFFFFF02000572A00005",
6996
+ },
6997
+ },
6998
+ )
6999
+
7000
+ expect(result).to be_success
7001
+ end
7002
+ end
7003
+
7004
+ context "with invalid encrypted payment reader card details" do
7005
+ it "returns a failure response" do
7006
+ result = Braintree::Transaction.sale(
7007
+ :amount => "10.00",
7008
+ :credit_card => {
7009
+ :payment_reader_card_details => {
7010
+ :encrypted_card_data => "invalid",
7011
+ :key_serial_number => "invalid",
7012
+ },
7013
+ },
7014
+ )
7015
+
7016
+ expect(result).not_to be_success
7017
+ expect(result.errors.for(:transaction).first.code)
7018
+ .to eq(Braintree::ErrorCodes::Transaction::PaymentInstrumentNotSupportedByMerchantAccount)
7019
+ end
7020
+ end
7021
+ end
7022
+
6987
7023
  describe "Adjust Authorization" do
6988
7024
  let(:first_data_master_transaction_params) do
6989
7025
  {
@@ -11,7 +11,7 @@ describe Braintree::CreditCard do
11
11
 
12
12
  describe "self.create_signature" do
13
13
  it "should be what we expect" do
14
- Braintree::CreditCardGateway._create_signature.should == [
14
+ expect(Braintree::CreditCardGateway._create_signature).to match([
15
15
  :billing_address_id,
16
16
  :cardholder_name,
17
17
  :cvv,
@@ -24,7 +24,7 @@ describe Braintree::CreditCard do
24
24
  :device_data,
25
25
  :payment_method_nonce,
26
26
  {:external_vault=>[:network_transaction_id]},
27
- {:options => [:make_default, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type, :verification_currency_iso_code]},
27
+ {:options => match_array([:make_default, :skip_advanced_fraud_checking, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type, :verification_currency_iso_code])},
28
28
  {:billing_address => [
29
29
  :company,
30
30
  :country_code_alpha2,
@@ -51,13 +51,13 @@ describe Braintree::CreditCard do
51
51
  :ds_transaction_id,
52
52
  ]},
53
53
  :customer_id,
54
- ]
54
+ ])
55
55
  end
56
56
  end
57
57
 
58
58
  describe "self.update_signature" do
59
59
  it "should be what we expect" do
60
- Braintree::CreditCardGateway._update_signature.should == [
60
+ expect(Braintree::CreditCardGateway._update_signature).to match([
61
61
  :billing_address_id,
62
62
  :cardholder_name,
63
63
  :cvv,
@@ -70,7 +70,7 @@ describe Braintree::CreditCard do
70
70
  :device_data,
71
71
  :payment_method_nonce,
72
72
  {:external_vault=>[:network_transaction_id]},
73
- {:options => [:make_default, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type, :verification_currency_iso_code]},
73
+ {:options => match_array([:make_default, :skip_advanced_fraud_checking, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type, :verification_currency_iso_code])},
74
74
  {:billing_address => [
75
75
  :company,
76
76
  :country_code_alpha2,
@@ -97,7 +97,7 @@ describe Braintree::CreditCard do
97
97
  :cavv_algorithm,
98
98
  :ds_transaction_id,
99
99
  ]},
100
- ]
100
+ ])
101
101
  end
102
102
  end
103
103
 
@@ -76,7 +76,7 @@ describe Braintree::Customer do
76
76
 
77
77
  describe "self.create_signature" do
78
78
  it "should be what we expect" do
79
- Braintree::CustomerGateway._create_signature.should == [
79
+ expect(Braintree::CustomerGateway._create_signature).to match([
80
80
  :company,
81
81
  :email,
82
82
  :fax,
@@ -101,7 +101,7 @@ describe Braintree::Customer do
101
101
  :device_data,
102
102
  :payment_method_nonce,
103
103
  {:external_vault=>[:network_transaction_id]},
104
- {:options => [:make_default, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type, :verification_currency_iso_code]},
104
+ {:options => match_array([:make_default, :skip_advanced_fraud_checking, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type, :verification_currency_iso_code])},
105
105
  {:billing_address => [
106
106
  :company,
107
107
  :country_code_alpha2,
@@ -163,13 +163,13 @@ describe Braintree::Customer do
163
163
  ]]
164
164
  },
165
165
  {:custom_fields => :_any_key_}
166
- ]
166
+ ])
167
167
  end
168
168
  end
169
169
 
170
170
  describe "self.update_signature" do
171
171
  it "should be what we expect" do
172
- Braintree::CustomerGateway._update_signature.should == [
172
+ expect(Braintree::CustomerGateway._update_signature).to match([
173
173
  :company,
174
174
  :email,
175
175
  :fax,
@@ -194,8 +194,9 @@ describe Braintree::Customer do
194
194
  :device_data,
195
195
  :payment_method_nonce,
196
196
  {:external_vault=>[:network_transaction_id]},
197
- {:options => [
197
+ {:options => match_array([
198
198
  :make_default,
199
+ :skip_advanced_fraud_checking,
199
200
  :verification_merchant_account_id,
200
201
  :verify_card,
201
202
  :verification_amount,
@@ -204,7 +205,7 @@ describe Braintree::Customer do
204
205
  :verification_account_type,
205
206
  :verification_currency_iso_code,
206
207
  :update_existing_token
207
- ]},
208
+ ])},
208
209
  {:billing_address => [
209
210
  :company,
210
211
  :country_code_alpha2,
@@ -261,7 +262,7 @@ describe Braintree::Customer do
261
262
  ]]
262
263
  },
263
264
  {:custom_fields => :_any_key_}
264
- ]
265
+ ])
265
266
  end
266
267
  end
267
268
 
@@ -611,6 +611,22 @@ describe Braintree::WebhookNotification do
611
611
  metadata.token.should == "venmo_token"
612
612
  metadata.revoked_payment_method.class.should == Braintree::VenmoAccount
613
613
  end
614
+
615
+ it "builds a sample notification for a GrantedPaymentMethodRevoked webhook" do
616
+ sample_notification = Braintree::WebhookTesting.sample_notification(
617
+ Braintree::WebhookNotification::Kind::GrantedPaymentMethodRevoked,
618
+ "my_id",
619
+ )
620
+
621
+ notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
622
+ expect(notification.kind).to eq Braintree::WebhookNotification::Kind::GrantedPaymentMethodRevoked
623
+
624
+ metadata = notification.revoked_payment_method_metadata
625
+
626
+ expect(metadata.customer_id).to eq "venmo_customer_id"
627
+ expect(metadata.token).to eq "my_id"
628
+ expect(metadata.revoked_payment_method.class).to eq Braintree::VenmoAccount
629
+ end
614
630
  end
615
631
  end
616
632
 
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: 4.0.0
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Braintree
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-10 00:00:00.000000000 Z
11
+ date: 2021-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.2.4
27
+ - !ruby/object:Gem::Dependency
28
+ name: rexml
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 3.1.9
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 3.1.9
27
41
  description: Resources and tools for developers to integrate Braintree's global payments
28
42
  platform.
29
43
  email: code@getbraintree.com
@@ -314,7 +328,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
314
328
  - !ruby/object:Gem::Version
315
329
  version: '0'
316
330
  requirements: []
317
- rubygems_version: 3.2.17
331
+ rubygems_version: 3.2.18
318
332
  signing_key:
319
333
  specification_version: 4
320
334
  summary: Braintree Ruby Server SDK