go_puff-tax_service 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 526b3c2835e7e616fbba411b00233f1eb06f04a7dcd3cdfb34c940f2de4660f8
4
+ data.tar.gz: aa17969f6074beb34e0d67e06c25b32bae51872f161c6ed1936bebd46e86c15d
5
+ SHA512:
6
+ metadata.gz: 1f3ac9637457e14a5757fe32fabf1e16bbd1e48a4c6216d6d33b2f808c7e640a85164285825ec9eabd3c45f28ac9928d72ce14fb99b3f2255cae955bfbacf682
7
+ data.tar.gz: c733352e4b01583e81f2a615454fce27acf282a97f654910fb83adf08bf59bde107ab81ec6a1975506e05950dd44979de2993823ee15892561a3343c4dacb584
@@ -0,0 +1,2 @@
1
+ ---
2
+ BUNDLE_HTTPS://RUBYGEMS__PKG__GITHUB__COM/GOPUFF/: "GITHUB_USERNAME:PERSONAL_ACCESS_TOKEN"
@@ -0,0 +1,5 @@
1
+ # Lines starting with '#' are comments.
2
+ # Each line is a file pattern followed by one or more owners.
3
+
4
+ # These owners will be the default owners for everything in the repo.
5
+ * @ruslantolstov
@@ -0,0 +1,14 @@
1
+ ## Links
2
+
3
+ - **Jira:** [PUFF-XXX](https://gopuff.atlassian.net/browse/PUFF-XXX)
4
+
5
+ ## Description
6
+ _Description of changes. If a reviewer should focus their review on specific files or lines of code, list them here._
7
+
8
+ ## Checklist
9
+
10
+ **Note:** All questions should be answered before this PR is ready to be reviewed.
11
+
12
+
13
+ - [ ] Tested my changes locally
14
+ - [ ] Self-reviewed this PR
@@ -0,0 +1,126 @@
1
+ name: CI
2
+
3
+ on: [push]
4
+
5
+ env:
6
+ GITHUB_PACKAGES_TOKEN: ${{ secrets.GP_REPO_PACKAGE_R }}
7
+
8
+ jobs:
9
+ lint:
10
+ name: Lint
11
+ runs-on: self-hosted-base
12
+ steps:
13
+ - uses: actions/checkout@v3
14
+ - name: Set up Ruby 2.7
15
+ uses: ruby/setup-ruby@v1
16
+ with:
17
+ ruby-version: 2.7
18
+ - name: Lint Ruby code with RuboCop
19
+ run: |
20
+ gem install bundler
21
+ bundle config set --global rubygems.pkg.github.com ${GITHUB_PACKAGES_TOKEN}
22
+ bundle install --jobs 4 --retry 3
23
+ bundle exec rubocop
24
+
25
+
26
+ test:
27
+ runs-on: self-hosted-base
28
+ needs: lint
29
+ strategy:
30
+ matrix:
31
+ ruby: [2.7, 3.0, 3.1]
32
+ steps:
33
+ - uses: actions/checkout@v3
34
+ - name: Set up Ruby ${{ matrix.ruby }}
35
+ uses: ruby/setup-ruby@v1
36
+ with:
37
+ ruby-version: ${{ matrix.ruby }}
38
+ - name: Build and test with RSpec
39
+ run: |
40
+ gem install bundler
41
+ bundle config set --global rubygems.pkg.github.com ${GITHUB_PACKAGES_TOKEN}
42
+ bundle install --jobs 4 --retry 3
43
+ bundle exec rspec
44
+ - name: Coveralls Parallel
45
+ uses: coverallsapp/github-action@master
46
+ with:
47
+ github-token: ${{ secrets.GITHUB_TOKEN }}
48
+ flag-name: run-${{ matrix.ruby }}
49
+ parallel: true
50
+
51
+ test-finish:
52
+ needs: test
53
+ name: Publish to Coveralls
54
+ runs-on: self-hosted-base
55
+ steps:
56
+ - name: Coveralls Finished
57
+ uses: coverallsapp/github-action@master
58
+ with:
59
+ github-token: ${{ secrets.GITHUB_TOKEN }}
60
+ parallel-finished: true
61
+
62
+ publish:
63
+ needs: test
64
+ name: Publish to GitHub Packages
65
+ if: github.head_ref == 'main' || github.ref_name == 'main'
66
+ runs-on: self-hosted-base
67
+ steps:
68
+ - uses: actions/checkout@v3
69
+ - name: Set up Ruby 2.7
70
+ uses: ruby/setup-ruby@v1
71
+ with:
72
+ ruby-version: 2.7
73
+ - name: Set Credentials
74
+ run: |
75
+ mkdir -p $HOME/.gem
76
+ touch $HOME/.gem/credentials
77
+ chmod 0600 $HOME/.gem/credentials
78
+ printf -- "---\n:github: Bearer ${GITHUB_TOKEN}\n" > $HOME/.gem/credentials
79
+ env:
80
+ GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
81
+ - name: Publish to GitHub Packages
82
+ run: |
83
+ gem build go_puff-tax_service.gemspec
84
+ gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
85
+ echo "release_version=v"`find . -iname "*.gem" | sed -ne "s/[^0-9]*\(\([0-9]\.\)\{0,4\}[0-9]\).*/\1/p"` >> $GITHUB_ENV
86
+ env:
87
+ OWNER: ${{ github.repository_owner }}
88
+
89
+ - name: Create a Release
90
+ uses: "marvinpinto/action-automatic-releases@latest"
91
+ with:
92
+ repo_token: ${{secrets.GITHUB_TOKEN}}
93
+ automatic_release_tag: ${{ env.release_version }}
94
+ prerelease: false
95
+ publish-beta:
96
+ needs: test
97
+ name: Publish Beta to GitHub Packages
98
+ if: github.ref != 'refs/heads/main'
99
+ runs-on: self-hosted-base
100
+ steps:
101
+ - uses: actions/checkout@v3
102
+ - name: Set up Ruby 2.7
103
+ uses: ruby/setup-ruby@v1
104
+ with:
105
+ ruby-version: 2.7
106
+ - name: Set Credentials
107
+ run: |
108
+ mkdir -p $HOME/.gem
109
+ touch $HOME/.gem/credentials
110
+ chmod 0600 $HOME/.gem/credentials
111
+ printf -- "---\n:github: Bearer ${GITHUB_TOKEN}\n" > $HOME/.gem/credentials
112
+ env:
113
+ GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
114
+ - name: Publish to GitHub Packages
115
+ run: |
116
+ gem build go_puff-tax_service.gemspec
117
+ find . -iname "*-*.*.*.*.gem" | grep .
118
+ if [ $? -eq 1 ]
119
+ then
120
+ echo "Version does not contain beta/alpha prefix. Please check version.rb file."
121
+ exit 1
122
+ fi
123
+ gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
124
+ echo "release_version=v"`find . -iname "*.gem" | sed -ne "s/[^0-9]*\(\([0-9]\.\)\{0,4\}[0-9]\).*/\1/p"` >> $GITHUB_ENV
125
+ env:
126
+ OWNER: ${{ github.repository_owner }}
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ .DS_Store
2
+
3
+ /.bundle/
4
+ /.yardoc
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /pkg/
9
+ /spec/reports/
10
+ /tmp/
11
+
12
+ # rspec failure tracking
13
+ .rspec_status
14
+
15
+ rspec*.xml
data/.rubocop.yml ADDED
@@ -0,0 +1,85 @@
1
+ require:
2
+ - rubocop-thread_safety
3
+ - rubocop-rspec
4
+ - rubocop-performance
5
+
6
+
7
+ AllCops:
8
+ NewCops: enable
9
+ TargetRubyVersion: 2.6.8
10
+ SuggestExtensions: false
11
+
12
+ Metrics/BlockLength:
13
+ Enabled: false
14
+
15
+ Layout/HashAlignment:
16
+ EnforcedColonStyle: table
17
+
18
+ RSpec/MultipleMemoizedHelpers:
19
+ Enabled: false
20
+
21
+ RSpec/NestedGroups:
22
+ Enabled: false
23
+
24
+ RSpec/ExpectInHook:
25
+ Enabled: false
26
+
27
+ RSpec/ExampleLength:
28
+ Enabled: false
29
+
30
+ RSpec/ScatteredSetup:
31
+ Enabled: false
32
+
33
+ RSpec/NamedSubject:
34
+ Enabled: false
35
+
36
+ RSpec/StubbedMock:
37
+ Enabled: false
38
+
39
+ RSpec/MultipleExpectations:
40
+ Max: 10
41
+
42
+ Metrics/AbcSize:
43
+ Enabled: false
44
+
45
+ RSpec/VerifiedDoubles:
46
+ Enabled: false
47
+
48
+ Metrics/ClassLength:
49
+ Enabled: false
50
+
51
+ Metrics/MethodLength:
52
+ Enabled: false
53
+
54
+ RSpec/MessageSpies:
55
+ Enabled: false
56
+
57
+ Layout/LineLength:
58
+ Enabled: false
59
+
60
+ Style/Documentation:
61
+ Enabled: false
62
+
63
+ RSpec/SubjectStub:
64
+ Enabled: false
65
+
66
+ RSpec/MessageChain:
67
+ Exclude:
68
+ - spec/go_puff/tax_service/tax_spec.rb
69
+
70
+ RSpec/AnyInstance:
71
+ Exclude:
72
+ - spec/go_puff/tax_service/tax_spec.rb
73
+
74
+ ThreadSafety/ClassAndModuleAttributes:
75
+ Exclude:
76
+ - lib/go_puff/tax_service.rb
77
+
78
+ RSpec/ContextWording:
79
+ Exclude:
80
+ - spec/go_puff/tax_service/configuration_spec.rb
81
+ - spec/support/shared_contexts/get_response.rb
82
+
83
+ RSpec/InstanceVariable:
84
+ Exclude:
85
+ - spec/go_puff/tax_service/tax_spec.rb
data/Dockerfile ADDED
@@ -0,0 +1,22 @@
1
+ FROM ruby:2.7-slim
2
+
3
+ RUN apt-get update \
4
+ && apt-get install -y --no-install-recommends \
5
+ bash less git \
6
+ build-essential ruby-dev \
7
+ && apt-get clean
8
+
9
+ ENV APP_HOME /app
10
+
11
+ ENV BUNDLE_GEMFILE=$APP_HOME/Gemfile \
12
+ BUNDLE_JOBS=8 \
13
+ BUNDLE_PATH=/gems
14
+
15
+ RUN mkdir $APP_HOME
16
+
17
+ WORKDIR $APP_HOME
18
+
19
+ ADD Gemfile $APP_HOME/Gemfile
20
+ ADD Gemfile.lock $APP_HOME/Gemfile.lock
21
+
22
+ RUN gem install bundler --no-document
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+ source 'https://rubygems.pkg.github.com/gopuff'
5
+
6
+ # Specify your gem's dependencies in gopuff-gem-rails_tax_service.gemspec
7
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,124 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ go_puff-tax_service (1.5.0)
5
+ activesupport
6
+ go_puff-http-client (~> 0.1)
7
+ retryable
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ remote: https://rubygems.pkg.github.com/gopuff/
12
+ specs:
13
+ activesupport (7.0.4.3)
14
+ concurrent-ruby (~> 1.0, >= 1.0.2)
15
+ i18n (>= 1.6, < 2)
16
+ minitest (>= 5.1)
17
+ tzinfo (~> 2.0)
18
+ addressable (2.8.0)
19
+ public_suffix (>= 2.0.2, < 5.0)
20
+ ast (2.4.2)
21
+ coderay (1.1.3)
22
+ concurrent-ruby (1.2.2)
23
+ connection_pool (2.4.0)
24
+ crack (0.4.5)
25
+ rexml
26
+ diff-lcs (1.5.0)
27
+ docile (1.4.0)
28
+ faraday (2.7.4)
29
+ faraday-net_http (>= 2.0, < 3.1)
30
+ ruby2_keywords (>= 0.0.4)
31
+ faraday-net_http (3.0.2)
32
+ faraday-net_http_persistent (2.1.0)
33
+ faraday (~> 2.5)
34
+ net-http-persistent (~> 4.0)
35
+ go_puff-http-client (0.5.1)
36
+ faraday (~> 2.5)
37
+ faraday-net_http_persistent (~> 2.1)
38
+ hashdiff (1.0.1)
39
+ i18n (1.12.0)
40
+ concurrent-ruby (~> 1.0)
41
+ json (2.6.2)
42
+ method_source (1.0.0)
43
+ minitest (5.18.0)
44
+ net-http-persistent (4.0.2)
45
+ connection_pool (~> 2.2)
46
+ parallel (1.22.1)
47
+ parser (3.1.2.0)
48
+ ast (~> 2.4.1)
49
+ pry (0.14.2)
50
+ coderay (~> 1.1)
51
+ method_source (~> 1.0)
52
+ public_suffix (4.0.7)
53
+ rainbow (3.1.1)
54
+ regexp_parser (2.5.0)
55
+ retryable (3.0.5)
56
+ rexml (3.2.5)
57
+ rspec (3.11.0)
58
+ rspec-core (~> 3.11.0)
59
+ rspec-expectations (~> 3.11.0)
60
+ rspec-mocks (~> 3.11.0)
61
+ rspec-core (3.11.0)
62
+ rspec-support (~> 3.11.0)
63
+ rspec-expectations (3.11.0)
64
+ diff-lcs (>= 1.2.0, < 2.0)
65
+ rspec-support (~> 3.11.0)
66
+ rspec-mocks (3.11.1)
67
+ diff-lcs (>= 1.2.0, < 2.0)
68
+ rspec-support (~> 3.11.0)
69
+ rspec-support (3.11.0)
70
+ rubocop (1.31.1)
71
+ json (~> 2.3)
72
+ parallel (~> 1.10)
73
+ parser (>= 3.1.0.0)
74
+ rainbow (>= 2.2.2, < 4.0)
75
+ regexp_parser (>= 1.8, < 3.0)
76
+ rexml (>= 3.2.5, < 4.0)
77
+ rubocop-ast (>= 1.18.0, < 2.0)
78
+ ruby-progressbar (~> 1.7)
79
+ unicode-display_width (>= 1.4.0, < 3.0)
80
+ rubocop-ast (1.18.0)
81
+ parser (>= 3.1.1.0)
82
+ rubocop-performance (1.14.2)
83
+ rubocop (>= 1.7.0, < 2.0)
84
+ rubocop-ast (>= 0.4.0)
85
+ rubocop-rspec (2.11.1)
86
+ rubocop (~> 1.19)
87
+ rubocop-thread_safety (0.4.4)
88
+ rubocop (>= 0.53.0)
89
+ ruby-progressbar (1.11.0)
90
+ ruby2_keywords (0.0.5)
91
+ simplecov (0.21.2)
92
+ docile (~> 1.1)
93
+ simplecov-html (~> 0.11)
94
+ simplecov_json_formatter (~> 0.1)
95
+ simplecov-html (0.12.3)
96
+ simplecov-lcov (0.8.0)
97
+ simplecov_json_formatter (0.1.4)
98
+ tzinfo (2.0.6)
99
+ concurrent-ruby (~> 1.0)
100
+ unicode-display_width (2.2.0)
101
+ webmock (3.14.0)
102
+ addressable (>= 2.8.0)
103
+ crack (>= 0.3.2)
104
+ hashdiff (>= 0.4.0, < 2.0.0)
105
+
106
+ PLATFORMS
107
+ aarch64-linux
108
+ ruby
109
+ x86_64-darwin-18
110
+
111
+ DEPENDENCIES
112
+ go_puff-tax_service!
113
+ pry
114
+ rspec
115
+ rubocop (~> 1.25)
116
+ rubocop-performance
117
+ rubocop-rspec
118
+ rubocop-thread_safety (~> 0.4)
119
+ simplecov (~> 0.21)
120
+ simplecov-lcov (~> 0.8.0)
121
+ webmock
122
+
123
+ BUNDLED WITH
124
+ 2.4.12
data/README.md ADDED
@@ -0,0 +1,86 @@
1
+ # GoPuff::TaxService
2
+ [![Coverage Status](https://coveralls.io/repos/github/gopuff/go_puff-tax_service/badge.svg?branch=main&t=ZBIABm)](https://coveralls.io/github/gopuff/go_puff-tax_service?branch=main)
3
+
4
+ GoPuff Rails library to handle interaction with Tax Service
5
+
6
+ ## Installation
7
+
8
+ Add the gem to your project's Gemfile:
9
+
10
+ ```ruby
11
+ source 'https://rubygems.pkg.github.com/gopuff' do
12
+ gem 'go_puff-tax_service'
13
+ end
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ ```bash
19
+ $ bundle install
20
+ ```
21
+
22
+ Or install it yourself as:
23
+ ```bash
24
+ gem install go_puff-tax_service --source "https://rubygems.pkg.github.com/gopuff"
25
+ ```
26
+ ## Configuration example
27
+ ```ruby
28
+ # config/initializers/tax_service.rb
29
+
30
+ GoPuff::TaxService.configure do |config|
31
+ config.logger = GoPuff::Logger
32
+
33
+ config.base_url = ENV['GOPUFF_TAX_SERVICE_BASE_URL']
34
+
35
+ config.requests.max_retries = 3
36
+ config.requests.retry_wait_time = 0.5
37
+ config.requests.retryable_exceptions = [EOFError, Errno::ECONNRESET]
38
+
39
+ config.user_agent_header = 'your header'
40
+
41
+ config.authentication.token_provider = -> { Apis::TaxService::Authentication.get_token }
42
+ config.authentication.on_unauthorized = -> { Apis::TaxService::Authentication.get_token(fresh: true) }
43
+ end
44
+
45
+ Gopuff::TaxService = GoPuff::TaxService
46
+ ```
47
+
48
+ ## Usage
49
+ There are 3 main actions you can use: `Get`, `Commit`, `Cancel`
50
+
51
+ `Get`. It is used for fee calculation:
52
+ ```ruby
53
+ order = ...
54
+ purchases = ...
55
+ fees_kind = 'all' || 'non_alcohol' || 'alcohol' || 'none'
56
+ GoPuff::TaxService::Actions::Get.new(order, purchases: purchases, fees_kind: 'all').call
57
+ ```
58
+
59
+ `Commit` It is used for confirming fee when order is finished:
60
+ ```ruby
61
+ order = ...
62
+ GoPuff::TaxService::Actions::Commit.new(order).call
63
+ ```
64
+
65
+ `Cancel` It is used for refund:
66
+ ```ruby
67
+ order = ...
68
+ GoPuff::TaxService::Actions::Cancel.new(order).call
69
+ ```
70
+
71
+ ## Local development with docker
72
+ ```bash
73
+ docker-compose run --rm go_puff-tax_service bash
74
+ ```
75
+
76
+
77
+
78
+ ## Contributing
79
+
80
+ Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.
81
+
82
+ 1. Clone the Project
83
+ 2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
84
+ 3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
85
+ 4. Push to the Branch (`git push origin feature/AmazingFeature`)
86
+ 5. Open a Pull Request
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'go_puff/tax_service'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
data/bin/rspec ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rspec' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path('bundle', __dir__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require 'rubygems'
27
+ require 'bundler/setup'
28
+
29
+ load Gem.bin_path('rspec-core', 'rspec')
data/bin/rubocop ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rubocop' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path('bundle', __dir__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require 'rubygems'
27
+ require 'bundler/setup'
28
+
29
+ load Gem.bin_path('rubocop', 'rubocop')
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/dip.yml ADDED
@@ -0,0 +1,23 @@
1
+ version: '2'
2
+
3
+ environment:
4
+ RAILS_ENV: development
5
+
6
+ compose:
7
+ files:
8
+ - docker-compose.yml
9
+
10
+ interaction:
11
+ bash:
12
+ service: go_puff-tax_service
13
+ command: /bin/bash
14
+ compose_run_options: [no-deps]
15
+ bundle:
16
+ service: go_puff-tax_service
17
+ command: bundle
18
+ rake:
19
+ service: go_puff-tax_service
20
+ command: bundle exec rake
21
+ rspec:
22
+ service: go_puff-tax_service
23
+ command: bundle exec rspec
@@ -0,0 +1,13 @@
1
+
2
+ version: '3.4'
3
+
4
+ services:
5
+ go_puff-tax_service:
6
+ build:
7
+ context: .
8
+ volumes:
9
+ - .:/app
10
+ - go_puff-tax_service-gems:/gems
11
+ - ./.bundle/config:/root/.bundle/config
12
+ volumes:
13
+ go_puff-tax_service-gems:
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+
6
+ require 'go_puff/tax_service/version'
7
+
8
+ Gem::Specification.new do |spec|
9
+ spec.name = 'go_puff-tax_service'
10
+ spec.version = GoPuff::TaxService::VERSION
11
+ spec.authors = ['Sergey Timofeyev']
12
+ spec.email = ['timofeyev@mlsdev.com']
13
+ spec.required_ruby_version = '>= 2.6.0'
14
+
15
+ spec.summary = 'Tax Service'
16
+ spec.description = 'Tax service integration that was made initially for Avalara'
17
+
18
+ # Specify which files should be added to the gem when it is released.
19
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
20
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
21
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ end
23
+ spec.bindir = 'exe'
24
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
+ spec.require_paths = ['lib']
26
+
27
+ spec.add_dependency 'activesupport'
28
+ spec.add_dependency 'go_puff-http-client', '~> 0.1'
29
+ spec.add_dependency 'retryable'
30
+
31
+ spec.add_development_dependency 'pry'
32
+ spec.add_development_dependency 'rspec'
33
+ spec.add_development_dependency 'rubocop', '~> 1.25'
34
+ spec.add_development_dependency 'rubocop-performance'
35
+ spec.add_development_dependency 'rubocop-rspec'
36
+ spec.add_development_dependency 'rubocop-thread_safety', '~> 0.4'
37
+ spec.add_development_dependency 'simplecov', '~> 0.21'
38
+ spec.add_development_dependency 'simplecov-lcov', '~> 0.8.0'
39
+ spec.add_development_dependency 'webmock'
40
+ spec.metadata['rubygems_mfa_required'] = 'true'
41
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GoPuff
4
+ module TaxService
5
+ module Actions
6
+ class Cancel < GoPuff::TaxService::Tax
7
+ private
8
+
9
+ def body_params
10
+ @body_params ||= { orderId: order.id_obfuscated.to_s }
11
+ end
12
+
13
+ def endpoint
14
+ '/api/taxes/refund'
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end