spec/integration/braintree/transaction_spec.rb in braintree-1.2.0 vs spec/integration/braintree/transaction_spec.rb in braintree-1.2.1
- old
+ new
@@ -32,11 +32,11 @@
}
)
result.success?.should == true
result.transaction.id.should =~ /^\w{6}$/
result.transaction.type.should == "sale"
- result.transaction.status.should == "processor_declined"
+ result.transaction.status.should == Braintree::Transaction::Status::ProcessorDeclined
result.transaction.processor_response_code.should == "2000"
result.transaction.processor_response_text.should == "Do Not Honor"
end
it "accepts credit card expiration month and expiration year" do
@@ -294,11 +294,11 @@
)
result.success?.should == true
transaction = result.transaction
transaction.id.should =~ /\A\w{6}\z/
transaction.type.should == "sale"
- transaction.status.should == "authorized"
+ transaction.status.should == Braintree::Transaction::Status::Authorized
transaction.amount.should == BigDecimal.new("100.00")
transaction.order_id.should == "123"
transaction.processor_response_code.should == "1000"
transaction.created_at.between?(Time.now - 5, Time.now).should == true
transaction.updated_at.between?(Time.now - 5, Time.now).should == true
@@ -459,11 +459,11 @@
:options => {
:submit_for_settlement => true
}
)
result.success?.should == true
- result.transaction.status.should == "submitted_for_settlement"
+ result.transaction.status.should == Braintree::Transaction::Status::SubmittedForSettlement
end
it "can specify the customer id and payment method token" do
customer_id = "customer_#{rand(1000000)}"
payment_mehtod_token = "credit_card_#{rand(1000000)}"
@@ -561,11 +561,11 @@
)
transaction.amount.should == BigDecimal.new("1000.00")
result = Braintree::Transaction.submit_for_settlement(transaction.id, "999.99")
result.success?.should == true
result.transaction.amount.should == BigDecimal.new("999.99")
- result.transaction.status.should == "submitted_for_settlement"
+ result.transaction.status.should == Braintree::Transaction::Status::SubmittedForSettlement
result.transaction.updated_at.between?(Time.now - 5, Time.now).should == true
end
it "returns an error result if settlement is too large" do
transaction = Braintree::Transaction.sale!(
@@ -604,11 +604,11 @@
:number => Braintree::Test::CreditCardNumbers::Visa,
:expiration_date => "06/2009"
}
)
transaction = Braintree::Transaction.submit_for_settlement!(original_transaction.id)
- transaction.status.should == "submitted_for_settlement"
+ transaction.status.should == Braintree::Transaction::Status::SubmittedForSettlement
transaction.id.should == original_transaction.id
end
it "raises a ValidationsFailed if unsuccessful" do
transaction = Braintree::Transaction.sale!(
@@ -771,11 +771,11 @@
result = Braintree::Transaction.create_from_transparent_redirect(query_string_response)
transaction = result.transaction
transaction.id.should =~ /\A\w{6}\z/
transaction.type.should == "sale"
- transaction.status.should == "authorized"
+ transaction.status.should == Braintree::Transaction::Status::Authorized
transaction.amount.should == BigDecimal.new("100.00")
transaction.order_id.should == "123"
transaction.processor_response_code.should == "1000"
transaction.created_at.between?(Time.now - 60, Time.now).should == true
transaction.updated_at.between?(Time.now - 60, Time.now).should == true
@@ -872,11 +872,11 @@
}
)
result = Braintree::Transaction.void(transaction.id)
result.success?.should == true
result.transaction.id.should == transaction.id
- result.transaction.status.should == "voided"
+ result.transaction.status.should == Braintree::Transaction::Status::Voided
end
it "returns an error result if unsuccessful" do
transaction = Braintree::Transaction.sale!(
:amount => Braintree::Test::TransactionAmounts::Decline,
@@ -900,11 +900,11 @@
:expiration_date => "05/2009"
}
)
returned_transaction = Braintree::Transaction.void!(transaction.id)
returned_transaction.should == transaction
- returned_transaction.status.should == "voided"
+ returned_transaction.status.should == Braintree::Transaction::Status::Voided
end
it "raises a ValidationsFailed if unsuccessful" do
transaction = Braintree::Transaction.sale!(
:amount => Braintree::Test::TransactionAmounts::Decline,
@@ -920,11 +920,11 @@
end
describe "refund" do
it "returns a successful result if successful" do
transaction = create_transaction_to_refund
- transaction.status.should == "settled"
+ transaction.status.should == Braintree::Transaction::Status::Settled
result = transaction.refund
result.success?.should == true
result.new_transaction.type.should == "credit"
end
@@ -989,11 +989,11 @@
)
transaction.amount.should == BigDecimal.new("1000.00")
result = transaction.submit_for_settlement("999.99")
result.success?.should == true
transaction.amount.should == BigDecimal.new("999.99")
- transaction.status.should == "submitted_for_settlement"
+ transaction.status.should == Braintree::Transaction::Status::SubmittedForSettlement
transaction.updated_at.between?(Time.now - 5, Time.now).should == true
end
it "returns an error result if unsuccessful" do
transaction = Braintree::Transaction.sale!(
@@ -1019,11 +1019,11 @@
:number => Braintree::Test::CreditCardNumbers::Visa,
:expiration_date => "06/2009"
}
)
transaction = original_transaction.submit_for_settlement!
- transaction.status.should == "submitted_for_settlement"
+ transaction.status.should == Braintree::Transaction::Status::SubmittedForSettlement
transaction.id.should == original_transaction.id
end
it "raises a ValidationsFailed if unsuccessful" do
transaction = Braintree::Transaction.sale!(
@@ -1147,12 +1147,12 @@
:expiration_date => "05/2009"
}
)
transaction.submit_for_settlement!
transaction.status_history.size.should == 2
- transaction.status_history[0].status.should == "authorized"
- transaction.status_history[1].status.should == "submitted_for_settlement"
+ transaction.status_history[0].status.should == Braintree::Transaction::Status::Authorized
+ transaction.status_history[1].status.should == Braintree::Transaction::Status::SubmittedForSettlement
end
end
describe "vault_credit_card" do
it "returns the Braintree::CreditCard if the transaction credit card is stored in the vault" do
@@ -1214,11 +1214,11 @@
:expiration_date => "05/2009"
}
)
result.success?.should == true
transaction = result.transaction
- transaction.status.should == "authorized"
+ transaction.status.should == Braintree::Transaction::Status::Authorized
void_result = transaction.void
void_result.success?.should == true
void_result.transaction.should == transaction
transaction.status.should == void_result.transaction.status
end
@@ -1229,11 +1229,11 @@
:credit_card => {
:number => Braintree::Test::CreditCardNumbers::Visa,
:expiration_date => "05/2009"
}
)
- transaction.status.should == "processor_declined"
+ transaction.status.should == Braintree::Transaction::Status::ProcessorDeclined
result = transaction.void
result.success?.should == false
result.errors.for(:transaction).on(:base)[0].code.should == Braintree::ErrorCodes::Transaction::CannotBeVoided
end
end
@@ -1246,21 +1246,21 @@
:number => Braintree::Test::CreditCardNumbers::Visa,
:expiration_date => "05/2009"
}
)
transaction.void!.should == transaction
- transaction.status.should == "voided"
+ transaction.status.should == Braintree::Transaction::Status::Voided
end
it "raises a ValidationsFailed if unsuccessful" do
transaction = Braintree::Transaction.sale!(
:amount => Braintree::Test::TransactionAmounts::Decline,
:credit_card => {
:number => Braintree::Test::CreditCardNumbers::Visa,
:expiration_date => "05/2009"
}
)
- transaction.status.should == "processor_declined"
+ transaction.status.should == Braintree::Transaction::Status::ProcessorDeclined
expect do
transaction.void!
end.to raise_error(Braintree::ValidationsFailed)
end
end