effective_orders 6.17.1 → 6.18.0
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 +4 -4
- data/app/models/effective/order.rb +15 -2
- data/app/views/effective/orders/delayed/_form.html.haml +1 -1
- data/app/views/effective/orders/delayed/_form_purchase.html.haml +1 -1
- data/config/effective_orders.rb +2 -0
- data/lib/effective_orders/version.rb +1 -1
- data/lib/effective_orders.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0559a1dd68e0c43937ccf7a6e13c0f4e8f54c0bf79382744a360f5151b613340'
|
4
|
+
data.tar.gz: 1ae3981f93b86d70bc6706b7688351d3ea555aa9700265e9dc62616eb449f96c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e44abc94fabf240ca5d7c8d446c362f2aca1e59afffc55724753471499acec7fb9bf52d6e6a78469a7763f820c659dfb4a033a80bc09f6452d498fce9283b80
|
7
|
+
data.tar.gz: c648c5762abbb8b39842e1424a78631e614128404ffe73859232bc350d619ba4df5a5da1e22f3632bf357b94b4a8dd66ece50d1b080272903f5b124a500684ed
|
@@ -935,7 +935,13 @@ module Effective
|
|
935
935
|
protected
|
936
936
|
|
937
937
|
def get_subtotal
|
938
|
-
present_order_items.map { |oi| oi.subtotal }.sum
|
938
|
+
subtotal = present_order_items.map { |oi| oi.subtotal }.sum
|
939
|
+
|
940
|
+
if subtotal.to_i < 0 && EffectiveOrders.no_refund?
|
941
|
+
return 0
|
942
|
+
end
|
943
|
+
|
944
|
+
subtotal
|
939
945
|
end
|
940
946
|
|
941
947
|
def get_tax_rate
|
@@ -950,7 +956,14 @@ module Effective
|
|
950
956
|
|
951
957
|
def get_tax
|
952
958
|
return 0 unless tax_rate.present?
|
953
|
-
|
959
|
+
|
960
|
+
tax = present_order_items.reject { |oi| oi.tax_exempt? }.map { |oi| (oi.subtotal * (tax_rate / 100.0)).round(0).to_i }.sum
|
961
|
+
|
962
|
+
if tax.to_i < 0 && EffectiveOrders.no_refund?
|
963
|
+
return 0
|
964
|
+
end
|
965
|
+
|
966
|
+
tax
|
954
967
|
end
|
955
968
|
|
956
969
|
def get_amount_owing
|
data/config/effective_orders.rb
CHANGED
@@ -242,6 +242,8 @@ EffectiveOrders.setup do |config|
|
|
242
242
|
# config.buyer_purchases_refund = false
|
243
243
|
# config.send_refund_notification_to_admin = false
|
244
244
|
#
|
245
|
+
# If you set config.refund = false, Negative order price is set to $0. Can checkout free.
|
246
|
+
#
|
245
247
|
# You can call order.send_refund_notification! directly or implement a better one in your app
|
246
248
|
config.refund = false
|
247
249
|
|
data/lib/effective_orders.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_orders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|