コード例 #1
0
ファイル: PaySuccess.aspx.cs プロジェクト: prontoo/CaSyS
        private string FillRequestInvoices(InvoiceObject currentResponse, string lang, bool onlyShow)
        {
            var info = new LoginInfo();
            info.SessionId = currentResponse.SessionID;
            if (string.IsNullOrEmpty(currentResponse.SessionID))
            {
                return string.Empty;
            }

            if (!onlyShow)
            {
                if (string.IsNullOrEmpty(currentResponse.CaSySTransactionID))
                {
                    return string.Empty;
                }
            }

            try
            {
                var objectForSend = new ChargeInvoicesRequestData
                {
                    DealerId = ConfigurationManager.AppSettings["DealerID"],
                    SessionId = currentResponse.SessionID,
                    CustomerData = new WebServices.eRecharge.Customer
                    {
                        Email = currentResponse.ConfirmationEmail,
                        MSISDN = currentResponse.ConfirmationTelephone
                    },
                    PaymentData = new Payment
                    {
                        AuthCode = currentResponse.CaSySTransactionID,
                        BankID =
                            Convert.ToInt32(
                                ConfigurationManager.AppSettings["BankID"]),
                        CardID =
                            Convert.ToInt32(
                                currentResponse.TmisIssuedByAcquirer)
                    },
                    InvoiceData = new PaidInvoice[currentResponse.InvoiceDetais.Count]
                };

                for (var i = 0; i < currentResponse.InvoiceDetais.Count; i++)
                {
                    objectForSend.InvoiceData[i] = new PaidInvoice
                    {
                        Paid_Amount = currentResponse.InvoiceDetais[i].Amount,
                        Invoice_Ref_Num =
                            currentResponse.InvoiceDetais[i].InvoiceNumber
                    };
                }

                switch (lang.ToLower())
                {
                    case "mk":
                        objectForSend.Language = WebServices.eRecharge.type_Language.MK;
                        break;
                    case "al":
                        objectForSend.Language = WebServices.eRecharge.type_Language.AL;
                        break;
                    case "en":
                        objectForSend.Language = WebServices.eRecharge.type_Language.EN;
                        break;
                }

                if (!onlyShow)
                {
                    var dorecharge = Invoices.DoChargeInvoices(objectForSend);

                    if (dorecharge != null && dorecharge.ResponseType != null)
                    {
                        if (dorecharge.ResponseType.Status == 1)
                        {
                            return "1";
                        }
                    }
                }
                else
                {
                    AzurirajLabeli(objectForSend);
                }

                return string.Empty;
            }
            catch (Exception ex)
            {
                Log(ex);
                //Auditing.LogAction(AuditAction.InvoiceGeneralError, false, "0", info, DateTime.Now);
            }

            return string.Empty;
        }
コード例 #2
0
ファイル: PaySuccess.aspx.cs プロジェクト: prontoo/CaSyS
        private void AzurirajLabeli(ChargeInvoicesRequestData objectForSend)
        {
            decimal vkupno = 0;
            var payedInvoices = new Collection<PayedInvoices>();
            foreach (var invoice in objectForSend.InvoiceData)
            {
                var p = new PayedInvoices
                {
                    InvoiceNumber = invoice.Invoice_Ref_Num,

                    InvoicePayedAmount = Utils.FormatPriceValue(MyTranslation.GetResourceString("den"), invoice.Paid_Amount, true)
                };
                vkupno = vkupno + Convert.ToDecimal(invoice.Paid_Amount);

                payedInvoices.Add(p);
            }

            RepeaterInvoices.DataSource = payedInvoices;
            RepeaterInvoices.DataBind();
            ltrVkupno.Text = "vkupna suma";
        }