shoppe 0.0.18 → 0.0.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/shoppe/application.scss +1 -0
  3. data/app/assets/stylesheets/shoppe/sub.scss +2 -1
  4. data/app/controllers/shoppe/countries_controller.rb +47 -0
  5. data/app/controllers/shoppe/orders_controller.rb +4 -0
  6. data/app/models/shoppe/order.rb +1 -1
  7. data/app/models/shoppe/order/actions.rb +18 -14
  8. data/app/models/shoppe/order/delivery.rb +24 -6
  9. data/app/models/shoppe/order_item.rb +1 -1
  10. data/app/models/shoppe/product.rb +0 -8
  11. data/app/models/shoppe/tax_rate.rb +3 -0
  12. data/app/views/layouts/shoppe/application.html.haml +1 -0
  13. data/app/views/shoppe/countries/_form.html.haml +31 -0
  14. data/app/views/shoppe/countries/edit.html.haml +5 -0
  15. data/app/views/shoppe/countries/index.html.haml +25 -0
  16. data/app/views/shoppe/countries/new.html.haml +5 -0
  17. data/app/views/shoppe/orders/_order_details.html.haml +51 -0
  18. data/app/views/shoppe/orders/_order_items.html.haml +38 -0
  19. data/app/views/shoppe/orders/_payments_form.html.haml +15 -0
  20. data/app/views/shoppe/orders/_payments_table.html.haml +37 -0
  21. data/app/views/shoppe/orders/_search_form.html.haml +24 -0
  22. data/app/views/shoppe/orders/_status_bar.html.haml +25 -0
  23. data/app/views/shoppe/orders/index.html.haml +2 -27
  24. data/app/views/shoppe/orders/show.html.haml +5 -168
  25. data/app/views/shoppe/shared/error.html.haml +3 -1
  26. data/config/routes.rb +1 -0
  27. data/db/seeds.rb +10 -26
  28. data/lib/shoppe.rb +0 -5
  29. data/lib/shoppe/error.rb +21 -0
  30. data/lib/shoppe/errors/inappropriate_delivery_service.rb +0 -5
  31. data/lib/shoppe/errors/insufficient_stock_to_fulfil.rb +0 -4
  32. data/lib/shoppe/errors/not_enough_stock.rb +0 -4
  33. data/lib/shoppe/errors/payment_declined.rb +1 -10
  34. data/lib/shoppe/errors/refund_failed.rb +0 -9
  35. data/lib/shoppe/errors/unorderable_item.rb +0 -5
  36. data/lib/shoppe/version.rb +1 -1
  37. data/test/app/log/development.log +2934 -0
  38. data/test/app/tmp/cache/assets/development/sass/ae14d07da246951103a34baf6ced4dbc454e5f8d/dialog.scssc +0 -0
  39. data/test/app/tmp/cache/assets/development/sass/edac894564dae62b78e653a08d1c41f10ade93f9/application.scssc +0 -0
  40. data/test/app/tmp/cache/assets/development/sass/edac894564dae62b78e653a08d1c41f10ade93f9/dialog.scssc +0 -0
  41. data/test/app/tmp/cache/assets/development/sprockets/08eabc96013073092a91d64aaf3da292 +0 -0
  42. data/test/app/tmp/cache/assets/development/sprockets/0a6bca3e510625f255083bd154cc470b +0 -0
  43. data/test/app/tmp/cache/assets/development/sprockets/267ddf6307abe4d3de2ad900609a6c33 +0 -0
  44. data/test/app/tmp/cache/assets/development/sprockets/2c9164359b1d599a71cebf132035ed6d +0 -0
  45. data/test/app/tmp/cache/assets/development/sprockets/322295abdd8625fcce4da08f9565cc63 +0 -0
  46. data/test/app/tmp/cache/assets/development/sprockets/445cd520fe49b793bd58dfe8ed70d16e +0 -0
  47. data/test/app/tmp/cache/assets/development/sprockets/4df1915796b86f6133a3c75bb30be02a +0 -0
  48. data/test/app/tmp/cache/assets/development/sprockets/5f32b259cbcc52156d2fe21c185d9390 +0 -0
  49. data/test/app/tmp/cache/assets/development/sprockets/71293acda556db2f1dd4f22e3f607f57 +0 -0
  50. data/test/app/tmp/cache/assets/development/sprockets/7938636d16e11b754d4dd046b89863c4 +0 -0
  51. data/test/app/tmp/cache/assets/development/sprockets/7de0e84287a67005fed3fea41ee2c0e9 +0 -0
  52. data/test/app/tmp/cache/assets/development/sprockets/8b6802665cb32689236636d16a1f04e3 +0 -0
  53. data/test/app/tmp/cache/assets/development/sprockets/a7e398541852f6f05ecc5888932a0138 +0 -0
  54. data/test/app/tmp/cache/assets/development/sprockets/accc4dc17ef18d0b510917a005340da5 +0 -0
  55. data/test/app/tmp/cache/assets/development/sprockets/af89877010f84851c64ea77c06baf4ba +0 -0
  56. data/test/app/tmp/cache/assets/development/sprockets/b519a4f6c5b5a0d9236bdca14e0eb00d +0 -0
  57. data/test/app/tmp/cache/assets/development/sprockets/b9ad7ea18b7e55c3626a15d1dae142ed +0 -0
  58. data/test/app/tmp/cache/assets/development/sprockets/c76e2374fc93583d158883980db69094 +0 -0
  59. data/test/app/tmp/cache/assets/development/sprockets/cf45ce1c68370bf536616d1dd87fb89d +0 -0
  60. data/test/app/tmp/cache/assets/development/sprockets/d7feb1bb9d1746a4c653985285f727cd +0 -0
  61. data/test/app/tmp/cache/assets/development/sprockets/e60289d4f6dc2754610af229263c914b +0 -0
  62. data/test/app/tmp/cache/assets/development/sprockets/edf3c55a27678996371bffe56298925b +0 -0
  63. metadata +44 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a08927371decda213891d9e76774821d35ead258
4
- data.tar.gz: 1e0867ff99e0b3ad7793e8cf087167ce4a619932
3
+ metadata.gz: a4a6a283ee7752cb07086b2e0d773f9d9b41a579
4
+ data.tar.gz: 2fafdc5e4fc48385e9f67f6392dca0c7694a61df
5
5
  SHA512:
6
- metadata.gz: 5bd5a7b0f46593eae97db8af9ac06215859c360aae9c0bc8a2de22d6f1c9b40c3dfb2da9769c3e18f9c248df255160da56aa9f0b7506a95b304dc29bbee22b22
7
- data.tar.gz: 7df780d5472b0900b4b2d0164c7dd6dfb267cfcbda20e6d51c8dd82f2aa551fb182b31f481b8eeb6b3ba59c2f49a69d0f874f29641e7fc19169a050f826e6376
6
+ metadata.gz: d519ec68770b5fc88f9d75d13f112877ed91f72899f87dc4ac03131b2265410d7f0bba5ae4d90f800ecc5c86c695a9de9caabce98bdacd186bceecfec68fe3fe
7
+ data.tar.gz: acf90329031a180edc5cc62c331535115357c41bac154476bdce5898409785c1b498fa25f94e724d2733983a3bfac60fe12be19d4d2463fc1887160c533d8655
@@ -81,6 +81,7 @@ header.main {
81
81
  h2.delivery_services { background-image:image-url('shoppe/icons/box.svg'); background-position: 0 3px; background-size:20px;}
82
82
  h2.tax_rates { background-image:image-url('shoppe/icons/currency.svg'); background-position: 0 2px; background-size:22px;}
83
83
  h2.users { background-image:image-url('shoppe/icons/id.svg'); background-position: 0 2px; background-size:22px;}
84
+ h2.countries { background-image:image-url('shoppe/icons/globe.svg'); background-position: 0 2px; background-size:22px;}
84
85
  h2.settings { background-image:image-url('shoppe/icons/toolbox.svg'); background-position: 0 2px; background-size:22px;}
85
86
 
86
87
  }
@@ -46,9 +46,10 @@ html.login {
46
46
  padding:25px;
47
47
  line-height:1.5;
48
48
  font-size:0.9em;
49
- font-weight:500;
50
49
  text-align:center;
50
+ h2 { color:#C17391; text-transform:uppercase; font-size:0.8em; margin-bottom:15px;}
51
51
  p.back { margin-top:25px;}
52
+ p.message { font-size:1.1em;}
52
53
  }
53
54
 
54
55
  //
@@ -0,0 +1,47 @@
1
+ module Shoppe
2
+ class CountriesController < Shoppe::ApplicationController
3
+
4
+ before_filter { @active_nav = :countries }
5
+ before_filter { params[:id] && @country = Shoppe::Country.find(params[:id]) }
6
+
7
+ def index
8
+ @countries = Shoppe::Country.ordered
9
+ end
10
+
11
+ def new
12
+ @country = Shoppe::Country.new
13
+ end
14
+
15
+ def create
16
+ @country = Shoppe::Country.new(safe_params)
17
+ if @country.save
18
+ redirect_to :countries, :flash => {:notice => "Country has been created successfully"}
19
+ else
20
+ render :action => "new"
21
+ end
22
+ end
23
+
24
+ def edit
25
+ end
26
+
27
+ def update
28
+ if @country.update(safe_params)
29
+ redirect_to [:edit, @country], :flash => {:notice => "Country has been updated successfully"}
30
+ else
31
+ render :action => "edit"
32
+ end
33
+ end
34
+
35
+ def destroy
36
+ @country.destroy
37
+ redirect_to :countries, :flash => {:notice => "Country has been removed successfully"}
38
+ end
39
+
40
+ private
41
+
42
+ def safe_params
43
+ params[:country].permit(:name, :code2, :code3, :continent, :tld, :currency, :eu_member)
44
+ end
45
+
46
+ end
47
+ end
@@ -29,11 +29,15 @@ module Shoppe
29
29
  def accept
30
30
  @order.accept!(current_user)
31
31
  redirect_to @order, :notice => "Order has been accepted successfully"
32
+ rescue Shoppe::Errors::PaymentDeclined => e
33
+ redirect_to @order, :alert => e.message
32
34
  end
33
35
 
34
36
  def reject
35
37
  @order.reject!(current_user)
36
38
  redirect_to @order, :notice => "Order has been rejected successfully"
39
+ rescue Shoppe::Errors::PaymentDeclined => e
40
+ redirect_to @order, :alert => e.message
37
41
  end
38
42
 
39
43
  def ship
@@ -85,7 +85,7 @@ module Shoppe
85
85
  end
86
86
 
87
87
  def self.ransackable_associations(auth_object = nil)
88
- ['products']
88
+ []
89
89
  end
90
90
 
91
91
  end
@@ -52,13 +52,15 @@ module Shoppe
52
52
  #
53
53
  # @param user [Shoppe::User] the user who carried out this action
54
54
  def accept!(user)
55
- run_callbacks :acceptance do
56
- self.accepted_at = Time.now
57
- self.accepted_by = user.id
58
- self.status = 'accepted'
59
- self.save!
60
- self.order_items.each(&:accept!)
61
- Shoppe::OrderMailer.accepted(self).deliver
55
+ transaction do
56
+ run_callbacks :acceptance do
57
+ self.accepted_at = Time.now
58
+ self.accepted_by = user.id
59
+ self.status = 'accepted'
60
+ self.save!
61
+ self.order_items.each(&:accept!)
62
+ Shoppe::OrderMailer.accepted(self).deliver
63
+ end
62
64
  end
63
65
  end
64
66
 
@@ -66,13 +68,15 @@ module Shoppe
66
68
  #
67
69
  # @param user [Shoppe::User] the user who carried out the action
68
70
  def reject!(user)
69
- run_callbacks :rejection do
70
- self.rejected_at = Time.now
71
- self.rejected_by = user.id
72
- self.status = 'rejected'
73
- self.save!
74
- self.order_items.each(&:reject!)
75
- Shoppe::OrderMailer.rejected(self).deliver
71
+ transaction do
72
+ run_callbacks :rejection do
73
+ self.rejected_at = Time.now
74
+ self.rejected_by = user.id
75
+ self.status = 'rejected'
76
+ self.save!
77
+ self.order_items.each(&:reject!)
78
+ Shoppe::OrderMailer.rejected(self).deliver
79
+ end
76
80
  end
77
81
  end
78
82
 
@@ -29,15 +29,22 @@ module Shoppe
29
29
  order.validates :delivery_country, :presence => true
30
30
  end
31
31
  validate do
32
- unless available_delivery_services.include?(self.delivery_service)
33
- errors.add :delivery_service_id, "is not suitable for this order"
32
+ if self.delivery_required?
33
+ if self.delivery_service.nil?
34
+ errors.add :delivery_service_id, "must be specified"
35
+ return
36
+ end
37
+
38
+ if self.delivery_service && !available_delivery_services.include?(self.delivery_service)
39
+ errors.add :delivery_service_id, "is not suitable for this order"
40
+ end
34
41
  end
35
42
  end
36
43
 
37
44
  before_confirmation do
38
45
  # Ensure that before we confirm the order that the delivery service which has been selected
39
46
  # is appropritae for the contents of the order.
40
- unless self.valid_delivery_service?
47
+ if self.delivery_required? && !self.valid_delivery_service?
41
48
  raise Shoppe::Errors::InappropriateDeliveryService, :order => self
42
49
  end
43
50
 
@@ -86,6 +93,13 @@ module Shoppe
86
93
  order_items.inject(BigDecimal(0)) { |t,i| t + i.weight}
87
94
  end
88
95
 
96
+ # Is delivery required for this order?
97
+ #
98
+ # @return [Boolean]
99
+ def delivery_required?
100
+ total_weight > BigDecimal(0)
101
+ end
102
+
89
103
  # An array of all the delivery services which are suitable for this order in it's
90
104
  # current state (based on its current weight)
91
105
  #
@@ -101,9 +115,13 @@ module Shoppe
101
115
  # @return [Array] an array of Shoppe:DeliveryServicePrice objects
102
116
  def delivery_service_prices
103
117
  @delivery_service_prices ||= begin
104
- prices = Shoppe::DeliveryServicePrice.joins(:delivery_service).where(:shoppe_delivery_services => {:active => true}).order("`default` desc, price asc").for_weight(total_weight)
105
- prices = prices.select { |p| p.countries.empty? || p.country?(self.delivery_country) }
106
- prices
118
+ if delivery_required?
119
+ prices = Shoppe::DeliveryServicePrice.joins(:delivery_service).where(:shoppe_delivery_services => {:active => true}).order("`default` desc, price asc").for_weight(total_weight)
120
+ prices = prices.select { |p| p.countries.empty? || p.country?(self.delivery_country) }
121
+ prices
122
+ else
123
+ []
124
+ end
107
125
  end
108
126
  end
109
127
 
@@ -6,7 +6,7 @@ module Shoppe
6
6
  # The associated order
7
7
  #
8
8
  # @return [Shoppe::Order]
9
- belongs_to :order, :class_name => 'Shoppe::Order'
9
+ belongs_to :order, :class_name => 'Shoppe::Order', :touch => true
10
10
 
11
11
  # The item which has been ordered
12
12
  belongs_to :ordered_item, :polymorphic => true
@@ -91,14 +91,6 @@ module Shoppe
91
91
  @stock ||= self.stock_level_adjustments.sum(:adjustment)
92
92
  end
93
93
 
94
- def self.ransackable_attributes(auth_object = nil)
95
- ["id", "name", "sku"] + _ransackers.keys
96
- end
97
-
98
- def self.ransackable_associations(auth_object = nil)
99
- []
100
- end
101
-
102
94
  # Search for products which include the guven attributes and return an active record
103
95
  # scope of these products. Chainable with other scopes and with_attributes methods.
104
96
  # For example:
@@ -22,6 +22,9 @@ module Shoppe
22
22
  # All tax rates ordered by their ID
23
23
  scope :ordered, -> { order("shoppe_tax_rates.id")}
24
24
 
25
+ # Set the address type if appropriate
26
+ before_validation { self.address_type = ADDRESS_TYPES.first if self.address_type.blank? }
27
+
25
28
  # A description of the tax rate including its name & percentage
26
29
  #
27
30
  # @return [String]
@@ -21,6 +21,7 @@
21
21
  %li= link_to "Delivery Services", [:delivery_services], :class => @active_nav == :delivery_services ? 'active' : ''
22
22
  %li= link_to "Tax Rates", :tax_rates, :class => @active_nav == :tax_rates ? 'active' : ''
23
23
  %li= link_to "Users", [:users], :class => @active_nav == :users ? 'active' : ''
24
+ %li= link_to "Countries", :countries, :class => @active_nav == :countries ? 'active' : ''
24
25
  %li= link_to "Settings", :settings, :class => @active_nav == :settings ? 'active' : ''
25
26
  %li= link_to "Logout", [:logout], :method => :delete
26
27
 
@@ -0,0 +1,31 @@
1
+ = form_for @country do |f|
2
+ = f.error_messages
3
+ = field_set_tag "User Details" do
4
+ .splitContainer
5
+ %dl.third
6
+ %dt= f.label :name
7
+ %dd= f.text_field :name, :class => 'focus text'
8
+ %dl.third
9
+ %dt= f.label :code2, "ISO 3166-alpha-2"
10
+ %dd= f.text_field :code2, :class => 'text'
11
+ %dl.third
12
+ %dt= f.label :code3, "ISO 3166-alpha-3"
13
+ %dd= f.text_field :code3, :class => 'text'
14
+ .splitContainer
15
+ %dl.third
16
+ %dt= f.label :continent
17
+ %dd= f.text_field :continent, :class => 'text'
18
+ %dl.third
19
+ %dt= f.label :tld, "TLD"
20
+ %dd= f.text_field :tld, :class => 'text'
21
+ %dl.third
22
+ %dt= f.label :eu_member, "EU Member?"
23
+ %dd.checkbox
24
+ = f.check_box :eu_member
25
+ = f.label :eu_member, 'Country is an EU member?'
26
+
27
+ %p.submit
28
+ - unless @country.new_record?
29
+ %span.right= link_to "Delete", @country, :class => 'button purple', :method => :delete, :data => {:confirm => "Are you sure you wish to remove this country?"}
30
+ = f.submit :class => 'button green'
31
+ = link_to "Cancel", :countries, :class => 'button'
@@ -0,0 +1,5 @@
1
+ - @page_title = "Countries"
2
+ = content_for :header do
3
+ %p.buttons= link_to "Back to countries", :countries, :class => 'button'
4
+ %h2.countries Countries
5
+ = render 'form'
@@ -0,0 +1,25 @@
1
+ - @page_title = "Countries"
2
+
3
+ = content_for :header do
4
+ %p.buttons=link_to "New country", :new_country, :class => 'button green'
5
+ %h2.countries Countries
6
+
7
+ .table
8
+ %table.data
9
+ %thead
10
+ %tr
11
+ %th Name
12
+ %th ISO 3166-1-alpha-2
13
+ %th ISO 3166-1-alpha-3
14
+ %th Continent
15
+ %th TLD
16
+ %th EU?
17
+ %tbody
18
+ - for country in @countries
19
+ %tr
20
+ %td= link_to country.name, [:edit, country]
21
+ %td= country.code2
22
+ %td= country.code3
23
+ %td= country.continent
24
+ %td= country.tld
25
+ %td= boolean_tag country.eu_member?
@@ -0,0 +1,5 @@
1
+ - @page_title = "Countries"
2
+ = content_for :header do
3
+ %p.buttons= link_to "Back to countries", :countries, :class => 'button'
4
+ %h2.countries Countries
5
+ = render 'form'
@@ -0,0 +1,51 @@
1
+ .details
2
+ .left
3
+ %dl
4
+ %dt Name
5
+ %dd= @order.first_name + ' ' + @order.last_name
6
+ %dt Company
7
+ %dd= @order.company.blank? ? '-' : @order.company
8
+ %dt Billing#{@order.separate_delivery_address? ? '' : '/Delivery'} Address
9
+ %dd= @order.billing_address1
10
+ %dd= @order.billing_address2
11
+ %dd= @order.billing_address3
12
+ %dd= @order.billing_address4
13
+ %dd= @order.billing_postcode
14
+ %dd= @order.billing_country.try(:name)
15
+ - if @order.separate_delivery_address?
16
+ %dt Delivery Address
17
+ %dd= @order.delivery_name
18
+ %dd= @order.delivery_address1
19
+ %dd= @order.delivery_address2
20
+ %dd= @order.delivery_address3
21
+ %dd= @order.delivery_address4
22
+ %dd= @order.delivery_postcode
23
+ %dd= @order.delivery_country.try(:name)
24
+ .right
25
+ %dl
26
+ %dt E-Mail Address
27
+ %dd= mail_to @order.email_address
28
+ %dt Telephone
29
+ %dd= @order.phone_number
30
+ %dt Weight
31
+ %dd= number_to_weight @order.total_weight
32
+ %dt Build Time
33
+ %dd= distance_of_time_in_words(@order.created_at, @order.received_at)
34
+ - if @order.invoiced?
35
+ %dt Invoice Number
36
+ %dd= @order.invoice_number
37
+ %dt Order Balance
38
+ %dd= boolean_tag @order.paid_in_full?, nil, :true_text => number_to_currency(@order.balance), :false_text => number_to_currency(@order.balance)
39
+ - if @order.accepted? && !@order.shipped?
40
+ = form_tag [:ship, @order] do
41
+ %dl.form
42
+ %dt.padding= label_tag 'consignment_number', 'Consignment Number'
43
+ %dd= text_field_tag 'consignment_number', '', :class => 'text'
44
+ %dl.form
45
+ %dd= submit_tag "Mark as shipped", :class => 'button green button-mini'
46
+
47
+ - unless @order.accepted? || @order.rejected?
48
+ %dl.form
49
+ %dd
50
+ = link_to "Accept", [:accept, @order], :method => :post, :class => 'button green'
51
+ = link_to "Reject", [:reject, @order], :method => :post, :class => 'button purple'
@@ -0,0 +1,38 @@
1
+ .order_items
2
+ .table
3
+ %table.data
4
+ %thead
5
+ %tr
6
+ %th.qty Qty
7
+ %th Item
8
+ %th SKU
9
+ %th.money Cost
10
+ %th.money Price
11
+ %th.money= Shoppe.settings.tax_name
12
+ %th.money Sub-Total
13
+ %tbody
14
+ - for item in @order.order_items
15
+ %tr
16
+ %td.qty= item.quantity
17
+ %td.product= item.ordered_item.full_name
18
+ %td.sku= item.ordered_item.sku
19
+ %td.money= number_to_currency item.total_cost
20
+ %td.money= number_to_currency item.sub_total
21
+ %td.money= number_to_currency item.tax_amount
22
+ %td.money= number_to_currency item.total
23
+ - if @order.delivery_service
24
+ %td.qty
25
+ %td.product= link_to @order.delivery_service.name, [:edit, @order.delivery_service]
26
+ %td.sku
27
+ %td.money= number_to_currency @order.delivery_cost_price
28
+ %td.money= number_to_currency @order.delivery_price
29
+ %td.money= number_to_currency @order.delivery_tax_amount
30
+ %td.money= number_to_currency @order.delivery_price + @order.delivery_tax_amount
31
+ %tfoot
32
+ %tr
33
+ %td.qty= @order.total_items
34
+ %td{:colspan => 2}
35
+ %td.money= number_to_currency @order.total_cost
36
+ %td.money= number_to_currency @order.total_before_tax
37
+ %td.money= number_to_currency @order.tax
38
+ %td.money= number_to_currency @order.total
@@ -0,0 +1,15 @@
1
+ = form_for [@order, Shoppe::Payment.new(:amount => @order.balance)] do |f|
2
+ %dl.text
3
+ %dt= f.label :method
4
+ %dd= f.text_field :method, :class => 'text'
5
+ %dl.text
6
+ %dt= f.label :reference
7
+ %dd= f.text_field :reference, :class => 'text'
8
+ %dl.amount
9
+ %dt= f.label :amount
10
+ %dd
11
+ .moneyInput
12
+ .currency= Shoppe.settings.currency_unit.html_safe
13
+ = f.text_field :amount, :class => 'text'
14
+ %dl.submit
15
+ %dd= f.submit "Add Payment", :class => 'button green'
@@ -0,0 +1,37 @@
1
+ - unless @payments.empty?
2
+ .table
3
+ %table.data
4
+ %thead
5
+ %tr
6
+ %th ID
7
+ %th Type
8
+ %th Method
9
+ %th Reference
10
+ %th Amount
11
+ %th Refunded?
12
+ %th
13
+ %tbody
14
+ - for payment in @payments
15
+ %tr
16
+ %td= payment.id
17
+ %td
18
+ = payment.refund? ? 'Refund' : 'Payment'
19
+ %span.float-right= boolean_tag payment.confirmed?
20
+ %td= payment.method
21
+ %td= link_to_if payment.transaction_url, payment.reference, payment.transaction_url
22
+
23
+ - if payment.refund?
24
+ %td{:colspan => 2}
25
+ %b= number_to_currency payment.amount
26
+ - if payment.parent_payment_id
27
+ from payment ##{payment.parent_payment_id}
28
+ - else
29
+ %td= number_to_currency payment.amount
30
+ %td= boolean_tag payment.refunded?, nil, :true_text => number_to_currency(payment.amount_refunded)
31
+ %td.refund
32
+ - if payment.refundable?
33
+ = link_to "Refund", [:refund, @order, payment], :class => 'button purple button-mini', :rel => 'dialog'
34
+ - else
35
+ = link_to "Delete", [@order, payment], :class => 'button purple button-mini', :data => {:confirm => "Are you sure you wish to remove this payment?"}, :method => :delete
36
+ - else
37
+ %p.notice There are no payments recorded for this order...