Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Checkout Finland #2406

Merged
merged 13 commits into from Aug 17, 2016
18 changes: 0 additions & 18 deletions app/assets/javascripts/kassi.js
Expand Up @@ -263,24 +263,6 @@ function initialize_login_form(password_forgotten) {
$('#login_form input.text_field:first').focus();
}

function initialize_payments_form(locale) {
var form_id = "#payment_settings_form";
$(form_id).validate({
rules: {
// regex validation here kept failing always, so relying on backend validation for the ID
"checkout_account_form[company_id_or_personal_id]": {required: true, minlength: 9, maxlength: 11},
"checkout_account_form[phone_number]": {required: true, maxlength: 25},
"checkout_account_form[organization_address]": {required: true, minlength: 6}
},
messages: {
},
onkeyup: false, //Only do validations when form focus changes
submitHandler: function(form) {
disable_and_submit(form_id, form, "false", locale);
}
});
}

function initialize_braintree_account_form(locale) {
var form_id = "#braintree_account_form";
$(form_id).validate({
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/admin/listing_shapes_controller.rb
@@ -1,7 +1,7 @@
class Admin::ListingShapesController < ApplicationController
before_filter :ensure_is_admin

before_filter :ensure_no_braintree_or_checkout
before_filter :ensure_no_braintree
before_filter :set_url_name

LISTING_SHAPES_NAVI_LINK = "listing_shapes"
Expand Down Expand Up @@ -320,7 +320,7 @@ def pick_translation(translations)
}.second
end

def ensure_no_braintree_or_checkout
def ensure_no_braintree
gw = PaymentGateway.where(community_id: @current_community.id).first
if !@current_user.is_admin? && gw
flash[:error] = "Not available for your payment gateway: #{gw.type}"
Expand Down
40 changes: 0 additions & 40 deletions app/controllers/checkout_accounts_controller.rb

This file was deleted.

26 changes: 0 additions & 26 deletions app/controllers/payments_controller.rb
Expand Up @@ -26,32 +26,6 @@ def new
end
end

def choose_method

end

def done
@payment = Payment.find(params[:id])
@payment_gateway = @current_community.payment_gateway

check = @payment_gateway.check_payment(@payment, { :params => params, :mock =>@current_community.settings["mock_cf_payments"]})

if check.nil? || check[:status].blank?
flash[:error] = t("layouts.notifications.error_in_payment")
elsif check[:status] == "paid"
@payment.paid!
MarketplaceService::Transaction::Command.transition_to(@payment.tx.id, "paid")
@payment_gateway.handle_paid_payment(@payment)
flash[:notice] = check[:notice]
else # not yet paid
flash[:notice] = check[:notice]
flash[:warning] = check[:warning]
flash[:error] = check[:error]
end

redirect_to person_transaction_path(:id => params[:message_id])
end

private

def payment_can_be_conducted
Expand Down
6 changes: 1 addition & 5 deletions app/helpers/application_helper.rb
Expand Up @@ -429,7 +429,7 @@ def admin_links_for(community)
}
]

# Disabled for Braintree and Checkout
# Disabled for Braintree
gw = PaymentGateway.where(community_id: @current_community.id).first
unless gw
links << {
Expand Down Expand Up @@ -551,8 +551,6 @@ def settings_links_for(person, community=nil)
def payment_settings_path(gateway_type, person)
if gateway_type == :braintree
show_braintree_settings_payment_path(person)
elsif gateway_type == :checkout
person_checkout_account_path(person)
elsif gateway_type == :paypal
paypal_account_settings_payment_path(person)
end
Expand All @@ -561,8 +559,6 @@ def payment_settings_path(gateway_type, person)
def payment_settings_url(gateway_type, person, url_params)
if gateway_type == :braintree
show_braintree_settings_payment_url(person, url_params.merge(locale: person.locale))
elsif gateway_type == :checkout
person_checkout_account_url(person, url_params.merge(locale: person.locale))
elsif gateway_type == :paypal
paypal_account_settings_payment_url(person, url_params.merge(locale: person.locale))
end
Expand Down
13 changes: 0 additions & 13 deletions app/jobs/send_payment_receipts.rb
Expand Up @@ -19,15 +19,6 @@ def perform
receipts << TransactionMailer.braintree_receipt_to_payer(payment, community)
receipts

when :checkout
community = Community.find(transaction[:community_id])
payment = checkout_payment_for(transaction_id)

receipts = []
receipts << PersonMailer.new_payment(payment, community) if receipt_to_seller
receipts << PersonMailer.receipt_to_payer(payment, community)
receipts

when :paypal
community = Community.find(transaction[:community_id])

Expand Down Expand Up @@ -57,8 +48,4 @@ def braintree_payment_for(transaction_id)
BraintreePayment.where(transaction_id: transaction_id).first
end

def checkout_payment_for(transaction_id)
CheckoutPayment.where(transaction_id: transaction_id).first
end

end
8 changes: 0 additions & 8 deletions app/mailers/mail_preview.rb
Expand Up @@ -3,10 +3,6 @@
class MailPreview < MailView
include MailViewTestData

def new_payment
PersonMailer.new_payment(checkout_payment, checkout_community)
end

def payment_settings_reminder
PersonMailer.payment_settings_reminder(listing, member, community)
end
Expand All @@ -15,10 +11,6 @@ def payment_reminder
PersonMailer.payment_reminder(conversation, member, community)
end

def receipt_to_payer
PersonMailer.receipt_to_payer(checkout_payment, checkout_community)
end

def braintree_receipt_to_payer
TransactionMailer.braintree_receipt_to_payer(payment, community)
end
Expand Down
28 changes: 0 additions & 28 deletions app/mailers/mail_view_test_data.rb
Expand Up @@ -41,10 +41,6 @@ def payment_gateway
@braintree_payment_gateway ||= FactoryGirl.build(:braintree_payment_gateway)
end

def checkout_payment_gateway
@checkout_payment_gateway ||= FactoryGirl.build(:checkout_payment_gateway)
end

def payment
return @payment unless @payment.nil?
@payment ||= FactoryGirl.build(:braintree_payment,
Expand All @@ -60,20 +56,6 @@ def payment
@payment
end

def checkout_payment
return @checkout_payment unless @checkout_payment.nil?
@checkout_payment ||= FactoryGirl.build(:checkout_payment,
id: 55,
payment_gateway: checkout_payment_gateway,
payer: starter,
recipient: author
)

# Avoid infinite loop, set conversation here
@checkout_payment.conversation = conversation
@checkout_payment
end

def listing
@listing ||= FactoryGirl.build(:listing,
author: author,
Expand Down Expand Up @@ -145,14 +127,4 @@ def community
community_memberships: community_memberships
)
end

def checkout_community
@checkout_community ||= FactoryGirl.build(:community,
payment_gateway: checkout_payment_gateway,
custom_color1: "FF0099",
admins: [admin],
members: members,
community_memberships: community_memberships
)
end
end
24 changes: 0 additions & 24 deletions app/mailers/person_mailer.rb
Expand Up @@ -49,30 +49,6 @@ def new_message_notification(message, community)
end
end

def new_payment(payment, community)
@email_type = "email_about_new_payments"
@payment = payment
recipient = @payment.recipient
set_up_layout_variables(recipient, community, @email_type)
with_locale(recipient.locale, community.locales.map(&:to_sym), community.id) do
premailer_mail(:to => recipient.confirmed_notification_emails_to,
:from => community_specific_sender(community),
:subject => t("emails.new_payment.new_payment"))
end
end

def receipt_to_payer(payment, community)
@email_type = "email_about_new_payments"
@payment = payment
recipient = @payment.payer
set_up_layout_variables(recipient, community, @email_type)
with_locale(recipient.locale, community.locales.map(&:to_sym), community.id) do
premailer_mail(:to => recipient.confirmed_notification_emails_to,
:from => community_specific_sender(community),
:subject => t("emails.receipt_to_payer.receipt_of_payment"))
end
end

def transaction_confirmed(conversation, community)
@email_type = "email_about_completed_transactions"
@conversation = conversation
Expand Down
2 changes: 1 addition & 1 deletion app/models/braintree_payment.rb
Expand Up @@ -14,7 +14,7 @@
# payment_gateway_id :integer
# sum_cents :integer
# currency :string(255)
# type :string(255) default("CheckoutPayment")
# type :string(255) default("BraintreePayment")
# braintree_transaction_id :string(255)
#
# Indexes
Expand Down
17 changes: 0 additions & 17 deletions app/models/checkout_account.rb

This file was deleted.

56 changes: 0 additions & 56 deletions app/models/checkout_payment.rb

This file was deleted.

2 changes: 1 addition & 1 deletion app/models/community.rb
Expand Up @@ -606,7 +606,7 @@ def absolute_minimum_price(currency)
end

def invoice_form_type_for(listing)
payment_possible_for?(listing) && payments_in_use? ? payment_gateway.invoice_form_type : "no_form"
payment_possible_for?(listing) && payments_in_use? ? "simple" : "no_form"
end

def email_notification_types
Expand Down
2 changes: 1 addition & 1 deletion app/models/community_membership.rb
Expand Up @@ -3,7 +3,7 @@
# Table name: community_memberships
#
# id :integer not null, primary key
# person_id :string(255) default(""), not null
# person_id :string(255) not null
# community_id :integer not null
# admin :boolean default(FALSE)
# created_at :datetime
Expand Down
2 changes: 1 addition & 1 deletion app/models/payment.rb
Expand Up @@ -14,7 +14,7 @@
# payment_gateway_id :integer
# sum_cents :integer
# currency :string(255)
# type :string(255) default("CheckoutPayment")
# type :string(255) default("BraintreePayment")
# braintree_transaction_id :string(255)
#
# Indexes
Expand Down