Class: C2eCore::Drops::OrderDrop

Inherits:
BaseDrop
  • Object
show all
Defined in:
/build/app/mailers/c2e_core/drops/order_drop.rb

Instance Method Summary collapse

Constructor Details

#initialize(order) ⇒ OrderDrop

Returns a new instance of OrderDrop.

Instance Method Details

#accepted_atDateTime

Returns - Datetime object containing value when order was submitted by customer. E.g.: "2020-11-16T11:38:56+01:00".

Returns:

  • (DateTime)
    • Datetime object containing value when order was submitted by customer.

    E.g.: "2020-11-16T11:38:56+01:00"

#admin_customer_detail_urlString

Returns - URL redirecting to current customer detail in staff admin application.

Returns:

  • (String)
    • URL redirecting to current customer detail in staff admin application.

#admin_order_detail_urlString

Returns - URL redirecting to order detail in staff admin application.

Returns:

  • (String)
    • URL redirecting to order detail in staff admin application.

#canceled?Boolean

Returns - Returns true if the order is canceled, and false otherwise.

Returns:

  • (Boolean)
    • Returns true if the order is canceled, and false otherwise.

#cash_boxCashBoxDrop

Returns - Returns orders cash box as drop object if it is present.

Returns:

  • (CashBoxDrop)
    • Returns orders cash box as drop object if it is present.

#company_branchCompanyBranchDrop

Returns - Company branch to which order belongs as drop object.

Returns:

#credits_rewardCreditsRewardDrop?

Returns - The credits reward as a drop object, if it is present. Otherwise, null.

Returns:

  • (CreditsRewardDrop, nil)
    • The credits reward as a drop object, if it is present.

    Otherwise, null.

#credits_walletsArray[CreditsWalletDrop]

Returns - An array of credit wallets as drop objects.

Returns:

#currencyCurrencyDrop

Returns - Orders currency object. By default it is taken from company branch.

Returns:

  • (CurrencyDrop)
    • Orders currency object. By default it is taken from company branch.

#customerCustomerDrop

Returns - Customer as drop object.

Returns:

#customer_track_urlString

Returns - URL redirecting to a finish screen of a customer-facing application. E.g.: https://speedlo.cz/cs/app/brand/branch/w/?order-tracking?orderId=[Integer]&userToken=[String].

Returns:

  • (String)
    • URL redirecting to a finish screen of a customer-facing application.

    E.g.: https://speedlo.cz/cs/app/brand/branch/w/?order-tracking?orderId=[Integer]&userToken=[String].

#data_from_terminalString?

Returns - Returns the data we received from the terminal after a successful transaction, if present.

Returns:

  • (String, nil)
    • Returns the data we received from the terminal after

    a successful transaction, if present.

#delayed_delivery_timeDateTime

Returns - Returns time which customer specifically chosen. Can differ from #deliver_at and always has same value.

Returns:

  • (DateTime)
    • Returns time which customer specifically chosen. Can differ from #deliver_at and

    always has same value.

#deliver_atTime

Returns - Returns current time of expected delivery. Can be changed by staff. E.g.: 2022-10-31 15:56:02 +0100.

Returns:

  • (Time)
    • Returns current time of expected delivery. Can be changed by staff.

    E.g.: 2022-10-31 15:56:02 +0100

#deliver_at_minutesInteger

Returns - Returns number of minutes remaining to current deliver_at time. Result is rounded to multiples of 5.

Returns:

  • (Integer)
    • Returns number of minutes remaining to current deliver_at time. Result is rounded

    to multiples of 5.

#delivered_atTime?

Returns - Returns current time of delivery. Can be changed by staff. E.g.: 2022-10-31 15:56:02 +0100.

Returns:

  • (Time, nil)
    • Returns current time of delivery. Can be changed by staff.

    E.g.: 2022-10-31 15:56:02 +0100

#delivery_today?Boolean

Returns - Returns true when deliver_at time is today.

Returns:

  • (Boolean)
    • Returns true when deliver_at time is today.

#delivery_type_enumString

Returns - DeliveryType.enum value. E.g.: MESSENGER, PICKUP. Returns nil for inhouse order.

Returns:

  • (String)
    • DeliveryType.enum value. E.g.: MESSENGER, PICKUP. Returns nil for inhouse

    order.

#flat_itemsArray[OrderRecipeFlatDrop]

Returns - Returns a flat array of main order recipes as drop objects. Doesn’t group the same recipes with side dishes.

Returns:

  • (Array[OrderRecipeFlatDrop])
    • Returns a flat array of main order recipes as drop objects.

    Doesn’t group the same recipes with side dishes.

#flat_ware_category_itemsArray[OrderWareCategoryFlatDrop]

Returns - Returns a flat array of orders ware categories as drop objects ordered by recipes where this ware category was first.

Returns:

  • (Array[OrderWareCategoryFlatDrop])
    • Returns a flat array of orders ware categories as drop objects

    ordered by recipes where this ware category was first.

#has_delivery?Boolean

Returns - Returns true when order is supposed to be delivered by messenger.

Returns:

  • (Boolean)
    • Returns true when order is supposed to be delivered by messenger.

#idInteger

Returns - ID of order.

Returns:

  • (Integer)
    • ID of order

#invoice_promosArray<InvoicePromoDrop>

Returns - An array of invoice promos as drop objects.

Returns:

#main_itemsArray[OrderRecipeDrop]

Returns - Returns an array of main orders’ recipes with name and price as drop objects.

Returns:

  • (Array[OrderRecipeDrop])
    • Returns an array of main orders’ recipes with name and price as drop objects.

#noteString

Returns - text of first info note. E.g.: "Pozor pes, počkat venku!".

Returns:

  • (String)
    • text of first info note. E.g.: "Pozor pes, počkat venku!"

#online?Boolean

Returns - Returns true when order was paid by card in online gate.

Returns:

  • (Boolean)
    • Returns true when order was paid by card in online gate.

#online_payment_idInteger

Returns - Returns id from customer_json gopay hash.

Returns:

  • (Integer)
    • Returns id from customer_json gopay hash

#order_originOrderOriginDrop

Returns - Returns order origin as drop object with name. E.g.: "Web", "Staff", "foodora"..

Returns:

  • (OrderOriginDrop)
    • Returns order origin as drop object with name.

    E.g.: "Web", "Staff", "foodora".

#order_payment_methodsArray[OrderPaymentMethodDrop]

Returns - An array of order payment methods as drop objects.

Returns:

#payment_method_enumsArray

Returns - An array containing the concatenation of PaymentType.enum and PaymentGate.enum values for all orders’ payment methods. E.g.: ["CREDIT_CSOB", "WALLET_CREDIT_WALLET_CREDIT"].

Returns:

  • (Array)
    • An array containing the concatenation of PaymentType.enum and PaymentGate.enum values

    for all orders’ payment methods. E.g.: ["CREDIT_CSOB", "WALLET_CREDIT_WALLET_CREDIT"].

#payment_method_enums_without_wallet_creditArray

Returns - An array containing the concatenation of PaymentType.enum and PaymentGate.enum values for all orders’ payment methods, excluding credit payments. If an order is fully paid using credits, an empty array is returned. E.g.: ["CREDIT_CSOB", "CASH_CASH"].

Returns:

  • (Array)
    • An array containing the concatenation of PaymentType.enum and PaymentGate.enum values

    for all orders’ payment methods, excluding credit payments. If an order is fully paid using credits, an empty array is returned. E.g.: ["CREDIT_CSOB", "CASH_CASH"].

#priceOrderPriceDrop

Returns - Returns orders price as drop object.

Returns:

#purchased_credits_walletCreditsWalletDrop?

Returns - A credit wallet that was purchased with the order as a drop object or nil.

Returns:

  • (CreditsWalletDrop, nil)
    • A credit wallet that was purchased with the order as a drop object or nil.

#qr_with_idString

Returns - QR code including Order#id as data-URL. E.g.: "data:image/png;base64,iVBO.....". Current width of image is 400px.

Returns:

  • (String)
    • QR code including Order#id as data-URL. E.g.:

    "data:image/png;base64,iVBO.....". Current width of image is 400px.

#ratingsArray[OrderRatingDrop]

Returns - Returns an array of order rating notes as drop objects with quality evaluation from customer and text message e.g.: "Dobra, ale těsto bylo trochu tuhé.".

Returns:

  • (Array[OrderRatingDrop])
    • Returns an array of order rating notes as drop objects with

    quality evaluation from customer and text message e.g.: "Dobra, ale těsto bylo trochu tuhé."

#require_age_control?Boolean

Returns - Returns true when order contains a recipe that requires age control, and false otherwise.

Returns:

  • (Boolean)
    • Returns true when order contains a recipe that requires age control, and false otherwise.

#resettable_idInteger

Returns - Resettable ID of order. E.g.: 142.

Returns:

  • (Integer)
    • Resettable ID of order. E.g.: 142

#simplified_payment_methodString

Deprecated.

This method is deprecated and will be removed in future versions. Use #payment_method_enums instead. Reason: This method may return incorrect values for orders paid using multiple payment methods.

Returns - Cotains concatenation of PaymentType.enum and PaymentGate.enum E.g.: CREDIT_CREDIT, CREDIT_CSOB, CASH_CASH, etc.

Returns:

  • (String)
    • Cotains concatenation of PaymentType.enum and PaymentGate.enum

    E.g.: CREDIT_CREDIT, CREDIT_CSOB, CASH_CASH, etc.

#time_deliver_atDateTime

Returns - Returns current date and time of expected delivery. Can be changed by staff. E.g.: 14:51.

Returns:

  • (DateTime)
    • Returns current date and time of expected delivery. Can be changed by staff.

    E.g.: 14:51

#userUserDrop

Returns - Returns user who created order as drop object.

Returns:

  • (UserDrop)
    • Returns user who created order as drop object.