braintree 4.25.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/apple_pay_card.rb +1 -0
- data/lib/braintree/bin_data.rb +2 -1
- data/lib/braintree/configuration.rb +1 -1
- data/lib/braintree/credit_card.rb +6 -5
- data/lib/braintree/error_codes.rb +46 -104
- data/lib/braintree/gateway.rb +4 -0
- data/lib/braintree/google_pay_card.rb +1 -0
- data/lib/braintree/merchant_account.rb +1 -25
- data/lib/braintree/merchant_account_gateway.rb +0 -81
- data/lib/braintree/meta_checkout_card.rb +6 -5
- data/lib/braintree/meta_checkout_token.rb +6 -5
- data/lib/braintree/paypal_payment_resource.rb +22 -0
- data/lib/braintree/paypal_payment_resource_gateway.rb +36 -0
- data/lib/braintree/test/credit_card.rb +1 -0
- data/lib/braintree/transaction/apple_pay_details.rb +1 -0
- data/lib/braintree/transaction/credit_card_details.rb +12 -10
- data/lib/braintree/transaction/google_pay_details.rb +11 -10
- data/lib/braintree/transaction/meta_checkout_card_details.rb +5 -2
- data/lib/braintree/transaction/meta_checkout_token_details.rb +6 -2
- data/lib/braintree/transaction/visa_checkout_card_details.rb +5 -2
- 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/visa_checkout_card.rb +5 -5
- data/lib/braintree/webhook_notification.rb +0 -4
- data/lib/braintree/webhook_testing_gateway.rb +0 -33
- data/lib/braintree.rb +2 -3
- data/spec/integration/braintree/credit_card_spec.rb +12 -0
- data/spec/integration/braintree/credit_card_verification_spec.rb +24 -0
- data/spec/integration/braintree/customer_spec.rb +22 -6
- 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_nonce_spec.rb +11 -0
- data/spec/integration/braintree/payment_method_spec.rb +3 -3
- data/spec/integration/braintree/paypal_payment_resource_spec.rb +141 -0
- data/spec/integration/braintree/transaction_payment_facilitator_spec.rb +119 -0
- data/spec/integration/braintree/transaction_spec.rb +16 -305
- data/spec/spec_helper.rb +1 -1
- data/spec/unit/braintree/apple_pay_card_spec.rb +1 -0
- data/spec/unit/braintree/configuration_spec.rb +1 -1
- data/spec/unit/braintree/credit_card_spec.rb +5 -0
- data/spec/unit/braintree/google_pay_card_spec.rb +8 -0
- data/spec/unit/braintree/meta_checkout_card_spec.rb +53 -51
- data/spec/unit/braintree/meta_checkout_token_spec.rb +3 -1
- data/spec/unit/braintree/payment_method_nonce_spec.rb +4 -1
- data/spec/unit/braintree/paypal_payment_resource_spec.rb +125 -0
- data/spec/unit/braintree/transaction/apple_pay_details_spec.rb +8 -0
- data/spec/unit/braintree/transaction/credit_card_details_spec.rb +2 -1
- data/spec/unit/braintree/transaction/google_pay_details_spec.rb +8 -0
- data/spec/unit/braintree/transaction/meta_checkout_card_details_spec.rb +8 -0
- data/spec/unit/braintree/transaction/meta_checkout_token_details_spec.rb +8 -0
- data/spec/unit/braintree/transaction/visa_checkout_card_details_spec.rb +8 -0
- data/spec/unit/braintree/transaction_gateway_spec.rb +19 -0
- data/spec/unit/braintree/transaction_spec.rb +2 -0
- data/spec/unit/braintree/visa_checkout_card_spec.rb +8 -0
- data/spec/unit/braintree/webhook_notification_spec.rb +0 -53
- data/spec/unit/credit_card_details_spec.rb +8 -0
- metadata +15 -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
@@ -267,6 +267,19 @@ describe Braintree::Transaction do
|
|
267
267
|
expect(result.transaction.credit_card_details.prepaid).to eq(Braintree::CreditCard::Prepaid::Yes)
|
268
268
|
expect(result.transaction.payment_instrument_type).to eq(Braintree::PaymentInstrumentType::CreditCard)
|
269
269
|
end
|
270
|
+
|
271
|
+
it "sets the prepaid_reloadable field if the card is prepaid reloadable" do
|
272
|
+
result = Braintree::Transaction.create(
|
273
|
+
:type => "sale",
|
274
|
+
:amount => 1_00,
|
275
|
+
:credit_card => {
|
276
|
+
:number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::PrepaidReloadable,
|
277
|
+
:expiration_date => "05/2009"
|
278
|
+
},
|
279
|
+
)
|
280
|
+
expect(result.transaction.credit_card_details.prepaid_reloadable).to eq(Braintree::CreditCard::PrepaidReloadable::Yes)
|
281
|
+
expect(result.transaction.payment_instrument_type).to eq(Braintree::PaymentInstrumentType::CreditCard)
|
282
|
+
end
|
270
283
|
end
|
271
284
|
|
272
285
|
describe "sca_exemption" do
|
@@ -1974,108 +1987,6 @@ describe Braintree::Transaction do
|
|
1974
1987
|
end
|
1975
1988
|
end
|
1976
1989
|
|
1977
|
-
context "service fees" do
|
1978
|
-
it "allows specifying service fees" do
|
1979
|
-
result = Braintree::Transaction.create(
|
1980
|
-
:type => "sale",
|
1981
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
1982
|
-
:merchant_account_id => SpecHelper::NonDefaultSubMerchantAccountId,
|
1983
|
-
:credit_card => {
|
1984
|
-
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1985
|
-
:expiration_date => "12/12",
|
1986
|
-
},
|
1987
|
-
:service_fee_amount => "1.00",
|
1988
|
-
)
|
1989
|
-
expect(result.success?).to eq(true)
|
1990
|
-
expect(result.transaction.service_fee_amount).to eq(BigDecimal("1.00"))
|
1991
|
-
end
|
1992
|
-
|
1993
|
-
it "raises an error if transaction merchant account is a master" do
|
1994
|
-
result = Braintree::Transaction.create(
|
1995
|
-
:type => "sale",
|
1996
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
1997
|
-
:merchant_account_id => SpecHelper::NonDefaultMerchantAccountId,
|
1998
|
-
:credit_card => {
|
1999
|
-
:number => Braintree::Test::CreditCardNumbers::Visa,
|
2000
|
-
:expiration_date => "12/12",
|
2001
|
-
},
|
2002
|
-
:service_fee_amount => "1.00",
|
2003
|
-
)
|
2004
|
-
expect(result.success?).to eq(false)
|
2005
|
-
expected_error_code = Braintree::ErrorCodes::Transaction::ServiceFeeAmountNotAllowedOnMasterMerchantAccount
|
2006
|
-
expect(result.errors.for(:transaction).on(:service_fee_amount)[0].code).to eq(expected_error_code)
|
2007
|
-
end
|
2008
|
-
|
2009
|
-
it "raises an error if no service fee is present on a sub merchant account transaction" do
|
2010
|
-
result = Braintree::Transaction.create(
|
2011
|
-
:type => "sale",
|
2012
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
2013
|
-
:merchant_account_id => SpecHelper::NonDefaultSubMerchantAccountId,
|
2014
|
-
:credit_card => {
|
2015
|
-
:number => Braintree::Test::CreditCardNumbers::Visa,
|
2016
|
-
:expiration_date => "12/12",
|
2017
|
-
},
|
2018
|
-
)
|
2019
|
-
expect(result.success?).to eq(false)
|
2020
|
-
expected_error_code = Braintree::ErrorCodes::Transaction::SubMerchantAccountRequiresServiceFeeAmount
|
2021
|
-
expect(result.errors.for(:transaction).on(:merchant_account_id)[0].code).to eq(expected_error_code)
|
2022
|
-
end
|
2023
|
-
|
2024
|
-
it "raises an error if service fee amount is negative" do
|
2025
|
-
result = Braintree::Transaction.create(
|
2026
|
-
:merchant_account_id => SpecHelper::NonDefaultSubMerchantAccountId,
|
2027
|
-
:service_fee_amount => "-1.00",
|
2028
|
-
)
|
2029
|
-
expect(result.success?).to eq(false)
|
2030
|
-
expect(result.errors.for(:transaction).on(:service_fee_amount)[0].code).to eq(Braintree::ErrorCodes::Transaction::ServiceFeeAmountCannotBeNegative)
|
2031
|
-
end
|
2032
|
-
|
2033
|
-
it "raises an error if service fee amount is invalid" do
|
2034
|
-
result = Braintree::Transaction.create(
|
2035
|
-
:merchant_account_id => SpecHelper::NonDefaultSubMerchantAccountId,
|
2036
|
-
:service_fee_amount => "invalid amount",
|
2037
|
-
)
|
2038
|
-
expect(result.success?).to eq(false)
|
2039
|
-
expect(result.errors.for(:transaction).on(:service_fee_amount)[0].code).to eq(Braintree::ErrorCodes::Transaction::ServiceFeeAmountFormatIsInvalid)
|
2040
|
-
end
|
2041
|
-
end
|
2042
|
-
|
2043
|
-
context "escrow" do
|
2044
|
-
it "allows specifying transactions to be held for escrow" do
|
2045
|
-
result = Braintree::Transaction.create(
|
2046
|
-
:type => "sale",
|
2047
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
2048
|
-
:merchant_account_id => SpecHelper::NonDefaultSubMerchantAccountId,
|
2049
|
-
:credit_card => {
|
2050
|
-
:number => Braintree::Test::CreditCardNumbers::Visa,
|
2051
|
-
:expiration_date => "12/12",
|
2052
|
-
},
|
2053
|
-
:service_fee_amount => "10.00",
|
2054
|
-
:options => {:hold_in_escrow => true},
|
2055
|
-
)
|
2056
|
-
|
2057
|
-
expect(result.success?).to eq(true)
|
2058
|
-
expect(result.transaction.escrow_status).to eq(Braintree::Transaction::EscrowStatus::HoldPending)
|
2059
|
-
end
|
2060
|
-
|
2061
|
-
it "raises an error if transaction merchant account is a master" do
|
2062
|
-
result = Braintree::Transaction.create(
|
2063
|
-
:type => "sale",
|
2064
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
2065
|
-
:merchant_account_id => SpecHelper::NonDefaultMerchantAccountId,
|
2066
|
-
:credit_card => {
|
2067
|
-
:number => Braintree::Test::CreditCardNumbers::Visa,
|
2068
|
-
:expiration_date => "12/12",
|
2069
|
-
},
|
2070
|
-
:service_fee_amount => "1.00",
|
2071
|
-
:options => {:hold_in_escrow => true},
|
2072
|
-
)
|
2073
|
-
expect(result.success?).to eq(false)
|
2074
|
-
expected_error_code = Braintree::ErrorCodes::Transaction::CannotHoldInEscrow
|
2075
|
-
expect(result.errors.for(:transaction).on(:base)[0].code).to eq(expected_error_code)
|
2076
|
-
end
|
2077
|
-
end
|
2078
|
-
|
2079
1990
|
context "client API" do
|
2080
1991
|
it "can create a transaction with a shared card nonce" do
|
2081
1992
|
nonce = nonce_for_new_payment_method(
|
@@ -2183,6 +2094,7 @@ describe Braintree::Transaction do
|
|
2183
2094
|
meta_checkout_card_details.last_4.should == "1881"
|
2184
2095
|
meta_checkout_card_details.masked_number.should == "401288******1881"
|
2185
2096
|
meta_checkout_card_details.prepaid.should == "No"
|
2097
|
+
meta_checkout_card_details.prepaid_reloadable.should == "Unknown"
|
2186
2098
|
end
|
2187
2099
|
|
2188
2100
|
it "can create a transaction with a fake meta checkout token nonce" do
|
@@ -2213,6 +2125,7 @@ describe Braintree::Transaction do
|
|
2213
2125
|
meta_checkout_token_details.last_4.should == "1881"
|
2214
2126
|
meta_checkout_token_details.masked_number.should == "401288******1881"
|
2215
2127
|
meta_checkout_token_details.prepaid.should == "No"
|
2128
|
+
meta_checkout_token_details.prepaid_reloadable.should == "Unknown"
|
2216
2129
|
end
|
2217
2130
|
|
2218
2131
|
it "can create a transaction with a fake apple pay nonce" do
|
@@ -5724,7 +5637,6 @@ describe Braintree::Transaction do
|
|
5724
5637
|
end
|
5725
5638
|
end
|
5726
5639
|
|
5727
|
-
|
5728
5640
|
context "3rd party Card on File Network Token" do
|
5729
5641
|
it "Works with all params" do
|
5730
5642
|
params = {
|
@@ -6119,24 +6031,6 @@ describe Braintree::Transaction do
|
|
6119
6031
|
expect(result.errors.for(:transaction).on(:base)[0].code).to eq(Braintree::ErrorCodes::Transaction::CannotSubmitForSettlement)
|
6120
6032
|
end
|
6121
6033
|
|
6122
|
-
context "service fees" do
|
6123
|
-
it "returns an error result if amount submitted for settlement is less than service fee amount" do
|
6124
|
-
transaction = Braintree::Transaction.create(
|
6125
|
-
:type => "sale",
|
6126
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
6127
|
-
:merchant_account_id => SpecHelper::NonDefaultSubMerchantAccountId,
|
6128
|
-
:credit_card => {
|
6129
|
-
:number => Braintree::Test::CreditCardNumbers::Visa,
|
6130
|
-
:expiration_date => "06/2009"
|
6131
|
-
},
|
6132
|
-
:service_fee_amount => "1.00",
|
6133
|
-
).transaction
|
6134
|
-
result = Braintree::Transaction.submit_for_settlement(transaction.id, "0.01")
|
6135
|
-
expect(result.success?).to eq(false)
|
6136
|
-
expect(result.errors.for(:transaction).on(:amount)[0].code).to eq(Braintree::ErrorCodes::Transaction::SettlementAmountIsLessThanServiceFeeAmount)
|
6137
|
-
end
|
6138
|
-
end
|
6139
|
-
|
6140
6034
|
it "succeeds when industry data is provided" do
|
6141
6035
|
transaction = Braintree::Transaction.create(
|
6142
6036
|
:type => "sale",
|
@@ -6700,101 +6594,6 @@ describe Braintree::Transaction do
|
|
6700
6594
|
end
|
6701
6595
|
end
|
6702
6596
|
|
6703
|
-
describe "self.release_from_escrow" do
|
6704
|
-
it "returns the transaction if successful" do
|
6705
|
-
original_transaction = create_escrowed_transcation
|
6706
|
-
|
6707
|
-
result = Braintree::Transaction.release_from_escrow(original_transaction.id)
|
6708
|
-
expect(result.transaction.escrow_status).to eq(Braintree::Transaction::EscrowStatus::ReleasePending)
|
6709
|
-
end
|
6710
|
-
|
6711
|
-
it "returns an error result if escrow_status is not HeldForEscrow" do
|
6712
|
-
transaction = Braintree::Transaction.sale!(
|
6713
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
6714
|
-
:merchant_account_id => SpecHelper::NonDefaultSubMerchantAccountId,
|
6715
|
-
:credit_card => {
|
6716
|
-
:number => Braintree::Test::CreditCardNumbers::Visa,
|
6717
|
-
:expiration_date => "05/2009"
|
6718
|
-
},
|
6719
|
-
:service_fee_amount => "1.00",
|
6720
|
-
)
|
6721
|
-
|
6722
|
-
expect(transaction.escrow_status).to be_nil
|
6723
|
-
|
6724
|
-
result = Braintree::Transaction.release_from_escrow(transaction.id)
|
6725
|
-
expect(result.errors.for(:transaction).on(:base)[0].code).to eq(Braintree::ErrorCodes::Transaction::CannotReleaseFromEscrow)
|
6726
|
-
end
|
6727
|
-
end
|
6728
|
-
|
6729
|
-
describe "self.release_from_escrow!" do
|
6730
|
-
it "returns the transaction when successful" do
|
6731
|
-
original_transaction = create_escrowed_transcation
|
6732
|
-
|
6733
|
-
transaction = Braintree::Transaction.release_from_escrow!(original_transaction.id)
|
6734
|
-
expect(transaction.escrow_status).to eq(Braintree::Transaction::EscrowStatus::ReleasePending)
|
6735
|
-
end
|
6736
|
-
|
6737
|
-
it "raises an error when transaction is not successful" do
|
6738
|
-
transaction = Braintree::Transaction.sale!(
|
6739
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
6740
|
-
:merchant_account_id => SpecHelper::NonDefaultSubMerchantAccountId,
|
6741
|
-
:credit_card => {
|
6742
|
-
:number => Braintree::Test::CreditCardNumbers::Visa,
|
6743
|
-
:expiration_date => "05/2009"
|
6744
|
-
},
|
6745
|
-
:service_fee_amount => "1.00",
|
6746
|
-
)
|
6747
|
-
|
6748
|
-
expect(transaction.escrow_status).to be_nil
|
6749
|
-
|
6750
|
-
expect do
|
6751
|
-
Braintree::Transaction.release_from_escrow!(transaction.id)
|
6752
|
-
end.to raise_error(Braintree::ValidationsFailed)
|
6753
|
-
end
|
6754
|
-
end
|
6755
|
-
|
6756
|
-
describe "self.cancel_release" do
|
6757
|
-
it "returns the transaction if successful" do
|
6758
|
-
transaction = create_escrowed_transcation
|
6759
|
-
result = Braintree::Transaction.release_from_escrow(transaction.id)
|
6760
|
-
expect(result.transaction.escrow_status).to eq(Braintree::Transaction::EscrowStatus::ReleasePending)
|
6761
|
-
|
6762
|
-
result = Braintree::Transaction.cancel_release(transaction.id)
|
6763
|
-
|
6764
|
-
expect(result.success?).to be(true)
|
6765
|
-
expect(result.transaction.escrow_status).to eq(Braintree::Transaction::EscrowStatus::Held)
|
6766
|
-
end
|
6767
|
-
|
6768
|
-
it "returns an error result if escrow_status is not ReleasePending" do
|
6769
|
-
transaction = create_escrowed_transcation
|
6770
|
-
|
6771
|
-
result = Braintree::Transaction.cancel_release(transaction.id)
|
6772
|
-
|
6773
|
-
expect(result.success?).to be(false)
|
6774
|
-
expect(result.errors.for(:transaction).on(:base)[0].code).to eq(Braintree::ErrorCodes::Transaction::CannotCancelRelease)
|
6775
|
-
end
|
6776
|
-
end
|
6777
|
-
|
6778
|
-
describe "self.cancel_release!" do
|
6779
|
-
it "returns the transaction when release is cancelled" do
|
6780
|
-
transaction = create_escrowed_transcation
|
6781
|
-
result = Braintree::Transaction.release_from_escrow(transaction.id)
|
6782
|
-
expect(result.transaction.escrow_status).to eq(Braintree::Transaction::EscrowStatus::ReleasePending)
|
6783
|
-
|
6784
|
-
transaction = Braintree::Transaction.cancel_release!(transaction.id)
|
6785
|
-
|
6786
|
-
expect(transaction.escrow_status).to eq(Braintree::Transaction::EscrowStatus::Held)
|
6787
|
-
end
|
6788
|
-
|
6789
|
-
it "raises an error when release cannot be cancelled" do
|
6790
|
-
transaction = create_escrowed_transcation
|
6791
|
-
|
6792
|
-
expect {
|
6793
|
-
transaction = Braintree::Transaction.cancel_release!(transaction.id)
|
6794
|
-
}.to raise_error(Braintree::ValidationsFailed)
|
6795
|
-
end
|
6796
|
-
end
|
6797
|
-
|
6798
6597
|
describe "self.credit" do
|
6799
6598
|
it "returns a successful result with type=credit if successful" do
|
6800
6599
|
result = Braintree::Transaction.credit(
|
@@ -7080,76 +6879,6 @@ describe Braintree::Transaction do
|
|
7080
6879
|
end
|
7081
6880
|
end
|
7082
6881
|
|
7083
|
-
describe "self.hold_in_escrow" do
|
7084
|
-
it "returns the transaction if successful" do
|
7085
|
-
result = Braintree::Transaction.create(
|
7086
|
-
:type => "sale",
|
7087
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
7088
|
-
:merchant_account_id => SpecHelper::NonDefaultSubMerchantAccountId,
|
7089
|
-
:credit_card => {
|
7090
|
-
:number => Braintree::Test::CreditCardNumbers::Visa,
|
7091
|
-
:expiration_date => "12/12",
|
7092
|
-
},
|
7093
|
-
:service_fee_amount => "10.00",
|
7094
|
-
)
|
7095
|
-
|
7096
|
-
expect(result.transaction.escrow_status).to be_nil
|
7097
|
-
result = Braintree::Transaction.hold_in_escrow(result.transaction.id)
|
7098
|
-
|
7099
|
-
expect(result.success?).to be(true)
|
7100
|
-
expect(result.transaction.escrow_status).to eq(Braintree::Transaction::EscrowStatus::HoldPending)
|
7101
|
-
end
|
7102
|
-
|
7103
|
-
it "returns an error result if the transaction cannot be held in escrow" do
|
7104
|
-
transaction = Braintree::Transaction.sale!(
|
7105
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
7106
|
-
:merchant_account_id => SpecHelper::NonDefaultMerchantAccountId,
|
7107
|
-
:credit_card => {
|
7108
|
-
:number => Braintree::Test::CreditCardNumbers::Visa,
|
7109
|
-
:expiration_date => "05/2009"
|
7110
|
-
},
|
7111
|
-
)
|
7112
|
-
|
7113
|
-
result = Braintree::Transaction.hold_in_escrow(transaction.id)
|
7114
|
-
expect(result.errors.for(:transaction).on(:base)[0].code).to eq(Braintree::ErrorCodes::Transaction::CannotHoldInEscrow)
|
7115
|
-
end
|
7116
|
-
end
|
7117
|
-
|
7118
|
-
describe "self.hold_in_escrow!" do
|
7119
|
-
it "returns the transaction if successful" do
|
7120
|
-
result = Braintree::Transaction.create(
|
7121
|
-
:type => "sale",
|
7122
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
7123
|
-
:merchant_account_id => SpecHelper::NonDefaultSubMerchantAccountId,
|
7124
|
-
:credit_card => {
|
7125
|
-
:number => Braintree::Test::CreditCardNumbers::Visa,
|
7126
|
-
:expiration_date => "12/12",
|
7127
|
-
},
|
7128
|
-
:service_fee_amount => "10.00",
|
7129
|
-
)
|
7130
|
-
|
7131
|
-
expect(result.transaction.escrow_status).to be_nil
|
7132
|
-
transaction = Braintree::Transaction.hold_in_escrow!(result.transaction.id)
|
7133
|
-
|
7134
|
-
expect(transaction.escrow_status).to eq(Braintree::Transaction::EscrowStatus::HoldPending)
|
7135
|
-
end
|
7136
|
-
|
7137
|
-
it "raises an error if the transaction cannot be held in escrow" do
|
7138
|
-
transaction = Braintree::Transaction.sale!(
|
7139
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
7140
|
-
:merchant_account_id => SpecHelper::NonDefaultMerchantAccountId,
|
7141
|
-
:credit_card => {
|
7142
|
-
:number => Braintree::Test::CreditCardNumbers::Visa,
|
7143
|
-
:expiration_date => "05/2009"
|
7144
|
-
},
|
7145
|
-
)
|
7146
|
-
|
7147
|
-
expect do
|
7148
|
-
Braintree::Transaction.hold_in_escrow!(transaction.id)
|
7149
|
-
end.to raise_error(Braintree::ValidationsFailed)
|
7150
|
-
end
|
7151
|
-
end
|
7152
|
-
|
7153
6882
|
describe "self.void" do
|
7154
6883
|
it "returns a successful result if successful" do
|
7155
6884
|
transaction = Braintree::Transaction.sale!(
|
@@ -7359,24 +7088,6 @@ describe Braintree::Transaction do
|
|
7359
7088
|
Braintree::Transaction.find(transaction.id)
|
7360
7089
|
end
|
7361
7090
|
|
7362
|
-
def create_escrowed_transcation
|
7363
|
-
transaction = Braintree::Transaction.sale!(
|
7364
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
7365
|
-
:merchant_account_id => SpecHelper::NonDefaultSubMerchantAccountId,
|
7366
|
-
:credit_card => {
|
7367
|
-
:number => Braintree::Test::CreditCardNumbers::Visa,
|
7368
|
-
:expiration_date => "05/2009"
|
7369
|
-
},
|
7370
|
-
:service_fee_amount => "1.00",
|
7371
|
-
:options => {:hold_in_escrow => true},
|
7372
|
-
)
|
7373
|
-
|
7374
|
-
config = Braintree::Configuration.instantiate
|
7375
|
-
config.http.put("#{config.base_merchant_path}/transactions/#{transaction.id}/settle")
|
7376
|
-
config.http.put("#{config.base_merchant_path}/transactions/#{transaction.id}/escrow")
|
7377
|
-
Braintree::Transaction.find(transaction.id)
|
7378
|
-
end
|
7379
|
-
|
7380
7091
|
context "paypal" do
|
7381
7092
|
it "can create a transaction for a paypal account" do
|
7382
7093
|
result = Braintree::Transaction.sale(
|
@@ -8007,4 +7718,4 @@ describe Braintree::Transaction do
|
|
8007
7718
|
expect(result.transaction.status).to eq(Braintree::Transaction::Status::SubmittedForSettlement)
|
8008
7719
|
end
|
8009
7720
|
end
|
8010
|
-
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
|
@@ -266,4 +266,9 @@ describe Braintree::CreditCard do
|
|
266
266
|
end
|
267
267
|
end
|
268
268
|
end
|
269
|
+
|
270
|
+
it "initializes prepaid reloadable correctly" do
|
271
|
+
card = Braintree::CreditCard._new(:gateway, {:prepaid_reloadable => "No"})
|
272
|
+
expect(card.prepaid_reloadable).to eq("No")
|
273
|
+
end
|
269
274
|
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
|
3
|
+
describe Braintree::GooglePayCard do
|
4
|
+
it "initializes prepaid reloadable correctly" do
|
5
|
+
card = Braintree::GooglePayCard._new(:gateway, {:prepaid_reloadable => "No"})
|
6
|
+
expect(card.prepaid_reloadable).to eq("No")
|
7
|
+
end
|
8
|
+
end
|
@@ -1,60 +1,62 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
2
|
|
3
3
|
describe Braintree::MetaCheckoutCard do
|
4
|
-
|
4
|
+
let(:attributes) do {
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
6
|
+
:bin => "abc1234",
|
7
|
+
:card_type => "Visa",
|
8
|
+
:cardholder_name => "Meta Checkout Card CardHolder",
|
9
|
+
:commercial => "NO",
|
10
|
+
:container_id => "a-container-id",
|
11
|
+
:country_of_issuance => "US",
|
12
|
+
:created_at => "2023-05-05T21:28:37Z",
|
13
|
+
:debit => "NO",
|
14
|
+
:durbin_regulated => "NO",
|
15
|
+
:expiration_month => "05",
|
16
|
+
:expiration_year => "2024",
|
17
|
+
:healthcare => "NO",
|
18
|
+
:last_4 => "1234",
|
19
|
+
:payroll => "NO",
|
20
|
+
:prepaid => "NO",
|
21
|
+
:prepaid_reloadable => "NO",
|
22
|
+
:token => "token1",
|
23
|
+
:unique_number_identifier => "abc1234",
|
24
|
+
:updated_at => "2023-05-05T21:28:37Z"
|
25
|
+
}
|
26
|
+
end
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
28
|
+
describe "unit tests" do
|
29
|
+
it "initializes with the correct attributes" do
|
30
|
+
card = Braintree::MetaCheckoutCard._new(:gateway, attributes)
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
32
|
+
card.bin.should == "abc1234"
|
33
|
+
card.card_type.should == "Visa"
|
34
|
+
card.cardholder_name.should == "Meta Checkout Card CardHolder"
|
35
|
+
card.commercial == "NO"
|
36
|
+
card.container_id.should == "a-container-id"
|
37
|
+
card.country_of_issuance == "US"
|
38
|
+
card.created_at == "2023-05-05T21:28:37Z"
|
39
|
+
card.debit == "NO"
|
40
|
+
card.expiration_month.should == "05"
|
41
|
+
card.expiration_year.should == "2024"
|
42
|
+
card.healthcare == "NO"
|
43
|
+
card.last_4.should == "1234"
|
44
|
+
card.payroll == "NO"
|
45
|
+
card.prepaid == "NO"
|
46
|
+
card.prepaid_reloadable == "NO"
|
47
|
+
card.token == "token1"
|
48
|
+
card.unique_number_identifier == "abc1234"
|
49
|
+
card.updated_at == "2023-05-05T21:28:37Z"
|
50
|
+
end
|
49
51
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
52
|
+
it "sets expiration date correctly" do
|
53
|
+
card = Braintree::MetaCheckoutCard._new(:gateway, attributes)
|
54
|
+
card.expiration_date.should == "05/2024"
|
55
|
+
end
|
54
56
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
end
|
57
|
+
it "masks the card number correctly" do
|
58
|
+
card = Braintree::MetaCheckoutCard._new(:gateway, attributes)
|
59
|
+
card.masked_number.should == "abc1234******1234"
|
59
60
|
end
|
60
|
-
end
|
61
|
+
end
|
62
|
+
end
|
@@ -17,6 +17,7 @@ describe Braintree::MetaCheckoutToken do
|
|
17
17
|
:last_4 => "1234",
|
18
18
|
:payroll => "NO",
|
19
19
|
:prepaid => "NO",
|
20
|
+
:prepaid_reloadable => "NO",
|
20
21
|
:token => "token1",
|
21
22
|
:unique_number_identifier => "abc1234",
|
22
23
|
:updated_at => "2023-05-05T21:28:37Z",
|
@@ -40,6 +41,7 @@ describe Braintree::MetaCheckoutToken do
|
|
40
41
|
card.debit == "NO"
|
41
42
|
card.payroll == "NO"
|
42
43
|
card.prepaid == "NO"
|
44
|
+
card.prepaid_reloadable == "NO"
|
43
45
|
card.healthcare == "NO"
|
44
46
|
card.token == "token1"
|
45
47
|
card.unique_number_identifier == "abc1234"
|
@@ -60,4 +62,4 @@ describe Braintree::MetaCheckoutToken do
|
|
60
62
|
card.masked_number.should == "abc1234******1234"
|
61
63
|
end
|
62
64
|
end
|
63
|
-
end
|
65
|
+
end
|
@@ -15,7 +15,8 @@ describe Braintree::PaymentMethodNonce do
|
|
15
15
|
:liability_shifted => false
|
16
16
|
},
|
17
17
|
:bin_data => {
|
18
|
-
:country_of_issuance => "USA"
|
18
|
+
:country_of_issuance => "USA",
|
19
|
+
:prepaid_reloadable => "Yes"
|
19
20
|
},
|
20
21
|
)
|
21
22
|
}
|
@@ -29,6 +30,8 @@ describe Braintree::PaymentMethodNonce do
|
|
29
30
|
expect(payment_method_nonce.three_d_secure_info.liability_shift_possible).to be false
|
30
31
|
expect(payment_method_nonce.three_d_secure_info.liability_shifted).to be false
|
31
32
|
expect(payment_method_nonce.bin_data.country_of_issuance).to eq("USA")
|
33
|
+
expect(payment_method_nonce.bin_data.prepaid_reloadable).to eq("Yes")
|
34
|
+
|
32
35
|
end
|
33
36
|
end
|
34
37
|
|