solidus-returnly 0.7.1 → 0.8.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/refund_presenter.rb +15 -0
- data/lib/returnly/refunder.rb +6 -0
- data/lib/returnly/services/mark_items_as_returned.rb +25 -0
- data/lib/returnly/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb8d06cd851a7ea78575686899bba9bacc2b341c
|
4
|
+
data.tar.gz: 6b1f367725053816fa4bee8b03fb385cc118a1b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9f4a0a0feafea3e45a61bc6d894b26233f9f2c7ccfabe7a624988664605dee31b9b81243a605e65ce5518cd8d9de88abe432dfbd18ef59f327e53cf11e5a017
|
7
|
+
data.tar.gz: 1e6eb5e42d0d8f5e5c3513590a89574a40f9e8f258b4415b7e93532cf993869219cd8a2084d479293102ea21a3bcb2367f12899465587b5ff3a3a65dc3add577
|
@@ -71,6 +71,21 @@ module Returnly
|
|
71
71
|
}
|
72
72
|
end
|
73
73
|
|
74
|
+
def self.present_refund_with_zero_amount(refunder)
|
75
|
+
{
|
76
|
+
refund_id: '',
|
77
|
+
line_items: refunder.line_items.map do |line_item|
|
78
|
+
{
|
79
|
+
refund_line_item_id: '',
|
80
|
+
order_line_item_id: line_item[:order_line_item_id].to_s,
|
81
|
+
units: line_item[:units].to_i,
|
82
|
+
restock: !!(line_item[:restock].to_s =~ /true/)
|
83
|
+
}
|
84
|
+
end,
|
85
|
+
transactions: []
|
86
|
+
}
|
87
|
+
end
|
88
|
+
|
74
89
|
private_class_method def self.refunds_by_payment(order, payment_amount)
|
75
90
|
::RefundPayments.new(order).perform!(payment_amount)
|
76
91
|
end
|
data/lib/returnly/refunder.rb
CHANGED
@@ -31,6 +31,7 @@ module Returnly
|
|
31
31
|
|
32
32
|
def proceed!
|
33
33
|
return proceed_without_line_items if line_items.empty?
|
34
|
+
return proceed_with_product_zero_amount if product_refund_amount.to_d.zero?
|
34
35
|
process_return_items
|
35
36
|
|
36
37
|
if customer_return.save!
|
@@ -73,6 +74,11 @@ module Returnly
|
|
73
74
|
RefundPresenter.present_refund(self)
|
74
75
|
end
|
75
76
|
|
77
|
+
def proceed_with_product_zero_amount
|
78
|
+
Returnly::Services::MarkItemsAsReturned.new(order, line_items).perform!
|
79
|
+
RefundPresenter.present_refund_with_zero_amount(self)
|
80
|
+
end
|
81
|
+
|
76
82
|
def perform_reimbursement
|
77
83
|
Returnly::Services::CreateReimbursement.new(reimbursement).perform!
|
78
84
|
add_shipping_amount!
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Returnly
|
2
|
+
module Services
|
3
|
+
class MarkItemsAsReturned
|
4
|
+
attr_accessor :order, :line_items
|
5
|
+
|
6
|
+
def initialize(order, line_items)
|
7
|
+
@order = order
|
8
|
+
@line_items = line_items
|
9
|
+
end
|
10
|
+
|
11
|
+
def perform!
|
12
|
+
line_items.each do |line_item|
|
13
|
+
quantity = line_item[:units].to_i
|
14
|
+
inventory_units_by(line_item[:order_line_item_id]).take(quantity).each(&:return)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def inventory_units_by(line_item_id)
|
21
|
+
order.inventory_units.where(line_item_id: line_item_id)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
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.
|
4
|
+
version: 0.8.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-
|
11
|
+
date: 2017-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: solidus
|
@@ -350,6 +350,7 @@ files:
|
|
350
350
|
- lib/returnly/refunder.rb
|
351
351
|
- lib/returnly/refunds_configuration.rb
|
352
352
|
- lib/returnly/services/create_reimbursement.rb
|
353
|
+
- lib/returnly/services/mark_items_as_returned.rb
|
353
354
|
- lib/returnly/version.rb
|
354
355
|
- lib/solidus-returnly.rb
|
355
356
|
- lib/spree-returnly.rb
|