- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 729
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6293 from luisramos0/subs_debug
Add task to print Subscriptions debug info
- v5.0.17
- v5.0.16
- v5.0.15
- v5.0.14
- v5.0.13
- v5.0.12
- v5.0.11
- v5.0.10
- v5.0.9
- v5.0.8
- v5.0.7
- v5.0.6
- v5.0.5
- v5.0.4
- v5.0.3
- v5.0.2
- v5.0.1
- v5.0.0
- v4.6.12
- v4.6.11
- v4.6.10
- v4.6.9
- v4.6.8
- v4.6.7
- v4.6.6
- v4.6.5
- v4.6.4
- v4.6.3
- v4.6.1
- v4.6
- v4.5.5
- v4.5.4
- v4.5.3
- v4.5.2
- v4.5.1
- v4.5.0
- v4.4.55
- v4.4.54
- v4.4.53
- v4.4.52
- v4.4.51
- v4.4.50
- v4.4.49
- v4.4.48
- v4.4.47
- v4.4.46
- v4.4.45
- v4.4.44
- v4.4.43
- v4.4.42
- v4.4.41
- v4.4.40
- v4.4.39
- v4.4.38
- v4.4.37
- v4.4.36
- v4.4.35
- v4.4.34
- v4.4.33
- v4.4.32
- v4.4.31
- v4.4.30
- v4.4.29
- v4.4.28
- v4.4.27
- v4.4.26
- v4.4.25
- v4.4.24
- v4.4.23
- v4.4.22
- v4.4.21
- v4.4.20
- v4.4.19
- v4.4.18
- v4.4.17
- v4.4.16
- v4.4.15
- v4.4.14
- v4.4.13
- v4.4.12
- v4.4.11
- v4.4.10
- v4.4.9
- v4.4.8
- v4.4.7
- v4.4.6
- v4.4.5
- v4.4.4
- v4.4.3
- v4.4.2
- v4.4.1
- v4.4.0
- v4.3.13
- v4.3.12
- v4.3.11
- v4.3.10
- v4.3.9
- v4.3.8
- v4.3.7
- v4.3.6
- v4.3.5
- v4.3.4
- v4.3.3
- v4.3.2
- v4.3.1
- v4.3.0
- v4.2.39
- v4.2.38
- v4.2.37
- v4.2.36
- v4.2.35
- v4.2.34
- v4.2.33
- v4.2.32
- v4.2.31
- v4.2.30
- v4.2.29
- v4.2.28
- v4.2.27
- v4.2.26
- v4.2.25
- v4.2.24
- v4.2.23
- v4.2.22
- v4.2.21.1
- v4.2.21
- v4.2.20
- v4.2.19
- v4.2.18
- v4.2.17
- v4.2.16
- v4.2.15
- v4.2.14
- v4.2.13
- v4.2.12
- v4.2.11
- v4.2.10
- v4.2.9
- v4.2.8
- v4.2.7
- v4.2.6
- v4.2.5
- v4.2.4
- v4.2.3
- v4.2.1
- v4.2.0
- v4.2.0-beta
- v4.2.0-alpha
- v4.1.34
- v4.1.33
- v4.1.32
- v4.1.31
- v4.1.30
- v4.1.29
- v4.1.28
- v4.1.27
- v4.1.26
- v4.1.25
- v4.1.24
- v4.1.23
- v4.1.22
- v4.1.21
- v4.1.20
- v4.1.19
- v4.1.18
- v4.1.17
- v4.1.16
- v4.1.15
- v4.1.14
- v4.1.13
- v4.1.12
- v4.1.11
- v4.1.10
- v4.1.9
- v4.1.8
- v4.1.7
- v4.1.6
- v4.1.5
- v4.1.4
- v4.1.3
- v4.1.2
- v4.1.1
- v4.1.0
- v4.0.1
- v4.0.0
- v3.8.8
- v3.8.7
- v3.8.6
- v3.8.5
- v3.8.4
- v3.8.3
- v3.8.2
- v3.8.1
- v3.8.0
- v3.7.3
- v3.7.2
- v3.7.1
- v3.7.0
- v3.6.10
- v3.6.9
- v3.6.8
- v3.6.7
- v3.6.6
- v3.6.5
- v3.6.4
- v3.6.3
- v3.6.2
- v3.6.1
- v3.6.0-rc1
- v3.6-beta
- v3.5.14
- v3.5.13
- v3.5.12
- v3.5.11
- v3.5.10
- v3.5.9
- v3.5.8
- v3.5.7
- v3.5.6
- v3.5.5
- v3.5.4
- v3.5.3
- v3.5.2
- v3.5.1
- v3.5.0
- v3.4.5
- v3.4.4
- v3.4.3
Showing
1 changed file
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# frozen_string_literal: true | ||
|
||
# rubocop:disable Metrics/BlockLength | ||
namespace :ofn do | ||
namespace :subs do | ||
namespace :debug do | ||
desc "Print standard info about a specific Order Cycle" | ||
task order_cycle: :environment do | ||
order_cycle_id = request_order_cycle_id | ||
|
||
order_cycle = OrderCycle.find_by(id: order_cycle_id) | ||
puts "Order Cycle #{order_cycle.name}" | ||
order_cycle.schedules.each do |schedule| | ||
puts "Schedule #{schedule.name}" | ||
Subscription.where(schedule_id: schedule.id).each do |subscription| | ||
puts | ||
puts "Subscription #{subscription.id}" | ||
puts subscription.shop.name | ||
puts subscription.customer.email | ||
puts subscription.payment_method.name | ||
puts "Active from #{subscription.begins_at} to #{subscription.ends_at}" | ||
puts "Last edited on #{subscription.updated_at}" | ||
puts "Canceled at #{subscription.canceled_at} and paused at #{subscription.paused_at}" | ||
|
||
ProxyOrder.where(order_cycle_id: order_cycle_id, | ||
subscription_id: subscription.id).each do |proxy_order| | ||
puts | ||
puts "Proxy Order #{proxy_order.id}" | ||
puts "Canceled at #{proxy_order.canceled_at}" | ||
puts "Last updated at #{proxy_order.updated_at}" | ||
puts "Placed at #{proxy_order.placed_at}" | ||
puts "Confirmed at #{proxy_order.confirmed_at}" | ||
|
||
puts | ||
puts "Order #{proxy_order.order_id} - #{proxy_order.order.number}" | ||
puts "Order is #{proxy_order.order.state} with total #{proxy_order.order.total}" | ||
proxy_order.order.payments.each do |payment| | ||
puts "Payment #{payment.id} with state #{payment.state}" | ||
puts "Amount #{payment.amount}" | ||
puts "Source #{payment.source_type} #{payment.source_id}" | ||
if payment.source_type == "Spree::CreditCard" | ||
puts "Source #{payment.source.to_json}" | ||
end | ||
Spree::LogEntry.where(source_type: "Spree::Payment", | ||
source_id: payment.id).each do |log_entry| | ||
puts "Log Entries found" | ||
puts log_entry.details | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
def request_order_cycle_id | ||
puts "Please input Order Cycle ID to debug" | ||
input = STDIN.gets.chomp | ||
exit if input.blank? || !Integer(input) | ||
Integer(input) | ||
end | ||
end | ||
end | ||
end | ||
# rubocop:enable Metrics/BlockLength |