wunder 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -10
- data/lib/wunder/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bd1798280b9716dffe6a71fd44054963b94dea4e338ca66562a7516128e551b
|
4
|
+
data.tar.gz: 4a65757fdf6eecd8c92bc5267ce8133bd41055b1e935d8583ce9cc143aabaf72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
45
|
+
def calculate_total_discounted_price(total, discount_type)
|
46
46
|
if discount_type == "percentage"
|
47
|
-
|
48
|
-
basket_item.product.price = discount
|
47
|
+
discount_price = total - ((total * value) / 100)
|
49
48
|
elsif discount_type == "flat_rate"
|
50
|
-
|
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
|
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
|
63
|
+
def calculate_discounted_price(basket_item, discount_type)
|
63
64
|
if discount_type == "percentage"
|
64
|
-
|
65
|
+
discount = compute_discount(basket_item)
|
66
|
+
basket_item.product.price = discount
|
65
67
|
elsif discount_type == "flat_rate"
|
66
|
-
|
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.
|
data/lib/wunder/version.rb
CHANGED