solidus_bolt 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +7 -1
- data/app/controllers/spree/admin/bolt_callback_urls_controller.rb +3 -1
- data/app/services/solidus_bolt/base_service.rb +2 -2
- data/app/views/spree/admin/bolt_callback_urls/edit.html.erb +6 -2
- data/bin/sandbox +2 -0
- data/lib/solidus_bolt/engine.rb +34 -32
- data/lib/solidus_bolt/version.rb +1 -1
- data/solidus_bolt.gemspec +2 -1
- data/spec/fixtures/vcr_cassettes/SolidusBolt_MerchantConfiguration_SetCallbackUrlsService/_call/receives_the_correct_response.yml +7 -7
- data/spec/services/solidus_bolt/merchant_configuration/set_callback_urls_service_spec.rb +3 -2
- data/spec/spec_helper.rb +1 -0
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a29718f8e31f9d466f5699cc9d10bb6052ce24f0e85bc2a9cead45d5ba3a3e6
|
4
|
+
data.tar.gz: 037250f96ab9782723363d2137e199a97488bccec18e43a615244761e894530c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 586deaa3255d4ec43442474494397c07207fada7411ab8866c21131467645dd0803f21d4e2f8c583e2aceeed7063deafe939b6c882360e3657899c260899b9fa
|
7
|
+
data.tar.gz: ad351e9d4f378fd93c9dfa09993586b0cd3506bfdf0d9fdcbe088d6a4234abf0c676d4c9f2f69e21c36c291e7e785af3a41c1df6a0794c8ac751c9d3419fdfc8
|
data/Gemfile
CHANGED
@@ -4,7 +4,13 @@ source 'https://rubygems.org'
|
|
4
4
|
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
5
5
|
|
6
6
|
branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
|
7
|
-
|
7
|
+
solidus_git, solidus_frontend_git = if (branch == 'master') || (branch >= 'v3.2')
|
8
|
+
%w[solidusio/solidus solidusio/solidus_frontend]
|
9
|
+
else
|
10
|
+
%w[solidusio/solidus] * 2
|
11
|
+
end
|
12
|
+
gem 'solidus', github: solidus_git, branch: branch
|
13
|
+
gem 'solidus_frontend', github: solidus_frontend_git, branch: branch
|
8
14
|
|
9
15
|
# Needed to help Bundler figure out how to resolve dependencies,
|
10
16
|
# otherwise it takes forever to resolve them.
|
@@ -8,12 +8,14 @@ module Spree
|
|
8
8
|
|
9
9
|
@oauth_logout = callback_urls['callback_urls'].find { |c| c['type'] == 'oauth_logout' }&.dig('url')
|
10
10
|
@oauth_redirect = callback_urls['callback_urls'].find { |c| c['type'] == 'oauth_redirect' }&.dig('url')
|
11
|
+
@get_account = callback_urls['callback_urls'].find { |c| c['type'] == 'get_account' }&.dig('url')
|
11
12
|
end
|
12
13
|
|
13
14
|
def update
|
14
15
|
SolidusBolt::MerchantConfiguration::SetCallbackUrlsService.call(
|
15
16
|
oauth_logout: params[:bolt_callback_urls][:oauth_logout],
|
16
|
-
oauth_redirect: params[:bolt_callback_urls][:oauth_redirect]
|
17
|
+
oauth_redirect: params[:bolt_callback_urls][:oauth_redirect],
|
18
|
+
get_account: params[:bolt_callback_urls][:get_account]
|
17
19
|
)
|
18
20
|
flash[:success] = "Successfully updated callback urls."
|
19
21
|
|
@@ -7,11 +7,15 @@
|
|
7
7
|
<div class="row">
|
8
8
|
<div class="col-12">
|
9
9
|
<%= f.label :oauth_redirect %>
|
10
|
-
<%= f.text_field :oauth_redirect, class: 'fullwidth', value: @oauth_redirect || 'https://domain.com/
|
10
|
+
<%= f.text_field :oauth_redirect, class: 'fullwidth', value: @oauth_redirect || 'https://domain.com/users/auth/bolt' %>
|
11
11
|
</div>
|
12
12
|
<div class="col-12">
|
13
13
|
<%= f.label :oauth_logout %>
|
14
|
-
<%= f.text_field :oauth_logout, class: 'fullwidth', value: @oauth_logout || 'https://domain.com/
|
14
|
+
<%= f.text_field :oauth_logout, class: 'fullwidth', value: @oauth_logout || 'https://domain.com/bolt_logout' %>
|
15
|
+
</div>
|
16
|
+
<div class="col-12">
|
17
|
+
<%= f.label :get_account %>
|
18
|
+
<%= f.text_field :get_account, class: 'fullwidth', value: @get_account || 'https://domain.com/api/accounts/bolt' %>
|
15
19
|
</div>
|
16
20
|
</div>
|
17
21
|
<div class="row p-2 justify-content-center">
|
data/bin/sandbox
CHANGED
data/lib/solidus_bolt/engine.rb
CHANGED
@@ -12,17 +12,19 @@ module SolidusBolt
|
|
12
12
|
engine_name 'solidus_bolt'
|
13
13
|
|
14
14
|
initializer "solidus_bolt.add_static_preference", after: "spree.register.payment_methods" do |app|
|
15
|
-
app.config.spree.payment_methods << SolidusBolt::PaymentMethod
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
15
|
+
app.config.spree.payment_methods << 'SolidusBolt::PaymentMethod'
|
16
|
+
app.config.to_prepare do
|
17
|
+
Spree::Config.static_model_preferences.add(
|
18
|
+
SolidusBolt::PaymentMethod,
|
19
|
+
'bolt_credentials',
|
20
|
+
::SolidusBolt::Engine.bolt_credentials_hash
|
21
|
+
)
|
22
|
+
Spree::Config.static_model_preferences.add(
|
23
|
+
SolidusBolt::PaymentMethod,
|
24
|
+
'bolt_config_credentials',
|
25
|
+
::SolidusBolt::Engine.bolt_config_credentials_hash
|
26
|
+
)
|
27
|
+
end
|
26
28
|
|
27
29
|
Spree::PermittedAttributes.source_attributes.concat(%i[
|
28
30
|
card_token card_last4 card_bin card_number card_expiration card_postal_code create_bolt_account
|
@@ -34,29 +36,29 @@ module SolidusBolt
|
|
34
36
|
g.test_framework :rspec
|
35
37
|
end
|
36
38
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
bolt_publishable_key: ENV['BOLT_PUBLISHABLE_KEY'],
|
44
|
-
}
|
45
|
-
end
|
46
|
-
|
47
|
-
def bolt_config_credentials_hash
|
48
|
-
begin
|
49
|
-
bolt_config = SolidusBolt::BoltConfiguration.fetch
|
50
|
-
rescue ActiveRecord::StatementInvalid
|
51
|
-
bolt_config = nil
|
52
|
-
ensure
|
53
|
-
bolt_config_hash = {
|
54
|
-
bolt_api_key: bolt_config&.api_key,
|
55
|
-
bolt_signing_secret: bolt_config&.signing_secret,
|
56
|
-
bolt_publishable_key: bolt_config&.publishable_key,
|
39
|
+
class << self
|
40
|
+
def bolt_credentials_hash
|
41
|
+
{
|
42
|
+
bolt_api_key: ENV['BOLT_API_KEY'],
|
43
|
+
bolt_signing_secret: ENV['BOLT_SIGNING_SECRET'],
|
44
|
+
bolt_publishable_key: ENV['BOLT_PUBLISHABLE_KEY'],
|
57
45
|
}
|
58
46
|
end
|
59
|
-
|
47
|
+
|
48
|
+
def bolt_config_credentials_hash
|
49
|
+
begin
|
50
|
+
bolt_config = SolidusBolt::BoltConfiguration.fetch
|
51
|
+
rescue ActiveRecord::StatementInvalid
|
52
|
+
bolt_config = nil
|
53
|
+
ensure
|
54
|
+
bolt_config_hash = {
|
55
|
+
bolt_api_key: bolt_config&.api_key,
|
56
|
+
bolt_signing_secret: bolt_config&.signing_secret,
|
57
|
+
bolt_publishable_key: bolt_config&.publishable_key,
|
58
|
+
}
|
59
|
+
end
|
60
|
+
bolt_config_hash
|
61
|
+
end
|
60
62
|
end
|
61
63
|
end
|
62
64
|
end
|
data/lib/solidus_bolt/version.rb
CHANGED
data/solidus_bolt.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.metadata['source_code_uri'] = 'https://github.com/nebulab/solidus_bolt'
|
17
17
|
spec.metadata['changelog_uri'] = 'https://github.com/nebulab/solidus_bolt/blob/master/CHANGELOG.md'
|
18
18
|
|
19
|
-
spec.required_ruby_version = Gem::Requirement.new('
|
19
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.5')
|
20
20
|
|
21
21
|
# Specify which files should be added to the gem when it is released.
|
22
22
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -39,6 +39,7 @@ Gem::Specification.new do |spec|
|
|
39
39
|
spec.add_dependency 'solidus_support', '~> 0.5'
|
40
40
|
spec.add_dependency 'tweetnacl'
|
41
41
|
|
42
|
+
spec.add_development_dependency 'net-smtp'
|
42
43
|
spec.add_development_dependency 'pry'
|
43
44
|
spec.add_development_dependency 'solidus_dev_support', '~> 2.5'
|
44
45
|
spec.add_development_dependency 'vcr'
|
@@ -5,7 +5,7 @@ http_interactions:
|
|
5
5
|
uri: https://api-sandbox.bolt.com/v1/merchant/callbacks
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string: '{"division_id":"
|
8
|
+
string: '{"division_id":"<DIVISION_PUBLIC_ID>","callback_urls":[{"type":"oauth_redirect","url":"http://localhost:3000/users/auth/bolt"},{"type":"oauth_logout","url":"http://localhost:3000/user/spree_user/logout"},{"type":"get_account","url":"http://localhost:3000/api/accounts/bolt"}]}'
|
9
9
|
headers:
|
10
10
|
Content-Type:
|
11
11
|
- application/json
|
@@ -23,7 +23,7 @@ http_interactions:
|
|
23
23
|
message: OK
|
24
24
|
headers:
|
25
25
|
Date:
|
26
|
-
-
|
26
|
+
- Wed, 17 Aug 2022 15:39:28 GMT
|
27
27
|
Content-Type:
|
28
28
|
- application/json; charset=UTF-8
|
29
29
|
Content-Length:
|
@@ -33,22 +33,22 @@ http_interactions:
|
|
33
33
|
Public-Key-Pins-Report-Only:
|
34
34
|
- max-age=2592000;pin-sha256="OGAVOYhLZd3ADKYGFZOED1c5m1ObMlRv9PyIWrO4Nd0=";pin-sha256="RRM1dGqnDFsCJXBTHky16vi1obOlCgFFn/yOhI/y+ho=";pin-sha256="IXHYSIdST+XY22J5ivybYkntMIfjA5P6pMKX2hWG1BE=";report-uri="https://77aa1bd121ef22d50247a23390ce6cff.report-uri.io/r/default/hpkp/reportOnly"
|
35
35
|
Set-Cookie:
|
36
|
-
- trk=
|
36
|
+
- trk=4702ac8b-e387-4557-a2d2-eecc98fb0b81; Path=/; Max-Age=31536000; HttpOnly;
|
37
37
|
Secure; SameSite=None
|
38
38
|
Strict-Transport-Security:
|
39
39
|
- max-age=31536000; includeSubDomains; preload
|
40
40
|
X-Bolt-Api-Version:
|
41
41
|
- '2022-01-01'
|
42
42
|
X-Bolt-Trace-Id:
|
43
|
-
- Root=1-
|
43
|
+
- Root=1-62fd0bb0-24e313d41fce5fd10e2eeeda
|
44
44
|
X-Device-Id:
|
45
|
-
-
|
45
|
+
- 2a43c9a2f4fc3f8e06bc3007f8c13908180b0c7555c38d14a7ad494f0a6a4ddb
|
46
46
|
X-Envoy-Upstream-Service-Time:
|
47
|
-
- '
|
47
|
+
- '45'
|
48
48
|
Server:
|
49
49
|
- envoy
|
50
50
|
body:
|
51
51
|
encoding: UTF-8
|
52
52
|
string: 'null'
|
53
|
-
recorded_at:
|
53
|
+
recorded_at: Wed, 17 Aug 2022 15:39:28 GMT
|
54
54
|
recorded_with: VCR 6.1.0
|
@@ -3,12 +3,13 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
RSpec.describe SolidusBolt::MerchantConfiguration::SetCallbackUrlsService, :vcr, :bolt_configuration do
|
6
|
-
subject(:api) { described_class.new(params) }
|
6
|
+
subject(:api) { described_class.new(**params) }
|
7
7
|
|
8
8
|
let(:params) {
|
9
9
|
{
|
10
10
|
oauth_redirect: 'http://localhost:3000/users/auth/bolt',
|
11
|
-
oauth_logout: 'http://localhost:3000
|
11
|
+
oauth_logout: 'http://localhost:3000/user/spree_user/logout',
|
12
|
+
get_account: 'http://localhost:3000/api/accounts/bolt'
|
12
13
|
}
|
13
14
|
}
|
14
15
|
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus_bolt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piyushswain
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-
|
13
|
+
date: 2022-08-31 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: coffee-rails
|
@@ -158,6 +158,20 @@ dependencies:
|
|
158
158
|
- - ">="
|
159
159
|
- !ruby/object:Gem::Version
|
160
160
|
version: '0'
|
161
|
+
- !ruby/object:Gem::Dependency
|
162
|
+
name: net-smtp
|
163
|
+
requirement: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - ">="
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '0'
|
168
|
+
type: :development
|
169
|
+
prerelease: false
|
170
|
+
version_requirements: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - ">="
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '0'
|
161
175
|
- !ruby/object:Gem::Dependency
|
162
176
|
name: pry
|
163
177
|
requirement: !ruby/object:Gem::Requirement
|
@@ -416,7 +430,7 @@ require_paths:
|
|
416
430
|
- lib
|
417
431
|
required_ruby_version: !ruby/object:Gem::Requirement
|
418
432
|
requirements:
|
419
|
-
- - "
|
433
|
+
- - ">="
|
420
434
|
- !ruby/object:Gem::Version
|
421
435
|
version: '2.5'
|
422
436
|
required_rubygems_version: !ruby/object:Gem::Requirement
|