Esempio n. 1
0
        public void UpdateAccountsLedger(PaymentReceiptModel payment)
        {
            SqlDataReader SqlDtr = null;
            object        op     = null;

            dbobj.ExecProc(DbOperations_LATEST.OprType.Update, "UpdateAccountsLedgerForCustomer", ref op, "@Ledger_ID", payment.LedgerID, "@Invoice_Date", payment.Invoice_Date);
            dbobj.SelectQuery("select cust_id from customer,ledger_master where Cust_Name=Ledger_Name and Ledger_ID='" + payment.LedgerID + "'", ref SqlDtr);
            if (SqlDtr.Read())
            {
                dbobj.ExecProc(DbOperations_LATEST.OprType.Update, "UpdateCustomerLedgerForCustomer", ref op, "@Cust_ID", SqlDtr["Cust_ID"].ToString(), "@Invoice_Date", payment.Invoice_Date);
            }
        }
Esempio n. 2
0
        public void ValidateATransactionResult()
        {
            ITransactionResult transactionResult = new PaymentReceiptModel();

            var validator = new PolymorphicValidator <ITransactionResult>(new TransactionResultValidation())
// ReSharper disable RedundantTypeArgumentsOfMethod
                            .Add <PaymentReceiptModel>(new PaymentReceiptValidation())
                            .Add <PaymentRequiresThreeDSecureModel>(new PaymentRequiresThreeDSecureModelValidation());

// ReSharper restore RedundantTypeArgumentsOfMethod

            validator.Validate(transactionResult);
        }
Esempio n. 3
0
        private void SuccessPayment(PaymentReceiptModel receipt)
        {
            Client.Instance.PaymentToken.CardToken     = receipt.CardDetails.CardToken;
            Client.Instance.PaymentToken.ConsumerToken = receipt.Consumer.ConsumerToken;
            Client.Instance.PaymentToken.CardLastfour  = receipt.CardDetails.CardLastfour;
            Client.Instance.PaymentToken.CardType      = (int)receipt.CardDetails.CardType;
            DispatchQueue.MainQueue.DispatchAfter(DispatchTime.Now, () => {
                // show receipt
                ShowMessage("Transaction Successful", "Receipt ID - " + receipt.ReceiptId);

                // store token to further use
            });
        }
Esempio n. 4
0
        protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            JudoReceipt receipt    = null;
            string      msg_prefix = "";

            if (data != null)
            {
                var resultString = data.GetStringExtra(JudoSDKManager.JUDO_RECEIPT);
                if (resultString != null)
                {
                    var jsonResult = JsonConvert.DeserializeObject <PaymentReceiptModel> (resultString);
                    receipt = new JudoReceipt(jsonResult);
                }
                if (resultCode == Result.Canceled)
                {
                    Finish();
                }
                else if (resultCode == JudoSDKManager.JUDO_ERROR)
                {
                    var jsonError = data.GetStringExtra(JudoSDKManager.JUDO_ERROR_EXCEPTION);
                    var error     = (jsonError != null ? JsonConvert.DeserializeObject <JudoError> (data.GetStringExtra(JudoSDKManager.JUDO_ERROR_EXCEPTION)) : null);
                    PaymentReceiptModel paymentReceipt = null;
                    if (receipt != null)
                    {
                        paymentReceipt = receipt.FullReceipt as PaymentReceiptModel;
                    }

                    var innerError = new JudoError()
                    {
                        Exception = new Exception("Unknown Error"),
                        ApiError  = null
                    };
                    if (error != null)
                    {
                        innerError = new JudoError()
                        {
                            Exception = error.Exception,
                            ApiError  = error.ApiError
                        };
                    }
                    _judoFailureCallback.Value(innerError, paymentReceipt);

                    Finish();
                }
                else
                {
                    HandleRequestCode(requestCode, resultCode, receipt);
                }
            }
            Finish();
        }
Esempio n. 5
0
        public List <string> GetReceiptNos(PaymentReceiptModel payment)
        {
            InventoryClass obj    = new InventoryClass();
            SqlDataReader  SqlDtr = null;
            string         sql    = "select distinct Receipt_No from Payment_Receipt where cast(floor(cast(Receipt_Date as float)) as datetime) >= '" + payment.ReceiptFromDate + "' and cast(floor(cast(Receipt_Date as float)) as datetime) <= '" + payment.ReceiptToDate + "' order by Receipt_No";

            SqlDtr = obj.GetRecordSet(sql);
            List <string> Receipts = new List <string>();

            while (SqlDtr.Read())
            {
                Receipts.Add(SqlDtr.GetValue(0).ToString());
            }
            SqlDtr.Close();
            return(Receipts);
        }
Esempio n. 6
0
        private void SuccessPayment(PaymentReceiptModel receipt)
        {
            cardToken     = receipt.CardDetails.CardToken;
            consumerToken = receipt.Consumer.ConsumerToken;
            lastFour      = receipt.CardDetails.CardLastfour;
            cardType      = receipt.CardDetails.CardType;
            //set alert for executing the task
            AlertDialog.Builder alert = new AlertDialog.Builder(this);
            alert.SetTitle("Transaction Successful, Receipt ID - " + receipt.ReceiptId);
            alert.SetPositiveButton("OK", (senderAlert, args) => {
            });

            RunOnUiThread(() => {
                alert.Show();
            });
        }
Esempio n. 7
0
        public void ValidateATransactionResult()
        {
            ITransactionResult transactionResult = new PaymentReceiptModel();

            var validator = new PolymorphicValidator <ITransactionResult>(new TransactionResultValidation())
                            // ReSharper disable RedundantTypeArgumentsOfMethod
                            .Add <PaymentReceiptModel>(new PaymentReceiptValidation())
                            .Add <PaymentRequiresThreeDSecureModel>(new PaymentRequiresThreeDSecureModelValidation());
            // ReSharper restore RedundantTypeArgumentsOfMethod

            var result = validator.Validate(transactionResult);

            Assert.IsNotNull(result);

            var inner = result.First();

            Assert.IsTrue(inner.PropertyName == "ReceiptId");
        }
Esempio n. 8
0
        public string GetCustID(PaymentReceiptModel payment)
        {
            int OldCustID = 0;

            if (payment.PanReceiptNo == true)
            {
                dbobj.ExecuteScalar("select cust_id from customer where cust_name=(select ledger_name from ledger_master where ledger_id = '" + payment.CustomerID + "')", ref OldCustID);
                var customerID = OldCustID.ToString();
            }

            /****************Add by vikas 12.09.09 ********************************/
            else
            {
                dbobj.ExecuteScalar("select cust_id from customer where cust_name=(select ledger_name from ledger_master where ledger_name= '" + payment.CustomerID + "')", ref OldCustID);
                var customerID = OldCustID.ToString();
            }

            return(OldCustID.ToString());
        }
Esempio n. 9
0
        public string DeleteReceipt(PaymentReceiptModel payment)
        {
            int    x = 0, Cust_ID = 0;
            object obj = null;

            dbobj.Insert_or_Update("delete from AccountsLedgerTable where particulars = 'Receipt (" + payment.ReceiptNo + ")'", ref x);
            dbobj1.Insert_or_Update("delete from AccountsLedgerTable where Particulars = 'Receipt_" + payment.DiscountType1 + " (" + payment.ReceiptNo + ")'", ref x);
            dbobj1.Insert_or_Update("delete from AccountsLedgerTable where Particulars = 'Receipt_" + payment.DiscountType2 + " (" + payment.ReceiptNo + ")'", ref x);
            dbobj.Insert_or_Update("delete from CustomerLedgerTable where particular = 'Payment Received(" + payment.ReceiptNo + ")'", ref x);
            dbobj.Insert_or_Update("delete from Payment_Receipt where Receipt_No='" + payment.ReceiptNo + "'", ref x);
            dbobj.Insert_or_Update("insert into payment_receipt values(" + payment.ReceiptNo + ",'Deleted','" + payment.Invoice_Date + "','','','','','','','','','','','','','')", ref x);

            dbobj.ExecuteScalar("select cust_id from customer where cust_name=(select ledger_name from ledger_master where ledger_id = '" + payment.CustomerID + "')", ref Cust_ID);
            dbobj.ExecProc(DbOperations_LATEST.OprType.Insert, "UpdateAccountsLedgerForCustomer", ref obj, "@Ledger_ID", payment.CustomerID, "@Invoice_Date", payment.RecDate);
            dbobj.ExecProc(DbOperations_LATEST.OprType.Insert, "UpdateCustomerLedgerForCustomer", ref obj, "@Cust_ID", Cust_ID, "@Invoice_Date", payment.RecDate);
            string message = "Receipt Cancellation Successfully";

            return(message);
        }
Esempio n. 10
0
        private void FailurePayment(JudoError error, PaymentReceiptModel receipt)
        {
            DispatchQueue.MainQueue.DispatchAfter(DispatchTime.Now, () => {
                // move back to home screen
                // show receipt
                string title          = "Error";
                string message        = "";
                StringBuilder builder = new StringBuilder();

                if (error != null && error.ApiError != null)
                {
                    title = (error.ApiError != null ? error.ApiError.Message : "");
                }

                if (error != null && error.ApiError != null)
                {
                    if (error.ApiError.ModelErrors != null && error.ApiError.ModelErrors.Count > 0)
                    {
                        foreach (FieldError model in error.ApiError.ModelErrors)
                        {
                            builder.AppendLine(model.Message);
                        }
                    }
                    else
                    {
                        title = "Error";
                        builder.AppendLine(error.ApiError.Message);
                    }
                }

                if (receipt != null)
                {
                    builder.AppendLine("Transaction : ");
                    builder.AppendLine(receipt.Message);
                    builder.AppendLine("Receipt ID - " + receipt.ReceiptId);
                }

                ShowMessage(title, builder.ToString());
            });
        }
Esempio n. 11
0
        private void FailurePayment(JudoError error, PaymentReceiptModel receipt)
        {
            //set alert for executing the task
            AlertDialog.Builder alert = new AlertDialog.Builder(this);

            string        title   = "Error";
            StringBuilder builder = new StringBuilder();

            if (error != null && error.ApiError != null)
            {
                title = (error.ApiError.Message);
                if (error.ApiError.ModelErrors != null && error.ApiError.ModelErrors.Count > 0)
                {
                    foreach (FieldError model in error.ApiError.ModelErrors)
                    {
                        builder.AppendLine(model.Message + (!String.IsNullOrWhiteSpace(model.FieldName) ? "(" + model.FieldName + ")" : ""));
                    }
                }
                else
                {
                    title = ("Error");
                    builder.AppendLine(error.ApiError.Message);
                }
            }
            if (receipt != null)
            {
                builder.AppendLine("Transaction : " + receipt.Result);
                builder.AppendLine(receipt.Message);
                builder.AppendLine("Receipt ID - " + receipt.ReceiptId);
            }
            alert.SetTitle(title);
            alert.SetMessage(builder.ToString());
            alert.SetPositiveButton("OK", (senderAlert, args) => {
            });

            RunOnUiThread(() => {
                alert.Show();
            });
        }
Esempio n. 12
0
        public void InsertPayment(PaymentReceiptModel payment)
        {
            object op = null;

            if (payment.PanReceiptNo == true)
            {
                //************* Add This code by Mahesh on 05.07.008 ******************
                int x = 0;
                dbobj1.Insert_or_Update("delete from AccountsLedgerTable where Particulars = 'Receipt (" + payment.ReceiptNo + ")'", ref x);
                dbobj1.Insert_or_Update("delete from AccountsLedgerTable where Particulars = 'Receipt_" + payment.Discount1 + " (" + payment.ReceiptNo + ")'", ref x);
                dbobj1.Insert_or_Update("delete from AccountsLedgerTable where Particulars = 'Receipt_" + payment.Discount2 + " (" + payment.ReceiptNo + ")'", ref x);
                dbobj1.Insert_or_Update("delete from CustomerLedgerTable where Particular = 'Payment Received(" + payment.ReceiptNo + ")' and CustID='" + payment.CustomerID + "'", ref x);
                dbobj1.Insert_or_Update("delete from Payment_Receipt where Receipt_No='" + payment.ReceiptNo + "'", ref x);
                //*********************************************************************
                //dbobj.ExecProc(OprType.Insert,"InsertPayment",ref op,"@Ledger_ID",Ledger_ID,"@amount",Amount,"@Acc_Type",Acc_Type,"@BankName",Acc_Type,"@ChNo",txtChequeno.Text,"@ChDate",txtDate.Text,"@Mode",DropMode.SelectedItem.Text,"@Narration",txtNar.Text,"@CustBankName",txtCustBankName.Text);
                if (payment.Mode == "Cash")
                {
                    dbobj.ExecProc(DbOperations_LATEST.OprType.Insert, "InsertPayment", ref op, "@Ledger_ID", payment.Cust_ID, "@amount", payment.Amount, "@Acc_Type", payment.AccountType, "@BankName", "", "@ChNo", "", "@ChDate", "", "@Mode", payment.Mode, "@Narration", "", "@CustBankName", "", "@RecDate", payment.RecDate, "@Cust_ID", payment.Cust_ID, "@Receipt", "Save", "@Receipt_No", payment.ReceiptNo);
                }
                else
                {
                    dbobj.ExecProc(DbOperations_LATEST.OprType.Insert, "InsertPayment", ref op, "@Ledger_ID", payment.Cust_ID, "@amount", payment.Amount, "@Acc_Type", payment.AccountType, "@BankName", payment.AccountType, "@ChNo", payment.ChequeNumber, "@ChDate", payment.ChequeDate, "@Mode", payment.Mode, "@Narration", payment.Narration, "@CustBankName", payment.CustBankName, "@RecDate", payment.RecDate, "@Cust_ID", payment.Cust_ID, "@Receipt", "Save", "@Receipt_No", payment.ReceiptNo);
                }
            }
            else
            {
                var date = Convert.ToDateTime(payment.RecDate);
                if (payment.Mode == "Cash")
                {
                    dbobj.ExecProc(DbOperations_LATEST.OprType.Insert, "InsertPayment", ref op, "@Ledger_ID", payment.Cust_ID, "@amount", payment.Amount, "@Acc_Type", payment.AccountType, "@BankName", "", "@ChNo", "", "@ChDate", "", "@Mode", payment.Mode, "@Narration", "", "@CustBankName", "", "@RecDate", date, "@Cust_ID", payment.Cust_ID, "@Receipt", "Save", "@Receipt_No", payment.ReceiptNo);
                }
                else
                {
                    dbobj.ExecProc(DbOperations_LATEST.OprType.Insert, "InsertPayment", ref op, "@Ledger_ID", payment.Cust_ID, "@amount", payment.Amount, "@Acc_Type", payment.AccountType, "@BankName", payment.AccountType, "@ChNo", payment.ChequeNumber, "@ChDate", payment.ChequeDate, "@Mode", payment.Mode, "@Narration", payment.Narration, "@CustBankName", payment.CustBankName, "@RecDate", payment.RecDate, "@Cust_ID", payment.Cust_ID, "@Receipt", "Save", "@Receipt_No", payment.ReceiptNo);
                }
            }
        }
Esempio n. 13
0
        public PaymentReceiptModel GetSelectedReceipt(string ReceiptNo)
        {
            PaymentReceiptModel receipt = new PaymentReceiptModel();
            InventoryClass      obj     = new InventoryClass();
            InventoryClass      obj1    = new InventoryClass();
            SqlDataReader       SqlDtr;

            string sql;

            sql    = "select * from payment_receipt where Receipt_No=" + ReceiptNo;
            SqlDtr = obj.GetRecordSet(sql);
            SqlDataReader rdr     = null;
            double        totdisc = 0;

            //bool Flag=true;

            //*****while(SqlDtr.Read())
            if (SqlDtr.Read())
            {
                receipt.SubReceiptNo = SqlDtr["SubReceiptNo"].ToString();

                receipt.InvoiceNo = SqlDtr.GetValue(3).ToString();
                receipt.Mode      = SqlDtr.GetValue(8).ToString();
                if (SqlDtr.GetValue(5).ToString() != "")
                {
                    dbobj.SelectQuery("select Ledger_Name,Ledger_ID from Ledger_Master where Ledger_ID='" + SqlDtr.GetValue(5).ToString() + "'", ref rdr);
                    if (rdr.Read())
                    {
                        receipt.BankName = rdr["Ledger_Name"].ToString();
                        receipt.LedgerID = rdr["Ledger_ID"].ToString();
                    }
                    rdr.Close();
                }
                else
                {
                    receipt.BankName = "0";
                    receipt.LedgerID = "0";
                }
                //txtBankName.Text=SqlDtr.GetValue(5).ToString();
                receipt.ChequeNumber = SqlDtr.GetValue(6).ToString();
                receipt.ChequeDate   = SqlDtr.GetValue(7).ToString();
                receipt.RecDate      = SqlDtr["Receipt_Date"].ToString();
                //Invoice_Date=txtReceivedDate.Text.ToString();
                receipt.Invoice_Date = SqlDtr["Receipt_Date"].ToString();
                //********
                receipt.ReceivedAmount = SqlDtr["Received_Amount"].ToString();
                if (SqlDtr["Discount1"].ToString() != "")
                {
                    receipt.Discount1 = SqlDtr["Discount1"].ToString();
                }
                if (SqlDtr["Discount2"].ToString() != "")
                {
                    receipt.Discount2 = SqlDtr["Discount2"].ToString();
                }
                //********
                //str = SqlDtr.GetValue(4).ToString();
                //str=System.Convert.ToString(double.Parse(SqlDtr.GetValue(4).ToString())-totdisc);
                //Cache["RecAmt"] = SqlDtr.GetValue(4).ToString();
                //Cache["RecAmt"]=System.Convert.ToString(double.Parse(SqlDtr.GetValue(4).ToString())-totdisc);
                receipt.Cust_ID        = SqlDtr["Cust_ID"].ToString();
                receipt.CustomerID     = SqlDtr["Cust_ID"].ToString();
                receipt.Narration      = SqlDtr["Narration"].ToString();
                receipt.ReceivedAmount = SqlDtr["Received_Amount"].ToString();
                receipt.CustBankName   = SqlDtr["CustBankName"].ToString();
                //Textbox1.Text = totdisc.ToString();

                //Tot_Rec = Convert.ToDouble(totdisc.ToString());                       //Add by vikas 12.09.09

                dbobj.SelectQuery("select Ledger_Name from Ledger_Master where Ledger_ID='" + SqlDtr["DiscLedgerID1"].ToString() + "'", ref rdr);
                if (rdr.Read())
                {
                    receipt.DiscLedgerID1 = rdr["Ledger_Name"].ToString();
                    //DiscLedgerName1 = rdr["Ledger_Name"].ToString();
                }
                else
                {
                    receipt.DiscLedgerID1 = "0";
                    //DiscLedgerName1 = "";
                }
                rdr.Close();
                dbobj.SelectQuery("select Ledger_Name from Ledger_Master where Ledger_ID='" + SqlDtr["DiscLedgerID2"].ToString() + "'", ref rdr);
                if (rdr.Read())
                {
                    receipt.DiscLedgerID2 = rdr["Ledger_Name"].ToString();
                    //DiscLedgerName2 = rdr["Ledger_Name"].ToString();
                }
                else
                {
                    receipt.DiscLedgerID2 = "0";
                    //DiscLedgerName2 = "";
                }
                rdr.Close();
                //if (DropDiscount1.SelectedIndex == 0)
                //    txtDisc1.Enabled = false;
                //else
                //    txtDisc1.Enabled = true;
                //if (DropDiscount2.SelectedIndex == 0)
                //    txtDisc2.Enabled = false;
                //else
                //    txtDisc2.Enabled = true;
                //if (double.Parse(SqlDtr["Discount1"].ToString()) > 0)
                //    TempDiscAmt1 = double.Parse(SqlDtr["Discount1"].ToString());
                //else
                //    TempDiscAmt1 = 0;
                //if (double.Parse(SqlDtr["Discount2"].ToString()) > 0)
                //    TempDiscAmt2 = double.Parse(SqlDtr["Discount2"].ToString());
                //else
                //    TempDiscAmt2 = 0;
                //txtDisc1.Text = SqlDtr["Discount1"].ToString();
                //txtDisc2.Text = SqlDtr["Discount2"].ToString();
                //DropCustName.Disabled = false;
            }
            SqlDtr.Close();
            return(receipt);
        }
Esempio n. 14
0
        public void UpdatePayment(PaymentReceiptModel payment)
        {
            object         op  = null;
            InventoryClass obj = new InventoryClass();

            if (payment.PanReceiptNo == true)
            {
                int x = 0;
                dbobj1.Insert_or_Update("delete from AccountsLedgerTable where Particulars = 'Receipt (" + payment.ReceiptNo + ")'", ref x);
                dbobj1.Insert_or_Update("delete from AccountsLedgerTable where Particulars = 'Receipt_" + payment.Discount1 + " (" + payment.ReceiptNo + ")'", ref x);
                dbobj1.Insert_or_Update("delete from AccountsLedgerTable where Particulars = 'Receipt_" + payment.Discount2 + " (" + payment.ReceiptNo + ")'", ref x);
                dbobj1.Insert_or_Update("delete from CustomerLedgerTable where Particular = 'Payment Received(" + payment.ReceiptNo + ")'", ref x);
                dbobj1.Insert_or_Update("delete from Payment_Receipt where Receipt_No='" + payment.ReceiptNo + "'", ref x);

                int Curr_Credit  = 0;
                int Credit_Limit = 0;
                dbobj.ExecuteScalar("Select Cr_Limit from customer where Cust_ID = '" + payment.CustomerID + "'", ref Credit_Limit);
                dbobj.ExecuteScalar("Select Curr_Credit from customer where Cust_ID = '" + payment.CustomerID + "'", ref Curr_Credit);

                if (Curr_Credit <= Credit_Limit)
                {
                    Curr_Credit = Curr_Credit + int.Parse(payment.ReceivedAmount);

                    Curr_Credit = Curr_Credit - int.Parse(payment.TotalRec);

                    if (@Curr_Credit >= @Credit_Limit)
                    {
                        dbobj1.Insert_or_Update("update customer set Curr_Credit = '" + Credit_Limit + "' where Cust_ID  = '" + payment.CustomerID + "'", ref x);
                    }
                    else
                    {
                        dbobj1.Insert_or_Update("update customer set Curr_Credit = '" + Curr_Credit + "' where Cust_ID  = '" + payment.CustomerID + "'", ref x);
                    }
                }
                else
                {
                    Curr_Credit = Curr_Credit + int.Parse(payment.ReceivedAmount);
                    Curr_Credit = Curr_Credit - int.Parse(payment.TotalRec);
                    dbobj1.Insert_or_Update("update customer set Cr_Limit = '" + Curr_Credit + "' where Cust_ID  = '" + payment.CustomerID + "'", ref x);
                }

                obj.InsertPaymentReceived(payment);

                dbobj.ExecProc(DbOperations_LATEST.OprType.Insert, "ProCustLedgerEntry", ref op, "@Cust_Name", payment.CustomerName, "@City", payment.City, "@Amount", payment.Amount, "@Rec_Acc_Type", payment.AccountType, "@Receipt", payment.Receipt, "@Receipt_No", payment.ReceiptNo, "@ActualAmount", payment.ReceivedAmount, "@RecDate", payment.RecDate);
                if (payment.Discount1 != "" && payment.Discount1 != "0")
                {
                    dbobj.ExecProc(DbOperations_LATEST.OprType.Insert, "ProSpacialDiscountEntry", ref op, "@Cust_ID", payment.Cust_ID, "@Receipt", "Save", "@Receipt_No", payment.ReceiptNo, "@Amount", payment.Discount1, "@Ledger_ID", payment.DiscLedgerID1, "@RecDate", payment.RecDate, "@DisType", payment.Discount1);
                }
                if (payment.Discount2 != "" && payment.Discount2 != "0")
                {
                    dbobj.ExecProc(DbOperations_LATEST.OprType.Insert, "ProSpacialDiscountEntry", ref op, "@Cust_ID", payment.Cust_ID, "@Receipt", "Save", "@Receipt_No", payment.ReceiptNo, "@Amount", payment.Discount1, "@Ledger_ID", payment.DiscLedgerID2, "@RecDate", payment.RecDate, "@DisType", payment.Discount2);
                }
            }
            else
            {
                obj.InsertPaymentReceived(payment);

                dbobj.ExecProc(DbOperations_LATEST.OprType.Insert, "ProCustLedgerEntry", ref op, "@Cust_Name", payment.CustomerName, "@City", payment.City, "@Amount", payment.Amount, "@Rec_Acc_Type", payment.AccountType, "@Receipt", payment.Receipt, "@Receipt_No", payment.ReceiptNo, "@ActualAmount", payment.ReceivedAmount, "@RecDate", payment.RecDate);
                if (payment.Discount1 != "" && payment.Discount1 != "0")
                {
                    dbobj.ExecProc(DbOperations_LATEST.OprType.Insert, "ProSpacialDiscountEntry", ref op, "@Cust_ID", payment.Cust_ID, "@Receipt", "Save", "@Receipt_No", payment.ReceiptNo, "@Amount", payment.Discount1, "@Ledger_ID", payment.DiscLedgerID1, "@RecDate", payment.RecDate, "@DisType", payment.DiscountType1);
                }
                if (payment.Discount2 != "" && payment.Discount2 != "0")
                {
                    dbobj.ExecProc(DbOperations_LATEST.OprType.Insert, "ProSpacialDiscountEntry", ref op, "@Cust_ID", payment.Cust_ID, "@Receipt", "Save", "@Receipt_No", payment.ReceiptNo, "@Amount", payment.Discount1, "@Ledger_ID", payment.DiscLedgerID2, "@RecDate", payment.RecDate, "@DisType", payment.DiscountType2);
                }

                int x            = 0;
                int Curr_Credit  = 0;
                int Credit_Limit = 0;
                dbobj.ExecuteScalar("Select Cr_Limit from customer where Cust_ID = '" + payment.OldCust_ID + "'", ref Credit_Limit);
                dbobj.ExecuteScalar("Select Curr_Credit from customer where Cust_ID = '" + payment.OldCust_ID + "'", ref Curr_Credit);
                if (Curr_Credit < Credit_Limit)
                {
                    Curr_Credit = Curr_Credit + int.Parse(payment.ReceivedAmount);
                    if (@Curr_Credit >= @Credit_Limit)
                    {
                        dbobj1.Insert_or_Update("update customer set Curr_Credit = '" + Credit_Limit + "' where Cust_ID  = '" + payment.CustomerID + "'", ref x);
                    }
                    else
                    {
                        dbobj1.Insert_or_Update("update customer set Curr_Credit = '" + Curr_Credit + "' where Cust_ID  = '" + payment.CustomerID + "'", ref x);
                    }
                }
                else
                {
                    Curr_Credit = Curr_Credit + int.Parse(payment.ReceivedAmount);   //Add by vikas 12.09.09
                    Curr_Credit = Curr_Credit - int.Parse(payment.TotalRec);         //Add by vikas 12.09.09
                    dbobj1.Insert_or_Update("update customer set Cr_Limit = '" + Curr_Credit + "' where Cust_ID  = '" + payment.CustomerID + "'", ref x);
                }
            }
        }
        public async void ApplePayFailure(JudoError error, PaymentReceiptModel receipt = null)
        {
            await Navigation.PopAsync();

            await DisplayAlert("Payment error", "", "OK");
        }
        public async void ApplePaySuccess(PaymentReceiptModel receipt)
        {
            await Navigation.PopAsync();

            await DisplayAlert("Payment successful", "Receipt ID: " + receipt.ReceiptId, "OK");
        }
Esempio n. 17
0
         private void FailurePayment(JudoError error, PaymentReceiptModel receipt)
 {
        
                    
 }
        public void MakeTokenPayment()
        {
            try {
                LoadingScreen.ShowLoading(this.View);
                var instance = JudoConfiguration.Instance;
                tokenPayment.CV2 = tokenCell.CCV;

                PaymentButton.Disable();


                _paymentService.MakeTokenPreAuthorisation(tokenPayment, new ClientService()).ContinueWith(reponse => {
                    if (reponse.Exception != null)
                    {
                        LoadingScreen.HideLoading();
                        DispatchQueue.MainQueue.DispatchAfter(DispatchTime.Now, () => {
                            NavigationController.CloseView();

                            reponse.Exception.FlattenToJudoFailure(failureCallback);
                        });
                    }
                    else
                    {
                        var result = reponse.Result;
                        if (result != null && !result.HasError && result.Response.Result != "Declined")
                        {
                            PaymentReceiptModel paymentreceipt = result.Response as PaymentReceiptModel;
                            // call success callback
                            if (successCallback != null)
                            {
                                DispatchQueue.MainQueue.DispatchAfter(DispatchTime.Now, () => {
                                    NavigationController.CloseView();

                                    successCallback(paymentreceipt);
                                });
                            }
                        }
                        else
                        {
                            // Failure callback
                            if (failureCallback != null)
                            {
                                var judoError = new JudoError {
                                    ApiError = result != null ? result.Error : null
                                };
                                var paymentreceipt = result != null ? result.Response as PaymentReceiptModel : null;

                                if (paymentreceipt != null)
                                {
                                    // send receipt even we got card declined
                                    DispatchQueue.MainQueue.DispatchAfter(DispatchTime.Now, () => {
                                        NavigationController.CloseView();

                                        failureCallback(judoError, paymentreceipt);
                                    });
                                }
                                else
                                {
                                    DispatchQueue.MainQueue.DispatchAfter(DispatchTime.Now, () => {
                                        NavigationController.CloseView();

                                        failureCallback(judoError);
                                    });
                                }
                            }
                        }
                    }
                    LoadingScreen.HideLoading();
                });
            } catch (Exception ex) {
                LoadingScreen.HideLoading();
                // Failure callback
                if (failureCallback != null)
                {
                    var judoError = new JudoError {
                        Exception = ex
                    };
                    DispatchQueue.MainQueue.DispatchAfter(DispatchTime.Now, () => {
                        NavigationController.CloseView();

                        failureCallback(judoError);
                    });
                }
            }
        }