diff --git a/Gemfile.lock b/Gemfile.lock index f768b459b..c720e297f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -169,13 +169,13 @@ GEM async (>= 1.25) auto_strip_attributes (2.6.0) activerecord (>= 4.0) - autoprefixer-rails (10.4.13.0) + autoprefixer-rails (10.4.15.0) execjs (~> 2) awesome_nested_set (3.5.0) activerecord (>= 4.0.0, < 7.1) awesome_print (1.9.2) aws-eventstream (1.2.0) - aws-partitions (1.813.0) + aws-partitions (1.818.0) aws-sdk-core (3.181.0) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.651.0) @@ -289,7 +289,7 @@ GEM zeitwerk (~> 2.6) ecma-re-validator (0.4.0) regexp_parser (~> 2.2) - elastic-transport (8.2.2) + elastic-transport (8.2.3) faraday (< 3) multi_json elasticsearch (8.9.0) @@ -350,8 +350,8 @@ GEM octokit (~> 4.6) rainbow (>= 2.2.1) rake (>= 10.0) - globalid (1.1.0) - activesupport (>= 5.0) + globalid (1.2.1) + activesupport (>= 6.1) glyphicons (1.0.2) googleauth (1.7.0) faraday (>= 0.17.3, < 3.a) @@ -441,7 +441,7 @@ GEM mini_magick (4.12.0) mini_mime (1.1.5) mini_portile2 (2.8.4) - minitest (5.19.0) + minitest (5.20.0) monetize (1.12.0) money (~> 6.12) money (6.16.0) @@ -479,7 +479,7 @@ GEM parser (3.2.2.3) ast (~> 2.4.1) racc - pg (1.5.3) + pg (1.5.4) phonelib (0.8.3) polyglot (0.3.5) popper_js (1.16.1) @@ -542,7 +542,7 @@ GEM i18n redis (5.0.7) redis-client (>= 0.9.0) - redis-client (0.16.0) + redis-client (0.17.0) connection_pool regexp_parser (2.8.1) responders (3.1.0) @@ -617,13 +617,13 @@ GEM activemodel (>= 6.1) hashie select2-rails (4.0.13) - selenium-webdriver (4.11.0) + selenium-webdriver (4.12.0) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) shoulda-matchers (5.3.0) activesupport (>= 5.2.0) - signet (0.17.0) + signet (0.18.0) addressable (~> 2.8) faraday (>= 0.17.5, < 3.a) jwt (>= 1.5, < 3.0) @@ -719,7 +719,7 @@ GEM spree_backend (>= 4.3.0.rc1) spree_emails (>= 4.3.0.rc1) spree_extension - sprockets (4.2.0) + sprockets (4.2.1) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) sprockets-rails (3.4.2) diff --git a/app/controllers/spree/admin/taxons_controller_decorator.rb b/app/controllers/spree/admin/taxons_controller_decorator.rb index ad1234fae..b105f6ed5 100644 --- a/app/controllers/spree/admin/taxons_controller_decorator.rb +++ b/app/controllers/spree/admin/taxons_controller_decorator.rb @@ -2,11 +2,25 @@ module Spree module Admin module TaxonsControllerDecorator def self.prepended(base) - base.before_action :build_category_icon, only: %i[create update] + base.before_action :build_assets, only: %i[create update] end def remove_category_icon - if @taxon.category_icon.destroy + remove_asset(@taxon.category_icon) + end + + def remove_app_banner + remove_asset(@taxon.app_banner) + end + + def remove_web_banner + remove_asset(@taxon.web_banner) + end + + private + + def remove_asset(asset) + if asset.destroy flash[:success] = Spree.t('notice_messages.icon_removed') redirect_to spree.edit_admin_taxonomy_taxon_url(@taxonomy.id, @taxon.id) else @@ -15,12 +29,10 @@ def remove_category_icon end end - private - - def build_category_icon - return unless permitted_resource_params[:category_icon] - - @taxon.build_category_icon(attachment: permitted_resource_params.delete(:category_icon)) + def build_assets + @taxon.build_category_icon(attachment: permitted_resource_params.delete(:category_icon)) if permitted_resource_params[:category_icon] + @taxon.build_app_banner(attachment: permitted_resource_params.delete(:app_banner)) if permitted_resource_params[:app_banner] + @taxon.build_web_banner(attachment: permitted_resource_params.delete(:web_banner)) if permitted_resource_params[:web_banner] end end end diff --git a/app/controllers/spree/api/v2/storefront/notifications_controller.rb b/app/controllers/spree/api/v2/storefront/notifications_controller.rb index 25beacb71..1d8b5fe99 100644 --- a/app/controllers/spree/api/v2/storefront/notifications_controller.rb +++ b/app/controllers/spree/api/v2/storefront/notifications_controller.rb @@ -6,7 +6,7 @@ class NotificationsController < Spree::Api::V2::ResourceController before_action :require_spree_current_user def collection - spree_current_user.notifications.newest_first + spree_current_user.notifications.newest_first.user_notifications end def serialize_collection(collection) diff --git a/app/controllers/spree/api/v2/storefront/order_request_notifications_controller.rb b/app/controllers/spree/api/v2/storefront/order_request_notifications_controller.rb new file mode 100644 index 000000000..86c218391 --- /dev/null +++ b/app/controllers/spree/api/v2/storefront/order_request_notifications_controller.rb @@ -0,0 +1,39 @@ +module Spree + module Api + module V2 + module Storefront + class OrderRequestNotificationsController < Spree::Api::V2::ResourceController + before_action :require_spree_current_user + + def collection + spree_current_user.notifications.top_3_request_notifications + end + + def serialize_collection(collection) + options_data = collection_options(collection).merge(params: serializer_params) + options_data[:meta][:unread_count] = SpreeCmCommissioner::Notification.select(&:unread?).count + + collection_serializer.new( + collection, + options_data + ).serializable_hash + end + + def collection_serializer + Spree::V2::Storefront::NotificationSerializer + end + + def show + notification = SpreeCmCommissioner::Notification.find(params[:id]) + SpreeCmCommissioner::NotificationReader.call(notification: notification) + render_serialized_payload { serialize_resource(notification) } + end + + def resource_serializer + Spree::V2::Storefront::NotificationSerializer + end + end + end + end + end +end diff --git a/app/controllers/spree/transit/branches_controller.rb b/app/controllers/spree/transit/branches_controller.rb index 95950aff7..952712613 100644 --- a/app/controllers/spree/transit/branches_controller.rb +++ b/app/controllers/spree/transit/branches_controller.rb @@ -1,7 +1,6 @@ module Spree module Transit class BranchesController < Spree::Transit::BaseController - def new @branch = SpreeCmCommissioner::Branch.new super @@ -9,6 +8,7 @@ def new def collection return @collection if defined?(@collection) + current_vendor.branches @search = current_vendor.branches.ransack(params[:q]) diff --git a/app/controllers/spree/transit/stops_controller.rb b/app/controllers/spree/transit/stops_controller.rb index 837e228b6..22fd26edf 100644 --- a/app/controllers/spree/transit/stops_controller.rb +++ b/app/controllers/spree/transit/stops_controller.rb @@ -7,18 +7,15 @@ def index @stops = SpreeCmCommissioner::Stop.order(:name) end - def new + def new; end - end - - def edit - - end + def edit; end def collection load_location return [] if current_vendor.blank? return @collection if defined?(@collection) + @search = @locations.ransack(params[:q]) @collection = @search.result end diff --git a/app/interactors/spree_cm_commissioner/order_requested_notification_sender.rb b/app/interactors/spree_cm_commissioner/order_requested_notification_sender.rb new file mode 100644 index 000000000..35afad788 --- /dev/null +++ b/app/interactors/spree_cm_commissioner/order_requested_notification_sender.rb @@ -0,0 +1,11 @@ +module SpreeCmCommissioner + class OrderRequestedNotificationSender < BaseInteractor + def call + notification = SpreeCmCommissioner::OrderRequestedNotification.with( + order: context.order + ).deliver_later(context.order.user) + + context.notification = notification + end + end +end diff --git a/app/models/concerns/spree_cm_commissioner/order_requestable.rb b/app/models/concerns/spree_cm_commissioner/order_requestable.rb index 22cca82d8..e3a4f9c3b 100644 --- a/app/models/concerns/spree_cm_commissioner/order_requestable.rb +++ b/app/models/concerns/spree_cm_commissioner/order_requestable.rb @@ -4,6 +4,7 @@ module OrderRequestable included do after_save :update_request_state_to_requested, if: :need_confirmation? + after_commit :send_order_requested_notification, if: :request_order? state_machine :request_state, initial: nil, use_transactions: false do event :request do @@ -12,19 +13,42 @@ module OrderRequestable event :accept do transition from: :requested, to: :accepted end + after_transition to: :accepted, do: :send_order_accepted_notification + event :reject do transition from: :requested, to: :rejected end + after_transition to: :rejected, do: :send_order_rejected_notification end def update_request_state_to_requested request! end + def send_order_requested_notification + SpreeCmCommissioner::OrderRequestedNotificationSender.call(order: self) + end + + def send_order_accepted_notification + SpreeCmCommissioner::OrderAcceptedNotificationSender.call(order: self) + end + + def send_order_rejected_notification + SpreeCmCommissioner::OrderRejectedNotificationSender.call(order: self) + end + def requested_state? request_state == 'requested' end + def request_order? + need_confirmation? && state_changed_to_complete? + end + + def state_changed_to_complete? + saved_change_to_state? && state == 'complete' + end + def need_confirmation? line_items.any?(&:need_confirmation?) end diff --git a/app/models/spree_cm_commissioner/branch.rb b/app/models/spree_cm_commissioner/branch.rb index 81bf08337..dfc70e012 100644 --- a/app/models/spree_cm_commissioner/branch.rb +++ b/app/models/spree_cm_commissioner/branch.rb @@ -5,8 +5,6 @@ class Branch < SpreeCmCommissioner::Place belongs_to :state, class_name: 'Spree::State', optional: true belongs_to :vendor, class_name: 'Spree::Vendor' - validates :vendor_id, presence: true - def validate_reference? false end diff --git a/app/models/spree_cm_commissioner/notification.rb b/app/models/spree_cm_commissioner/notification.rb index 512229e9d..e8f34c223 100644 --- a/app/models/spree_cm_commissioner/notification.rb +++ b/app/models/spree_cm_commissioner/notification.rb @@ -2,9 +2,20 @@ module SpreeCmCommissioner class Notification < SpreeCmCommissioner::Base include Noticed::Model + scope :top_3_request_notifications, lambda { + where( + type: %w[order_requested_notification order_rejected_notification order_accepted_notification], + read_at: nil + ).newest_first.limit(3) + } + + scope :user_notifications, lambda { + where( + type: %w[order_complete_notification customer_notification] + ) + } + belongs_to :recipient, polymorphic: true belongs_to :notificable, polymorphic: true - - validates :recipient_id, uniqueness: { scope: %i[notificable_id notificable_type] } end end diff --git a/app/models/spree_cm_commissioner/order_decorator.rb b/app/models/spree_cm_commissioner/order_decorator.rb index 6b63cf954..e926e32de 100644 --- a/app/models/spree_cm_commissioner/order_decorator.rb +++ b/app/models/spree_cm_commissioner/order_decorator.rb @@ -105,10 +105,6 @@ def associate_customer def send_order_complete_notification SpreeCmCommissioner::OrderCompleteNotificationSender.call(order: self) end - - def state_changed_to_complete? - saved_change_to_state? && state == 'complete' - end end end diff --git a/app/models/spree_cm_commissioner/product_decorator.rb b/app/models/spree_cm_commissioner/product_decorator.rb index b6da22e88..2fa030ccd 100644 --- a/app/models/spree_cm_commissioner/product_decorator.rb +++ b/app/models/spree_cm_commissioner/product_decorator.rb @@ -17,6 +17,8 @@ def self.prepended(base) order('spree_variants.position, spree_variants.id, currency') }, source: :prices, through: :variants_including_master + base.has_one :default_state, through: :vendor + base.scope :min_price, lambda { |vendor| joins(:prices_including_master) .where(vendor_id: vendor.id, product_type: vendor.primary_product_type) diff --git a/app/models/spree_cm_commissioner/stop.rb b/app/models/spree_cm_commissioner/stop.rb index c998627fe..3d5946e36 100644 --- a/app/models/spree_cm_commissioner/stop.rb +++ b/app/models/spree_cm_commissioner/stop.rb @@ -9,4 +9,4 @@ def validate_reference? false end end -end \ No newline at end of file +end diff --git a/app/models/spree_cm_commissioner/taxon_app_banner.rb b/app/models/spree_cm_commissioner/taxon_app_banner.rb new file mode 100644 index 000000000..0b3b2a071 --- /dev/null +++ b/app/models/spree_cm_commissioner/taxon_app_banner.rb @@ -0,0 +1,12 @@ +module SpreeCmCommissioner + class TaxonAppBanner < Asset + # 16x9 + def asset_styles + { + mini: '160x90>', + small: '480x270>', + medium: '960x540>' + } + end + end +end diff --git a/app/models/spree_cm_commissioner/taxon_decorator.rb b/app/models/spree_cm_commissioner/taxon_decorator.rb index 60a5fd16f..9bea8b47c 100644 --- a/app/models/spree_cm_commissioner/taxon_decorator.rb +++ b/app/models/spree_cm_commissioner/taxon_decorator.rb @@ -3,7 +3,6 @@ module TaxonDecorator def self.prepended(base) base.has_one :category_icon, as: :viewable, dependent: :destroy, class_name: 'SpreeCmCommissioner::TaxonCategoryIcon' - ## use in trending category card base.has_one :web_banner, as: :viewable, dependent: :destroy, class_name: 'SpreeCmCommissioner::TaxonWebBanner' base.has_one :app_banner, as: :viewable, dependent: :destroy, class_name: 'SpreeCmCommissioner::TaxonAppBanner' diff --git a/app/models/spree_cm_commissioner/taxon_web_banner.rb b/app/models/spree_cm_commissioner/taxon_web_banner.rb index aead66070..2cf02e2ee 100644 --- a/app/models/spree_cm_commissioner/taxon_web_banner.rb +++ b/app/models/spree_cm_commissioner/taxon_web_banner.rb @@ -1,12 +1,11 @@ module SpreeCmCommissioner class TaxonWebBanner < Asset + # 10x2 def asset_styles { - mini: '85x85>', - extra_small: '170x170>', - small: '250x250', - medium: '340x340>', - large: '680x680>' + mini: '160x32>', + small: '720x90>', + medium: '1440x180>' } end end diff --git a/app/models/spree_cm_commissioner/user_decorator.rb b/app/models/spree_cm_commissioner/user_decorator.rb index e20dc5a83..541b61ba5 100644 --- a/app/models/spree_cm_commissioner/user_decorator.rb +++ b/app/models/spree_cm_commissioner/user_decorator.rb @@ -54,7 +54,8 @@ def ensure_unique_database_delivery_method(attributes) options = { recipient_id: recipient.id, notificable_id: attributes[:notificable].id, - notificable_type: attributes[:notificable].class.to_s + notificable_type: attributes[:notificable].class.to_s, + type: attributes[:type] } notification = recipient.notifications.where(options).first_or_initialize diff --git a/app/notifications/noticed_fcm_base.rb b/app/notifications/noticed_fcm_base.rb index a6097b3a3..4e12d0f42 100644 --- a/app/notifications/noticed_fcm_base.rb +++ b/app/notifications/noticed_fcm_base.rb @@ -6,9 +6,12 @@ class NoticedFcmBase < Noticed::Base def format_for_database { notificable: notificable, + type: type, + params: { payload: payload, translatable_options: translatable_options + } } end @@ -45,7 +48,6 @@ def convert_hash_values_to_str(hash) def payload default_payload = { - type: type, id: notificable.id.to_s } default_payload.merge(extra_payload) diff --git a/app/notifications/spree_cm_commissioner/order_accepted_notification.rb b/app/notifications/spree_cm_commissioner/order_accepted_notification.rb index 16500ac9f..4b18d04c5 100644 --- a/app/notifications/spree_cm_commissioner/order_accepted_notification.rb +++ b/app/notifications/spree_cm_commissioner/order_accepted_notification.rb @@ -10,11 +10,21 @@ def order def extra_payload { - order_id: order.id, - order_number: order.number + order_number: order.number, + title: notification_title, + message: notification_message + } end + def notification_title + I18n.t('notifications.spree_cm_commissioner.order_accepted_notification.title') + end + + def notification_message + I18n.t('notifications.spree_cm_commissioner.order_accepted_notification.message') + end + def translatable_options { order_number: order.number diff --git a/app/notifications/spree_cm_commissioner/order_rejected_notification.rb b/app/notifications/spree_cm_commissioner/order_rejected_notification.rb index c51fc931f..6a01b5738 100644 --- a/app/notifications/spree_cm_commissioner/order_rejected_notification.rb +++ b/app/notifications/spree_cm_commissioner/order_rejected_notification.rb @@ -14,11 +14,23 @@ def vendor def extra_payload { - order_id: order.id, - order_number: order.number + order_number: order.number, + title: notification_title, + message: notification_message + } end + def notification_title + I18n.t('notifications.spree_cm_commissioner.order_rejected_notification.title') + end + + def notification_message + I18n.t('notifications.spree_cm_commissioner.order_rejected_notification.message', + vendor_name: vendor&.name + ) + end + def translatable_options { order_number: order.number, diff --git a/app/notifications/spree_cm_commissioner/order_requested_notification.rb b/app/notifications/spree_cm_commissioner/order_requested_notification.rb new file mode 100644 index 000000000..f3cb95394 --- /dev/null +++ b/app/notifications/spree_cm_commissioner/order_requested_notification.rb @@ -0,0 +1,45 @@ +module SpreeCmCommissioner + class OrderRequestedNotification < NoticedFcmBase + def notificable + order + end + + def order + params[:order] + end + + def vendor + order.line_items.first.vendor + end + + def extra_payload + { + order_number: order.number, + title: notification_title, + message: notification_message + + } + end + + def notification_title + I18n.t('notifications.spree_cm_commissioner.order_requested_notification.title') + end + + def notification_message + I18n.t('notifications.spree_cm_commissioner.order_requested_notification.message', + vendor_name: vendor&.name + ) + end + + def translatable_options + { + order_number: order.number, + vendor_name: vendor&.name + } + end + + def type + 'order_requested_notification' + end + end +end diff --git a/app/overrides/spree/admin/taxons/_form/assets_form.html.erb.deface b/app/overrides/spree/admin/taxons/_form/assets_form.html.erb.deface new file mode 100644 index 000000000..483c8c760 --- /dev/null +++ b/app/overrides/spree/admin/taxons/_form/assets_form.html.erb.deface @@ -0,0 +1,34 @@ + + +<%# "@taxon.icon is not used yet" %> +<%# render 'shared/asset_field', + field: :icon, + label: I18n.t('taxon.icon'), + asset: @taxon.icon, + remove_url: remove_icon_admin_taxonomy_taxon_url(@taxonomy.id, @taxon.id), + form:f +%> + +<%= render 'shared/asset_field', + field: :category_icon, + label: I18n.t('taxon.category_icon'), + asset: @taxon.category_icon, + remove_url: remove_category_icon_admin_taxonomy_taxon_url(@taxonomy.id, @taxon.id), + form:f +%> + +<%= render 'shared/asset_field', + field: :app_banner, + label: I18n.t('taxon.app_banner'), + asset: @taxon.app_banner, + remove_url: remove_app_banner_admin_taxonomy_taxon_url(@taxonomy.id, @taxon.id), + form:f +%> + +<%= render 'shared/asset_field', + field: :web_banner, + label: I18n.t('taxon.web_banner'), + asset: @taxon.web_banner, + remove_url: remove_web_banner_admin_taxonomy_taxon_url(@taxonomy.id, @taxon.id), + form:f +%> diff --git a/app/overrides/spree/admin/taxons/_form/category_icon_field.html.erb.deface b/app/overrides/spree/admin/taxons/_form/category_icon_field.html.erb.deface deleted file mode 100644 index 68e2aeecc..000000000 --- a/app/overrides/spree/admin/taxons/_form/category_icon_field.html.erb.deface +++ /dev/null @@ -1,17 +0,0 @@ - - -<%= render 'shared/asset_field', - field: :category_icon, - label: I18n.t('category_icon.field'), - asset: @taxon.category_icon, - remove_url: remove_category_icon_admin_taxonomy_taxon_url(@taxonomy.id, @taxon.id), - form:f -%> - -<%= render 'shared/asset_field', - field: :icon, - label: Spree.t(:header_banner), - asset: @taxon.icon, - remove_url: remove_icon_admin_taxonomy_taxon_url(@taxonomy.id, @taxon.id), - form:f -%> \ No newline at end of file diff --git a/app/serializers/spree/v2/storefront/cart_serializer_decorator.rb b/app/serializers/spree/v2/storefront/cart_serializer_decorator.rb index a64df7140..23b0f88b5 100644 --- a/app/serializers/spree/v2/storefront/cart_serializer_decorator.rb +++ b/app/serializers/spree/v2/storefront/cart_serializer_decorator.rb @@ -3,7 +3,7 @@ module V2 module Storefront module CartSerializerDecorator def self.prepended(base) - base.attributes :phone_number, :intel_phone_number, :country_code + base.attributes :phone_number, :intel_phone_number, :country_code, :request_state end end end diff --git a/app/serializers/spree/v2/storefront/notification_serializer.rb b/app/serializers/spree/v2/storefront/notification_serializer.rb index 68e322279..7ebf9f6fb 100644 --- a/app/serializers/spree/v2/storefront/notification_serializer.rb +++ b/app/serializers/spree/v2/storefront/notification_serializer.rb @@ -4,7 +4,7 @@ module Storefront class NotificationSerializer < BaseSerializer set_type :notification - attributes :read_at, :created_at, :params + attributes :read_at, :created_at, :params, :type end end end diff --git a/app/serializers/spree/v2/storefront/product_serializer_decorator.rb b/app/serializers/spree/v2/storefront/product_serializer_decorator.rb index 10c1aa768..c3cc2b3a4 100644 --- a/app/serializers/spree/v2/storefront/product_serializer_decorator.rb +++ b/app/serializers/spree/v2/storefront/product_serializer_decorator.rb @@ -7,6 +7,8 @@ def self.prepended(base) base.has_many :product_kind_option_types, serializer: :option_type base.has_many :promoted_option_types, serializer: :option_type base.has_many :possible_promotions, serializer: ::SpreeCmCommissioner::V2::Storefront::PromotionSerializer + + base.has_one :default_state, serializer: :state end end end diff --git a/app/serializers/spree/v2/storefront/taxon_serializer_decorator.rb b/app/serializers/spree/v2/storefront/taxon_serializer_decorator.rb index 590b40d8d..504596f17 100644 --- a/app/serializers/spree/v2/storefront/taxon_serializer_decorator.rb +++ b/app/serializers/spree/v2/storefront/taxon_serializer_decorator.rb @@ -4,6 +4,8 @@ module Storefront module TaxonSerializerDecorator def self.prepended(base) base.has_one :category_icon, serializer: ::SpreeCmCommissioner::V2::Storefront::AssetSerializer + base.has_one :app_banner, serializer: ::SpreeCmCommissioner::V2::Storefront::AssetSerializer + base.has_one :web_banner, serializer: ::SpreeCmCommissioner::V2::Storefront::AssetSerializer end end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 4a00ab3cb..6b2f074e4 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -33,8 +33,11 @@ en: hello: "Hello world" - category_icon: - field: Category icon (Square) + taxon: + icon: Icon (Square) + category_icon: Category icon (Square) + app_banner: App Banner (16x9) + web_banner: Web banner (10x2) calendar: event: @@ -283,7 +286,9 @@ en: order_rejected_notification: title: "Request Reject!" message: "Oops! The room you requested to book with [%{vendor_name}] is not available on your selected date." - + order_requested_notification: + title: "Request Send!" + message: "[%{vendor_name}] is reviewing your booking request." actions: login: "Login" diff --git a/config/locales/km.yml b/config/locales/km.yml index 751a85dc3..1c7ad2b17 100644 --- a/config/locales/km.yml +++ b/config/locales/km.yml @@ -25,8 +25,11 @@ km: hello: "Hello world" - category_icon: - field: Category icon (Square) + taxon: + icon: Icon (Square) + category_icon: Category icon (Square) + app_banner: App Banner (16x9) + web_banner: Web banner (10x2) calendar: event: @@ -252,6 +255,9 @@ km: order_rejected_notification: title: "ត្រូវបានបដិសេធ!" message: "សូមអធ្យាស្រ័យ! បន្ទប់ដែលអ្នកបានស្នើសុំកក់ជាមួយ [%{vendor_name}] មិនមាននៅកាលបរិច្ឆេទដែលអ្នកបានជ្រើសរើសទេ" + order_requested_notification: + title: "សំណេីរត្រូវបានផ្ញេីរ" + message: "[%{vendor_name}] កំពុងពិនិត្យមើលសំណើកក់របស់អ្នក" spree_user: invalid_password: "ពាក្យសង្ងាត់បច្ចុប្បន្នមិនត្រឹមត្រូវ" cannot_delete_account: "អ្នកមិនអាចលុបគណនីនេះបានទេ ដោយសារអ្នកមានតួនាទីពិសេស" diff --git a/config/routes.rb b/config/routes.rb index 54e6714fd..810f3c86c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -63,6 +63,8 @@ resources :taxons do member do delete :remove_category_icon + delete :remove_app_banner + delete :remove_web_banner end end end @@ -166,6 +168,8 @@ resource :profile_images, only: [:update] resource :user_profiles, only: [:update] resources :notifications, only: %i[index show] + resources :order_request_notifications, only: %i[index show] + resources :customer_notifications, only: [:show] resource :user_registration_with_pin_codes, only: [:create] resources :user_device_token_registrations, only: %i[create destroy] diff --git a/db/migrate/20230903040734_add_type_to_spree_cm_commissioner_notification.rb b/db/migrate/20230903040734_add_type_to_spree_cm_commissioner_notification.rb new file mode 100644 index 000000000..79e1e8204 --- /dev/null +++ b/db/migrate/20230903040734_add_type_to_spree_cm_commissioner_notification.rb @@ -0,0 +1,5 @@ +class AddTypeToSpreeCmCommissionerNotification < ActiveRecord::Migration[7.0] + def change + add_column :cm_notifications, :type, :string, if_not_exists: true + end +end diff --git a/spec/interactors/spree_cm_commissioner/order_accepted_notification_sender_spec.rb b/spec/interactors/spree_cm_commissioner/order_accepted_notification_sender_spec.rb index c21302a33..2b3854082 100644 --- a/spec/interactors/spree_cm_commissioner/order_accepted_notification_sender_spec.rb +++ b/spec/interactors/spree_cm_commissioner/order_accepted_notification_sender_spec.rb @@ -25,7 +25,6 @@ payload = notification.params[:payload] - expect(payload[:order_id]).not_to be_nil expect(payload[:order_number]).to eq order.number end end diff --git a/spec/interactors/spree_cm_commissioner/order_rejected_notification_sender_spec.rb b/spec/interactors/spree_cm_commissioner/order_rejected_notification_sender_spec.rb index 869e29c04..146b7e3c7 100644 --- a/spec/interactors/spree_cm_commissioner/order_rejected_notification_sender_spec.rb +++ b/spec/interactors/spree_cm_commissioner/order_rejected_notification_sender_spec.rb @@ -14,6 +14,7 @@ end it 'should have in database' do + puts order.line_items expect(SpreeCmCommissioner::Notification.count).to eq 1 end @@ -27,7 +28,6 @@ payload = notification.params[:payload] - expect(payload[:order_id]).not_to be_nil expect(payload[:order_number]).to eq order.number end end diff --git a/spec/serializers/spree/v2/storefront/cart_serializer_spec.rb b/spec/serializers/spree/v2/storefront/cart_serializer_spec.rb index 9cca99a7f..4d8368593 100644 --- a/spec/serializers/spree/v2/storefront/cart_serializer_spec.rb +++ b/spec/serializers/spree/v2/storefront/cart_serializer_spec.rb @@ -56,7 +56,8 @@ :public_metadata, :phone_number, :intel_phone_number, - :country_code + :country_code, + :request_state ) end diff --git a/spec/serializers/spree/v2/storefront/product_serializer_spec.rb b/spec/serializers/spree/v2/storefront/product_serializer_spec.rb index d6859f06d..9a6c2768b 100644 --- a/spec/serializers/spree/v2/storefront/product_serializer_spec.rb +++ b/spec/serializers/spree/v2/storefront/product_serializer_spec.rb @@ -17,7 +17,8 @@ :variant_kind_option_types, :product_kind_option_types, :promoted_option_types, - :possible_promotions + :possible_promotions, + :default_state, ]).serializable_hash } @@ -58,7 +59,8 @@ :variant_kind_option_types, :product_kind_option_types, :promoted_option_types, - :possible_promotions + :possible_promotions, + :default_state, ) end end diff --git a/spec/serializers/spree/v2/storefront/taxon_serializer_spec.rb b/spec/serializers/spree/v2/storefront/taxon_serializer_spec.rb index 9f871fe28..8f4d10d8b 100644 --- a/spec/serializers/spree/v2/storefront/taxon_serializer_spec.rb +++ b/spec/serializers/spree/v2/storefront/taxon_serializer_spec.rb @@ -11,7 +11,9 @@ :taxonomy, :children, :image, - :category_icon + :category_icon, + :app_banner, + :web_banner, ]).serializable_hash } @@ -43,7 +45,9 @@ :taxonomy, :children, :image, - :category_icon + :category_icon, + :app_banner, + :web_banner, ) end end