diff --git a/app/models/spree/billing_integration/skrill/quick_checkout.rb b/app/models/spree/billing_integration/skrill/quick_checkout.rb deleted file mode 100644 index 21d81b22..00000000 --- a/app/models/spree/billing_integration/skrill/quick_checkout.rb +++ /dev/null @@ -1,48 +0,0 @@ -module Spree - class BillingIntegration::Skrill::QuickCheckout < BillingIntegration - preference :merchant_id, :string - preference :language, :string, :default => 'EN' - preference :currency, :string, :default => 'EUR' - preference :payment_options, :string, :default => 'ACC' - preference :pay_to_email, :string , :default => 'your@merchant.email_here' - - def provider_class - ActiveMerchant::Billing::Skrill - end - - def redirect_url(order, opts = {}) - opts.merge! self.preferences - - set_global_options(opts) - - opts[:detail1_text] = order.number - opts[:detail1_description] = "Order:" - - opts[:pay_from_email] = order.email - opts[:firstname] = order.bill_address.firstname - opts[:lastname] = order.bill_address.lastname - opts[:address] = order.bill_address.address1 - opts[:address2] = order.bill_address.address2 - opts[:phone_number] = order.bill_address.phone.gsub(/\D/,'') if order.bill_address.phone - opts[:city] = order.bill_address.city - opts[:postal_code] = order.bill_address.zipcode - opts[:state] = order.bill_address.state.nil? ? order.bill_address.state_name.to_s : order.bill_address.state.abbr - opts[:country] = order.bill_address.country.name - opts[:pay_to_email] = self.preferred_pay_to_email - opts[:hide_login] = 1 - opts[:merchant_fields] = 'platform,order_id,payment_method_id' - opts[:platform] = 'Spree' - opts[:order_id] = order.number - - skrill = self.provider - skrill.payment_url(opts) - end - - private - def set_global_options(opts) - opts[:recipient_description] = Spree::Config[:site_name] - opts[:payment_methods] = self.preferred_payment_options - end - - end -end diff --git a/app/models/spree/skrill_transaction.rb b/app/models/spree/skrill_transaction.rb deleted file mode 100644 index 0dbcb275..00000000 --- a/app/models/spree/skrill_transaction.rb +++ /dev/null @@ -1,19 +0,0 @@ -module Spree - class SkrillTransaction < ActiveRecord::Base - has_many :payments, :as => :source - - def actions - [] - end - - def self.create_from_postback(params) - SkrillTransaction.create(:email => params[:pay_from_email], - :amount => params[:mb_amount], - :currency => params[:mb_currency], - :transaction_id => params[:mb_transaction_id], - :customer_id => params[:customer_id], - :payment_type => params[:payment_type]) - end - - end -end diff --git a/config/locales/bg.yml b/config/locales/bg.yml index b994f3d7..d59fc116 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -2,10 +2,3 @@ bg: spree: payment_has_been_cancelled: Плащането беше прекъснато. - complete_skrill_checkout: Моля довършете Вашето плащане със Skrill преди да продължите - skrill: Skrill - skrill_transaction: Транзакция - skrill_customer_id: Клиентски номер - skrill_transaction_id: Номер на транкцията - skrill_payment_type: Вид на плащане - skrill_payment_currency: Валута diff --git a/config/locales/de.yml b/config/locales/de.yml index 0ed761c0..eabc01c0 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -2,10 +2,3 @@ de: spree: payment_has_been_cancelled: Die Zahlung wurde abgebrochen. - complete_skrill_checkout: Bitte schliessen Sie die Skrill-Zahlung ab - skrill: Skrill - skrill_transaction: Transaktion - skrill_customer_id: Kunden ID - skrill_transaction_id: Transaktions ID - skrill_payment_type: Bezahlart - skrill_payment_currency: Währung diff --git a/config/locales/en.yml b/config/locales/en.yml index 20c9706f..cf7bed4f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2,13 +2,6 @@ en: spree: payment_has_been_cancelled: The payment has been cancelled. - complete_skrill_checkout: Please complete Skrill checkout before continuing - skrill: Skrill - skrill_transaction: Transaction - skrill_customer_id: Customer ID - skrill_transaction_id: Transaction ID - skrill_payment_type: Payment Type - skrill_payment_currency: Payment Currency log_entry: braintree: message: Message diff --git a/config/locales/sv.yml b/config/locales/sv.yml index b8798477..02e4dcd4 100644 --- a/config/locales/sv.yml +++ b/config/locales/sv.yml @@ -2,10 +2,3 @@ sv: spree: payment_has_been_cancelled: Betalningen har avbrutits. - complete_skrill_checkout: Var god fyll i Skrill kassan innan du fortsätter - skrill: Skrill - skrill_transaction: Transaktion - skrill_customer_id: Kund ID - skrill_transaction_id: Transaktion ID - skrill_payment_type: Betalningstyp - skrill_payment_currency: Betalningsvaluta diff --git a/config/routes.rb b/config/routes.rb deleted file mode 100644 index d6c64c37..00000000 --- a/config/routes.rb +++ /dev/null @@ -1,13 +0,0 @@ -Spree::Core::Engine.add_routes do - # Add your extension routes here - resources :orders, :only => [] do - resource :checkout, :controller => 'checkout' do - member do - get :skrill_cancel - get :skrill_return - end - end - end - - post '/skrill' => 'skrill_status#update' -end diff --git a/db/migrate/20111118164631_create_skrill_transactions.rb b/db/migrate/20111118164631_create_skrill_transactions.rb deleted file mode 100644 index baf43be0..00000000 --- a/db/migrate/20111118164631_create_skrill_transactions.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreateSkrillTransactions < SpreeExtension::Migration[4.2] - def change - create_table :spree_skrill_transactions do |t| - t.string :email - t.float :amount - t.string :currency - t.integer :transaction_id - t.integer :customer_id - t.string :payment_type - t.timestamps null: true - end - end -end diff --git a/lib/active_merchant/billing/skrill.rb b/lib/active_merchant/billing/skrill.rb deleted file mode 100644 index 7acda15f..00000000 --- a/lib/active_merchant/billing/skrill.rb +++ /dev/null @@ -1,18 +0,0 @@ -module ActiveMerchant #:nodoc: - module Billing #:nodoc: - class Skrill < Gateway - - def service_url - "https://www.moneybookers.com/app/payment.pl" - end - - def payment_url(opts) - post = PostData.new - post.merge! opts - - "#{service_url}?#{post.to_s}" - end - - end - end -end diff --git a/lib/controllers/frontend/spree/checkout_controller_decorator.rb b/lib/controllers/frontend/spree/checkout_controller_decorator.rb deleted file mode 100644 index 2e9eea5b..00000000 --- a/lib/controllers/frontend/spree/checkout_controller_decorator.rb +++ /dev/null @@ -1,51 +0,0 @@ -module Spree - CheckoutController.class_eval do - before_action :confirm_skrill, :only => [:update] - - def skrill_return - - unless @order.payments.where(:source_type => 'Spree::SkrillTransaction').present? - payment_method = PaymentMethod.find(params[:payment_method_id]) - skrill_transaction = SkrillTransaction.new - - payment = @order.payments.create({:amount => @order.total, - :source => skrill_transaction, - :payment_method => payment_method}, - :without_protection => true) - payment.started_processing! - payment.pend! - end - - @order.update_attributes({:state => "complete", :completed_at => Time.now}, :without_protection => true) - - until @order.state == "complete" - if @order.next! - @order.update_with_updater! - state_callback(:after) - end - end - - @order.finalize! - - flash.notice = Spree.t(:order_processed_successfully) - redirect_to completion_route - end - - def skrill_cancel - flash[:error] = Spree.t(:payment_has_been_cancelled) - redirect_to edit_order_path(@order) - end - - private - def confirm_skrill - return unless (params[:state] == "payment") && params[:order] && params[:order][:payments_attributes] - - payment_method = PaymentMethod.find(params[:order][:payments_attributes].first[:payment_method_id]) - if payment_method.kind_of?(BillingIntegration::Skrill::QuickCheckout) - #TODO confirming payment method - redirect_to edit_order_checkout_url(@order, :state => 'payment'), - :notice => Spree.t(:complete_skrill_checkout) - end - end - end -end diff --git a/lib/controllers/frontend/spree/skrill_status_controller.rb b/lib/controllers/frontend/spree/skrill_status_controller.rb deleted file mode 100644 index 60295d2c..00000000 --- a/lib/controllers/frontend/spree/skrill_status_controller.rb +++ /dev/null @@ -1,39 +0,0 @@ -module Spree - class SkrillStatusController < ApplicationController - def update - @order = Order.find_by_number!(params[:order_id]) - payment_method = PaymentMethod.find(params[:payment_method_id]) - skrill_transaction = SkrillTransaction.create_from_postback params - - payment = @order.payments.where(:state => "pending", - :payment_method_id => payment_method).first - - if payment - payment.source = skrill_transaction - payment.save - else - payment = @order.payments.create(:amount => @order.total, - :source => skrill_transaction, - :payment_method => payment_method) - end - - payment.started_processing! - - unless payment.completed? - case params[:status] - when "0" - payment.pend #may already be pending - when "2" #processed / captured - payment.complete! - when "-1", "-2" - payment.failure! - else - raise "Unexpected payment status" - end - end - - render :text => "" - end - - end -end diff --git a/lib/spree_gateway/engine.rb b/lib/spree_gateway/engine.rb index 3f0531a3..22455b82 100644 --- a/lib/spree_gateway/engine.rb +++ b/lib/spree_gateway/engine.rb @@ -5,7 +5,6 @@ class Engine < Rails::Engine config.autoload_paths += %W(#{config.root}/lib) initializer "spree.gateway.payment_methods", :after => "spree.register.payment_methods" do |app| - app.config.spree.payment_methods << Spree::BillingIntegration::Skrill::QuickCheckout app.config.spree.payment_methods << Spree::Gateway::AuthorizeNet app.config.spree.payment_methods << Spree::Gateway::AuthorizeNetCim app.config.spree.payment_methods << Spree::Gateway::BalancedGateway diff --git a/lib/views/backend/spree/admin/payments/source_views/_quickcheckout.html.erb b/lib/views/backend/spree/admin/payments/source_views/_quickcheckout.html.erb deleted file mode 100644 index f6cd94ac..00000000 --- a/lib/views/backend/spree/admin/payments/source_views/_quickcheckout.html.erb +++ /dev/null @@ -1,39 +0,0 @@ -
- <%= Spree.t(:skrill) %> - - - - - - - - - - - - - - - - - - - - - - - - - -
<%= Spree.t(:skrill_transaction) %>
- <%= payment.source.email %> -
- <%= payment.source.customer_id %> -
- <%= payment.source.transaction_id %> -
- <%= payment.source.payment_type %> -
- <%= payment.source.currency %> -
-
diff --git a/lib/views/frontend/spree/checkout/payment/_quickcheckout.html.erb b/lib/views/frontend/spree/checkout/payment/_quickcheckout.html.erb deleted file mode 100644 index d75064b2..00000000 --- a/lib/views/frontend/spree/checkout/payment/_quickcheckout.html.erb +++ /dev/null @@ -1,26 +0,0 @@ -

- -<% -opts = {} -opts[:transaction_id] = "#{@order.number}" -opts[:amount] = @order.total -opts[:return_url] = skrill_return_order_checkout_url(@order, :token => @order.guest_token, - :payment_method_id => payment_method.id) -opts[:cancel_url] = skrill_cancel_order_checkout_url(@order, :token => @order.guest_token) -opts[:status_url] = skrill_url -opts[:payment_method_id] = payment_method.id -%> - - - -
- <%= Spree.t(:payment_information) %> - -
diff --git a/spec/controllers/spree/checkout_controller_spec.rb b/spec/controllers/spree/checkout_controller_spec.rb deleted file mode 100644 index e9831292..00000000 --- a/spec/controllers/spree/checkout_controller_spec.rb +++ /dev/null @@ -1,13 +0,0 @@ -require 'spec_helper' - -describe Spree::CheckoutController do - context '#skrill_return' do - specify do - end - end - - context '#skrill_cancel' do - specify do - end - end -end diff --git a/spec/controllers/spree/skrill_status_controller_spec.rb b/spec/controllers/spree/skrill_status_controller_spec.rb deleted file mode 100644 index 039e96b9..00000000 --- a/spec/controllers/spree/skrill_status_controller_spec.rb +++ /dev/null @@ -1,8 +0,0 @@ -require 'spec_helper' - -describe Spree::SkrillStatusController do - context '#update' do - specify do - end - end -end \ No newline at end of file diff --git a/spec/factories/payment_method_factory.rb b/spec/factories/payment_method_factory.rb deleted file mode 100644 index fe0c0678..00000000 --- a/spec/factories/payment_method_factory.rb +++ /dev/null @@ -1,5 +0,0 @@ -FactoryGirl.define do - factory :skrill_quick_checkout, class: Spree::BillingIntegration::Skrill::QuickCheckout do - name 'Skrill - Quick Checkout' - end -end diff --git a/spec/factories/skrill_transaction_factory.rb b/spec/factories/skrill_transaction_factory.rb deleted file mode 100644 index 18733950..00000000 --- a/spec/factories/skrill_transaction_factory.rb +++ /dev/null @@ -1,10 +0,0 @@ -FactoryGirl.define do - factory :skrill_transaction, class: Spree::SkrillTransaction do - email '' - amount 0.0 - currency 'USD' - transaction_id nil - customer_id nil - payment_type nil - end -end \ No newline at end of file diff --git a/spec/lib/active_merchant/billing_skrill_spec.rb b/spec/lib/active_merchant/billing_skrill_spec.rb deleted file mode 100644 index 2ec298c0..00000000 --- a/spec/lib/active_merchant/billing_skrill_spec.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'spec_helper' - -describe ActiveMerchant::Billing::Skrill do - let(:url) { 'https://www.moneybookers.com/app/payment.pl' } - - context '.service_url' do - it 'return its url' do - expect(subject.service_url).to eq url - end - end - - context '.payment_url' do - it 'prepend options to url' do - options = { 'hi' => 'you' } - expect(subject.payment_url(options)).to eq "#{url}?hi=you" - end - end -end \ No newline at end of file diff --git a/spec/models/billing_integration/skrill_quick_checkout_spec.rb b/spec/models/billing_integration/skrill_quick_checkout_spec.rb deleted file mode 100644 index 02f219f1..00000000 --- a/spec/models/billing_integration/skrill_quick_checkout_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'spec_helper' - -describe Spree::BillingIntegration::Skrill::QuickCheckout, focus: true do - let(:quick_checkout) { create(:skrill_quick_checkout) } - - context '.provider_class' do - it 'is a Billing::Skrill class' do - expect(quick_checkout.provider_class).to eq ::ActiveMerchant::Billing::Skrill - end - end -end \ No newline at end of file diff --git a/spec/models/skrill_transaction_spec.rb b/spec/models/skrill_transaction_spec.rb deleted file mode 100644 index 97b08867..00000000 --- a/spec/models/skrill_transaction_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'spec_helper' - -describe Spree::SkrillTransaction do - let(:skrill_transaction) { create(:skrill_transaction) } - - context '.actions' do - it { expect(subject.actions).to match_array([]) } - end -end \ No newline at end of file diff --git a/spree_gateway.gemspec b/spree_gateway.gemspec index 2f681ebc..98ef502d 100644 --- a/spree_gateway.gemspec +++ b/spree_gateway.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'spree_gateway' - s.version = '3.3.0.rc2' + s.version = '3.3.0' s.summary = 'Additional Payment Gateways for Spree Commerce' s.description = s.summary