effective_orders 4.1.2 → 4.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8bc7d8f3210188ed31b12ab7e99954f29d8b48cb
4
- data.tar.gz: c4de6ed1374628fb5e0f3f41934e6a711b121c23
3
+ metadata.gz: b0138f12b6cd08d275d70c37e1b9a04c6fb54b10
4
+ data.tar.gz: 857afa9059a486f0b8d2c50e5c8ee51c9b5a5577
5
5
  SHA512:
6
- metadata.gz: 7178d70dbb59450824f7c768b4592e859a569a1ffa3d6a5853f00efa6bd28a741af17f5f53e11ed499075c4ce7624b4067027ef041d573d81b0471ac26782dd7
7
- data.tar.gz: 7cea6c6ce5f8b82e94eddc4271c0ef33869535d98edf33f198afcd0d5581a91b7dace42982b8e77a71e8483dc6b29e5abe6996ffa7508da1f08030b94eb38cf2
6
+ metadata.gz: a18411c2278e6b93222a77e962fb85ec58f34d217c7394a05f28c9309b6c8afa4954c4d7d22e1bda654a7e5a50d1baaf84d04a531b970f5e3a558f1fa2d87db7
7
+ data.tar.gz: 6a5f4bc9942d336ba1f0f885b5d9df3fc2326e13a84d1b2ca35d6453c04972c24ca3622620e76db4a41207a5c5df473f22a9663b2904835b53455b352d8038f3
@@ -29,8 +29,9 @@
29
29
  %th Total
30
30
  %tbody
31
31
  - customer.stripe_customer.invoices.each do |invoice|
32
+ - date_method = [(:date if invoice.respond_to?(:date)), (:period_start if invoice.respond_to?(:period_start)), :created].compact.first
32
33
  %tr
33
- %td= link_to Time.zone.at(invoice.date).strftime('%F'), invoice.invoice_pdf
34
+ %td= link_to Time.zone.at(invoice.public_send(date_method)).strftime('%F'), invoice.invoice_pdf
34
35
  %td
35
36
  %p
36
37
  = invoice.number
@@ -47,6 +48,9 @@
47
48
  %td= price_to_currency(invoice.total)
48
49
 
49
50
  - if customer.upcoming_invoice.present?
51
+ - invoice = customer.upcoming_invoice
52
+ - date_method = [(:date if invoice.respond_to?(:date)), (:period_start if invoice.respond_to?(:period_start)), :created].compact.first
53
+
50
54
  .card.my-4
51
55
  .card-header Upcoming Invoice
52
56
  .card-body
@@ -54,13 +58,13 @@
54
58
  %tbody
55
59
  %tr
56
60
  %th Date
57
- %td= Time.zone.at(customer.upcoming_invoice.date).strftime('%F')
61
+ %td= Time.zone.at(invoice.public_send(date_method)).strftime('%F')
58
62
  %tr
59
63
  %th Items
60
64
  %td
61
65
  %table.table
62
66
  %tbody
63
- - customer.upcoming_invoice.lines.each do |line|
67
+ - invoice.lines.each do |line|
64
68
  %tr
65
69
  %td #{Time.zone.at(line.period.start).strftime('%F')} to #{Time.zone.at(line.period.end).strftime('%F')}
66
70
  %td= line.description
@@ -10,7 +10,7 @@
10
10
  - stripe_plans = stripe_plans_collection(f.object)
11
11
  - stripe_plans = stripe_plans.select { |plan| plan[:name].include?('per User') }
12
12
 
13
- - f.object.stripe_plan_id ||= stripe_plans.first[:id]
13
+ - f.object.stripe_plan_id ||= (stripe_plans.first || {})[:id]
14
14
 
15
15
  - if f.object.subscribable.subscribed?
16
16
  - quantity_used = f.object.subscribable.subscribable_quantity_used.to_i
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '4.1.2'.freeze
2
+ VERSION = '4.1.3'.freeze
3
3
  end
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: 4.1.2
4
+ version: 4.1.3
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: 2019-04-15 00:00:00.000000000 Z
11
+ date: 2019-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails