File tree Expand file tree Collapse file tree 8 files changed +145
-88
lines changed
app/models/solidus_importer Expand file tree Collapse file tree 8 files changed +145
-88
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ name : Lint
2+
3+ on : [pull_request]
4+
5+ concurrency :
6+ group : lint-${{ github.ref_name }}
7+ cancel-in-progress : ${{ github.ref_name != 'master' }}
8+
9+ permissions :
10+ contents : read
11+
12+ jobs :
13+ ruby :
14+ name : Check Ruby
15+ runs-on : ubuntu-24.04
16+ steps :
17+ - name : Checkout code
18+ uses : actions/checkout@v3
19+ - name : Install Ruby and gems
20+ uses : ruby/setup-ruby@v1
21+ with :
22+ ruby-version : " 3.4"
23+ bundler-cache : true
24+ - name : Lint Ruby files
25+ run : bundle exec rubocop -ESP
Original file line number Diff line number Diff line change 1+ name : Test
2+ on :
3+ push :
4+ branches :
5+ - master
6+ pull_request :
7+ schedule :
8+ - cron : " 0 0 * * 4" # every Thursday
9+ concurrency :
10+ group : test-${{ github.ref_name }}
11+ cancel-in-progress : ${{ github.ref_name != 'master' }}
12+ permissions :
13+ contents : read
14+ jobs :
15+ rspec :
16+ name : Solidus ${{ matrix.solidus-branch }}, Rails ${{ matrix.rails-version }} and Ruby ${{ matrix.ruby-version }} on ${{ matrix.database }}
17+ runs-on : ubuntu-24.04
18+ strategy :
19+ fail-fast : true
20+ matrix :
21+ rails-version :
22+ - " 7.2"
23+ - " 8.0"
24+ ruby-version :
25+ - " 3.2"
26+ - " 3.4"
27+ solidus-branch :
28+ - " v4.1"
29+ - " v4.2"
30+ - " v4.3"
31+ - " v4.4"
32+ - " v4.5"
33+ database :
34+ - " postgresql"
35+ - " mysql"
36+ - " sqlite"
37+ exclude :
38+ - rails-version : " 7.2"
39+ solidus-branch : " v4.3"
40+ - rails-version : " 7.2"
41+ solidus-branch : " v4.2"
42+ - rails-version : " 7.2"
43+ solidus-branch : " v4.1"
44+ - ruby-version : " 3.4"
45+ rails-version : " 7.0"
46+ - ruby-version : " 3.2"
47+ rails-version : " 8.0"
48+ - solidus-branch : " v4.3"
49+ rails-version : " 8.0"
50+ - solidus-branch : " v4.4"
51+ rails-version : " 8.0"
52+ steps :
53+ - uses : actions/checkout@v4
54+ - name : Run extension tests
55+ uses : solidusio/test-solidus-extension@main
56+ with :
57+ database : ${{ matrix.database }}
58+ rails-version : ${{ matrix.rails-version }}
59+ ruby-version : ${{ matrix.ruby-version }}
60+ solidus-branch : ${{ matrix.solidus-branch }}
61+ - name : Upload coverage reports to Codecov
62+ uses : codecov/codecov-action@v5
63+ continue-on-error : true
64+ with :
65+ token : ${{ secrets.CODECOV_TOKEN }}
66+ files : ./coverage/coverage.xml
Original file line number Diff line number Diff line change @@ -10,13 +10,21 @@ class Import < ApplicationRecord
1010 class_name : 'SolidusImporter::Row' ,
1111 inverse_of : :import ,
1212 dependent : :destroy
13-
14- enum state : {
15- created : 'created' ,
16- processing : 'processing' ,
17- failed : 'failed' ,
18- completed : 'completed'
19- }
13+ if Rails . gem_version >= Gem ::Version . new ( '7.1' )
14+ enum :state , {
15+ created : 'created' ,
16+ processing : 'processing' ,
17+ failed : 'failed' ,
18+ completed : 'completed'
19+ }
20+ else
21+ enum state : {
22+ created : 'created' ,
23+ processing : 'processing' ,
24+ failed : 'failed' ,
25+ completed : 'completed'
26+ }
27+ end
2028
2129 has_attached_file :file
2230
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -8,14 +8,23 @@ class Row < ApplicationRecord
88 class_name : 'SolidusImporter::Import' ,
99 inverse_of : :rows
1010
11- serialize :data , JSON
12-
13- enum state : {
14- created : 'created' ,
15- processing : 'processing' ,
16- failed : 'failed' ,
17- completed : 'completed'
18- }
11+ if Rails . gem_version >= Gem ::Version . new ( '7.1' )
12+ serialize :data , coder : JSON
13+ enum :state , {
14+ created : 'created' ,
15+ processing : 'processing' ,
16+ failed : 'failed' ,
17+ completed : 'completed'
18+ }
19+ else
20+ serialize :data , JSON
21+ enum state : {
22+ created : 'created' ,
23+ processing : 'processing' ,
24+ failed : 'failed' ,
25+ completed : 'completed'
26+ }
27+ end
1928
2029 scope :created_or_failed , -> { where ( state : %i[ created failed ] ) }
2130 scope :failed_or_completed , -> { where ( state : %i[ failed completed ] ) }
Original file line number Diff line number Diff line change @@ -38,14 +38,18 @@ def self.import(user, params)
3838 end
3939
4040 # Really ensure that the order totals & states are correct
41- updater = SolidusImporter ::OrderUpdater . new ( order )
42- updater . update
41+ tax_adjuster_class = Spree ::Config . tax_adjuster_class
42+ Spree ::Config . tax_adjuster_class = SolidusImporter ::Tax ::NullOrderAdjuster
43+
44+ order . updater . update
4345 if shipments_attrs . present?
4446 order . shipments . each_with_index do |shipment , index |
4547 shipment . update_columns ( cost : shipments_attrs [ index ] [ :cost ] . to_f ) if shipments_attrs [ index ] [ :cost ] . present?
4648 end
4749 end
4850 order . reload
51+
52+ Spree ::Config . tax_adjuster_class = tax_adjuster_class
4953 end
5054 end
5155 end
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ module SolidusImporter
4+ module Tax
5+ class NullOrderAdjuster
6+ attr_reader :order
7+
8+ def initialize ( order )
9+ @order = order
10+ end
11+
12+ def adjust!
13+ end
14+ end
15+ end
16+ end
You can’t perform that action at this time.
0 commit comments