• When check SM reconciliations eligibility by cron job date.

    Run below:

    cron_job_date = Date.parse('2021-11-07')

    no_later_than_date = cron_job_date - Reconciliation::SELF_MANAGED_RECONCILIATION_DELAY no_earlier_than_date = no_later_than_date - Reconciliation::NOTIFICATION_PERIOD

    sm_reconciliations = Reconciliation.for_self_hosted_plans.reconcile_on_before(no_later_than_date).reconcile_on_after(no_earlier_than_date).pending.without_errors.pending_notification

    puts find_eligible_reconciliations(sm_reconciliations)

    Edited by Qingyu Zhao
  • Check the licenseseatlink for a reconciliation id:

    def check_lsl(rid) r = Reconciliation.find(rid); order = r.order; lsl = LicenseSeatLink.where(order_id: order.id); puts lsl.count; pp lsl.map{|l| [l.created_at, l.order_id, l.max_historical_user_count, l.active_user_count]} end

  • #Check the subscription by the reconcilation id:

    #------------------------------------------------

    def check_sub(rid)
      r = Reconciliation.find(rid)
      order = r.order
    
      puts ' ---- r.subscription ----- '
      pp r.subscription
    
      puts ' ---- r.order.subscription ----- '
      pp order.subscription
      puts
    
      puts ' ---- order.customer&.zuora_account_id ----- '
      pp order.customer&.zuora_account_id
      puts
    
      puts ' ---- Zuora::Subscription.where(name: order.subscription_name).map(&:status) ----- '
      pp Zuora::Subscription.where(name: order.subscription_name).map(&:status)
      puts
    
      puts ' ---- Zuora::Subscription.where(name: order.subscription_name).map(&:term_start_date) ----- '
      pp Zuora::Subscription.where(name: order.subscription_name).map(&:term_start_date)
      puts
    
      puts ' ---- Zuora::Subscription.where(name: order.subscription_name).map(&:term_end_date) ----- '
      pp Zuora::Subscription.where(name: order.subscription_name).map(&:term_end_date)
      puts
    
      active_sub = Zuora::Subscription.where(name: order.subscription_name, status: 'Active').first
      puts ' ---- the last(active) subscription ----- '
      pp active_sub
      puts
    
      puts ' ---- r.subscription.products ----- '
      pp r.subscription.products
      puts
      
      puts ' ---- r.order.subscription&.products ----- '
      pp r.order.subscription&.products
      puts
    end
    Edited by Qingyu Zhao
  • SM only check the last one day. When check SM reconciliations eligibility by cron job date but only check the last day(suppose all previous reconciliations have been processed successfully). This runs faster since this has less reconciliations.

    def check_sm_only_last_day_by_cron_job_date(date: Date.current + 5.days)
       cron_job_date = date
    
       no_later_than_date = cron_job_date - Reconciliation::SELF_MANAGED_RECONCILIATION_DELAY 
       no_earlier_than_date = no_later_than_date
    
       sm_reconciliations = Reconciliation.for_self_hosted_plans.reconcile_on_before(no_later_than_date).reconcile_on_after(no_earlier_than_date).pending.without_errors.pending_notification
    
       puts find_eligible_reconciliations(sm_reconciliations)
    end
    Edited by Qingyu Zhao
  • SaaS only check the last one day. When check SaaS reconciliations eligibility by cron job date, but only check the last day (suppose all previous reconciliations have been processed successfully). This runs faster since this has less reconciliations.

    ---------------------------------------------------------

    def check_saas_only_last_day_by_cron_job_date(date: Date.current + 5.days)
        cron_job_date = date
    
        no_later_than_date = cron_job_date
        no_earlier_than_date = no_later_than_date
    
        saas_reconciliations = Reconciliation.for_hosted_plans.reconcile_on_before(no_later_than_date).reconcile_on_after(no_earlier_than_date).pending.without_errors.pending_notification
    
        puts find_eligible_reconciliations(saas_reconciliations)
    end
    Edited by Qingyu Zhao
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment