class SignupForm
include ActiveModel::Model
include ActiveModel::Attributes
attribute :account_name, :string
attribute :email, :string
module Retryable
module_function
def with_retries(tries: 3, base: 0.3, cap: 5.0, on: [StandardError])
attempt = 0
begin
class OrderCreationService
Result = Struct.new(:success?, :order, :error, keyword_init: true)
def initialize(customer:, line_params:)
@customer = customer
@line_params = line_params
class ImportResult
RowError = Struct.new(:line, :messages)
attr_reader :imported, :row_errors
def initialize
class PriceBreakdown < Struct.new(:subtotal_cents, :discount_cents, :tax_cents, keyword_init: true)
def initialize(*)
super
freeze
end
require "csv"
class ProductImporter
BATCH_SIZE = 500
attr_reader :errors, :inserted
class Cart < ApplicationRecord
belongs_to :user, optional: true
has_many :cart_items, dependent: :destroy
scope :for_session, ->(token) { where(session_token: token) }
scope :active, -> { where(merged_at: nil) }