<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -104,7 +104,11 @@ class CheckoutsController &lt; Spree::BaseController
       end
 
     end
-  end
+
+		#mark checkout as confirmed (if applicable)
+		@checkout.confirmed = (params[:final_answer] == &quot;yes&quot;)
+ 
+   end
 
   update.after do
     @order.save!		# expect messages here</diff>
      <filename>app/controllers/checkouts_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -13,6 +13,7 @@ class Checkout &lt; ActiveRecord::Base
   # for memory-only storage of creditcard details
   attr_accessor :creditcard    
   attr_accessor :coupon_code
+	attr_accessor :confirmed
 
   validates_presence_of :order_id
 
@@ -40,7 +41,7 @@ class Checkout &lt; ActiveRecord::Base
   end
 
   def process_creditcard?
-    order and creditcard and not creditcard[:number].blank?
+    order and creditcard and confirmed and not creditcard[:number].blank?
   end
 
   def process_coupon_code</diff>
      <filename>app/models/checkout.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,6 @@
 Factory.define(:checkout) do |record|
   record.email { Faker::Internet.email }
+	record.confirmed true
   record.special_instructions { Faker::Lorem.paragraphs(rand(5)+1).join(&quot;\n&quot;) }
 
   # associations: </diff>
      <filename>test/factories/checkout_factory.rb</filename>
    </modified>
    <modified>
      <diff>@@ -15,9 +15,8 @@ class CheckoutsControllerTest &lt; ActionController::TestCase
     end
     context &quot;post&quot; do
       setup do
-        @params = { :final_answer =&gt; true, :order_id =&gt; @order.number }
+        @params = { :final_answer =&gt; &quot;yes&quot;, :order_id =&gt; @order.number }
         @shipping_method = Factory(:shipping_method)
-        @params[:final_answer] = true
         @params[:checkout] = {
           :bill_address_attributes =&gt; @address.attributes.symbolize_keys,
           :shipment_attributes =&gt; {</diff>
      <filename>test/functional/checkouts_controller_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -44,6 +44,19 @@ class IncompleteCheckoutTest &lt; ActiveSupport::TestCase
         should_change(&quot;CreditcardTxn.count&quot;, :by =&gt; 1) { CreditcardTxn.count }
         should_change(&quot;@checkout.order.state&quot;, :from =&gt; 'in_progress', :to =&gt; 'paid') { @checkout.order.state }
       end
+      context &quot;save with confirmed = false&quot; do
+        setup do
+          @checkout.confirmed = false
+          @checkout.save
+        end
+	      should_not_change(&quot;Creditcard.count&quot;) { Creditcard.count }
+	      should_not_change(&quot;CreditcardPayment.count&quot;) { CreditcardPayment.count }
+	      should_not_change(&quot;CreditcardTxn.count&quot;) { CreditcardTxn.count }
+	      should_not_change(&quot;@checkout.order.state&quot;) { @checkout.order.state }
+        should 'not require processing' do
+          assert !@checkout.send(:process_creditcard?)
+        end
+       end
     end
     context &quot;save with declineable creditcard&quot; do
       setup do</diff>
      <filename>test/unit/incomplete_checkout_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>86f23cff8c4b6a0666e42f6a6e54f2aec8e702ce</id>
    </parent>
  </parents>
  <author>
    <name>Brian Quinn</name>
    <email>briandquinn@gmail.com</email>
  </author>
  <url>http://github.com/railsdog/spree/commit/72e92dc5faccc836b3f9d53325dd3549675da630</url>
  <id>72e92dc5faccc836b3f9d53325dd3549675da630</id>
  <committed-date>2009-11-01T12:44:14-08:00</committed-date>
  <authored-date>2009-11-01T12:44:14-08:00</authored-date>
  <message>Ensures that checkout doesn't charge creditcard before user Confirms order.

[#860 state:resolved]</message>
  <tree>047afcdbc8f475673681d2f3de0c2f761e4f1624</tree>
  <committer>
    <name>Brian Quinn</name>
    <email>briandquinn@gmail.com</email>
  </committer>
</commit>
