spec/integration/braintree/credit_card_spec.rb in braintree-4.0.0 vs spec/integration/braintree/credit_card_spec.rb in braintree-4.1.0

- old
+ new

@@ -155,10 +155,52 @@ expect(verification.risk_data).to respond_to(:fraud_service_provider) expect(verification.risk_data).to respond_to(:transaction_risk_score) end end + it "includes risk data when skip_advanced_fraud_checking is false" do + with_fraud_protection_enterprise_merchant do + customer = Braintree::Customer.create! + result = Braintree::CreditCard.create( + :cardholder_name => "Original Holder", + :customer_id => customer.id, + :cvv => "123", + :number => Braintree::Test::CreditCardNumbers::Visa, + :expiration_date => "05/2020", + :options => { + :skip_advanced_fraud_checking => false, + :verify_card => true, + }, + ) + + expect(result).to be_success + verification = result.credit_card.verification + expect(verification.risk_data).not_to be_nil + end + end + + it "does not include risk data when skip_advanced_fraud_checking is true" do + with_fraud_protection_enterprise_merchant do + customer = Braintree::Customer.create! + result = Braintree::CreditCard.create( + :cardholder_name => "Original Holder", + :customer_id => customer.id, + :cvv => "123", + :number => Braintree::Test::CreditCardNumbers::Visa, + :expiration_date => "05/2020", + :options => { + :skip_advanced_fraud_checking => true, + :verify_card => true, + }, + ) + + expect(result).to be_success + verification = result.credit_card.verification + expect(verification.risk_data).to be_nil + end + end + it "exposes the gateway rejection reason on verification" do old_merchant = Braintree::Configuration.merchant_id old_public_key = Braintree::Configuration.public_key old_private_key = Braintree::Configuration.private_key @@ -850,10 +892,57 @@ }, :options => {:verify_card => true}, ) result.success?.should == true + end + it "includes risk data when skip_advanced_fraud_checking is false" do + with_fraud_protection_enterprise_merchant do + customer = Braintree::Customer.create! + credit_card = Braintree::CreditCard.create!( + :cardholder_name => "Original Holder", + :customer_id => customer.id, + :cvv => "123", + :number => Braintree::Test::CreditCardNumbers::Visa, + :expiration_date => "05/2020", + ) + updated_result = Braintree::CreditCard.update(credit_card.token, + :expiration_date => "05/2021", + :options => { + :verify_card => true, + :skip_advanced_fraud_checking => false, + }, + ) + + expect(updated_result).to be_success + verification = updated_result.credit_card.verification + expect(verification.risk_data).not_to be_nil + end + end + + it "does not include risk data when skip_advanced_fraud_checking is true" do + with_fraud_protection_enterprise_merchant do + customer = Braintree::Customer.create! + credit_card = Braintree::CreditCard.create!( + :cardholder_name => "Original Holder", + :customer_id => customer.id, + :cvv => "123", + :number => Braintree::Test::CreditCardNumbers::Visa, + :expiration_date => "05/2020", + ) + updated_result = Braintree::CreditCard.update(credit_card.token, + :expiration_date => "05/2021", + :options => { + :verify_card => true, + :skip_advanced_fraud_checking => true, + }, + ) + + expect(updated_result).to be_success + verification = updated_result.credit_card.verification + expect(verification.risk_data).to be_nil + end end context "billing address" do it "creates a new billing address by default" do customer = Braintree::Customer.create!