spec/integration/braintree/transaction_spec.rb in braintree-2.69.1 vs spec/integration/braintree/transaction_spec.rb in braintree-2.70.0
- old
+ new
@@ -2121,16 +2121,16 @@
result.transaction.id.should =~ /^\w{6,}$/
result.transaction.type.should == "sale"
result.transaction.payment_instrument_type.should == Braintree::PaymentInstrumentType::UsBankAccount
result.transaction.amount.should == BigDecimal.new(Braintree::Test::TransactionAmounts::Authorize)
result.transaction.status.should == Braintree::Transaction::Status::SettlementPending
- result.transaction.us_bank_account_details.routing_number.should == "123456789"
+ result.transaction.us_bank_account_details.routing_number.should == "021000021"
result.transaction.us_bank_account_details.last_4.should == "1234"
result.transaction.us_bank_account_details.account_type.should == "checking"
result.transaction.us_bank_account_details.account_description.should == "PayPal Checking - 1234"
result.transaction.us_bank_account_details.account_holder_name.should == "Dan Schulman"
- result.transaction.us_bank_account_details.bank_name.should == "UNKNOWN"
+ result.transaction.us_bank_account_details.bank_name.should =~ /CHASE/
result.transaction.us_bank_account_details.ach_mandate.text.should == "cl mandate text"
result.transaction.us_bank_account_details.ach_mandate.accepted_at.should be_a Time
end
it "return successful result for vaulting and transacting on vaulted token" do
@@ -2147,16 +2147,16 @@
result.success?.should == true
result.transaction.id.should =~ /^\w{6,}$/
result.transaction.type.should == "sale"
result.transaction.amount.should == BigDecimal.new(Braintree::Test::TransactionAmounts::Authorize)
result.transaction.status.should == Braintree::Transaction::Status::SettlementPending
- result.transaction.us_bank_account_details.routing_number.should == "123456789"
+ result.transaction.us_bank_account_details.routing_number.should == "021000021"
result.transaction.us_bank_account_details.last_4.should == "1234"
result.transaction.us_bank_account_details.account_type.should == "checking"
result.transaction.us_bank_account_details.account_description.should == "PayPal Checking - 1234"
result.transaction.us_bank_account_details.account_holder_name.should == "Dan Schulman"
- result.transaction.us_bank_account_details.bank_name.should == "UNKNOWN"
+ result.transaction.us_bank_account_details.bank_name.should =~ /CHASE/
result.transaction.us_bank_account_details.ach_mandate.text.should == "cl mandate text"
result.transaction.us_bank_account_details.ach_mandate.accepted_at.should be_a Time
result = Braintree::Transaction.create(
:type => "sale",
@@ -2170,16 +2170,16 @@
result.success?.should == true
result.transaction.id.should =~ /^\w{6,}$/
result.transaction.type.should == "sale"
result.transaction.amount.should == BigDecimal.new(Braintree::Test::TransactionAmounts::Authorize)
result.transaction.status.should == Braintree::Transaction::Status::SettlementPending
- result.transaction.us_bank_account_details.routing_number.should == "123456789"
+ result.transaction.us_bank_account_details.routing_number.should == "021000021"
result.transaction.us_bank_account_details.last_4.should == "1234"
result.transaction.us_bank_account_details.account_type.should == "checking"
result.transaction.us_bank_account_details.account_description.should == "PayPal Checking - 1234"
result.transaction.us_bank_account_details.account_holder_name.should == "Dan Schulman"
- result.transaction.us_bank_account_details.bank_name.should == "UNKNOWN"
+ result.transaction.us_bank_account_details.bank_name.should =~ /CHASE/
result.transaction.us_bank_account_details.ach_mandate.text.should == "cl mandate text"
result.transaction.us_bank_account_details.ach_mandate.accepted_at.should be_a Time
end
it "returns failure for token that doesn't exist" do
@@ -2194,10 +2194,57 @@
)
result.success?.should == false
result.errors.for(:transaction).on(:payment_method_nonce)[0].code.should == Braintree::ErrorCodes::Transaction::PaymentMethodNonceUnknown
end
end
+
+ context "ideal payment nonce" do
+ it "returns a successful result for tansacting on an ideal payment nonce" do
+ valid_ideal_payment_id = generate_valid_ideal_payment_nonce
+ result = Braintree::Transaction.create(
+ :type => "sale",
+ :order_id => SpecHelper::DefaultOrderId,
+ :amount => Braintree::Test::TransactionAmounts::Authorize,
+ :merchant_account_id => SpecHelper::IdealMerchantAccountId,
+ :payment_method_nonce => valid_ideal_payment_id,
+ :options => {
+ :submit_for_settlement => true,
+ }
+ )
+ result.success?.should == true
+ result.transaction.id.should =~ /^\w{6,}$/
+ result.transaction.type.should == "sale"
+ result.transaction.payment_instrument_type.should == Braintree::PaymentInstrumentType::IdealPayment
+ result.transaction.amount.should == BigDecimal.new(Braintree::Test::TransactionAmounts::Authorize)
+ result.transaction.status.should == Braintree::Transaction::Status::Settled
+ result.transaction.ideal_payment_details.ideal_payment_id.should =~ /^idealpayment_\w{6,}$/
+ result.transaction.ideal_payment_details.ideal_transaction_id.should =~ /^\d{16,}$/
+ result.transaction.ideal_payment_details.image_url.should start_with("https://")
+ result.transaction.ideal_payment_details.masked_iban.should_not be_empty
+ result.transaction.ideal_payment_details.bic.should_not be_empty
+ end
+
+ it "returns a failure if ideal payment is not complete" do
+ expired_payment_amount = "3.00"
+
+ incomplete_payment_id = generate_valid_ideal_payment_nonce(expired_payment_amount)
+
+ result = Braintree::Transaction.create(
+ :type => "sale",
+ :order_id => SpecHelper::DefaultOrderId,
+ :amount => expired_payment_amount,
+ :merchant_account_id => SpecHelper::IdealMerchantAccountId,
+ :payment_method_nonce => incomplete_payment_id,
+ :options => {
+ :submit_for_settlement => true,
+ }
+ )
+
+ result.success?.should == false
+ result.errors.for(:transaction).on(:ideal_payment)[0].code.should == Braintree::ErrorCodes::Transaction::IdealPaymentNotComplete
+ end
+ end
end
describe "self.create!" do
it "returns the transaction if valid" do
transaction = Braintree::Transaction.create!(
@@ -2649,10 +2696,25 @@
result.success?.should == false
result.params.should == {:transaction => {:type => 'sale', :amount => nil, :credit_card => {:expiration_date => "05/2009"}}}
result.errors.for(:transaction).on(:amount)[0].code.should == Braintree::ErrorCodes::Transaction::AmountIsRequired
end
+ it "skips advanced fraud checking if transaction[options][skip_advanced_fraud_checking] is set to true" do
+ result = Braintree::Transaction.sale(
+ :amount => Braintree::Test::TransactionAmounts::Authorize,
+ :credit_card => {
+ :number => Braintree::Test::CreditCardNumbers::Visa,
+ :expiration_date => "05/2009"
+ },
+ :options => {
+ :skip_advanced_fraud_checking => true
+ }
+ )
+ result.success?.should == true
+ result.transaction.risk_data.id.should be_nil
+ end
+
it "works with Apple Pay params" do
params = {
:amount => "3.12",
:apple_pay_card => {
:number => "370295001292109",
@@ -3935,9 +3997,10 @@
transaction.paypal_details.payer_email.should_not be_nil
transaction.paypal_details.authorization_id.should_not be_nil
transaction.paypal_details.payer_id.should_not be_nil
transaction.paypal_details.payer_first_name.should_not be_nil
transaction.paypal_details.payer_last_name.should_not be_nil
+ transaction.paypal_details.payer_status.should_not be_nil
transaction.paypal_details.seller_protection_status.should_not be_nil
transaction.paypal_details.capture_id.should_not be_nil
transaction.paypal_details.refund_id.should_not be_nil
transaction.paypal_details.transaction_fee_amount.should_not be_nil
transaction.paypal_details.transaction_fee_currency_iso_code.should_not be_nil