Class: SpreeCmCommissioner::OrdersController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/spree_cm_commissioner/orders_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/spree_cm_commissioner/orders_controller.rb', line 6

def show
  @order = if params[:id].match?(/^R\d{9,}-([A-Za-z0-9_\-]+)$/)
             Spree::Order.search_by_qr_data!(params[:id])
           else
             SpreeCmCommissioner::Orders::JwtToken::Verify.call(token: params[:t]).value[:order]
           end

  @product_type = @order.products.first&.product_type || 'accommodation'

  if @order.tenant.present?
    @name = @order.tenant.name
    @logo = @order.tenant.active_vendor&.&.original_url
    @brand_color = @order.tenant.preferred_brand_primary_color
  end

  render :template => 'spree/order_mailer/confirm_email'
end