effective_orders 5.9.0 → 5.9.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 03a959b70b778d7a61499dcaec401c812b0fda1685fbbf9593fb75dd12aa21b6
4
- data.tar.gz: 79f227bd79c340bfe03e37db465dc85addeecf36ab33c3b4977e85ad8bc46a53
3
+ metadata.gz: 8207656323cf7dfe93656598ad79fec2db779f8879d1c89adce3d2c71f66b079
4
+ data.tar.gz: 705cf2da66eee1acdaf88dd41061d517d7701ec5ff7aa66d0369d1324e177b3e
5
5
  SHA512:
6
- metadata.gz: 10f7edcd5aa36dfcc1a37802453c781e6e40818747818e14a09994ded71d53021fb4e0218dc5302c15ff952fe4f9272ae846d0b5dce5d897bba530c1e561e51a
7
- data.tar.gz: 7450d630b12ae7755093f99239e759f88d0b3ff077bd04cf1a7eb9c9c740dd3d62c5d22db5649d6f594e6299d7162d7936ede470de24a3648008bf11bc9ecdd6
6
+ metadata.gz: 84102e16425ac192cf6f011ed9e10630971fb46beed5d16a433ae19e661e387e215d7242003e414ee76302cbe8c1913ccb86ada31a6caec9c86f32b3b6f0d083
7
+ data.tar.gz: 44845062ecb7a093b1139d65a4912b6edbc2a261cb119663ea06456981ac4262b97e1e68989039684fcf201afa934b71a89ae8321da56faf6ec3fa5e1741d1c4
@@ -20,6 +20,21 @@ module Admin
20
20
  message
21
21
  }
22
22
 
23
+ def create
24
+ @order = Effective::Order.new
25
+ @order.assign_attributes(permitted_params)
26
+
27
+ authorize_effective_order!
28
+
29
+ @page_title ||= 'New Order'
30
+
31
+ if save_resource(@order, :pending)
32
+ respond_with_success(@order, :save)
33
+ else
34
+ respond_with_error(@order, :save)
35
+ end
36
+ end
37
+
23
38
  # The show page posts to this action
24
39
  # See Effective::OrdersController checkout
25
40
  def checkout
@@ -40,7 +40,7 @@ class Admin::EffectiveOrdersDatatable < Effective::Datatable
40
40
  end
41
41
 
42
42
  col :purchased_at do |order|
43
- order.purchased_at&.strftime('%F %H:%M') || ('pending refund' if order.pending_refund?) || 'not purchased'
43
+ order.purchased_at&.strftime('%F %H:%M') || ('pending refund' if order.pending_refund?) || ("pending #{order.payment_provider}" if order.deferred?) || 'not purchased'
44
44
  end
45
45
 
46
46
  if attributes[:user_id].blank?
@@ -66,6 +66,7 @@ class Admin::EffectiveOrdersDatatable < Effective::Datatable
66
66
  end
67
67
 
68
68
  col :payment_method
69
+ col :payment_provider
69
70
 
70
71
  col :subtotal, as: :price, visible: false
71
72
  col :tax, as: :price, visible: false
@@ -3,12 +3,12 @@
3
3
  class EffectiveOrdersDatatable < Effective::Datatable
4
4
  filters do
5
5
  unless attributes[:not_purchased]
6
- scope :purchased, default: true
6
+ scope :all
7
+ scope :purchased
7
8
 
8
9
  scope :deferred if EffectiveOrders.deferred_providers.present?
9
10
  scope :refunds if EffectiveOrders.refund
10
-
11
- scope :all
11
+ scope :not_purchased
12
12
  end
13
13
  end
14
14
 
@@ -1,3 +1,15 @@
1
+ # Acts as purchasable
2
+ # Add to your model:
3
+ # t.integer :purchased_order_id
4
+ # t.integer :price
5
+ # t.boolean :tax_exempt, default: false
6
+ # t.string :qb_item_name
7
+ # or
8
+ # add_column :resources, :purchased_order_id, :integer
9
+ # add_column :resources, :price, :integer
10
+ # add_column :resources, :tax_exempt, :boolean, default: false
11
+ # add_column :resources, :qb_item_name, :string
12
+
1
13
  module ActsAsPurchasable
2
14
  extend ActiveSupport::Concern
3
15
 
@@ -0,0 +1,2 @@
1
+ .effective-orders
2
+ = yield
@@ -1,3 +1,4 @@
1
- %h1.effective-admin-heading= @page_title
1
+ = render 'layout' do
2
+ %h1.effective-admin-heading= @page_title
2
3
 
3
- = render_checkout(@order, namespace: :admin, purchased_url: effective_orders.admin_order_path(@order), declined_url: effective_orders.admin_order_path(@order))
4
+ = render_checkout(@order, namespace: :admin, purchased_url: effective_orders.admin_order_path(@order), declined_url: effective_orders.admin_order_path(@order))
@@ -1,15 +1,16 @@
1
- %h1.effective-admin-heading= @page_title
1
+ = render 'layout' do
2
+ %h1.effective-admin-heading= @page_title
2
3
 
3
- - if @order.custom_order? && @order.in_progress?
4
- = render 'effective/orders/order_actions', order: @order
4
+ - if @order.custom_order? && @order.in_progress?
5
+ = render 'effective/orders/order_actions', order: @order
5
6
 
6
- .mb-4
7
- = collapse('show order') do
8
- = render 'effective/orders/order', order: @order, no_order_actions: true
7
+ .mb-4
8
+ = collapse('show order') do
9
+ = render 'effective/orders/order', order: @order, no_order_actions: true
9
10
 
10
- = render 'admin/orders/form', order: @order
11
+ = render 'admin/orders/form', order: @order
11
12
 
12
- - else
13
- - # Same as the show action
14
- = render 'effective/orders/order', order: @order
15
- = render 'admin/orders/form_note_internal', order: @order
13
+ - else
14
+ - # Same as the show action
15
+ = render 'effective/orders/order', order: @order
16
+ = render 'admin/orders/form_note_internal', order: @order
@@ -1,6 +1,7 @@
1
- %h1.effective-admin-heading= @page_title
1
+ = render 'layout' do
2
+ %h1.effective-admin-heading= @page_title
2
3
 
3
- %p.text-right.effective-admin-actions
4
- = link_to 'New Order', effective_orders.new_admin_order_path, class: 'btn btn-primary'
4
+ %p.text-right.effective-admin-actions
5
+ = link_to 'New Order', effective_orders.new_admin_order_path, class: 'btn btn-primary'
5
6
 
6
- = render_datatable @datatable
7
+ = render_datatable @datatable
@@ -1,3 +1,4 @@
1
- %h1.effective-admin-heading= @page_title
1
+ = render 'layout' do
2
+ %h1.effective-admin-heading= @page_title
2
3
 
3
- = render 'admin/orders/form', order: @order
4
+ = render 'admin/orders/form', order: @order
@@ -1,4 +1,5 @@
1
- %h1.effective-admin-heading= @page_title
1
+ = render 'layout' do
2
+ %h1.effective-admin-heading= @page_title
2
3
 
3
- = render 'effective/orders/order', order: @order
4
- = render 'admin/orders/form_note_internal', order: @order
4
+ = render 'effective/orders/order', order: @order
5
+ = render 'admin/orders/form_note_internal', order: @order
@@ -0,0 +1,2 @@
1
+ .effective-orders
2
+ = yield
@@ -1,10 +1,11 @@
1
- %h1.effective-heading= @page_title
1
+ = render 'layout' do
2
+ %h1.effective-heading= @page_title
2
3
 
3
- %p.effective-orders-page-content
4
- - if current_cart.present?
5
- Your #{link_to_current_cart(label: 'Cart')} items have been saved. Please try again.
6
- - else
7
- Please try again.
4
+ %p.effective-orders-page-content
5
+ - if current_cart.present?
6
+ Your #{link_to_current_cart(label: 'Cart')} items have been saved. Please try again.
7
+ - else
8
+ Please try again.
8
9
 
9
- %p.text-center
10
- = link_to 'Continue', root_path, class: 'btn btn-primary'
10
+ %p.text-center
11
+ = link_to 'Continue', root_path, class: 'btn btn-primary'
@@ -1,11 +1,12 @@
1
- %h1.effective-heading= @page_title
1
+ = render 'layout' do
2
+ %h1.effective-heading= @page_title
2
3
 
3
- %p.effective-orders-page-content
4
- You have indicated that this order will be paid by #{@order.payment_provider}.
5
- Your order will not be considered purchased until we receive your payment.
6
- Please contact us at your earliest convenience.
4
+ %p.effective-orders-page-content
5
+ You have indicated that this order will be paid by #{@order.payment_provider}.
6
+ Your order will not be considered purchased until we receive your payment.
7
+ Please contact us at your earliest convenience.
7
8
 
8
- = render @order
9
+ = render @order
9
10
 
10
- %p.text-center
11
- = link_to 'Continue', root_path, class: 'btn btn-primary'
11
+ %p.text-center
12
+ = link_to 'Continue', root_path, class: 'btn btn-primary'
@@ -1,3 +1,4 @@
1
- %h1.effective-heading= @page_title
1
+ = render 'layout' do
2
+ %h1.effective-heading= @page_title
2
3
 
3
- = render_checkout_step1(@order)
4
+ = render_checkout_step1(@order)
@@ -1,3 +1,4 @@
1
- %h1.effective-heading= @page_title
1
+ = render 'layout' do
2
+ %h1.effective-heading= @page_title
2
3
 
3
- = render_datatable(@datatable)
4
+ = render_datatable(@datatable)
@@ -1,3 +1,4 @@
1
- %h1.effective-heading= @page_title
1
+ = render 'layout' do
2
+ %h1.effective-heading= @page_title
2
3
 
3
- = render_checkout_step1(@order)
4
+ = render_checkout_step1(@order)
@@ -1,9 +1,10 @@
1
- %h1.effective-heading= @page_title
1
+ = render 'layout' do
2
+ %h1.effective-heading= @page_title
2
3
 
3
- %p.effective-orders-page-content
4
- You have successfully purchased the following:
4
+ %p.effective-orders-page-content
5
+ You have successfully purchased the following:
5
6
 
6
- = render @order
7
+ = render @order
7
8
 
8
- %p.text-center
9
- = link_to 'Continue', root_path, class: 'btn btn-primary'
9
+ %p.text-center
10
+ = link_to 'Continue', root_path, class: 'btn btn-primary'
@@ -1,9 +1,10 @@
1
- %h1.effective-heading= @page_title
1
+ = render 'layout' do
2
+ %h1.effective-heading= @page_title
2
3
 
3
- - if !@order.purchased? && @order.user == current_user
4
- = render_checkout(@order)
5
- - else
6
- = render(@order)
4
+ - if !@order.purchased? && @order.user == current_user
5
+ = render_checkout(@order)
6
+ - else
7
+ = render(@order)
7
8
 
8
- %p.text-center
9
- = link_to 'Continue', effective_orders.orders_path, class: 'btn btn-primary'
9
+ %p.text-center
10
+ = link_to 'Continue', effective_orders.orders_path, class: 'btn btn-primary'
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '5.9.0'.freeze
2
+ VERSION = '5.9.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_orders
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.9.0
4
+ version: 5.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-06 00:00:00.000000000 Z
11
+ date: 2022-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -236,6 +236,7 @@ files:
236
236
  - app/views/admin/orders/_datatable_actions.html.haml
237
237
  - app/views/admin/orders/_form.html.haml
238
238
  - app/views/admin/orders/_form_note_internal.html.haml
239
+ - app/views/admin/orders/_layout.html.haml
239
240
  - app/views/admin/orders/_order_actions.html.haml
240
241
  - app/views/admin/orders/_order_item_fields.html.haml
241
242
  - app/views/admin/orders/checkout.html.haml
@@ -257,6 +258,7 @@ files:
257
258
  - app/views/effective/orders/_fields.html.haml
258
259
  - app/views/effective/orders/_fields_note.html.haml
259
260
  - app/views/effective/orders/_fields_terms.html.haml
261
+ - app/views/effective/orders/_layout.html.haml
260
262
  - app/views/effective/orders/_order.html.haml
261
263
  - app/views/effective/orders/_order_actions.html.haml
262
264
  - app/views/effective/orders/_order_deferred.html.haml