Пример #1
0
    private void CreatePostParameters(CheckoutDetails checkout)
    {
        PayPalRedirectPaymentMethod paymentMethod = (PayPalRedirectPaymentMethod)checkout.PaymentMethod;

        uxLiteral.Text    = CreateParameterText(checkout, paymentMethod);
        uxUrlHidden.Value = paymentMethod.GetPostedUrl();
    }
Пример #2
0
 protected override void PreProcessCheckout(CheckoutDetails details)
 {
     // call base
     base.PreProcessCheckout(details);
     // set invoice number
     InvoiceId = details.GetInt32("merchant_order_id");
 }
Пример #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if ((!DataAccessContext.Configurations.GetBoolValue("ShippingAddressMode")) ||
            (!StoreContext.CheckoutDetails.ShowShippingAddress))
        {
            uxShippingForm.Visible = false;
        }
        else
        {
            PopulateShippingForm();
            uxShippingForm.Visible = true;
        }

        CheckoutDetails details = StoreContext.CheckoutDetails;

        uxOrderCommentLabel.Text = WebUtilities.ReplaceNewLine(details.CustomerComments);
        if (string.IsNullOrEmpty(uxOrderCommentLabel.Text))
        {
            uxOrderSummaryCommentTD.Visible = false;
        }

        if (details.RedeemPoint > 0 && details.RedeemPrice > 0)
        {
            uxPointEarnedTD.Visible = false;
        }
        else
        {
            uxPointEarnedTD.Visible      = DataAccessContext.Configurations.GetBoolValue("PointSystemEnabled", StoreContext.CurrentStore) && KeyUtilities.IsDeluxeLicense(DataAccessHelper.DomainRegistrationkey, DataAccessHelper.DomainName);
            uxPointEarnedValueLabel.Text = GetRewardPoint().ToString();
        }
    }
Пример #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (StoreContext.ShoppingCart.GetCartItems().Length == 0)
        {
            Response.Redirect("Default.aspx");
        }

        if ((!DataAccessContext.Configurations.GetBoolValue("ShippingAddressMode")) ||
            (!StoreContext.CheckoutDetails.ShowShippingAddress))
        {
            uxShippingForm.Visible = false;
        }
        else
        {
            PopulateShippingForm();
            uxShippingForm.Visible = true;
        }

        CheckoutDetails details = StoreContext.CheckoutDetails;

        uxOrderCommentLabel.Text = WebUtilities.ReplaceNewLine(details.CustomerComments);
        if (string.IsNullOrEmpty(uxOrderCommentLabel.Text))
        {
            uxOrderSummaryCommentTD.Visible = false;
        }
    }
Пример #5
0
        public TransactionResult SubmitPaymentTransaction(CheckoutDetails details)
        {
            TransactionResult result = new TransactionResult();

            // 1. Process date and time variables
            string transactionNumber = DateTime.Now.ToString(TransactionNumberFormat);

            // 2. Process E-Commerce variables
            transactionNumber = transactionNumber.Replace("[INVOICE_ID]", details[CheckoutKeys.InvoiceNumber]);

            // transaction is ok
            result.Succeed = true;
            // set transation id
            result.TransactionId = transactionNumber;
            // status code is empty
            result.StatusCode = String.Empty;
            // no response available
            result.RawResponse = "No response available";

            // check payment approval setting
            if (AutoApprove)
            {
                result.TransactionStatus = TransactionStatus.Approved;
            }
            else
            {
                result.TransactionStatus = TransactionStatus.Pending;
            }

            // return result
            return(result);
        }
        public CheckoutDetails GetCheckoutDetails()
        {
            CheckoutDetails info = new CheckoutDetails();

            //
            info.Persistent = chkSaveDetails.Checked;
            //
            info[CheckoutKeys.IPAddress] = Request.UserHostAddress;
            //
            info[CheckoutKeys.CardNumber] = txtCreditCard.Text.Trim();
            //
            info[CheckoutKeys.CardType] = ddlCardTypes.SelectedValue;
            //
            info[CheckoutKeys.VerificationCode] = txtVerificationCode.Text.Trim();
            //
            info[CheckoutKeys.ExpireMonth] = ddlExpMonth.SelectedValue.Trim();
            //
            info[CheckoutKeys.ExpireYear] = ddlExpYear.SelectedValue.Trim();
            //
            info[CheckoutKeys.FirstName] = txtFirstName.Text.Trim();
            //
            info[CheckoutKeys.LastName] = txtLastName.Text.Trim();
            //
            info[CheckoutKeys.CustomerEmail] = txtEmail.Text.Trim();
            //
            info[CheckoutKeys.CompanyName] = txtCompany.Text.Trim();
            //
            info[CheckoutKeys.Address] = txtAddress.Text.Trim();
            //
            info[CheckoutKeys.Zip] = txtPostalCode.Text.Trim();
            //
            info[CheckoutKeys.City] = txtCity.Text.Trim();
            //
            if (ddlCountryStates.Visible)
            {
                info[CheckoutKeys.State] = ddlCountryStates.Text.Trim();
            }
            else
            {
                info[CheckoutKeys.State] = txtCountryState.Text.Trim();
            }
            //
            info[CheckoutKeys.Country] = ddlCountry.SelectedValue.Trim();
            //
            info[CheckoutKeys.Phone] = txtPhoneNumber.Text.Trim();
            //
            info[CheckoutKeys.Fax] = txtFaxNumber.Text.Trim();
            //
            if (phCardExt.Visible)
            {
                //
                info[CheckoutKeys.StartMonth] = ddlStartMonth.SelectedValue;
                //
                info[CheckoutKeys.StartYear] = ddlStartYear.SelectedValue;
                //
                info[CheckoutKeys.IssueNumber] = txtIssueNumber.Text.Trim();
            }
            //
            return(info);
        }
Пример #7
0
 private void CompleteCheckout()
 {
     try
     {
         // lookup for payment form
         IPaymentMethod methodObj = (IPaymentMethod)FindControl(CTL_PAYMENT_FORM);
         //
         CheckoutDetails details = methodObj.GetCheckoutDetails();
         //
         CheckoutResult result = StorefrontHelper.CompleteCheckout(ecPanelRequest.ContractId,
                                                                   ecPanelRequest.InvoiceId, ecPanelRequest.PaymentMethod, details);
         //
         if (!result.Succeed)
         {
             ShowErrorMessage(result.StatusCode);
             return;
         }
         //
         ecUtils.Navigate("ecOrderComplete", true);
     }
     catch (Exception ex)
     {
         ShowErrorMessage("COMPLETE_CHECKOUT", ex);
     }
 }
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var responseObject = await HttpClientHelper.GetFromLMARApi <MediaRecord>($"https://localhost:44300/api/v1/archives/9/mediarecords/{id}");

            MediaRecord mediaRecord = responseObject.ResponseData;

            if (mediaRecord == null)
            {
                return(NotFound());
            }

            CheckoutDetails checkoutDetails = new CheckoutDetails()
            {
                SelectedSizeId = "1",
                Sizes          = _orderRepository.GetSizes()
            };

            mediaRecord.ImageLink = mediaRecord.Links.FirstOrDefault(l => l.Rel == "Thumbnail").Href;

            DetailsViewModel detailsViewModel = new DetailsViewModel()
            {
                MediaRecord     = mediaRecord,
                CheckoutDetails = checkoutDetails
            };

            return(View(detailsViewModel));
        }
Пример #9
0
    private void CreatePostParameters(CheckoutDetails checkout)
    {
        PaymentAppGateway gateway = new PaymentAppGateway(checkout);
        TwoCheckoutRedirectPaymentMethod twoCheckoutPaymentMethod = (TwoCheckoutRedirectPaymentMethod)checkout.PaymentMethod;
        string urlHidden = twoCheckoutPaymentMethod.GetPostedUrl();

        NameValueCollection collection = twoCheckoutPaymentMethod.CreatePostParameters(
            checkout,
            StoreContext.Culture,
            StoreContext.Currency,
            StoreContext.ShoppingCart,
            UrlPath.StorefrontUrl,
            OrderID,
            StoreContext.GetOrderAmount().Total,
            StoreContext.WholesaleStatus,
            WebUtilities.GetVisitorIP());

        uxLiteral.Text = CreateParameterText(collection, twoCheckoutPaymentMethod);

        string xmlData = gateway.CreateHostedPaymentXml(
            StoreContext.Culture,
            StoreContext.Currency,
            StoreContext.ShoppingCart,
            UrlPath.StorefrontUrl,
            OrderID,
            StoreContext.GetOrderAmount().Total,
            StoreContext.WholesaleStatus,
            WebUtilities.GetVisitorIP());

        HostedXml.Value           = HttpUtility.UrlEncode(xmlData);
        uxUrlHidden.Value         = urlHidden;
        uxRefreshLink.NavigateUrl = urlHidden;
    }
Пример #10
0
    private void ProcessOnWebsiteRequireOrderIDPayment(CheckoutDetails checkout)
    {
        OnWebsiteRequireOrderIDPaymentMethod payment = (OnWebsiteRequireOrderIDPaymentMethod)checkout.PaymentMethod;

        OrderNotifyService order = CreateOrder(checkout);

        PaymentAppGateway gateway  = new PaymentAppGateway(checkout);
        string            postData = gateway.CreateOnWebsitePaymentXml(
            StoreContext.Culture,
            StoreContext.GetOrderAmount().Total,
            order.OrderID,
            WebUtilities.GetVisitorIP(),
            UrlPath.StorefrontUrl,
            true);

        PaymentAppResult paymentResult = gateway.PostCommand(new HttpService(), postData, UrlPath.StorefrontUrl);

        if (paymentResult.Status == PaymentAppResult.PaymentStatus.OK)
        {
            ProcessCreditCardPaymentSuccess(
                order,
                paymentResult.GatewayOrderID,
                paymentResult.PaymentLog,
                paymentResult.CvvStatus,
                paymentResult.AvsAddrStatus,
                paymentResult.AvsZipStatus);
        }
        else
        {
            ProcessCreditCardPaymentFailure(paymentResult.ErrorMessage);
        }
    }
Пример #11
0
    private OrderNotifyService CreateOrder(CheckoutDetails checkout)
    {
        OrderCreateService orderCreateService = new OrderCreateService(
            StoreContext.ShoppingCart,
            checkout,
            StoreContext.Culture,
            CurrenntCurrency,
            AffiliateHelper.GetAffiliateCode(),
            WebUtilities.GetVisitorIP());

        OrderNotifyService orderBusiness;
        OrderAmount        amount = orderCreateService.GetOrderAmount(StoreContext.Customer)
                                    .Add(CartItemPromotion.CalculatePromotionShippingAndTax(
                                             checkout,
                                             StoreContext.ShoppingCart.SeparateCartItemGroups(),
                                             StoreContext.Customer));

        Order order = orderCreateService.PlaceOrder(amount,
                                                    StoreContext.Customer, DataAccessContext.StoreRetriever, StoreContext.Culture);

        GiftRegistry.UpdateGiftRegistryQuantity(StoreContext.ShoppingCart, checkout);
        CustomerRewardPoint.UpdateRedeemPoint(checkout, StoreContext.Customer, order);

        orderBusiness = new OrderNotifyService(order.OrderID);

        return(orderBusiness);
    }
Пример #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //uxShippingForm.FindControl("T_BillingDetail").Visible = true;

        if (StoreContext.ShoppingCart.GetCartItems().Length == 0)
        {
            Response.Redirect("Default.aspx");
        }

        if ((!DataAccessContext.Configurations.GetBoolValue("ShippingAddressMode")) ||
            (!StoreContext.CheckoutDetails.ShowShippingAddress))
        {
            uxShippingForm.Visible = false;
        }
        else
        {
            PopulateShippingForm();
            uxShippingForm.Visible = true;
        }

        CheckoutDetails details = StoreContext.CheckoutDetails;

        uxCustomerCommentsLabel.Text = WebUtilities.ReplaceNewLine(details.CustomerComments);
        uxPointEarnedLabel.Text      = GetRewardPoint().ToString();
    }
Пример #13
0
    private string CreateParameterText(CheckoutDetails checkoutDetails, PayPalRedirectPaymentMethod paymentMethod)
    {
        NameValueCollection collection = paymentMethod.CreatePostParameters(
            checkoutDetails,
            StoreContext.Culture,
            StoreContext.Currency,
            StoreContext.ShoppingCart,
            UrlPath.StorefrontUrl,
            OrderID,
            StoreContext.GetOrderAmount().Total,
            StoreContext.WholesaleStatus,
            WebUtilities.GetVisitorIP()
            );

        StringBuilder sb = new StringBuilder();

        for (int i = 0; i < collection.Count; i++)
        {
            string text;
            if (paymentMethod.IsHiddenFieldUsingID)
            {
                text = CreateTagHiddenWithID(collection.GetKey(i), collection.Get(i));
            }
            else
            {
                text = CreateTagHidden(collection.GetKey(i), collection.Get(i));
            }

            sb.Append(text);
        }

        return(sb.ToString());
    }
Пример #14
0
    private OrderNotifyService CreateOrder(CheckoutDetails checkout)
    {
        OrderCreateService orderCreateService = new OrderCreateService(
            StoreContext.ShoppingCart,
            checkout,
            StoreContext.Culture,
            StoreContext.Currency,
            AffiliateHelper.GetAffiliateCode(),
            WebUtilities.GetVisitorIP());

        OrderNotifyService orderBusiness;
        Order       order;
        OrderAmount orderAmount;

        if (!IsAnonymousCheckout())
        {
            order         = PlaceOrder(orderCreateService, out orderAmount);
            orderBusiness = new OrderNotifyService(order.OrderID);
        }
        else
        {
            order = PlaceOrderAnonymous(
                SystemConst.AnonymousUser, orderCreateService, checkout, out orderAmount);

            orderBusiness = new OrderNotifyService(order.OrderID);
        }

        AffiliateOrder affiliateorder = new AffiliateOrder();

        affiliateorder.AffiliateCode = AffiliateHelper.GetAffiliateCode();
        affiliateorder.CreateAffiliateOrder(order.OrderID, orderAmount.Subtotal, orderAmount.Discount);

        return(orderBusiness);
    }
Пример #15
0
        private void Process_IPN_Request(TransactionResult result, CheckoutDetails details)
        {
            result.RawResponse = "";

            // build raw response
            foreach (string keyName in details.GetAllKeys())
            {
                if (String.IsNullOrEmpty(keyName))
                {
                    continue;
                }

                // check for separator
                if (!String.IsNullOrEmpty(result.RawResponse) &&
                    !result.RawResponse.EndsWith("&"))
                {
                    result.RawResponse += "&";
                }

                result.RawResponse += keyName + "=" + details[keyName];
            }
            // compare business account against email addres in response
            if (!String.Equals(details["receiver_email"], Business, StringComparison.InvariantCultureIgnoreCase))
            {
                throw new Exception(BUSINESS_NOT_MATCH_MSG);
            }

            // validate whether response still genuine
            if (!IsResponseGenuine(result.RawResponse))
            {
                throw new Exception(INVALID_RESPONSE_MSG);
            }
            // build tran id
            string transactionId = details["txn_id"];

            // check payment status
            switch (details["payment_status"])
            {
            case "Completed":
            case "Processed":
                result.Succeed = true;
                // store order details
                result.TransactionId     = transactionId;
                result.TransactionStatus = TransactionStatus.Approved;
                break;

            case "Pending":
                result.Succeed = true;
                // store order details
                result.TransactionId     = transactionId;
                result.TransactionStatus = TransactionStatus.Pending;
                break;

            default:
                result.Succeed           = false;
                result.TransactionStatus = TransactionStatus.Declined;
                break;
            }
        }
Пример #16
0
        public TransactionResult SubmitPaymentTransaction(CheckoutDetails details)
        {
            TransactionResult result = new TransactionResult();

            // build raw response for 2CO
            string[]      keys  = details.GetAllKeys();
            List <string> bunch = new List <string>();

            // copy checkout details
            foreach (string key in keys)
            {
                bunch.Add(String.Concat(key, "=", details[key]));
            }
            // build raw 2CO response
            result.RawResponse = String.Join("|", bunch.ToArray());
            // recognize credit card status
            switch (details[CREDIT_CARD_PROCESSED])
            {
            case "Y":
                result.TransactionStatus = TransactionStatus.Approved;
                break;

            case "K":
                result.TransactionStatus = TransactionStatus.Pending;
                break;

            default:
                throw new Exception(CC_PROCESSED_ERROR_MSG);
            }
            // read order number
            string order_number = details["order_number"];
            // check demo mode: set order number to 1
            // according to 2Checkout documentation for demo transactions

            bool valid = false;

            // validate TCO key
            if (LiveMode)             // do live validation
            {
                valid = ValidateKey(SecretWord, AccountSID, order_number, details[CheckoutKeys.Amount], details[KEY]);
            }
            else             // do demo validation
            {
                valid = ValidateKey(SecretWord, AccountSID, "1", details[CheckoutKeys.Amount], details[KEY]);
            }

            // key validation failed
            if (!valid)
            {
                throw new ArgumentException(KEY_VALIDATION_FAILED_MSG);
            }
            // we are succeed copy order number
            result.TransactionId = order_number;
            //
            result.Succeed = true;
            // return result
            return(result);
        }
Пример #17
0
    private void ProcessOnPayPalProUSPayment(CheckoutDetails checkout)
    {
        PayPalProUSPaymentMethod paypalPayment = (PayPalProUSPaymentMethod)checkout.PaymentMethod;
        bool                   result          = false;
        PaymentAppResult       paymentResult;
        RecurringPaymentResult recurringPaymentResult;
        ProcessPaymentService  process = ProcessPaymentService.CreateNew(new HttpService(), StoreContext.ShoppingCart);

        result = process.ProcessPayPalProUSPayment(
            StoreContext.GetOrderAmount().Total,
            DataAccessContext.CurrencyRepository.GetOne(DataAccessContext.Configurations.GetValue("PaymentCurrency")),
            StoreContext.Culture,
            checkout,
            StoreContext.ShoppingCart,
            StoreContext.Customer,
            UrlPath.StorefrontUrl,
            WebUtilities.GetVisitorIP(),
            out paymentResult,
            out recurringPaymentResult);

        if (result)
        {
            OrderCreateService orderCreateService = new OrderCreateService(
                StoreContext.ShoppingCart,
                StoreContext.CheckoutDetails,
                StoreContext.Culture,
                CurrenntCurrency,
                AffiliateHelper.GetAffiliateCode(),
                WebUtilities.GetVisitorIP(),
                recurringPaymentResult
                );

            Order       order;
            OrderAmount amount = orderCreateService.GetOrderAmount(StoreContext.Customer)
                                 .Add(CartItemPromotion.CalculatePromotionShippingAndTax(
                                          StoreContext.CheckoutDetails,
                                          StoreContext.ShoppingCart.SeparateCartItemGroups(),
                                          StoreContext.Customer));
            order = orderCreateService.PlaceOrder(amount, StoreContext.Customer, DataAccessContext.StoreRetriever, StoreContext.Culture);
            GiftRegistry.UpdateGiftRegistryQuantity(StoreContext.ShoppingCart, StoreContext.CheckoutDetails);
            CustomerRewardPoint.UpdateRedeemPoint(StoreContext.CheckoutDetails, StoreContext.Customer, order);

            OrderNotifyService orderBusiness = new OrderNotifyService(order.OrderID);

            ProcessCreditCardPaymentSuccess(
                orderBusiness,
                paymentResult.GatewayOrderID,
                paymentResult.PaymentLog,
                paymentResult.CvvStatus,
                paymentResult.AvsAddrStatus,
                paymentResult.AvsZipStatus);
        }
        else
        {
            ProcessCreditCardPaymentFailure(paymentResult.ErrorMessage);
        }
    }
Пример #18
0
        public TransactionResult SubmitPaymentTransaction(CheckoutDetails details)
        {
            //init result structure
            TransactionResult result = new TransactionResult();

            // check is request genuine depending on the provider mode
            Process_IPN_Request(result, details);
            //
            return(result);
        }
Пример #19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CheckoutDetails checkout = StoreContext.CheckoutDetails;

        if (checkout.PaymentMethod.IsNull || !(checkout.PaymentMethod is PayPalRedirectPaymentMethod))
        {
            Response.Redirect("GatewayPaymentError.aspx");
        }
        uxRefreshLink.NavigateUrl = Request.Url.PathAndQuery;
        CreatePostParameters(checkout);
    }
Пример #20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CheckoutDetails checkout = StoreContext.CheckoutDetails;

        if (checkout.PaymentMethod.IsNull ||
            !(checkout.PaymentMethod is RedirectPaymentMethod))
        {
            Response.Redirect("GatewayPaymentError.aspx");
        }

        CreatePostParameters(checkout);
    }
Пример #21
0
    private void ProcessZeroPricePayment(CheckoutDetails checkout)
    {
        OrderNotifyService order = CreateOrder(checkout);

        Exception emailEx = order.SendOrderEmailNoThrow();

        StoreError.Instance.Exception = emailEx;

        order.ProcessPaymentComplete();

        StoreContext.ClearCheckoutSession();

        MainContext.RedirectMainControl("OrdersEdit.ascx", String.Format("OrderID={0}", order.OrderID));
    }
        // GET: Checkout
        public async Task <ActionResult> Index()
        {
            CheckoutDetails details = new CheckoutDetails
            {
                Addresses   = await InitializeAddressesAsync(),
                CurrentCart = await InitializeCartAsync()
            };

            if ((details.CurrentCart == null) || (!details.CurrentCart.Cart_Books.Any()))
            {
                return(RedirectToAction("Index", "Cart"));
            }
            return(View(details));
        }
Пример #23
0
    private bool IsEnoughGiftRegistyWantQuantity(out string message)
    {
        CheckoutDetails checkout = StoreContext.CheckoutDetails;

        message = String.Empty;
        if (!String.IsNullOrEmpty(checkout.GiftRegistryID) && checkout.GiftRegistryID != "0")
        {
            int rowIndex;
            for (rowIndex = 0; rowIndex < uxGrid.Rows.Count; rowIndex++)
            {
                GridViewRow row = uxGrid.Rows[rowIndex];
                if (row.RowType == DataControlRowType.DataRow)
                {
                    string cartItemID         = uxGrid.DataKeys[rowIndex]["CartItemID"].ToString();
                    string giftRegistryItemID =
                        StoreContext.CheckoutDetails.CartItemIDToGiftRegistryIDMap[cartItemID];

                    GiftRegistryItem giftRegistryItem = DataAccessContextDeluxe.GiftRegistryItemRepository.GetOne(
                        giftRegistryItemID);

                    int wantQuantity = (int)(giftRegistryItem.WantQuantity - giftRegistryItem.HasQuantity);

                    string productName = ((Label)row.FindControl("uxNameLabel")).Text;
                    int    quantity    = ConvertUtilities.ToInt32(((TextBox)row.FindControl("uxQuantityText")).Text);

                    if (quantity > wantQuantity)
                    {
                        message += "<li>" + productName + "</li>";
                    }
                }
            }

            if (!String.IsNullOrEmpty(message))
            {
                message =
                    "<p class=\"ErrorHeader\">[$GiftRegistryError]</p>" +
                    "<ul class=\"ErrorBody\">" + message + "</ul>";

                return(false);
            }
            else
            {
                return(true);
            }
        }
        else
        {
            return(true);
        }
    }
Пример #24
0
    private void ProcessAnonymousPayment(CheckoutDetails checkout)
    {
        AnonymousPaymentMethod payment = (AnonymousPaymentMethod)checkout.PaymentMethod;

        ProcessPaymentResult paymentResult;
        bool result = payment.ProcessPayment(
            StoreContext.GetOrderAmount().Total,
            DataAccessContext.Configurations.GetValue("PaymentCurrency"),
            checkout,
            out paymentResult);

        if (result)
        {
            OrderCreateService orderCreateService = new OrderCreateService(
                StoreContext.ShoppingCart,
                checkout,
                StoreContext.Culture,
                StoreContext.Currency,
                AffiliateHelper.GetAffiliateCode(),
                WebUtilities.GetVisitorIP());

            OrderAmount orderAmount;
            Order       order = PlaceOrderAnonymous(
                (Page.User.Identity.IsAuthenticated) ? Membership.GetUser().UserName : SystemConst.AnonymousUser,
                orderCreateService,
                checkout, out orderAmount);

            AffiliateOrder affiliateorder = new AffiliateOrder();
            affiliateorder.AffiliateCode = AffiliateHelper.GetAffiliateCode();
            affiliateorder.CreateAffiliateOrder(order.OrderID, orderAmount.Subtotal, orderAmount.Discount);

            OrderNotifyService orderBusiness = new OrderNotifyService(order.OrderID);
            ProcessCreditCardPaymentSuccess(
                orderBusiness,
                paymentResult.GatewayOrderID,
                paymentResult.PaymentLog,
                paymentResult.CvvStatus,
                paymentResult.AvsAddrStatus,
                paymentResult.AvsZipStatus);
        }
        else
        {
            CheckoutNotCompletePage.RedirectToPage(
                "Error Message",
                paymentResult.ErrorMessage,
                "ShoppingCart.aspx",
                "Return To Shopping Cart");
        }
    }
Пример #25
0
        private void SavePaymentProfile()
        {
            try
            {
                CheckoutDetails profile = ctlPaymentProfile.GetCheckoutDetails();

                StorehouseHelper.SetPaymentProfile(myContract.ContractId, profile);

                ShowSuccessMessage("SAVE_PAYMENT_PROFILE");
            }
            catch (Exception ex)
            {
                ShowErrorMessage("SAVE_PAYMENT_PROFILE", ex);
            }
        }
Пример #26
0
    private void ProcessZeroPricePayment(CheckoutDetails checkout)
    {
        OrderNotifyService order = CreateOrder(checkout);

        Exception emailEx = order.SendOrderEmailNoThrow();

        StoreError.Instance.Exception = emailEx;

        order.ProcessPaymentComplete();

        StoreContext.ClearCheckoutSession();

        Response.Redirect("CheckoutComplete.aspx?OrderID=" + order.OrderID +
                          "&IsTransaction=True" + GenerateIsEmailOKString(emailEx));
    }
Пример #27
0
    private void ProcessOfflinePaymentSuccess(CheckoutDetails checkout)
    {
        OrderNotifyService order = CreateOrder(checkout);

        // Do not send electronic goods for offline payment. Merchants should send them manually.

        //********************* For Testing *****************************
        //order.SendDownloadEmailByOrderID();

        Exception emailEx = order.SendOrderEmailNoThrow();

        StoreError.Instance.Exception = emailEx;

        StoreContext.ClearCheckoutSession();

        MainContext.RedirectMainControl("OrdersEdit.ascx", String.Format("OrderID={0}", order.OrderID));
    }
Пример #28
0
 protected virtual void ProcessCheckout(string methodName, CheckoutDetails details)
 {
     try
     {
         PreProcessCheckout(details);
         // perform order payment
         CheckoutResult result = StorefrontHelper.CompleteCheckout(details[contractKey], invoiceId, methodName, details);
         // post process order result
         PostProcessCheckout(result);
     }
     catch (Exception ex)
     {
         // Output error message into the trace
         Trace.Write("ECOMMERCE", "COMPLETE_CHECKOUT_ERROR", ex);
         // display raw stack trace in case of error
         Response.Write(PortalUtils.GetSharedLocalizedString("Ecommerce", "Error.CHECKOUT_GENERAL_FAILURE"));
     }
 }
Пример #29
0
    private void ProcessHostedPayment(CheckoutDetails checkout)
    {
        OrderNotifyService order = CreateOrder(checkout);

        PaymentAppGateway gateway = new PaymentAppGateway(checkout);

        string xmlData = gateway.CreateHostedPaymentXml(
            StoreContext.Culture,
            CurrenntCurrency,
            StoreContext.ShoppingCart,
            UrlPath.StorefrontUrl,
            order.OrderID,
            StoreContext.GetOrderAmount().Total,
            StoreContext.WholesaleStatus,
            WebUtilities.GetVisitorIP());

        Response.Redirect("../Gateway/GatewayPosting.aspx?OrderID=" + order.OrderID);
    }
Пример #30
0
    private void ProcessOfflinePaymentSuccess(CheckoutDetails checkout)
    {
        OrderNotifyService order = CreateOrder(checkout);

        // Do not send electronic goods for offline payment. Merchants should send them manually.

        //********************* For Testing *****************************
        //order.SendDownloadEmailByOrderID();

        Exception emailEx = order.SendOrderEmailNoThrow();

        StoreError.Instance.Exception = emailEx;

        StoreContext.ClearCheckoutSession();

        Response.Redirect("CheckoutComplete.aspx?OrderID=" + order.OrderID +
                          "&IsTransaction=True" + GenerateIsEmailOKString(emailEx));
    }
Пример #31
0
        public ActionResult Create(FormCollection frm, Checkout model, int ticketID)
        {
            //Kế toán sửa rồi thanh toán
            if (model.ID != 0)
            {
                var listCheckoutDetailJson = new List<CheckoutDetails>();
                try
                {
                    listCheckoutDetailJson = JsonConvert.DeserializeObject<List<CheckoutDetails>>(frm["listCheckoutDetailJson"]);
                }
                catch { }

                var obj = db.Checkout.FirstOrDefault(m => m.ID == model.ID);
                int i = 0;
                if (listCheckoutDetailJson.Count == obj.CheckoutDetails.Count)
                    foreach (var item in obj.CheckoutDetails)
                    {
                        item.DeptCode = listCheckoutDetailJson[i].DeptCode;
                        item.No = listCheckoutDetailJson[i].No;
                        item.Date = listCheckoutDetailJson[i].Date;
                    }
                db.SaveChanges();
                return ThanhToan(model.ID);
            }

            try
            {
                model.Created = DateTime.Now;
                model.CreatedBy = DB.CurrentUser.ID;
                model.SumTotal = 0;
                model.Total = 0;
                model.Track += ";#" + model.CreatedBy;
                model.Current = model.CreatedBy;
                model.Status = CheckoutStatus.KhoiTao;

                var listCheckoutDetailJson = new List<CheckoutDetails>();
                try
                {
                    listCheckoutDetailJson = JsonConvert.DeserializeObject<List<CheckoutDetails>>(frm["listCheckoutDetailJson"]);
                }
                catch { }

                var tamUng = new CheckoutDetails();
                try
                {
                    tamUng = JsonConvert.DeserializeObject<CheckoutDetails>(frm["tamUng"]);
                }
                catch { }

                var phiNganHang = new CheckoutDetails();
                try
                {
                    phiNganHang = JsonConvert.DeserializeObject<CheckoutDetails>(frm["phiNganHang"]);
                }
                catch { }
                model.AdvandPayment = tamUng.VND;
                model.BankingCharge = phiNganHang.VND;
                db.Checkout.Add(model);
                db.SaveChanges();

                var details = listCheckoutDetailJson.Select(m => new CheckoutDetails()
                    {
                        Date = m.Date,
                        DeptCode = m.DeptCode,
                        No = m.No,
                        Title = m.Title,
                        CheckoutID = model.ID,
                        VND = m.VND,
                        USD = m.USD,
                    });
                model.SumTotal = details.Sum(m => m.VND);
                model.Total = model.SumTotal - model.AdvandPayment.Value + model.BankingCharge.Value;
                db.CheckoutDetails.AddRange(details);
                //cập nhật lại ticket
                var ticket = db.Ticket.FirstOrDefault(m => m.ID == ticketID);
                ticket.CheckoutID = model.ID;

                db.SaveChanges();

                db.Database.ExecuteSqlCommand(string.Format("insert into CheckoutUser values({0},{1})", model.ID, model.Current));

                return GuiKiemTra(model.ID);
            }
            catch
            {
                return Redirect(Request.RawUrl);
            }
        }