solidus-returnly 0.5.0.rc1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/returnly.rb +5 -0
- data/lib/returnly/refund_calculator.rb +1 -1
- data/lib/returnly/refund_presenter.rb +16 -11
- data/lib/returnly/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9edf2b667482113a215f7917d02a5e0cf9cd8dd
|
4
|
+
data.tar.gz: 5ef6fc23050351bebe96e0709d7799f321755700
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8d04617201af5df391a32f9f64b1232be810b696e3a9a2f50d3d821db8ce08acb9000dfe55c2bf02070370def937422818195d2b44cf28e4d7fdb891edfe668
|
7
|
+
data.tar.gz: 1695d8f7d61946f15bc7d80fa2a45805a284a80bb12a55591c855240aa4c5b631931283fbfe43aa4c7b41a5830c572e26409e99e18a83d4a845413d656b689f1
|
data/lib/returnly.rb
CHANGED
@@ -2,3 +2,8 @@ require 'returnly/engine'
|
|
2
2
|
require 'returnly/refunds_configuration'
|
3
3
|
require 'returnly/refunder'
|
4
4
|
require 'returnly/refund_calculator'
|
5
|
+
|
6
|
+
require 'returnly/version'
|
7
|
+
require 'returnly/refund/amount_calculator'
|
8
|
+
require 'returnly/refund/return_item_restock_policy'
|
9
|
+
require 'returnly/refund_presenter'
|
@@ -55,7 +55,7 @@ module Returnly
|
|
55
55
|
def returnable_inventory_units
|
56
56
|
@_inventory_units ||= order.inventory_units.includes(:line_item)
|
57
57
|
.where(line_item_id: requested_line_items)
|
58
|
-
.where('state
|
58
|
+
.where('state != ?', 'returned')
|
59
59
|
end
|
60
60
|
|
61
61
|
def returnable_line_items
|
@@ -10,15 +10,17 @@ module Returnly
|
|
10
10
|
sub_total += Money.from_amount return_item.pre_tax_amount
|
11
11
|
end
|
12
12
|
|
13
|
+
total_refund_amount = total - calculator.order.promo_total
|
14
|
+
shipping_tax = calculator.shipping_tax
|
13
15
|
{
|
14
|
-
product_amount:
|
15
|
-
tax_amount:
|
16
|
-
discount_amount:
|
17
|
-
total_refund_amount:
|
18
|
-
refundable_shipping_amount:
|
19
|
-
refundable_shipping_tax_amount:
|
20
|
-
max_refundable_amount:
|
21
|
-
refunds_by_payment_method:
|
16
|
+
product_amount: sub_total.to_f,
|
17
|
+
tax_amount: (total - sub_total).to_f,
|
18
|
+
discount_amount: calculator.order.promo_total.to_f,
|
19
|
+
total_refund_amount: total_refund_amount.to_f,
|
20
|
+
refundable_shipping_amount: calculator.order.shipment_total.to_f,
|
21
|
+
refundable_shipping_tax_amount: shipping_tax.to_f,
|
22
|
+
max_refundable_amount: calculator.order.total.to_f,
|
23
|
+
refunds_by_payment_method: refunds_by_payment(calculator.order, total_refund_amount.to_d + calculator.order.shipment_total + shipping_tax)
|
22
24
|
}
|
23
25
|
end
|
24
26
|
|
@@ -65,11 +67,14 @@ module Returnly
|
|
65
67
|
}
|
66
68
|
end
|
67
69
|
|
68
|
-
private_class_method def self.refunds_by_payment(order)
|
69
|
-
order.payments.
|
70
|
+
private_class_method def self.refunds_by_payment(order, amount)
|
71
|
+
completed_payments = order.payments.completed
|
72
|
+
payment_amount = amount / completed_payments.count
|
73
|
+
|
74
|
+
completed_payments.each_with_object([]) do |payment, payments|
|
70
75
|
payments << {
|
71
76
|
code: payment.source_type.constantize.model_name.human,
|
72
|
-
amount:
|
77
|
+
amount: payment_amount.to_f,
|
73
78
|
original_transaction_id: ''
|
74
79
|
}
|
75
80
|
end
|
data/lib/returnly/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus-returnly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.0
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Returnly Technologies, Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: solidus_auth_devise
|
@@ -360,9 +360,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
360
360
|
version: '0'
|
361
361
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
362
362
|
requirements:
|
363
|
-
- - "
|
363
|
+
- - ">="
|
364
364
|
- !ruby/object:Gem::Version
|
365
|
-
version:
|
365
|
+
version: '0'
|
366
366
|
requirements: []
|
367
367
|
rubyforge_project:
|
368
368
|
rubygems_version: 2.6.11
|