wunder 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -10
  3. data/lib/wunder/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 20f583583705c30caecbe64d86d42c51fa75a81c70d825fded9aa914596dfdd2
4
- data.tar.gz: 6bb8d8b8423368dc407632cda431e8aac60b47c5bd79406b04a17580fbf1b605
3
+ metadata.gz: 1bd1798280b9716dffe6a71fd44054963b94dea4e338ca66562a7516128e551b
4
+ data.tar.gz: 4a65757fdf6eecd8c92bc5267ce8133bd41055b1e935d8583ce9cc143aabaf72
5
5
  SHA512:
6
- metadata.gz: 9476befdb75097f7dac10e039e6a136bb672c2a52015ffc0e62067264c61be9fe965e15662052c4af6a8d0ae9655907e49ab2ea2e0424ef8e3107dbcf5cc8e43
7
- data.tar.gz: 0a2a50de553eacd6f20a8f56177c5aac5155b2f1ba6cfd1bad0a749d4ea4ea1d683d1b68c98217799e024b464595b8d9cce1fc6529c80bb8672ab8c4a5bf48ca
6
+ metadata.gz: 5cc47386e07edbc650da07fb14ae582f759fb0864e215a51d2f596e592e0c62b0c74a3964232394ed1d1f902962f03cb15a7efe10340a354953eae19f09130f1
7
+ data.tar.gz: '0069482f78defc92bbb2afebb762e9dfca497265ea64180aad53edf8ec292f188adbe49f8ccb7f08c1d192b4537beb772f1bcf81b00195872c05c65b9d7252b3'
data/README.md CHANGED
@@ -34,7 +34,7 @@ Make sure that the below mentioned methods are available in the file.
34
34
  If the discount is on basket define adjustable method as mentioned below.
35
35
 
36
36
  Total is the parameter after discounts on individual items.
37
- Define calculate_discounted_price to compute the new value after discounts.
37
+ Define calculate_total_discounted_price to compute the new value after discounts.
38
38
  return false if your rule has only item specific discounts.
39
39
 
40
40
  def adjustable?(total)
@@ -42,30 +42,31 @@ return false if your rule has only item specific discounts.
42
42
  false
43
43
  end
44
44
 
45
- def calculate_discounted_price(basket_item, discount_type)
45
+ def calculate_total_discounted_price(total, discount_type)
46
46
  if discount_type == "percentage"
47
- discount = compute_discount(basket_item)
48
- basket_item.product.price = discount
47
+ discount_price = total - ((total * value) / 100)
49
48
  elsif discount_type == "flat_rate"
50
- basket_item.product.price = value
49
+ discount_price = total
51
50
  end
51
+ discount_price
52
52
  end
53
53
 
54
+
54
55
  If the discount is on an item define eligible method as mentioned below.Item is the individual item scaned during the checkout.
55
- Define calculate_total_discounted_price to compute the new value after discounts.
56
+ Define calculate_discounted_price to compute the new value after discounts.
56
57
  return false if your rule has only basket specific discounts.
57
58
 
58
59
  def eligible?(_item)
59
60
  false
60
61
  end
61
62
 
62
- def calculate_total_discounted_price(total, discount_type)
63
+ def calculate_discounted_price(basket_item, discount_type)
63
64
  if discount_type == "percentage"
64
- discount_price = total - ((total * value) / 100)
65
+ discount = compute_discount(basket_item)
66
+ basket_item.product.price = discount
65
67
  elsif discount_type == "flat_rate"
66
- discount_price = total
68
+ basket_item.product.price = value
67
69
  end
68
- discount_price
69
70
  end
70
71
 
71
72
  Methods in concerns/rule_validations can be used readily to validate the input parameters while capturing the rule.
@@ -1,3 +1,3 @@
1
1
  module Wunder
2
- VERSION = "0.1.3".freeze
2
+ VERSION = "0.1.4".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wunder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akhilesh