spree_cm_commissioner 2.1.2 → 2.1.3.pre.beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ee0ae4eae84a0969d4e124d27edbd5f05f82439960fe814dab8221f9e7b486da
4
- data.tar.gz: fce2acf06b539cd00604bc66d1ae0bb2b951c20a3d1769b1a37405b3b0bbe986
3
+ metadata.gz: 1b1bf8bbc92e68f9c6d475925cb6e45f64468be42f63495f6f0934ff396a8335
4
+ data.tar.gz: ebddd7396af6d5036a13656da0dd17f12c4b003bc2166bb62b8f008befdb1704
5
5
  SHA512:
6
- metadata.gz: aae15d8c9a0c90580e07999aaea7c06410ac052c8570c9a5849864b40e871c979458932e222ea734c8fb433eb6d4923a6985a8d98e8fe6c66e775e66881e0edd
7
- data.tar.gz: d6caf18d6baed70edf799ec7a719254fb144ce882bafe5fbdebcb3930913946e72191a53327803b0c016263e5fb4a0f6b6929309afa3ea602c15a635dc83c1e8
6
+ metadata.gz: e500edd2aaf333240d9cccdd410af03ddcf896853daa8eb2129320a60ecdc4b73097da3bc9f4aed9f7b7a74c3736a65dd97ac21e6927b383139f906426cf146d
7
+ data.tar.gz: 68c69b704746da48c93773dffce024b68c7274adde41e2f14b4a4f453eff876e8a0e422fc96067506c1a6a7b64c4c71cc4f34eddd3c99d45616aeb781d6a2e34
data/Gemfile.lock CHANGED
@@ -34,7 +34,7 @@ GIT
34
34
  PATH
35
35
  remote: .
36
36
  specs:
37
- spree_cm_commissioner (2.1.2)
37
+ spree_cm_commissioner (2.1.3.pre.beta)
38
38
  activerecord-multi-tenant
39
39
  activerecord_json_validator (~> 2.1, >= 2.1.3)
40
40
  aws-sdk-cloudfront
data/README.md CHANGED
@@ -116,7 +116,6 @@ ACCOMMODATION_MAX_STAY_DAYS = 10
116
116
  DEFAULT_TELEGRAM_BOT_API_TOKEN = ""
117
117
 
118
118
  PIN_CODE_DEBUG_NOTIFIY_TELEGRAM_ENABLE="yes"
119
- RECAPTCHA_TOKEN_VALIDATOR_ENABLE="yes"
120
119
 
121
120
  EXCEPTION_NOTIFY_ENABLE="yes" # yes or no
122
121
  EXCEPTION_TELEGRAM_BOT_TOKEN=""
@@ -3,22 +3,6 @@ module Spree
3
3
  module V2
4
4
  module Storefront
5
5
  class PinCodeGeneratorsController < ::Spree::Api::V2::ResourceController
6
- before_action :validate_recaptcha, only: [:create]
7
-
8
- def validate_recaptcha
9
- return unless ENV['RECAPTCHA_TOKEN_VALIDATOR_ENABLE'] == 'yes'
10
-
11
- context = SpreeCmCommissioner::RecaptchaTokenValidator.call(
12
- token: params[:recaptcha_token],
13
- action: params[:recaptcha_action],
14
- site_key: params[:recaptcah_site_key]
15
- )
16
-
17
- return if context.success?
18
-
19
- render_error_payload(context.message, 400)
20
- end
21
-
22
6
  # :phone_number, :email, :type, :tenant
23
7
  def create
24
8
  context = SpreeCmCommissioner::PinCodeGenerator.call(pin_code_attrs)
@@ -3,22 +3,6 @@ module Spree
3
3
  module V2
4
4
  module Storefront
5
5
  class PinCodeOtpGeneratorsController < ::Spree::Api::V2::ResourceController
6
- before_action :validate_recaptcha, only: [:create]
7
-
8
- def validate_recaptcha
9
- return unless ENV['RECAPTCHA_TOKEN_VALIDATOR_ENABLE'] == 'yes'
10
-
11
- context = SpreeCmCommissioner::RecaptchaTokenValidator.call(
12
- token: params[:recaptcha_token],
13
- action: params[:recaptcha_action],
14
- site_key: params[:recaptcah_site_key]
15
- )
16
-
17
- return if context.success?
18
-
19
- render_error_payload(context.message, 400)
20
- end
21
-
22
6
  # :phone_number, :email, :type, :recaptcha_token, :recaptcha_action, :recaptcah_site_key
23
7
  def create
24
8
  options = otp_attrs
@@ -14,7 +14,7 @@ module Spree
14
14
  else
15
15
  render json: {
16
16
  message: 'FAILED',
17
- error: result.error
17
+ error: result.message
18
18
  }, status: result.status || :unprocessable_entity
19
19
  end
20
20
  end
@@ -66,7 +66,7 @@ module SpreeCmCommissioner
66
66
 
67
67
  def find_existing_user
68
68
  user_data = context.user_data
69
- intel_phone = normalized_phone_number(user_data['intel_phone'])
69
+ intel_phone = normalized_phone_number(user_data['phoneNum'])
70
70
 
71
71
  context.user = Spree::User.by_non_tenant.find_by(
72
72
  'email = :email OR intel_phone_number = :intel_phone',
@@ -0,0 +1,45 @@
1
+ module SpreeCmCommissioner
2
+ class GuestSeatUpdater < BaseInteractor
3
+ delegate :line_item,
4
+ :guest,
5
+ :block_id,
6
+ :updated_by, to: :context
7
+
8
+ def call
9
+ context.fail!(errors: 'Updated user is required') if updated_by.blank?
10
+ context.fail!(errors: 'Line item not found') unless line_item
11
+ context.fail!(errors: 'Guest not found') unless guest
12
+ context.fail!(errors: 'Block ID is required') if block_id.blank?
13
+
14
+ if block_id.present? && !block_belongs_to_variant?(block_id, line_item.variant_id)
15
+ context.fail!(errors: "Variant change is not allowed — seat can only be updated for the same variant #{line_item.variant_id}")
16
+ end
17
+
18
+ ActiveRecord::Base.transaction do
19
+ update_seat_for_guest
20
+ end
21
+ rescue StandardError => e
22
+ raise if defined?(Interactor::Failure) && e.is_a?(Interactor::Failure)
23
+
24
+ context.fail!(errors: e.message)
25
+ end
26
+
27
+ def update_seat_for_guest
28
+ reserve_block = SpreeCmCommissioner::ReservedBlock.find_by(
29
+ guest_id: guest.id,
30
+ block_id: guest.block_id
31
+ )
32
+ reserve_block.update!(block_id: block_id, updated_by_id: updated_by.id) if reserve_block && reserve_block.block_id != block_id
33
+
34
+ guest.update!(block_id: block_id) if guest.block_id != block_id && block_id.present?
35
+
36
+ line_item
37
+ end
38
+
39
+ def block_belongs_to_variant?(block_id, variant_id)
40
+ return false unless block_id.present? && variant_id.present?
41
+
42
+ SpreeCmCommissioner::VariantBlock.exists?(variant_id: variant_id, block_id: block_id)
43
+ end
44
+ end
45
+ end
@@ -88,6 +88,7 @@ module SpreeCmCommissioner
88
88
  id: trip&.id,
89
89
  departure_time: trip&.departure_time,
90
90
  duration: trip&.duration,
91
+ distance: trip&.distance,
91
92
  allow_seat_selection: trip&.allow_seat_selection,
92
93
  route_type: trip&.route_type,
93
94
  origin_place: {
@@ -0,0 +1,11 @@
1
+ module Spree
2
+ module V2
3
+ module Tenant
4
+ class ProductSerializer < Spree::V2::Storefront::ProductSerializer
5
+ # This serializer extends the Storefront ProductSerializer
6
+ # to include any additional attributes or relationships needed
7
+ # for the Tenant context.
8
+ end
9
+ end
10
+ end
11
+ end
@@ -5,7 +5,7 @@ module SpreeCmCommissioner
5
5
  set_type :trip_result
6
6
 
7
7
  attributes :origin_place, :destination_place, :boarding, :drop_off, :price, :compare_at_amount, :currency, :quantity_available, :max_capacity,
8
- :allow_seat_selection, :departure_time, :route_type
8
+ :allow_seat_selection, :departure_time, :route_type, :distance
9
9
  attribute :duration_in_hms, &:duration_in_hms
10
10
  attribute :arrival_time, &:arrival_time
11
11
  belongs_to :vendor, serializer: ::SpreeCmCommissioner::V2::Storefront::TripVendorSerializer
@@ -4,7 +4,7 @@ module SpreeCmCommissioner
4
4
  :departure_time, :duration, :route_type,
5
5
  :vehicle_id, :vehicle, :vendor_id, :vendor,
6
6
  :quantity_available, :max_capacity, :boarding, :drop_off,
7
- :product_id, :amenities, :price, :compare_at_amount, :currency
7
+ :product_id, :amenities, :price, :compare_at_amount, :currency, :distance
8
8
 
9
9
  def initialize(options = {})
10
10
  options.each do |key, value|
@@ -1,5 +1,5 @@
1
1
  module SpreeCmCommissioner
2
- VERSION = '2.1.2'.freeze
2
+ VERSION = '2.1.3-beta'.freeze
3
3
 
4
4
  module_function
5
5
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_cm_commissioner
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3.pre.beta
5
5
  platform: ruby
6
6
  authors:
7
7
  - You
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-08-29 00:00:00.000000000 Z
11
+ date: 2025-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spree
@@ -1289,6 +1289,7 @@ files:
1289
1289
  - app/mailers/spree_cm_commissioner/team_invite_mailer.rb
1290
1290
  - app/models/.gitkeep
1291
1291
  - app/models/concerns/spree_cm_commissioner/event_check_in_flowable.rb
1292
+ - app/models/concerns/spree_cm_commissioner/guest_seat_updater.rb
1292
1293
  - app/models/concerns/spree_cm_commissioner/homepage_section_bitwise.rb
1293
1294
  - app/models/concerns/spree_cm_commissioner/json_preference_validator.rb
1294
1295
  - app/models/concerns/spree_cm_commissioner/kyc_bitwise.rb
@@ -1750,6 +1751,7 @@ files:
1750
1751
  - app/serializers/spree/v2/tenant/order_serializer.rb
1751
1752
  - app/serializers/spree/v2/tenant/payment_method_group_serializer.rb
1752
1753
  - app/serializers/spree/v2/tenant/payment_method_serializer.rb
1754
+ - app/serializers/spree/v2/tenant/product_serializer.rb
1753
1755
  - app/serializers/spree/v2/tenant/reset_password_serializer.rb
1754
1756
  - app/serializers/spree/v2/tenant/role_serializer.rb
1755
1757
  - app/serializers/spree/v2/tenant/s3_signed_url_serializer.rb
@@ -2885,9 +2887,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
2885
2887
  version: '2.7'
2886
2888
  required_rubygems_version: !ruby/object:Gem::Requirement
2887
2889
  requirements:
2888
- - - ">="
2890
+ - - ">"
2889
2891
  - !ruby/object:Gem::Version
2890
- version: '0'
2892
+ version: 1.3.1
2891
2893
  requirements:
2892
2894
  - none
2893
2895
  rubygems_version: 3.4.1