spree_cm_commissioner 2.13.3.pre.pre2 → 2.13.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/.env.example +0 -1
- data/Gemfile.lock +1 -1
- data/app/controllers/spree/admin/integrations_controller.rb +7 -5
- data/app/controllers/spree/admin/inventory_items_controller.rb +0 -12
- data/app/controllers/spree/api/v2/storefront/draft_orders_controller.rb +41 -3
- data/app/controllers/spree/api/v2/storefront/guest_qrs_controller.rb +2 -0
- data/app/controllers/spree_cm_commissioner/api/v2/storefront/checkout_controller_decorator.rb +0 -3
- data/app/factory/spree_cm_commissioner/order_telegram_message_factory.rb +2 -6
- data/app/models/concerns/spree_cm_commissioner/line_item_bundleable.rb +38 -0
- data/app/models/concerns/spree_cm_commissioner/vehicle_kind.rb +1 -1
- data/app/models/spree_cm_commissioner/guest.rb +8 -0
- data/app/models/spree_cm_commissioner/integration.rb +0 -46
- data/app/models/spree_cm_commissioner/integrations/stadium_x_v1.rb +10 -4
- data/app/models/spree_cm_commissioner/inventory_item.rb +0 -18
- data/app/models/spree_cm_commissioner/line_item_decorator.rb +1 -0
- data/app/models/spree_cm_commissioner/order_decorator.rb +0 -2
- data/app/models/spree_cm_commissioner/place.rb +0 -2
- data/app/models/spree_cm_commissioner/redis_stock/cached_inventory_items_builder.rb +1 -2
- data/app/models/spree_cm_commissioner/route.rb +0 -1
- data/app/models/spree_cm_commissioner/seat_layout.rb +0 -1
- data/app/models/spree_cm_commissioner/stock/availability_checker.rb +1 -1
- data/app/models/spree_cm_commissioner/stock/order_availability_checker.rb +1 -1
- data/app/models/spree_cm_commissioner/stock_item_decorator.rb +0 -4
- data/app/models/spree_cm_commissioner/trip.rb +1 -2
- data/app/models/spree_cm_commissioner/trip_stop.rb +0 -2
- data/app/models/spree_cm_commissioner/variant_decorator.rb +0 -5
- data/app/models/spree_cm_commissioner/vehicle.rb +0 -3
- data/app/models/spree_cm_commissioner/vehicle_type.rb +0 -1
- data/app/models/spree_cm_commissioner/vendor_decorator.rb +0 -17
- data/app/models/spree_cm_commissioner/vendor_place.rb +0 -2
- data/app/serializers/spree/v2/storefront/line_item_serializer_decorator.rb +2 -1
- data/app/serializers/spree_cm_commissioner/v2/storefront/cart_serializer_decorator.rb +2 -1
- data/app/services/spree_cm_commissioner/integrations/base/sync_manager.rb +2 -1
- data/app/services/spree_cm_commissioner/integrations/base/sync_result.rb +0 -11
- data/app/services/spree_cm_commissioner/integrations/stadium_x_v1/external_client/client.rb +15 -14
- data/app/services/spree_cm_commissioner/integrations/stadium_x_v1/polling/sync_matches.rb +4 -7
- data/app/services/spree_cm_commissioner/integrations/stadium_x_v1/polling/sync_zones.rb +3 -6
- data/app/services/spree_cm_commissioner/integrations/stadium_x_v1/sync_manager.rb +3 -0
- data/app/services/spree_cm_commissioner/integrations/stadium_x_v1/sync_strategies/full_sync_strategy.rb +3 -1
- data/app/services/spree_cm_commissioner/integrations/stadium_x_v1/sync_strategies/incremental_sync_strategy.rb +3 -1
- data/app/services/spree_cm_commissioner/integrations/stadium_x_v1/sync_strategies/webhook_sync_strategy.rb +2 -1
- data/app/services/spree_cm_commissioner/inventory_items/bulk_adjust_quantities_by_variant.rb +0 -4
- data/app/services/spree_cm_commissioner/inventory_items/reset.rb +0 -4
- data/app/services/spree_cm_commissioner/order_holds/hold.rb +0 -17
- data/app/services/spree_cm_commissioner/order_holds/release.rb +0 -17
- data/app/services/spree_cm_commissioner/seat_layouts/update.rb +4 -0
- data/app/services/spree_cm_commissioner/transit_order/create.rb +8 -2
- data/app/services/spree_cm_commissioner/users/backfill_device_tokens_count.rb +48 -0
- data/app/views/spree/admin/integrations/_form.html.erb +0 -16
- data/app/views/spree/admin/integrations/index.html.erb +1 -1
- data/config/locales/en.yml +0 -2
- data/config/locales/km.yml +0 -2
- data/config/routes.rb +0 -25
- data/db/migrate/20260925000000_change_commission_rate_default_on_spree_vendors.rb +5 -0
- data/db/migrate/20260925090000_add_parent_id_and_relation_type_to_spree_line_items.rb +6 -0
- data/lib/spree_cm_commissioner/cached_inventory_item.rb +1 -7
- data/lib/spree_cm_commissioner/test_helper/factories/integration_factory.rb +0 -17
- data/lib/spree_cm_commissioner/version.rb +1 -1
- data/lib/tasks/backfill_device_tokens_count.rake +8 -0
- metadata +8 -161
- data/app/controllers/spree/api/switch_cm/base_controller.rb +0 -98
- data/app/controllers/spree/api/switch_cm/ota/avail_notifs_controller.rb +0 -17
- data/app/controllers/spree/api/switch_cm/ota/base_controller.rb +0 -27
- data/app/controllers/spree/api/switch_cm/ota/product_notifs_controller.rb +0 -44
- data/app/controllers/spree/api/switch_cm/ota/pushes_controller.rb +0 -46
- data/app/controllers/spree/api/switch_cm/ota/rate_amount_notifs_controller.rb +0 -17
- data/app/controllers/spree/api/switch_cm/ota/res_modify_notifs_controller.rb +0 -31
- data/app/controllers/spree/api/switch_cm/ota/res_notifs_controller.rb +0 -29
- data/app/controllers/spree/api/switch_cm/ota/reservation_streams_controller.rb +0 -83
- data/app/controllers/spree/api/switch_cm/tokens_controller.rb +0 -68
- data/app/controllers/spree/api/switch_cm/xml/availabilities_controller.rb +0 -39
- data/app/controllers/spree/api/switch_cm/xml/base_controller.rb +0 -37
- data/app/controllers/spree/api/switch_cm/xml/reservation_summaries_controller.rb +0 -28
- data/app/controllers/spree/api/switch_cm/xml/reservations_controller.rb +0 -56
- data/app/controllers/spree/api/switch_cm/xml/room_rate_availabilities_controller.rb +0 -56
- data/app/controllers/spree/api/switch_cm/xml/room_rates_controller.rb +0 -32
- data/app/controllers/spree/api/v2/storefront/transit/item_availabilities_controller.rb +0 -66
- data/app/jobs/spree_cm_commissioner/audit_event_job.rb +0 -29
- data/app/models/concerns/spree_cm_commissioner/audit_wrapper.rb +0 -139
- data/app/models/concerns/spree_cm_commissioner/integrations/inventory_sync_cachable.rb +0 -9
- data/app/models/concerns/spree_cm_commissioner/variant_metadata.rb +0 -24
- data/app/models/spree_cm_commissioner/audit_event.rb +0 -11
- data/app/models/spree_cm_commissioner/currency_rate.rb +0 -15
- data/app/models/spree_cm_commissioner/integrations/book_me_bus_v1.rb +0 -64
- data/app/models/spree_cm_commissioner/integrations/larryta.rb +0 -81
- data/app/models/spree_cm_commissioner/integrations/switch_cm.rb +0 -86
- data/app/models/spree_cm_commissioner/integrations/vireak_buntham.rb +0 -82
- data/app/serializables/spree_cm_commissioner/item_availability_sync.rb +0 -10
- data/app/serializers/spree_cm_commissioner/v2/storefront/item_availability_sync_serializer.rb +0 -10
- data/app/services/spree_cm_commissioner/audit_logger.rb +0 -59
- data/app/services/spree_cm_commissioner/currency_converter/create.rb +0 -27
- data/app/services/spree_cm_commissioner/currency_rates/manage.rb +0 -99
- data/app/services/spree_cm_commissioner/google_maps_geocoder.rb +0 -41
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/external_client/client.rb +0 -230
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/external_client/connection.rb +0 -147
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/inventory/external_inventory_item_status.rb +0 -52
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/inventory/external_inventory_items.rb +0 -91
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/inventory/unstock_inventory.rb +0 -188
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/polling/sync_inventory.rb +0 -79
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/polling/sync_item_availability.rb +0 -354
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/polling/sync_locations.rb +0 -103
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/polling/sync_nationality_pricing.rb +0 -93
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/polling/sync_product.rb +0 -70
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/polling/sync_route_stops.rb +0 -121
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/polling/sync_routes.rb +0 -128
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/polling/sync_seat_layout.rb +0 -412
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/polling/sync_service_calendars.rb +0 -59
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/polling/sync_trip_stop.rb +0 -224
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/polling/sync_trips.rb +0 -769
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/polling/sync_variant.rb +0 -69
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/polling/sync_vehicle_types.rb +0 -92
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/polling/time_parser.rb +0 -19
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/base.rb +0 -40
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/inventory_item_status.rb +0 -148
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/location.rb +0 -55
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/reservation_cart.rb +0 -85
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/seat.rb +0 -128
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/seat_layout.rb +0 -386
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/stop.rb +0 -84
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/trip.rb +0 -237
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/wallet_payment.rb +0 -48
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/sync_manager.rb +0 -22
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/sync_strategies/full_sync_strategy.rb +0 -116
- data/app/services/spree_cm_commissioner/integrations/book_me_bus_v1/sync_strategies/incremental_sync_strategy.rb +0 -63
- data/app/services/spree_cm_commissioner/integrations/larryta/external_client/client.rb +0 -314
- data/app/services/spree_cm_commissioner/integrations/larryta/external_client/connection.rb +0 -74
- data/app/services/spree_cm_commissioner/integrations/larryta/inventory/external_inventory_item_status.rb +0 -53
- data/app/services/spree_cm_commissioner/integrations/larryta/inventory/external_inventory_items.rb +0 -106
- data/app/services/spree_cm_commissioner/integrations/larryta/inventory/hold_seats.rb +0 -143
- data/app/services/spree_cm_commissioner/integrations/larryta/inventory/release_seats.rb +0 -90
- data/app/services/spree_cm_commissioner/integrations/larryta/inventory/unstock_inventory.rb +0 -143
- data/app/services/spree_cm_commissioner/integrations/larryta/polling/sync_item_availability.rb +0 -325
- data/app/services/spree_cm_commissioner/integrations/larryta/polling/sync_product.rb +0 -72
- data/app/services/spree_cm_commissioner/integrations/larryta/polling/sync_routes.rb +0 -142
- data/app/services/spree_cm_commissioner/integrations/larryta/polling/sync_seat_layout.rb +0 -255
- data/app/services/spree_cm_commissioner/integrations/larryta/polling/sync_stock_item.rb +0 -55
- data/app/services/spree_cm_commissioner/integrations/larryta/polling/sync_trip_stop.rb +0 -171
- data/app/services/spree_cm_commissioner/integrations/larryta/polling/sync_trips.rb +0 -397
- data/app/services/spree_cm_commissioner/integrations/larryta/polling/sync_variant.rb +0 -63
- data/app/services/spree_cm_commissioner/integrations/larryta/polling/sync_vehicle_type.rb +0 -79
- data/app/services/spree_cm_commissioner/integrations/larryta/resources/base.rb +0 -39
- data/app/services/spree_cm_commissioner/integrations/larryta/resources/booking.rb +0 -113
- data/app/services/spree_cm_commissioner/integrations/larryta/resources/booking_session.rb +0 -43
- data/app/services/spree_cm_commissioner/integrations/larryta/resources/booking_transaction.rb +0 -236
- data/app/services/spree_cm_commissioner/integrations/larryta/resources/direction.rb +0 -71
- data/app/services/spree_cm_commissioner/integrations/larryta/resources/passenger.rb +0 -48
- data/app/services/spree_cm_commissioner/integrations/larryta/resources/schedule.rb +0 -150
- data/app/services/spree_cm_commissioner/integrations/larryta/resources/seat.rb +0 -31
- data/app/services/spree_cm_commissioner/integrations/larryta/resources/seat_availability.rb +0 -49
- data/app/services/spree_cm_commissioner/integrations/larryta/resources/seat_layout.rb +0 -211
- data/app/services/spree_cm_commissioner/integrations/larryta/sync_manager.rb +0 -17
- data/app/services/spree_cm_commissioner/integrations/larryta/sync_strategies/full_sync_strategy.rb +0 -79
- data/app/services/spree_cm_commissioner/integrations/larryta/sync_strategies/incremental_sync_strategy.rb +0 -58
- data/app/services/spree_cm_commissioner/integrations/switch_cm/accept_push.rb +0 -101
- data/app/services/spree_cm_commissioner/integrations/switch_cm/accommodation_lock.rb +0 -41
- data/app/services/spree_cm_commissioner/integrations/switch_cm/acknowledge_reservations.rb +0 -43
- data/app/services/spree_cm_commissioner/integrations/switch_cm/apply_ari.rb +0 -119
- data/app/services/spree_cm_commissioner/integrations/switch_cm/ari_update.rb +0 -24
- data/app/services/spree_cm_commissioner/integrations/switch_cm/availability_readback.rb +0 -86
- data/app/services/spree_cm_commissioner/integrations/switch_cm/mark_seen.rb +0 -53
- data/app/services/spree_cm_commissioner/integrations/switch_cm/ota/avail_notif_parser.rb +0 -60
- data/app/services/spree_cm_commissioner/integrations/switch_cm/ota/base_parser.rb +0 -60
- data/app/services/spree_cm_commissioner/integrations/switch_cm/ota/push_response.rb +0 -38
- data/app/services/spree_cm_commissioner/integrations/switch_cm/ota/rate_amount_notif_parser.rb +0 -46
- data/app/services/spree_cm_commissioner/integrations/switch_cm/ota/reservation_presenter.rb +0 -99
- data/app/services/spree_cm_commissioner/integrations/switch_cm/ota/response_builder.rb +0 -52
- data/app/services/spree_cm_commissioner/integrations/switch_cm/pushed_nights.rb +0 -79
- data/app/services/spree_cm_commissioner/integrations/switch_cm/reservation.rb +0 -118
- data/app/services/spree_cm_commissioner/integrations/switch_cm/reservation_feed.rb +0 -143
- data/app/services/spree_cm_commissioner/integrations/switch_cm/room_catalog.rb +0 -56
- data/app/services/spree_cm_commissioner/integrations/switch_cm/sync_manager.rb +0 -16
- data/app/services/spree_cm_commissioner/integrations/switch_cm/sync_strategies/full_sync_strategy.rb +0 -39
- data/app/services/spree_cm_commissioner/integrations/switch_cm/sync_strategies/incremental_sync_strategy.rb +0 -51
- data/app/services/spree_cm_commissioner/integrations/switch_cm/unseen_room_nights.rb +0 -39
- data/app/services/spree_cm_commissioner/integrations/switch_cm/validate_ari_updates.rb +0 -136
- data/app/services/spree_cm_commissioner/integrations/switch_cm/xml/availability_parser.rb +0 -103
- data/app/services/spree_cm_commissioner/integrations/switch_cm/xml/push_response.rb +0 -45
- data/app/services/spree_cm_commissioner/integrations/switch_cm/xml/reservation_presenter.rb +0 -74
- data/app/services/spree_cm_commissioner/integrations/switch_cm/xml/response_builder.rb +0 -19
- data/app/services/spree_cm_commissioner/integrations/vireak_buntham/external_client/client.rb +0 -170
- data/app/services/spree_cm_commissioner/integrations/vireak_buntham/external_client/connection.rb +0 -59
- data/app/services/spree_cm_commissioner/integrations/vireak_buntham/inventory/external_inventory_item_status.rb +0 -48
- data/app/services/spree_cm_commissioner/integrations/vireak_buntham/inventory/external_inventory_items.rb +0 -92
- data/app/services/spree_cm_commissioner/integrations/vireak_buntham/inventory/unstock_inventory.rb +0 -230
- data/app/services/spree_cm_commissioner/integrations/vireak_buntham/polling/sync_item_availability.rb +0 -270
- data/app/services/spree_cm_commissioner/integrations/vireak_buntham/polling/sync_locations.rb +0 -96
- data/app/services/spree_cm_commissioner/integrations/vireak_buntham/polling/sync_nationality_pricing.rb +0 -76
- data/app/services/spree_cm_commissioner/integrations/vireak_buntham/polling/sync_product.rb +0 -69
- data/app/services/spree_cm_commissioner/integrations/vireak_buntham/polling/sync_routes.rb +0 -110
- data/app/services/spree_cm_commissioner/integrations/vireak_buntham/polling/sync_seat_layout.rb +0 -207
- data/app/services/spree_cm_commissioner/integrations/vireak_buntham/polling/sync_stock_item.rb +0 -43
- data/app/services/spree_cm_commissioner/integrations/vireak_buntham/polling/sync_trip_stop.rb +0 -192
- data/app/services/spree_cm_commissioner/integrations/vireak_buntham/polling/sync_trips.rb +0 -377
- data/app/services/spree_cm_commissioner/integrations/vireak_buntham/polling/sync_variant.rb +0 -56
- data/app/services/spree_cm_commissioner/integrations/vireak_buntham/polling/sync_vehicle_type.rb +0 -51
- data/app/services/spree_cm_commissioner/integrations/vireak_buntham/resources/base.rb +0 -32
- data/app/services/spree_cm_commissioner/integrations/vireak_buntham/resources/booking.rb +0 -48
- data/app/services/spree_cm_commissioner/integrations/vireak_buntham/resources/booking_transaction.rb +0 -46
- data/app/services/spree_cm_commissioner/integrations/vireak_buntham/resources/cell.rb +0 -53
- data/app/services/spree_cm_commissioner/integrations/vireak_buntham/resources/confirm_booking_request.rb +0 -43
- data/app/services/spree_cm_commissioner/integrations/vireak_buntham/resources/location.rb +0 -37
- data/app/services/spree_cm_commissioner/integrations/vireak_buntham/resources/schedule.rb +0 -138
- data/app/services/spree_cm_commissioner/integrations/vireak_buntham/resources/seat.rb +0 -48
- data/app/services/spree_cm_commissioner/integrations/vireak_buntham/resources/seat_layout.rb +0 -79
- data/app/services/spree_cm_commissioner/integrations/vireak_buntham/sync_manager.rb +0 -17
- data/app/services/spree_cm_commissioner/integrations/vireak_buntham/sync_strategies/full_sync_strategy.rb +0 -87
- data/app/services/spree_cm_commissioner/integrations/vireak_buntham/sync_strategies/incremental_sync_strategy.rb +0 -53
- data/app/services/spree_cm_commissioner/inventory_items/generate_permanent_item.rb +0 -48
- data/app/services/spree_cm_commissioner/place_resolver.rb +0 -95
- data/app/views/spree/admin/integrations/_book_me_bus_v1_fields.html.erb +0 -47
- data/app/views/spree/admin/integrations/_larryta_fields.html.erb +0 -58
- data/app/views/spree/admin/integrations/_switch_cm_fields.html.erb +0 -53
- data/app/views/spree/admin/integrations/_vireak_buntham_fields.html.erb +0 -75
- data/db/migrate/20260327143200_create_cm_audit_events.rb +0 -21
- data/db/migrate/20260410045815_create_cm_currency_rates.rb +0 -23
- data/db/migrate/20260411102139_add_metadata_to_cm_inventory_items.rb +0 -6
- data/db/migrate/20260928000000_add_oauth_application_id_to_cm_integrations.rb +0 -5
- data/db/migrate/20260928000001_add_closed_to_cm_inventory_items.rb +0 -5
|
@@ -174,17 +174,6 @@ module SpreeCmCommissioner::Integrations::Base
|
|
|
174
174
|
@error.nil?
|
|
175
175
|
end
|
|
176
176
|
|
|
177
|
-
# Access metrics
|
|
178
|
-
# @return [Hash] The metrics hash
|
|
179
|
-
attr_reader :metrics
|
|
180
|
-
|
|
181
|
-
# Access API calls
|
|
182
|
-
# @return [Hash] The API calls hash
|
|
183
|
-
attr_reader :api_calls
|
|
184
|
-
|
|
185
|
-
# Timestamp of the last synced item (set by SyncItemAvailability)
|
|
186
|
-
attr_accessor :last_synced_at
|
|
187
|
-
|
|
188
177
|
# Serialize to hash for JSONB persistence
|
|
189
178
|
# @return [Hash] Serialized representation
|
|
190
179
|
def to_h
|
|
@@ -4,10 +4,11 @@ class SpreeCmCommissioner::Integrations::StadiumXV1
|
|
|
4
4
|
BASE_PATH = '/api/v1'.freeze
|
|
5
5
|
RATE_LIMIT = 100
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
@
|
|
7
|
+
def initialize(public_key:, private_key:, base_url:)
|
|
8
|
+
@public_key = public_key
|
|
9
|
+
@private_key = private_key
|
|
10
|
+
@base_url = base_url
|
|
11
|
+
@connection = build_connection
|
|
11
12
|
end
|
|
12
13
|
|
|
13
14
|
# Ticket Operations
|
|
@@ -16,7 +17,7 @@ class SpreeCmCommissioner::Integrations::StadiumXV1
|
|
|
16
17
|
# @param id [String] The ticket ID
|
|
17
18
|
# @return [Resources::Ticket] The ticket object
|
|
18
19
|
def get_ticket!(id:)
|
|
19
|
-
response = connection.get("#{BASE_PATH}/tickets/#{id}") do |req|
|
|
20
|
+
response = @connection.get("#{BASE_PATH}/tickets/#{id}") do |req|
|
|
20
21
|
req.body = auth_params.to_json
|
|
21
22
|
end
|
|
22
23
|
|
|
@@ -27,7 +28,7 @@ class SpreeCmCommissioner::Integrations::StadiumXV1
|
|
|
27
28
|
# @param user_id [String] The user ID
|
|
28
29
|
# @return [Array<Resources::Ticket>] Array of ticket objects
|
|
29
30
|
def get_tickets_by_user!(user_id:)
|
|
30
|
-
response = connection.get("#{BASE_PATH}/tickets/user/#{user_id}") do |req|
|
|
31
|
+
response = @connection.get("#{BASE_PATH}/tickets/user/#{user_id}") do |req|
|
|
31
32
|
req.body = auth_params.merge(user_id: user_id).to_json
|
|
32
33
|
end
|
|
33
34
|
|
|
@@ -50,7 +51,7 @@ class SpreeCmCommissioner::Integrations::StadiumXV1
|
|
|
50
51
|
quantity: quantity
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
response = connection.post("#{BASE_PATH}/tickets") do |req|
|
|
54
|
+
response = @connection.post("#{BASE_PATH}/tickets") do |req|
|
|
54
55
|
req.body = auth_params.merge(params).to_json
|
|
55
56
|
req.headers['Content-Type'] = 'application/json'
|
|
56
57
|
end
|
|
@@ -63,7 +64,7 @@ class SpreeCmCommissioner::Integrations::StadiumXV1
|
|
|
63
64
|
# Get all available matches
|
|
64
65
|
# @return [Array<Resources::Match>] Array of match objects
|
|
65
66
|
def get_matches! # rubocop:disable Naming/AccessorMethodName
|
|
66
|
-
response = connection.get("#{BASE_PATH}/matches") do |req|
|
|
67
|
+
response = @connection.get("#{BASE_PATH}/matches") do |req|
|
|
67
68
|
req.params = auth_params
|
|
68
69
|
end
|
|
69
70
|
|
|
@@ -74,7 +75,7 @@ class SpreeCmCommissioner::Integrations::StadiumXV1
|
|
|
74
75
|
# @param id [String] The match ID
|
|
75
76
|
# @return [Resources::Match] The match object
|
|
76
77
|
def get_match!(id:)
|
|
77
|
-
response = connection.get("#{BASE_PATH}/matches/#{id}") do |req|
|
|
78
|
+
response = @connection.get("#{BASE_PATH}/matches/#{id}") do |req|
|
|
78
79
|
req.params = auth_params
|
|
79
80
|
end
|
|
80
81
|
|
|
@@ -88,7 +89,7 @@ class SpreeCmCommissioner::Integrations::StadiumXV1
|
|
|
88
89
|
# @param match_id [String] The match ID
|
|
89
90
|
# @return [Array<Resources::Zone>] Array of zone objects
|
|
90
91
|
def get_zones!(club_id:, match_id:)
|
|
91
|
-
response = connection.get("#{BASE_PATH}/zones/club") do |req|
|
|
92
|
+
response = @connection.get("#{BASE_PATH}/zones/club") do |req|
|
|
92
93
|
req.params = auth_params.merge(
|
|
93
94
|
club_id: club_id,
|
|
94
95
|
match_id: match_id
|
|
@@ -100,8 +101,8 @@ class SpreeCmCommissioner::Integrations::StadiumXV1
|
|
|
100
101
|
|
|
101
102
|
private
|
|
102
103
|
|
|
103
|
-
def
|
|
104
|
-
|
|
104
|
+
def build_connection
|
|
105
|
+
Faraday.new(url: @base_url) do |faraday|
|
|
105
106
|
faraday.request :json
|
|
106
107
|
faraday.response :json, content_type: /\bjson$/
|
|
107
108
|
faraday.adapter Faraday.default_adapter
|
|
@@ -110,8 +111,8 @@ class SpreeCmCommissioner::Integrations::StadiumXV1
|
|
|
110
111
|
|
|
111
112
|
def auth_params
|
|
112
113
|
{
|
|
113
|
-
public_key: @
|
|
114
|
-
private_key: @
|
|
114
|
+
public_key: @public_key,
|
|
115
|
+
private_key: @private_key
|
|
115
116
|
}
|
|
116
117
|
end
|
|
117
118
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
class SpreeCmCommissioner::Integrations::StadiumXV1
|
|
2
2
|
module Polling
|
|
3
3
|
class SyncMatches
|
|
4
|
-
def initialize(integration:, sync_result: nil)
|
|
4
|
+
def initialize(client:, integration:, sync_result: nil)
|
|
5
|
+
@client = client
|
|
5
6
|
@integration = integration
|
|
6
7
|
@sync_result = sync_result || SpreeCmCommissioner::Integrations::Base::SyncResult.new
|
|
7
8
|
end
|
|
@@ -11,14 +12,10 @@ class SpreeCmCommissioner::Integrations::StadiumXV1
|
|
|
11
12
|
cleanup_stale_mappings!(synced_match_mappings)
|
|
12
13
|
end
|
|
13
14
|
|
|
14
|
-
def client
|
|
15
|
-
@client ||= @integration.client
|
|
16
|
-
end
|
|
17
|
-
|
|
18
15
|
# Sync all available matches from the API and create them as events
|
|
19
16
|
def sync_matches!
|
|
20
17
|
external_matches = begin
|
|
21
|
-
@sync_result.track_api_call('get_matches') { client.get_matches! }
|
|
18
|
+
@sync_result.track_api_call('get_matches') { @client.get_matches! }
|
|
22
19
|
rescue SpreeCmCommissioner::Integrations::ExternalClientError => e
|
|
23
20
|
raise SpreeCmCommissioner::Integrations::SyncError, "Failed to sync matches: #{e.message}"
|
|
24
21
|
end
|
|
@@ -32,7 +29,7 @@ class SpreeCmCommissioner::Integrations::StadiumXV1
|
|
|
32
29
|
# Match data might be incomplete in the matches list, so we fetch full details
|
|
33
30
|
def sync_match!(external_match)
|
|
34
31
|
external_match = begin
|
|
35
|
-
@sync_result.track_api_call('get_match_details') { client.get_match!(id: external_match._id) }
|
|
32
|
+
@sync_result.track_api_call('get_match_details') { @client.get_match!(id: external_match._id) }
|
|
36
33
|
rescue SpreeCmCommissioner::Integrations::ExternalClientError => e
|
|
37
34
|
raise SpreeCmCommissioner::Integrations::SyncError, "Failed to sync matches: #{e.message}"
|
|
38
35
|
end
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
class SpreeCmCommissioner::Integrations::StadiumXV1
|
|
2
2
|
module Polling
|
|
3
3
|
class SyncZones
|
|
4
|
-
def initialize(integration:, sync_result:)
|
|
4
|
+
def initialize(client:, integration:, sync_result:)
|
|
5
|
+
@client = client
|
|
5
6
|
@integration = integration
|
|
6
7
|
@sync_result = sync_result
|
|
7
8
|
end
|
|
@@ -18,17 +19,13 @@ class SpreeCmCommissioner::Integrations::StadiumXV1
|
|
|
18
19
|
cleanup_stale_mappings!(match_mapping, synced_zone_mappings, match_section)
|
|
19
20
|
end
|
|
20
21
|
|
|
21
|
-
def client
|
|
22
|
-
@client ||= @integration.client
|
|
23
|
-
end
|
|
24
|
-
|
|
25
22
|
# Sync zones for a specific club and match
|
|
26
23
|
def sync_zones!(match_mapping, match_section)
|
|
27
24
|
external_club_id = match_mapping.external_payload&.dig('club_id')
|
|
28
25
|
raise SpreeCmCommissioner::Integrations::SyncError, 'club_id is required' if external_club_id.blank?
|
|
29
26
|
|
|
30
27
|
external_zones = begin
|
|
31
|
-
@sync_result.track_api_call('get_zones') { client.get_zones!(club_id: external_club_id, match_id: match_mapping.external_id) }
|
|
28
|
+
@sync_result.track_api_call('get_zones') { @client.get_zones!(club_id: external_club_id, match_id: match_mapping.external_id) }
|
|
32
29
|
rescue SpreeCmCommissioner::Integrations::ExternalClientError => e
|
|
33
30
|
raise SpreeCmCommissioner::Integrations::SyncError, "Failed to sync zones match #{match_mapping.external_id}: #{e.message}"
|
|
34
31
|
end
|
|
@@ -4,6 +4,7 @@ class SpreeCmCommissioner::Integrations::StadiumXV1
|
|
|
4
4
|
def sync_full!
|
|
5
5
|
run_execution(:full) do
|
|
6
6
|
SyncStrategies::FullSyncStrategy.new(
|
|
7
|
+
client: @client,
|
|
7
8
|
integration: @integration
|
|
8
9
|
).call
|
|
9
10
|
end
|
|
@@ -13,6 +14,7 @@ class SpreeCmCommissioner::Integrations::StadiumXV1
|
|
|
13
14
|
def sync_incremental!
|
|
14
15
|
run_execution(:incremental) do
|
|
15
16
|
SyncStrategies::IncrementalSyncStrategy.new(
|
|
17
|
+
client: @client,
|
|
16
18
|
integration: @integration
|
|
17
19
|
).call
|
|
18
20
|
end
|
|
@@ -22,6 +24,7 @@ class SpreeCmCommissioner::Integrations::StadiumXV1
|
|
|
22
24
|
def sync_webhook!(event_type:, event_data:)
|
|
23
25
|
run_execution(:webhook) do
|
|
24
26
|
SyncStrategies::WebhookSyncStrategy.new(
|
|
27
|
+
client: @client,
|
|
25
28
|
integration: @integration,
|
|
26
29
|
event_type: event_type,
|
|
27
30
|
event_data: event_data
|
|
@@ -14,7 +14,8 @@ class SpreeCmCommissioner::Integrations::StadiumXV1
|
|
|
14
14
|
# - Syncs zone data for one match per interval
|
|
15
15
|
# - Keeps data fresh without overwhelming the system
|
|
16
16
|
class FullSyncStrategy
|
|
17
|
-
def initialize(integration:)
|
|
17
|
+
def initialize(client:, integration:)
|
|
18
|
+
@client = client
|
|
18
19
|
@integration = integration
|
|
19
20
|
@sync_result = ::SpreeCmCommissioner::Integrations::Base::SyncResult.new
|
|
20
21
|
end
|
|
@@ -22,6 +23,7 @@ class SpreeCmCommissioner::Integrations::StadiumXV1
|
|
|
22
23
|
def call
|
|
23
24
|
begin
|
|
24
25
|
Polling::SyncMatches.new(
|
|
26
|
+
client: @client,
|
|
25
27
|
integration: @integration,
|
|
26
28
|
sync_result: @sync_result
|
|
27
29
|
).call
|
|
@@ -13,7 +13,8 @@ class SpreeCmCommissioner::Integrations::StadiumXV1
|
|
|
13
13
|
#
|
|
14
14
|
# This ensures all matches get synced regularly without overwhelming the system.
|
|
15
15
|
class IncrementalSyncStrategy
|
|
16
|
-
def initialize(integration:)
|
|
16
|
+
def initialize(client:, integration:)
|
|
17
|
+
@client = client
|
|
17
18
|
@integration = integration
|
|
18
19
|
@sync_result = ::SpreeCmCommissioner::Integrations::Base::SyncResult.new
|
|
19
20
|
end
|
|
@@ -27,6 +28,7 @@ class SpreeCmCommissioner::Integrations::StadiumXV1
|
|
|
27
28
|
|
|
28
29
|
Polling::SyncZones.new(
|
|
29
30
|
integration: @integration,
|
|
31
|
+
client: @integration.client,
|
|
30
32
|
sync_result: @sync_result
|
|
31
33
|
).call(external_match_id: oldest_sync_mapping.external_id)
|
|
32
34
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
class SpreeCmCommissioner::Integrations::StadiumXV1
|
|
2
2
|
module SyncStrategies
|
|
3
3
|
class WebhookSyncStrategy
|
|
4
|
-
def initialize(integration:, event_type:, event_data:)
|
|
4
|
+
def initialize(client:, integration:, event_type:, event_data:)
|
|
5
|
+
@client = client
|
|
5
6
|
@integration = integration
|
|
6
7
|
@event_type = event_type
|
|
7
8
|
@event_data = event_data
|
data/app/services/spree_cm_commissioner/inventory_items/bulk_adjust_quantities_by_variant.rb
CHANGED
|
@@ -5,10 +5,6 @@ module SpreeCmCommissioner
|
|
|
5
5
|
extend SpreeCmCommissioner::ServiceModuleThrowable
|
|
6
6
|
|
|
7
7
|
def call(variant:, quantity:)
|
|
8
|
-
# The physical count still changes (it caps a channel manager's "unlimited"), but each night's
|
|
9
|
-
# sellable count is the partner's, and its next update would overwrite a shift.
|
|
10
|
-
return success(nil) if variant.inventory_external_wins?
|
|
11
|
-
|
|
12
8
|
variant.inventory_items.active.find_each do |inventory_item|
|
|
13
9
|
inventory_item.adjust_quantity!(quantity)
|
|
14
10
|
end
|
|
@@ -32,10 +32,6 @@ module SpreeCmCommissioner
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def variant_total_inventory(inventory_item)
|
|
35
|
-
# The partner sets the night's capacity (a channel manager's ApplyAri keeps max_capacity at
|
|
36
|
-
# pushed + sold), so recomputing it from the physical count would undo its last update.
|
|
37
|
-
return inventory_item.max_capacity if inventory_item.variant.inventory_external_wins?
|
|
38
|
-
|
|
39
35
|
# for shipment, total_on_hand is not orignal stock. shipment does subtract the stock.
|
|
40
36
|
# to get desire result, we need to add to total_purchase.
|
|
41
37
|
if inventory_item.variant.delivery_required?
|
|
@@ -8,14 +8,12 @@ module SpreeCmCommissioner
|
|
|
8
8
|
|
|
9
9
|
UnableToHoldSeatsError = Class.new(StandardError)
|
|
10
10
|
UnableToHoldInventoryError = Class.new(StandardError)
|
|
11
|
-
UnableToHoldExternalInventoryError = Class.new(StandardError)
|
|
12
11
|
|
|
13
12
|
HOLD_DURATION = ENV.fetch('HOLD_DURATION_IN_MINUTES', '8').to_i.minutes
|
|
14
13
|
|
|
15
14
|
def call(order:, expires_at: HOLD_DURATION.from_now)
|
|
16
15
|
held_blocks = hold_seat_blocks!(order, expires_at)
|
|
17
16
|
inventory_hold = acquire_inventory_hold!(order, expires_at)
|
|
18
|
-
hold_external_inventory!(order)
|
|
19
17
|
|
|
20
18
|
sync_hold_expires_at!(order, held_blocks, inventory_hold)
|
|
21
19
|
|
|
@@ -68,21 +66,6 @@ module SpreeCmCommissioner
|
|
|
68
66
|
|
|
69
67
|
order.update!(hold_expires_at: earliest)
|
|
70
68
|
end
|
|
71
|
-
|
|
72
|
-
def hold_external_inventory!(order)
|
|
73
|
-
integration_line_items = order.line_items.select(&:integration?)
|
|
74
|
-
return if integration_line_items.empty?
|
|
75
|
-
|
|
76
|
-
integration_line_items.group_by(&:vendor_id).each do |_, line_items|
|
|
77
|
-
integration = line_items.first&.vendor&.integration
|
|
78
|
-
next if integration.nil?
|
|
79
|
-
next unless integration.supports_external_inventory_holding?
|
|
80
|
-
|
|
81
|
-
integration.hold_inventory!(order, line_items)
|
|
82
|
-
end
|
|
83
|
-
rescue SpreeCmCommissioner::Integrations::SyncError => e
|
|
84
|
-
raise UnableToHoldExternalInventoryError, e.message
|
|
85
|
-
end
|
|
86
69
|
end
|
|
87
70
|
end
|
|
88
71
|
end
|
|
@@ -8,12 +8,10 @@ module SpreeCmCommissioner
|
|
|
8
8
|
|
|
9
9
|
UnableToCancelSeatsError = Class.new(StandardError)
|
|
10
10
|
UnableToReleaseInventoryError = Class.new(StandardError)
|
|
11
|
-
UnableToReleaseExternalInventoryError = Class.new(StandardError)
|
|
12
11
|
|
|
13
12
|
def call(order:, reason: :user_canceled)
|
|
14
13
|
cancel_seat_blocks!(order)
|
|
15
14
|
release_inventory_hold!(order, reason)
|
|
16
|
-
release_external_inventory!(order)
|
|
17
15
|
|
|
18
16
|
order.update!(hold_expires_at: nil)
|
|
19
17
|
|
|
@@ -53,21 +51,6 @@ module SpreeCmCommissioner
|
|
|
53
51
|
|
|
54
52
|
result.value
|
|
55
53
|
end
|
|
56
|
-
|
|
57
|
-
def release_external_inventory!(order)
|
|
58
|
-
integration_line_items = order.line_items.select(&:integration?)
|
|
59
|
-
return if integration_line_items.empty?
|
|
60
|
-
|
|
61
|
-
integration_line_items.group_by(&:vendor_id).each_value do |line_items|
|
|
62
|
-
integration = line_items.first&.vendor&.integration
|
|
63
|
-
next if integration.nil?
|
|
64
|
-
next unless integration.supports_auto_release_inventory?
|
|
65
|
-
|
|
66
|
-
result = integration.release_inventory!(order, line_items)
|
|
67
|
-
|
|
68
|
-
raise UnableToReleaseExternalInventoryError, result.error.to_s unless result.success?
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
54
|
end
|
|
72
55
|
end
|
|
73
56
|
end
|
|
@@ -9,6 +9,10 @@ module SpreeCmCommissioner
|
|
|
9
9
|
|
|
10
10
|
def call(seat_layout:, attributes:)
|
|
11
11
|
attributes = attributes.deep_dup
|
|
12
|
+
# `background_svg_url` is derived (SeatLayout#background_svg_url), not a writable column —
|
|
13
|
+
# the event-scoped caller strips/handles it separately (background removal); other callers'
|
|
14
|
+
# editor payload includes it unconditionally, so drop it here rather than crashing on assign.
|
|
15
|
+
attributes.delete(:background_svg_url)
|
|
12
16
|
|
|
13
17
|
ActiveRecord::Base.transaction do
|
|
14
18
|
create_sections_for_existing_blocks!(seat_layout, attributes)
|
|
@@ -51,7 +51,7 @@ module SpreeCmCommissioner
|
|
|
51
51
|
raise StandardError, "Outbound & inbound passenger counts do not match (#{outbound_qty_per_leg} vs #{inbound_qty_per_leg})"
|
|
52
52
|
end
|
|
53
53
|
|
|
54
|
-
add_return_line_item!(order, outbound_legs, outbound_qty_per_leg, outbound_date) if include_return
|
|
54
|
+
add_return_line_item!(order, outbound_legs, outbound_line_items, outbound_qty_per_leg, outbound_date) if include_return
|
|
55
55
|
|
|
56
56
|
order.preload_trip_ids = (outbound_legs.map(&:trip_id) + inbound_legs.map(&:trip_id)).flatten.uniq
|
|
57
57
|
order.preload_main_trip_ids = (outbound_legs.map(&:main_trip_id) + inbound_legs.map(&:main_trip_id)).flatten.compact.uniq
|
|
@@ -182,7 +182,11 @@ module SpreeCmCommissioner
|
|
|
182
182
|
# Setup is single-leg today, so the endpoints come straight off the outbound trip; when
|
|
183
183
|
# multi-leg outbound is supported, the return origin is the last leg's drop-off place and the
|
|
184
184
|
# return destination is the first leg's boarding place.
|
|
185
|
-
|
|
185
|
+
#
|
|
186
|
+
# The add-on is nested under the outbound line item (parent_id + relation_type) so clients can
|
|
187
|
+
# show it as part of the outbound ticket. A leg split across variants yields several outbound
|
|
188
|
+
# line items; the add-on then hangs off the first one, covering all passengers.
|
|
189
|
+
def add_return_line_item!(order, outbound_legs, outbound_line_items, quantity, outbound_date)
|
|
186
190
|
return if quantity <= 0
|
|
187
191
|
return unless outbound_legs.size == 1
|
|
188
192
|
|
|
@@ -196,6 +200,8 @@ module SpreeCmCommissioner
|
|
|
196
200
|
product_type: :ecommerce,
|
|
197
201
|
variant_id: addon.master.id,
|
|
198
202
|
quantity: quantity,
|
|
203
|
+
parent: outbound_line_items.first,
|
|
204
|
+
relation_type: :open_dated_pair,
|
|
199
205
|
from_date: from_date,
|
|
200
206
|
to_date: to_date,
|
|
201
207
|
open_dated_product_id: addon.id,
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Some users have device tokens but a stale device_tokens_count of 0, so customer
|
|
2
|
+
# notifications (which check device_tokens_count before sending push) skip them.
|
|
3
|
+
# This service recounts device tokens and updates those users in batches.
|
|
4
|
+
module SpreeCmCommissioner
|
|
5
|
+
module Users
|
|
6
|
+
class BackfillDeviceTokensCount
|
|
7
|
+
prepend Spree::ServiceModule::Base
|
|
8
|
+
|
|
9
|
+
BATCH_SIZE = 1000
|
|
10
|
+
|
|
11
|
+
def call(batch_size: BATCH_SIZE)
|
|
12
|
+
counts = device_tokens_count_by_user
|
|
13
|
+
ids = stale_user_ids(counts)
|
|
14
|
+
|
|
15
|
+
update_counts(ids, counts, batch_size)
|
|
16
|
+
|
|
17
|
+
success(updated_count: ids.size)
|
|
18
|
+
rescue StandardError => e
|
|
19
|
+
failure(nil, e.message)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
# e.g: { 665 => 1, 448 => 1, 593 => 4 }
|
|
25
|
+
def device_tokens_count_by_user
|
|
26
|
+
SpreeCmCommissioner::DeviceToken.group(:user_id).count
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# e.g: [665, 448, 593]
|
|
30
|
+
def stale_user_ids(counts)
|
|
31
|
+
Spree::User.where(id: counts.keys, device_tokens_count: 0).pluck(:id)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Updates each batch in one query, giving every user its own count.
|
|
35
|
+
# e.g: ids [665, 448, 593], counts { 665 => 1, 448 => 1, 593 => 4 }
|
|
36
|
+
# case_sql → "WHEN 665 THEN 1 WHEN 448 THEN 1 WHEN 593 THEN 4"
|
|
37
|
+
# UPDATE spree_users
|
|
38
|
+
# SET device_tokens_count = CASE id WHEN 665 THEN 1 WHEN 448 THEN 1 WHEN 593 THEN 4 END
|
|
39
|
+
# WHERE id IN (665, 448, 593)
|
|
40
|
+
def update_counts(ids, counts, batch_size)
|
|
41
|
+
ids.each_slice(batch_size) do |batch_ids|
|
|
42
|
+
case_sql = batch_ids.map { |id| "WHEN #{id.to_i} THEN #{counts[id].to_i}" }.join(' ')
|
|
43
|
+
Spree::User.where(id: batch_ids).update_all("device_tokens_count = CASE id #{case_sql} END") # rubocop:disable Rails/SkipsModelValidations
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -101,20 +101,4 @@
|
|
|
101
101
|
<% if f.object.type == 'SpreeCmCommissioner::Integrations::StadiumXV1' || (f.object.new_record? && params[:type] == 'SpreeCmCommissioner::Integrations::StadiumXV1') %>
|
|
102
102
|
<%= render partial: 'stadium_x_v1_fields', locals: { f: f } %>
|
|
103
103
|
<% end %>
|
|
104
|
-
|
|
105
|
-
<% if f.object.type == 'SpreeCmCommissioner::Integrations::BookMeBusV1' || (f.object.new_record? && params[:type] == 'SpreeCmCommissioner::Integrations::BookMeBusV1') %>
|
|
106
|
-
<%= render partial: 'book_me_bus_v1_fields', locals: { f: f } %>
|
|
107
|
-
<% end %>
|
|
108
|
-
|
|
109
|
-
<% if f.object.type == 'SpreeCmCommissioner::Integrations::Larryta' || (f.object.new_record? && params[:type] == 'SpreeCmCommissioner::Integrations::Larryta') %>
|
|
110
|
-
<%= render partial: 'larryta_fields', locals: { f: f } %>
|
|
111
|
-
<% end %>
|
|
112
|
-
|
|
113
|
-
<% if f.object.type == 'SpreeCmCommissioner::Integrations::VireakBuntham' || (f.object.new_record? && params[:type] == 'SpreeCmCommissioner::Integrations::VireakBuntham') %>
|
|
114
|
-
<%= render partial: 'vireak_buntham_fields', locals: { f: f } %>
|
|
115
|
-
<% end %>
|
|
116
|
-
|
|
117
|
-
<% if f.object.type == 'SpreeCmCommissioner::Integrations::SwitchCm' || (f.object.new_record? && params[:type] == 'SpreeCmCommissioner::Integrations::SwitchCm') %>
|
|
118
|
-
<%= render partial: 'switch_cm_fields', locals: { f: f } %>
|
|
119
|
-
<% end %>
|
|
120
104
|
</div>
|
data/config/locales/en.yml
CHANGED
|
@@ -161,7 +161,6 @@ en:
|
|
|
161
161
|
air_bus: "Air Bus"
|
|
162
162
|
bus: "Bus"
|
|
163
163
|
ferry: "Ferry"
|
|
164
|
-
boat: "Boat"
|
|
165
164
|
train: "Train"
|
|
166
165
|
|
|
167
166
|
line_item:
|
|
@@ -672,7 +671,6 @@ en:
|
|
|
672
671
|
import_already_exists: "Import Already Exists"
|
|
673
672
|
integration_sync_enqueued: "Integration sync has been enqueued"
|
|
674
673
|
integration_inactive: "Integration is inactive"
|
|
675
|
-
inventory_external_wins: "Managed by %{name}: its stock and prices are set by the channel manager"
|
|
676
674
|
external_integrations:
|
|
677
675
|
view_result: "View Result"
|
|
678
676
|
sync_result: "Sync Result"
|
data/config/locales/km.yml
CHANGED
|
@@ -130,7 +130,6 @@ km:
|
|
|
130
130
|
air_bus: "Air Bus"
|
|
131
131
|
bus: "Bus"
|
|
132
132
|
ferry: "Ferry"
|
|
133
|
-
boat: "Boat"
|
|
134
133
|
train: "រថភ្លើង"
|
|
135
134
|
|
|
136
135
|
line_item:
|
|
@@ -445,7 +444,6 @@ km:
|
|
|
445
444
|
import_already_exists: "ឯកសារយោងមានរួចហើយ"
|
|
446
445
|
integration_sync_enqueued: "ការធ្វើសមកាលកម្មបានដាក់ក្នុងជួរ"
|
|
447
446
|
integration_inactive: "ការភ្ជាប់មិនដំណើរការ"
|
|
448
|
-
inventory_external_wins: "គ្រប់គ្រងដោយ %{name}៖ ស្តុក និងតម្លៃ ត្រូវបានកំណត់ដោយ channel manager"
|
|
449
447
|
external_integrations:
|
|
450
448
|
view_result: "មើលលទ្ធផល"
|
|
451
449
|
sync_result: "លទ្ធផលធ្វើសមកាលកម្ម"
|
data/config/routes.rb
CHANGED
|
@@ -1,30 +1,6 @@
|
|
|
1
1
|
Spree::Core::Engine.add_routes do
|
|
2
2
|
# Add your extension routes here
|
|
3
3
|
|
|
4
|
-
# switch.cm's channel-manager API. Its base URL is <host>/api/switch_cm, and everything after it is
|
|
5
|
-
# Booking.com's paths, so a connector built for Booking.com only swaps the base URL.
|
|
6
|
-
scope 'api/switch_cm', module: 'api/switch_cm', as: :switch_cm do
|
|
7
|
-
post 'token-based-authentication/exchange', to: 'tokens#create', as: :token_exchange
|
|
8
|
-
|
|
9
|
-
scope 'hotels/ota', module: :ota, as: :ota do
|
|
10
|
-
get 'OTA_HotelProductNotif', to: 'product_notifs#show', as: :product_notif
|
|
11
|
-
post 'OTA_HotelAvailNotif', to: 'avail_notifs#create', as: :avail_notifs
|
|
12
|
-
post 'OTA_HotelRateAmountNotif', to: 'rate_amount_notifs#create', as: :rate_amount_notifs
|
|
13
|
-
get 'OTA_HotelResNotif', to: 'res_notifs#index', as: :res_notifs
|
|
14
|
-
post 'OTA_HotelResNotif', to: 'res_notifs#acknowledge'
|
|
15
|
-
get 'OTA_HotelResModifyNotif', to: 'res_modify_notifs#index', as: :res_modify_notifs
|
|
16
|
-
post 'OTA_HotelResModifyNotif', to: 'res_modify_notifs#acknowledge'
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
scope 'hotels/xml', module: :xml, as: :xml do
|
|
20
|
-
post 'roomrates', to: 'room_rates#create', as: :room_rates
|
|
21
|
-
post 'availability', to: 'availabilities#create', as: :availabilities
|
|
22
|
-
post 'roomrateavailability', to: 'room_rate_availabilities#create', as: :room_rate_availabilities
|
|
23
|
-
post 'reservations', to: 'reservations#create', as: :reservations
|
|
24
|
-
post 'reservationssummary', to: 'reservation_summaries#create', as: :reservation_summaries
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
4
|
authenticate :spree_user, -> (user) { user.admin? || user.organizer? || user.vendors.exists? } do
|
|
29
5
|
mount Blazer::Engine, at: 'admin/bi_reports'
|
|
30
6
|
end
|
|
@@ -873,7 +849,6 @@ Spree::Core::Engine.add_routes do
|
|
|
873
849
|
end
|
|
874
850
|
namespace :transit do
|
|
875
851
|
resources :draft_orders, only: %i[create]
|
|
876
|
-
resources :item_availabilities, only: %i[create]
|
|
877
852
|
end
|
|
878
853
|
namespace :intercity_taxi do
|
|
879
854
|
resource :draft_orders, only: %i[create update]
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
class AddParentIdAndRelationTypeToSpreeLineItems < ActiveRecord::Migration[7.0]
|
|
2
|
+
def change
|
|
3
|
+
add_reference :spree_line_items, :parent, foreign_key: { to_table: :spree_line_items }, index: true, null: true
|
|
4
|
+
add_column :spree_line_items, :relation_type, :integer, null: true
|
|
5
|
+
end
|
|
6
|
+
end
|
|
@@ -14,8 +14,7 @@ module SpreeCmCommissioner
|
|
|
14
14
|
:quantity_locked_on_hold,
|
|
15
15
|
:max_capacity,
|
|
16
16
|
:inventory_item_id,
|
|
17
|
-
:variant_id
|
|
18
|
-
:closed
|
|
17
|
+
:variant_id
|
|
19
18
|
|
|
20
19
|
def initialize(options = {})
|
|
21
20
|
@inventory_key = options[:inventory_key]
|
|
@@ -28,17 +27,12 @@ module SpreeCmCommissioner
|
|
|
28
27
|
@max_capacity = options[:max_capacity]
|
|
29
28
|
@inventory_item_id = options[:inventory_item_id]
|
|
30
29
|
@variant_id = options[:variant_id]
|
|
31
|
-
@closed = options[:closed]
|
|
32
30
|
end
|
|
33
31
|
|
|
34
32
|
def active?
|
|
35
33
|
active
|
|
36
34
|
end
|
|
37
35
|
|
|
38
|
-
def sellable?
|
|
39
|
-
active? && !closed
|
|
40
|
-
end
|
|
41
|
-
|
|
42
36
|
def to_h
|
|
43
37
|
instance_variables.each_with_object({}) do |var, hash|
|
|
44
38
|
hash[var.to_s.delete('@').to_sym] = instance_variable_get(var)
|
|
@@ -22,21 +22,4 @@ FactoryBot.define do
|
|
|
22
22
|
private_key { FFaker::Lorem.characters(40) }
|
|
23
23
|
base_url { 'https://api.stadiumx.com' }
|
|
24
24
|
end
|
|
25
|
-
|
|
26
|
-
factory :cm_switch_cm_integration, parent: :cm_integration, class: SpreeCmCommissioner::Integrations::SwitchCm do
|
|
27
|
-
type { 'SpreeCmCommissioner::Integrations::SwitchCm' }
|
|
28
|
-
association :oauth_application, factory: :oauth_application
|
|
29
|
-
conflict_strategy { :external_wins }
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
factory :cm_larryta_integration, parent: :cm_integration, class: SpreeCmCommissioner::Integrations::Larryta do
|
|
33
|
-
private_metadata do
|
|
34
|
-
{
|
|
35
|
-
'base_url' => 'https://api.larryta.com',
|
|
36
|
-
'username' => FFaker::Internet.user_name,
|
|
37
|
-
'api_token' => FFaker::Lorem.characters(40),
|
|
38
|
-
'api_uid' => FFaker::Lorem.characters(20)
|
|
39
|
-
}
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
25
|
end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
namespace :spree_cm_commissioner do
|
|
2
|
+
namespace :users do
|
|
3
|
+
desc 'Backfill stale device_tokens_count for spree_users that have device_tokens but count is 0'
|
|
4
|
+
task backfill_device_tokens_count: :environment do
|
|
5
|
+
SpreeCmCommissioner::Users::BackfillDeviceTokensCount.call
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
end
|