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
Add ransackable attrs to StoreCredit
Aleksandar Petrusheva7b37d5c24ac
diff --git a/api/spec/integration/api/v2/platform/store_credits_spec.rb b/api/spec/integration/api/v2/platform/store_credits_spec.rbindex 3be71d15e4..aacb65959b 100644--- a/api/spec/integration/api/v2/platform/store_credits_spec.rb+++ b/api/spec/integration/api/v2/platform/store_credits_spec.rb@@ -6,8 +6,8 @@ describe 'Store Credits API', swagger: true doresource_name = 'Store Credit'options = {include_example: 'user,created_by,category,credit_type',- filter_examples: [{ name: 'filter[user_id_eq]', example: 5 },- { name: 'filter[created_by_id_eq]', example: 2 },+ filter_examples: [{ name: 'filter[user_id_eq]', example: '5' },+ { name: 'filter[created_by_id_eq]', example: '2' },{ name: 'filter[amount_gteq]', example: 50.0 },{ name: 'filter[currency_eq]', example: 'USD' }]}diff --git a/core/app/models/spree/store_credit.rb b/core/app/models/spree/store_credit.rbindex 1024fae9cc..d8887d9199 100644--- a/core/app/models/spree/store_credit.rb+++ b/core/app/models/spree/store_credit.rb@@ -42,6 +42,8 @@ module Spreeextend Spree::DisplayMoneymoney_methods :amount, :amount_used+ self.whitelisted_ransackable_attributes = %w[user_id created_by_id amount currency type_id store_id]+def amount_remainingamount - amount_used - amount_authorizedend