Skip to main content

How to run auto-charge on the Rails console?

Table of contents​

  1. Prerequisites
  2. Step by Step
  3. Debugging

Prerequisites​

  1. POWR project already installed and set
  2. Running the POWR project
  3. Be familiar with the code that is going to run
    1. lib/tasks/scheduler.rake
    2. lib/tasks/scheduler.rake#create_subscription_transactions
    3. lib/tasks/scheduler.rake#charge_transactions

Step by Step​

  1. Open a terminal or connect to the sidekiq container from Docker Desktop
    1. docker exec -t powr-sidekiq-1 bash

      💡 It will open a bash of the powr-sidekiq-1 container.

    2. Manually open from Docker Desktop
  2. Run rake create_subscription_transactions

    💡 It will create a transaction for the pending pro subscriptions.

  3. Run rake charge_transactions

    💡 Charges the created transactions.

Debugging​

If you want to debug locally you should uncomment the following line inside config/environments/development.rb:3.

Also, you can see the failed workers on localhost:3000/sidekiq.