Skip to content

Commit

Permalink
enable early payment discount on invoice, add preferred name to contacts
Browse files Browse the repository at this point in the history
  • Loading branch information
reubenjs committed Apr 28, 2014
1 parent ff3a236 commit 814d3bd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
1 change: 1 addition & 0 deletions app/controllers/entities/contacts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def myc_webhooks

contact.update_attributes(
:first_name => params[:first_name],
:preferred_name => params[:preferred_name],
:last_name => params[:last_name],
:email => params[:email],
:cf_gender => params[:gender],
Expand Down
16 changes: 8 additions & 8 deletions app/models/observers/registration_observer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,14 @@ def calculate_invoice_items(registration)

invoice_items << fee

# if registration.payment_method != "PayPal"
# discount = Saasu::ServiceInvoiceItem.new
# discount.description = "Online payment discount (if paid before 19th July)"
# discount.account_uid = Setting.saasu[:myc_income_account]
# discount.total_amount_incl_tax = -5
#
# i.invoice_items << discount
# end
if registration.payment_method != "PayPal"
discount = Saasu::ServiceInvoiceItem.new
discount.description = "Online payment discount (if paid before 20th June)"
discount.account_uid = Setting.saasu[:myc_income_account]
discount.total_amount_incl_tax = -10

invoice_items << discount
end

if registration.t_shirt_ordered.to_i > 0
tshirt = Saasu::ServiceInvoiceItem.new
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20140428155112_add_preferred_name_to_contacts.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddPreferredNameToContacts < ActiveRecord::Migration
def change
add_column :contacts, :preferred_name, :string
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20140428142707) do
ActiveRecord::Schema.define(:version => 20140428155112) do

create_table "account_aliases", :force => true do |t|
t.integer "account_id"
Expand Down Expand Up @@ -233,6 +233,7 @@
t.text "subscribed_users"
t.string "saasu_uid"
t.boolean "inactive", :default => false
t.string "preferred_name"
end

add_index "contacts", ["assigned_to"], :name => "index_contacts_on_assigned_to"
Expand Down

0 comments on commit 814d3bd

Please sign in to comment.