spec/integration/braintree/customer_spec.rb in braintree-4.22.0 vs spec/integration/braintree/customer_spec.rb in braintree-4.23.0
- old
+ new
@@ -618,11 +618,11 @@
result = Braintree::Customer.create(
:payment_method_nonce => nonce,
:credit_card => {
:options => {
:verify_card => true,
- :verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
+ :verification_merchant_account_id => SpecHelper::CardProcessorBRLMerchantAccountId,
:verification_account_type => "debit",
}
},
)
@@ -1229,10 +1229,31 @@
)
expect(result.success?).to eq(false)
expect(result.errors.for(:customer).for(:credit_card).on(:number)[0].message).to eq("Duplicate card exists in the vault.")
end
+ it "does not update customer with duplicate payment method if fail_on_payment_method_for_customer option set" do
+ customer = Braintree::Customer.create!(
+ :credit_card => {
+ :number => 4111111111111111,
+ :expiration_date => "05/2010",
+ },
+ )
+ result = Braintree::Customer.update(
+ customer.id,
+ :credit_card => {
+ :number => 4111111111111111,
+ :expiration_date => "05/2010",
+ :options=> {
+ :fail_on_duplicate_payment_method_for_customer => true
+ }
+ },
+ )
+ expect(result.success?).to eq(false)
+ expect(result.errors.for(:customer).for(:credit_card).on(:number)[0].message).to eq("Duplicate card exists in the vault for the customer.")
+ end
+
it "updates the default payment method" do
customer = Braintree::Customer.create!(
:first_name => "Joe",
:last_name => "Brown",
)
@@ -1662,10 +1683,10 @@
:cvv => "456",
:number => Braintree::Test::CreditCardNumbers::Hiper,
:expiration_date => "06/2013",
:options => {
:verify_card => true,
- :verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
+ :verification_merchant_account_id => SpecHelper::CardProcessorBRLMerchantAccountId,
:verification_account_type => "debit",
},
},
)
expect(update_result).to be_success