<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>config/locales/en-US.yml</filename>
    </added>
    <added>
      <filename>config/routes.rb</filename>
    </added>
    <added>
      <filename>db/migrate/20090128011158_refactor_payments_as_sti.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,11 @@
-1.1
----
+0.5.x
+-----
 
 * `checkout_controller` is obsolete now that Spree has been refactored to use REST.
 * `after_notify` and `after_success` hooks are gone.  See the `README` for how to implement them as hooks in the  &quot;fat&quot; order model.
+
+0.6.x
+-----
+
+* Significant database changes, do not run migrations until you have backed up your payment data.
+* Migrations will not port over your old payments, its suggested you write your own migration to do this in order to preserve legacy payments.
\ No newline at end of file</diff>
      <filename>CHANGELOG.markdown</filename>
    </modified>
    <modified>
      <diff>@@ -23,15 +23,41 @@ Order.class_eval do
   end
 end
 &lt;/pre&gt;  
+        
+# Configuration
 
- * TODO: User account creation (if necessary) after notify and associate order with a user
- * TODO: Make the paypal account stuff configurable via new preferences system
- * TODO: Taxes
- * TODO: Shipping
- * TODO: Refunds
+Be sure to configure the following configuration parameters.  
+
+Example
+
+&lt;pre&gt;
+Spree::Paypal::Config[:account] = &quot;foo@example.com&quot;
+Spree::Paypal::Config[:ipn_notify_host] = &quot;http://123.456.78:3000&quot;
+Spree::Paypal::Config[:success_url] = &quot;http://localhost:3000/checkout/success&quot;
+&lt;/pre&gt;
+
+Or even better, you can configure these in a migration for your site extension.
+
+&lt;pre&gt;
+class AddPaypalStandardConfigurations &lt; ActiveRecord::Migration
+  def self.up
+    Spree::Paypal::Config.set(:account =&gt; &quot;foo@example.com&quot;)
+    Spree::Paypal::Config.set(:ipn_notify_host =&gt; &quot;http://123.456.78:3000&quot;)
+    Spree::Paypal::Config.set(:success_url =&gt; &quot;http://localhost:3000/checkout/success&quot;)
+  end
+
+  def self.down
+  end
+end
+&lt;/pre&gt;
 
 # Installation 
 
 &lt;pre&gt;
 script/extension install git://github.com/Gregg/spree-pp-website-standard.git  
-&lt;/pre&gt;
\ No newline at end of file
+&lt;/pre&gt;
+
+* TODO: User account creation (if necessary) after notify and associate order with a user
+* TODO: Taxes
+* TODO: Shipping
+* TODO: Refunds</diff>
      <filename>README.markdown</filename>
    </modified>
    <modified>
      <diff>@@ -4,7 +4,7 @@ class PaypalPaymentsController &lt; Spree::BaseController
   before_filter :load_object, :only =&gt; :successful
   layout 'application'
   
-  resource_controller :singleton
+  resource_controller
   belongs_to :order
 
   # NOTE: The Paypal Instant Payment Notification (IPN) results in the creation of a PaypalPayment
@@ -56,10 +56,9 @@ class PaypalPaymentsController &lt; Spree::BaseController
   def successful 
     @order.update_attribute(&quot;ip_address&quot;, request.env['REMOTE_ADDR'] || &quot;unknown&quot;)
     # its possible that the IPN has already been received at this point so that
-    unless @order.paypal_payment
+    if @order.paypal_payments.empty?
       # create a payment and record the successful transaction
-      paypal_payment = PaypalPayment.create(:order =&gt; @order, :email =&gt; params[:payer_email], :payer_id =&gt; params[:payer_id])
-      @order.paypal_payment = paypal_payment
+      paypal_payment = @order.paypal_payments.create(:email =&gt; params[:payer_email], :payer_id =&gt; params[:payer_id])
       paypal_payment.txns.create(:amount =&gt; params[:mc_gross].to_d, 
                                  :status =&gt; &quot;Processed&quot;,
                                  :transaction_id =&gt; params[:txn_id],
@@ -67,7 +66,9 @@ class PaypalPaymentsController &lt; Spree::BaseController
                                  :currency_type =&gt; params[:mc_currency],
                                  :received_at =&gt; params[:payment_date])
       # advance the state
-      @order.pend_payment!
+      @order.pend_payment!  
+    else
+      paypal_payment = @order.paypal_payments.last
     end
     
     # remove order from the session (its not really practical to allow the user to edit the session anymore)
@@ -78,7 +79,7 @@ class PaypalPaymentsController &lt; Spree::BaseController
       redirect_to order_url(@order) and return
     else
       flash[:notice] = &quot;Please create an account or login so we can associate this order with an account&quot;
-      session[:return_to] = &quot;#{order_url(@order)}?payer_id=#{@order.paypal_payment.payer_id}&quot;
+      session[:return_to] = &quot;#{order_url(@order)}?payer_id=#{paypal_payment.payer_id}&quot;
       redirect_to signup_path
     end
   end</diff>
      <filename>app/controllers/paypal_payments_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,4 @@
-class PaypalPayment &lt; ActiveRecord::Base
-  has_many :paypal_txns
-  belongs_to :order
-  
+class PaypalPayment &lt; Payment
+  has_many :paypal_txns  
   alias :txns :paypal_txns
 end</diff>
      <filename>app/models/paypal_payment.rb</filename>
    </modified>
    <modified>
      <diff>@@ -20,17 +20,21 @@
 &lt;input id=&quot;cmd&quot; name=&quot;cmd&quot; type=&quot;hidden&quot; value=&quot;_cart&quot; /&gt;
 &lt;input type=&quot;hidden&quot; name=&quot;upload&quot; value=&quot;1&quot; /&gt;
 
-&lt;p&gt; Please select your country &lt;select name=&quot;country&quot; id=&quot;country&quot;&gt;
-&lt;%= country_options_for_select('United States', ['United States']) %&gt;
-&lt;/select&gt;&lt;/p&gt;
-&lt;span style=&quot;color:red; font-weight:bold; display:none;&quot; id=&quot;needZipcode&quot;&gt;Please enter a valid zipcode.&lt;/span&gt;
+&lt;p&gt; &lt;%= t('please_select_your_country') %&gt;
+  &lt;select name=&quot;country&quot; id=&quot;country&quot;&gt;     
+    &lt;%= options_from_collection_for_select(Country.all, :id, :name, 214) %&gt;
+  &lt;/select&gt;
+&lt;/p&gt;
+&lt;span style=&quot;color:red; font-weight:bold; display:none;&quot; id=&quot;needZipcode&quot;&gt;
+  &lt;%= t(&quot;please_enter_valid_zip&quot;) %&gt;
+&lt;/span&gt;
 &lt;p&gt;
-Zipcode (if you have one): &lt;input id=&quot;zip&quot; name=&quot;zip&quot; type=&quot;text&quot; value=&quot;&quot; /&gt;
+&lt;%= t('zip_code_if_you_have_one')%&gt;: &lt;input id=&quot;zip&quot; name=&quot;zip&quot; type=&quot;text&quot; value=&quot;&quot; /&gt;
 &lt;/p&gt;
 
-&lt;input id=&quot;notify_url&quot; name=&quot;notify_url&quot; type=&quot;hidden&quot; value=&quot;&lt;%= Spree::Paypal::Config[:ipn_notify_host] + order_paypal_payment_path(@order) %&gt;&quot; /&gt;
+&lt;input id=&quot;notify_url&quot; name=&quot;notify_url&quot; type=&quot;hidden&quot; value=&quot;&lt;%= Spree::Paypal::Config[:ipn_notify_host] + order_paypal_payments_path(@order) %&gt;&quot; /&gt;
 &lt;input type=&quot;hidden&quot; name=&quot;rm&quot; value =&quot;2&quot;&gt; &lt;!-- tells paypal that the return should be POST instead of GET --&gt;
-&lt;input id=&quot;return&quot; name=&quot;return&quot; type=&quot;hidden&quot; value=&quot;&lt;%= successful_order_paypal_payment_url(@order) %&gt;&quot; /&gt;
+&lt;input id=&quot;return&quot; name=&quot;return&quot; type=&quot;hidden&quot; value=&quot;&lt;%= successful_order_paypal_payments_url(@order) %&gt;&quot; /&gt;
 
 &lt;!-- input id=&quot;address_override&quot; name=&quot;address_override&quot; type=&quot;hidden&quot; value=&quot;0&quot; /&gt;
 &lt;input id=&quot;charset&quot; name=&quot;charset&quot; type=&quot;hidden&quot; value=&quot;utf-8&quot; /&gt;</diff>
      <filename>app/views/orders/_paypal_checkout.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -1,19 +1,19 @@
 &lt;%=error_messages_for :order%&gt;
-&lt;h1&gt;&lt;%= t(&quot;Shopping Cart&quot;)%&gt;&lt;/h1&gt;
+&lt;h1&gt;&lt;%= t(&quot;shopping_cart&quot;)%&gt;&lt;/h1&gt;
 &lt;% form_for(:order, :url =&gt; object_url, :html =&gt; { :method =&gt; :put}) do |f| %&gt;
   &lt;%= render :partial =&gt; 'form', :locals =&gt; {:f =&gt; f} %&gt;
 
 	&lt;div id=&quot;subtotal&quot;&gt;
-		&lt;h3&gt;&lt;%= &quot;#{t(&quot;Subtotal&quot;)}: #{order_price(@order)}&quot; %&gt;&lt;/h3&gt;
-	  &lt;%= submit_tag t('Update') %&gt;
+		&lt;h3&gt;&lt;%= &quot;#{t(&quot;subtotal&quot;)}: #{order_price(@order)}&quot; %&gt;&lt;/h3&gt;
+	  &lt;%= submit_tag t('update') %&gt;
 	&lt;/div&gt;
 	
-	&lt;p&gt;&lt;%=link_to t(&quot;Continue Shopping&quot;), products_path %&gt;&lt;/p&gt;
+	&lt;p&gt;&lt;%=link_to t(&quot;continue_shopping&quot;), products_path %&gt;&lt;/p&gt;
   
 	&lt;% unless @order.line_items.empty? %&gt;
 	  &lt;p id=&quot;clear_cart_link&quot;&gt;
 	    &lt;small&gt;
-	      &lt;%= link_to t(&quot;Empty Cart&quot;), object_url, :method =&gt; :delete  %&gt;
+	      &lt;%= link_to t(&quot;empty_cart&quot;), object_url, :method =&gt; :delete  %&gt;
 	    &lt;/small&gt;
 	  &lt;/p&gt;
 	&lt;% end %&gt;</diff>
      <filename>app/views/orders/edit.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -5,8 +5,8 @@ class PaypalConfiguration &lt; Configuration
   preference :paypal_url, :string, :default =&gt; &quot;https://www.paypal.com/cgi-bin/webscr&quot;
   
   # these are just default preferences of course, you'll need to change them to something meaningful
-  preference :account, :string, :default =&gt; &quot;kevin@schoftech.net&quot;
-  preference :ipn_notify_host, :string, :default =&gt; &quot;http://96.255.82.213:3000&quot;
+  preference :account, :string, :default =&gt; &quot;foo@example.com&quot;
+  preference :ipn_notify_host, :string, :default =&gt; &quot;http://123.456.78:3000&quot;
   preference :success_url, :string, :default =&gt; &quot;http://localhost:3000/checkout/success&quot;
   
   validates_presence_of :name</diff>
      <filename>lib/paypal_configuration.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,25 +1,17 @@
 # Uncomment this if you reference any of your controllers in activate
 require_dependency 'application'
-
+=begin
 unless RAILS_ENV == 'production'
   PAYPAL_ACCOUNT = 'joe@bidness.com'
   ActiveMerchant::Billing::Base.mode = :test
 else
   PAYPAL_ACCOUNT = 'Gregg@railsenvy.com'
 end
-
+=end
 class PpWebsiteStandardExtension &lt; Spree::Extension
-  version &quot;1.1&quot;
+  version &quot;0.6.x&quot;
   description &quot;Describe your extension here&quot;
-  url &quot;http://yourwebsite.com/spree_pp_website_standard&quot;
-
-  define_routes do |map|
-    map.resources :orders do |order|
-      # we're kind of abusing the notion of a restful collection here but we're in the weird position of 
-      # not being able to create the payment before sending the request to paypal
-      order.resource :paypal_payment, :collection =&gt; {:successful =&gt; :post}
-    end  
-  end
+  url &quot;http://github.com/Gregg/spree-pp-website-standard/tree/master&quot;
   
   def activate
 
@@ -38,7 +30,7 @@ class PpWebsiteStandardExtension &lt; Spree::Extension
       private
       def associate_order  
         return unless payer_id = params[:payer_id]
-        orders = Order.find(:all, :include =&gt; :paypal_payment, :conditions =&gt; ['paypal_payments.payer_id = ? AND orders.user_id is null', payer_id])
+        orders = Order.find(:all, :include =&gt; :paypal_payments, :conditions =&gt; ['payments.payer_id = ? AND orders.user_id is null', payer_id])
         orders.each do |order|
           order.update_attribute(&quot;user&quot;, current_user)
         end
@@ -54,17 +46,11 @@ class PpWebsiteStandardExtension &lt; Spree::Extension
     fsm.events[&quot;pend_payment&quot;].transition(:to =&gt; 'payment_pending', :from =&gt; 'in_progress')    
     fsm.after_transition :to =&gt; 'payment_pending', :do =&gt; lambda {|order| order.update_attribute(:checkout_complete, true)}  
 
-    fsm.events[&quot;pay&quot;] = PluginAWeek::StateMachine::Event.new(fsm, &quot;pay&quot;)
     fsm.events[&quot;pay&quot;].transition(:to =&gt; 'paid', :from =&gt; ['payment_pending', 'in_progress'])
-    fsm.after_transition :to =&gt; 'paid', :do =&gt; :complete_order  
-
-    fsm.events[&quot;ship&quot;].transition(:to =&gt; 'shipped', :from =&gt; 'paid')
-    
-    # add a PaypalPayment association to the Order model
+                                  
     Order.class_eval do 
-      has_one :paypal_payment
+      has_many :paypal_payments
     end
-  
   end
   
   def deactivate</diff>
      <filename>pp_website_standard_extension.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>1efe0d2965653e36170fe1be6baa8009a0d0f448</id>
    </parent>
  </parents>
  <author>
    <name>Sean Schofield</name>
    <email>schof@apache.org</email>
  </author>
  <url>http://github.com/Gregg/spree-pp-website-standard/commit/0626b9ca0e8139f47c56f6e2c61d63190da9fe84</url>
  <id>0626b9ca0e8139f47c56f6e2c61d63190da9fe84</id>
  <committed-date>2009-01-27T19:40:44-08:00</committed-date>
  <authored-date>2009-01-27T19:40:44-08:00</authored-date>
  <message>Refactoring to support upcoming Spree 0.6.0 release.  NOTE: More work to be done before this works properly.</message>
  <tree>fe99730aeedb787385cf2e7eed3b784bbfe86632</tree>
  <committer>
    <name>Sean Schofield</name>
    <email>schof@apache.org</email>
  </committer>
</commit>
