spec/integration/braintree/transaction_spec.rb in braintree-2.20.0 vs spec/integration/braintree/transaction_spec.rb in braintree-2.21.0
- old
+ new
@@ -113,10 +113,25 @@
end.to raise_error(Braintree::ValidationsFailed)
end
end
describe "self.create" do
+
+ describe "card type indicators" do
+ it "sets the prepaid field if the card is prepaid" do
+ result = Braintree::Transaction.create(
+ :type => "sale",
+ :amount => 1_00,
+ :credit_card => {
+ :number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::Prepaid,
+ :expiration_date => "05/2009"
+ }
+ )
+ result.transaction.credit_card_details.prepaid.should == Braintree::CreditCard::Prepaid::Yes
+ end
+ end
+
it "returns a successful result if successful" do
result = Braintree::Transaction.create(
:type => "sale",
:amount => Braintree::Test::TransactionAmounts::Authorize,
:credit_card => {
@@ -459,10 +474,10 @@
:payment_method_token => "too long and doesn't belong to customer" * 250
}
}
result = Braintree::Transaction.create(params[:transaction])
result.success?.should == false
- result.errors.for(:transaction).on(:base).map{|error| error.code}.should include(Braintree::ErrorCodes::Transaction::PaymentMethodConflict)
+ result.errors.for(:transaction).on(:base).map{|error| error.code}.should include(Braintree::ErrorCodes::Transaction::PaymentMethodConflictWithVenmoSDK)
result.errors.for(:transaction).on(:base).map{|error| error.code}.should include(Braintree::ErrorCodes::Transaction::PaymentMethodDoesNotBelongToCustomer)
result.errors.for(:transaction).on(:amount)[0].code.should == Braintree::ErrorCodes::Transaction::AmountIsRequired
result.errors.for(:transaction).on(:customer_id)[0].code.should == Braintree::ErrorCodes::Transaction::CustomerIdIsInvalid
result.errors.for(:transaction).on(:order_id)[0].code.should == Braintree::ErrorCodes::Transaction::OrderIdIsTooLong
result.errors.for(:transaction).on(:payment_method_token)[0].code.should == Braintree::ErrorCodes::Transaction::PaymentMethodTokenIsInvalid