effective_orders 4.0.0beta2 → 4.0.0beta3

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
  SHA1:
3
- metadata.gz: da1a756900ec2369535464ac59524e04e480c05f
4
- data.tar.gz: 593c2b74776dd66558b67efc5ddc2fb09b94203b
3
+ metadata.gz: 41a725b2c451424ab930ca84057bfa76d9404a14
4
+ data.tar.gz: 90b4af7a1be8ad14966a6449b14620271677bb1f
5
5
  SHA512:
6
- metadata.gz: d3d7d27ebe782735240eba20c79372d281c9ffa009305c853e2bdd6ed319cf19936051ce8e82b9859f3ee4f6265e67db02161c984b51e42f229b3d4fb2e2474e
7
- data.tar.gz: a8ff40a48e296934603d9841df3a4854d36fe4ce4ffa59d896310a6176aae905b29aab7ca7b4e1ca2d35bdbd75846b3eeea2c6f2b96e6737410c57d80b42f89c
6
+ metadata.gz: ca7e090b0167792643e3a9d56d4c25d1127e30a7fa84a33df06c96c762a832633aefed1fca2074b37cc28511a1159ad4880f5a09b1501e1e76884c0028269ad7
7
+ data.tar.gz: a0cd6b57b48f61aef840cdff2339bac7ec5ff9bf5cf0846121535ffb88e719d30a0f4436eed781e7ca44ab2deeb298b7e5c0df3d8a850a6b6ee9d1e6dbecdc10
@@ -35,15 +35,6 @@
35
35
  margin-bottom: 1rem;
36
36
  }
37
37
 
38
- // Checkout buttons. Bottom of order.
39
- .effective-order-purchase-actions {
40
- text-align: right;
41
-
42
- > * {
43
- display: inline-block;
44
- }
45
- }
46
-
47
38
  .effective-order-admin-purchase-actions {
48
39
  margin-top: 0.5rem;
49
40
  }
@@ -105,6 +105,8 @@ module Admin
105
105
 
106
106
  authorize_effective_order!
107
107
 
108
+ @page_title ||= 'Checkout'
109
+
108
110
  if request.get?
109
111
  @order.assign_confirmed_if_valid!
110
112
  render :checkout and return
@@ -37,21 +37,21 @@ module EffectiveOrdersHelper
37
37
 
38
38
  case processor
39
39
  when :cheque
40
- 'Pay by cheque'
40
+ 'Pay by Cheque'
41
41
  when :free
42
- 'Checkout free'
42
+ 'Checkout Free'
43
43
  when :mark_as_paid
44
- 'Mark as paid'
44
+ 'Admin: Mark as Paid'
45
45
  when :moneris
46
- 'Checkout with credit card'
46
+ 'Checkout with Credit Card'
47
47
  when :paypal
48
48
  'Checkout with PayPal'
49
49
  when :pretend
50
50
  EffectiveOrders.pretend_purchase_in_production_enabled ? 'Purchase Order' : 'Purchase Order (development only)'
51
51
  when :refund
52
- 'Complete refund'
52
+ 'Complete Refund'
53
53
  when :stripe
54
- 'Checkout with credit card'
54
+ 'Checkout with Credit Card'
55
55
  else
56
56
  'Checkout'
57
57
  end
@@ -6,11 +6,16 @@ module ActsAsPurchasable
6
6
  module ActiveRecord
7
7
  def acts_as_purchasable(*options)
8
8
  @acts_as_purchasable = options || []
9
- include ::ActsAsPurchasable
10
9
 
11
10
  instance = new()
12
11
  raise 'must respond_to price' unless instance.respond_to?(:price)
13
12
  raise 'must respond_to purchased_order_id' unless instance.respond_to?(:purchased_order_id)
13
+
14
+ if defined?(EffectiveQbSync)
15
+ raise 'must respond to qb_item_name' unless instance.respond_to?(:qb_item_name)
16
+ end
17
+
18
+ include ::ActsAsPurchasable
14
19
  end
15
20
  end
16
21
 
@@ -1 +1,2 @@
1
- = link_to 'Manage', "https://dashboard.stripe.com/#{'test/' if Rails.env.development?}customers/#{customer.stripe_customer_id}"
1
+ = dropdown(variation: :dropleft) do
2
+ = dropdown_link_to 'Manage', "https://dashboard.stripe.com/#{'test/' if Rails.env.development?}customers/#{customer.stripe_customer_id}"
@@ -1,6 +1,7 @@
1
- = effective_save(form) do
1
+ = form.submit do
2
2
  = form.save 'Save', class: 'btn btn-primary'
3
3
  = form.save 'Duplicate', class: 'btn btn-primary'
4
+
4
5
  - unless form.object.purchased?
5
6
  = form.save 'Checkout', class: 'btn btn-success'
6
7
 
@@ -2,8 +2,12 @@
2
2
  .row.align-items-center
3
3
  = f.fields_for :purchasable, (f.object.purchasable || Effective::Product.new) do |pf|
4
4
  .col-md-1= f.number_field :quantity, input_html: { value: f.object.quantity || 1, min: 1 }
5
- .col-md-5= pf.text_field :title, maxlength: 255
5
+ .col-md-4= pf.text_field :title, maxlength: 255
6
6
  .col-md-2= pf.price_field :price
7
+
8
+ - if defined?(EffectiveQbSync)
9
+ .col-md-2= pf.text_field :qb_item_name, maxlength: 255, label: 'Quickbooks Item'
10
+
7
11
  .col-md-2.mt-4= pf.check_box :tax_exempt, label: "Tax Exempt", title: 'When checked, tax will not be applied to this item'
8
12
  .col-md-1.mt-4
9
13
  = link_to_remove_association(f, 'data-confirm': 'Really remove this item?') do
@@ -31,4 +31,4 @@
31
31
  - if EffectiveOrders.terms_and_conditions
32
32
  = render partial: 'effective/orders/order_terms_and_conditions_fields', locals: { form: f }
33
33
 
34
- = effective_save(f, 'Proceed to Checkout')
34
+ = f.submit 'Proceed to Checkout'
@@ -4,40 +4,42 @@
4
4
  .effective-order-change-items
5
5
  = link_to 'Change Addresses', effective_orders.edit_order_path(order), rel: :nofollow, class: 'btn btn-secondary'
6
6
 
7
- .effective-order.effective-order-purchase-actions.form-actions
8
- - provider_locals = { order: order, purchased_url: purchased_url, declined_url: declined_url }
7
+ .effective-order-purchase-actions
8
+ .form-actions.form-actions-bordered.justify-content-end
9
+ - provider_locals = { order: order, purchased_url: purchased_url, declined_url: declined_url }
9
10
 
10
- - if EffectiveOrders.free? && order.free?
11
- = render partial: '/effective/orders/free/form', locals: provider_locals
11
+ - if EffectiveOrders.free? && order.free?
12
+ = render partial: '/effective/orders/free/form', locals: provider_locals
12
13
 
13
- - elsif EffectiveOrders.refunds? && order.refund?
14
- -# Nothing
14
+ - elsif EffectiveOrders.refunds? && order.refund?
15
+ -# Nothing
15
16
 
16
- - else
17
- - if EffectiveOrders.pretend?
18
- = render partial: '/effective/orders/pretend/form', locals: provider_locals
17
+ - else
18
+ - if EffectiveOrders.pretend?
19
+ = render partial: '/effective/orders/pretend/form', locals: provider_locals
19
20
 
20
- - if EffectiveOrders.moneris?
21
- = render partial: '/effective/orders/moneris/form', locals: provider_locals
21
+ - if EffectiveOrders.moneris?
22
+ = render partial: '/effective/orders/moneris/form', locals: provider_locals
22
23
 
23
- - if EffectiveOrders.paypal?
24
- = render partial: '/effective/orders/paypal/form', locals: provider_locals
24
+ - if EffectiveOrders.paypal?
25
+ = render partial: '/effective/orders/paypal/form', locals: provider_locals
25
26
 
26
- - if EffectiveOrders.stripe?
27
- = render partial: '/effective/orders/stripe/form', locals: provider_locals
27
+ - if EffectiveOrders.stripe?
28
+ = render partial: '/effective/orders/stripe/form', locals: provider_locals
28
29
 
29
- - if EffectiveOrders.cheque? && order.user == current_user
30
- = render partial: '/effective/orders/cheque/form', locals: provider_locals
30
+ - if EffectiveOrders.cheque? && order.user == current_user
31
+ = render partial: '/effective/orders/cheque/form', locals: provider_locals
31
32
 
32
- - if EffectiveOrders.pretend? && Rails.env.production? && EffectiveOrders.pretend_purchase_in_production_message.present?
33
- %br
34
- %p= EffectiveOrders.pretend_purchase_in_production_message
33
+ - if EffectiveOrders.pretend? && Rails.env.production? && EffectiveOrders.pretend_purchase_in_production_message.present?
34
+ %br
35
+ %p= EffectiveOrders.pretend_purchase_in_production_message
35
36
 
36
- - if EffectiveOrders.authorized?(controller, :admin, :effective_orders) && order.user != current_user
37
- - if EffectiveOrders.refunds? && order.refund?
38
- .effective-order.effective-order-admin-purchase-actions
39
- = render partial: '/effective/orders/refund/form', locals: provider_locals
40
- - elsif EffectiveOrders.mark_as_paid?
41
- .effective-order.effective-order-admin-purchase-actions
42
- = render partial: '/effective/orders/mark_as_paid/form', locals: provider_locals
37
+
38
+ - if EffectiveOrders.authorized?(controller, :admin, :effective_orders) && order.user != current_user
39
+ - if EffectiveOrders.refunds? && order.refund?
40
+ .effective-order-admin-purchase-actions
41
+ = render partial: '/effective/orders/refund/form', locals: provider_locals
42
+ - elsif EffectiveOrders.mark_as_paid?
43
+ .effective-order-admin-purchase-actions
44
+ = render partial: '/effective/orders/mark_as_paid/form', locals: provider_locals
43
45
 
@@ -1,4 +1,5 @@
1
- = form_tag(effective_orders.pay_by_cheque_order_path(order), method: :post) do
1
+ = effective_form_with(scope: :cheque, url: effective_orders.pay_by_cheque_order_path(order), method: :post) do |f|
2
2
  = hidden_field_tag(:purchased_url, purchased_url)
3
3
  = hidden_field_tag(:declined_url, declined_url)
4
- = submit_tag order_checkout_label(:cheque), class: 'btn btn-primary', data: { confirm: EffectiveOrders.cheque[:confirm].presence, disable_with: 'Continuing...' }
4
+
5
+ = f.submit order_checkout_label(:cheque), border: false
@@ -3,10 +3,12 @@
3
3
  %p= flash[:danger]
4
4
 
5
5
  %p.effective-orders-page-content
6
- = link_to 'Home', root_path, class: 'btn btn-primary'
6
+ = link_to 'Home', root_path
7
7
 
8
8
  %p.effective-orders-page-content
9
9
  - if current_cart.present?
10
10
  Your #{link_to_current_cart(label: 'Cart')} items have been saved. Please try again.
11
11
  - else
12
12
  Please try again.
13
+
14
+ = link_to 'Continue', root_path, class: 'btn btn-primary'
@@ -1,4 +1,5 @@
1
- = form_tag(effective_orders.free_order_path(order), method: :post) do
1
+ = effective_form_with(scope: :free, url: effective_orders.free_order_path(order), method: :post) do |f|
2
2
  = hidden_field_tag(:purchased_url, purchased_url)
3
3
  = hidden_field_tag(:declined_url, declined_url)
4
- = submit_tag order_checkout_label(:free), class: 'btn btn-primary', data: { disable_with: 'Continuing...' }
4
+
5
+ = f.submit order_checkout_label(:free), border: false
@@ -1,5 +1,5 @@
1
- .panel.panel-default
2
- .panel-body
1
+ .card
2
+ .card-body
3
3
  %h2 Admin: Offline Payment
4
4
 
5
5
  = effective_form_with(model: order, url: effective_orders.mark_as_paid_order_path(order), method: :post) do |f|
@@ -22,5 +22,5 @@
22
22
 
23
23
  = f.text_area :note_to_buyer, hint: 'This message will be displayed on the receipt.'
24
24
 
25
- = effective_save(f, 'Admin: Mark as Paid')
25
+ = f.submit order_checkout_label(:mark_as_paid)
26
26
 
@@ -1,4 +1,4 @@
1
- = form_tag(EffectiveOrders.moneris[:hpp_url], method: :post) do
1
+ = effective_form_with(scope: :moneris, url: EffectiveOrders.moneris[:hpp_url], method: :post) do |f|
2
2
  = hidden_field_tag(:ps_store_id, EffectiveOrders.moneris[:ps_store_id])
3
3
  = hidden_field_tag(:hpp_key, EffectiveOrders.moneris[:hpp_key])
4
4
  = hidden_field_tag(:lang, 'en-ca')
@@ -44,4 +44,4 @@
44
44
  = hidden_field_tag(:ship_postal_code, address.postal_code)
45
45
  = hidden_field_tag(:ship_country, address.country)
46
46
 
47
- = submit_tag order_checkout_label(:moneris), class: 'btn btn-primary', data: { disable_with: 'Continuing...' }
47
+ = f.submit order_checkout_label(:moneris), border: false
@@ -1,5 +1,5 @@
1
- = form_tag(EffectiveOrders.paypal[:paypal_url], method: :post) do
2
- = hidden_field_tag :cmd, '_s-xclick'
3
- = hidden_field_tag :encrypted, paypal_encrypted_payload(order)
1
+ = effective_form_with(scope: :paypal, url: EffectiveOrders.paypal[:paypal_url], method: :post) do |f|
2
+ = hidden_field_tag(:cmd, '_s-xclick')
3
+ = hidden_field_tag(:encrypted, paypal_encrypted_payload(order))
4
4
 
5
- = submit_tag order_checkout_label(:paypal), class: 'btn btn-primary', data: { disable_with: 'Continuing...' }
5
+ = f.submit order_checkout_label(:paypal), border: false
@@ -1,2 +1,2 @@
1
- = form_tag(effective_orders.pretend_order_path(order, purchased_url: purchased_url, declined_url: declined_url), method: :post) do
2
- = submit_tag order_checkout_label(:pretend), class: 'btn btn-primary', data: { disable_with: 'Continuing...' }
1
+ = effective_form_with(scope: :pretend, url: effective_orders.pretend_order_path(order, purchased_url: purchased_url, declined_url: declined_url), method: :post) do |f|
2
+ = f.submit order_checkout_label(:pretend), border: false
@@ -1,9 +1,11 @@
1
1
  %h1.effective-heading= @page_title
2
2
 
3
3
  %p.effective-orders-page-content
4
- = link_to 'Home', root_path, class: 'btn btn-primary'
4
+ = link_to 'Home', root_path
5
5
 
6
6
  %p.effective-orders-page-content
7
7
  You have successfully purchased the following:
8
8
 
9
9
  = render @order
10
+
11
+ = link_to 'Continue', root_path, class: 'btn btn-primary'
@@ -1,5 +1,5 @@
1
- .panel.panel-default
2
- .panel-body
1
+ .card
2
+ .card-body
3
3
  %h2 Admin: Complete Refund
4
4
 
5
5
  = effective_form_with(model: order, url: effective_orders.refund_order_path(order), method: :post) do |f|
@@ -23,6 +23,4 @@
23
23
 
24
24
  = f.text_area :note_to_buyer, hint: 'This is displayed to the buyer on all order receipts.'
25
25
 
26
- .text-right
27
- = f.submit order_checkout_label(:refund), class: 'btn btn-primary'
28
-
26
+ = f.submit order_checkout_label(:refund)
@@ -4,4 +4,5 @@
4
4
  = effective_form_with(model: @stripe_charge || Effective::Providers::StripeCharge.new(order: order), url: effective_orders.stripe_charge_orders_path) do |f|
5
5
  = f.hidden_field :stripe_token
6
6
  = f.hidden_field :effective_order_id
7
- = f.submit order_checkout_label(:stripe), class: 'btn btn-primary'
7
+
8
+ = f.submit order_checkout_label(:stripe), border: false
@@ -110,6 +110,8 @@ class CreateEffectiveOrders < ActiveRecord::Migration[4.2]
110
110
  t.integer :price
111
111
  t.boolean :tax_exempt, :default => false
112
112
 
113
+ t.string :qb_item_name
114
+
113
115
  t.timestamps
114
116
  end
115
117
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '4.0.0beta2'.freeze
2
+ VERSION = '4.0.0beta3'.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: 4.0.0beta2
4
+ version: 4.0.0beta3
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: 2018-03-27 00:00:00.000000000 Z
11
+ date: 2018-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails