solidus-returnly 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a0d71aa3fc918ca44c18793faf76d987bf02f6f7
4
- data.tar.gz: dee66d85096e0b8ff6e934d8b2d256e8848727c6
3
+ metadata.gz: 75f8eee45930bec292d27a3b6fb876f21361b0df
4
+ data.tar.gz: 425e7dbb0fed050f6762c4b5c766d7e77ac89bbc
5
5
  SHA512:
6
- metadata.gz: deb9e37418ecf8dac19d58a3fb6e93cc4c6efeb8e49f2cec3ea988604d194a1c3204edd8564f7bf4da566ceb1ab562b797728e52d1d123362bf8a7bb19dc525c
7
- data.tar.gz: 980a0001ced5190de64c12b3a42370e9c4064ce3b0ae00d78300255688d1f5813d1b18a1dca3d0590e924466220cd0d20e202da36efa1dd2a6c58ba947a2b44a
6
+ metadata.gz: 90d55e4b55a56af2737040bc1c9826fe9ab80269a724a48dd43f133a33152bc7056b101180461959735ec1f9ff12efb8205075b269c1392625569f3c35144b37
7
+ data.tar.gz: ceeb5f3e0c0f472a213b3e736ed92e86d1b44dc35c56fb475a1e26c99cd87138b3c2d3caebf6a5d71e4db5ae3010d15067fb9ea49d177237236e3b1eb3721c84
@@ -7,19 +7,14 @@ module RefundMethods
7
7
 
8
8
  class_methods do
9
9
  def whitelisted_refund_methods
10
- # Solidus 2.3.0 deprecates "Spree::Gateway::Bogus" and recommends using "Spree::PaymentMethod::BogusCreditCard" instead.
11
- %w[Spree::Gateway::Bogus Spree::PaymentMethod::SimpleBogusCreditCard Spree::PaymentMethod::BogusCreditCard Spree::PaymentMethod::Check Spree::PaymentMethod::StoreCredit].inject([]) do |methods, payment_method|
12
- begin
13
- methods << payment_method.constantize
14
- methods
15
- rescue
16
- methods
17
- end
18
- end
10
+ # Override this methods to whitelist payment methods
11
+ []
19
12
  end
20
13
 
21
14
  def defined_refund_methods
22
- Spree::PaymentMethod.order('id DESC').pluck(:type).map(&:constantize)
15
+ payment_methods = Spree::PaymentMethod.pluck(:type)
16
+ sorted_payment_methods = payment_methods.reject { |payment_method| payment_method =~ /StoreCredit/ }
17
+ (sorted_payment_methods | payment_methods).map(&:constantize)
23
18
  end
24
19
  end
25
20
  end
@@ -51,20 +51,23 @@ module Returnly
51
51
  customer_return = refunder.customer_return
52
52
 
53
53
  {
54
- refund_id: refunder.order.refunds.last.try(:id),
54
+ refund_id: refunder.order.reload.refunds.last.try(:id).try(:to_s),
55
55
  line_items: customer_return.return_items.group_by { |ri| ri.inventory_unit.line_item.id }.map do |_, return_items|
56
56
  first_return_item = return_items.first
57
57
  {
58
- refund_line_item_id: first_return_item.id,
59
- order_line_item_id: first_return_item.inventory_unit.line_item.id,
60
- refunded_amount_per_item: first_return_item.amount.to_f,
61
- units: return_items.size
58
+ refund_line_item_id: first_return_item.id.to_s,
59
+ order_line_item_id: first_return_item.inventory_unit.line_item.id.to_s,
60
+ units: return_items.size,
61
+ restock: first_return_item.resellable
62
62
  }
63
63
  end,
64
- transactions: [
65
- id: refunder.reimbursement.id,
66
- amount: refunder.reimbursement.total
67
- ]
64
+ transactions: refunder.reimbursement.refunds.map do |refund|
65
+ {
66
+ id: refund.transaction_id,
67
+ amount: refund.amount.to_f,
68
+ code: refund.payment.source_type.constantize.model_name.human
69
+ }
70
+ end
68
71
  }
69
72
  end
70
73
 
@@ -1,5 +1,5 @@
1
1
  module Returnly
2
- VERSION = '0.7.0'
2
+ VERSION = '0.7.1'
3
3
 
4
4
  def platform_version
5
5
  defined?(Solidus)
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.7.0
4
+ version: 0.7.1
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-10-19 00:00:00.000000000 Z
11
+ date: 2017-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus
@@ -373,7 +373,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
373
373
  version: '0'
374
374
  requirements: []
375
375
  rubyforge_project:
376
- rubygems_version: 2.6.11
376
+ rubygems_version: 2.4.5.1
377
377
  signing_key:
378
378
  specification_version: 4
379
379
  summary: Returnly integration with Solidus