solidus_bolt 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 94b2a582685d844a4e3c0b9f5db529400eebffc1c546a0783f68629fa74ca74b
4
- data.tar.gz: 5e9b74ce81c07973564709d65920c17ec2fc44d92076c9914eb4da440fee3251
3
+ metadata.gz: 742875df47de9e63b63e2abb6d986c8e6fda7b1f5298fc49be6e04d06cd5a050
4
+ data.tar.gz: 8e3f173daca61cb9b03b63ee26d70e06ce0a5462c3803fc9c65150fa1da13cc7
5
5
  SHA512:
6
- metadata.gz: 4ba2a650993c03f57b304f8f0b3bef38654bdba35ae24d9f155404d5994f1328f8736ce387db46ef16a27454740d9205039256c6ea3535e270c964cedb998106
7
- data.tar.gz: abb020bf31418d56d460de9dc07a3e83ce54473ddbc6750e011d51a47abc37a0ffdc62c2f5b73f4417fa86a4823fec9404ea4db0be7d0f01a35333c10ca90c40
6
+ metadata.gz: a0f3cea501cbc8086af33a9d2871593d4e30e6495807ad2fad05f029711086ec8f2b2d3b6e44149fa838403536129d5a5038347a23a87ff99627a80e3274cd87
7
+ data.tar.gz: 90901739f3d6cc165309ef2f0528f6f4897ac8598c8434e01322bbae208a5cd58f1154b6a2bddebd57e5b75808010961f3a710eac83f267df38400d6dcbbb248
data/README.md CHANGED
@@ -13,7 +13,7 @@ Add solidus_bolt to your Gemfile:
13
13
  gem 'solidus_bolt'
14
14
  ```
15
15
 
16
- Bundle your dependencies and run the installation generator (before running the following command, we recommend setting up the environment variables and seeds as described in the sections below):
16
+ Bundle your dependencies and run the installation generator (before running the following command, we recommend setting up the environment variables and seeds as described in the sections below):
17
17
 
18
18
  ```shell
19
19
  bin/rails generate solidus_bolt:install
@@ -26,7 +26,6 @@ bin/rails generate solidus_bolt:install
26
26
  Many of the API calls handled by this gem use the variables set in Bolt Configuration. Since this extension's seeds automatically generate a Bolt Configuration, the easiest and safest way to configure it would be by setting the following environment variables:
27
27
 
28
28
  ```
29
- BOLT_BEARER_TOKEN
30
29
  BOLT_ENVIRONMENT
31
30
  BOLT_MERCHANT_PUBLIC_ID
32
31
  BOLT_DIVISION_PUBLIC_ID
@@ -45,11 +44,11 @@ Provided you setup the environment variables, you can simplify the setup of a Bo
45
44
  - AuthenticationMethod
46
45
  - PaymentMethod
47
46
 
48
- You can run solidus_bolt's seeds either by running
47
+ You can run solidus_bolt's seeds either by running
49
48
  ```shell
50
49
  bin/rails db:seed:solidus_bolt
51
- ```
52
- or by adding the following line to your seed file:
50
+ ```
51
+ or by adding the following line to your seed file:
53
52
  ```ruby
54
53
  SolidusBolt::Engine.load_seed if defined?(SolidusBolt)
55
54
  ```
@@ -29,7 +29,6 @@ module Spree
29
29
  params
30
30
  .require(:solidus_bolt_bolt_configuration)
31
31
  .permit(
32
- :bearer_token,
33
32
  :environment,
34
33
  :merchant_public_id,
35
34
  :division_public_id,
@@ -6,7 +6,8 @@ module SolidusBolt
6
6
  class BoltConfiguration < ApplicationRecord
7
7
  after_commit :update_bolt_config_credentials
8
8
 
9
- REGISTER_URL = 'https://merchant.bolt.com/register'
9
+ PRODUCTION_REGISTER_URL = 'https://merchant.bolt.com/register?platform=solidus'
10
+ SANDBOX_REGISTER_URL = 'https://merchant-sandbox.bolt.com/register?platform=solidus'
10
11
  EVENTS = %w[all payment credit capture void auth pending rejected_irreversible rejected_reversible no_op
11
12
  failed_payment newsletter_subscription risk_insights credit_card_deleted].freeze
12
13
 
@@ -6,8 +6,6 @@
6
6
  <div class="col-12">
7
7
  <%= f.label :environment %>
8
8
  <%= f.select :environment, %w[production sandbox staging] %><br />
9
- <%= f.label :bearer_token %>
10
- <%= f.text_field :bearer_token, class: 'fullwidth'%>
11
9
  <%= f.label 'Merchant Public Id' %><br />
12
10
  <%= f.text_field :merchant_public_id, class: 'fullwidth' %>
13
11
  <%= f.label 'Division Public Id' %><br />
@@ -3,10 +3,12 @@
3
3
  <% content_for :page_actions do %>
4
4
  <% if SolidusBolt::BoltConfiguration.config_empty? %>
5
5
  <li>
6
- <p>Don't have a <%= image_tag "bolt_logo_standard.png", alt: "Bolt", width: "40" %> Merchant account yet?</p>
7
- </li>
8
- <li>
9
- <%= link_to t('spree.admin.bolt.create_merchant_account'), SolidusBolt::BoltConfiguration::REGISTER_URL, class: 'btn btn-primary', target: '_blank' %>
6
+ <%= raw t(
7
+ 'spree.admin.bolt.register_merchant_account',
8
+ production_link: link_to(t('spree.admin.bolt.production'), SolidusBolt::BoltConfiguration::PRODUCTION_REGISTER_URL, target: '_blank'),
9
+ sandbox_link: link_to(t('spree.admin.bolt.sandbox'), SolidusBolt::BoltConfiguration::SANDBOX_REGISTER_URL, target: '_blank'),
10
+ bolt_image: image_tag("bolt_logo_standard.png", alt: "Bolt", width: "40")
11
+ ) %>
10
12
  </li>
11
13
  <% else %>
12
14
  <li>
@@ -12,6 +12,8 @@ en:
12
12
  configuration_not_found: 'No Bolt Configuration found'
13
13
  edit_configuration: 'Edit Bolt Configuration'
14
14
  updated_successfully: 'Bolt Configuration Updated Successfully'
15
- create_merchant_account: 'Create Merchant Account'
15
+ register_merchant_account: Create a %{production_link} or %{sandbox_link} merchant account with %{bolt_image}
16
+ production: Production
17
+ sandbox: Sandbox
16
18
  tab:
17
19
  bolt: 'Bolt'
@@ -0,0 +1,5 @@
1
+ class RemoveBearerTokenOnSolidusBoltBoltConfiguration < ActiveRecord::Migration[6.1]
2
+ def change
3
+ remove_column :solidus_bolt_bolt_configurations, :bearer_token, :string
4
+ end
5
+ end
data/db/seeds.rb CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  solidus_bolt_configuration = SolidusBolt::BoltConfiguration.fetch
4
4
 
5
- solidus_bolt_configuration.bearer_token = ENV['BOLT_BEARER_TOKEN']
6
5
  solidus_bolt_configuration.environment = ENV['BOLT_ENVIRONMENT']
7
6
  solidus_bolt_configuration.merchant_public_id = ENV['BOLT_MERCHANT_PUBLIC_ID']
8
7
  solidus_bolt_configuration.division_public_id = ENV['BOLT_DIVISION_PUBLIC_ID']
@@ -2,7 +2,6 @@
2
2
 
3
3
  FactoryBot.define do
4
4
  factory :bolt_configuration, class: SolidusBolt::BoltConfiguration do
5
- bearer_token { SecureRandom.hex }
6
5
  environment { 'sandbox' }
7
6
  merchant_public_id { SecureRandom.hex }
8
7
  division_public_id { SecureRandom.hex }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusBolt
4
- VERSION = '0.0.1'
4
+ VERSION = '0.1.0'
5
5
  end
data/solidus_bolt.gemspec CHANGED
@@ -31,6 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.add_dependency 'coffee-rails'
32
32
  spec.add_dependency 'deface'
33
33
  spec.add_dependency 'httparty'
34
+ spec.add_dependency 'multi_json'
34
35
  spec.add_dependency 'omniauth-bolt'
35
36
  spec.add_dependency 'rails', ['>0.a', '< 7.a']
36
37
  spec.add_dependency 'solidus_auth_devise'
@@ -4,7 +4,6 @@ RSpec.describe SolidusBolt::BoltConfiguration, type: :model do
4
4
  let(:column_list) {
5
5
  [
6
6
  'id',
7
- 'bearer_token',
8
7
  'environment',
9
8
  'merchant_public_id',
10
9
  'division_public_id',
@@ -47,7 +46,6 @@ RSpec.describe SolidusBolt::BoltConfiguration, type: :model do
47
46
  it 'is true for a record with empty fields' do
48
47
  create(
49
48
  :bolt_configuration,
50
- bearer_token: '',
51
49
  merchant_public_id: '',
52
50
  division_public_id: '',
53
51
  api_key: '',
@@ -5,7 +5,6 @@ RSpec.describe "Spree::Admin::Bolts", type: :request do
5
5
 
6
6
  let(:bolt_configuration_params) {
7
7
  {
8
- bearer_token: SecureRandom.hex,
9
8
  environment: 'sandbox',
10
9
  merchant_public_id: SecureRandom.hex,
11
10
  division_public_id: SecureRandom.hex,
@@ -56,7 +55,6 @@ RSpec.describe "Spree::Admin::Bolts", type: :request do
56
55
  request
57
56
 
58
57
  updated_attributes = SolidusBolt::BoltConfiguration.fetch.attributes.slice(
59
- 'bearer_token',
60
58
  'environment',
61
59
  'merchant_public_id',
62
60
  'division_public_id',
@@ -4,7 +4,6 @@ RSpec.configure do |config|
4
4
  config.before(:example, :bolt_configuration) do
5
5
  solidus_bolt_configuration = SolidusBolt::BoltConfiguration.fetch
6
6
 
7
- solidus_bolt_configuration.bearer_token = ENV['BOLT_BEARER_TOKEN']
8
7
  solidus_bolt_configuration.environment = 'sandbox'
9
8
  solidus_bolt_configuration.merchant_public_id = ENV['BOLT_MERCHANT_PUBLIC_ID']
10
9
  solidus_bolt_configuration.division_public_id = ENV['BOLT_DIVISION_PUBLIC_ID']
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.0.1
4
+ version: 0.1.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-06-17 00:00:00.000000000 Z
13
+ date: 2022-06-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: coffee-rails
@@ -54,6 +54,20 @@ dependencies:
54
54
  - - ">="
55
55
  - !ruby/object:Gem::Version
56
56
  version: '0'
57
+ - !ruby/object:Gem::Dependency
58
+ name: multi_json
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ type: :runtime
65
+ prerelease: false
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
57
71
  - !ruby/object:Gem::Dependency
58
72
  name: omniauth-bolt
59
73
  requirement: !ruby/object:Gem::Requirement
@@ -320,6 +334,7 @@ files:
320
334
  - db/migrate/20220526005619_remove_user_id_from_solidus_bolt_payment_source.rb
321
335
  - db/migrate/20220530102107_rename_bolt_configuration_merchant_id_to_division_public_id.rb
322
336
  - db/migrate/20220531075527_update_bolt_configuration_environment_column_restrictions.rb
337
+ - db/migrate/20220629131950_remove_bearer_token_on_solidus_bolt_bolt_configuration.rb
323
338
  - db/seeds.rb
324
339
  - lib/generators/solidus_bolt/install/install_generator.rb
325
340
  - lib/generators/solidus_bolt/install/templates/initializer.rb