solidus_bolt 0.3.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/solidus_bolt.js +14 -2
- data/app/controllers/spree/admin/bolt_callback_urls_controller.rb +39 -0
- data/app/decorators/models/solidus_bolt/order_decorator.rb +1 -0
- data/app/models/solidus_bolt/bolt_configuration.rb +2 -2
- data/app/services/solidus_bolt/merchant_configuration/get_callback_urls_service.rb +36 -0
- data/app/services/solidus_bolt/merchant_configuration/set_callback_urls_service.rb +55 -0
- data/app/views/spree/admin/bolt_callback_urls/edit.html.erb +24 -0
- data/app/views/spree/admin/bolts/show.html.erb +3 -0
- data/config/routes.rb +5 -0
- data/lib/solidus_bolt/version.rb +1 -1
- data/lib/views/frontend/spree/shared/_login_bar_items.html.erb +1 -1
- data/solidus_bolt.gemspec +0 -1
- data/spec/decorators/models/solidus_bolt/order_decorator_spec.rb +1 -0
- data/spec/fixtures/vcr_cassettes/SolidusBolt_MerchantConfiguration_GetCallbackUrlsService/_call/receives_the_correct_response.yml +54 -0
- data/spec/fixtures/vcr_cassettes/SolidusBolt_MerchantConfiguration_SetCallbackUrlsService/_call/receives_the_correct_response.yml +54 -0
- data/spec/models/solidus_bolt/bolt_configuration_spec.rb +10 -0
- data/spec/services/solidus_bolt/merchant_configuration/get_callback_urls_service_spec.rb +15 -0
- data/spec/services/solidus_bolt/merchant_configuration/set_callback_urls_service_spec.rb +20 -0
- data/spec/support/bolt_configuration.rb +1 -1
- data/spec/support/vcr.rb +1 -0
- metadata +14 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d91d355d44749ba39444cd212cf3358af9d4fdc765c0aef0331fc0ea363066e
|
4
|
+
data.tar.gz: d0a97484c2dd27d7ab078480b3a57f979bb438ca714322bc3dd6ba8388dec066
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6499d04e3f47a046fbca944f1d7ad0f8a6181c299175fa5b1734960d912295f47b68596c2eb103651edf40147948a3cba211df1e69c9746d6367165b0bb176b1
|
7
|
+
data.tar.gz: c2d55795d7683a04debbe3d3d18f3a5f46a581759d12d990941af05204fd4281245e238667526ef4ce21d5cf1b54cccbe9c814359729818b285072e3c6467a98
|
@@ -31,6 +31,11 @@ const redirectToNextStep = (frontend) => {
|
|
31
31
|
}
|
32
32
|
}
|
33
33
|
|
34
|
+
async function getResponseText(response) {
|
35
|
+
const text = await response.text();
|
36
|
+
return text;
|
37
|
+
}
|
38
|
+
|
34
39
|
const updateOrder = async (card, paymentMethodId, frontend) => {
|
35
40
|
await fetch(`/api/checkouts/${Spree.current_order_id}`, {
|
36
41
|
method: 'PATCH',
|
@@ -39,6 +44,7 @@ const updateOrder = async (card, paymentMethodId, frontend) => {
|
|
39
44
|
'X-Spree-Order-Token': Spree.current_order_token
|
40
45
|
},
|
41
46
|
body: JSON.stringify({
|
47
|
+
'state': 'payment',
|
42
48
|
'order': {
|
43
49
|
'payments_attributes': [{
|
44
50
|
'payment_method_id': paymentMethodId,
|
@@ -55,8 +61,14 @@ const updateOrder = async (card, paymentMethodId, frontend) => {
|
|
55
61
|
}
|
56
62
|
})
|
57
63
|
})
|
58
|
-
.then(() => {
|
59
|
-
|
64
|
+
.then((response) => {
|
65
|
+
if(response.ok) {
|
66
|
+
redirectToNextStep(frontend)
|
67
|
+
} else {
|
68
|
+
getResponseText(response).then(text => {
|
69
|
+
console.error(text);
|
70
|
+
});
|
71
|
+
}
|
60
72
|
})
|
61
73
|
.catch((response) => {
|
62
74
|
console.log('Error updating order')
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Spree
|
4
|
+
module Admin
|
5
|
+
class BoltCallbackUrlsController < Spree::Admin::BaseController
|
6
|
+
def edit
|
7
|
+
callback_urls = SolidusBolt::MerchantConfiguration::GetCallbackUrlsService.call
|
8
|
+
|
9
|
+
@oauth_logout = callback_urls['callback_urls'].find { |c| c['type'] == 'oauth_logout' }&.dig('url')
|
10
|
+
@oauth_redirect = callback_urls['callback_urls'].find { |c| c['type'] == 'oauth_redirect' }&.dig('url')
|
11
|
+
end
|
12
|
+
|
13
|
+
def update
|
14
|
+
SolidusBolt::MerchantConfiguration::SetCallbackUrlsService.call(
|
15
|
+
oauth_logout: params[:bolt_callback_urls][:oauth_logout],
|
16
|
+
oauth_redirect: params[:bolt_callback_urls][:oauth_redirect]
|
17
|
+
)
|
18
|
+
flash[:success] = "Successfully updated callback urls."
|
19
|
+
|
20
|
+
redirect_to edit_admin_bolt_callback_urls_path
|
21
|
+
rescue SolidusBolt::ServerError => e
|
22
|
+
flash[:error] = e.message
|
23
|
+
|
24
|
+
render :new
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def bolt_webhook_params
|
30
|
+
params
|
31
|
+
.require(:bolt_webhook)
|
32
|
+
.permit(
|
33
|
+
:event,
|
34
|
+
:webhook_url,
|
35
|
+
)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -16,11 +16,11 @@ module SolidusBolt
|
|
16
16
|
validate :config_can_be_created, on: :create
|
17
17
|
|
18
18
|
def merchant_public_id
|
19
|
-
publishable_key
|
19
|
+
publishable_key&.split('.')&.first
|
20
20
|
end
|
21
21
|
|
22
22
|
def division_public_id
|
23
|
-
publishable_key
|
23
|
+
publishable_key&.split('.')&.second
|
24
24
|
end
|
25
25
|
|
26
26
|
def self.fetch
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SolidusBolt
|
4
|
+
module MerchantConfiguration
|
5
|
+
class GetCallbackUrlsService < SolidusBolt::BaseService
|
6
|
+
attr_reader :oauth_redirect, :oauth_logout, :get_account
|
7
|
+
|
8
|
+
def call
|
9
|
+
get_callbacks
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def get_callbacks # rubocop:disable Naming/AccessorMethodName
|
15
|
+
url = "#{api_base_url}/#{api_version}/merchant/callbacks"
|
16
|
+
handle_result(
|
17
|
+
HTTParty.get(
|
18
|
+
url, headers: headers, query: query
|
19
|
+
)
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
23
|
+
def query
|
24
|
+
{
|
25
|
+
division_id: @config.division_public_id
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
def headers
|
30
|
+
{
|
31
|
+
'Content-Type' => 'application/json',
|
32
|
+
}.merge(authentication_header)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SolidusBolt
|
4
|
+
module MerchantConfiguration
|
5
|
+
class SetCallbackUrlsService < SolidusBolt::BaseService
|
6
|
+
attr_reader :oauth_redirect, :oauth_logout, :get_account
|
7
|
+
|
8
|
+
def initialize(oauth_redirect: nil, oauth_logout: nil, get_account: nil)
|
9
|
+
@oauth_redirect = oauth_redirect
|
10
|
+
@oauth_logout = oauth_logout
|
11
|
+
@get_account = get_account
|
12
|
+
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
def call
|
17
|
+
set_callbacks
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def set_callbacks
|
23
|
+
url = "#{api_base_url}/#{api_version}/merchant/callbacks"
|
24
|
+
handle_result(
|
25
|
+
HTTParty.post(
|
26
|
+
url, headers: headers, body: body.to_json
|
27
|
+
)
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
def body
|
32
|
+
{
|
33
|
+
division_id: @config.division_public_id,
|
34
|
+
callback_urls: callback_urls
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
def callback_urls
|
39
|
+
callback_urls = []
|
40
|
+
|
41
|
+
callback_urls << { type: 'oauth_redirect', url: oauth_redirect } if oauth_redirect.present?
|
42
|
+
callback_urls << { type: 'oauth_logout', url: oauth_logout } if oauth_logout.present?
|
43
|
+
callback_urls << { type: 'get_account', url: get_account } if get_account.present?
|
44
|
+
|
45
|
+
callback_urls
|
46
|
+
end
|
47
|
+
|
48
|
+
def headers
|
49
|
+
{
|
50
|
+
'Content-Type' => 'application/json',
|
51
|
+
}.merge(authentication_header)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<% admin_breadcrumb(plural_resource_name(SolidusBolt::BoltConfiguration)) %>
|
2
|
+
|
3
|
+
<%= form_for :bolt_callback_urls, url: admin_bolt_callback_urls_path, method: :patch do |f| %>
|
4
|
+
<fieldset class="form-group no-border-bottom no-border-top">
|
5
|
+
<div class="row">
|
6
|
+
<div id="general_fields" class="col-9">
|
7
|
+
<div class="row">
|
8
|
+
<div class="col-12">
|
9
|
+
<%= f.label :oauth_redirect %>
|
10
|
+
<%= f.text_field :oauth_redirect, class: 'fullwidth', value: @oauth_redirect || 'https://domain.com/webhooks/bolt' %>
|
11
|
+
</div>
|
12
|
+
<div class="col-12">
|
13
|
+
<%= f.label :oauth_logout %>
|
14
|
+
<%= f.text_field :oauth_logout, class: 'fullwidth', value: @oauth_logout || 'https://domain.com/webhooks/bolt' %>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
<div class="row p-2 justify-content-center">
|
18
|
+
<%= f.submit 'Update', class: 'btn btn-primary', data: { disable_with: 'Creating..' } %>
|
19
|
+
<%= link_to 'Cancel', admin_bolt_path, class: 'button' %>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
</div>
|
23
|
+
</fieldset>
|
24
|
+
<% end %>
|
@@ -11,6 +11,9 @@
|
|
11
11
|
) %>
|
12
12
|
</li>
|
13
13
|
<% else %>
|
14
|
+
<li>
|
15
|
+
<%= link_to 'Configure Callbacks URLs', edit_admin_bolt_callback_urls_path, class: 'btn btn-primary' %>
|
16
|
+
</li>
|
14
17
|
<li>
|
15
18
|
<%= link_to 'Configure Webhooks', new_admin_bolt_webhook_path, class: 'btn btn-primary' %>
|
16
19
|
</li>
|
data/config/routes.rb
CHANGED
@@ -4,8 +4,13 @@ Spree::Core::Engine.routes.draw do
|
|
4
4
|
namespace :admin do
|
5
5
|
resource :bolt, only: [:show, :edit, :update]
|
6
6
|
resource :bolt_webhook, only: [:new, :create]
|
7
|
+
resource :bolt_callback_urls, only: [:edit, :update]
|
7
8
|
end
|
8
9
|
|
9
10
|
post '/webhooks/bolt', to: '/solidus_bolt/webhooks#update'
|
10
11
|
post '/api/accounts/bolt', to: '/solidus_bolt/accounts#create'
|
12
|
+
|
13
|
+
devise_scope :spree_user do
|
14
|
+
get '/bolt_logout', to: '/spree/user_sessions#destroy', as: 'bolt_logout'
|
15
|
+
end
|
11
16
|
end
|
data/lib/solidus_bolt/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
<% if spree_current_user %>
|
2
2
|
<li><%= link_to t('spree.my_account'), spree.account_path %></li>
|
3
|
-
<li
|
3
|
+
<li><div class="bolt-account-sso" data-logged-in="true"></div></li>
|
4
4
|
<% else %>
|
5
5
|
<li>
|
6
6
|
<div class="bolt-account-sso"></div>
|
data/solidus_bolt.gemspec
CHANGED
@@ -34,7 +34,6 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.add_dependency 'multi_json'
|
35
35
|
spec.add_dependency 'omniauth-bolt'
|
36
36
|
spec.add_dependency 'rails'
|
37
|
-
spec.add_dependency 'solidus_auth_devise'
|
38
37
|
spec.add_dependency 'solidus_core', ['>= 2.0.0', '< 4']
|
39
38
|
spec.add_dependency 'solidus_social'
|
40
39
|
spec.add_dependency 'solidus_support', '~> 0.5'
|
@@ -7,6 +7,7 @@ RSpec.describe SolidusBolt::OrderDecorator do
|
|
7
7
|
it 'returns a hash with line items and price' do
|
8
8
|
result = {
|
9
9
|
total_amount: (order.total * 100).to_i,
|
10
|
+
tax_amount: (order.tax_total * 100).to_i,
|
10
11
|
order_reference: order.number,
|
11
12
|
currency: 'USD',
|
12
13
|
shipments: array_including(hash_including(:reference)),
|
@@ -0,0 +1,54 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api-sandbox.bolt.com/v1/merchant/callbacks?division_id=<DIVISION_PUBLIC_ID>
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Content-Type:
|
11
|
+
- application/json
|
12
|
+
X-Api-Key:
|
13
|
+
- "<API_KEY>"
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
16
|
+
Accept:
|
17
|
+
- "*/*"
|
18
|
+
User-Agent:
|
19
|
+
- Ruby
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Date:
|
26
|
+
- Wed, 27 Jul 2022 18:10:11 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json; charset=UTF-8
|
29
|
+
Content-Length:
|
30
|
+
- '157'
|
31
|
+
Connection:
|
32
|
+
- keep-alive
|
33
|
+
Public-Key-Pins-Report-Only:
|
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
|
+
Set-Cookie:
|
36
|
+
- trk=f47ec1df-c6f5-460c-baf3-2ff506846dd2; Path=/; Max-Age=31536000; HttpOnly;
|
37
|
+
Secure; SameSite=None
|
38
|
+
Strict-Transport-Security:
|
39
|
+
- max-age=31536000; includeSubDomains; preload
|
40
|
+
X-Bolt-Api-Version:
|
41
|
+
- '2022-01-01'
|
42
|
+
X-Bolt-Trace-Id:
|
43
|
+
- Root=1-62e17f83-46d90f8f25fd210e0420dbdb
|
44
|
+
X-Device-Id:
|
45
|
+
- cc0e49b483c9bdb9dce4a6f35b9fcfb75194e19da94e18882fac74a192a8fc71
|
46
|
+
X-Envoy-Upstream-Service-Time:
|
47
|
+
- '29'
|
48
|
+
Server:
|
49
|
+
- envoy
|
50
|
+
body:
|
51
|
+
encoding: UTF-8
|
52
|
+
string: '{"callback_urls":[{"url":"http://localhost:3000/bolt_logout","type":"oauth_logout"},{"url":"http://localhost:3000/users/auth/bolt","type":"oauth_redirect"}]}'
|
53
|
+
recorded_at: Wed, 27 Jul 2022 18:10:11 GMT
|
54
|
+
recorded_with: VCR 6.1.0
|
@@ -0,0 +1,54 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api-sandbox.bolt.com/v1/merchant/callbacks
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"division_id":"Rq4qB1QajYLn","callback_urls":[{"type":"oauth_redirect","url":"http://localhost:3000/users/auth/bolt"},{"type":"oauth_logout","url":"http://localhost:3000//user/spree_user/logout"}]}'
|
9
|
+
headers:
|
10
|
+
Content-Type:
|
11
|
+
- application/json
|
12
|
+
X-Api-Key:
|
13
|
+
- "<API_KEY>"
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
16
|
+
Accept:
|
17
|
+
- "*/*"
|
18
|
+
User-Agent:
|
19
|
+
- Ruby
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Date:
|
26
|
+
- Tue, 26 Jul 2022 21:17:15 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json; charset=UTF-8
|
29
|
+
Content-Length:
|
30
|
+
- '4'
|
31
|
+
Connection:
|
32
|
+
- keep-alive
|
33
|
+
Public-Key-Pins-Report-Only:
|
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
|
+
Set-Cookie:
|
36
|
+
- trk=ea8f518e-f41d-4b8c-9615-161bff916a0f; Path=/; Max-Age=31536000; HttpOnly;
|
37
|
+
Secure; SameSite=None
|
38
|
+
Strict-Transport-Security:
|
39
|
+
- max-age=31536000; includeSubDomains; preload
|
40
|
+
X-Bolt-Api-Version:
|
41
|
+
- '2022-01-01'
|
42
|
+
X-Bolt-Trace-Id:
|
43
|
+
- Root=1-62e059db-307d2def557ae7d63cda1f93
|
44
|
+
X-Device-Id:
|
45
|
+
- 65fb9d676354668c7128f58217c94230e32303007b66559078fee6aefb88e8a4
|
46
|
+
X-Envoy-Upstream-Service-Time:
|
47
|
+
- '37'
|
48
|
+
Server:
|
49
|
+
- envoy
|
50
|
+
body:
|
51
|
+
encoding: UTF-8
|
52
|
+
string: 'null'
|
53
|
+
recorded_at: Tue, 26 Jul 2022 21:17:15 GMT
|
54
|
+
recorded_with: VCR 6.1.0
|
@@ -62,6 +62,11 @@ RSpec.describe SolidusBolt::BoltConfiguration, type: :model do
|
|
62
62
|
bolt_configuration = create(:bolt_configuration, publishable_key: 'abc.def.ghi')
|
63
63
|
expect(bolt_configuration.merchant_public_id).to eq('abc')
|
64
64
|
end
|
65
|
+
|
66
|
+
it 'returns nil if publishable_key is nil' do
|
67
|
+
bolt_configuration = create(:bolt_configuration, publishable_key: nil)
|
68
|
+
expect(bolt_configuration.division_public_id).to be_nil
|
69
|
+
end
|
65
70
|
end
|
66
71
|
|
67
72
|
describe '#division_public_id' do
|
@@ -69,6 +74,11 @@ RSpec.describe SolidusBolt::BoltConfiguration, type: :model do
|
|
69
74
|
bolt_configuration = create(:bolt_configuration, publishable_key: 'abc.def.ghi')
|
70
75
|
expect(bolt_configuration.division_public_id).to eq('def')
|
71
76
|
end
|
77
|
+
|
78
|
+
it 'returns nil if publishable_key is nil' do
|
79
|
+
bolt_configuration = create(:bolt_configuration, publishable_key: nil)
|
80
|
+
expect(bolt_configuration.division_public_id).to be_nil
|
81
|
+
end
|
72
82
|
end
|
73
83
|
|
74
84
|
describe '#environment_url' do
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
RSpec.describe SolidusBolt::MerchantConfiguration::GetCallbackUrlsService, :vcr, :bolt_configuration do
|
6
|
+
subject(:api) { described_class.new }
|
7
|
+
|
8
|
+
describe '#call', vcr: true do
|
9
|
+
it 'receives the correct response' do
|
10
|
+
expect(api.call).to match hash_including(
|
11
|
+
'callback_urls' => array_including(hash_including('type', 'url'))
|
12
|
+
)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
RSpec.describe SolidusBolt::MerchantConfiguration::SetCallbackUrlsService, :vcr, :bolt_configuration do
|
6
|
+
subject(:api) { described_class.new(params) }
|
7
|
+
|
8
|
+
let(:params) {
|
9
|
+
{
|
10
|
+
oauth_redirect: 'http://localhost:3000/users/auth/bolt',
|
11
|
+
oauth_logout: 'http://localhost:3000//user/spree_user/logout'
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
describe '#call', vcr: true do
|
16
|
+
it 'receives the correct response' do
|
17
|
+
expect(api.call).to be_nil
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -7,7 +7,7 @@ RSpec.configure do |config|
|
|
7
7
|
solidus_bolt_configuration.environment = 'sandbox'
|
8
8
|
solidus_bolt_configuration.api_key = ENV['BOLT_API_KEY']
|
9
9
|
solidus_bolt_configuration.signing_secret = ENV['BOLT_SIGNING_SECRET']
|
10
|
-
solidus_bolt_configuration.publishable_key = ENV['BOLT_PUBLISHABLE_KEY']
|
10
|
+
solidus_bolt_configuration.publishable_key = ENV['BOLT_PUBLISHABLE_KEY'] || 'abc.def.ghi'
|
11
11
|
|
12
12
|
solidus_bolt_configuration.save!
|
13
13
|
|
data/spec/support/vcr.rb
CHANGED
@@ -19,6 +19,7 @@ VCR.configure do |config|
|
|
19
19
|
end
|
20
20
|
|
21
21
|
config.filter_sensitive_data('<PUBLISHABLE_KEY>') { SolidusBolt::BoltConfiguration.fetch.publishable_key }
|
22
|
+
config.filter_sensitive_data('<DIVISION_PUBLIC_ID>') { SolidusBolt::BoltConfiguration.fetch.division_public_id }
|
22
23
|
config.filter_sensitive_data('<API_KEY>') { SolidusBolt::BoltConfiguration.fetch.api_key }
|
23
24
|
|
24
25
|
# Let's you set default VCR record mode with VCR_RECORDE_MODE=all for re-recording
|
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.6.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-07-
|
13
|
+
date: 2022-07-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: coffee-rails
|
@@ -96,20 +96,6 @@ dependencies:
|
|
96
96
|
- - ">="
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '0'
|
99
|
-
- !ruby/object:Gem::Dependency
|
100
|
-
name: solidus_auth_devise
|
101
|
-
requirement: !ruby/object:Gem::Requirement
|
102
|
-
requirements:
|
103
|
-
- - ">="
|
104
|
-
- !ruby/object:Gem::Version
|
105
|
-
version: '0'
|
106
|
-
type: :runtime
|
107
|
-
prerelease: false
|
108
|
-
version_requirements: !ruby/object:Gem::Requirement
|
109
|
-
requirements:
|
110
|
-
- - ">="
|
111
|
-
- !ruby/object:Gem::Version
|
112
|
-
version: '0'
|
113
99
|
- !ruby/object:Gem::Dependency
|
114
100
|
name: solidus_core
|
115
101
|
requirement: !ruby/object:Gem::Requirement
|
@@ -256,6 +242,7 @@ files:
|
|
256
242
|
- app/controllers/solidus_bolt/accounts_controller.rb
|
257
243
|
- app/controllers/solidus_bolt/base_controller.rb
|
258
244
|
- app/controllers/solidus_bolt/webhooks_controller.rb
|
245
|
+
- app/controllers/spree/admin/bolt_callback_urls_controller.rb
|
259
246
|
- app/controllers/spree/admin/bolt_webhooks_controller.rb
|
260
247
|
- app/controllers/spree/admin/bolts_controller.rb
|
261
248
|
- app/decorators/controllers/solidus_bolt/spree_checkout_controller/add_addresses_to_bolt.rb
|
@@ -279,6 +266,8 @@ files:
|
|
279
266
|
- app/services/solidus_bolt/accounts/detail_service.rb
|
280
267
|
- app/services/solidus_bolt/accounts/detect_account_service.rb
|
281
268
|
- app/services/solidus_bolt/base_service.rb
|
269
|
+
- app/services/solidus_bolt/merchant_configuration/get_callback_urls_service.rb
|
270
|
+
- app/services/solidus_bolt/merchant_configuration/set_callback_urls_service.rb
|
282
271
|
- app/services/solidus_bolt/oauth/token_service.rb
|
283
272
|
- app/services/solidus_bolt/payments/capture_sync_service.rb
|
284
273
|
- app/services/solidus_bolt/payments/credit_sync_service.rb
|
@@ -294,6 +283,7 @@ files:
|
|
294
283
|
- app/services/solidus_bolt/users/sync_addresses_service.rb
|
295
284
|
- app/services/solidus_bolt/users/sync_payment_sources_service.rb
|
296
285
|
- app/services/solidus_bolt/webhooks/create_service.rb
|
286
|
+
- app/views/spree/admin/bolt_callback_urls/edit.html.erb
|
297
287
|
- app/views/spree/admin/bolt_webhooks/new.html.erb
|
298
288
|
- app/views/spree/admin/bolts/_configuration.html.erb
|
299
289
|
- app/views/spree/admin/bolts/_form.html.erb
|
@@ -355,6 +345,8 @@ files:
|
|
355
345
|
- spec/fixtures/vcr_cassettes/SolidusBolt_Accounts_DetailService/_call/with_wrong_access_token/gives_an_error.yml
|
356
346
|
- spec/fixtures/vcr_cassettes/SolidusBolt_Accounts_DetectAccountService/_call/receives_the_correct_response.yml
|
357
347
|
- spec/fixtures/vcr_cassettes/SolidusBolt_Accounts_DetectAccountService/_call/returns_status_200.yml
|
348
|
+
- spec/fixtures/vcr_cassettes/SolidusBolt_MerchantConfiguration_GetCallbackUrlsService/_call/receives_the_correct_response.yml
|
349
|
+
- spec/fixtures/vcr_cassettes/SolidusBolt_MerchantConfiguration_SetCallbackUrlsService/_call/receives_the_correct_response.yml
|
358
350
|
- spec/fixtures/vcr_cassettes/SolidusBolt_Oauth_TokenService/_call/makes_the_API_call.yml
|
359
351
|
- spec/fixtures/vcr_cassettes/SolidusBolt_Transactions_AuthorizeService/when_repeat_payment/_call/makes_the_API_call.yml
|
360
352
|
- spec/fixtures/vcr_cassettes/SolidusBolt_Transactions_AuthorizeService/with_auto_capture/_call/makes_the_API_call.yml
|
@@ -386,6 +378,8 @@ files:
|
|
386
378
|
- spec/services/solidus_bolt/accounts/detail_service_spec.rb
|
387
379
|
- spec/services/solidus_bolt/accounts/detect_account_service_spec.rb
|
388
380
|
- spec/services/solidus_bolt/base_service_spec.rb
|
381
|
+
- spec/services/solidus_bolt/merchant_configuration/get_callback_urls_service_spec.rb
|
382
|
+
- spec/services/solidus_bolt/merchant_configuration/set_callback_urls_service_spec.rb
|
389
383
|
- spec/services/solidus_bolt/oauth/token_service_spec.rb
|
390
384
|
- spec/services/solidus_bolt/payments/capture_sync_service_spec.rb
|
391
385
|
- spec/services/solidus_bolt/payments/credit_sync_service_spec.rb
|
@@ -449,6 +443,8 @@ test_files:
|
|
449
443
|
- spec/fixtures/vcr_cassettes/SolidusBolt_Accounts_DetailService/_call/with_wrong_access_token/gives_an_error.yml
|
450
444
|
- spec/fixtures/vcr_cassettes/SolidusBolt_Accounts_DetectAccountService/_call/receives_the_correct_response.yml
|
451
445
|
- spec/fixtures/vcr_cassettes/SolidusBolt_Accounts_DetectAccountService/_call/returns_status_200.yml
|
446
|
+
- spec/fixtures/vcr_cassettes/SolidusBolt_MerchantConfiguration_GetCallbackUrlsService/_call/receives_the_correct_response.yml
|
447
|
+
- spec/fixtures/vcr_cassettes/SolidusBolt_MerchantConfiguration_SetCallbackUrlsService/_call/receives_the_correct_response.yml
|
452
448
|
- spec/fixtures/vcr_cassettes/SolidusBolt_Oauth_TokenService/_call/makes_the_API_call.yml
|
453
449
|
- spec/fixtures/vcr_cassettes/SolidusBolt_Transactions_AuthorizeService/when_repeat_payment/_call/makes_the_API_call.yml
|
454
450
|
- spec/fixtures/vcr_cassettes/SolidusBolt_Transactions_AuthorizeService/with_auto_capture/_call/makes_the_API_call.yml
|
@@ -480,6 +476,8 @@ test_files:
|
|
480
476
|
- spec/services/solidus_bolt/accounts/detail_service_spec.rb
|
481
477
|
- spec/services/solidus_bolt/accounts/detect_account_service_spec.rb
|
482
478
|
- spec/services/solidus_bolt/base_service_spec.rb
|
479
|
+
- spec/services/solidus_bolt/merchant_configuration/get_callback_urls_service_spec.rb
|
480
|
+
- spec/services/solidus_bolt/merchant_configuration/set_callback_urls_service_spec.rb
|
483
481
|
- spec/services/solidus_bolt/oauth/token_service_spec.rb
|
484
482
|
- spec/services/solidus_bolt/payments/capture_sync_service_spec.rb
|
485
483
|
- spec/services/solidus_bolt/payments/credit_sync_service_spec.rb
|