effective_orders 6.16.3 → 6.17.0

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: 5d05df34a90172ec81cc5cae1f0cc206236358f70601c644e0468bd860d2481f
4
- data.tar.gz: f5f8d8a13a508f10f88d3a45ce3aaebe7280830228900cd53b4025fd2e7d0f28
3
+ metadata.gz: bcd28b8d2dda1a9982419e2cfbb46de103d59de912ba3c95de4bd213389708cc
4
+ data.tar.gz: 216dab4a26eeeef06bf80b6a71e462ea0834bb084037bd9116b1057e68e8933c
5
5
  SHA512:
6
- metadata.gz: c7957c31b1eacf9f6119f327f541636c65ec738742f9dff5c2e2363ebea81d1be1126a58ae8f024489abb0038b7e94159cdca4d91b10160a1c8ad1e12d4c68a5
7
- data.tar.gz: ccce3f3ccbfa90884daa1259ddbf1f4d13afce92d05fdaa57acf6f1b1b0b69f18b2d155fc18c39c34d38a9e90c2d976cb34fbe448d174e6f8fc3d3bc2ff86ec2
6
+ metadata.gz: e8408c08ee2d9efaa894f53b3f01431410a8888af0cd0f37cca76b7bf429ad8fbe925eb239dd5d3db0a9b4f90459d7360a26fdd0e3d0d1a4a7d6da81c43d0011
7
+ data.tar.gz: 143ab80fe0744376ba4f3b2bbe1b66a4bbb5971de311cca4953458f983cd0f98fc263255a1d2bea249e0eb14c0301ec62ce2c5df6e0c1a33ab591090a5d5c01f
@@ -49,14 +49,47 @@ module ActsAsPurchasable
49
49
  validates_with Effective::SoldOutValidator, on: :create
50
50
  end
51
51
 
52
- scope :purchased, -> { where.not(purchased_order_id: nil) }
53
- scope :not_purchased, -> { where(purchased_order_id: nil) }
54
-
55
- scope :purchased_by, lambda { |user| joins(order_items: :order).where(orders: { purchased_by: user, status: :purchased }).distinct }
56
- scope :not_purchased_by, lambda { |user| where.not(id: purchased_by(user)) }
57
-
58
- scope :purchased_or_deferred, -> { joins(order_items: :order).where(orders: { status: [:purchased, :deferred] }) }
59
- scope :deferred, -> { joins(order_items: :order).where(orders: { status: :deferred }) }
52
+ scope :purchased, -> {
53
+ if respond_to?(:unarchived)
54
+ unarchived.where.not(purchased_order_id: nil)
55
+ else
56
+ where.not(purchased_order_id: nil)
57
+ end
58
+ }
59
+
60
+ scope :not_purchased, -> {
61
+ if respond_to?(:unarchived)
62
+ unarchived.where(purchased_order_id: nil)
63
+ else
64
+ where(purchased_order_id: nil)
65
+ end
66
+ }
67
+
68
+ scope :purchased_or_deferred, -> {
69
+ if respond_to?(:unarchived)
70
+ unarchived.joins(order_items: :order).where(orders: { status: [:purchased, :deferred] })
71
+ else
72
+ joins(order_items: :order).where(orders: { status: [:purchased, :deferred] })
73
+ end
74
+ }
75
+
76
+ scope :deferred, -> {
77
+ if respond_to?(:unarchived)
78
+ unarchived.joins(order_items: :order).where(orders: { status: :deferred })
79
+ else
80
+ joins(order_items: :order).where(orders: { status: :deferred })
81
+ end
82
+ }
83
+
84
+ scope :purchased_by, -> (user) {
85
+ if respond_to?(:unarchived)
86
+ unarchived.joins(order_items: :order).where(orders: { purchased_by: user, status: :purchased }).distinct
87
+ else
88
+ joins(order_items: :order).where(orders: { purchased_by: user, status: :purchased }).distinct
89
+ end
90
+ }
91
+
92
+ scope :not_purchased_by, -> (user) { where.not(id: purchased_by(user)) }
60
93
  end
61
94
 
62
95
  module ClassMethods
@@ -271,7 +271,7 @@ module Effective
271
271
  paymentMethod: paymentMethod,
272
272
  shippingAddress: shippingAddress,
273
273
  customData: customData,
274
- merchantCategory: "E-Commerce",
274
+ merchantCategory: "MOTO",
275
275
  orderData: orderData
276
276
  }.compact
277
277
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '6.16.3'.freeze
2
+ VERSION = '6.17.0'.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.16.3
4
+ version: 6.17.0
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: 2024-10-10 00:00:00.000000000 Z
11
+ date: 2024-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails