Exemplo n.º 1
0
        public PayInfoParam GetPayInfoParamBeforeDeliveryInfoInsert(OrderItem orderItem, UserItem userItem, bool fromOrderConfirm)
        {
            DeliveryInfoItem deliveryInfoItem = DeliveryInfoDao.FindById(orderItem.DeliveryInfoId);

            PayInfoParam param = new PayInfoParam();

            param.OrderItem        = orderItem;
            param.DeliveryInfoItem = deliveryInfoItem;
            param.UserItem         = userItem;
            OrderService.SetPriceInPayInfoParam(orderItem.Id, param);
            param.PayInfoItem = GetPayInfoItem(param.OrderItem.PayInfoId);
            if (param.OrderItem.PayInfoId == 0)
            {
                if (orderItem.HighPrintId > 0)
                {
                    param.PayInfoItem.PayType        = "BANK"; // 우선 출력 상품의 경우 대인불가
                    param.PayInfoItem.ShippingCharge = 0;
                    param.PayInfoItem.ManPaidCharge  = 0;
                }
                else
                {
                    param.PayInfoItem.PayType        = "MAN";
                    param.PayInfoItem.ShippingCharge = TradeUtil.GetShippingCharge(param.GoodsPrice, deliveryInfoItem);
                    param.PayInfoItem.ManPaidCharge  = TradeUtil.ManPaidCharge(param.PayInfoItem.ProductCharge + param.PayInfoItem.ShippingCharge - param.PayInfoItem.PointPaid);
                }
                param.PayInfoItem.ProductCharge = param.TaxAddedPrice;
                param.PayInfoItem.CashPrice     = param.PayInfoItem.ComputedCashPrice();
            }
            param.BankInfoSelectList = GetBankInfoSelectList(param.PayInfoItem.BankType);
            param.FromOrderConfirm   = fromOrderConfirm;
            return(param);
        }
Exemplo n.º 2
0
        //[Transaction()]
        //public void SetPayInfo(OrderItem orderItem, int pointPaid, string payType, string bankType, string bankUserName, int shippingCharge)
        //{
        //    int payInfoId = orderItem.PayInfoId;
        //    PayInfoItem payInfoItem = GetPayInfoItem(orderItem, pointPaid, payType, bankType, bankUserName, shippingCharge);

        //    if (payInfoId == 0)
        //    {
        //        payInfoId = InsertPayInfo(orderItem, payInfoId, payInfoItem);
        //    }
        //    else
        //    {
        //        UpdatePayInfo(orderItem, payInfoId, payInfoItem);
        //    }
        //}

        //[Transaction()]
        //public void SetPayInfo(OrderItem orderItem, int pointPaid, string payType, string bankType, string bankUserName, DeliveryInfoItem deliveryInfoItem)
        //{
        //    int payInfoId = orderItem.PayInfoId;

        //    int shippingCharge = GetShippingCharge(orderItem, deliveryInfoItem);

        //    PayInfoItem payInfoItem = GetPayInfoItem(orderItem, pointPaid, payType, bankType, bankUserName, shippingCharge);
        //    if (payInfoId == 0)
        //    {
        //        payInfoId = InsertPayInfo(orderItem, payInfoId, payInfoItem);
        //    }
        //    else
        //    {
        //        UpdatePayInfo(orderItem, payInfoId, payInfoItem);
        //    }
        //}

        //[Transaction()]
        //public void SetPayInfoTelegram(OrderItem orderItem, int pointPaid, string payType, string bankType, string bankUserName, DeliveryInfoItem deliveryInfoItem, IDictionary<string, string> dic)
        //{
        //    int payInfoId = orderItem.PayInfoId;
        //    int shippingCharge = GetShippingCharge(orderItem, deliveryInfoItem);

        //    PayInfoItem payInfoItem = GetPayInfoItem(orderItem, pointPaid, payType, bankType, bankUserName, shippingCharge);
        //    payInfoId = InsertPayInfo(orderItem, payInfoId, payInfoItem);

        //    if (payType.StartsWith("TELEGRAM"))
        //    {
        //        TelegramProcess(payInfoItem, orderItem, dic);
        //    }
        //}

        //[Transaction()]
        //public void SetPayInfoTelegram_UPDATE(OrderItem orderItem, int pointPaid, string payType, string bankType, string bankUserName, DeliveryInfoItem deliveryInfoItem, IDictionary<string, string> dic)
        //{
        //    int payInfoId = orderItem.PayInfoId;
        //    string oldPayType = orderItem.PayType;
        //    int shippingCharge = GetShippingCharge(orderItem, deliveryInfoItem);

        //    PayInfoItem payInfoItem = GetPayInfoItem(orderItem, pointPaid, payType, bankType, bankUserName, shippingCharge);
        //    UpdatePayInfo(orderItem, payInfoId, payInfoItem);

        //    if (payType.StartsWith("TELEGRAM") && !oldPayType.Equals(payType))
        //    {
        //        TelegramProcess(payInfoItem, orderItem, dic);
        //        OrderDao.UpdatePayStatus(orderItem.Id, "UNPAID");
        //    }
        //    else if (payType.Equals("POINT") || payType.Equals("MAN"))
        //    {
        //        OrderDao.UpdatePayStatus(orderItem.Id, "PAID");
        //    }
        //    else
        //    {
        //        OrderDao.UpdatePayStatus(orderItem.Id, "UNPAID");
        //    }
        //}

        //private void TelegramProcess(PayInfoItem payInfoItem, OrderItem orderItem, IDictionary<string, string> dic)
        //{
        //    // 요청
        //    Paygent_TELEGRAM_KIND telegramType = (Paygent_TELEGRAM_KIND)Enum.Parse(typeof(Paygent_TELEGRAM_KIND), payInfoItem.PayType);
        //    var Result = this.PaygentService.ProcPaygentTelegramPaymentRequest(orderItem.Id, payInfoItem.CashPrice, telegramType, this.TelegramProcess_GetParamDic(orderItem, telegramType, dic));

        //    // 응답 처리
        //    if (Result.Result != PaygentResultStatus.SUCCESS)
        //    {
        //        switch (Result.Result)
        //        {
        //            case PaygentResultStatus.ERROR_PARAM:
        //                string propertyName = PaygentUtil.GetPropertyNameFromRESPONSE_HEADER_DETAIL(Result.Response.RESPONSE_HEADER_DETAIL);
        //                string propertyNameJP = PaygentUtil.GetPaygentRequestTelegramDescription(propertyName, telegramType);
        //                throw BizException.CreateMakumakuServiceException(propertyName, propertyNameJP + "を確認してください。(" + Result.Response.RESPONSE_HEADER_CODE + ")");
        //            case PaygentResultStatus.ERROR_CARD:
        //                throw BizException.CreateMakumakuServiceException(PaygentResultStatus.ERROR_PARAM.ToString(), Result.Response.RESPONSE_HEADER_DETAIL + " (" + Result.Response.RESPONSE_HEADER_CODE + ")");
        //            default:
        //                if (Result.ManagedException != null)
        //                {
        //                    throw BizException.CreateMakumakuServiceException(PaygentResultStatus.ERROR_PARAM.ToString(), "PG社から決済システムの応答がありません。\nしばらくお待ちになってから、もう一度行なってください。" + " (" + Result.Response.RESPONSE_HEADER_CODE + ")", Result.ManagedException);
        //                }
        //                else
        //                {
        //                    throw BizException.CreateMakumakuServiceException(PaygentResultStatus.ERROR_PARAM.ToString(), "PG社から決済システムの応答がありません。\nしばらくお待ちになってから、もう一度行なってください。" + " (" + Result.Response.RESPONSE_HEADER_CODE + ")");
        //                }
        //        }
        //    }
        //}

        //private IDictionary TelegramProcess_GetParamDic(OrderItem orderItem, Paygent_TELEGRAM_KIND telegramType, IDictionary<string, string> dic)
        //{
        //    DateTime executeTime = DateTime.Now;

        //    PaygentTelegramRequest req = null;
        //    string payment_detail = orderItem.Code;
        //    string payment_detail_kana = orderItem.Code;
        //    string payment_limit_date = executeTime.AddDays(20).ToString("yyyyMMdd");
        //    string customer_name = dic["customer_name"];
        //    string customer_family_name = dic["customer_family_name"];
        //    if (telegramType == Paygent_TELEGRAM_KIND.TELEGRAM_ATM_REQUEST)
        //    {
        //        req = new PaygentTelegramRequest_ATM()
        //        {
        //            customer_name = orderItem.UserName,
        //            customer_name_kana = orderItem.UserId,
        //            payment_detail = payment_detail,
        //            payment_detail_kana = payment_detail_kana,
        //            payment_limit_date = payment_limit_date
        //        };
        //    }
        //    else if (telegramType == Paygent_TELEGRAM_KIND.TELEGRAM_CARD_REQUEST)
        //    {
        //        req = new PaygentTelegramRequest_DEFAULT()
        //        {
        //            //card_conf_number = JangBoGo.Security.Cryptography.RSADecrypt(dic["card_conf_number"]),
        //            //card_number = JangBoGo.Security.Cryptography.RSADecrypt(dic["card_number"]).FullToHalf().Replace("-", ""),
        //            //card_valid_term = JangBoGo.Security.Cryptography.RSADecrypt(dic["card_valid_term"]),
        //            //payment_detail = payment_detail,
        //            //payment_detail_kana = payment_detail_kana,
        //            //payment_class = (Paygent_CARD_PAYMENT_CLASS)Enum.Parse(typeof(Paygent_CARD_PAYMENT_CLASS), dic["payment_class"]),
        //            //split_count = dic["split_count"]
        //        };
        //    }
        //else if (telegramType == Paygent_TELEGRAM_KIND.TELEGRAM_KONBINI_N_REQUEST)
        //{
        //    var cvsCompanyId = (Paygent_KONBINI_PAYMENT_CVS_COMPANY_ID)Enum.Parse(typeof(Paygent_KONBINI_PAYMENT_CVS_COMPANY_ID), dic["cvs_company_id"]);
        //    string cvsType = string.Empty;
        //    switch (cvsCompanyId)
        //    {
        //        case Paygent_KONBINI_PAYMENT_CVS_COMPANY_ID.SEICO:
        //            cvsType = "01";
        //            break;

        //        case Paygent_KONBINI_PAYMENT_CVS_COMPANY_ID.LAWSON:
        //        case Paygent_KONBINI_PAYMENT_CVS_COMPANY_ID.MINISTOP:
        //        case Paygent_KONBINI_PAYMENT_CVS_COMPANY_ID.CIRCLEK:
        //        case Paygent_KONBINI_PAYMENT_CVS_COMPANY_ID.DAILY_YAMAZAKI:
        //        case Paygent_KONBINI_PAYMENT_CVS_COMPANY_ID.SUNKUS:
        //            cvsType = "02";
        //            break;

        //        case Paygent_KONBINI_PAYMENT_CVS_COMPANY_ID.SEJ:
        //            cvsType = "03";
        //            break;

        //        case Paygent_KONBINI_PAYMENT_CVS_COMPANY_ID.FAMILY:
        //            cvsType = "04";
        //            break;
        //    }
        //    var item = new PaygentTelegramRequest_KONBINI_N()
        //    {
        //        cvs_type = cvsType,
        //        customer_name = customer_name,
        //        customer_family_name = customer_family_name,
        //        customer_tel = dic["customer_tel"],
        //        site_info = "Makumaku",
        //        payment_limit_date = payment_limit_date,
        //        cvs_company_id = cvsCompanyId,
        //        sales_type = dic["sales_type"],
        //        ticket_start_date = executeTime.ToString("yyyyMMdd"),
        //        ticket_end_date = payment_limit_date,
        //        service_type = Paygent_KONBINI_PAYMENT_SERVICE_TYPE.NONE,
        //        ticket_num = 1
        //    };
        //    item.customer_notice[0] = string.Empty;
        //    item.tNNmaster[0] = string.Empty;
        //    item.tNNtemplate[0] = string.Empty;
        //    item.tNN_fieldNN[0, 0] = orderItem.Code;
        //    item.tNN_fieldNN_align[0, 0] = "1";
        //    req = item;
        //}
        //else if (telegramType == Paygent_TELEGRAM_KIND.TELEGRAM_BANK_ASP_PAYMENT_REQUEST)
        //{
        //    req = new PaygentTelegramRequest_BANK_ASP()
        //    {
        //        claim_kanji = payment_detail,
        //        claim_kana = payment_detail_kana,
        //        customer_name = orderItem.UserName,
        //        customer_name_kana = orderItem.UserId,
        //        copy_right = "Makumaku",
        //        banner_url = "",
        //        free_memo = "Makumaku"
        //    };
        //}

        //var rtn = req.ToRequestDictionary();

        //foreach (var kv in dic)
        //{
        //    if (!rtn.Contains(kv.Key))
        //    {
        //        rtn[kv.Key] = kv.Value;
        //    }
        //}

        //    return rtn;
        //}

        private int GetShippingCharge(OrderItem orderItem, DeliveryInfoItem deliveryInfoItem)
        {
            if (orderItem.HighPrintId > 0)
            {
                return(0);
            }
            return(TradeUtil.GetShippingCharge(OrderService.GetTaxAddedPrice(orderItem.Id), deliveryInfoItem));
        }
Exemplo n.º 3
0
        //public IPayInfoDao PayInfoDao { set; private get; }
        //public IOrderDao OrderDao { set; private get; }
        //public IBankInfoDao BankInfoDao { set; private get; }
        //public IPointService PointService { set; private get; }
        //public IDeliveryInfoDao DeliveryInfoDao { set; private get; }
        //public IPaygentService PaygentService { get; set; }

        //public ValidationErrorParam ValidationCheck(OrderItem orderItem, int pointPaid, string payType, string bankType, string bankUserName, DeliveryInfoItem deliveryInfoItem)
        //{
        //    ValidationErrorParam param = new ValidationErrorParam();

        //    if ("BANK".Equals(payType))
        //    {
        //        if (!"1,2".Split(',').Contains(bankType)) param.Add(new ValidationErrorItem() { ErrorTarget = "", ErrorMessage = "振込先口座入力してください。" });
        //        if (string.IsNullOrEmpty(bankUserName)) param.Add(new ValidationErrorItem() { ErrorTarget = "bankUserName", ErrorMessage = "振込先口座入力してください。" });
        //    }

        //    return param;
        //}

        //public ValidationErrorParam ValidationCheckPayInfoInsert(OrderItem orderItem)
        //{
        //    ValidationErrorParam param = new ValidationErrorParam();
        //    PayInfoItem payInfoItem = GetPayInfoItem(orderItem.Id);
        //    if (payInfoItem.Id > 0)
        //    {
        //        param.Add(new ValidationErrorItem() { ErrorTarget = "", ErrorMessage = "処理できません - すでに処理が完了しています。" });
        //    }
        //    return param;
        //}

        public ValidationErrorParam ValidationCheckCanPayInfoChange(OrderItem orderItem, int pointPaid, string payType, string bankType, string bankUserName, DeliveryInfoItem deliveryInfoItem)
        {
            ValidationErrorParam param = new ValidationErrorParam();
            var oldPayInfoItem         = GetPayInfoItem(orderItem.PayInfoId);
            var newPayInfoItem         = GetPayInfoItem(orderItem, pointPaid, payType, bankType, bankUserName, TradeUtil.GetShippingCharge(OrderService.GetTaxAddedPrice(orderItem.Id), deliveryInfoItem));

            if (orderItem.PayType.StartsWith("TELEGRAM") && !orderItem.PayType.Equals(payType))
            {
                param.Add(new ValidationErrorItem()
                {
                    ErrorTarget = "", ErrorMessage = "決済代行サービス(株式会社PAYGENT)ご利用頂いた場合、決済内容は変更頂けません。"
                });
            }
            bool payChanged = oldPayInfoItem.TotalCharge != newPayInfoItem.TotalCharge;

            if (payChanged && ((!orderItem.PayType.Equals("MAN") && orderItem.IsPaid()) || orderItem.PayType.StartsWith("TELEGRAM")))
            {
                param.Add(new ValidationErrorItem()
                {
                    ErrorTarget = "", ErrorMessage = "決済代行サービス(株式会社PAYGENT)ご利用頂いた場合、決済金額等の修正は出来ません。\n※変更がある場合は、別途お問い合わせ下さい。"
                });
            }
            return(param);
        }