note description: "Summary description for {SHOP_CART_HANDLER}." date: "$Date$" revision: "$Revision$" class SHOP_CART_HANDLER inherit CMS_HANDLER rename make as make_with_cms_api end WSF_URI_TEMPLATE_HANDLER create make feature {NONE} -- Initialization make (a_mod: SHOP_MODULE; a_mod_api: SHOP_API; a_base_url: READABLE_STRING_8) do module := a_mod make_with_cms_api (a_mod_api.cms_api) shop_api := a_mod_api end feature -- API module: SHOP_MODULE shop_api: SHOP_API feature -- Execution execute (req: WSF_REQUEST; res: WSF_RESPONSE) -- Execute handler for `req' and respond in `res'. local rep: like new_generic_response do if shop_api.config.is_valid then if req.is_get_request_method then handle_get_cart (req, res) elseif req.is_post_request_method then handle_post_cart (req, res) else send_bad_request (req, res) end else rep := new_generic_response (req, res) rep.set_main_content ("
Please provide an email address where we should send your order information.
") l_html.append ("[ ]") l_html.append ("We found an account for this email %""+ html_encoded (l_email) +"%",
")
if attached {CMS_AUTHENTICATION_MODULE} api.module ({CMS_AUTHENTICATION_MODULE}) as l_auth_module then
l_form.extend_html_text ("You can sign in to continue ...")
end
l_form.extend_html_text ("
We cannot find an account for this email %""+ html_encoded (l_email) +"%",
")
if attached {CMS_AUTHENTICATION_MODULE} api.module ({CMS_AUTHENTICATION_MODULE}) as l_auth_module then
l_form.extend_html_text ("You can register a new account to continue ...")
end
l_form.extend_html_text ("
Product(s) | Item Price | Quantity | |||
---|---|---|---|---|---|
Product | Provider | Item Price | Quantity | ||
") if attached l_item.details as l_details and then attached l_details.title as l_title then a_html.append (html_encoded (l_title)) else a_html.append (html_encoded (l_item.code)) end a_html.append (" | ") if l_unique_provider = Void then a_html.append ("") a_html.append (html_encoded (l_item.provider)) a_html.append (" | ") end if attached l_item.details as l_item_details then a_html.append ("") a_html.append (html_encoded (l_item_details.price_as_string)) if l_item_details.is_monthly then l_interval := "/month" elseif l_item_details.is_yearly then l_interval := "/year" elseif l_item_details.is_weekly then l_interval := "/week" elseif l_item_details.is_daily then l_interval := "/day" else l_interval := Void end if l_interval /= Void then a_html.append (" ") a_html.append (l_interval) if not l_intervals.has (l_interval) then l_intervals.force (l_interval) end end if attached l_item.data as l_data then a_html.append (l_data) end a_html.append (" | ") else a_html.append ("N/A | ") end a_html.append ("") a_html.append (l_item.quantity.out) a_html.append (" | ") a_html.append ("|
") if l_unique_provider = Void then a_html.append (" | ") end a_html.append (" | Total: | ") a_html.append (html_encoded (a_cart.price_as_string)) if l_intervals.count = 1 then a_html.append (" ") a_html.append (l_intervals.first) end a_html.append (" | ") a_html.append ("||
") else a_html.append (" | ") end a_html.append (" | ") create s32.make (8) s32.append_character (l_sign) s32.append_string ({STRING_32} " = ") s32.append_string_general (a_cart.currency.as_upper) a_html.append (html_encoded (s32) + " | ") a_html.append ("