Example #1
0
        // GET: /<controller>/
        public IActionResult Index(ErrorViewModel errorModel)
        {
            //B2d分銷商資料
            var aesUserData = User.Identities.SelectMany(i => i.Claims.Where(c => c.Type == ClaimTypes.UserData).Select(c => c.Value)).FirstOrDefault();
            var UserData    = JsonConvert.DeserializeObject <B2dAccount>(AesCryptHelper.aesDecryptBase64(aesUserData, Website.Instance.AesCryptKey));


            //取挖字
            Dictionary <string, string> uikey = CommonRepostory.getuiKey(RedisHelper, UserData.LOCALE);// RedisHelper.getuiKey(fakeContact.lang);

            ProdTitleModel title = JsonConvert.DeserializeObject <ProdTitleModel>(JsonConvert.SerializeObject(uikey));

            switch (errorModel.ErrorType)
            {
            case ErrorType.Invalid_Market:
                ViewBag.invalid_info = title.common_invalid_market_title;
                break;

            case ErrorType.Order_Fail:
                ViewBag.invalid_info = title.common_invalid_order;
                break;

            default:
                ViewBag.invalid_info = title.common_invalid_info;
                break;
            }

            ViewBag.invalid_title           = title.common_invalid_title;
            ViewBag.common_more_experiences = title.common_more_experiences;
            ViewBag.error_alert             = errorModel.ErrorMessage;

            return(View());
        }
Example #2
0
        //套餐&日期整合
        public static PackageModel InitPkg2(prodQury prodQury, ProdTitleModel title, PackageModel pkgs, List <PkgDateforEcModel> prodPkgDateList)
        {
            if (prodQury.selDate == "")//第一次進來
            {
                foreach (PkgDetailModel pkg in pkgs.pkgs)
                {
                    string pkgOid = pkg.pkg_no;

                    foreach (PkgDateforEcModel pkgDate in prodPkgDateList)
                    {
                        if (pkgOid.Equals(pkgDate.pkgOid))
                        {
                            pkg.pkgDate = pkgDate;
                        }
                    }
                }
            }
            else
            {
                //如果有 selDate要依selDate決定可用的套餐
                foreach (PkgDetailModel pkg in pkgs.pkgs)
                {
                    string pkgOid = pkg.pkg_no;
                    //先確認有沒有在可售區間 -晚點寫,要改

                    if (pkg.status == "N")
                    {
                        pkg.chkDateCanSell = "3";                                   //3己售罄
                        pkg.NoSellTextShow = title.product_index_has_been_sold_out; // "已售罄";
                    }
                    else
                    {
                        //foreach (PkgDateforEcModel pkgDate in prodPkgDateList)
                        {
                            //if (prodPkgDateList.Select(x=>x.day))
                            {
                                //if (pkgDate.day.IndexOf(prodQury.selDate.Replace("/", "-")) > -1)
                                {
                                    if (pkg.status == "Y")
                                    {
                                        pkg.chkDateCanSell = "1";// 1上架日期可賣
                                    }
                                }
                                //else
                                {
                                    pkg.chkDateCanSell = "2";                                   //2上架日期不可賣
                                    //pkg.NoSellTextShow = title.product_index_check_availablity; //"此日期無法購買";
                                    pkg.NoSellTextShow = title.product_index_has_been_sold_out; // "已售罄";
                                }
                                //pkg.pkgDate = pkgDate;
                            }
                        }
                    }
                }
            }

            return(pkgs);
        }
Example #3
0
 public static object orderNew(DataModel data, ProdTitleModel title)
 {
     try
     {
         object result = ApiHelper.orderNew(data, title);
         return(result);
     }
     catch (Exception ex)
     {
         Website.Instance.logger.Debug($"bookingStep1_orderNewErr:{ JsonConvert.SerializeObject(ex.ToString())}");
         throw new Exception(ex.Message.ToString());
     }
 }
Example #4
0
        //付款中途停止導回
        //public IActionResult Failure(string id)
        public IActionResult Failure(string id)
        {
            try
            {
                BookingShowProdModel prodShow  = null;
                DataModel            orderData = null;
                Boolean chkSuccess             = true;

                Website.Instance.logger.Debug($",bookingFailure_id:{id}");

                if (id != null)
                {
                    string prodShowStr = RedisHelper.getRedis("b2d:ec:order:final:prodShow:" + id);
                    if (prodShowStr != null)
                    {
                        prodShow = JsonConvert.DeserializeObject <BookingShowProdModel>(prodShowStr);
                    }
                    string orderDataStr = RedisHelper.getRedis("b2d:ec:order:final:orderData:" + id);
                    if (orderDataStr != null)
                    {
                        orderData = JsonConvert.DeserializeObject <DataModel>(orderDataStr);
                    }
                }
                else
                {
                    chkSuccess = false;
                }
                //B2d分銷商資料
                var aesUserData = User.Identities.SelectMany(i => i.Claims.Where(c => c.Type == ClaimTypes.UserData).Select(c => c.Value)).FirstOrDefault();
                var UserData    = JsonConvert.DeserializeObject <B2dAccount>(AesCryptHelper.aesDecryptBase64(aesUserData, Website.Instance.AesCryptKey));

                //取挖字
                Dictionary <string, string> uikey = CommonRepostory.getuiKey(RedisHelper, UserData.LOCALE);;//RedisHelper.getuiKey(fakeContact.lang);
                ProdTitleModel title = JsonConvert.DeserializeObject <ProdTitleModel>(JsonConvert.SerializeObject(uikey));

                ViewData["chkSuccess"] = chkSuccess;
                ViewData["prodShow"]   = prodShow;
                ViewData["orderData"]  = orderData;
                ViewData["prodTitle"]  = title;
                return(View("Success"));
            }
            catch (Exception ex)
            {
                ViewData["errMsg"] = ex.Message.ToString();
                Website.Instance.logger.Debug($"Final_Step3_err:{ex.Message.ToString()}");
                //導到錯誤頁
                return(RedirectToAction("Index", "Error", new ErrorViewModel {
                    ErrorType = ErrorType.Order_Fail
                }));
            }
        }
Example #5
0
        [HttpPost]//[AcceptVerbs("Post")]
        public IActionResult reflashPkg([FromBody] prodQury prodQury)
        {
            try
            {
                //B2d分銷商資料
                var aesUserData = User.Identities.SelectMany(i => i.Claims.Where(c => c.Type == ClaimTypes.UserData).Select(c => c.Value)).FirstOrDefault();
                var UserData    = JsonConvert.DeserializeObject <B2dAccount>(AesCryptHelper.aesDecryptBase64(aesUserData, Website.Instance.AesCryptKey));

                //先確認是否有selDate ,如果沒有表示是第一次
                //如果有 selDate要依selDate決定可用的套餐


                string allCanUseDate = "";

                //取挖字
                Dictionary <string, string> uikey = CommonRepostory.getuiKey(RedisHelper, UserData.LOCALE);;// Redishelper.getuiKey(fakeContact.lang);

                ProdTitleModel title = ProductRepostory.getProdTitle(uikey);
                ViewData["prodTitle"] = title;
                ViewData["currency"]  = UserData.CURRENCY;//先從這裡取得幣別就不用再抓prod

                //ProductforEcModel prod = ApiHelper.getProdDtl(fakeContact.companyXid, fakeContact.state, fakeContact.lang, fakeContact.currency, prodQury.prodOid);
                //prod = prodRep.getProdInfo(prod, prodQury.prodOid, fakeContact.lang, fakeContact.currency, uikey); //prod.guidNo = guid;
                //ViewData["prodInfo"] = prod;

                PackageModel pkgs = ProductRepostory.getProdPkg(UserData.COMPANY_XID, UserData.COUNRTY_CODE, UserData.LOCALE, UserData.CURRENCY, prodQury.prodOid, title);

                Int64 nowDatetime = Convert.ToInt64(DateTime.Now.ToString("yyyyMMddHHmmss"));
                pkgs.pkgs = pkgs.pkgs.Where(x => nowDatetime >= Convert.ToInt64(x.online_s_date) && Convert.ToInt64(x.online_e_date) > nowDatetime).ToList();

                Website.Instance.logger.Debug($"product_reflashPkg_err:{JsonConvert.SerializeObject(pkgs)}");
                List <PkgDateforEcModel> prodPkgDateList = ProductRepostory.getProdPkgDate(pkgs, UserData.LOCALE, UserData.CURRENCY, uikey, out allCanUseDate);

                //設定每個pkg裡面可以使用的日期有那些
                pkgs = ProductRepostory.InitPkg(prodQury, title, pkgs, prodPkgDateList);

                return(Content(this.RenderPartialViewToString(ViewEngine, "_prodPkg", pkgs)));
            }
            catch (Exception ex)
            {
                //error
                Website.Instance.logger.Debug($"product_reflashPkg_err:{ex.ToString()}");
                returnStatus status = new returnStatus();
                status.status = "Error";
                status.msgErr = "資料錯誤,請重新讀取頁";//要改

                return(Json(status));
            }
        }
Example #6
0
        [HttpPost]//[AcceptVerbs("Post")]
        public IActionResult getKlingon(string key, string replace)
        {
            try
            {
                string replaceWord = "%s";
                string msg         = "";
                String json        = TempData["ProdTitleKeep"] as string;
                if (string.IsNullOrEmpty(json))
                {
                    throw new Exception("");
                }
                ProdTitleModel title = JsonConvert.DeserializeObject <ProdTitleModel>(json);
                TempData.Keep();

                switch (key)
                {
                case "product_index_min_event_qty_alert":
                    msg = title.product_index_min_event_qty_alert.Replace(replaceWord, replace);
                    break;

                case "product_index_min_order_adult_qty_alert":
                    msg = title.product_index_min_order_adult_qty_alert.Replace(replaceWord, replace);
                    break;

                case "product_index_min_order_qty_alert":
                    msg = title.product_index_min_order_qty_alert.Replace(replaceWord, replace);
                    break;

                case "product_index_max_order_qty_alert":
                    msg = title.product_index_max_order_qty_alert.Replace(replaceWord, replace);
                    break;

                case "product_index_no_event_avalible":
                    msg = title.product_index_no_event_avalible;
                    break;

                default:
                    break;
                }

                return(Json(new { flag = true, errMsg = "", msgreturn = msg }));
            }
            catch (Exception ex)
            {
                Website.Instance.logger.Debug($"product_getKlingon_err:{ex.ToString()}");
                return(Json(new { flag = false, errMsg = "資料錯誤,請重新讀取頁" }));
            }
        }
Example #7
0
        [HttpPost]//[AcceptVerbs("Post")]
        public IActionResult GetEventTime([FromBody] prodEvent prodEvent)
        {
            try
            {
                //B2d分銷商資料
                var aesUserData = User.Identities.SelectMany(i => i.Claims.Where(c => c.Type == ClaimTypes.UserData).Select(c => c.Value)).FirstOrDefault();
                var UserData    = JsonConvert.DeserializeObject <B2dAccount>(AesCryptHelper.aesDecryptBase64(aesUserData, Website.Instance.AesCryptKey));

                //取挖字
                String json = TempData["ProdTitleKeep"] as string;
                if (string.IsNullOrEmpty(json))
                {
                    throw new Exception("資料錯誤,請重新讀取頁面");
                }
                ProdTitleModel title = JsonConvert.DeserializeObject <ProdTitleModel>(json);
                TempData.Keep();

                PkgEventsModel getEventTime = ProductRepostory.getEvent(UserData.COMPANY_XID, UserData.COUNRTY_CODE, UserData.LOCALE, UserData.CURRENCY, prodEvent.prodno, prodEvent.pkgno, title);
                if (getEventTime.result == "0000")
                {
                    var result = getEventTime.events.Where(x => x.day == prodEvent.DateSelected);
                    //result = new List<Event> { };

                    getEventTime.events = result.ToList();
                    return(Json(new { errMsg = "", data = result.ToList() }));
                }
                else
                {
                    return(Json(new { errMsg = "false" }));
                }
            }
            catch (Exception ex)
            {
                //error
                Website.Instance.logger.Debug($"product_eventtime_err:{ex.ToString()}");
                returnStatus status = new returnStatus();
                status.status = "Error";
                status.msgErr = "資料錯誤,請重新讀取頁面";//要改

                return(Json(status));
            }
        }
Example #8
0
        public IActionResult Index()
        {
            //假分銷商
            //distributorInfo fakeContact = DataSettingRepostory.fakeContact();

            //B2d分銷商資料
            var aesUserData = User.FindFirst(ClaimTypes.UserData).Value;
            var UserData    = JsonConvert.DeserializeObject <B2dAccount>(AesCryptHelper.aesDecryptBase64(aesUserData, Website.Instance.AesCryptKey));
            //取得可售商品之國家&城市
            string locale    = UserData.LOCALE;
            var    countries = CountryRepostory.GetCountries(locale);
            //取挖字
            Dictionary <string, string> uikey = CommonRepostory.getuiKey(RedisHelper, UserData.LOCALE); //fakeContact.lang, UserData.LOCALE
            ProdTitleModel title = JsonConvert.DeserializeObject <ProdTitleModel>(JsonConvert.SerializeObject(uikey));


            ViewData["prodTitle"] = title;

            return(View(countries));
        }
Example #9
0
        //預設標題挖字處理
        public static ProdTitleModel getProdTitle(Dictionary <string, string> uiKey)
        {
            ProdTitleModel title = new ProdTitleModel();

            title.common_per_person            = uiKey["common_per_person"];
            title.product_index_product_oid    = uiKey["product_index_product_oid"];
            title.product_index_see_more_photo = uiKey["product_index_see_more_photo"];
            title.common_duration             = uiKey["common_duration"];
            title.common_location             = uiKey["common_location"];
            title.common_guide_can_speak      = uiKey["common_guide_can_speak"];
            title.product_index_option_title  = uiKey["product_index_option_title"];
            title.product_index_select_date   = uiKey["product_index_select_date"];
            title.product_index_option_detail = uiKey["product_index_option_detail"];
            title.common_experience           = uiKey["common_experience"];
            title.common_timetable            = uiKey["common_timetable"];
            title.product_index_price_detail  = uiKey["product_index_price_detail"];
            title.product_index_voucher_type  = uiKey["product_index_voucher_type"];
            title.product_index_place         = uiKey["product_index_place"];
            title.common_reminder             = uiKey["common_reminder"];
            title.common_cancellation_policy  = uiKey["common_cancellation_policy"];
            title.common_map = uiKey["common_map"];
            title.common_experience_point          = uiKey["common_experience_point"];
            title.common_special_cancel_fee        = uiKey["common_special_cancel_fee"];
            title.product_index_select             = uiKey["product_index_select"];
            title.common_cancel_policy_explanation = uiKey["common_cancel_policy_explanation"];
            title.common_cancel_date      = uiKey["common_cancel_date"];
            title.common_cancellation_fee = uiKey["common_cancellation_fee"];

            title.common_days_more  = uiKey["common_days_more"];
            title.common_days_prior = uiKey["common_days_prior"];

            title.product_index_event = uiKey["product_index_event"];


            //bookin bar
            title.common_booking            = uiKey["common_booking"];
            title.product_index_coming_soon = uiKey["product_index_coming_soon"];

            //價錢
            title.common_total  = uiKey["common_total"];
            title.common_adult  = uiKey["common_adult"];
            title.common_child  = uiKey["common_child"];
            title.common_infant = uiKey["common_infant"];
            title.common_elder  = uiKey["common_elder"];

            //單位
            title.product_index_unit2_01 = uiKey["product_index_unit2_01"];
            title.product_index_unit2_02 = uiKey["product_index_unit2_02"];
            title.product_index_unit2_03 = uiKey["product_index_unit2_03"];
            title.product_index_unit2_04 = uiKey["product_index_unit2_04"];
            title.product_index_unit2_05 = uiKey["product_index_unit2_05"];
            title.product_index_unit2_06 = uiKey["product_index_unit2_06"];

            //套餐選擇
            title.product_index_has_been_sold_out = uiKey["product_index_has_been_sold_out"];
            title.product_index_check_availablity = uiKey["product_index_check_availablity"];



            title.common_confirmation = uiKey["common_confirmation"];
            title.common_payment      = uiKey["common_payment"];
            title.common_done         = uiKey["common_done"];

            title.booking_step1_contact           = uiKey["booking_step1_contact"];
            title.booking_step1_contact_firstname = uiKey["booking_step1_contact_firstname"];
            title.booking_step1_contact_lastname  = uiKey["booking_step1_contact_lastname"];

            title.booking_step1_local_firstname_placeholder = uiKey["booking_step1_local_firstname_placeholder"];
            title.booking_step1_local_lastname_placeholder  = uiKey["booking_step1_local_lastname_placeholder"];

            title.booking_step1_cus_cusBirthday             = uiKey["booking_step1_cus_cusBirthday"];
            title.booking_step1_cus_countryName             = uiKey["booking_step1_cus_countryName"];
            title.booking_step1_cus_countryName_placeholder = uiKey["booking_step1_cus_countryName_placeholder"];

            title.common_nationality           = uiKey["common_nationality"];
            title.booking_step1_contact_tel    = uiKey["booking_step1_contact_tel"];
            title.booking_step1_contact_email  = uiKey["booking_step1_contact_email"];
            title.booking_step1_update_profile = uiKey["booking_step1_update_profile"];
            title.common_next_step             = uiKey["common_next_step"];

            title.booking_step1_traveler_information   = uiKey["booking_step1_traveler_information"];
            title.booking_step1_lead_traveler          = uiKey["booking_step1_lead_traveler"];
            title.booking_step1_chose_contacted_member = uiKey["booking_step1_chose_contacted_member"];
            title.booking_step1_cust_data_passport_english_firstname = uiKey["booking_step1_cust_data_passport_english_firstname"];

            title.booking_step1_cust_data_passport_english_lastname = uiKey["booking_step1_cust_data_passport_english_lastname"];
            title.booking_step1_cus_cusGender = uiKey["booking_step1_cus_cusGender"];
            title.booking_step1_cust_data_passport_english_lastname_placeholder  = uiKey["booking_step1_cust_data_passport_english_lastname_placeholder"];
            title.booking_step1_cust_data_passport_english_firstname_placeholder = uiKey["booking_step1_cust_data_passport_english_firstname_placeholder"];

            title.booking_step1_cus_passportId             = uiKey["booking_step1_cus_passportId"];
            title.booking_step1_cus_passportId_placeholder = uiKey["booking_step1_cus_passportId_placeholder"];

            title.booking_step1_cust_data_passport_exp_date = uiKey["booking_step1_cust_data_passport_exp_date"];

            title.booking_step1_cust_data_local_firstname             = uiKey["booking_step1_cust_data_local_firstname"];
            title.booking_step1_cust_data_local_firstname_placeholder = uiKey["booking_step1_cust_data_local_firstname_placeholder"];
            title.booking_step1_cust_data_local_lastname             = uiKey["booking_step1_cust_data_local_lastname"];
            title.booking_step1_cust_data_local_lastname_placeholder = uiKey["booking_step1_cust_data_local_lastname_placeholder"];

            title.booking_step1_cust_data_tw_identity_number             = uiKey["booking_step1_cust_data_tw_identity_number"];
            title.booking_step1_cust_data_tw_identity_number_placeholder = uiKey["booking_step1_cust_data_tw_identity_number_placeholder"];

            title.booking_step1_cust_data_hk_mo_identity_number             = uiKey["booking_step1_cust_data_hk_mo_identity_number"];
            title.booking_step1_cust_data_hk_mo_identity_number_placeholder = uiKey["booking_step1_cust_data_hk_mo_identity_number_placeholder"];

            title.booking_step1_cust_data_mtp_number             = uiKey["booking_step1_cust_data_mtp_number"];
            title.booking_step1_cust_data_mtp_number_placeholder = uiKey["booking_step1_cust_data_mtp_number_placeholder"];

            title.booking_step1_cust_data_height         = uiKey["booking_step1_cust_data_height"];
            title.booking_step1_cust_data_height_unit_01 = uiKey["booking_step1_cust_data_height_unit_01"];
            title.booking_step1_cust_data_height_unit_02 = uiKey["booking_step1_cust_data_height_unit_02"];
            title.booking_step1_cust_data_unit           = uiKey["booking_step1_cust_data_unit"];

            title.booking_step1_cust_data_weight         = uiKey["booking_step1_cust_data_weight"];
            title.booking_step1_cust_data_weight_unit_01 = uiKey["booking_step1_cust_data_weight_unit_01"];
            title.booking_step1_cust_data_weight_unit_02 = uiKey["booking_step1_cust_data_weight_unit_02"];

            title.booking_step1_cust_data_shoe_size             = uiKey["booking_step1_cust_data_shoe_size"];
            title.booking_step1_cust_data_shoe_size_placeholder = uiKey["booking_step1_cust_data_shoe_size_placeholder"];
            title.booking_step1_cust_data_shoe_size_man         = uiKey["booking_step1_cust_data_shoe_size_man"];
            title.booking_step1_cust_data_shoe_size_woman       = uiKey["booking_step1_cust_data_shoe_size_woman"];
            title.booking_step1_cust_data_shoe_size_child       = uiKey["booking_step1_cust_data_shoe_size_child"];
            title.booking_step1_cust_data_shoe_size_tip         = uiKey["booking_step1_cust_data_shoe_size_tip"];

            title.booking_step1_cust_data_glass_diopter             = uiKey["booking_step1_cust_data_glass_diopter"];
            title.booking_step1_cust_data_glass_diopter_placeholder = uiKey["booking_step1_cust_data_glass_diopter_placeholder"];
            title.booking_step1_cust_data_do_not_need = uiKey["booking_step1_cust_data_do_not_need"];

            title.booking_step1_cust_data_meal             = uiKey["booking_step1_cust_data_meal"];
            title.booking_step1_cust_data_meal_placeholder = uiKey["booking_step1_cust_data_meal_placeholder"];
            title.booking_step1_cust_data_exclude_food     = uiKey["booking_step1_cust_data_exclude_food"];
            title.booking_step1_cust_data_meal_tip         = uiKey["booking_step1_cust_data_meal_tip"];
            title.booking_step1_cust_data_is_food_allergy  = uiKey["booking_step1_cust_data_is_food_allergy"];

            title.common_select_set = uiKey["common_select_set"];
            title.common_male       = uiKey["common_male"];
            title.common_female     = uiKey["common_female"];
            title.booking_step1_save_member_data = uiKey["booking_step1_save_member_data"];
            title.common_guide_lang = uiKey["common_guide_lang"];
            title.booking_step1_product_guide_lang                         = uiKey["booking_step1_product_guide_lang"];
            title.booking_step1_shuttle_data                               = uiKey["booking_step1_shuttle_data"];
            title.booking_step1_shuttle_data                               = uiKey["booking_step1_shuttle_data"];
            title.booking_step1_shuttle_data_shuttle_date                  = uiKey["booking_step1_shuttle_data_shuttle_date"];
            title.booking_step1_shuttle_data_pick_up_location              = uiKey["booking_step1_shuttle_data_pick_up_location"];
            title.booking_step1_shuttle_data_drop_off_location             = uiKey["booking_step1_shuttle_data_drop_off_location"];
            title.booking_step1_shuttle_data_pick_up_location_placeholder  = uiKey["booking_step1_shuttle_data_pick_up_location_placeholder"];
            title.booking_step1_shuttle_data_drop_off_location_placeholder = uiKey["booking_step1_shuttle_data_drop_off_location_placeholder"];
            title.booking_step1_order_note         = uiKey["booking_step1_order_note"];
            title.booking_step1_order_note_tip     = uiKey["booking_step1_order_note_tip"];
            title.booking_step1_use_coupon         = uiKey["booking_step1_use_coupon"];
            title.booking_step1_have_discount_code = uiKey["booking_step1_have_discount_code"];
            title.booking_step1_dont_use           = uiKey["booking_step1_dont_use"];
            title.booking_step1_coupon_code        = uiKey["booking_step1_coupon_code"];
            title.booking_step1_btn_coupon         = uiKey["booking_step1_btn_coupon"];

            title.booking_step1_please_select_payment_method = uiKey["booking_step1_please_select_payment_method"];
            title.payment_pmch_name_CITI_CREDITCARD          = uiKey["payment_pmch_name_CITI_CREDITCARD"];
            title.booking_step1_amount_of_money        = uiKey["booking_step1_amount_of_money"];
            title.payment_pmch_info_remind_twd         = uiKey["payment_pmch_info_remind_twd"];
            title.payment_pmch_info_remind_hkd         = uiKey["payment_pmch_info_remind_hkd"];
            title.payment_pmch_info_remind_usd         = uiKey["payment_pmch_info_remind_usd"];
            title.payment_pmch_info_fee_remind         = uiKey["payment_pmch_info_fee_remind"];
            title.common_card_holder_name              = uiKey["common_card_holder_name"];
            title.booking_step1_enter_card_holder_name = uiKey["booking_step1_enter_card_holder_name"];
            title.common_credit_card_num = uiKey["common_credit_card_num"];
            title.common_expire_date     = uiKey["common_expire_date"];
            title.common_next            = uiKey["common_next"];



            title.booking_step1_flight_info_arrival_airport             = uiKey["booking_step1_flight_info_arrival_airport"];
            title.booking_step1_flight_info_arrival_info                = uiKey["booking_step1_flight_info_arrival_info"];
            title.booking_step1_flight_info_arrival_airport_placeholder = uiKey["booking_step1_flight_info_arrival_airport_placeholder"];
            title.booking_step1_flight_info_terminal_no             = uiKey["booking_step1_flight_info_terminal_no"];
            title.booking_step1_flight_info_terminal_no_placeholder = uiKey["booking_step1_flight_info_terminal_no_placeholder"];
            title.booking_step1_flight_info_airline                       = uiKey["booking_step1_flight_info_airline"];
            title.booking_step1_flight_info_airline_placeholder           = uiKey["booking_step1_flight_info_airline_placeholder"];
            title.booking_step1_flight_info_flight_no                     = uiKey["booking_step1_flight_info_flight_no"];
            title.booking_step1_flight_info_flight_no_placeholder         = uiKey["booking_step1_flight_info_flight_no_placeholder"];
            title.booking_step1_flight_info_arrival_time                  = uiKey["booking_step1_flight_info_arrival_time"];
            title.booking_step1_flight_info_arrival_time_placeholder      = uiKey["booking_step1_flight_info_arrival_time_placeholder"];
            title.booking_step1_flight_info_departure_info                = uiKey["booking_step1_flight_info_departure_info"];
            title.booking_step1_flight_info_departure_airport             = uiKey["booking_step1_flight_info_departure_airport"];
            title.booking_step1_flight_info_departure_airport_placeholder = uiKey["booking_step1_flight_info_departure_airport_placeholder"];
            title.booking_step1_flight_info_departure_time                = uiKey["booking_step1_flight_info_departure_time"];
            title.booking_step1_flight_info_departure_time_placeholder    = uiKey["booking_step1_flight_info_departure_time_placeholder"];
            title.booking_step1_flight_info_flight_type                   = uiKey["booking_step1_flight_info_flight_type"];
            title.booking_step1_flight_info_flight_type_placeholder       = uiKey["booking_step1_flight_info_flight_type_placeholder"];
            title.booking_step1_flight_info_domestic_routes               = uiKey["booking_step1_flight_info_domestic_routes"];
            title.booking_step1_flight_info_international_routes          = uiKey["booking_step1_flight_info_international_routes"];
            title.common_hr  = uiKey["common_hr"];
            title.common_min = uiKey["common_min"];
            title.common_yes = uiKey["common_yes"];
            title.common_no  = uiKey["common_no"];
            title.booking_step1_is_visa_required = uiKey["booking_step1_is_visa_required"];

            title.booking_step1_shuttle_data_shuttle_date_placeholder        = uiKey["booking_step1_shuttle_data_shuttle_date_placeholder"];
            title.booking_step1_shuttle_data_pick_up_time                    = uiKey["booking_step1_shuttle_data_pick_up_time"];
            title.booking_step1_shuttle_data_pick_up_time_placeholder        = uiKey["booking_step1_shuttle_data_pick_up_time_placeholder"];
            title.booking_step1_shuttle_data_designated_location             = uiKey["booking_step1_shuttle_data_designated_location"];
            title.booking_step1_shuttle_data_designated_location_placeholder = uiKey["booking_step1_shuttle_data_designated_location_placeholder"];
            title.booking_step1_shuttle_data_charter_route                   = uiKey["booking_step1_shuttle_data_charter_route"];
            title.booking_step1_shuttle_data_charter_route_placeholder       = uiKey["booking_step1_shuttle_data_charter_route_placeholder"];
            title.booking_step1_shuttle_data_custom_routes                   = uiKey["booking_step1_shuttle_data_custom_routes"];
            title.booking_step1_shuttle_data_custom_routes_placeholder       = uiKey["booking_step1_shuttle_data_custom_routes_placeholder"];
            title.common_add = uiKey["common_add"];
            title.booking_step1_shuttle_data_custom_routes_note_1 = uiKey["booking_step1_shuttle_data_custom_routes_note_1"];
            title.booking_step1_shuttle_data_custom_routes_note_2 = uiKey["booking_step1_shuttle_data_custom_routes_note_2"];

            title.booking_step1_other_data = uiKey["booking_step1_other_data"];
            title.booking_step1_other_data_mobile_model_number = uiKey["booking_step1_other_data_mobile_model_number"];
            title.booking_step1_other_data_imei                        = uiKey["booking_step1_other_data_imei"];
            title.booking_step1_other_data_activation_date             = uiKey["booking_step1_other_data_activation_date"];
            title.booking_step1_other_data_activation_date_placeholder = uiKey["booking_step1_other_data_activation_date_placeholder"];

            title.booking_step1_rent_car = uiKey["booking_step1_rent_car"];
            title.booking_step1_rent_car_pick_up_office             = uiKey["booking_step1_rent_car_pick_up_office"];
            title.booking_step1_rent_car_pick_up_office_placeholder = uiKey["booking_step1_rent_car_pick_up_office_placeholder"];
            title.booking_step1_rent_car_pick_up_date             = uiKey["booking_step1_rent_car_pick_up_date"];
            title.booking_step1_rent_car_pick_up_date_placeholder = uiKey["booking_step1_rent_car_pick_up_date_placeholder"];
            title.booking_step1_rent_car_is_need_free_wifi        = uiKey["booking_step1_rent_car_is_need_free_wifi"];
            title.booking_step1_rent_car_is_need_free_gps         = uiKey["booking_step1_rent_car_is_need_free_gps"];
            title.common_need    = uiKey["common_need"];
            title.common_no_need = uiKey["common_no_need"];
            title.booking_step1_rent_car_drop_off_office             = uiKey["booking_step1_rent_car_drop_off_office"];
            title.booking_step1_rent_car_drop_off_office_placeholder = uiKey["booking_step1_rent_car_drop_off_office_placeholder"];
            title.booking_step1_rent_car_drop_off_date             = uiKey["booking_step1_rent_car_drop_off_date"];
            title.booking_step1_rent_car_drop_off_date_placeholder = uiKey["booking_step1_rent_car_drop_off_date_placeholder"];
            title.booking_step1_car_psgr = uiKey["booking_step1_car_psgr"];
            title.booking_step1_car_psgr_carry_luggage_quantity = uiKey["booking_step1_car_psgr_carry_luggage_quantity"];
            title.booking_step1_car_psgr_carry_luggage          = uiKey["booking_step1_car_psgr_carry_luggage"];
            title.booking_step1_car_psgr_checked_luggage        = uiKey["booking_step1_car_psgr_checked_luggage"];
            title.booking_step1_car_psgr_child_seat_quantity    = uiKey["booking_step1_car_psgr_child_seat_quantity"];
            title.booking_step1_car_psgr_suitable_for_age       = uiKey["booking_step1_car_psgr_suitable_for_age"];
            title.booking_step1_car_psgr_supplier_provided      = uiKey["booking_step1_car_psgr_supplier_provided"];
            title.common_years_old = uiKey["common_years_old"];
            title.booking_step1_car_psgr_self_provided        = uiKey["booking_step1_car_psgr_self_provided"];
            title.booking_step1_car_psgr_infant_seat_quantity = uiKey["booking_step1_car_psgr_infant_seat_quantity"];
            title.booking_step1_send_data = uiKey["booking_step1_send_data"];
            title.booking_step1_send_data_receiver_name                       = uiKey["booking_step1_send_data_receiver_name"];
            title.booking_step1_send_data_receiver_first_name                 = uiKey["booking_step1_send_data_receiver_first_name"];
            title.booking_step1_send_data_receiver_firstname                  = uiKey["booking_step1_send_data_receiver_firstname"];
            title.booking_step1_send_data_receiver_firstname_placeholder      = uiKey["booking_step1_send_data_receiver_firstname_placeholder"];
            title.booking_step1_send_data_receiver_lastname                   = uiKey["booking_step1_send_data_receiver_lastname"];
            title.booking_step1_send_data_receiver_lastname_placeholder       = uiKey["booking_step1_send_data_receiver_lastname_placeholder"];
            title.booking_step1_send_data_receive_address                     = uiKey["booking_step1_send_data_receive_address"];
            title.booking_step1_send_data_receive_address_country             = uiKey["booking_step1_send_data_receive_address_country"];
            title.booking_step1_send_data_receive_address_country_placeholder = uiKey["booking_step1_send_data_receive_address_country_placeholder"];
            title.booking_step1_send_data_receive_address_city                = uiKey["booking_step1_send_data_receive_address_city"];
            title.booking_step1_send_data_receive_address_city_placeholder    = uiKey["booking_step1_send_data_receive_address_city_placeholder"];
            title.booking_step1_send_data_zip_colde = uiKey["booking_step1_send_data_zip_colde"];
            title.booking_step1_send_data_receive_address_detail      = uiKey["booking_step1_send_data_receive_address_detail"];
            title.booking_step1_send_data_receive_address_placeholder = uiKey["booking_step1_send_data_receive_address_placeholder"];
            title.booking_step1_send_data_receiver_tel             = uiKey["booking_step1_send_data_receiver_tel"];
            title.booking_step1_send_data_receiver_tel_placeholder = uiKey["booking_step1_send_data_receiver_tel_placeholder"];
            title.booking_step1_send_data_hotel_name                                   = uiKey["booking_step1_send_data_hotel_name"];
            title.product_index_voucher_type                                           = uiKey["product_index_voucher_type"];
            title.booking_step1_send_data_hotel_tel                                    = uiKey["booking_step1_send_data_hotel_tel"];
            title.booking_step1_send_data_hotel_tel_placeholder                        = uiKey["booking_step1_send_data_hotel_tel_placeholder"];
            title.booking_step1_send_data_hotel_address                                = uiKey["booking_step1_send_data_hotel_address"];
            title.booking_step1_send_data_buyer_passport_english_firstname             = uiKey["booking_step1_send_data_buyer_passport_english_firstname"];
            title.booking_step1_send_data_buyer_passport_english_firstname_placeholder = uiKey["booking_step1_send_data_buyer_passport_english_firstname_placeholder"];
            title.booking_step1_send_data_buyer_passport_english_lastname              = uiKey["booking_step1_send_data_buyer_passport_english_lastname"];
            title.booking_step1_send_data_buyer_passport_english_lastname_placeholder  = uiKey["booking_step1_send_data_buyer_passport_english_lastname_placeholder"];
            title.booking_step1_send_data_buyer_local_firstname                        = uiKey["booking_step1_send_data_buyer_local_firstname"];
            title.booking_step1_send_data_buyer_local_firstname_placeholder            = uiKey["booking_step1_send_data_buyer_local_firstname_placeholder"];
            title.booking_step1_send_data_buyer_local_lastname                         = uiKey["booking_step1_send_data_buyer_local_lastname"];
            title.booking_step1_send_data_buyer_local_lastname_placeholder             = uiKey["booking_step1_send_data_buyer_local_lastname_placeholder"];
            title.booking_step1_send_data_booking_website                              = uiKey["booking_step1_send_data_booking_website"];
            title.booking_step1_send_data_booking_website_placeholder                  = uiKey["booking_step1_send_data_booking_website_placeholder"];
            title.booking_step1_send_data_booking_order_no                             = uiKey["booking_step1_send_data_booking_order_no"];
            title.booking_step1_send_data_booking_order_no_placeholder                 = uiKey["booking_step1_send_data_booking_order_no_placeholder"];
            title.booking_step1_send_data_check_in_date                                = uiKey["booking_step1_send_data_check_in_date"];
            title.booking_step1_send_data_check_in_date_placeholder                    = uiKey["booking_step1_send_data_check_in_date_placeholder"];
            title.booking_step1_send_data_check_out_date                               = uiKey["booking_step1_send_data_check_out_date"];
            title.booking_step1_send_data_check_out_date_placeholder                   = uiKey["booking_step1_send_data_check_out_date_placeholder"];
            title.booking_step1_contact_data                                           = uiKey["booking_step1_contact_data"];
            title.booking_step1_contact_data_firstname                                 = uiKey["booking_step1_contact_data_firstname"];
            title.booking_step1_contact_data_firstname_placeholder                     = uiKey["booking_step1_contact_data_firstname_placeholder"];
            title.booking_step1_contact_data_lastname                                  = uiKey["booking_step1_contact_data_lastname"];
            title.booking_step1_contact_data_lastname_placeholder                      = uiKey["booking_step1_contact_data_lastname_placeholder"];
            title.booking_step1_contact_data_contact_tel                               = uiKey["booking_step1_contact_data_contact_tel"];
            title.booking_step1_contact_data_contact_tel_placeholder                   = uiKey["booking_step1_contact_data_contact_tel_placeholder"];
            title.booking_step1_contact_data_contact_app                               = uiKey["booking_step1_contact_data_contact_app"];
            title.booking_step1_contact_data_contact_app_placeholder                   = uiKey["booking_step1_contact_data_contact_app_placeholder"];
            title.booking_step1_contact_data_contact_app_account                       = uiKey["booking_step1_contact_data_contact_app_account"];
            title.booking_step1_other_data_exchange_location                           = uiKey["booking_step1_other_data_exchange_location"];
            title.booking_step1_other_data_exchange_location_placeholder               = uiKey["booking_step1_other_data_exchange_location_placeholder"];
            title.common_have     = uiKey["common_have"];
            title.common_have_not = uiKey["common_have_not"];


            title.booking_step1_shuttle_data_customized_shuttle_time  = uiKey["booking_step1_shuttle_data_customized_shuttle_time"];
            title.booking_step1_shuttle_data_customized_charter_route = uiKey["booking_step1_shuttle_data_customized_charter_route"];

            //error
            title.booking_step1_required_error = uiKey["booking_step1_required_error"];
            title.booking_step1_length_error_1 = uiKey["booking_step1_length_error_1"];
            title.booking_step1_length_error_2 = uiKey["booking_step1_length_error_2"];
            title.booking_step1_english_error  = uiKey["booking_step1_english_error"];


            //active
            title.common_options = uiKey["common_options"];
            title.common_date    = uiKey["common_date"];
            title.common_guest   = uiKey["common_guest"];
            title.common_order_num_of_travellers = uiKey["common_order_num_of_travellers"];
            title.order_show_event_time          = uiKey["order_show_event_time"];
            //event
            title.booking_step1_event_backup             = uiKey["booking_step1_event_backup"];
            title.booking_step1_backup_event_data_number = uiKey["booking_step1_backup_event_data_number"];
            title.product_productlist_choose_date        = uiKey["product_productlist_choose_date"];

            return(title);
        }
Example #10
0
        //付款後導回
        public IActionResult Step3(string id)
        {
            try
            {
                BookingShowProdModel prodShow  = null;
                DataModel            orderData = null;
                Boolean chkSuccess             = true;

                //B2d分銷商資料
                string jsondata = TempData[id + "forward"] as string;
                if (string.IsNullOrEmpty(jsondata))
                {
                    chkSuccess = false;
                }

                B2dAccount UserData = null;

                if (id != null && jsondata != null && chkSuccess == true)
                {
                    PmchSslResponse2 res = JsonConvert.DeserializeObject <PmchSslResponse2>(jsondata); //新版
                    Website.Instance.logger.Debug($",bookingStep3_id:{id},bookingStep3_jsondata:{jsondata}");
                    if (res.metadata.status != "0000")                                                 //授權失敗,直接跳付款失敗
                    {
                        chkSuccess = false;
                    }
                    else
                    {
                        Boolean chk = ApiHelper.PaymentValid(id, res);
                        if (chk == false)
                        {
                            chkSuccess = false;
                        }
                    }

                    string prodShowStr = RedisHelper.getRedis("b2d:ec:order:final:prodShow:" + id);
                    if (prodShowStr != null)
                    {
                        prodShow = JsonConvert.DeserializeObject <BookingShowProdModel>(prodShowStr);
                    }
                    string orderDataStr = RedisHelper.getRedis("b2d:ec:order:final:orderData:" + id);
                    if (orderDataStr != null)
                    {
                        orderData = JsonConvert.DeserializeObject <DataModel>(orderDataStr);
                    }
                }
                else
                {
                    chkSuccess = false;
                }

                //取挖字
                //B2d分銷商資料
                var aesUserData = User.Identities.SelectMany(i => i.Claims.Where(c => c.Type == ClaimTypes.UserData).Select(c => c.Value)).FirstOrDefault();
                UserData = JsonConvert.DeserializeObject <B2dAccount>(AesCryptHelper.aesDecryptBase64(aesUserData, Website.Instance.AesCryptKey));

                Dictionary <string, string> uikey = CommonRepostory.getuiKey(RedisHelper, UserData.LOCALE);// RedisHelper.getuiKey(fakeContact.lang);
                ProdTitleModel title = JsonConvert.DeserializeObject <ProdTitleModel>(JsonConvert.SerializeObject(uikey));

                ViewData["chkSuccess"] = chkSuccess;
                ViewData["prodShow"]   = prodShow;
                ViewData["orderData"]  = orderData;
                ViewData["prodTitle"]  = title;

                return(View("Success"));
            }
            catch (Exception ex)
            {
                ViewData["errMsg"] = ex.Message.ToString();
                Website.Instance.logger.Debug($"Final_Step3_err:{ex.Message.ToString()}");
                //導到錯誤頁
                return(RedirectToAction("Index", "Error", new ErrorViewModel {
                    ErrorType = ErrorType.Order_Fail
                }));
            }
        }
Example #11
0
        //付款後導回
        public IActionResult Step3(string id, string jsondata)
        {
            B2dAccount           UserData  = null;
            BookingShowProdModel prodShow  = null;
            DataModel            orderData = null;
            Boolean chkSuccess             = true;

            if (id != null && jsondata != null)
            {
                ////回傳的連結有訂編 (記log)
                ////透過訂編將redis 的資料抓回送出去的資料
                ////取b2dredis 內的paymentDtl
                ////string payDtlStr = RedisHelper.getProdInfotoRedis("b2d:ec:payDtl:" + id);
                ////PaymentDtl payDtl = JsonConvert.DeserializeObject<PaymentDtl>(payDtlStr);

                ////從kkday redis 取出
                ////組出token res:pmgwTransNo, res:pmgwMethod ,res:pmch_resp ceil res:payAmount order_mid
                ////md5($pmgw_trans_no.$pmgw_method.$trans_curr_cd.$trans_amt.$pmch_ref_no.$key);
                ////PmchSslResponse res = JsonConvert.DeserializeObject<PmchSslResponse>(jsondata); //舊版
                PmchSslResponse2 res = JsonConvert.DeserializeObject <PmchSslResponse2>(jsondata); //新版
                //string transNo = GibberishAES.OpenSSLDecrypt(res.data.pmgw_trans_no, "pmgw@%#@trans*no");
                ////CallJsonPay req = JsonConvert.DeserializeObject<CallJsonPay>(RedisHelper.getProdInfotoRedis("b2d:ec:pmchSslRequest:" + id)); //using KKday.Web.B2D.EC.AppCode;
                //CallJsonPay2 req = JsonConvert.DeserializeObject<CallJsonPay2>(RedisHelper.getProdInfotoRedis("b2d:ec:pmchSslRequest:" + id)); //using KKday.Web.B2D.EC.AppCode;

                //string token = Website.Instance.Configuration["kkdayKey:pmgwValidToken"].ToString();
                //string pmgwMethod = res.data.pmgw_method;

                //string payCurrency = res.data.pay_currency;
                //string payAmount = Math.Ceiling(res.data.pay_amount).ToString();
                //string pmgwValidToken = MD5Tool.GetMD5(transNo + pmgwMethod + payCurrency + payAmount + id + token);

                //KKapiHelper helper = new KKapiHelper();
                //必須要再呼叫一次要讓FA 知道這個授權是kkday做的!而不是robot
                //string isSuccess = helper.PaymentValid(transNo, pmgwValidToken);

                //如果ok就upd

                //helper.PayUpdSuccessUpdOrder(id, transNo, payDtl, req, res, fakeContact);//舊版
                //helper.PayUpdSuccessUpdOrder2(id, transNo, payDtl, req, res, fakeContact); //新版

                Website.Instance.logger.Debug($",bookingStep3_id:{id},bookingStep3_jsondata:{jsondata}");

                if (res.metadata.status != "0000") //授權失敗,直接跳付款失敗
                {
                    chkSuccess = false;
                }
                else
                {
                    Boolean chk = ApiHelper.PaymentValid(id, jsondata);
                    if (chk == false)
                    {
                        chkSuccess = false;
                    }
                }

                string prodShowStr = RedisHelper.getRedis("b2d:ec:order:final:prodShow:" + id);
                if (prodShowStr != null)
                {
                    prodShow = JsonConvert.DeserializeObject <BookingShowProdModel>(prodShowStr);
                }
                string orderDataStr = RedisHelper.getRedis("b2d:ec:order:final:orderData:" + id);
                if (orderDataStr != null)
                {
                    orderData = JsonConvert.DeserializeObject <DataModel>(orderDataStr);
                }
            }
            else
            {
                chkSuccess = false;
            }

            //取挖字
            //B2d分銷商資料
            var aesUserData = User.Identities.SelectMany(i => i.Claims.Where(c => c.Type == ClaimTypes.UserData).Select(c => c.Value)).FirstOrDefault();

            UserData = JsonConvert.DeserializeObject <B2dAccount>(AesCryptHelper.aesDecryptBase64(aesUserData, Website.Instance.AesCryptKey));

            Dictionary <string, string> uikey = CommonRepostory.getuiKey(RedisHelper, UserData.LOCALE);// RedisHelper.getuiKey(fakeContact.lang);
            ProdTitleModel title = JsonConvert.DeserializeObject <ProdTitleModel>(JsonConvert.SerializeObject(uikey));

            ViewData["chkSuccess"] = chkSuccess;
            ViewData["prodShow"]   = prodShow;
            ViewData["orderData"]  = orderData;
            ViewData["prodTitle"]  = title;

            return(View("Success"));
        }
Example #12
0
        //
        //public static JObject  getModuleBooking(string oid, string lang, string currency)
        //{
        //KKapiHelper api = new KKapiHelper();
        //var obj = (JObject)api.callKKapiProdModuleBooking(lang, currency, oid);

        //finishStatus 一定要是9
        //customerDataType 01 入住代表人 02 每個人
        //把已選到的場次時間去掉,以免 step1 備選場次又被選到
        //拿寄送資料的城市清單

        //return obj;
        //}

        public static PkgEventsModel getEvent(long companyXid, string state, string lang, string currency, string prodoid, string pkgoid, ProdTitleModel title)
        {
            try
            {
                return(ApiHelper.getPkgEvent(companyXid, state, lang, currency, prodoid, pkgoid, title));
            }
            catch (Exception ex)
            {
                Website.Instance.logger.Debug($"error-getprodDtl ex:{ex.ToString()}");
                throw new Exception("error-getprodDtl ex:" + ex.ToString());
            }
        }
Example #13
0
        public IActionResult bookingStep1([FromBody] DataModel data)
        {
            try
            {
                string memUuid = Website.Instance.Configuration["kkdayKey:uuid"];

                string    userAgent = Request.Headers["User-Agent"].ToString();
                UserAgent ua        = new UserAgent(userAgent);

                //B2d分銷商資料
                var aesUserData = User.Identities.SelectMany(i => i.Claims.Where(c => c.Type == ClaimTypes.UserData).Select(c => c.Value)).FirstOrDefault();
                var UserData    = JsonConvert.DeserializeObject <B2dAccount>(AesCryptHelper.aesDecryptBase64(aesUserData, Website.Instance.AesCryptKey));

                string ip = httpContextAccessor.HttpContext.Request.HttpContext.Connection.RemoteIpAddress.ToString().Replace("::1", "127.0.0.1");
                data = BookingRepostory.setCardEncrypt(data);
                //log時把卡號移除
                DataModel dataTemp = data.Clone();
                dataTemp.card = null;
                Website.Instance.logger.Debug($"bookingStep1_inputdata:{ JsonConvert.SerializeObject(dataTemp)}");

                string prodStr = TempData["prod_" + data.guidNo] as string;
                if (string.IsNullOrEmpty(prodStr))
                {
                    throw new Exception("資料錯誤,請重新讀取頁");
                }
                ProductModel prod = JsonConvert.DeserializeObject <ProductModel>(prodStr);

                string moduleStr = TempData["module_" + data.guidNo] as string;
                if (string.IsNullOrEmpty(moduleStr))
                {
                    throw new Exception("資料錯誤,請重新讀取頁");
                }
                ProductModuleModel module = JsonConvert.DeserializeObject <ProductModuleModel>(moduleStr);

                string pkgStr = TempData["pkg_" + data.guidNo] as string;
                if (string.IsNullOrEmpty(pkgStr))
                {
                    throw new Exception("資料錯誤,請重新讀取頁");
                }
                PkgDetailModel pkg = JsonConvert.DeserializeObject <PkgDetailModel>(pkgStr);

                string pkgConfirmStr = TempData["confirm_" + data.guidNo] as string;
                if (string.IsNullOrEmpty(moduleStr))
                {
                    throw new Exception("資料錯誤,請重新讀取頁");
                }
                confirmPkgInfo confirm = JsonConvert.DeserializeObject <confirmPkgInfo>(pkgConfirmStr);

                string titleStr = TempData["ProdTitleKeep_" + data.guidNo] as string;
                if (string.IsNullOrEmpty(moduleStr))
                {
                    throw new Exception("資料錯誤,請重新讀取頁");
                }
                ProdTitleModel title = JsonConvert.DeserializeObject <ProdTitleModel>(titleStr);

                string discRuleStr = TempData["pkgsDiscRule_" + data.guidNo] as string;
                if (string.IsNullOrEmpty(discRuleStr))
                {
                    throw new Exception("資料錯誤,請重新讀取頁");
                }
                DiscountRuleModel rule = JsonConvert.DeserializeObject <DiscountRuleModel>(discRuleStr);

                string pmgwStr = TempData["pmgw_" + data.guidNo] as string;
                if (string.IsNullOrEmpty(pmgwStr))
                {
                    throw new Exception("資料錯誤,請重新讀取頁");
                }
                Pmgw pmgw = JsonConvert.DeserializeObject <Pmgw>(pmgwStr);

                string showStr = TempData["prodShow_" + data.guidNo] as string;
                if (string.IsNullOrEmpty(showStr))
                {
                    throw new Exception("資料錯誤,請重新讀取頁");
                }
                //BookingShowProdModel show = JsonConvert.DeserializeObject<BookingShowProdModel>(showStr);

                TempData.Keep();
                data = BookingRepostory.setDefaultBookingInfo(memUuid, ua, data, prod, pkg, confirm, UserData, pmgw);

                //排除餐食
                data = BookingRepostory.exculdeFood(prod, data, module);

                data.company_xid = UserData.COMPANY_XID.ToString();
                data.channel_oid = UserData.KKDAY_CHANNEL_OID;
                data.locale      = UserData.LOCALE;
                data.ip          = ip;
                JObject order = ApiHelper.orderNew(data, title);

                string       orderMid = "";
                string       orderOid = "";
                returnStatus status   = new returnStatus();

                Website.Instance.logger.Debug($"bookingStep1_ordernewresponse:" + JsonConvert.SerializeObject(order));//要改
                //要先判斷是不是result='0000'
                if (order["result"].ToString() == "0000")
                {
                    orderMid = order["order_mid"].ToString();
                    orderOid = order["order_oid"].ToString();
                    //upd B2bOrder
                    //BookingRepostory.updB2dOrder(UserData.COMPANY_XID, orderOid, orderMid, b2bOrder, title);

                    status.pmchSslRequest = BookingRepostory.setPaymentInfo2(prod, data, orderMid, UserData, pmgw, memUuid, ip);
                    status.status         = "OK";
                    status.url            = Website.Instance.Configuration["kkUrl:pmchUrl"].ToString() + pmgw.pmchPayURL; //pmchUrl

                    //要把BookingShowProdModel 帶到訂購final頁
                    RedisHelper.SetRedis(showStr, "b2d:ec:order:final:prodShow:" + orderMid, 60);
                    RedisHelper.SetRedis(JsonConvert.SerializeObject(data), "b2d:ec:order:final:orderData:" + orderMid, 60);

                    //要存redis 付款主要資訊,最後訂單 upd時要使用,可和下面整合存一個就
                    BookingRepostory.setPayDtltoRedis(data, orderMid, UserData.UUID, RedisHelper);

                    //要存redis 因為付款後要從這個redis內容再進行payment驗證,可和上面整合存一個就好
                    //CallJsonPay rdsJson = (CallJsonPay)status.pmchSslRequest.json;
                    CallJsonPay2 rdsJson     = (CallJsonPay2)status.pmchSslRequest.json;
                    string       callPmchReq = JsonConvert.SerializeObject(status.pmchSslRequest.json);
                    RedisHelper.SetRedis(callPmchReq, "b2d:ec:pmchSslRequest:" + orderMid, 60);
                }
                else
                {
                    status.status = "Error";
                    status.msgErr = order["content"]["result"].ToString() + order["content"]["msg"].ToString();//要改
                }

                return(Json(status));
                //v1/channel/citi/auth
                //https://pmch.sit.kkday.com/citi/payment/auth
                //https://payment.kkday.com/v1/channel/adyen/auth
            }
            catch (Exception ex)
            {
                Website.Instance.logger.Debug($"bookingStep1_err_ordernew失敗:{ex.Message.ToString()}");
                ViewData["errMsg"] = ex.Message.ToString();
                Website.Instance.logger.Debug($"booking_index_err:{ex.Message.ToString()}");

                //導到錯誤頁
                return(RedirectToAction("Index", "Error", new ErrorViewModel {
                    ErrorType = ErrorType.Order_Fail, ErrorMessage = ex.Message.ToString()
                }));
            }
        }
Example #14
0
        public IActionResult getEvent([FromBody] EventQury Eventday)
        {
            returnBookingEventStatus status = new returnBookingEventStatus();

            try
            {
                List <string> dayevent = new List <string>();
                string        day      = Eventday.day.Replace("-", "");

                string titleJson    = (string)TempData["ProdTitleKeep_" + Eventday.guid];
                string pkgEventJson = (string)TempData["pkgEvent_" + Eventday.guid];
                string confirmJson  = (string)TempData["confirm_" + Eventday.guid];

                if (string.IsNullOrEmpty(titleJson))
                {
                    throw new Exception("資料錯誤,請重新讀取頁面");
                }
                if (string.IsNullOrEmpty(pkgEventJson))
                {
                    throw new Exception("資料錯誤,請重新讀取頁面");
                }
                if (string.IsNullOrEmpty(confirmJson))
                {
                    throw new Exception("資料錯誤,請重新讀取頁面");
                }

                ProdTitleModel title    = JsonConvert.DeserializeObject <ProdTitleModel>(titleJson);
                PkgEventsModel pkgEvent = JsonConvert.DeserializeObject <PkgEventsModel>(pkgEventJson);
                confirmPkgInfo confirm  = JsonConvert.DeserializeObject <confirmPkgInfo>(confirmJson);
                var            eTemp    = pkgEvent.events.Where(x => x.day.Equals(day));

                TempData.Keep();

                int?BookingQty = (confirm.price1Qty + confirm.price2Qty + confirm.price3Qty + confirm.price4Qty);
                if (eTemp.Count() > 0)
                {
                    foreach (Event e in eTemp)
                    {
                        string[] eventTime = e.event_times.Split(',');

                        foreach (string s in eventTime)
                        {
                            string id  = s.Split("_")[0];
                            int    Qty = Convert.ToInt32(s.Split("_")[2]);

                            if (Qty >= BookingQty && ((day != confirm.selDate) || (day == confirm.selDate && confirm.pkgEvent != id)))
                            {
                                dayevent.Add(s);
                            }
                        }
                    }

                    status.status   = "OK";
                    status.msgErr   = "";
                    status.dayevent = dayevent;
                    return(Json(status));
                }
                else
                {
                    //再補回傳的格式
                    status.status = "FAIL";
                    status.msgErr = title.product_index_no_event_avalible;
                    return(Json(status));
                }
            }
            catch (Exception ex)
            {
                Website.Instance.logger.Debug($"bookingStep1_getEventerr:eventTime->{JsonConvert.SerializeObject(Eventday)} ,{ex.ToString()}");
                //再補回傳的格式
                status.status = "FAIL";
                status.msgErr = "資料錯誤,請重新讀取頁面";
                return(Json(status));
            }
        }
Example #15
0
        // GET: /<controller>/
        public IActionResult Index(string id)
        {
            try
            {
                //還沒有做的區塊
                //productIntro
                //product_intruduction_tab 行程表 憑證區塊

                //呼叫api 取資料   https://api.sit.kkday.com/api/product/info/fe/v1/17379
                //判斷是否有資料,如果沒有要跳 alert 並導頁
                //資料取得後要揉資料
                //要把挖字存成一個物件並帶到view去
                //logs Website.Instance.logger.Info($"[PAY]kkOrderNo:{bookRQ.order.orderMid},priceType:{lst.price_type},jtrTktNo:{payRS.code},jtrErr:{payRS.error_msg}");
                //B2d分銷商資料
                var aesUserData = User.Identities.SelectMany(i => i.Claims.Where(c => c.Type == ClaimTypes.UserData).Select(c => c.Value)).FirstOrDefault();
                var UserData    = JsonConvert.DeserializeObject <B2dAccount>(AesCryptHelper.aesDecryptBase64(aesUserData, Website.Instance.AesCryptKey));


                //fakeContact.state = "CN";

                //取挖字
                Dictionary <string, string> uikey = CommonRepostory.getuiKey(RedisHelper, UserData.LOCALE);;// Redishelper.getuiKey(fakeContact.lang);
                //ProdTitleModel title = ProductRepostory.getProdTitle(uikey);
                ProdTitleModel title = JsonConvert.DeserializeObject <ProdTitleModel>(JsonConvert.SerializeObject(uikey));

                if (id == null)
                {
                    throw new Exception("商品不存在");
                }

                //從 api取
                ProductforEcModel prod = ProductRepostory.getProdDtl(UserData.COMPANY_XID, UserData.COUNRTY_CODE, UserData.LOCALE, UserData.CURRENCY, id, title);

                if (prod.result != "0000")
                {
                    //if (prod.result == "10001" && !prod.prod_mkt.is_ec_sale)
                    if (prod.result == "10001")
                    {
                        int    strCut1 = (prod.result_msg.IndexOf("Product ERROR:", StringComparison.CurrentCulture) + "Product ERROR:".Length);
                        int    strCut2 = prod.result_msg.IndexOf(",   at", StringComparison.CurrentCulture);
                        string errMsg  = prod.result_msg.Length > 0 ? prod.result_msg.Substring(strCut1, strCut2 - strCut1) : "";
                        return(RedirectToAction("Index", "Error", new ErrorViewModel {
                            ErrorType = ErrorType.Invalid_Market, ErrorMessage = errMsg
                        }));
                    }
                    else
                    {
                        throw new Exception(prod.result_msg); //不正確就導錯誤頁,但api還未處理怎麼回傳
                    }
                }

                PackageModel pkgs = ProductRepostory.getProdPkg(UserData.COMPANY_XID, UserData.COUNRTY_CODE, UserData.LOCALE, UserData.CURRENCY, id, title);

                if (pkgs.result != "0000")
                {
                    throw new Exception(prod.result_msg);                       //不正確就導錯誤頁,但api還未處理怎麼回傳
                }
                Int64 nowDatetime = Convert.ToInt64(DateTime.Now.ToString("yyyyMMddHHmmss"));
                pkgs.pkgs = pkgs.pkgs.Where(x => nowDatetime >= Convert.ToInt64(x.online_s_date) && Convert.ToInt64(x.online_e_date) > nowDatetime).ToList();
                string price1Type    = pkgs.pkgs != null && pkgs.pkgs.Any() ? pkgs.pkgs.Select(p => p.is_unit_pirce).FirstOrDefault() : "";
                string price1TypeStr = pkgs.pkgs != null && pkgs.pkgs.Any() ? pkgs.pkgs.Select(p => p.unit_txt).FirstOrDefault() : "";
                ViewData["priceType"] = price1Type == "NORANK" ? price1TypeStr : title.common_adult;
                ////判斷是不是可以可以秀可以賣 ,但api 未決定錯誤怎麼給
                //if (prod.prod_mkt.is_ec_sale == false) //不能秀就導錯誤頁
                //{
                //    throw new Exception("商品不顯示!");
                //}

                string guid = System.Guid.NewGuid().ToString();

                string allCanUseDate = "";


                prod        = ProductRepostory.getProdOtherInfo(prod, id, UserData.LOCALE, UserData.CURRENCY, uikey);
                prod.guidNo = pkgs.guid;
                List <PkgDateforEcModel> prodPkgDateList = ProductRepostory.getProdPkgDate(pkgs, UserData.LOCALE, UserData.CURRENCY, uikey, out allCanUseDate);

                TempData["ProdTitleKeep"] = JsonConvert.SerializeObject(uikey);

                //取消政策排序
                if (prod.policy_list != null && prod.policy_list.Any())
                {
                    prod.policy_list = prod.policy_list.OrderByDescending(o => o.is_over).OrderByDescending(o => o.days).ToList();
                }

                ProductModuleModel module = ProductRepostory.getProdModule(UserData.COMPANY_XID, UserData.COUNRTY_CODE, UserData.LOCALE, UserData.CURRENCY, id, "", title);
                if (module != null && module.module_venue_info != null)
                {
                    if (module.module_venue_info.venue_type == "01")
                    {
                        ViewData["moduleVenue"] = module.module_venue_info;
                    }
                }


                ViewData["prodTitle"]     = title;
                ViewData["prod"]          = prod;
                ViewData["pkgs"]          = pkgs;
                ViewData["allCanUseDate"] = allCanUseDate;
                ViewData["pkgDate"]       = prodPkgDateList;
                ViewData["currency"]      = UserData.CURRENCY;

                return(View());
            }
            catch (Exception ex)
            {
                //導到錯誤頁
                Website.Instance.logger.Debug($"product_index_err:{ex.ToString()}");
                return(RedirectToAction("Index", "Error", new ErrorViewModel {
                    ErrorType = ErrorType.Invalid_Common
                }));
                //return View("~/Views/Shared/Error.cshtml", new ErrorViewModel
                //{ RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
            }
        }
Example #16
0
        // GET: /<controller>/
        public IActionResult Index(string guid)
        {
            try
            {
                //B2d分銷商資料
                var aesUserData = User.Identities.SelectMany(i => i.Claims.Where(c => c.Type == ClaimTypes.UserData).Select(c => c.Value)).FirstOrDefault();
                var UserData    = JsonConvert.DeserializeObject <B2dAccount>(AesCryptHelper.aesDecryptBase64(aesUserData, Website.Instance.AesCryptKey));

                string ip = httpContextAccessor.HttpContext.Request.HttpContext.Connection.RemoteIpAddress.ToString().Replace("::1", "127.0.0.1");

                //取挖字
                Dictionary <string, string> uikey = CommonRepostory.getuiKey(RedisHelper, UserData.LOCALE);// RedisHelper.getuiKey(fakeContact.lang);
                ProdTitleModel title = JsonConvert.DeserializeObject <ProdTitleModel>(JsonConvert.SerializeObject(uikey));

                if (guid == null)
                {
                    throw new Exception(title.common_data_error);
                }

                confirmPkgInfo confirm = JsonConvert.DeserializeObject <confirmPkgInfo>(RedisHelper.getRedis("bid:ec:confirm:" + guid));
                if (confirm == null)
                {
                    throw new Exception(title.common_data_error);
                }

                //從 api取
                ProductModuleModel module = ProductRepostory.getProdModule(UserData.COMPANY_XID, UserData.COUNRTY_CODE, UserData.LOCALE, UserData.CURRENCY, confirm.prodOid, confirm.pkgOid, title);
                ProductModel       prod   = ProductRepostory.getProdDtl(UserData.COMPANY_XID, UserData.COUNRTY_CODE, UserData.LOCALE, UserData.CURRENCY, confirm.prodOid, title);
                PackageModel       pkgs   = ProductRepostory.getProdPkg(UserData.COMPANY_XID, UserData.COUNRTY_CODE, UserData.LOCALE, UserData.CURRENCY, confirm.prodOid, title);

                if (prod.result != "0000")
                {
                    Website.Instance.logger.Debug($"booking_index_getProdDtl_err:prodOid->{confirm.prodOid} ,msg-> {prod.result_msg}");
                    throw new Exception(title.result_code_9990);
                }
                if (pkgs.result != "0000")
                {
                    Website.Instance.logger.Debug($"booking_index_getProdPkg_err:prodOid->{confirm.prodOid},pkgOid ->{confirm.pkgOid} ,msg-> {prod.result_msg}");
                    throw new Exception(title.result_code_9990);
                }

                string         flightInfoType = "";
                string         sendInfoType   = "";
                PkgDetailModel pkg            = null;
                PkgEventsModel pkgEvent       = null;
                CusAgeRange    cusAgeRange    = null;
                string         isEvent        = "N";
                string         isHl           = "N";
                var            pkgsTemp       = pkgs.pkgs.Where(x => x.pkg_no == confirm.pkgOid).ToList();
                if (pkgsTemp.Count() > 0)
                {
                    foreach (PkgDetailModel p in pkgsTemp)
                    {
                        pkg            = p;
                        flightInfoType = p.module_setting.flight_info_type.value;
                        sendInfoType   = p.module_setting.send_info_type.value;
                        cusAgeRange    = BookingRepostory.getCusAgeRange(confirm, p);

                        isEvent = p.is_event;
                        isHl    = p.is_hl;
                    }
                }
                else
                {
                    //丟錯誤頁
                    Website.Instance.logger.Debug($"booking_index_err:商編->{confirm.prodOid}即有pkgs找不到對應的pkgoid->{ confirm.pkgOid}");
                    throw new Exception(title.common_data_error);
                }

                //如果有event 但沒有傳 event id ,就error
                if (isEvent == "Y" && string.IsNullOrEmpty(confirm.pkgEvent))
                {
                    throw new Exception(title.common_data_error);
                }

                if (isEvent == "Y")
                {
                    pkgEvent = ApiHelper.getPkgEvent(UserData.COMPANY_XID, UserData.COUNRTY_CODE, UserData.LOCALE, UserData.CURRENCY, confirm.prodOid, confirm.pkgOid, title);
                }

                //pmgw
                PmchLstResponse pmchRes = ApiHelper.getPaymentListRes(prod.countries, prod.prod_no.ToString(), DateTime.Now.ToString("yyyy-MM-dd"), DateTime.Now.ToString("yyyy-MM-dd"),
                                                                      DateTimeTool.yyyyMMdd2DateTime(confirm.selDate).ToString("yyyy-MM-dd"), DateTimeTool.yyyyMMdd2DateTime(confirm.selDate).ToString("yyyy-MM-dd"), UserData.COUNRTY_CODE, UserData.LOCALE,
                                                                      prod.prod_type, ip, prod.prod_hander, UserData.CURRENCY, title);

                Pmgw pmgw = null;
                if (UserData.CURRENCY == "TWD")
                {
                    pmgw = pmchRes.pmchlist.Where(x => x.acctdocReceiveMethod == "ONLINE_CITI" && x.pmchCode == "B2D_CITI_TWD").FirstOrDefault();
                }
                else
                {
                    pmgw = pmchRes.pmchlist.Where(x => x.acctdocReceiveMethod == "ONLINE_HK_ADYEN").FirstOrDefault();
                }
                //必須要設定人數
                //var cusData = BookingRepostory.getCusDdate();
                int totalCus = 0;
                if (module.module_cust_data != null)
                {
                    if (module.module_cust_data.is_require == true)
                    {
                        totalCus = (module.module_cust_data.cus_type == "01") ? 1 : Convert.ToInt32(confirm.price1Qty + confirm.price2Qty + confirm.price3Qty + confirm.price4Qty);
                    }
                }

                //滿足國家
                List <Country> country    = prod.countries;
                string         nationName = "";
                if (country.Count > 0)
                {
                    nationName = country[0].name;
                }

                //將dataModel原型 以json str 帶到前台的hidden
                DataModel dm = DataSettingRepostory.getDefaultDataModel(totalCus, guid);
                dm.guidNo = guid;
                String dataModelStr = JsonConvert.SerializeObject(dm);
                //dm.travelerData[0].meal.mealType
                ViewData["dataModelStr"] = dataModelStr;

                VenueInfo venue = module.module_venue_info;
                if (venue == null)
                {
                    venue = new VenueInfo(); venue.is_require = false;
                }
                RentCar rentCar = module.module_rent_car;
                if (rentCar == null)
                {
                    rentCar = new RentCar(); rentCar.is_require = false;
                }
                ViewData["confirmPkgInfo"] = confirm;
                ViewData["contactInfo"]    = UserData;
                ViewData["cusData"]        = module.module_cust_data;
                ViewData["guide"]          = module.module_guide_lang_list;
                ViewData["wifi"]           = module.module_sim_wifi;
                ViewData["exchange"]       = module.module_exchange_location_list;
                ViewData["flightInfo"]     = module.module_flight_info;
                ViewData["venue"]          = venue;                                    // module.module_venue_info;
                ViewData["useDate"]        = DateTimeTool.yyyy_mm_dd(confirm.selDate); //DateTimeTool.yyyy_mm_dd();
                ViewData["rentCar"]        = rentCar;                                  // module.module_rent_car;
                ViewData["carPsgr"]        = module.module_car_pasgr;                  //車輛資料
                ViewData["sendData"]       = module.module_send_data;
                ViewData["contactData"]    = module.module_contact_data;
                ViewData["nationName"]     = nationName;

                ViewData["guid"]           = guid;
                ViewData["prodTitle"]      = title;
                ViewData["totalCus"]       = totalCus;
                ViewData["mainCat"]        = prod.prod_type;
                ViewData["flightInfoType"] = flightInfoType;
                ViewData["sendInfoType"]   = sendInfoType;
                ViewData["CutOfDay"]       = prod.before_order_day;
                ViewData["cusAgeRange"]    = cusAgeRange;
                BookingShowProdModel show = BookingRepostory.setBookingShowProd(prod, pkg, confirm, UserData.CURRENCY, pkgEvent, title);
                ViewData["prodShow"] = show;

                ViewData["isEvent"]       = isEvent;                                                                                                                                                                            //
                ViewData["isHl"]          = isHl;                                                                                                                                                                               //如果是N就不用做
                ViewData["pkgCanUseDate"] = (isHl == "Y" && isEvent == "Y") ? BookingRepostory.getPkgEventDate(pkgEvent, confirm.pkgOid, (confirm.price1Qty + confirm.price2Qty + confirm.price3Qty + confirm.price4Qty)) : ""; //要把這個套餐可以用的日期全抓出來
                ViewData["pmgw"]          = pmgw;

                //放到session
                TempData["prod_" + guid]          = JsonConvert.SerializeObject(prod);
                TempData["pkgEvent_" + guid]      = (isHl == "Y" && isEvent == "Y") ? JsonConvert.SerializeObject(pkgEvent) : "";
                TempData["module_" + guid]        = JsonConvert.SerializeObject(module);
                TempData["confirm_" + guid]       = JsonConvert.SerializeObject(confirm);
                TempData["ProdTitleKeep_" + guid] = JsonConvert.SerializeObject(title);
                TempData["pkg_" + guid]           = JsonConvert.SerializeObject(pkg);
                TempData["pkgsDiscRule_" + guid]  = JsonConvert.SerializeObject(pkgs.discount_rule);
                TempData["prodShow_" + guid]      = JsonConvert.SerializeObject(show);
                TempData["pmgw_" + guid]          = JsonConvert.SerializeObject(pmgw);

                return(View());
            }
            catch (Exception ex)
            {
                ViewData["errMsg"] = ex.Message.ToString();
                Website.Instance.logger.Debug($"booking_index_err:{ex.Message.ToString()}");
                //導到錯誤頁
                return(RedirectToAction("Index", "Error", new ErrorViewModel {
                    ErrorType = ErrorType.Invalid_Common
                }));
            }
        }
Example #17
0
 //模組
 public static ProductModuleModel getProdModule(long B2dXid, string state, string lang, string currency, string prodoid, string pkgoid, ProdTitleModel title)
 {
     try
     {
         return(ApiHelper.getProdModule(B2dXid, state, lang, currency, prodoid, pkgoid, title));
     }
     catch (Exception ex)
     {
         throw new Exception(title.result_code_9990);
     }
 }
Example #18
0
        //UPDb2d 訂單

        public static Boolean updB2dOrder(long companyXid, string orderOid, string orderMid, string b2bOrderNo, ProdTitleModel title)
        {
            UpdateB2dOrderModel order = new UpdateB2dOrderModel();

            order.company_xid = companyXid.ToString();
            order.order_no    = b2bOrderNo;
            order.order_mid   = orderMid;
            order.order_oid   = orderOid;

            try
            {
                Website.Instance.logger.Debug($"bookingStep1_insB2dOrder:{ JsonConvert.SerializeObject(order)}");

                updB2dOrderResult result = ApiHelper.updB2dOrder(order, title);
                if (result.result == "0000")
                {
                    Website.Instance.logger.Debug($"bookingStep1_insB2dOrderResult:{ JsonConvert.SerializeObject(result)}");
                    return(true);
                }
                else
                {
                    Website.Instance.logger.Debug($"bookingStep1_insB2dOrderResult:{ JsonConvert.SerializeObject(result)}");
                    throw new Exception(result.result_msg);
                }
            }
            catch (Exception ex)
            {
                Website.Instance.logger.Debug($"bookingStep1_insB2dOrderErr:{ JsonConvert.SerializeObject(ex.ToString())}");
                throw new Exception(ex.Message.ToString());
            }
        }
Example #19
0
        //組出booking 頁右邊顯示的內容
        public static BookingShowProdModel setBookingShowProd(ProductModel prod, PkgDetailModel pkg, confirmPkgInfo confirm, string currency, PkgEventsModel pkgEvent, ProdTitleModel prodTitle)
        {
            BookingShowProdModel prodShow = new BookingShowProdModel();

            prodShow.prodOid   = prod.prod_no.ToString();
            prodShow.prodName  = prod.prod_name;
            prodShow.currency  = currency;
            prodShow.sDate     = DateTimeTool.yyyy_mm_dd(confirm.selDate);
            prodShow.price1Qty = confirm.price1Qty;
            prodShow.price2Qty = confirm.price2Qty;
            prodShow.price3Qty = confirm.price3Qty;
            prodShow.price4Qty = confirm.price4Qty;
            prodShow.price1    = pkg.price1;
            prodShow.price2    = pkg.price2;
            prodShow.price3    = pkg.price3;
            prodShow.price4    = pkg.price4;
            prodShow.eventOid  = confirm.pkgEvent;
            if (prod.img_list.Count > 0)
            {
                prodShow.photoUrl = Website.Instance.Configuration["kkUrl:imgUrl"].ToString() + prod.img_list[0].img_kkday_url;
            }

            prodShow.isRank      = pkg.is_unit_pirce == "RANK" ? true : false;
            prodShow.pkgOid      = pkg.pkg_no;
            prodShow.pkgName     = pkg.pkg_name;
            prodShow.totoalPrice = (prodShow.price1Qty * prodShow.price1) + (prodShow.price2Qty * prodShow.price2) +
                                   (prodShow.price3Qty * prodShow.price3) + (prodShow.price4Qty * prodShow.price4);

            prodShow.unitText = pkg.unit_txt;

            if (pkgEvent != null)
            {
                var eTemp = pkgEvent.events.Where(x => x.day.Equals(confirm.selDate));


                foreach (Event e in eTemp)
                {
                    string[] times = e.event_times.Split(",");

                    foreach (string s in times)
                    {
                        string id = s.Split("_")[0];
                        if (id.Equals(confirm.pkgEvent))
                        {
                            prodShow.eventTime = s.Split("_")[1];
                            break;
                        }
                    }
                }
            }

            //設定回覆確試時間
            if (prod.confirm_order_time == 0)
            {
                prodShow.confirm_order_time = prodTitle.common_imm_confirm;
            }
            else
            {
                prodShow.confirm_order_time = prodTitle.booking_step3_check_confirm_hour.Replace("%d", prod.confirm_order_time.ToString());
            }

            return(prodShow);
        }
Example #20
0
        // GET: /<controller>/
        public IActionResult ProdList(string pg, string cat_main, string cat_sub, string key1, string citykey, string pricerange,
                                      string datefilter, string budget, string[] duration, string[] guidelang)
        {
            //紀錄目前頁次
            int active_page_idx = Convert.ToInt32(pg ?? "1");

            //紀緣分割後的durations

            if (duration != null)
            {
                _durations = duration.Select(s => s.Replace("-", ",")).ToArray();
            }

            //B2d分銷商資料
            var aesUserData = User.Identities.SelectMany(i => i.Claims.Where(c => c.Type == ClaimTypes.UserData).Select(c => c.Value)).FirstOrDefault();
            var UserData    = JsonConvert.DeserializeObject <B2dAccount>(AesCryptHelper.aesDecryptBase64(aesUserData, Website.Instance.AesCryptKey));
            //分銷商語系
            string locale = UserData.LOCALE;
            //分銷商幣別
            string currency = UserData.CURRENCY;
            //取得可售商品之國家&城市
            var countries = CountryRepostory.GetCountries(locale);

            Dictionary <string, string> uikey = CommonRepostory.getuiKey(RedisHelper, UserData.LOCALE);
            ProdTitleModel title = JsonConvert.DeserializeObject <ProdTitleModel>(JsonConvert.SerializeObject(uikey));

            List <ProductBaseModel> prodList = null;

            //查詢條件不為空值才查
            if (!string.IsNullOrEmpty(key1) || !string.IsNullOrEmpty(citykey))
            {
                int    offset      = (active_page_idx - 1) * 20; //計算從第幾筆開始
                int    size        = 20;                         //分頁筆數
                int    total_count = 0;                          //out 參數 (接收返回的total_count參數)
                int    total_pages = 0;                          //out 參數 (接收返回的total_pages參數)
                Facets facets      = new Facets();               //out 參數 (接收返回的facets參數)
                Stats  stats       = new Stats();                //out 參數 (接收返回的stats參數)

                //取得資料
                prodList = SearchRepostory.GetProduct(locale, currency, key1, citykey, offset, size, datefilter, budget, _durations, guidelang, cat_main, cat_sub,
                                                      out total_count, out total_pages, out stats, out facets);

                List <CountryInfo> country = new List <CountryInfo>();
                country = CountryRepostory.GetCountries(key1, citykey, locale);

                //當城市或國家不為空,則清除查詢關鍵字
                if (country != null && country.Count() > 0)
                {
                    //已選城市的判斷
                    if (!string.IsNullOrEmpty(citykey))
                    {
                        var    cd3    = country.SelectMany(co => co.Cities.Where(ci => ci.IsSelceted == true).ToList()).ToList().First();
                        string citycd = cd3.CityCode;
                        ViewData["citycode"] = citycd;
                    }
                    else
                    {
                        var city = country.FirstOrDefault().Cities.FirstOrDefault();
                        city.IsSelceted      = true;
                        ViewData["citycode"] = city.CityCode;
                    }
                    key1 = null;
                }

                //傳入VIEW的參數
                ViewData["total_count"]     = total_count;
                ViewData["active_page_idx"] = active_page_idx;
                ViewData["total_pages"]     = total_pages;
                ViewData["key"]             = key1;
                ViewData["facets"]          = facets;
                ViewData["duration"]        = duration;
                ViewData["guidelang"]       = guidelang;
                ViewData["stats"]           = stats;
                ViewData["pricerange"]      = !string.IsNullOrEmpty(pricerange) ? pricerange : string.Format("{0};{1}", stats.price.min, stats.price.max);
                ViewData["budget"]          = !string.IsNullOrEmpty(budget) ? budget : string.Format("{0};{1}", stats.price.min, stats.price.max);
                ViewData["country"]         = country;
                ViewData["prodTitle"]       = title;
            }

            return(View(prodList));
        }
Example #21
0
        //成立b2d 訂單
        public static string insB2dOrder(ProdTitleModel title, ProductModel prod, PkgDetailModel pkg, confirmPkgInfo confirm, DataModel dataModel, B2dAccount UserData, DiscountRuleModel discRule)
        {
            try
            {
                B2dOrderModel order = new B2dOrderModel();

                order.connect_mail  = dataModel.contactEmail;
                order.order_date    = DateTime.Now;
                order.order_type    = "B2D";
                order.order_status  = "NW";
                order.order_amt     = Convert.ToDouble(dataModel.currPriceTotal);
                order.order_b2c_amt = Convert.ToDouble(dataModel.currPriceTotal); //要重算
                order.connect_name  = dataModel.asiaMileMemberLastName + " " + dataModel.contactFirstname;
                order.connect_tel   = dataModel.contactTel;
                order.order_note    = dataModel.note;

                Source source = new Source();
                source.booking_type = "WEB";
                source.company_xid  = UserData.COMPANY_XID;
                source.channel_oid  = UserData.KKDAY_CHANNEL_OID;
                source.connect_tel  = dataModel.contactTel;
                source.connect_mail = dataModel.contactEmail;
                source.connect_name = dataModel.asiaMileMemberLastName + " " + dataModel.contactFirstname;
                source.order_note   = dataModel.note;
                source.client_ip    = "127.0.0.1";
                source.crt_time     = DateTime.Now;

                order.source = source;

                List <OrderCus> cusList = new List <OrderCus>();
                List <OrderLst> lstList = new List <OrderLst>();

                //NORANK 且 (只有一個代表人 或 不要代表人)    ->只塞一筆order_lst
                //NORANK 且要填所有旅客資料->只塞1~*筆order_lst

                //RANK 且 (只有一個代表人 或 不要代表人)    ->只塞1~*筆order_lst
                //RANK 且要填所有旅客資料     ->只塞1~*筆order_lst

                int?cusSeqno = 1;
                int lstSeqno = 1;

                string priceType = "";
                int    ii        = 0;
                //滿足cus
                foreach (CusDataInfo cus in dataModel.travelerData)
                {
                    if (ii < confirm.price1Qty)
                    {
                        priceType = "price1";
                    }
                    else if (ii < (confirm.price1Qty + confirm.price2Qty))
                    {
                        priceType = "price2";
                    }
                    else if (ii < (confirm.price1Qty + confirm.price2Qty + confirm.price3Qty))
                    {
                        priceType = "price3";
                    }
                    else if (ii < (confirm.price1Qty + confirm.price2Qty + confirm.price3Qty + confirm.price4Qty))
                    {
                        priceType = "price4";
                    }
                    OrderCus cusTemp = new OrderCus();
                    //cusTemp.cus_seqno = Convert.ToInt32(cusSeqno);
                    cusTemp.cus_type         = priceType;
                    cusTemp.cus_mail         = "";
                    cusTemp.cus_name_e_first = cus.englishName.firstName;
                    cusTemp.cus_name_e_last  = cus.englishName.lastName;
                    cusTemp.cus_sex          = cus.gender;
                    cusTemp.cus_tel          = "";

                    cusList.Add(cusTemp);
                    cusSeqno = cusSeqno + 1;
                    ii       = ii + 1;
                }

                if (dataModel.travelerData.Count == 0)
                {
                    cusSeqno = null;
                }
                else
                {
                    cusSeqno = 1;
                }

                if (dataModel.travelerData.Count == 1)
                {
                    //依priceTeype寫入
                    if (confirm.price1Qty > 0)
                    {
                        lstList.Add(insOrderListTemp(prod, pkg, confirm, dataModel, UserData, "price1", lstSeqno, 1, Convert.ToInt32(confirm.price1Qty), discRule));
                    }
                    lstSeqno = lstSeqno + 1;
                    if (confirm.price2Qty > 0)
                    {
                        lstList.Add(insOrderListTemp(prod, pkg, confirm, dataModel, UserData, "price2", lstSeqno, 1, Convert.ToInt32(confirm.price2Qty), discRule));
                    }
                    lstSeqno = lstSeqno + 1;
                    if (confirm.price3Qty > 0)
                    {
                        lstList.Add(insOrderListTemp(prod, pkg, confirm, dataModel, UserData, "price3", lstSeqno, 1, Convert.ToInt32(confirm.price3Qty), discRule));
                    }
                    lstSeqno = lstSeqno + 1;
                    if (confirm.price4Qty > 0)
                    {
                        lstList.Add(insOrderListTemp(prod, pkg, confirm, dataModel, UserData, "price4", lstSeqno, 1, Convert.ToInt32(confirm.price4Qty), discRule));
                    }
                }
                else
                {
                    //依每一個row寫入
                    for (ii = 0; ii < dataModel.travelerData.Count; ii++)
                    {
                        if (ii < confirm.price1Qty)
                        {
                            priceType = "price1";
                        }
                        else if (ii < (confirm.price1Qty + confirm.price2Qty))
                        {
                            priceType = "price2";
                        }
                        else if (ii < (confirm.price1Qty + confirm.price2Qty + confirm.price3Qty))
                        {
                            priceType = "price3";
                        }
                        else if (ii < (confirm.price1Qty + confirm.price2Qty + confirm.price3Qty + confirm.price4Qty))
                        {
                            priceType = "price4";
                        }
                        lstList.Add(insOrderListTemp(prod, pkg, confirm, dataModel, UserData, priceType, lstSeqno, cusSeqno, 1, discRule));
                        lstSeqno = lstSeqno + 1;
                        cusSeqno = cusSeqno + 1;
                    }
                }

                order.order_cus = cusList;
                order.order_lst = lstList;

                Website.Instance.logger.Debug($"bookingStep1_insB2dOrder:{ JsonConvert.SerializeObject(order)}");

                insB2dOrderResult result = ApiHelper.insB2dOrder(order, title);
                if (result.result == "0000")
                {
                    Website.Instance.logger.Debug($"bookingStep1_insB2dOrderResult:{ JsonConvert.SerializeObject(result)}");
                    return(result.order_no);
                }
                else
                {
                    Website.Instance.logger.Debug($"bookingStep1_insB2dOrderResult:{ JsonConvert.SerializeObject(result)}");
                    throw new Exception(result.result_msg);
                }
            }
            catch (Exception ex)
            {
                Website.Instance.logger.Debug($"bookingStep1_insB2dOrderErr:{ JsonConvert.SerializeObject(ex.ToString())}");
                throw new Exception(ex.Message.ToString());
            }
        }
Example #22
0
        public IActionResult bookingStep1([FromBody] DataModel data)
        {
            try
            {
                //B2d分銷商資料
                var aesUserData = User.Identities.SelectMany(i => i.Claims.Where(c => c.Type == ClaimTypes.UserData).Select(c => c.Value)).FirstOrDefault();
                var UserData    = JsonConvert.DeserializeObject <B2dAccount>(AesCryptHelper.aesDecryptBase64(aesUserData, Website.Instance.AesCryptKey));

                string ip = httpContextAccessor.HttpContext.Request.HttpContext.Connection.RemoteIpAddress.ToString().Replace("::1", "127.0.0.1");
                data = BookingRepostory.setCardEncrypt(data);
                //log時把卡號移除
                DataModel dataTemp = data.Clone();
                dataTemp.card = null;
                Website.Instance.logger.Debug($"bookingStep1_inputdata:{ JsonConvert.SerializeObject(dataTemp)}");

                ApiSetting api = new ApiSetting();
                api.apiKey    = "kkdayapi";
                api.userOid   = "1";
                api.ver       = "1.0.1";
                api.locale    = UserData.LOCALE;
                api.currency  = UserData.CURRENCY;
                api.ipaddress = ip;

                string prodStr = TempData["prod_" + data.guidNo] as string;
                if (string.IsNullOrEmpty(prodStr))
                {
                    throw new Exception("資料錯誤,請重新讀取頁");
                }
                ProductModel prod = JsonConvert.DeserializeObject <ProductModel>(prodStr);

                string moduleStr = TempData["module_" + data.guidNo] as string;
                if (string.IsNullOrEmpty(moduleStr))
                {
                    throw new Exception("資料錯誤,請重新讀取頁");
                }
                ProductModuleModel module = JsonConvert.DeserializeObject <ProductModuleModel>(moduleStr);

                string pkgStr = TempData["pkg_" + data.guidNo] as string;
                if (string.IsNullOrEmpty(pkgStr))
                {
                    throw new Exception("資料錯誤,請重新讀取頁");
                }
                PkgDetailModel pkg = JsonConvert.DeserializeObject <PkgDetailModel>(pkgStr);

                string pkgConfirmStr = TempData["confirm_" + data.guidNo] as string;
                if (string.IsNullOrEmpty(moduleStr))
                {
                    throw new Exception("資料錯誤,請重新讀取頁");
                }
                confirmPkgInfo confirm = JsonConvert.DeserializeObject <confirmPkgInfo>(pkgConfirmStr);

                string titleStr = TempData["ProdTitleKeep_" + data.guidNo] as string;
                if (string.IsNullOrEmpty(moduleStr))
                {
                    throw new Exception("資料錯誤,請重新讀取頁");
                }
                ProdTitleModel title = JsonConvert.DeserializeObject <ProdTitleModel>(titleStr);

                string discRuleStr = TempData["pkgsDiscRule_" + data.guidNo] as string;
                if (string.IsNullOrEmpty(discRuleStr))
                {
                    throw new Exception("資料錯誤,請重新讀取頁");
                }
                DiscountRuleModel rule = JsonConvert.DeserializeObject <DiscountRuleModel>(discRuleStr);

                string pmgwStr = TempData["pmgw_" + data.guidNo] as string;
                if (string.IsNullOrEmpty(pmgwStr))
                {
                    throw new Exception("資料錯誤,請重新讀取頁");
                }
                Pmgw pmgw = JsonConvert.DeserializeObject <Pmgw>(pmgwStr);

                string showStr = TempData["prodShow_" + data.guidNo] as string;
                if (string.IsNullOrEmpty(showStr))
                {
                    throw new Exception("資料錯誤,請重新讀取頁");
                }
                //BookingShowProdModel show = JsonConvert.DeserializeObject<BookingShowProdModel>(showStr);

                TempData.Keep();

                //排除餐食
                data = BookingRepostory.exculdeFood(prod, data, module);

                string b2bOrder = BookingRepostory.insB2dOrder(title, prod, pkg, confirm, data, UserData, rule);

                //轉 ordermodel
                //OrderRepostory res = new OrderRepostory();
                //OrderModel ord = res.setOrderModel(data,pmgw,title);
                //api.json = ord;
                //string orderModelStr = JsonConvert.SerializeObject(api);
                //Website.Instance.logger.Debug($"bookingStep1_ordernewdata:{ JsonConvert.SerializeObject(orderModelStr)}");

                //KKapiHelper kk = new KKapiHelper();
                //JObject order =kk.crtOrder(api);
                JObject order = ApiHelper.orderNew(data, title);

                string       orderMid = "";
                string       orderOid = "";
                returnStatus status   = new returnStatus();

                Website.Instance.logger.Debug($"bookingStep1_ordernewresponse:" + JsonConvert.SerializeObject(order));//要改
                //要先判斷是不是result='0000'
                if (order["content"]["result"].ToString() == "0000")
                {
                    string memUuid = "051794b8-db2a-4fe7-939f-31ab1ee2c719";
                    orderMid = order["content"]["orderMid"].ToString();
                    orderOid = order["content"]["orderOid"].ToString();
                    status.pmchSslRequest = BookingRepostory.setPaymentInfo2(prod, data, orderMid, UserData, pmgw, memUuid);
                    status.status         = "OK";
                    status.url            = Website.Instance.Configuration["kkUrl:pmchUrl"].ToString() + pmgw.pmchPayURL; //pmchUrl

                    //要把BookingShowProdModel 帶到訂購final頁
                    RedisHelper.SetRedis(showStr, "b2d:ec:order:final:prodShow:" + orderMid, 60);
                    RedisHelper.SetRedis(JsonConvert.SerializeObject(data), "b2d:ec:order:final:orderData:" + orderMid, 60);

                    //要存redis 付款主要資訊,最後訂單 upd時要使用,可和下面整合存一個就
                    BookingRepostory.setPayDtltoRedis(data, orderMid, memUuid, RedisHelper);

                    //要存redis 因為付款後要從這個redis內容再進行payment驗證,可和上面整合存一個就好
                    //CallJsonPay rdsJson = (CallJsonPay)status.pmchSslRequest.json;
                    CallJsonPay2 rdsJson     = (CallJsonPay2)status.pmchSslRequest.json;
                    string       callPmchReq = JsonConvert.SerializeObject(status.pmchSslRequest.json);
                    RedisHelper.SetRedis(callPmchReq, "b2d:ec:pmchSslRequest:" + orderMid, 60);
                }
                else
                {
                    status.status = "Error";
                    status.msgErr = order["content"]["result"].ToString() + order["content"]["msg"].ToString();//要改
                }

                return(Json(status));
                //v1/channel/citi/auth
                //https://pmch.sit.kkday.com/citi/payment/auth
                //https://payment.kkday.com/v1/channel/adyen/auth
            }
            catch (Exception ex)
            {
                //error
                Website.Instance.logger.Debug($"bookingStep1_err_ordernew失敗:{ex.Message.ToString()}");
                returnStatus status = new returnStatus();
                status.status = "Error";
                status.msgErr = ex.Message.ToString();

                return(Json(status));
            }
        }