Namespace Updates

This commit is contained in:
John Dyer 2011-11-17 10:53:07 -05:00
parent bea1aa48e0
commit 3a1fcf1771
10 changed files with 20 additions and 20 deletions

View File

@ -30,7 +30,7 @@ class PaypalExpressCallbacksController < Spree::BaseController
private
def retrieve_details
@order = Order.find_by_number(params["invoice"])
@order = Spree::Order.find_by_number(params["invoice"])
if @order
@payment = @order.payments.where(:state => "pending", :source_type => "PaypalAccount").try(:first)

View File

@ -1,4 +1,4 @@
CheckoutController.class_eval do
Spree::CheckoutController.class_eval do
before_filter :redirect_to_paypal_express_form_if_needed, :only => [:update]
def paypal_checkout
@ -74,12 +74,12 @@ CheckoutController.class_eval do
:address1 => ship_address["address1"],
:address2 => ship_address["address2"],
:city => ship_address["city"],
:country => Country.find_by_iso(ship_address["country"]),
:country => Spree::Country.find_by_iso(ship_address["country"]),
:zipcode => ship_address["zip"],
# phone is currently blanked in AM's PPX response lib
:phone => @ppx_details.params["phone"] || "(not given)"
if (state = State.find_by_abbr(ship_address["state"]))
if (state = Spree::State.find_by_abbr(ship_address["state"]))
order_ship_address.state = state
else
order_ship_address.state_name = ship_address["state"]
@ -186,9 +186,9 @@ CheckoutController.class_eval do
@order.process_coupon_code
end
load_order
payment_method = PaymentMethod.find(params[:order][:payments_attributes].first[:payment_method_id])
payment_method = Spree::PaymentMethod.find(params[:order][:payments_attributes].first[:payment_method_id])
if payment_method.kind_of?(BillingIntegration::PaypalExpress) || payment_method.kind_of?(BillingIntegration::PaypalExpressUk)
if payment_method.kind_of?(Spree::BillingIntegration::PaypalExpress) || payment_method.kind_of?(Spree::BillingIntegration::PaypalExpressUk)
redirect_to paypal_payment_order_checkout_url(@order, :payment_method_id => payment_method)
end
end
@ -264,7 +264,7 @@ CheckoutController.class_eval do
:tax => ((order.adjustments.map { |a| a.amount if ( a.source_type == 'Order' && a.label == 'Tax') }.compact.sum) * 100 ).to_i,
:shipping => ((order.adjustments.map { |a| a.amount if a.source_type == 'Shipment' }.compact.sum) * 100 ).to_i,
:money => (order.total * 100 ).to_i }
# add correct tax amount by subtracting subtotal and shipping otherwise tax = 0 -> need to check adjustments.map
opts[:tax] = (order.total*100).to_i - opts.slice(:subtotal, :shipping).values.sum
@ -357,7 +357,7 @@ CheckoutController.class_eval do
# create the gateway from the supplied options
def payment_method
PaymentMethod.find(params[:payment_method_id])
Spree::PaymentMethod.find(params[:payment_method_id])
end
def paypal_gateway

View File

@ -1,4 +1,4 @@
class BillingIntegration::PaypalExpress < BillingIntegration
class Spree::BillingIntegration::PaypalExpress < Spree::BillingIntegration
preference :login, :string
preference :password, :password
preference :signature, :string

View File

@ -1,4 +1,4 @@
class BillingIntegration::PaypalExpressUk < BillingIntegration
class Spree::BillingIntegration::PaypalExpressUk < Spree::BillingIntegration
preference :login, :string
preference :password, :password
preference :signature, :string

View File

@ -1,3 +0,0 @@
<a href="<%= paypal_payment_order_checkout_url @order, :payment_method_id => payment_method %>" style="text-align: center;">
<img src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" align="left" style="margin-right:7px;"/>
</a>

View File

@ -1,3 +1,3 @@
<a href="<%= paypal_checkout_orders_checkout_url @checkout.order, :integration_id => integration %>" style="text-align: center;">
<a href="<%= main_app.paypal_checkout_orders_checkout_url @checkout.order, :integration_id => integration %>" style="text-align: center;">
<img src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" align="left" style="margin-right:7px;"/>
</a>

View File

@ -5,6 +5,6 @@
<%= render :partial => 'shared/order_details', :locals => {:order => @order} -%>
<div class="form-buttons">
<%= button_to t('place_order'), paypal_finish_order_checkout_url(@order, {:token => params[:token] , :PayerID => params[:PayerID], :payment_method_id =>
<%= button_to t('place_order'), main_app.paypal_finish_order_checkout_url(@order, {:token => params[:token] , :PayerID => params[:PayerID], :payment_method_id =>
params[:payment_method_id] } ), :class => "button primary" %>
</div>

View File

@ -0,0 +1,3 @@
<a href="<%= main_app.paypal_payment_order_checkout_url @order, :payment_method_id => payment_method %>" style="text-align: center;">
<img src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" align="left" style="margin-right:7px;"/>
</a>

View File

@ -14,8 +14,8 @@ module SpreePaypalExpress
initializer "spree_paypal_express.register.payment_methods" do |app|
app.config.spree.payment_methods += [
BillingIntegration::PaypalExpress,
BillingIntegration::PaypalExpressUk
Spree::BillingIntegration::PaypalExpress,
Spree::BillingIntegration::PaypalExpressUk
]
end

View File

@ -11,7 +11,7 @@ namespace :spree_paypal_express do
source = File.join(File.dirname(__FILE__), '..', '..', 'db')
destination = File.join(Rails.root, 'db')
puts "INFO: Mirroring assets from #{source} to #{destination}"
Spree::FileUtilz.mirror_files(source, destination)
Spree::Core::FileUtilz.mirror_files(source, destination)
end
desc "Copies all assets (NOTE: This will be obsolete with Rails 3.1)"
@ -19,8 +19,8 @@ namespace :spree_paypal_express do
source = File.join(File.dirname(__FILE__), '..', '..', 'public')
destination = File.join(Rails.root, 'public')
puts "INFO: Mirroring assets from #{source} to #{destination}"
Spree::FileUtilz.mirror_files(source, destination)
Spree::Core::FileUtilz.mirror_files(source, destination)
end
end
end
end