spree_cm_commissioner 2.1.2 → 2.1.3
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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +0 -1
- data/app/controllers/spree/api/v2/storefront/pin_code_generators_controller.rb +0 -16
- data/app/controllers/spree/api/v2/storefront/pin_code_otp_generators_controller.rb +0 -16
- data/app/controllers/spree/api/v2/storefront/vattanac_banks_controller.rb +1 -1
- data/app/interactors/spree_cm_commissioner/vattanac_bank_initiator.rb +1 -1
- data/app/models/concerns/spree_cm_commissioner/guest_seat_updater.rb +45 -0
- data/app/queries/spree_cm_commissioner/trip_query.rb +1 -0
- data/app/serializers/spree/v2/tenant/product_serializer.rb +11 -0
- data/app/serializers/spree_cm_commissioner/v2/storefront/trip_result_serializer.rb +1 -1
- data/lib/spree_cm_commissioner/trip_result.rb +1 -1
- data/lib/spree_cm_commissioner/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fcd8e2ebc1971a88d96c69508d9097178ff724540850ad868b7576ba067cfaa8
|
4
|
+
data.tar.gz: fc379da6272fdcad2c4c0baa626889ad62fd5c9b612a1097673b5803118ea368
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d83ea3dc7cc3ae0a5f75dc93e37ac9f21dc6721c0c942807ab936340c28d8de02a0d563e52a94cc1caecf3da32436972c2a48c6e599a4bcd8d42f4dd96eeac67
|
7
|
+
data.tar.gz: e858334e4627f09e87470e9f3a01f36902a709612991971f5defdffd6202888e2fbfbebc162aabd46841cc3ec8105a952a4bbabcc9c412a33d9f44108bdf066d
|
data/Gemfile.lock
CHANGED
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
|
@@ -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['
|
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
|
@@ -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|
|
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.
|
4
|
+
version: 2.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- You
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-09-05 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
|