-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Merge solidus_starter_frontend into the monorepo #6468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 250 commits
032a91f
1c9673e
fdb8f15
b3360c7
77d356c
f067360
32d01e2
643e74a
378d10c
8dbf671
60ea6ab
d844f56
bcb9bd6
d8fb74a
7cf7e76
4921291
3e5c2f5
a3e9afc
56fc608
dfd9d2a
bb1039e
9634c37
d6f6c1f
1a2889f
2e44a8b
bc3f3f2
12b687b
016e4fc
b10bd0e
0a24c9d
6a7f611
7e72e1a
9f84ad7
75fcd69
7b9dda1
d554de2
402f545
4e423d2
71a9bf9
e3632ae
89472c5
1dd2ced
cb37ed4
0e17655
40d8947
46edf45
c44af61
74c8176
be9d99c
9c0e6c6
ef472d5
b9a02e1
01ee95b
bb1f2a0
9c27457
3958bd1
a4123ba
56dae24
eaadb0b
c9d981c
f3e1726
dc028e7
ecdc45f
df9a4a8
7a40215
09c253e
b9a9a50
ab49030
e78d2cb
dc83686
6620766
1d41ded
bbd7dca
faff335
5ecd5a6
8a32a2a
f029484
9d3bfcd
dbc9059
2b2755c
628e30b
51f18db
9c3fe46
362c150
7540c70
f743a65
72e6ce2
ce450b7
d3f2d83
be2126d
22ca260
e3d9dbc
e688d59
f3475cd
98d44ec
281c6ef
53d2aa2
e660dc3
5f43674
aedcb90
43adcfc
4e9e4b0
921371d
665084d
91fb279
81736de
6e2f055
7a59129
4d4dad0
33d46c7
f3e5675
497e27d
1774931
c6d1c04
4a8070f
2f44ab4
2a1f838
67edde5
f9950a4
b40cf05
8e003e7
8d8afda
96aa506
c368c16
f624bec
42ef9cc
13b160c
9f888f3
880acf3
386d607
141173d
bb0ed35
e6c6ede
e28df85
46d09eb
4bd0a94
1056709
6c8b687
6255e88
5c2e8eb
6a0190c
7d3497c
b247660
4f86a95
9f6d397
65126b7
99a8930
cf8f4e1
9297b7f
f2a5c57
27f3906
866a2f9
9be80e5
6f78024
5b7a761
1b887a2
aea1e08
652caa6
c27046b
a562752
c20a1f0
a54affb
523f59e
2e9717a
13c293b
e34dba7
789cce3
72fa0d2
e816468
69b56cc
760b9dd
17073c9
a49bf70
a8f8d4f
4ccb36f
ab13d97
4d208a2
70fd2fe
134943d
0e5ea40
635e707
4e24858
20b85b6
6c988b9
4c5e9cc
6e11515
b167723
8bed972
873ac2c
165a2df
1935414
1bcd3b3
275685c
331e0d7
39e25c7
be2d72b
9b33d87
87bbabd
8442d20
8945115
b341bde
1de3888
54ed595
685c7fa
cce35c5
6de294e
75cd6bc
094bbab
6658635
48de0ea
43b268e
c5a9794
771d3c5
1d77fef
d5ca648
f3d3801
d572ec4
7d04046
4053965
2adf47e
599bc57
707d9be
8c170a8
899f7d4
2830178
0a921bc
25e4899
c987918
0f7b3d5
901768e
1919206
1434c02
0ba6368
c5686f0
57e3262
5b1bea3
12dcb68
7544475
b11d37c
a0e18fc
6b2f199
b792964
fd74c07
bcd60d2
93289d0
84789af
61a70e8
a253832
afe8e98
50d6111
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,4 +3,4 @@ format: progress | |
| ruby_version: 3.1 | ||
| ignore: | ||
| - "*/spec/dummy/**/*" | ||
| - "sandbox/**/*" | ||
| - "**/sandbox/**/*" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ class PaymentsController < Spree::Admin::BaseController | |
| before_action :load_payment, except: [:create, :new, :index, :fire] | ||
| before_action :load_payment_for_fire, only: :fire | ||
| before_action :load_data | ||
| before_action :load_log_entries, only: [:show] | ||
| before_action :require_bill_address, only: [:index] | ||
|
|
||
| helper ::Spree::Admin::OrdersHelper | ||
|
|
@@ -102,6 +103,13 @@ def load_payment | |
| @payment = Spree::Payment.find(params[:id]) | ||
| end | ||
|
|
||
| def load_log_entries | ||
| @all_log_entries = Spree::LogEntry | ||
| .where(source: @payment) | ||
| .or(Spree::LogEntry.where(source: @payment.refunds)) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Layout/MultilineMethodCallIndentation: Align .or with Spree::LogEntry on line 107. |
||
| .order(:created_at) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Layout/MultilineMethodCallIndentation: Align .order with Spree::LogEntry on line 107. |
||
| end | ||
|
|
||
| def load_payment_for_fire | ||
| load_payment | ||
| authorize! params[:e].to_sym, @payment | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,4 +53,29 @@ | |
| end | ||
| end | ||
| end | ||
|
|
||
| context "with a log entry belonging to a refund of the payment", :js do | ||
| let(:payment) { create(:payment, amount: 100) } | ||
| let(:refund) { create(:refund, payment:, amount: 10) } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lint/Syntax: unexpected token tCOMMA |
||
|
|
||
| before do | ||
| response = ActiveMerchant::Billing::Response.new( | ||
| true, | ||
| "Refund processed", | ||
| transid: "REFUND-1" | ||
| ) | ||
|
|
||
| refund.log_entries.create!(details: response.to_yaml) | ||
| end | ||
|
|
||
| it "shows the refund entry on the payment page with 'Refund' as its source" do | ||
| visit spree.admin_order_payments_path(payment.order) | ||
| click_on payment.number | ||
|
|
||
| within("#listing_log_entries") do | ||
| expect(page).to have_content("Refund processed") | ||
| expect(page).to have_content("Refund") | ||
| end | ||
| end | ||
| end | ||
| end | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,7 +22,10 @@ def display_amount | |
|
|
||
| def perform! | ||
| begin | ||
| shipments = Spree::Config.stock.coordinator_class.new(@order, @reimbursement_objects.map(&:build_exchange_inventory_unit)).shipments | ||
| shipments = Spree::Config.stock.coordinator_class.new( | ||
| @order, | ||
| inventory_units: @reimbursement_objects.map(&:build_exchange_inventory_unit) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Metrics/LineLength: Line is too long. [86/80] |
||
| ).shipments | ||
| rescue Spree::Order::InsufficientStock | ||
| raise UnableToCreateShipments.new("Could not generate shipments for all items. Out of stock?") | ||
| end | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -513,9 +513,9 @@ def create_proposed_shipments | |
| end | ||
|
|
||
| def create_shipments_for_line_item(line_item) | ||
| units = Spree::Config.stock.inventory_unit_builder_class.new(self).missing_units_for_line_item(line_item) | ||
| inventory_units = Spree::Config.stock.inventory_unit_builder_class.new(self).missing_units_for_line_item(line_item) | ||
|
|
||
| Spree::Config.stock.coordinator_class.new(self, units).shipments.each do |shipment| | ||
| Spree::Config.stock.coordinator_class.new(self, inventory_units:).shipments.each do |shipment| | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lint/Syntax: unexpected token tRPAREN |
||
| shipments << shipment | ||
| end | ||
| end | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,19 @@ | ||
| apply "https://github.com/solidusio/solidus_starter_frontend/raw/main/template.rb" | ||
| # frozen_string_literal: true | ||
|
|
||
| template = | ||
| ENV["SOLIDUS_STOREFRONT_TEMPLATE"] || | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. |
||
| begin | ||
| version = Spree.solidus_version if defined?(Spree) && Spree.respond_to?(:solidus_version) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Metrics/LineLength: Line is too long. [93/80] |
||
| gem_version = version ? Gem::Version.new(version) : nil | ||
|
|
||
| ref = | ||
| if gem_version && !gem_version.prerelease? | ||
| "v#{gem_version.segments[0, 2].join(".")}" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style/StringLiteralsInInterpolation: Prefer single-quoted strings inside interpolations. |
||
| else | ||
| "main" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. |
||
| end | ||
|
|
||
| "https://github.com/solidusio/solidus/raw/#{ref}/storefront/template.rb" | ||
| end | ||
|
|
||
| apply template | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module SolidusPromotions | ||
| module Conditions | ||
| class TaxonRevenue < Condition | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style/Documentation: Missing top-level class documentation comment. |
||
| include OrderLevelCondition | ||
| include TaxonCondition | ||
|
|
||
| preference :operator, :string, default: "gte" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. |
||
| preference :amount, :decimal, default: 0 | ||
| preference :currency, :string, default: -> { Spree::Config.currency } | ||
|
|
||
| OPERATORS = {"gte" => :>=, "gt" => :>, "lt" => :<, "lte" => :<=}.freeze | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Layout/SpaceInsideHashLiteralBraces: Space inside { missing. |
||
|
|
||
| def self.operator_options | ||
| OPERATORS.map do |name, _method| | ||
| [I18n.t(name, scope: [:solidus_promotions, :operators]), name] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style/SymbolArray: Use %i or %I for an array of symbols. |
||
| end | ||
| end | ||
|
|
||
| def order_eligible?(order, _options = {}) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Metrics/AbcSize: Assignment Branch Condition size for order_eligible? is too high. [15.03/15] |
||
| matching = order.line_items.select do |line_item| | ||
| taxon_ids_with_children.any? do |taxon_and_descendant_ids| | ||
| (line_item.variant.product.classifications.map(&:taxon_id) & taxon_and_descendant_ids).any? | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Metrics/LineLength: Line is too long. [103/80] |
||
| end | ||
| end | ||
| matching.sum(&:discounted_amount).public_send(OPERATORS.fetch(preferred_operator), preferred_amount) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Metrics/LineLength: Line is too long. [108/80] |
||
| end | ||
| end | ||
| end | ||
| end | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module SolidusPromotions | ||
| module InMemoryOrderUpdaterPatch | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style/Documentation: Missing top-level module documentation comment. |
||
| # This is only needed for stores upgrading from the legacy promotion system. | ||
| # Once we've removed support for the legacy promotion system, we can remove this. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Metrics/LineLength: Line is too long. [85/80] |
||
| def recalculate(persist: true) | ||
| if SolidusPromotions.config.sync_order_promotions | ||
| MigrationSupport::OrderPromotionSyncer.new(order: order).call | ||
| end | ||
| super | ||
| end | ||
|
|
||
| Spree::InMemoryOrderUpdater.prepend self | ||
| end | ||
| end | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module SolidusPromotions | ||
| module OrderRecalculatorPatch | ||
| module OrderUpdaterPatch | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style/Documentation: Missing top-level module documentation comment. |
||
| # This is only needed for stores upgrading from the legacy promotion system. | ||
| # Once we've removed support for the legacy promotion system, we can remove this. | ||
| def recalculate | ||
|
|
@@ -12,6 +12,5 @@ def recalculate | |
| end | ||
|
|
||
| Spree::OrderUpdater.prepend self | ||
| Spree::InMemoryOrderUpdater.prepend self | ||
| end | ||
| end | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/MultilineMethodCallIndentation: Align .where with Spree::LogEntry on line 107.