effective_orders 4.4.1 → 4.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/README.md +0 -3
 - data/app/controllers/admin/customers_controller.rb +1 -1
 - data/app/controllers/admin/order_items_controller.rb +1 -1
 - data/app/controllers/admin/orders_controller.rb +1 -1
 - data/app/controllers/effective/concerns/purchase.rb +30 -7
 - data/app/controllers/effective/orders_controller.rb +9 -18
 - data/app/controllers/effective/providers/cheque.rb +7 -24
 - data/app/controllers/effective/providers/mark_as_paid.rb +2 -2
 - data/app/controllers/effective/providers/phone.rb +22 -0
 - data/app/datatables/{effective_customers_datatable.rb → admin/effective_customers_datatable.rb} +1 -1
 - data/app/datatables/admin/effective_orders_datatable.rb +100 -0
 - data/app/datatables/effective_orders_datatable.rb +24 -44
 - data/app/helpers/effective_orders_helper.rb +6 -6
 - data/app/helpers/effective_subscriptions_helper.rb +0 -2
 - data/app/mailers/effective/orders_mailer.rb +1 -0
 - data/app/models/effective/order.rb +27 -2
 - data/app/views/admin/orders/_datatable_actions.html.haml +18 -0
 - data/app/views/effective/orders/_checkout_step2.html.haml +4 -6
 - data/app/views/effective/orders/_datatable_actions.html.haml +2 -0
 - data/app/views/effective/orders/_fields.html.haml +2 -2
 - data/app/views/effective/orders/{_order_note_fields.html.haml → _fields_note.html.haml} +0 -0
 - data/app/views/effective/orders/{_order_terms_and_conditions_fields.html.haml → _fields_terms.html.haml} +0 -0
 - data/app/views/effective/orders/_order.html.haml +2 -1
 - data/app/views/effective/orders/_order_actions.html.haml +1 -1
 - data/app/views/effective/orders/_order_deferred.html.haml +9 -0
 - data/app/views/effective/orders/_order_header.html.haml +4 -1
 - data/app/views/effective/orders/_order_items.html.haml +12 -3
 - data/app/views/effective/orders/_order_notes.html.haml +2 -0
 - data/app/views/effective/orders/_order_payment.html.haml +24 -0
 - data/app/views/effective/orders/cheque/_form.html.haml +3 -4
 - data/app/views/effective/orders/declined.html.haml +0 -2
 - data/app/views/effective/orders/deferred.html.haml +13 -0
 - data/app/views/effective/orders/deferred/_form.html.haml +16 -0
 - data/app/views/effective/orders/index.html.haml +1 -10
 - data/app/views/effective/orders/mark_as_paid/_form.html.haml +1 -3
 - data/app/views/effective/orders/phone/_form.html.haml +4 -0
 - data/app/views/effective/orders/pretend/_form.html.haml +3 -0
 - data/app/views/effective/orders/stripe/_form.html.haml +2 -2
 - data/config/effective_orders.rb +13 -3
 - data/config/routes.rb +3 -1
 - data/lib/effective_orders.rb +21 -6
 - data/lib/effective_orders/version.rb +1 -1
 - metadata +13 -8
 - data/app/datatables/effective_order_items_datatable.rb +0 -99
 - data/app/views/admin/orders/_actions.html.haml +0 -22
 - data/app/views/effective/orders/_order_payment_details.html.haml +0 -18
 - data/app/views/effective/orders/cheque/pay_by_cheque.html.haml +0 -7
 
| 
         @@ -33,8 +33,6 @@ module EffectiveOrdersHelper 
     | 
|
| 
       33 
33 
     | 
    
         
             
              end
         
     | 
| 
       34 
34 
     | 
    
         | 
| 
       35 
35 
     | 
    
         
             
              def order_checkout_label(processor = nil)
         
     | 
| 
       36 
     | 
    
         
            -
                return 'Checkout' if (EffectiveOrders.single_payment_processor? && ![:pretend, :mark_as_paid, :free, :refund].include?(processor))
         
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
36 
     | 
    
         
             
                case processor
         
     | 
| 
       39 
37 
     | 
    
         
             
                when :cheque
         
     | 
| 
       40 
38 
     | 
    
         
             
                  'Pay by Cheque'
         
     | 
| 
         @@ -46,12 +44,14 @@ module EffectiveOrdersHelper 
     | 
|
| 
       46 
44 
     | 
    
         
             
                  'Checkout with Credit Card'
         
     | 
| 
       47 
45 
     | 
    
         
             
                when :paypal
         
     | 
| 
       48 
46 
     | 
    
         
             
                  'Checkout with PayPal'
         
     | 
| 
      
 47 
     | 
    
         
            +
                when :phone
         
     | 
| 
      
 48 
     | 
    
         
            +
                  'Pay by Phone'
         
     | 
| 
       49 
49 
     | 
    
         
             
                when :pretend
         
     | 
| 
       50 
50 
     | 
    
         
             
                  'Purchase Order (skip payment processor)'
         
     | 
| 
       51 
51 
     | 
    
         
             
                when :refund
         
     | 
| 
       52 
52 
     | 
    
         
             
                  'Accept Refund'
         
     | 
| 
       53 
53 
     | 
    
         
             
                when :stripe
         
     | 
| 
       54 
     | 
    
         
            -
                  ' 
     | 
| 
      
 54 
     | 
    
         
            +
                  'Pay Now'
         
     | 
| 
       55 
55 
     | 
    
         
             
                else
         
     | 
| 
       56 
56 
     | 
    
         
             
                  'Checkout'
         
     | 
| 
       57 
57 
     | 
    
         
             
                end
         
     | 
| 
         @@ -72,14 +72,14 @@ module EffectiveOrdersHelper 
     | 
|
| 
       72 
72 
     | 
    
         
             
                render(partial: 'effective/orders/order', locals: { order: order })
         
     | 
| 
       73 
73 
     | 
    
         
             
              end
         
     | 
| 
       74 
74 
     | 
    
         | 
| 
       75 
     | 
    
         
            -
              def render_checkout(order, namespace: nil, purchased_url: nil, declined_url: nil)
         
     | 
| 
      
 75 
     | 
    
         
            +
              def render_checkout(order, namespace: nil, purchased_url: nil, declined_url: nil, deferred_url: nil)
         
     | 
| 
       76 
76 
     | 
    
         
             
                raise 'unable to checkout an order without a user' unless order && order.user
         
     | 
| 
       77 
77 
     | 
    
         | 
| 
       78 
     | 
    
         
            -
                locals = { order: order, purchased_url: purchased_url, declined_url: declined_url, namespace: namespace }
         
     | 
| 
      
 78 
     | 
    
         
            +
                locals = { order: order, purchased_url: purchased_url, declined_url: declined_url, deferred_url: deferred_url, namespace: namespace }
         
     | 
| 
       79 
79 
     | 
    
         | 
| 
       80 
80 
     | 
    
         
             
                if order.purchased?
         
     | 
| 
       81 
81 
     | 
    
         
             
                  render(partial: 'effective/orders/order', locals: locals)
         
     | 
| 
       82 
     | 
    
         
            -
                elsif order.confirmed? && order.errors.blank?
         
     | 
| 
      
 82 
     | 
    
         
            +
                elsif (order.confirmed? || order.deferred?) && order.errors.blank?
         
     | 
| 
       83 
83 
     | 
    
         
             
                  render(partial: 'effective/orders/checkout_step2', locals: locals)
         
     | 
| 
       84 
84 
     | 
    
         
             
                else
         
     | 
| 
       85 
85 
     | 
    
         
             
                  render(partial: 'effective/orders/checkout_step1', locals: locals)
         
     | 
| 
         @@ -28,6 +28,7 @@ module Effective 
     | 
|
| 
       28 
28 
     | 
    
         
             
                end
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
30 
     | 
    
         
             
                # This is sent when an admin creates a new order or /admin/orders/new
         
     | 
| 
      
 31 
     | 
    
         
            +
                # Or when Pay by Cheque or Pay by Phone (deferred payments)
         
     | 
| 
       31 
32 
     | 
    
         
             
                # Or uses the order action Send Payment Request
         
     | 
| 
       32 
33 
     | 
    
         
             
                def payment_request_to_buyer(order_param)
         
     | 
| 
       33 
34 
     | 
    
         
             
                  return true unless EffectiveOrders.mailer[:send_payment_request_to_buyer]
         
     | 
| 
         @@ -112,6 +112,10 @@ module Effective 
     | 
|
| 
       112 
112 
     | 
    
         
             
                  validates :payment_card, presence: true
         
     | 
| 
       113 
113 
     | 
    
         
             
                end
         
     | 
| 
       114 
114 
     | 
    
         | 
| 
      
 115 
     | 
    
         
            +
                with_options if: -> { deferred? } do
         
     | 
| 
      
 116 
     | 
    
         
            +
                  validates :payment_provider, presence: true, inclusion: { in: EffectiveOrders.deferred_providers }
         
     | 
| 
      
 117 
     | 
    
         
            +
                end
         
     | 
| 
      
 118 
     | 
    
         
            +
             
     | 
| 
       115 
119 
     | 
    
         
             
                scope :deep, -> { includes(:user, order_items: :purchasable) }
         
     | 
| 
       116 
120 
     | 
    
         
             
                scope :sorted, -> { order(:id) }
         
     | 
| 
       117 
121 
     | 
    
         | 
| 
         @@ -121,7 +125,9 @@ module Effective 
     | 
|
| 
       121 
125 
     | 
    
         | 
| 
       122 
126 
     | 
    
         
             
                scope :pending, -> { where(state: EffectiveOrders::PENDING) }
         
     | 
| 
       123 
127 
     | 
    
         
             
                scope :confirmed, -> { where(state: EffectiveOrders::CONFIRMED) }
         
     | 
| 
      
 128 
     | 
    
         
            +
                scope :deferred, -> { where(state: EffectiveOrders::DEFERRED) }
         
     | 
| 
       124 
129 
     | 
    
         
             
                scope :declined, -> { where(state: EffectiveOrders::DECLINED) }
         
     | 
| 
      
 130 
     | 
    
         
            +
                scope :refunds, -> { purchased.where('total < ?', 0) }
         
     | 
| 
       125 
131 
     | 
    
         | 
| 
       126 
132 
     | 
    
         
             
                # Effective::Order.new()
         
     | 
| 
       127 
133 
     | 
    
         
             
                # Effective::Order.new(Product.first)
         
     | 
| 
         @@ -224,6 +230,10 @@ module Effective 
     | 
|
| 
       224 
230 
     | 
    
         
             
                  state == EffectiveOrders::CONFIRMED
         
     | 
| 
       225 
231 
     | 
    
         
             
                end
         
     | 
| 
       226 
232 
     | 
    
         | 
| 
      
 233 
     | 
    
         
            +
                def deferred?
         
     | 
| 
      
 234 
     | 
    
         
            +
                  state == EffectiveOrders::DEFERRED
         
     | 
| 
      
 235 
     | 
    
         
            +
                end
         
     | 
| 
      
 236 
     | 
    
         
            +
             
     | 
| 
       227 
237 
     | 
    
         
             
                def purchased?(provider = nil)
         
     | 
| 
       228 
238 
     | 
    
         
             
                  return false if (state != EffectiveOrders::PURCHASED)
         
     | 
| 
       229 
239 
     | 
    
         
             
                  return true if provider.nil? || payment_provider == provider.to_s
         
     | 
| 
         @@ -291,9 +301,9 @@ module Effective 
     | 
|
| 
       291 
301 
     | 
    
         
             
                  true
         
     | 
| 
       292 
302 
     | 
    
         
             
                end
         
     | 
| 
       293 
303 
     | 
    
         | 
| 
      
 304 
     | 
    
         
            +
                # Used by admin checkout only
         
     | 
| 
       294 
305 
     | 
    
         
             
                def confirm!
         
     | 
| 
       295 
     | 
    
         
            -
                   
     | 
| 
       296 
     | 
    
         
            -
                  save!
         
     | 
| 
      
 306 
     | 
    
         
            +
                  update!(state: EffectiveOrders::CONFIRMED)
         
     | 
| 
       297 
307 
     | 
    
         
             
                end
         
     | 
| 
       298 
308 
     | 
    
         | 
| 
       299 
309 
     | 
    
         
             
                # This lets us skip to the confirmed workflow for an admin...
         
     | 
| 
         @@ -346,6 +356,21 @@ module Effective 
     | 
|
| 
       346 
356 
     | 
    
         
             
                  true
         
     | 
| 
       347 
357 
     | 
    
         
             
                end
         
     | 
| 
       348 
358 
     | 
    
         | 
| 
      
 359 
     | 
    
         
            +
                def defer!(provider: 'none', email: true)
         
     | 
| 
      
 360 
     | 
    
         
            +
                  return false if purchased?
         
     | 
| 
      
 361 
     | 
    
         
            +
             
     | 
| 
      
 362 
     | 
    
         
            +
                  assign_attributes(
         
     | 
| 
      
 363 
     | 
    
         
            +
                    state: EffectiveOrders::DEFERRED,
         
     | 
| 
      
 364 
     | 
    
         
            +
                    payment_provider: provider
         
     | 
| 
      
 365 
     | 
    
         
            +
                  )
         
     | 
| 
      
 366 
     | 
    
         
            +
             
     | 
| 
      
 367 
     | 
    
         
            +
                  save!
         
     | 
| 
      
 368 
     | 
    
         
            +
             
     | 
| 
      
 369 
     | 
    
         
            +
                  send_payment_request_to_buyer! if email
         
     | 
| 
      
 370 
     | 
    
         
            +
             
     | 
| 
      
 371 
     | 
    
         
            +
                  true
         
     | 
| 
      
 372 
     | 
    
         
            +
                end
         
     | 
| 
      
 373 
     | 
    
         
            +
             
     | 
| 
       349 
374 
     | 
    
         
             
                def decline!(payment: 'none', provider: 'none', card: 'none', validate: true)
         
     | 
| 
       350 
375 
     | 
    
         
             
                  return false if declined?
         
     | 
| 
       351 
376 
     | 
    
         | 
| 
         @@ -0,0 +1,18 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            = dropdown(variation: :dropleft) do
         
     | 
| 
      
 2 
     | 
    
         
            +
              = dropdown_link_to 'View', effective_orders.admin_order_path(order)
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
              - if order.purchased? == false
         
     | 
| 
      
 5 
     | 
    
         
            +
                = dropdown_link_to 'Edit', effective_orders.edit_admin_order_path(order)
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
              - if order.purchased?
         
     | 
| 
      
 8 
     | 
    
         
            +
                = dropdown_link_to 'Email receipt to buyer', effective_orders.send_buyer_receipt_order_path(order),
         
     | 
| 
      
 9 
     | 
    
         
            +
                  data: { confirm: "Send receipt to #{order.user.email}?" }
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
              - if order.pending? || order.confirmed? || order.deferred?
         
     | 
| 
      
 12 
     | 
    
         
            +
                = dropdown_link_to 'Email request for payment to buyer', effective_orders.send_payment_request_admin_order_path(order),
         
     | 
| 
      
 13 
     | 
    
         
            +
                  data: { method: :post, confirm: "Send request for payment to #{order.user.email}?" }
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                = dropdown_link_to 'Admin: Checkout', effective_orders.checkout_admin_order_path(order)
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                = dropdown_link_to "Delete #{order}", effective_orders.admin_order_path(order),
         
     | 
| 
      
 18 
     | 
    
         
            +
                  data: { method: :delete, confirm: "Really delete #{order}?" }
         
     | 
| 
         @@ -5,7 +5,7 @@ 
     | 
|
| 
       5 
5 
     | 
    
         
             
                = link_to 'Change Addresses', effective_orders.edit_order_path(order), rel: :nofollow, class: 'btn btn-secondary'
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
            .effective-order-purchase-actions
         
     | 
| 
       8 
     | 
    
         
            -
              - provider_locals = { order: order, purchased_url: purchased_url, declined_url: declined_url }
         
     | 
| 
      
 8 
     | 
    
         
            +
              - provider_locals = { order: order, purchased_url: purchased_url, declined_url: declined_url, deferred_url: deferred_url }
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
              - if EffectiveOrders.free? && order.free?
         
     | 
| 
       11 
11 
     | 
    
         
             
                = render partial: '/effective/orders/free/form', locals: provider_locals
         
     | 
| 
         @@ -14,9 +14,6 @@ 
     | 
|
| 
       14 
14 
     | 
    
         
             
                = render partial: '/effective/orders/refund/form', locals: provider_locals
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
              - else
         
     | 
| 
       17 
     | 
    
         
            -
                - if EffectiveOrders.pretend? && EffectiveOrders.pretend_message.present?
         
     | 
| 
       18 
     | 
    
         
            -
                  %p.text-right= EffectiveOrders.pretend_message
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
17 
     | 
    
         
             
                - if EffectiveOrders.pretend?
         
     | 
| 
       21 
18 
     | 
    
         
             
                  = render partial: '/effective/orders/pretend/form', locals: provider_locals
         
     | 
| 
       22 
19 
     | 
    
         | 
| 
         @@ -29,8 +26,9 @@ 
     | 
|
| 
       29 
26 
     | 
    
         
             
                - if EffectiveOrders.stripe?
         
     | 
| 
       30 
27 
     | 
    
         
             
                  = render partial: '/effective/orders/stripe/form', locals: provider_locals
         
     | 
| 
       31 
28 
     | 
    
         | 
| 
       32 
     | 
    
         
            -
                - if EffectiveOrders. 
     | 
| 
       33 
     | 
    
         
            -
                   
     | 
| 
      
 29 
     | 
    
         
            +
                - if EffectiveOrders.deferred? && order.user == current_user
         
     | 
| 
      
 30 
     | 
    
         
            +
                  %p.my-4.text-center - or -
         
     | 
| 
      
 31 
     | 
    
         
            +
                  = render partial: '/effective/orders/deferred/form', locals: provider_locals
         
     | 
| 
       34 
32 
     | 
    
         | 
| 
       35 
33 
     | 
    
         
             
              - if EffectiveOrders.authorized?(controller, :admin, :effective_orders) && order.user != current_user
         
     | 
| 
       36 
34 
     | 
    
         
             
                - if EffectiveOrders.mark_as_paid?
         
     | 
| 
         @@ -25,7 +25,7 @@ 
     | 
|
| 
       25 
25 
     | 
    
         
             
                      = effective_address_fields(form, :shipping_address)
         
     | 
| 
       26 
26 
     | 
    
         | 
| 
       27 
27 
     | 
    
         
             
            - if EffectiveOrders.collect_note
         
     | 
| 
       28 
     | 
    
         
            -
              = render 'effective/orders/ 
     | 
| 
      
 28 
     | 
    
         
            +
              = render 'effective/orders/fields_note', form: form
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
30 
     | 
    
         
             
            - if EffectiveOrders.terms_and_conditions
         
     | 
| 
       31 
     | 
    
         
            -
              = render 'effective/orders/ 
     | 
| 
      
 31 
     | 
    
         
            +
              = render 'effective/orders/fields_terms', form: form
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         @@ -4,7 +4,8 @@ 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
              = render partial: 'effective/orders/order_header', locals: { order: order }
         
     | 
| 
       6 
6 
     | 
    
         
             
              = render partial: 'effective/orders/order_shipping', locals: { order: order }
         
     | 
| 
      
 7 
     | 
    
         
            +
              = render partial: 'effective/orders/order_deferred', locals: { order: order }
         
     | 
| 
       7 
8 
     | 
    
         
             
              = render partial: 'effective/orders/order_notes', locals: { order: order }
         
     | 
| 
       8 
9 
     | 
    
         
             
              = render partial: 'effective/orders/order_items', locals: { order: order }
         
     | 
| 
       9 
     | 
    
         
            -
              = render partial: 'effective/orders/ 
     | 
| 
      
 10 
     | 
    
         
            +
              = render partial: 'effective/orders/order_payment', locals: { order: order }
         
     | 
| 
       10 
11 
     | 
    
         
             
              = render partial: 'effective/orders/order_footer', locals: { order: order }
         
     | 
| 
         @@ -8,7 +8,7 @@ 
     | 
|
| 
       8 
8 
     | 
    
         
             
                  data: { confirm: "Send receipt to #{order.user.email}?" }
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
              - if order.persisted? && EffectiveOrders.authorized?(controller, :admin, :effective_orders)
         
     | 
| 
       11 
     | 
    
         
            -
                - if order.pending? || order.confirmed?
         
     | 
| 
      
 11 
     | 
    
         
            +
                - if order.pending? || order.confirmed? || order.deferred?
         
     | 
| 
       12 
12 
     | 
    
         
             
                  = link_to 'Email request for payment to buyer', effective_orders.send_payment_request_admin_order_path(order),
         
     | 
| 
       13 
13 
     | 
    
         
             
                    class: 'btn btn-secondary',
         
     | 
| 
       14 
14 
     | 
    
         
             
                    data: { method: :post, confirm: "Send request for payment to #{order.user.email}?" }
         
     | 
| 
         @@ -14,7 +14,10 @@ 
     | 
|
| 
       14 
14 
     | 
    
         
             
                .col-sm-6
         
     | 
| 
       15 
15 
     | 
    
         
             
                  - if order.purchased?
         
     | 
| 
       16 
16 
     | 
    
         
             
                    %p Receipt: ##{order.to_param}
         
     | 
| 
       17 
     | 
    
         
            -
                    %p Purchased at: #{order.purchased_at.strftime("%F %H:%M")}
         
     | 
| 
       18 
17 
     | 
    
         
             
                  - elsif order.persisted?
         
     | 
| 
       19 
18 
     | 
    
         
             
                    %p Order: ##{order.to_param}
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                  - if order.purchased?
         
     | 
| 
      
 21 
     | 
    
         
            +
                    %p Purchased at: #{order.purchased_at.strftime("%F %H:%M")}
         
     | 
| 
      
 22 
     | 
    
         
            +
                  - else
         
     | 
| 
       20 
23 
     | 
    
         
             
                    %p Date: #{Time.zone.now.strftime("%F %H:%M")}
         
     | 
| 
         @@ -1,5 +1,5 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            - include_download_column = order.purchased? && order.order_items.any? { |order_item| order_item.purchased_download_url.present? }
         
     | 
| 
       2 
1 
     | 
    
         
             
            - include_quantity_column = order.order_items.any? { |order_item| order_item.quantity > 1 }
         
     | 
| 
      
 2 
     | 
    
         
            +
            - include_download_column = order.purchased? && order.order_items.any? { |order_item| order_item.purchased_download_url.present? }
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
            .effective-order-items
         
     | 
| 
       5 
5 
     | 
    
         
             
              %table.table
         
     | 
| 
         @@ -7,8 +7,10 @@ 
     | 
|
| 
       7 
7 
     | 
    
         
             
                  %tr
         
     | 
| 
       8 
8 
     | 
    
         
             
                    - if include_quantity_column
         
     | 
| 
       9 
9 
     | 
    
         
             
                      %th.quantity Qty
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
       10 
11 
     | 
    
         
             
                    - if include_download_column
         
     | 
| 
       11 
12 
     | 
    
         
             
                      %th.download Download
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
       12 
14 
     | 
    
         
             
                    %th.item= order.order_items.length > 1 ? 'Items' : 'Item'
         
     | 
| 
       13 
15 
     | 
    
         
             
                    %th.price Price
         
     | 
| 
       14 
16 
     | 
    
         | 
| 
         @@ -17,15 +19,15 @@ 
     | 
|
| 
       17 
19 
     | 
    
         
             
                    %tr
         
     | 
| 
       18 
20 
     | 
    
         
             
                      - if include_quantity_column
         
     | 
| 
       19 
21 
     | 
    
         
             
                        %td.quantity= item.quantity
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
       20 
23 
     | 
    
         
             
                      - if include_download_column
         
     | 
| 
       21 
24 
     | 
    
         
             
                        %td.download
         
     | 
| 
       22 
25 
     | 
    
         
             
                          - if item.purchased_download_url.present?
         
     | 
| 
       23 
26 
     | 
    
         
             
                            = link_to 'download', item.purchased_download_url
         
     | 
| 
       24 
27 
     | 
    
         
             
                          - else
         
     | 
| 
       25 
28 
     | 
    
         
             
                            = '-'
         
     | 
| 
       26 
     | 
    
         
            -
                      %td.item
         
     | 
| 
       27 
     | 
    
         
            -
                        = item.name.html_safe
         
     | 
| 
       28 
29 
     | 
    
         | 
| 
      
 30 
     | 
    
         
            +
                      %td.item= item.name.html_safe
         
     | 
| 
       29 
31 
     | 
    
         
             
                      %td.price= price_to_currency(item.subtotal)
         
     | 
| 
       30 
32 
     | 
    
         | 
| 
       31 
33 
     | 
    
         
             
                %tfoot
         
     | 
| 
         @@ -33,22 +35,29 @@ 
     | 
|
| 
       33 
35 
     | 
    
         
             
                    %tr
         
     | 
| 
       34 
36 
     | 
    
         
             
                      - if include_quantity_column
         
     | 
| 
       35 
37 
     | 
    
         
             
                        %th.quantity
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
       36 
39 
     | 
    
         
             
                      - if include_download_column
         
     | 
| 
       37 
40 
     | 
    
         
             
                        %th.download
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
       38 
42 
     | 
    
         
             
                      %th.subtotal Subtotal
         
     | 
| 
       39 
43 
     | 
    
         
             
                      %td.price.subtotal-price= price_to_currency(order.subtotal)
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
       40 
45 
     | 
    
         
             
                  - if order.tax.to_i != 0
         
     | 
| 
       41 
46 
     | 
    
         
             
                    %tr
         
     | 
| 
       42 
47 
     | 
    
         
             
                      - if include_quantity_column
         
     | 
| 
       43 
48 
     | 
    
         
             
                        %th.quantity
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
       44 
50 
     | 
    
         
             
                      - if include_download_column
         
     | 
| 
       45 
51 
     | 
    
         
             
                        %th.download
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
       46 
53 
     | 
    
         
             
                      %th.tax Tax (#{tax_rate_to_percentage(order.tax_rate)})
         
     | 
| 
       47 
54 
     | 
    
         
             
                      %td.price.tax-price= price_to_currency(order.tax)
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
       48 
56 
     | 
    
         
             
                  - if order.tax_rate.present?
         
     | 
| 
       49 
57 
     | 
    
         
             
                    %tr
         
     | 
| 
       50 
58 
     | 
    
         
             
                      - if include_quantity_column
         
     | 
| 
       51 
59 
     | 
    
         
             
                        %th.quantity
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
       52 
61 
     | 
    
         
             
                      - if include_download_column
         
     | 
| 
       53 
62 
     | 
    
         
             
                        %th.download
         
     | 
| 
       54 
63 
     | 
    
         | 
| 
         @@ -0,0 +1,24 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            - if order.purchased?
         
     | 
| 
      
 2 
     | 
    
         
            +
              .effective-order-payment-details
         
     | 
| 
      
 3 
     | 
    
         
            +
                %table.table
         
     | 
| 
      
 4 
     | 
    
         
            +
                  %thead
         
     | 
| 
      
 5 
     | 
    
         
            +
                    %tr
         
     | 
| 
      
 6 
     | 
    
         
            +
                      %th Payment
         
     | 
| 
      
 7 
     | 
    
         
            +
                      %th
         
     | 
| 
      
 8 
     | 
    
         
            +
                  %tbody
         
     | 
| 
      
 9 
     | 
    
         
            +
                    %tr
         
     | 
| 
      
 10 
     | 
    
         
            +
                      %td Provider
         
     | 
| 
      
 11 
     | 
    
         
            +
                      %td= order.payment_provider
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                    - if order.payment_card.present?
         
     | 
| 
      
 14 
     | 
    
         
            +
                      %tr
         
     | 
| 
      
 15 
     | 
    
         
            +
                        %td Card
         
     | 
| 
      
 16 
     | 
    
         
            +
                        %td
         
     | 
| 
      
 17 
     | 
    
         
            +
                          = payment_card_label(order.payment_card)
         
     | 
| 
      
 18 
     | 
    
         
            +
                          - if order.payment.kind_of?(Hash)
         
     | 
| 
      
 19 
     | 
    
         
            +
                            = order.payment[:active_card] || order.payment['f4l4']
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                    %tr
         
     | 
| 
      
 22 
     | 
    
         
            +
                      %td Purchased at
         
     | 
| 
      
 23 
     | 
    
         
            +
                      %td= order.purchased_at&.strftime('%F %H:%M')
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
         @@ -1,5 +1,4 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            = effective_form_with(scope: :cheque, url: effective_orders. 
     | 
| 
       2 
     | 
    
         
            -
              =  
     | 
| 
       3 
     | 
    
         
            -
              = hidden_field_tag(:declined_url, declined_url)
         
     | 
| 
      
 1 
     | 
    
         
            +
            = effective_form_with(scope: :cheque, url: effective_orders.cheque_order_path(order), method: :post) do |f|
         
     | 
| 
      
 2 
     | 
    
         
            +
              = f.hidden_field :deferred_url, value: deferred_url
         
     | 
| 
       4 
3 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
              = f.submit order_checkout_label(:cheque), border: false
         
     | 
| 
      
 4 
     | 
    
         
            +
              = f.submit order_checkout_label(:cheque), center: true, border: false, 'data-confirm': EffectiveOrders.cheque[:confirm]
         
     | 
| 
         @@ -0,0 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            %h1.effective-heading= @page_title
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            %p.effective-orders-page-content
         
     | 
| 
      
 4 
     | 
    
         
            +
              = link_to 'Home', root_path
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            %p.effective-orders-page-content
         
     | 
| 
      
 7 
     | 
    
         
            +
              You have indicated that this order will be paid by #{@order.payment_provider}.
         
     | 
| 
      
 8 
     | 
    
         
            +
              Your order will not be considered purchased until we receive your payment.
         
     | 
| 
      
 9 
     | 
    
         
            +
              Please contact us at your earliest convenience.
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            = render @order
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            = link_to 'Continue', root_path, class: 'btn btn-primary'
         
     | 
| 
         @@ -0,0 +1,16 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            .card
         
     | 
| 
      
 2 
     | 
    
         
            +
              .card-body
         
     | 
| 
      
 3 
     | 
    
         
            +
                %h2 Checkout Offline
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                %p
         
     | 
| 
      
 6 
     | 
    
         
            +
                  = succeed('.') do
         
     | 
| 
      
 7 
     | 
    
         
            +
                    Please indicate that you would like to pay by
         
     | 
| 
      
 8 
     | 
    
         
            +
                    = EffectiveOrders.deferred_providers.to_sentence(last_word_connector: ', or', two_words_connector: ' or ')
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                %p Your order will not be considered purchased until we receive your payment.
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                - provider_locals = { order: order, deferred_url: deferred_url, declined_url: declined_url }
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                .d-flex.justify-content-around
         
     | 
| 
      
 15 
     | 
    
         
            +
                  - EffectiveOrders.deferred_providers.each do |provider|
         
     | 
| 
      
 16 
     | 
    
         
            +
                    = render partial: "/effective/orders/#{provider}/form", locals: provider_locals
         
     | 
| 
         @@ -1,12 +1,3 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            %h1.effective-heading= @page_title
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
              %h2 Pending Orders
         
     | 
| 
       5 
     | 
    
         
            -
              = render_orders(@pending_orders)
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
            - if @orders.present?
         
     | 
| 
       8 
     | 
    
         
            -
              %h2 Purchased Orders
         
     | 
| 
       9 
     | 
    
         
            -
              = render_orders(@orders)
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
            - unless (@pending_orders.present? || @orders.present?)
         
     | 
| 
       12 
     | 
    
         
            -
              %p You have no purchased orders.
         
     | 
| 
      
 3 
     | 
    
         
            +
            = render_datatable(@datatable)
         
     | 
| 
         @@ -1,10 +1,8 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            .card
         
     | 
| 
       2 
2 
     | 
    
         
             
              .card-body
         
     | 
| 
       3 
     | 
    
         
            -
                %h2 Admin:  
     | 
| 
      
 3 
     | 
    
         
            +
                %h2 Admin: Mark as Paid
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
                = effective_form_with(model: order, url: effective_orders.mark_as_paid_order_path(order), method: :post) do |f|
         
     | 
| 
       6 
     | 
    
         
            -
                  = hidden_field_tag(:purchased_url, purchased_url)
         
     | 
| 
       7 
     | 
    
         
            -
                  = hidden_field_tag(:declined_url, declined_url)
         
     | 
| 
       8 
6 
     | 
    
         
             
                  = f.select :payment_provider, EffectiveOrders.payment_providers, required: true
         
     | 
| 
       9 
7 
     | 
    
         | 
| 
       10 
8 
     | 
    
         
             
                  = f.text_field :payment_card,
         
     | 
| 
         @@ -0,0 +1,4 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            = effective_form_with(scope: :phone, url: effective_orders.phone_order_path(order), method: :post) do |f|
         
     | 
| 
      
 2 
     | 
    
         
            +
              = f.hidden_field :deferred_url, value: deferred_url
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
              = f.submit order_checkout_label(:phone), center: true, border: false, 'data-confirm': EffectiveOrders.phone[:confirm]
         
     | 
| 
         @@ -4,7 +4,7 @@ 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            .card
         
     | 
| 
       6 
6 
     | 
    
         
             
              .card-body
         
     | 
| 
       7 
     | 
    
         
            -
                % 
     | 
| 
      
 7 
     | 
    
         
            +
                %h2 Checkout
         
     | 
| 
       8 
8 
     | 
    
         
             
                %p
         
     | 
| 
       9 
9 
     | 
    
         
             
                  %em This checkout is powered by stripe.
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
         @@ -28,4 +28,4 @@ 
     | 
|
| 
       28 
28 
     | 
    
         
             
                      = render('effective/orders/stripe/element')
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
30 
     | 
    
         
             
                  .mt-4
         
     | 
| 
       31 
     | 
    
         
            -
                    = f.submit  
     | 
| 
      
 31 
     | 
    
         
            +
                    = f.submit order_checkout_label(:stripe), center: true, border: false
         
     |