Admin can set enterprises to charge or not charge sales tax

This commit is contained in:
Rohan Mitchell
2015-04-08 10:40:38 +10:00
parent 08fef890ec
commit 9bbc151cae
6 changed files with 26 additions and 2 deletions

View File

@@ -77,7 +77,7 @@ class Enterprise < ActiveRecord::Base
after_rollback :restore_permalink
scope :by_name, order('name')
scope :visible, where(:visible => true)
scope :visible, where(visible: true)
scope :confirmed, where('confirmed_at IS NOT NULL')
scope :unconfirmed, where('confirmed_at IS NULL')
scope :activated, where("confirmed_at IS NOT NULL AND sells != 'unspecified'")

View File

@@ -3,8 +3,21 @@
= f.label :abn, 'ABN'
.omega.eight.columns
= f.text_field :abn, { placeholder: "eg. 99 123 456 789"}
.row
.alpha.three.columns
= f.label :acn, 'ACN'
.omega.eight.columns
= f.text_field :acn, { placeholder: "eg. 123 456 789"}
= f.text_field :acn, { placeholder: "eg. 123 456 789"}
.row
.three.columns.alpha
%label= t('charges_sales_tax')
.two.columns
= f.radio_button :charges_sales_tax, true
&nbsp;
= f.label :charges_sales_tax, "Yes", :value => "true"
.five.columns.omega
= f.radio_button :charges_sales_tax, false
&nbsp;
= f.label :charges_sales_tax, "No", :value => "false"

View File

@@ -21,3 +21,4 @@ en-GB:
search_by_name: Search by name...
producers: UK Producers
producers_join: UK producers are now welcome to join Open Food Network UK.
charges_sales_tax: Charges sales tax?

View File

@@ -18,3 +18,4 @@ en:
search_by_name: Search by name or suburb...
producers: Aussie Producers
producers_join: Australian producers are now welcome to join the Open Food Network.
charges_sales_tax: Charges GST?

View File

@@ -0,0 +1,5 @@
class AddChargesSalesTaxToEnterprises < ActiveRecord::Migration
def change
add_column :enterprises, :charges_sales_tax, :boolean, null: false, default: false
end
end

View File

@@ -218,6 +218,7 @@ feature %q{
click_link "Business Details"
fill_in 'enterprise_abn', :with => '09812309823'
fill_in 'enterprise_acn', :with => ''
choose 'Yes' # enterprise_charges_sales_tax
click_link "Address"
fill_in 'enterprise_address_attributes_address1', :with => '35 Ballantyne St'
@@ -237,6 +238,9 @@ feature %q{
@enterprise.reload
expect(@enterprise.owner).to eq user
click_link "Business Details"
page.should have_checked_field "enterprise_charges_sales_tax_true"
click_link "Payment Methods"
page.should have_checked_field "enterprise_payment_method_ids_#{payment_method.id}"