caboose-cms 0.9.221 → 0.9.222

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
  SHA256:
3
- metadata.gz: c4ab4ced3bffac044477484005c6cfa97aafba645d26478ad71f66cad28ed76c
4
- data.tar.gz: 4644ad39de9e7ba1e2991285add45128e8a53e76b6a3b60cb7bd6d5b1d8fe8aa
3
+ metadata.gz: 5c84afb7cc5487f8ac8629eed63ff40539434e7bf63eaf330720d9869791b193
4
+ data.tar.gz: b3173175ca81d406f33b1bfc8772b390f09f34c23d7c7ebf7dca47fb7459bdac
5
5
  SHA512:
6
- metadata.gz: 3a36d740c046e87b17a871926f14790c641a7c2ebfd36b1f71a8c152dd9838c46a148bd2b54d46dba67963369232dad06a6702f1dce4de7c75380634f31105b2
7
- data.tar.gz: 92be7559a27e9ce83d198c4201eff8223b4884b4988021022a3f900ddc846e42f5adc8e7ef4bd3b6db3cfd71e23e261b373f02f1e5028c2b2e4f3785044088d7
6
+ metadata.gz: 759382d9241f48b78b766c02d50b6a00db55fd313114cc45ce1803d9a82456fbb9a970252f161825a31bbcb2e1db6649fb73122eb83b94ce753ba62b3bc9c153
7
+ data.tar.gz: c9905dea84074577dc189b0c26acbfb2375ef163877be7dbbb2918a1afa57bf5c4ced51d55dcaced11a4d019802906f6fd1884a81bc0cc60a94c255f65f50b78
@@ -242,7 +242,7 @@ module Caboose
242
242
  :amount => (@invoice.total * 100).to_i,
243
243
  :currency => 'usd',
244
244
  :customer => logged_in_user.stripe_customer_id,
245
- :capture => false,
245
+ :capture => sc.auto_capture,
246
246
  :metadata => { :invoice_id => @invoice.id },
247
247
  :statement_descriptor => "Invoice ##{@invoice.id}"
248
248
  )
@@ -265,14 +265,15 @@ module Caboose
265
265
  render :json => { :error => error }
266
266
  return
267
267
  else
268
- @invoice.financial_status = Invoice::FINANCIAL_STATUS_AUTHORIZED
268
+ @invoice.financial_status = sc.auto_capture ? Invoice::FINANCIAL_STATUS_CAPTURED : Invoice::FINANCIAL_STATUS_AUTHORIZED
269
269
  @invoice.take_gift_card_funds
270
270
  end
271
271
  end
272
272
 
273
- @invoice.status = Invoice::STATUS_PENDING
273
+ @invoice.status = sc.auto_capture ? Invoice::STATUS_PROCESSED : Invoice::STATUS_PENDING
274
274
  @invoice.invoice_number = @site.store_config.next_invoice_number
275
275
 
276
+
276
277
  # Update variant limits to reflect this purchase
277
278
  @invoice.line_items.each do |li|
278
279
  vl = VariantLimit.where(:user_id => @invoice.customer_id, :variant_id => li.variant_id).first
@@ -297,6 +298,7 @@ module Caboose
297
298
 
298
299
  # Save the invoice
299
300
  @invoice.save
301
+ @invoice.refresh_transactions if sc.auto_capture
300
302
 
301
303
  # Decrement quantities of variants
302
304
  @invoice.decrement_quantities
@@ -128,7 +128,8 @@ module Caboose
128
128
  when 'starting_invoice_number' then sc.starting_invoice_number = value
129
129
  when 'default_payment_terms' then sc.default_payment_terms = value
130
130
  when 'allow_instore_pickup' then sc.allow_instore_pickup = value
131
-
131
+ when 'auto_capture' then sc.auto_capture = value
132
+
132
133
  when 'product_vendor_id' then pd.vendor_id = value
133
134
  when 'product_option1' then pd.option1 = value
134
135
  when 'product_option2' then pd.option2 = value
@@ -1007,7 +1007,8 @@ class Caboose::Schema < Caboose::Utilities::Schema
1007
1007
  [ :default_taxable , :boolean ],
1008
1008
  [ :allow_instore_pickup , :boolean , { :default => false }],
1009
1009
  [ :instore_tax_rate , :decimal , { :precision => 8, :scale => 2 }],
1010
- [ :custom_invoice_pdf , :string ]
1010
+ [ :custom_invoice_pdf , :string ],
1011
+ [ :auto_capture , :boolean , { :default => false }]
1011
1012
  ],
1012
1013
  Caboose::Subscription => [
1013
1014
  [ :site_id , :integer ],
@@ -48,7 +48,8 @@ module Caboose
48
48
  :download_instructions,
49
49
  :weight_unit,
50
50
  :allow_instore_pickup,
51
- :custom_invoice_pdf
51
+ :custom_invoice_pdf,
52
+ :auto_capture
52
53
 
53
54
  WEIGHT_UNIT_METRIC = 'g'
54
55
  WEIGHT_UNIT_IMPERIAL = 'oz'
@@ -10,6 +10,7 @@ sc = @store_config
10
10
  <p><div id='storeconfig_<%= sc.id %>_download_url_expires_in' ></div></p>
11
11
  <p><div id='storeconfig_<%= sc.id %>_starting_invoice_number' ></div></p>
12
12
  <p><div id='storeconfig_<%= sc.id %>_default_payment_terms' ></div></p>
13
+ <p><div id='storeconfig_<%= sc.id %>_auto_capture' ></div></p>
13
14
 
14
15
  <h3 style="margin-bottom:5px;">Dimension Units</h3>
15
16
  <div id='storeconfig_<%= sc.id %>_length_unit' ></div>
@@ -50,7 +51,8 @@ $(document).ready(function() {
50
51
  { name: 'download_url_expires_in' , nice_name: 'Download URL Expires In (minutes)' , type: 'text' , value: <%= raw Caboose.json(sc.download_url_expires_in ) %>, width: 400 },
51
52
  { name: 'starting_invoice_number' , nice_name: 'Starting Invoice Number' , type: 'text' , value: <%= raw Caboose.json(sc.starting_invoice_number ) %>, width: 400 },
52
53
  { name: 'download_instructions' , nice_name: 'Download Instructions' , type: 'textarea' , value: <%= raw Caboose.json(sc.download_instructions ) %>, width: 800 , height: 200, fixed_placeholder: false },
53
- { name: 'default_payment_terms' , nice_name: 'Default Payment Terms' , type: 'select' , value: <%= raw Caboose.json(sc.default_payment_terms ) %>, width: 400 , options_url: '/admin/store/default-payment-terms-options' }
54
+ { name: 'default_payment_terms' , nice_name: 'Default Payment Terms' , type: 'select' , value: <%= raw Caboose.json(sc.default_payment_terms ) %>, width: 400 , options_url: '/admin/store/default-payment-terms-options' },
55
+ { name: 'auto_capture' , nice_name: 'Capture Funds Automatically' , type: 'checkbox' , value: <%= raw Caboose.json(sc.auto_capture ) %>, width: 400 }
54
56
  ]
55
57
  });
56
58
 
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.9.221'
2
+ VERSION = '0.9.222'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.221
4
+ version: 0.9.222
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-26 00:00:00.000000000 Z
11
+ date: 2019-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg