braintree 2.94.0 → 2.95.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 +4 -4
- data/lib/braintree/credit_card_verification_gateway.rb +1 -1
- data/lib/braintree/error_codes.rb +10 -0
- data/lib/braintree/payment_method_gateway.rb +1 -0
- data/lib/braintree/test/credit_card.rb +3 -0
- data/lib/braintree/transaction/credit_card_details.rb +1 -0
- data/lib/braintree/transaction_gateway.rb +2 -1
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree/webhook_notification.rb +4 -0
- data/lib/braintree/webhook_testing_gateway.rb +5 -0
- data/spec/integration/braintree/credit_card_verification_spec.rb +63 -0
- data/spec/integration/braintree/payment_method_spec.rb +141 -0
- data/spec/integration/braintree/transaction_spec.rb +118 -11
- data/spec/spec_helper.rb +1 -0
- data/spec/unit/braintree/webhook_notification_spec.rb +20 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6885baaa1cf0362ea29a6c57834122bfef5ef5e4f022527e7d8d25fa4c748b6
|
4
|
+
data.tar.gz: b2bff8e8cc234fcab9ee20a37c53f5977da827ab74b3634f4ac1e7f044423ca3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f79c7a60e1eeb0ad4ae677d8402eb0aa1538f55d6a29e2b324acb0db6506b8ec43e04e32ca8a5b3de20ced19f383c99038435d9a1a525fad3d8cf2b7aeb5d6df
|
7
|
+
data.tar.gz: 109bbdea462fddac547448a411f1d99a020ef46833313608846cb1d04c49eca0aa508a4221ac044cde8bb8a03251dcdf26002050d1499b857fe83b90f74a3a03
|
@@ -46,7 +46,7 @@ module Braintree
|
|
46
46
|
|
47
47
|
def self._create_signature
|
48
48
|
[
|
49
|
-
{:options => [:amount, :merchant_account_id]},
|
49
|
+
{:options => [:amount, :merchant_account_id, :account_type]},
|
50
50
|
{:credit_card => [
|
51
51
|
:cardholder_name, :cvv, :expiration_date, :expiration_month, :expiration_year,
|
52
52
|
:number, {:billing_address => AddressGateway._shared_signature}
|
@@ -100,6 +100,8 @@ module Braintree
|
|
100
100
|
TokenIsTooLong = "91720"
|
101
101
|
VenmoSDKPaymentMethodCodeCardTypeIsNotAccepted = "91726"
|
102
102
|
VerificationNotSupportedOnThisMerchantAccount = "91730"
|
103
|
+
VerificationAccountTypeIsInvalid = "91757"
|
104
|
+
VerificationAccountTypeNotSupported = "91758"
|
103
105
|
|
104
106
|
module Options
|
105
107
|
UpdateExistingTokenIsInvalid = "91723"
|
@@ -419,6 +421,12 @@ module Braintree
|
|
419
421
|
module PayPal
|
420
422
|
CustomFieldTooLong = "91580"
|
421
423
|
end
|
424
|
+
|
425
|
+
module CreditCard
|
426
|
+
AccountTypeIsInvalid = "915184"
|
427
|
+
AccountTypeNotSupported = "915185"
|
428
|
+
AccountTypeDebitDoesNotSupportAuths = "915186"
|
429
|
+
end
|
422
430
|
end
|
423
431
|
|
424
432
|
module Industry
|
@@ -724,6 +732,8 @@ module Braintree
|
|
724
732
|
MerchantAccountIsSuspended = "94205"
|
725
733
|
MerchantAccountIsForbidden = "94206"
|
726
734
|
MerchantAccountCannotBeSubMerchantAccount = "94208"
|
735
|
+
AccountTypeIsInvalid = "942184"
|
736
|
+
AccountTypeNotSupported = "942185"
|
727
737
|
end
|
728
738
|
end
|
729
739
|
|
@@ -155,6 +155,7 @@ module Braintree
|
|
155
155
|
options = [
|
156
156
|
:make_default, :verification_merchant_account_id, :verify_card, :venmo_sdk_session,
|
157
157
|
:verification_amount, :us_bank_account_verification_method,
|
158
|
+
:verification_account_type,
|
158
159
|
:paypal => [
|
159
160
|
:payee_email,
|
160
161
|
:order_id,
|
@@ -32,6 +32,9 @@ module Braintree
|
|
32
32
|
MasterCards = %w[5105105105105100 5555555555554444]
|
33
33
|
|
34
34
|
Elo = "5066991111111118"
|
35
|
+
Hiper = "6370950000000005"
|
36
|
+
Hipercard = "6062820524845321"
|
37
|
+
|
35
38
|
Visa = "4012888888881881"
|
36
39
|
VisaInternational = "4009348888881881" # :nodoc:
|
37
40
|
VisaPrepaid = "4500600000000061"
|
@@ -223,7 +223,8 @@ module Braintree
|
|
223
223
|
{:paypal => [:custom_field, :payee_id, :payee_email, :description, {:supplementary_data => :_any_key_}]},
|
224
224
|
{:three_d_secure => [:required]},
|
225
225
|
{:amex_rewards => [:request_id, :points, :currency_amount, :currency_iso_code]},
|
226
|
-
{:venmo => [:profile_id]}
|
226
|
+
{:venmo => [:profile_id]},
|
227
|
+
{:credit_card => [:account_type]},
|
227
228
|
]
|
228
229
|
},
|
229
230
|
{:external_vault => [
|
data/lib/braintree/version.rb
CHANGED
@@ -40,7 +40,11 @@ module Braintree
|
|
40
40
|
ConnectedMerchantStatusTransitioned = "connected_merchant_status_transitioned"
|
41
41
|
ConnectedMerchantPayPalStatusChanged = "connected_merchant_paypal_status_changed"
|
42
42
|
|
43
|
+
# NEXT_MAJOR_VERSION remove GrantedPaymentInstrumentUpdate. Kind is not sent by Braintree Gateway.
|
44
|
+
# Kind will either be GrantorUpdatedGrantedPaymentMethod or RecipientUpdatedGrantedPaymentMethod.
|
43
45
|
GrantedPaymentInstrumentUpdate = "granted_payment_instrument_update"
|
46
|
+
GrantorUpdatedGrantedPaymentMethod = "grantor_updated_granted_payment_method"
|
47
|
+
RecipientUpdatedGrantedPaymentMethod = "recipient_updated_granted_payment_method"
|
44
48
|
GrantedPaymentInstrumentRevoked = "granted_payment_instrument_revoked"
|
45
49
|
|
46
50
|
LocalPaymentCompleted = "local_payment_completed"
|
@@ -76,8 +76,13 @@ module Braintree
|
|
76
76
|
_ideal_payment_complete_sample_xml(id)
|
77
77
|
when Braintree::WebhookNotification::Kind::IdealPaymentFailed
|
78
78
|
_ideal_payment_failed_sample_xml(id)
|
79
|
+
# NEXT_MAJOR_VERSION remove GrantedPaymentInstrumentUpdate
|
79
80
|
when Braintree::WebhookNotification::Kind::GrantedPaymentInstrumentUpdate
|
80
81
|
_granted_payment_instrument_update_sample_xml(id)
|
82
|
+
when Braintree::WebhookNotification::Kind::GrantorUpdatedGrantedPaymentMethod
|
83
|
+
_granted_payment_instrument_update_sample_xml(id)
|
84
|
+
when Braintree::WebhookNotification::Kind::RecipientUpdatedGrantedPaymentMethod
|
85
|
+
_granted_payment_instrument_update_sample_xml(id)
|
81
86
|
when Braintree::WebhookNotification::Kind::LocalPaymentCompleted
|
82
87
|
_local_payment_completed_sample_xml(id)
|
83
88
|
else
|
@@ -61,6 +61,69 @@ describe Braintree::CreditCardVerification, "search" do
|
|
61
61
|
result.success?.should == false
|
62
62
|
result.errors.for(:verification).for(:options).first.code.should == Braintree::ErrorCodes::Verification::Options::AmountCannotBeNegative
|
63
63
|
end
|
64
|
+
|
65
|
+
it "returns account type with debit" do
|
66
|
+
result = Braintree::CreditCardVerification.create(
|
67
|
+
:credit_card => {
|
68
|
+
:expiration_date => "01/2020",
|
69
|
+
:number => Braintree::Test::CreditCardNumbers::Hiper
|
70
|
+
},
|
71
|
+
:options => {
|
72
|
+
:merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
73
|
+
:account_type => "debit",
|
74
|
+
},
|
75
|
+
)
|
76
|
+
|
77
|
+
result.success?.should == true
|
78
|
+
result.credit_card_verification.credit_card[:account_type].should == "debit"
|
79
|
+
end
|
80
|
+
|
81
|
+
it "returns account type with credit" do
|
82
|
+
result = Braintree::CreditCardVerification.create(
|
83
|
+
:credit_card => {
|
84
|
+
:expiration_date => "01/2020",
|
85
|
+
:number => Braintree::Test::CreditCardNumbers::Hiper
|
86
|
+
},
|
87
|
+
:options => {
|
88
|
+
:merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
89
|
+
:account_type => "credit",
|
90
|
+
},
|
91
|
+
)
|
92
|
+
|
93
|
+
result.success?.should == true
|
94
|
+
result.credit_card_verification.credit_card[:account_type].should == "credit"
|
95
|
+
end
|
96
|
+
|
97
|
+
it "errors with unsupported account type" do
|
98
|
+
result = Braintree::CreditCardVerification.create(
|
99
|
+
:credit_card => {
|
100
|
+
:expiration_date => "01/2020",
|
101
|
+
:number => Braintree::Test::CreditCardNumbers::Visa
|
102
|
+
},
|
103
|
+
:options => {
|
104
|
+
:account_type => "credit",
|
105
|
+
},
|
106
|
+
)
|
107
|
+
|
108
|
+
result.success?.should == false
|
109
|
+
result.errors.for(:verification).for(:options).on(:account_type)[0].code.should == Braintree::ErrorCodes::Verification::Options::AccountTypeNotSupported
|
110
|
+
end
|
111
|
+
|
112
|
+
it "errors with invalid account type" do
|
113
|
+
result = Braintree::CreditCardVerification.create(
|
114
|
+
:credit_card => {
|
115
|
+
:expiration_date => "01/2020",
|
116
|
+
:number => Braintree::Test::CreditCardNumbers::Hiper
|
117
|
+
},
|
118
|
+
:options => {
|
119
|
+
:merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
120
|
+
:account_type => "ach",
|
121
|
+
},
|
122
|
+
)
|
123
|
+
|
124
|
+
result.success?.should == false
|
125
|
+
result.errors.for(:verification).for(:options).on(:account_type)[0].code.should == Braintree::ErrorCodes::Verification::Options::AccountTypeIsInvalid
|
126
|
+
end
|
64
127
|
end
|
65
128
|
|
66
129
|
describe "self.find" do
|
@@ -487,6 +487,147 @@ describe Braintree::PaymentMethod do
|
|
487
487
|
found_credit_card.billing_address.street_address.should == "456 Xyz Way"
|
488
488
|
end
|
489
489
|
|
490
|
+
context "account_type" do
|
491
|
+
it "verifies card with account_type debit" do
|
492
|
+
nonce = nonce_for_new_payment_method(
|
493
|
+
:credit_card => {
|
494
|
+
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
495
|
+
:expiration_month => "11",
|
496
|
+
:expiration_year => "2099",
|
497
|
+
}
|
498
|
+
)
|
499
|
+
customer = Braintree::Customer.create!
|
500
|
+
result = Braintree::PaymentMethod.create(
|
501
|
+
:payment_method_nonce => nonce,
|
502
|
+
:customer_id => customer.id,
|
503
|
+
:options => {
|
504
|
+
:verify_card => true,
|
505
|
+
:verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
506
|
+
:verification_account_type => "debit",
|
507
|
+
}
|
508
|
+
)
|
509
|
+
|
510
|
+
result.should be_success
|
511
|
+
result.payment_method.verification.credit_card[:account_type].should == "debit"
|
512
|
+
end
|
513
|
+
|
514
|
+
it "verifies card with account_type credit" do
|
515
|
+
nonce = nonce_for_new_payment_method(
|
516
|
+
:credit_card => {
|
517
|
+
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
518
|
+
:expiration_month => "11",
|
519
|
+
:expiration_year => "2099",
|
520
|
+
}
|
521
|
+
)
|
522
|
+
customer = Braintree::Customer.create!
|
523
|
+
result = Braintree::PaymentMethod.create(
|
524
|
+
:payment_method_nonce => nonce,
|
525
|
+
:customer_id => customer.id,
|
526
|
+
:options => {
|
527
|
+
:verify_card => true,
|
528
|
+
:verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
529
|
+
:verification_account_type => "credit",
|
530
|
+
}
|
531
|
+
)
|
532
|
+
|
533
|
+
result.should be_success
|
534
|
+
result.payment_method.verification.credit_card[:account_type].should == "credit"
|
535
|
+
end
|
536
|
+
|
537
|
+
it "errors with invalid account_type" do
|
538
|
+
nonce = nonce_for_new_payment_method(
|
539
|
+
:credit_card => {
|
540
|
+
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
541
|
+
:expiration_month => "11",
|
542
|
+
:expiration_year => "2099",
|
543
|
+
}
|
544
|
+
)
|
545
|
+
customer = Braintree::Customer.create!
|
546
|
+
result = Braintree::PaymentMethod.create(
|
547
|
+
:payment_method_nonce => nonce,
|
548
|
+
:customer_id => customer.id,
|
549
|
+
:options => {
|
550
|
+
:verify_card => true,
|
551
|
+
:verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
552
|
+
:verification_account_type => "ach",
|
553
|
+
}
|
554
|
+
)
|
555
|
+
|
556
|
+
result.should_not be_success
|
557
|
+
result.errors.for(:credit_card).for(:options).on(:verification_account_type)[0].code.should == Braintree::ErrorCodes::CreditCard::VerificationAccountTypeIsInvalid
|
558
|
+
end
|
559
|
+
|
560
|
+
it "errors when account_type not supported by merchant" do
|
561
|
+
nonce = nonce_for_new_payment_method(
|
562
|
+
:credit_card => {
|
563
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
564
|
+
:expiration_month => "11",
|
565
|
+
:expiration_year => "2099",
|
566
|
+
}
|
567
|
+
)
|
568
|
+
customer = Braintree::Customer.create!
|
569
|
+
result = Braintree::PaymentMethod.create(
|
570
|
+
:payment_method_nonce => nonce,
|
571
|
+
:customer_id => customer.id,
|
572
|
+
:options => {
|
573
|
+
:verify_card => true,
|
574
|
+
:verification_account_type => "credit",
|
575
|
+
}
|
576
|
+
)
|
577
|
+
|
578
|
+
result.should_not be_success
|
579
|
+
result.errors.for(:credit_card).for(:options).on(:verification_account_type)[0].code.should == Braintree::ErrorCodes::CreditCard::VerificationAccountTypeNotSupported
|
580
|
+
end
|
581
|
+
|
582
|
+
it "updates the credit card with account_type credit" do
|
583
|
+
customer = Braintree::Customer.create!
|
584
|
+
credit_card = Braintree::CreditCard.create!(
|
585
|
+
:cardholder_name => "Original Holder",
|
586
|
+
:customer_id => customer.id,
|
587
|
+
:cvv => "123",
|
588
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
589
|
+
:expiration_date => "05/2012"
|
590
|
+
)
|
591
|
+
update_result = Braintree::PaymentMethod.update(credit_card.token,
|
592
|
+
:cardholder_name => "New Holder",
|
593
|
+
:cvv => "456",
|
594
|
+
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
595
|
+
:expiration_date => "06/2013",
|
596
|
+
:options => {
|
597
|
+
:verify_card => true,
|
598
|
+
:verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
599
|
+
:verification_account_type => "credit",
|
600
|
+
},
|
601
|
+
)
|
602
|
+
update_result.success?.should == true
|
603
|
+
update_result.payment_method.verification.credit_card[:account_type].should == "credit"
|
604
|
+
end
|
605
|
+
|
606
|
+
it "updates the credit card with account_type debit" do
|
607
|
+
customer = Braintree::Customer.create!
|
608
|
+
credit_card = Braintree::CreditCard.create!(
|
609
|
+
:cardholder_name => "Original Holder",
|
610
|
+
:customer_id => customer.id,
|
611
|
+
:cvv => "123",
|
612
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
613
|
+
:expiration_date => "05/2012"
|
614
|
+
)
|
615
|
+
update_result = Braintree::PaymentMethod.update(credit_card.token,
|
616
|
+
:cardholder_name => "New Holder",
|
617
|
+
:cvv => "456",
|
618
|
+
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
619
|
+
:expiration_date => "06/2013",
|
620
|
+
:options => {
|
621
|
+
:verify_card => true,
|
622
|
+
:verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
623
|
+
:verification_account_type => "debit",
|
624
|
+
},
|
625
|
+
)
|
626
|
+
update_result.success?.should == true
|
627
|
+
update_result.payment_method.verification.credit_card[:account_type].should == "debit"
|
628
|
+
end
|
629
|
+
end
|
630
|
+
|
490
631
|
context "paypal" do
|
491
632
|
it "creates a payment method from an unvalidated future paypal account nonce" do
|
492
633
|
nonce = nonce_for_paypal_account(:consent_code => "PAYPAL_CONSENT_CODE")
|
@@ -2398,15 +2398,6 @@ describe Braintree::Transaction do
|
|
2398
2398
|
refund_transaction.refunded_transaction_id.should == transaction.id
|
2399
2399
|
end
|
2400
2400
|
|
2401
|
-
it "returns an error if already refunded" do
|
2402
|
-
transaction = create_paypal_transaction_for_refund
|
2403
|
-
result = Braintree::Transaction.refund(transaction.id)
|
2404
|
-
result.success?.should == true
|
2405
|
-
result = Braintree::Transaction.refund(transaction.id)
|
2406
|
-
result.success?.should == false
|
2407
|
-
result.errors.for(:transaction).on(:base)[0].code.should == Braintree::ErrorCodes::Transaction::HasAlreadyBeenRefunded
|
2408
|
-
end
|
2409
|
-
|
2410
2401
|
it "returns an error result if unsettled" do
|
2411
2402
|
transaction = Braintree::Transaction.sale!(
|
2412
2403
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
@@ -3955,6 +3946,122 @@ describe Braintree::Transaction do
|
|
3955
3946
|
end
|
3956
3947
|
|
3957
3948
|
end
|
3949
|
+
|
3950
|
+
context "account_type" do
|
3951
|
+
it "creates a Hiper transaction with account type credit" do
|
3952
|
+
result = Braintree::Transaction.create(
|
3953
|
+
:type => "sale",
|
3954
|
+
:merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
3955
|
+
:credit_card => {
|
3956
|
+
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
3957
|
+
:expiration_date => "05/2009"
|
3958
|
+
},
|
3959
|
+
:amount => "10.00",
|
3960
|
+
:options => {
|
3961
|
+
:credit_card => {
|
3962
|
+
:account_type => "credit",
|
3963
|
+
}
|
3964
|
+
}
|
3965
|
+
)
|
3966
|
+
result.success?.should == true
|
3967
|
+
result.transaction.credit_card_details.account_type.should == "credit"
|
3968
|
+
end
|
3969
|
+
|
3970
|
+
it "creates a Hipercard transaction with account_type credit" do
|
3971
|
+
result = Braintree::Transaction.create(
|
3972
|
+
:type => "sale",
|
3973
|
+
:merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
3974
|
+
:credit_card => {
|
3975
|
+
:number => Braintree::Test::CreditCardNumbers::Hipercard,
|
3976
|
+
:expiration_date => "05/2009"
|
3977
|
+
},
|
3978
|
+
:amount => "10.00",
|
3979
|
+
:options => {
|
3980
|
+
:credit_card => {
|
3981
|
+
:account_type => "credit",
|
3982
|
+
}
|
3983
|
+
}
|
3984
|
+
)
|
3985
|
+
result.success?.should == true
|
3986
|
+
result.transaction.credit_card_details.account_type.should == "credit"
|
3987
|
+
end
|
3988
|
+
|
3989
|
+
it "creates a Hiper transaction with account_type debit" do
|
3990
|
+
result = Braintree::Transaction.create(
|
3991
|
+
:type => "sale",
|
3992
|
+
:merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
3993
|
+
:credit_card => {
|
3994
|
+
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
3995
|
+
:expiration_date => "05/2009"
|
3996
|
+
},
|
3997
|
+
:amount => "10.00",
|
3998
|
+
:options => {
|
3999
|
+
:credit_card => {
|
4000
|
+
:account_type => "debit",
|
4001
|
+
},
|
4002
|
+
:submit_for_settlement => true,
|
4003
|
+
}
|
4004
|
+
)
|
4005
|
+
result.success?.should == true
|
4006
|
+
result.transaction.credit_card_details.account_type.should == "debit"
|
4007
|
+
end
|
4008
|
+
|
4009
|
+
it "does not allow auths with account_type debit" do
|
4010
|
+
result = Braintree::Transaction.create(
|
4011
|
+
:type => "sale",
|
4012
|
+
:merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
4013
|
+
:credit_card => {
|
4014
|
+
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
4015
|
+
:expiration_date => "05/2009"
|
4016
|
+
},
|
4017
|
+
:amount => "10.00",
|
4018
|
+
:options => {
|
4019
|
+
:credit_card => {
|
4020
|
+
:account_type => "debit",
|
4021
|
+
},
|
4022
|
+
}
|
4023
|
+
)
|
4024
|
+
result.success?.should == false
|
4025
|
+
result.errors.for(:transaction).for(:options).for(:credit_card).on(:account_type)[0].code.should == Braintree::ErrorCodes::Transaction::Options::CreditCard::AccountTypeDebitDoesNotSupportAuths
|
4026
|
+
end
|
4027
|
+
|
4028
|
+
it "does not allow invalid account_type" do
|
4029
|
+
result = Braintree::Transaction.create(
|
4030
|
+
:type => "sale",
|
4031
|
+
:merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
4032
|
+
:credit_card => {
|
4033
|
+
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
4034
|
+
:expiration_date => "05/2009"
|
4035
|
+
},
|
4036
|
+
:amount => "10.00",
|
4037
|
+
:options => {
|
4038
|
+
:credit_card => {
|
4039
|
+
:account_type => "ach",
|
4040
|
+
},
|
4041
|
+
}
|
4042
|
+
)
|
4043
|
+
result.success?.should == false
|
4044
|
+
result.errors.for(:transaction).for(:options).for(:credit_card).on(:account_type)[0].code.should == Braintree::ErrorCodes::Transaction::Options::CreditCard::AccountTypeIsInvalid
|
4045
|
+
end
|
4046
|
+
|
4047
|
+
it "does not allow account_type not supported by merchant" do
|
4048
|
+
result = Braintree::Transaction.create(
|
4049
|
+
:type => "sale",
|
4050
|
+
:credit_card => {
|
4051
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
4052
|
+
:expiration_date => "05/2009"
|
4053
|
+
},
|
4054
|
+
:amount => "10.00",
|
4055
|
+
:options => {
|
4056
|
+
:credit_card => {
|
4057
|
+
:account_type => "credit",
|
4058
|
+
},
|
4059
|
+
}
|
4060
|
+
)
|
4061
|
+
result.success?.should == false
|
4062
|
+
result.errors.for(:transaction).for(:options).for(:credit_card).on(:account_type)[0].code.should == Braintree::ErrorCodes::Transaction::Options::CreditCard::AccountTypeNotSupported
|
4063
|
+
end
|
4064
|
+
end
|
3958
4065
|
end
|
3959
4066
|
|
3960
4067
|
describe "self.create!" do
|
@@ -6269,8 +6376,8 @@ describe Braintree::Transaction do
|
|
6269
6376
|
:venmo_sdk_payment_method_code => Braintree::Test::VenmoSDK::InvalidPaymentMethodCode
|
6270
6377
|
)
|
6271
6378
|
result.success?.should == false
|
6272
|
-
result.message.should
|
6273
|
-
result.errors.
|
6379
|
+
result.message.should include("Invalid VenmoSDK payment method code")
|
6380
|
+
result.errors.map(&:code).should include("91727")
|
6274
6381
|
end
|
6275
6382
|
end
|
6276
6383
|
|
data/spec/spec_helper.rb
CHANGED
@@ -43,6 +43,7 @@ unless defined?(SPEC_HELPER_LOADED)
|
|
43
43
|
AnotherUsBankMerchantAccountId = "another_us_bank_merchant_account"
|
44
44
|
IdealMerchantAccountId = "ideal_merchant_account"
|
45
45
|
AdyenMerchantAccountId = "adyen_ma"
|
46
|
+
HiperBRLMerchantAccountId = "hiper_brl"
|
46
47
|
|
47
48
|
TrialPlan = {
|
48
49
|
:description => "Plan for integration tests -- with trial",
|
@@ -436,16 +436,33 @@ describe Braintree::WebhookNotification do
|
|
436
436
|
end
|
437
437
|
|
438
438
|
context "granted_payment_instrument_update" do
|
439
|
-
it "builds a sample notification for a
|
439
|
+
it "builds a sample notification for a GrantorUpdatedGrantedPaymentMethod webhook" do
|
440
440
|
sample_notification = Braintree::WebhookTesting.sample_notification(
|
441
|
-
Braintree::WebhookNotification::Kind::
|
441
|
+
Braintree::WebhookNotification::Kind::GrantorUpdatedGrantedPaymentMethod,
|
442
442
|
"my_id"
|
443
443
|
)
|
444
444
|
|
445
445
|
notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
|
446
446
|
update = notification.granted_payment_instrument_update
|
447
447
|
|
448
|
-
notification.kind.should == Braintree::WebhookNotification::Kind::
|
448
|
+
notification.kind.should == Braintree::WebhookNotification::Kind::GrantorUpdatedGrantedPaymentMethod
|
449
|
+
update.grant_owner_merchant_id.should == 'vczo7jqrpwrsi2px'
|
450
|
+
update.grant_recipient_merchant_id.should == 'cf0i8wgarszuy6hc'
|
451
|
+
update.payment_method_nonce.should == 'ee257d98-de40-47e8-96b3-a6954ea7a9a4'
|
452
|
+
update.token.should == 'abc123z'
|
453
|
+
update.updated_fields.should == ['expiration-month', 'expiration-year']
|
454
|
+
end
|
455
|
+
|
456
|
+
it "builds a sample notification for a RecipientUpdatedGrantedPaymentMethod webhook" do
|
457
|
+
sample_notification = Braintree::WebhookTesting.sample_notification(
|
458
|
+
Braintree::WebhookNotification::Kind::RecipientUpdatedGrantedPaymentMethod,
|
459
|
+
"my_id"
|
460
|
+
)
|
461
|
+
|
462
|
+
notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
|
463
|
+
update = notification.granted_payment_instrument_update
|
464
|
+
|
465
|
+
notification.kind.should == Braintree::WebhookNotification::Kind::RecipientUpdatedGrantedPaymentMethod
|
449
466
|
update.grant_owner_merchant_id.should == 'vczo7jqrpwrsi2px'
|
450
467
|
update.grant_recipient_merchant_id.should == 'cf0i8wgarszuy6hc'
|
451
468
|
update.payment_method_nonce.should == 'ee257d98-de40-47e8-96b3-a6954ea7a9a4'
|
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.
|
4
|
+
version: 2.95.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-
|
11
|
+
date: 2019-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|
@@ -319,7 +319,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
319
319
|
version: '0'
|
320
320
|
requirements: []
|
321
321
|
rubyforge_project: braintree
|
322
|
-
rubygems_version: 2.7.
|
322
|
+
rubygems_version: 2.7.9
|
323
323
|
signing_key:
|
324
324
|
specification_version: 4
|
325
325
|
summary: Braintree Gateway Ruby Client Library
|