effective_orders 6.5.3 → 6.5.4

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: 71798da0cd20778fab3e106211f2e7b0ef691f38ba568e9161739b6016a54c18
4
- data.tar.gz: 5261409794ba913635a2966cc6afc7086f4e31e3cc80aea214716270d65536fc
3
+ metadata.gz: 9556f1f1d36f6ec955075b18a44d4ab62a89d5e9197ed96b7a74e0a9359dc3df
4
+ data.tar.gz: a21e9a22e9d90d6e1fe75aa76c521d21f7f42d8cee51248d0aacf9ba3aa7a6bc
5
5
  SHA512:
6
- metadata.gz: 9ed613f93dba098d010277e6bf8cd0eeeba6ef9e3f66d417e5010558c31f1132250e1ee83afe9b9f9a1b8356d60e0118a8178ddba4208e0b4927b9eabec8a955
7
- data.tar.gz: c19f20987bfb6e0431eba2a0b5e45b70f824202c9a894223891a7f93d5bf16504271918a501153249bd54183aa3f0c04ff1e4b9126666aafcad9dafa7ed9118d
6
+ metadata.gz: a9878d9e12edd59fefc4b4654d54591f1e0bea8b22a833f933086e058b1de81ce3c1907d76522318457ca4181086bd4fc8563dd078cf0e5baf858f99bf7cf259
7
+ data.tar.gz: 6a86937f2081ed04e7b8b10ede3e9511bd5c84dee08e8a19c35098c68ec39d9b0d152a877ab7156254feb1c3e351c6831f55700d93d41b6c14428be298fa209d
@@ -38,6 +38,7 @@
38
38
  }
39
39
 
40
40
  .effective-order-change-items {
41
+ text-align: right;
41
42
  margin-bottom: 1rem;
42
43
  }
43
44
 
@@ -52,7 +53,7 @@ form.new_effective_order {
52
53
  }
53
54
 
54
55
  .effective-moneris-checkout {
55
- height: 720px;
56
+ height: 560px;
56
57
  }
57
58
 
58
59
  @media print {
@@ -62,14 +62,16 @@ module Effective
62
62
  # Might render step1 or step2
63
63
  def show
64
64
  @order = Effective::Order.find(params[:id])
65
- EffectiveResources.authorize!(self, :show, @order)
65
+ @page_title ||= view_context.order_page_title(@order)
66
66
 
67
- @page_title ||= ((@order.user == current_user && !@order.purchased?) ? 'Checkout' : @order.to_s)
67
+ EffectiveResources.authorize!(self, :show, @order)
68
68
  end
69
69
 
70
70
  # Always step1
71
71
  def edit
72
72
  @order ||= Effective::Order.was_not_purchased.find(params[:id])
73
+ @page_title ||= view_context.order_page_title(@order)
74
+
73
75
  EffectiveResources.authorize!(self, :edit, @order)
74
76
  end
75
77
 
@@ -10,13 +10,22 @@ module Effective
10
10
 
11
11
  EffectiveResources.authorize!(self, :update, @order)
12
12
 
13
- order_purchased(
14
- payment: 'for pretend',
15
- provider: 'pretend',
16
- card: 'none',
17
- purchased_url: pretend_params[:purchased_url],
18
- current_user: current_user
19
- )
13
+ if params[:commit].to_s.include?('Decline')
14
+ order_declined(
15
+ payment: 'for pretend',
16
+ provider: 'pretend',
17
+ card: 'none',
18
+ declined_url: pretend_params[:declined_url]
19
+ )
20
+ else
21
+ order_purchased(
22
+ payment: 'for pretend',
23
+ provider: 'pretend',
24
+ card: 'none',
25
+ purchased_url: pretend_params[:purchased_url],
26
+ current_user: current_user
27
+ )
28
+ end
20
29
  end
21
30
 
22
31
  def pretend_params
@@ -82,6 +82,24 @@ module EffectiveOrdersHelper
82
82
  render(partial: 'effective/orders/order', locals: { order: order })
83
83
  end
84
84
 
85
+ def order_page_title(order)
86
+ raise 'expected an order' unless order.kind_of?(Effective::Order)
87
+
88
+ authorized = EffectiveResources.authorized?(self, :update, order)
89
+
90
+ if order.purchased? || order.declined?
91
+ order.to_s
92
+ elsif authorized && (controller.action_name == 'edit')
93
+ 'Order Review'
94
+ elsif authorized && (order.confirmed? || order.deferred?) && order.errors.blank?
95
+ 'Checkout'
96
+ elsif authorized && order.pending?
97
+ 'Order Review'
98
+ else
99
+ order.to_s
100
+ end
101
+ end
102
+
85
103
  def render_checkout(order, namespace: nil, purchased_url: nil, declined_url: nil, deferred_url: nil)
86
104
  raise 'expected an order' unless order.kind_of?(Effective::Order)
87
105
  raise 'unable to checkout an order without a user or organization' if order && (order.user.blank? && order.organization.blank?)
@@ -1,4 +1,9 @@
1
- .effective-order
2
- = effective_form_with(model: order, url: checkout_step1_form_url(order, namespace)) do |f|
3
- = render('effective/orders/fields', order: order, form: f)
4
- = f.submit 'Proceed to Checkout'
1
+ - if current_cart.present?
2
+ .effective-order-change-items
3
+ = link_to 'Change Items', effective_orders.cart_path, rel: :nofollow
4
+
5
+ = render(order, no_order_actions: true)
6
+
7
+ = effective_form_with(model: order, url: checkout_step1_form_url(order, namespace)) do |f|
8
+ = render('effective/orders/fields', order: order, form: f)
9
+ = f.submit 'Proceed to Checkout'
@@ -1,9 +1,9 @@
1
- = render partial: 'effective/orders/order', locals: { order: order }
2
-
3
1
  - # Show this if I'm on the effective orders checkout screen. But not on a rendered order.
4
2
  - if order.persisted? && order.user == current_user && request.path.to_s.start_with?(effective_orders.order_path(order))
5
3
  .effective-order-change-items
6
- = link_to 'Change Addresses', effective_orders.edit_order_path(order), rel: :nofollow, class: 'btn btn-secondary'
4
+ = link_to 'Change Addresses', effective_orders.edit_order_path(order), rel: :nofollow
5
+
6
+ = render(order, no_order_actions: true)
7
7
 
8
8
  .effective-order-purchase-actions
9
9
  - provider_locals = { order: order, purchased_url: purchased_url, declined_url: declined_url, deferred_url: deferred_url }
@@ -1,14 +1,10 @@
1
1
  - form ||= local_assigns[:form] || local_assigns[:f]
2
2
 
3
- = render 'effective/orders/order_notes', order: form.object
4
- = render 'effective/orders/order_items', order: form.object
3
+ -# = render 'effective/orders/order_notes', order: form.object
4
+ -# = render 'effective/orders/order_items', order: form.object
5
5
 
6
6
  = form.hidden_field :confirmed_checkout, value: true
7
7
 
8
- - if current_cart.present?
9
- .effective-order-change-items
10
- = link_to 'Change Items', effective_orders.cart_path, rel: :nofollow, class: 'btn btn-secondary'
11
-
12
8
  - num_addresses = [EffectiveOrders.billing_address, EffectiveOrders.shipping_address].count(true)
13
9
 
14
10
  - if num_addresses > 0
@@ -4,9 +4,6 @@
4
4
 
5
5
  .card
6
6
  .card-body.bg-light
7
- .mb-3.text-center
8
- %h2 Checkout
9
-
10
7
  = effective_form_with(scope: :moneris_checkout, url: effective_orders.moneris_checkout_order_path(order), data: { 'moneris-checkout-form': moneris_checkout.to_json }) do |f|
11
8
  = f.hidden_field :purchased_url, value: purchased_url
12
9
  = f.hidden_field :declined_url, value: declined_url
@@ -9,4 +9,6 @@
9
9
  - if EffectiveOrders.pretend_message.present?
10
10
  %p= EffectiveOrders.pretend_message
11
11
 
12
- = f.submit order_checkout_label(:pretend), border: false, center: true
12
+ = f.submit(border: false, center: true) do
13
+ = f.save order_checkout_label(:pretend)
14
+ = f.save order_checkout_label(:pretend).gsub('Purchase', 'Decline')
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '6.5.3'.freeze
2
+ VERSION = '6.5.4'.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: 6.5.3
4
+ version: 6.5.4
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: 2023-06-19 00:00:00.000000000 Z
11
+ date: 2023-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails