Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Working settings off store based JSON settings.
Matthew Kennedy38cbaa4c4bbf
diff --git a/core/app/models/spree/digital_link.rb b/core/app/models/spree/digital_link.rbindex f512e95eb5..61c12e41c9 100644--- a/core/app/models/spree/digital_link.rb+++ b/core/app/models/spree/digital_link.rb@@ -8,18 +8,16 @@ module Spreebefore_validation :set_defaults, on: :createvalidates :digital, presence: true- # Can this link stil be used? It is valid if it's less than 24 hours- # old and was not accessed more than 3 timesdef authorizable?!(expired? || access_limit_exceeded?)enddef expired?- created_at <= Spree::DigitalConfiguration[:authorized_days].day.ago+ created_at <= line_item.order.store.digital_asset_authorized_days.day.agoenddef access_limit_exceeded?- access_counter >= Spree::DigitalConfiguration[:authorized_clicks]+ access_counter >= line_item.order.store.digital_asset_authorized_clicksend# This method should be called when a download is initiated.diff --git a/core/app/models/spree/store.rb b/core/app/models/spree/store.rbindex 9e9658ddb6..a75e154bf3 100644--- a/core/app/models/spree/store.rb+++ b/core/app/models/spree/store.rb@@ -1,6 +1,5 @@module Spreeclass Store < Spree::Base- # Spree Store Settingstyped_store :settings do |s|# Spree Digital Asset Configurationss.integer :digital_asset_authorized_clicks, default: 3, null: false # number of times a customer can download a digital file.diff --git a/core/lib/spree/permitted_attributes.rb b/core/lib/spree/permitted_attributes.rbindex cda262ab20..5c772d6154 100644--- a/core/lib/spree/permitted_attributes.rb+++ b/core/lib/spree/permitted_attributes.rb@@ -93,7 +93,8 @@ module Spree@@property_attributes = [:name, :presentation]- @@return_authorization_attributes = [:amount, :memo, :stock_location_id, :inventory_units_attributes, :return_authorization_reason_id]+ @@return_authorization_attributes = [:amount, :memo, :stock_location_id, :inventory_units_attributes,+ :return_authorization_reason_id]@@shipment_attributes = [:order, :special_instructions, :stock_location_id, :id,@@ -124,7 +125,9 @@ module Spree:customer_support_email, :facebook, :twitter, :instagram,:description, :address, :contact_phone, :supported_locales,:default_locale, :default_country_id, :supported_currencies,- :new_order_notifications_email, :mailer_logo, :favicon_image, :checkout_zone_id, :seo_robots]+ :new_order_notifications_email, :mailer_logo, :favicon_image,+ :checkout_zone_id, :seo_robots, :digital_asset_authorized_clicks,+ :digital_asset_authorized_days]@@store_credit_attributes = %i[amount currency category_id memo]