Enterprise have access to the internal payment method by default.
The access is handled at the application level so we don't have to
manage database links.
Add extra security, we don't want to void a credit payment that is not
completed, otherwise we would be refunding credit that was not used.
A credit payment should not be in a non completed state, but you never
know.
It's now called as a before transition callback when the order move to
payment. We need to apply the credit at this point to account for
order fees, ie: shippment fees.
Currently it works like any other payment method you can select on
checkout. It will eventually be added automatically to the order, when a
customer has credit available.
Inspecting 1721 files
...................................C.................................................................................................................................................................................................................................................................................................................................................C...................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Offenses:
app/controllers/admin/enterprises_controller.rb:180:7: C: [Corrected] Rails/Presence: Use @object.custom_tab.presence&.destroy instead of @object.custom_tab.destroy if @object.custom_tab.present?.
@object.custom_tab.destroy if @object.custom_tab.present?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/enterprises_controller.rb:243:9: C: [Corrected] Rails/Presence: Use (enterprises.presence&.includes(supplied_products: [:variants, :image])) instead of if enterprises.present? ... end.
if enterprises.present? ...
^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/admin/enterprises_controller.rb:243:9: C: [Corrected] Style/RedundantParentheses: Don't use parentheses around a method call.
(enterprises.presence&.includes(supplied_products: [:variants, :image]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/spree/product.rb:298:7: C: [Corrected] Rails/Presence: Use (first_variant.supplier.presence&.touch) instead of first_variant.supplier.touch if first_variant.supplier.present?.
first_variant.supplier.touch if first_variant.supplier.present?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/spree/product.rb:298:7: C: [Corrected] Style/RedundantParentheses: Don't use parentheses around a method call.
(first_variant.supplier.presence&.touch)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1721 files inspected, 5 offenses detected, 5 offenses corrected
13220 Fixes affiliate sales spec
13220 Use before_create to update product name
13220 Fixes rubocop warnings
13220 Update product_name in line_item in specs
13220 Fix before_create lint
13220 Add spec for checking product_name is not set in reports
13220 Fixes rubocop issue
13220 Add migrations for updating the existing line items
13220 Fixing lint issues
13220 Set product_name in line_item before doing validation
13220 Fix linter issues
13220 Fixes spec
13220 Fixes linter issues
13220 Review comments
13220 Review comments
13220 Add default product name
13220 Use product_name instead of variant product name when using line item
13220 Fix specs
13220 Revert change in affiliate_sales_data_spec
CL-13220 Store variant name in line_item
13220 Default variant name to original variant's full name for line_items
13220 Add missing frozen string literal
13220 Add spec for full_variant_name
13220 Remove UpdateProductNameInLineItems and AddNotNullToProductNameInLineItems migrations
13220 Remove presence validation for product_name
13220 Use full_product_name which defaults to variant product name if empty