braintree 4.26.0 → 4.27.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/configuration.rb +1 -1
- data/lib/braintree/error_codes.rb +5 -104
- data/lib/braintree/merchant_account.rb +1 -25
- data/lib/braintree/merchant_account_gateway.rb +0 -81
- data/lib/braintree/transaction.rb +0 -26
- data/lib/braintree/transaction_gateway.rb +9 -20
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree/webhook_notification.rb +0 -4
- data/lib/braintree/webhook_testing_gateway.rb +0 -33
- data/lib/braintree.rb +0 -3
- data/spec/integration/braintree/disbursement_spec.rb +1 -1
- data/spec/integration/braintree/merchant_account_spec.rb +0 -342
- data/spec/integration/braintree/payment_method_spec.rb +3 -3
- data/spec/integration/braintree/transaction_payment_facilitator_spec.rb +119 -0
- data/spec/integration/braintree/transaction_spec.rb +1 -305
- data/spec/spec_helper.rb +1 -1
- data/spec/unit/braintree/configuration_spec.rb +1 -1
- data/spec/unit/braintree/transaction_gateway_spec.rb +19 -0
- data/spec/unit/braintree/webhook_notification_spec.rb +0 -53
- metadata +3 -7
- data/lib/braintree/merchant_account/business_details.rb +0 -17
- data/lib/braintree/merchant_account/funding_details.rb +0 -18
- data/lib/braintree/merchant_account/individual_details.rb +0 -20
- data/spec/unit/braintree/disbursement_spec.rb +0 -131
- data/spec/unit/braintree/merchant_account_spec.rb +0 -33
@@ -1987,108 +1987,6 @@ describe Braintree::Transaction do
|
|
1987
1987
|
end
|
1988
1988
|
end
|
1989
1989
|
|
1990
|
-
context "service fees" do
|
1991
|
-
it "allows specifying service fees" do
|
1992
|
-
result = Braintree::Transaction.create(
|
1993
|
-
:type => "sale",
|
1994
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
1995
|
-
:merchant_account_id => SpecHelper::NonDefaultSubMerchantAccountId,
|
1996
|
-
:credit_card => {
|
1997
|
-
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1998
|
-
:expiration_date => "12/12",
|
1999
|
-
},
|
2000
|
-
:service_fee_amount => "1.00",
|
2001
|
-
)
|
2002
|
-
expect(result.success?).to eq(true)
|
2003
|
-
expect(result.transaction.service_fee_amount).to eq(BigDecimal("1.00"))
|
2004
|
-
end
|
2005
|
-
|
2006
|
-
it "raises an error if transaction merchant account is a master" do
|
2007
|
-
result = Braintree::Transaction.create(
|
2008
|
-
:type => "sale",
|
2009
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
2010
|
-
:merchant_account_id => SpecHelper::NonDefaultMerchantAccountId,
|
2011
|
-
:credit_card => {
|
2012
|
-
:number => Braintree::Test::CreditCardNumbers::Visa,
|
2013
|
-
:expiration_date => "12/12",
|
2014
|
-
},
|
2015
|
-
:service_fee_amount => "1.00",
|
2016
|
-
)
|
2017
|
-
expect(result.success?).to eq(false)
|
2018
|
-
expected_error_code = Braintree::ErrorCodes::Transaction::ServiceFeeAmountNotAllowedOnMasterMerchantAccount
|
2019
|
-
expect(result.errors.for(:transaction).on(:service_fee_amount)[0].code).to eq(expected_error_code)
|
2020
|
-
end
|
2021
|
-
|
2022
|
-
it "raises an error if no service fee is present on a sub merchant account transaction" do
|
2023
|
-
result = Braintree::Transaction.create(
|
2024
|
-
:type => "sale",
|
2025
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
2026
|
-
:merchant_account_id => SpecHelper::NonDefaultSubMerchantAccountId,
|
2027
|
-
:credit_card => {
|
2028
|
-
:number => Braintree::Test::CreditCardNumbers::Visa,
|
2029
|
-
:expiration_date => "12/12",
|
2030
|
-
},
|
2031
|
-
)
|
2032
|
-
expect(result.success?).to eq(false)
|
2033
|
-
expected_error_code = Braintree::ErrorCodes::Transaction::SubMerchantAccountRequiresServiceFeeAmount
|
2034
|
-
expect(result.errors.for(:transaction).on(:merchant_account_id)[0].code).to eq(expected_error_code)
|
2035
|
-
end
|
2036
|
-
|
2037
|
-
it "raises an error if service fee amount is negative" do
|
2038
|
-
result = Braintree::Transaction.create(
|
2039
|
-
:merchant_account_id => SpecHelper::NonDefaultSubMerchantAccountId,
|
2040
|
-
:service_fee_amount => "-1.00",
|
2041
|
-
)
|
2042
|
-
expect(result.success?).to eq(false)
|
2043
|
-
expect(result.errors.for(:transaction).on(:service_fee_amount)[0].code).to eq(Braintree::ErrorCodes::Transaction::ServiceFeeAmountCannotBeNegative)
|
2044
|
-
end
|
2045
|
-
|
2046
|
-
it "raises an error if service fee amount is invalid" do
|
2047
|
-
result = Braintree::Transaction.create(
|
2048
|
-
:merchant_account_id => SpecHelper::NonDefaultSubMerchantAccountId,
|
2049
|
-
:service_fee_amount => "invalid amount",
|
2050
|
-
)
|
2051
|
-
expect(result.success?).to eq(false)
|
2052
|
-
expect(result.errors.for(:transaction).on(:service_fee_amount)[0].code).to eq(Braintree::ErrorCodes::Transaction::ServiceFeeAmountFormatIsInvalid)
|
2053
|
-
end
|
2054
|
-
end
|
2055
|
-
|
2056
|
-
context "escrow" do
|
2057
|
-
it "allows specifying transactions to be held for escrow" do
|
2058
|
-
result = Braintree::Transaction.create(
|
2059
|
-
:type => "sale",
|
2060
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
2061
|
-
:merchant_account_id => SpecHelper::NonDefaultSubMerchantAccountId,
|
2062
|
-
:credit_card => {
|
2063
|
-
:number => Braintree::Test::CreditCardNumbers::Visa,
|
2064
|
-
:expiration_date => "12/12",
|
2065
|
-
},
|
2066
|
-
:service_fee_amount => "10.00",
|
2067
|
-
:options => {:hold_in_escrow => true},
|
2068
|
-
)
|
2069
|
-
|
2070
|
-
expect(result.success?).to eq(true)
|
2071
|
-
expect(result.transaction.escrow_status).to eq(Braintree::Transaction::EscrowStatus::HoldPending)
|
2072
|
-
end
|
2073
|
-
|
2074
|
-
it "raises an error if transaction merchant account is a master" do
|
2075
|
-
result = Braintree::Transaction.create(
|
2076
|
-
:type => "sale",
|
2077
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
2078
|
-
:merchant_account_id => SpecHelper::NonDefaultMerchantAccountId,
|
2079
|
-
:credit_card => {
|
2080
|
-
:number => Braintree::Test::CreditCardNumbers::Visa,
|
2081
|
-
:expiration_date => "12/12",
|
2082
|
-
},
|
2083
|
-
:service_fee_amount => "1.00",
|
2084
|
-
:options => {:hold_in_escrow => true},
|
2085
|
-
)
|
2086
|
-
expect(result.success?).to eq(false)
|
2087
|
-
expected_error_code = Braintree::ErrorCodes::Transaction::CannotHoldInEscrow
|
2088
|
-
expect(result.errors.for(:transaction).on(:base)[0].code).to eq(expected_error_code)
|
2089
|
-
end
|
2090
|
-
end
|
2091
|
-
|
2092
1990
|
context "client API" do
|
2093
1991
|
it "can create a transaction with a shared card nonce" do
|
2094
1992
|
nonce = nonce_for_new_payment_method(
|
@@ -5739,7 +5637,6 @@ describe Braintree::Transaction do
|
|
5739
5637
|
end
|
5740
5638
|
end
|
5741
5639
|
|
5742
|
-
|
5743
5640
|
context "3rd party Card on File Network Token" do
|
5744
5641
|
it "Works with all params" do
|
5745
5642
|
params = {
|
@@ -6134,24 +6031,6 @@ describe Braintree::Transaction do
|
|
6134
6031
|
expect(result.errors.for(:transaction).on(:base)[0].code).to eq(Braintree::ErrorCodes::Transaction::CannotSubmitForSettlement)
|
6135
6032
|
end
|
6136
6033
|
|
6137
|
-
context "service fees" do
|
6138
|
-
it "returns an error result if amount submitted for settlement is less than service fee amount" do
|
6139
|
-
transaction = Braintree::Transaction.create(
|
6140
|
-
:type => "sale",
|
6141
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
6142
|
-
:merchant_account_id => SpecHelper::NonDefaultSubMerchantAccountId,
|
6143
|
-
:credit_card => {
|
6144
|
-
:number => Braintree::Test::CreditCardNumbers::Visa,
|
6145
|
-
:expiration_date => "06/2009"
|
6146
|
-
},
|
6147
|
-
:service_fee_amount => "1.00",
|
6148
|
-
).transaction
|
6149
|
-
result = Braintree::Transaction.submit_for_settlement(transaction.id, "0.01")
|
6150
|
-
expect(result.success?).to eq(false)
|
6151
|
-
expect(result.errors.for(:transaction).on(:amount)[0].code).to eq(Braintree::ErrorCodes::Transaction::SettlementAmountIsLessThanServiceFeeAmount)
|
6152
|
-
end
|
6153
|
-
end
|
6154
|
-
|
6155
6034
|
it "succeeds when industry data is provided" do
|
6156
6035
|
transaction = Braintree::Transaction.create(
|
6157
6036
|
:type => "sale",
|
@@ -6715,101 +6594,6 @@ describe Braintree::Transaction do
|
|
6715
6594
|
end
|
6716
6595
|
end
|
6717
6596
|
|
6718
|
-
describe "self.release_from_escrow" do
|
6719
|
-
it "returns the transaction if successful" do
|
6720
|
-
original_transaction = create_escrowed_transcation
|
6721
|
-
|
6722
|
-
result = Braintree::Transaction.release_from_escrow(original_transaction.id)
|
6723
|
-
expect(result.transaction.escrow_status).to eq(Braintree::Transaction::EscrowStatus::ReleasePending)
|
6724
|
-
end
|
6725
|
-
|
6726
|
-
it "returns an error result if escrow_status is not HeldForEscrow" do
|
6727
|
-
transaction = Braintree::Transaction.sale!(
|
6728
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
6729
|
-
:merchant_account_id => SpecHelper::NonDefaultSubMerchantAccountId,
|
6730
|
-
:credit_card => {
|
6731
|
-
:number => Braintree::Test::CreditCardNumbers::Visa,
|
6732
|
-
:expiration_date => "05/2009"
|
6733
|
-
},
|
6734
|
-
:service_fee_amount => "1.00",
|
6735
|
-
)
|
6736
|
-
|
6737
|
-
expect(transaction.escrow_status).to be_nil
|
6738
|
-
|
6739
|
-
result = Braintree::Transaction.release_from_escrow(transaction.id)
|
6740
|
-
expect(result.errors.for(:transaction).on(:base)[0].code).to eq(Braintree::ErrorCodes::Transaction::CannotReleaseFromEscrow)
|
6741
|
-
end
|
6742
|
-
end
|
6743
|
-
|
6744
|
-
describe "self.release_from_escrow!" do
|
6745
|
-
it "returns the transaction when successful" do
|
6746
|
-
original_transaction = create_escrowed_transcation
|
6747
|
-
|
6748
|
-
transaction = Braintree::Transaction.release_from_escrow!(original_transaction.id)
|
6749
|
-
expect(transaction.escrow_status).to eq(Braintree::Transaction::EscrowStatus::ReleasePending)
|
6750
|
-
end
|
6751
|
-
|
6752
|
-
it "raises an error when transaction is not successful" do
|
6753
|
-
transaction = Braintree::Transaction.sale!(
|
6754
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
6755
|
-
:merchant_account_id => SpecHelper::NonDefaultSubMerchantAccountId,
|
6756
|
-
:credit_card => {
|
6757
|
-
:number => Braintree::Test::CreditCardNumbers::Visa,
|
6758
|
-
:expiration_date => "05/2009"
|
6759
|
-
},
|
6760
|
-
:service_fee_amount => "1.00",
|
6761
|
-
)
|
6762
|
-
|
6763
|
-
expect(transaction.escrow_status).to be_nil
|
6764
|
-
|
6765
|
-
expect do
|
6766
|
-
Braintree::Transaction.release_from_escrow!(transaction.id)
|
6767
|
-
end.to raise_error(Braintree::ValidationsFailed)
|
6768
|
-
end
|
6769
|
-
end
|
6770
|
-
|
6771
|
-
describe "self.cancel_release" do
|
6772
|
-
it "returns the transaction if successful" do
|
6773
|
-
transaction = create_escrowed_transcation
|
6774
|
-
result = Braintree::Transaction.release_from_escrow(transaction.id)
|
6775
|
-
expect(result.transaction.escrow_status).to eq(Braintree::Transaction::EscrowStatus::ReleasePending)
|
6776
|
-
|
6777
|
-
result = Braintree::Transaction.cancel_release(transaction.id)
|
6778
|
-
|
6779
|
-
expect(result.success?).to be(true)
|
6780
|
-
expect(result.transaction.escrow_status).to eq(Braintree::Transaction::EscrowStatus::Held)
|
6781
|
-
end
|
6782
|
-
|
6783
|
-
it "returns an error result if escrow_status is not ReleasePending" do
|
6784
|
-
transaction = create_escrowed_transcation
|
6785
|
-
|
6786
|
-
result = Braintree::Transaction.cancel_release(transaction.id)
|
6787
|
-
|
6788
|
-
expect(result.success?).to be(false)
|
6789
|
-
expect(result.errors.for(:transaction).on(:base)[0].code).to eq(Braintree::ErrorCodes::Transaction::CannotCancelRelease)
|
6790
|
-
end
|
6791
|
-
end
|
6792
|
-
|
6793
|
-
describe "self.cancel_release!" do
|
6794
|
-
it "returns the transaction when release is cancelled" do
|
6795
|
-
transaction = create_escrowed_transcation
|
6796
|
-
result = Braintree::Transaction.release_from_escrow(transaction.id)
|
6797
|
-
expect(result.transaction.escrow_status).to eq(Braintree::Transaction::EscrowStatus::ReleasePending)
|
6798
|
-
|
6799
|
-
transaction = Braintree::Transaction.cancel_release!(transaction.id)
|
6800
|
-
|
6801
|
-
expect(transaction.escrow_status).to eq(Braintree::Transaction::EscrowStatus::Held)
|
6802
|
-
end
|
6803
|
-
|
6804
|
-
it "raises an error when release cannot be cancelled" do
|
6805
|
-
transaction = create_escrowed_transcation
|
6806
|
-
|
6807
|
-
expect {
|
6808
|
-
transaction = Braintree::Transaction.cancel_release!(transaction.id)
|
6809
|
-
}.to raise_error(Braintree::ValidationsFailed)
|
6810
|
-
end
|
6811
|
-
end
|
6812
|
-
|
6813
6597
|
describe "self.credit" do
|
6814
6598
|
it "returns a successful result with type=credit if successful" do
|
6815
6599
|
result = Braintree::Transaction.credit(
|
@@ -7095,76 +6879,6 @@ describe Braintree::Transaction do
|
|
7095
6879
|
end
|
7096
6880
|
end
|
7097
6881
|
|
7098
|
-
describe "self.hold_in_escrow" do
|
7099
|
-
it "returns the transaction if successful" do
|
7100
|
-
result = Braintree::Transaction.create(
|
7101
|
-
:type => "sale",
|
7102
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
7103
|
-
:merchant_account_id => SpecHelper::NonDefaultSubMerchantAccountId,
|
7104
|
-
:credit_card => {
|
7105
|
-
:number => Braintree::Test::CreditCardNumbers::Visa,
|
7106
|
-
:expiration_date => "12/12",
|
7107
|
-
},
|
7108
|
-
:service_fee_amount => "10.00",
|
7109
|
-
)
|
7110
|
-
|
7111
|
-
expect(result.transaction.escrow_status).to be_nil
|
7112
|
-
result = Braintree::Transaction.hold_in_escrow(result.transaction.id)
|
7113
|
-
|
7114
|
-
expect(result.success?).to be(true)
|
7115
|
-
expect(result.transaction.escrow_status).to eq(Braintree::Transaction::EscrowStatus::HoldPending)
|
7116
|
-
end
|
7117
|
-
|
7118
|
-
it "returns an error result if the transaction cannot be held in escrow" do
|
7119
|
-
transaction = Braintree::Transaction.sale!(
|
7120
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
7121
|
-
:merchant_account_id => SpecHelper::NonDefaultMerchantAccountId,
|
7122
|
-
:credit_card => {
|
7123
|
-
:number => Braintree::Test::CreditCardNumbers::Visa,
|
7124
|
-
:expiration_date => "05/2009"
|
7125
|
-
},
|
7126
|
-
)
|
7127
|
-
|
7128
|
-
result = Braintree::Transaction.hold_in_escrow(transaction.id)
|
7129
|
-
expect(result.errors.for(:transaction).on(:base)[0].code).to eq(Braintree::ErrorCodes::Transaction::CannotHoldInEscrow)
|
7130
|
-
end
|
7131
|
-
end
|
7132
|
-
|
7133
|
-
describe "self.hold_in_escrow!" do
|
7134
|
-
it "returns the transaction if successful" do
|
7135
|
-
result = Braintree::Transaction.create(
|
7136
|
-
:type => "sale",
|
7137
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
7138
|
-
:merchant_account_id => SpecHelper::NonDefaultSubMerchantAccountId,
|
7139
|
-
:credit_card => {
|
7140
|
-
:number => Braintree::Test::CreditCardNumbers::Visa,
|
7141
|
-
:expiration_date => "12/12",
|
7142
|
-
},
|
7143
|
-
:service_fee_amount => "10.00",
|
7144
|
-
)
|
7145
|
-
|
7146
|
-
expect(result.transaction.escrow_status).to be_nil
|
7147
|
-
transaction = Braintree::Transaction.hold_in_escrow!(result.transaction.id)
|
7148
|
-
|
7149
|
-
expect(transaction.escrow_status).to eq(Braintree::Transaction::EscrowStatus::HoldPending)
|
7150
|
-
end
|
7151
|
-
|
7152
|
-
it "raises an error if the transaction cannot be held in escrow" do
|
7153
|
-
transaction = Braintree::Transaction.sale!(
|
7154
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
7155
|
-
:merchant_account_id => SpecHelper::NonDefaultMerchantAccountId,
|
7156
|
-
:credit_card => {
|
7157
|
-
:number => Braintree::Test::CreditCardNumbers::Visa,
|
7158
|
-
:expiration_date => "05/2009"
|
7159
|
-
},
|
7160
|
-
)
|
7161
|
-
|
7162
|
-
expect do
|
7163
|
-
Braintree::Transaction.hold_in_escrow!(transaction.id)
|
7164
|
-
end.to raise_error(Braintree::ValidationsFailed)
|
7165
|
-
end
|
7166
|
-
end
|
7167
|
-
|
7168
6882
|
describe "self.void" do
|
7169
6883
|
it "returns a successful result if successful" do
|
7170
6884
|
transaction = Braintree::Transaction.sale!(
|
@@ -7374,24 +7088,6 @@ describe Braintree::Transaction do
|
|
7374
7088
|
Braintree::Transaction.find(transaction.id)
|
7375
7089
|
end
|
7376
7090
|
|
7377
|
-
def create_escrowed_transcation
|
7378
|
-
transaction = Braintree::Transaction.sale!(
|
7379
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
7380
|
-
:merchant_account_id => SpecHelper::NonDefaultSubMerchantAccountId,
|
7381
|
-
:credit_card => {
|
7382
|
-
:number => Braintree::Test::CreditCardNumbers::Visa,
|
7383
|
-
:expiration_date => "05/2009"
|
7384
|
-
},
|
7385
|
-
:service_fee_amount => "1.00",
|
7386
|
-
:options => {:hold_in_escrow => true},
|
7387
|
-
)
|
7388
|
-
|
7389
|
-
config = Braintree::Configuration.instantiate
|
7390
|
-
config.http.put("#{config.base_merchant_path}/transactions/#{transaction.id}/settle")
|
7391
|
-
config.http.put("#{config.base_merchant_path}/transactions/#{transaction.id}/escrow")
|
7392
|
-
Braintree::Transaction.find(transaction.id)
|
7393
|
-
end
|
7394
|
-
|
7395
7091
|
context "paypal" do
|
7396
7092
|
it "can create a transaction for a paypal account" do
|
7397
7093
|
result = Braintree::Transaction.sale(
|
@@ -8022,4 +7718,4 @@ describe Braintree::Transaction do
|
|
8022
7718
|
expect(result.transaction.status).to eq(Braintree::Transaction::Status::SubmittedForSettlement)
|
8023
7719
|
end
|
8024
7720
|
end
|
8025
|
-
end
|
7721
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -34,13 +34,13 @@ unless defined?(SPEC_HELPER_LOADED)
|
|
34
34
|
AibSwedenMaMerchantAccountId = "aib_swe_ma"
|
35
35
|
AnotherUsBankMerchantAccountId = "another_us_bank_merchant_account"
|
36
36
|
CardProcessorBRLMerchantAccountId = "card_processor_brl"
|
37
|
+
CardProcessorBRLPayFacMerchantAccountId = "card_processor_brl_payfac"
|
37
38
|
DefaultMerchantAccountId = "sandbox_credit_card"
|
38
39
|
FakeAmexDirectMerchantAccountId = "fake_amex_direct_usd"
|
39
40
|
FakeFirstDataMerchantAccountId = "fake_first_data_merchant_account"
|
40
41
|
FakeVenmoAccountMerchantAccountId = "fake_first_data_venmo_account"
|
41
42
|
HiperBRLMerchantAccountId = "hiper_brl"
|
42
43
|
NonDefaultMerchantAccountId = "sandbox_credit_card_non_default"
|
43
|
-
NonDefaultSubMerchantAccountId = "sandbox_sub_merchant_account"
|
44
44
|
PinlessDebitMerchantAccountId = "pinless_debit"
|
45
45
|
ThreeDSecureMerchantAccountId = "three_d_secure_merchant_account"
|
46
46
|
UsBankMerchantAccountId = "us_bank_merchant_account"
|
@@ -399,7 +399,7 @@ describe Braintree::Configuration do
|
|
399
399
|
|
400
400
|
it "is qa.braintreegateway.com for qa" do
|
401
401
|
Braintree::Configuration.environment = :qa
|
402
|
-
expect(Braintree::Configuration.instantiate.server).to eq("gateway.
|
402
|
+
expect(Braintree::Configuration.instantiate.server).to eq("gateway.qa.braintreepayments.com")
|
403
403
|
end
|
404
404
|
|
405
405
|
it "can by changed by configuring the production endpoint" do
|
@@ -94,6 +94,25 @@ describe Braintree::TransactionGateway do
|
|
94
94
|
]
|
95
95
|
},
|
96
96
|
{:paypal_account => [:email, :token, :paypal_data, :payee_id, :payee_email, :payer_id, :payment_id]},
|
97
|
+
{:payment_facilitator => [
|
98
|
+
:payment_facilitator_id,
|
99
|
+
{:sub_merchant => [
|
100
|
+
:reference_number,
|
101
|
+
:tax_id,
|
102
|
+
:legal_name,
|
103
|
+
{:address => [
|
104
|
+
:street_address,
|
105
|
+
:locality,
|
106
|
+
:region,
|
107
|
+
:country_code_alpha2,
|
108
|
+
:postal_code,
|
109
|
+
{:international_phone => [
|
110
|
+
:country_code,
|
111
|
+
:national_number
|
112
|
+
]}
|
113
|
+
]}
|
114
|
+
]}
|
115
|
+
]},
|
97
116
|
{:risk_data => [:customer_browser, :customer_device_id, :customer_ip, :customer_location_zip, :customer_tenure]},
|
98
117
|
{
|
99
118
|
:shipping => Braintree::AddressGateway._shared_signature + [:shipping_method],
|
@@ -310,25 +310,6 @@ describe Braintree::WebhookNotification do
|
|
310
310
|
expect(notification.transaction.disbursement_details.disbursement_date).to eq(Date.parse("2013-07-09"))
|
311
311
|
end
|
312
312
|
|
313
|
-
it "builds a sample notification for a disbursement_exception webhook" do
|
314
|
-
sample_notification = Braintree::WebhookTesting.sample_notification(
|
315
|
-
Braintree::WebhookNotification::Kind::DisbursementException,
|
316
|
-
"my_id",
|
317
|
-
)
|
318
|
-
|
319
|
-
notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
|
320
|
-
|
321
|
-
expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::DisbursementException)
|
322
|
-
expect(notification.disbursement.id).to eq("my_id")
|
323
|
-
expect(notification.disbursement.transaction_ids).to eq(%W{ afv56j kj8hjk })
|
324
|
-
expect(notification.disbursement.retry).to be(false)
|
325
|
-
expect(notification.disbursement.success).to be(false)
|
326
|
-
expect(notification.disbursement.exception_message).to eq("bank_rejected")
|
327
|
-
expect(notification.disbursement.disbursement_date).to eq(Date.parse("2014-02-10"))
|
328
|
-
expect(notification.disbursement.follow_up_action).to eq("update_funding_information")
|
329
|
-
expect(notification.disbursement.merchant_account.id).to eq("merchant_account_token")
|
330
|
-
end
|
331
|
-
|
332
313
|
it "builds a sample notification for a disbursement webhook" do
|
333
314
|
sample_notification = Braintree::WebhookTesting.sample_notification(
|
334
315
|
Braintree::WebhookNotification::Kind::Disbursement,
|
@@ -403,40 +384,6 @@ describe Braintree::WebhookNotification do
|
|
403
384
|
end
|
404
385
|
end
|
405
386
|
|
406
|
-
context "merchant account" do
|
407
|
-
it "builds a sample notification for a merchant account approved webhook" do
|
408
|
-
sample_notification = Braintree::WebhookTesting.sample_notification(
|
409
|
-
Braintree::WebhookNotification::Kind::SubMerchantAccountApproved,
|
410
|
-
"my_id",
|
411
|
-
)
|
412
|
-
|
413
|
-
notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
|
414
|
-
|
415
|
-
expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::SubMerchantAccountApproved)
|
416
|
-
expect(notification.merchant_account.id).to eq("my_id")
|
417
|
-
expect(notification.merchant_account.status).to eq(Braintree::MerchantAccount::Status::Active)
|
418
|
-
expect(notification.merchant_account.master_merchant_account.id).to eq("master_ma_for_my_id")
|
419
|
-
expect(notification.merchant_account.master_merchant_account.status).to eq(Braintree::MerchantAccount::Status::Active)
|
420
|
-
end
|
421
|
-
|
422
|
-
it "builds a sample notification for a merchant account declined webhook" do
|
423
|
-
sample_notification = Braintree::WebhookTesting.sample_notification(
|
424
|
-
Braintree::WebhookNotification::Kind::SubMerchantAccountDeclined,
|
425
|
-
"my_id",
|
426
|
-
)
|
427
|
-
|
428
|
-
notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
|
429
|
-
|
430
|
-
expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::SubMerchantAccountDeclined)
|
431
|
-
expect(notification.merchant_account.id).to eq("my_id")
|
432
|
-
expect(notification.merchant_account.status).to eq(Braintree::MerchantAccount::Status::Suspended)
|
433
|
-
expect(notification.merchant_account.master_merchant_account.id).to eq("master_ma_for_my_id")
|
434
|
-
expect(notification.merchant_account.master_merchant_account.status).to eq(Braintree::MerchantAccount::Status::Suspended)
|
435
|
-
expect(notification.message).to eq("Credit score is too low")
|
436
|
-
expect(notification.errors.for(:merchant_account).on(:base).first.code).to eq(Braintree::ErrorCodes::MerchantAccount::DeclinedOFAC)
|
437
|
-
end
|
438
|
-
end
|
439
|
-
|
440
387
|
context "subscription" do
|
441
388
|
it "builds a sample notification for a subscription billing skipped webhook" do
|
442
389
|
sample_notification = Braintree::WebhookTesting.sample_notification(
|
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.
|
4
|
+
version: 4.27.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Braintree
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|
@@ -129,9 +129,6 @@ files:
|
|
129
129
|
- lib/braintree/merchant.rb
|
130
130
|
- lib/braintree/merchant_account.rb
|
131
131
|
- lib/braintree/merchant_account/address_details.rb
|
132
|
-
- lib/braintree/merchant_account/business_details.rb
|
133
|
-
- lib/braintree/merchant_account/funding_details.rb
|
134
|
-
- lib/braintree/merchant_account/individual_details.rb
|
135
132
|
- lib/braintree/merchant_account_gateway.rb
|
136
133
|
- lib/braintree/merchant_gateway.rb
|
137
134
|
- lib/braintree/meta_checkout_card.rb
|
@@ -280,6 +277,7 @@ files:
|
|
280
277
|
- spec/integration/braintree/test/transaction_amounts_spec.rb
|
281
278
|
- spec/integration/braintree/test_transaction_spec.rb
|
282
279
|
- spec/integration/braintree/transaction_line_item_spec.rb
|
280
|
+
- spec/integration/braintree/transaction_payment_facilitator_spec.rb
|
283
281
|
- spec/integration/braintree/transaction_search_spec.rb
|
284
282
|
- spec/integration/braintree/transaction_spec.rb
|
285
283
|
- spec/integration/braintree/transaction_us_bank_account_spec.rb
|
@@ -308,7 +306,6 @@ files:
|
|
308
306
|
- spec/unit/braintree/customer_session_gateway_spec.rb
|
309
307
|
- spec/unit/braintree/customer_spec.rb
|
310
308
|
- spec/unit/braintree/digest_spec.rb
|
311
|
-
- spec/unit/braintree/disbursement_spec.rb
|
312
309
|
- spec/unit/braintree/dispute_search_spec.rb
|
313
310
|
- spec/unit/braintree/dispute_spec.rb
|
314
311
|
- spec/unit/braintree/document_upload_spec.rb
|
@@ -331,7 +328,6 @@ files:
|
|
331
328
|
- spec/unit/braintree/local_payment_completed_spec.rb
|
332
329
|
- spec/unit/braintree/local_payment_expired_spec.rb
|
333
330
|
- spec/unit/braintree/local_payment_funded_spec.rb
|
334
|
-
- spec/unit/braintree/merchant_account_spec.rb
|
335
331
|
- spec/unit/braintree/meta_checkout_card_details_spec.rb
|
336
332
|
- spec/unit/braintree/meta_checkout_card_spec.rb
|
337
333
|
- spec/unit/braintree/meta_checkout_token_details_spec.rb
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module Braintree
|
2
|
-
class MerchantAccount
|
3
|
-
class BusinessDetails
|
4
|
-
include BaseModule
|
5
|
-
|
6
|
-
attr_reader :address_details
|
7
|
-
attr_reader :dba_name
|
8
|
-
attr_reader :legal_name
|
9
|
-
attr_reader :tax_id
|
10
|
-
|
11
|
-
def initialize(attributes)
|
12
|
-
set_instance_variables_from_hash attributes unless attributes.nil?
|
13
|
-
@address_details = MerchantAccount::AddressDetails.new(@address)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module Braintree
|
2
|
-
class MerchantAccount
|
3
|
-
class FundingDetails
|
4
|
-
include BaseModule
|
5
|
-
|
6
|
-
attr_reader :account_number_last_4
|
7
|
-
attr_reader :descriptor
|
8
|
-
attr_reader :destination
|
9
|
-
attr_reader :email
|
10
|
-
attr_reader :mobile_phone
|
11
|
-
attr_reader :routing_number
|
12
|
-
|
13
|
-
def initialize(attributes)
|
14
|
-
set_instance_variables_from_hash attributes unless attributes.nil?
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module Braintree
|
2
|
-
class MerchantAccount
|
3
|
-
class IndividualDetails
|
4
|
-
include BaseModule
|
5
|
-
|
6
|
-
attr_reader :address_details
|
7
|
-
attr_reader :date_of_birth
|
8
|
-
attr_reader :email
|
9
|
-
attr_reader :first_name
|
10
|
-
attr_reader :last_name
|
11
|
-
attr_reader :phone
|
12
|
-
attr_reader :ssn_last_4
|
13
|
-
|
14
|
-
def initialize(attributes)
|
15
|
-
set_instance_variables_from_hash attributes unless attributes.nil?
|
16
|
-
@address_details = MerchantAccount::AddressDetails.new(@address)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|