effective_orders 5.1.6 → 5.1.7

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: '063584ca12ed4cb46363a9c7c99f729889bf536eb0a1afb6021e04f07349532b'
4
- data.tar.gz: 313908b8ff6797d96c7139a3598b6790a3fda9fb358e69a240e0ccb5afcd8569
3
+ metadata.gz: 642b6831172be548e28cec2adf8c2f13f75ec9ef9af0e1cb15ee48cb763e3edc
4
+ data.tar.gz: ce4111bbaf7d8fb7a50e16c7ff8a0a43ae412586d2c7063a9c6e910d1337fbc4
5
5
  SHA512:
6
- metadata.gz: 71a032b3e32b4387801d3630e58df4ee9b91f890a0d87e42c1c4eacb5cb49875e7494316089c01d9d9bdf8a10e246d09caa8d4d2bb400897221661957fc63034
7
- data.tar.gz: 7149e03e2c5f5f830a53f235eafd6c712213d5dd6eb4958554d752e7f8e51d124188cebe432284a8ddde462e2fd5ff7ec21999a00465220fbc9d4cb5f5a84a08
6
+ metadata.gz: a7e2f6adabe417e43819f95c46e12dcc2c36680c82bedc870041a7665a700428428888927eb35b1dca18ab89d3d695b03183edc3cb35be3e1406f3befa0eee80
7
+ data.tar.gz: 5650b3ed6960e16d3c630be6697ab9fe69084122a543f2cbbfec875a6defa3fefeb0bb19655affcaadbb4b15e074d5191579aead15107a91f447b401ae31f2aa
@@ -203,9 +203,21 @@ module Effective
203
203
  # Duplicate an existing order
204
204
  self.note_to_buyer ||= item.note_to_buyer
205
205
  self.note_internal ||= item.note_internal
206
+ self.cc ||= item.cc
206
207
 
207
208
  item.order_items.select { |oi| oi.purchasable.kind_of?(Effective::Product) }.map do |oi|
208
- product = Effective::Product.new(name: oi.purchasable.purchasable_name, price: oi.purchasable.price, tax_exempt: oi.purchasable.tax_exempt)
209
+ purchasable = oi.purchasable
210
+
211
+ product = Effective::Product.new(name: purchasable.purchasable_name, price: purchasable.price, tax_exempt: purchasable.tax_exempt)
212
+
213
+ # Copy over any extended attributes that may have been created
214
+ atts = purchasable.dup.attributes.except('name', 'price', 'tax_exempt', 'purchased_order_id').compact
215
+
216
+ atts.each do |k, v|
217
+ next unless product.respond_to?("#{k}=") && product.respond_to?(k)
218
+ product.send("#{k}=", v) if product.send(k).blank?
219
+ end
220
+
209
221
  Effective::CartItem.new(quantity: oi.quantity, purchasable: product)
210
222
  end
211
223
  else
@@ -283,6 +295,10 @@ module Effective
283
295
  [card, '-', last4].compact.join(' ')
284
296
  end
285
297
 
298
+ def duplicate
299
+ Effective::Order.new(self)
300
+ end
301
+
286
302
  # For moneris and moneris_checkout. Just a unique value.
287
303
  def transaction_id
288
304
  [to_param, billing_name.to_s.parameterize.presence, Time.zone.now.to_i].compact.join('-')
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '5.1.6'.freeze
2
+ VERSION = '5.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: 5.1.6
4
+ version: 5.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: 2021-09-07 00:00:00.000000000 Z
11
+ date: 2021-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails