effective_orders 2.1.6 → 2.1.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f067a482a08a63b26a23649c3ff1cbeabdf5a3c9
4
- data.tar.gz: b1c1adc7ce23f8196a072155261e3a9139761d0f
3
+ metadata.gz: 241819ceeb137196d59b1383c99ff092e65e1fa7
4
+ data.tar.gz: d79d5f2798e61e92ab25f686f1db9624d2706dec
5
5
  SHA512:
6
- metadata.gz: 253b5d1cb1877f869558aceaf15be0230f896bddc419821d3bb322a00aff98f576db9103ad8829fe08706a1dca1d2aa03d39398a558b4cad9999a7ec97dce2e7
7
- data.tar.gz: 2f0d3b522ad5c12632f9d6263459b13a26e2064a1ae838aa9a41dac3fc183a6998207f3937c1dabf6a08c7d47f0010c19cf4b20b828a4fe4a358c6232622efa1
6
+ metadata.gz: c74dcef00e1d2506b7a425582b3b51eaee276c007861e90ea5a275b78d1e40ff089332c7c084bf4cb63aaf9126b1004f146a68f2dfa3a24e00ba7c345f37f115
7
+ data.tar.gz: 1087399127980e9089fb2f1dd41d5d01eb2a850ac4f96e6074b82540b7f8ea4214aca1b0404ecba099cd6de13367c5a6bc192af83052cfd37d47d1c21615bae8
data/README.md CHANGED
@@ -793,12 +793,14 @@ Order totals ending in .05 will be Declined
793
793
 
794
794
  And there's a whole bunch more. Please refer to:
795
795
 
796
- https://www.google.ca/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CB8QFjAA&url=https%3A%2F%2Fcartthrob.com%2F%3FACT%3D50%26fid%3D25%26aid%3D704_jvVKOeo1a8d3aSYeT3R4%26board_id%3D1&ei=_p1OVOysEpK_sQTZ8oDgCg&usg=AFQjCNHJGH_hEm4kUJAzkvKrzTqEpFnrgA&sig2=XJdE6PZoOY9habWH_B4uWA&bvm=bv.77880786,d.cWc&cad=rja
796
+ https://www.collinsharper.com/downloadable/download/sample/sample_id/5/
797
797
 
798
798
  2. Moneris will not process a duplicate order ID
799
799
 
800
800
  Once Order id=1 has been purchased/declined, you will be unable to purchase an order with id=1 ever again.
801
801
 
802
+ effective_orders works around this by appending a timestamp to the order ID.
803
+
802
804
 
803
805
  ## Paying via Stripe
804
806
 
@@ -4,13 +4,13 @@ module Effective
4
4
  extend ActiveSupport::Concern
5
5
 
6
6
  included do
7
- if defined?(CanCan)
8
- skip_authorization_check only: [:app_checkout]
9
- end
10
7
  end
11
8
 
12
9
  def app_checkout
13
10
  @order = Order.find(params[:id])
11
+
12
+ (EffectiveOrders.authorized?(self, :update, @order) rescue false)
13
+
14
14
  checkout = EffectiveOrders.app_checkout[:service].call(order: @order)
15
15
  if checkout.success?
16
16
  order_purchased(details: payment_details(checkout), provider: 'app_checkout', card: 'none')
@@ -5,16 +5,14 @@ module Effective
5
5
 
6
6
  included do
7
7
  skip_before_filter :verify_authenticity_token, only: [:ccbill_postback]
8
-
9
- if defined?(CanCan)
10
- skip_authorization_check only: [:ccbill_postback]
11
- end
12
8
  end
13
9
 
14
10
  def ccbill_postback
15
11
  postback = Effective::Providers::CcbillPostback.new(params)
16
12
  @order ||= Effective::Order.find(postback.order_id)
17
13
 
14
+ (EffectiveOrders.authorized?(self, :update, @order) rescue false)
15
+
18
16
  if @order.present? && postback.verified?
19
17
  if @order.purchased?
20
18
  order_purchased(details: postback.order_details, provider: 'ccbill')
@@ -10,7 +10,7 @@ module Effective
10
10
  def moneris_postback
11
11
  @order ||= Effective::Order.find(params[:response_order_id])
12
12
 
13
- EffectiveOrders.authorized?(self, :update, @order)
13
+ (EffectiveOrders.authorized?(self, :update, @order) rescue false)
14
14
 
15
15
  # Delete the Purchased and Declined Redirect URLs
16
16
  purchased_redirect_url = params.delete(:rvar_purchased_redirect_url)
@@ -5,15 +5,13 @@ module Effective
5
5
 
6
6
  included do
7
7
  skip_before_filter :verify_authenticity_token, :only => [:paypal_postback]
8
-
9
- if defined?(CanCan)
10
- skip_authorization_check only: [:paypal_postback]
11
- end
12
8
  end
13
9
 
14
10
  def paypal_postback
15
11
  @order ||= Effective::Order.where(id: (params[:invoice].to_i rescue 0)).first
16
12
 
13
+ (EffectiveOrders.authorized?(self, :update, @order) rescue false)
14
+
17
15
  if @order.present?
18
16
  if @order.purchased?
19
17
  order_purchased(details: params, provider: 'paypal', card: params[:payment_type])
@@ -1,10 +1,12 @@
1
1
  module EffectiveOrdersHelper
2
- def price_to_currency(price)
2
+ def price_to_currency(price, options = {})
3
3
  raise 'price_to_currency expects an Integer representing the number of cents in a price' unless price.kind_of?(Integer)
4
- number_to_currency(price / 100.0)
4
+ options[:precision] ||= 2
5
+ number_to_currency(price / 100.0, options)
5
6
  end
6
7
 
7
- def tax_rate_to_percentage(tax_rate)
8
+ def tax_rate_to_percentage(tax_rate, options = {})
9
+ options[:strip_insignificant_zeros] = true if options[:strip_insignificant_zeros].nil?
8
10
  number_to_percentage(tax_rate, strip_insignificant_zeros: true)
9
11
  end
10
12
 
@@ -13,7 +13,7 @@
13
13
  = hidden_field_tag(:email, order.user.try(:email))
14
14
  = hidden_field_tag(:cust_id, order.user.to_param)
15
15
 
16
- = hidden_field_tag(:order_id, [order.to_param, order.billing_name.try(:parameterize).presence].compact.join('-'))
16
+ = hidden_field_tag(:order_id, [order.to_param, order.billing_name.try(:parameterize).presence, Time.zone.now.to_i].compact.join('-'))
17
17
  = hidden_field_tag(:gst, '%.2f' % (order.tax / 100.0))
18
18
  = hidden_field_tag(:charge_total, '%.2f' % (order.total / 100.0))
19
19
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '2.1.6'.freeze
2
+ VERSION = '2.1.7'.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: 2.1.6
4
+ version: 2.1.7
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: 2016-04-15 00:00:00.000000000 Z
11
+ date: 2016-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails