caboose-cms 0.5.130 → 0.5.131

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YWEzYzcwNzIxOGRiMmZkZjJhYzg3Y2I2YjQ5NDkwOWE3N2RmNTA5OA==
4
+ ZjNiOTM0OWM1OWM3N2NjYTFhMTE2Zjc3NTM2ZGIwYzJlYmNlMDhmNg==
5
5
  data.tar.gz: !binary |-
6
- YWVmNzkyNGQ2OWZmZTY4ZGViYTFlMWFmOTcyMzE2NWEyZDE3OWQyMw==
6
+ OTU1YjI5YTBkZGQ2NGNhZjhiOWQ2ZGM2MThmNjMzNjZmZTBlNjRiOQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NDBmZWIxYWIyODY5OTExMDMzNjA1OWQ3OWNhNzU4MDQ2ZTI3MzRhMzA3NWU4
10
- ZTA4OTY0ODIyMTA2ZWViYmY4OWFhOTc1NzE2ZTU0ZmE1NjU1YTA0OTAwYjBk
11
- NjA2YzEyMzM2Mzg1MWU3Y2NiNDllNjZlOGY3MDc5YThiY2MzYTQ=
9
+ ZjM2N2YzZGU1Nzk5N2RkMGI4Mzc3MzNhNDY4NWYzN2I5NzlkMDViNWFjZGQ3
10
+ N2RhYTAzNTM5ZjM3NjZlNDg0MDVjODdkZTgzYWFjMzE5MjgyYThjMTFiNDRi
11
+ MjIzODBkZjM1YzVmZTY0YjNmMjBiNTJmYzBlNmJmZDQ5MjQwMjY=
12
12
  data.tar.gz: !binary |-
13
- NTgxMzE2YWQ4NjA4MmM4OWJkYjlmMzM1NDE5NTBlYjkyYzBhNTE0NmJjNjdi
14
- MDI3NDNjYWZiODBhZjQxYzgwYWU5ZmIzMzgzMmZmNDhiNjNhMzdjZDBiZTI5
15
- YWMzMjdjMWYyZjUwOWMwMWNiMjY1MmVhMjg5OTc4YTFmYTU4MDM=
13
+ Yzg2NmMwOTI2MTFiYmZjMjdhNWRhZDcwMzNmYjk3YmMxYzhkYjJjYjI3MzY3
14
+ NTFkNmZhMmY5Mzk4MGY3NTIzMDcyOGJlZWQ1YzJmOGMyZTlkNTYyZjk3Yzlk
15
+ OTUwYjcxYmZhMmVkMjE1MjE3NDAwODdhNjU2YmY4NjBhZjljYzM=
@@ -101,12 +101,12 @@ Cart.prototype = {
101
101
 
102
102
  tbody.append($('<tr/>')
103
103
  .append(gctd)
104
- .append($('<td/>').css('text-align', 'right').html('$' + parseFloat(d.amount).toFixed(2)))
104
+ .append($('<td/>').css('text-align', 'right').html('-$' + parseFloat(d.amount).toFixed(2)))
105
105
  );
106
106
  });
107
107
  if (that.order.custom_discount && that.order.custom_discount > 0)
108
108
  {
109
- tbody.append($('<tr/>')
109
+ tbody.append($('<tr/>')
110
110
  .append($('<td/>').css('text-align', 'right').attr('colspan', 4).html('Discount'))
111
111
  .append($('<td/>').css('text-align', 'right').html('$' + parseFloat(that.order.custom_discount).toFixed(2)))
112
112
  );
@@ -86,7 +86,7 @@ module Caboose
86
86
  resp = StdClass.new
87
87
  code = params[:code].strip
88
88
  gc = GiftCard.where("lower(code) = ?", code.downcase).first
89
-
89
+
90
90
  if gc.nil? then resp.error = "Invalid gift card code."
91
91
  elsif gc.status != GiftCard::STATUS_ACTIVE then resp.error = "That gift card is not active."
92
92
  elsif gc.date_available && DateTime.now.utc < self.date_available then resp.error = "That gift card is not active yet."
@@ -96,9 +96,9 @@ module Caboose
96
96
  elsif Discount.where(:order_id => @order.id, :gift_card_id => gc.id).exists? then resp.error = "That gift card has already been applied to this order."
97
97
  else
98
98
  # Determine how much the discount will be
99
- d = Discount.new(:order_id => @order.id, :gift_card_id => gc.id, :amount => 0.0)
99
+ d = Discount.new(:order_id => @order.id, :gift_card_id => gc.id, :amount => 0.0)
100
100
  case gc.card_type
101
- when GiftCard::CARD_TYPE_AMOUNT then d.amount = (@order.total > gc.balance ? gc.balance : @order.total)
101
+ when GiftCard::CARD_TYPE_AMOUNT then d.amount = (@order.total >= gc.balance ? gc.balance : @order.total)
102
102
  when GiftCard::CARD_TYPE_PERCENTAGE then d.amount = @order.subtotal * gc.total
103
103
  when GiftCard::CARD_TYPE_NO_SHIPPING then d.amount = @order.shipping
104
104
  when GiftCard::CARD_TYPE_NO_TAX then d.amount = @order.tax
@@ -8,7 +8,11 @@ module Caboose
8
8
  attr_accessible :id,
9
9
  :gift_card_id,
10
10
  :order_id,
11
- :amount
11
+ :amount
12
+
13
+ after_find do |d|
14
+ d.amount = 0.00 if d.amount.nil?
15
+ end
12
16
 
13
17
  end
14
18
  end
@@ -46,6 +46,7 @@ module Caboose
46
46
  STATUS_SHIPPED = 'shipped'
47
47
  STATUS_TESTING = 'testing'
48
48
 
49
+ FINANCIAL_STATUS_PENDING = 'pending'
49
50
  FINANCIAL_STATUS_AUTHORIZED = 'authorized'
50
51
  FINANCIAL_STATUS_CAPTURED = 'captured'
51
52
  FINANCIAL_STATUS_REFUNDED = 'refunded'
@@ -54,6 +54,9 @@ class Caboose::Schema < Caboose::Utilities::Schema
54
54
  :repeat_start ,
55
55
  :repeat_end
56
56
  ],
57
+ #Caboose::Discount => [
58
+ # :amount
59
+ #],
57
60
  Caboose::Order => [
58
61
  :shipping_method ,
59
62
  :shipping_method_code ,
@@ -39,11 +39,9 @@ module Caboose
39
39
  :cylinder,
40
40
  :shipping_unit_value
41
41
 
42
- after_initialize :check_nil_fields
43
-
44
- def check_nil_fields
45
- self.price = 0.00 if self.price.nil?
46
- self.sale_price = 0.00 if self.sale_price.nil?
42
+ after_initialize do |v|
43
+ v.price = 0.00 if v.price.nil?
44
+ v.sale_price = 0.00 if v.sale_price.nil?
47
45
  end
48
46
 
49
47
  #
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.5.130'
2
+ VERSION = '0.5.131'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.130
4
+ version: 0.5.131
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry