コード例 #1
0
 public int Add(string EncryptedString, out string TrasactionID)
 {
     TrasactionID = string.Empty;
     try
     {
         PaymentGatewayTransactionsCoreEntity objPaymentGatewayTransactionsCoreEntity = new PaymentGatewayTransactionsCoreEntity();
         using (objPaymentGatewayTransactionsCoreEntity as IDisposable)
         {
             getPaymentGatewayTransactionsCoreEntity(EncryptedString, ref objPaymentGatewayTransactionsCoreEntity);
             PaymentGatewayTransactionsModel objPaymentGatewayTransactionsModel = new PaymentGatewayTransactionsModel();
             using (objPaymentGatewayTransactionsModel as IDisposable)
             {
                 AssignModelFromEntity(ref objPaymentGatewayTransactionsCoreEntity, ref objPaymentGatewayTransactionsModel);
                 IUnitOfWork objIUnitOfWorkAdd = new UnitOfWork(_objLoggedInUser.ConnectionStringAppKey);
                 using (objIUnitOfWorkAdd as IDisposable)
                 {
                     objIUnitOfWorkAdd.RepositoryPaymentGatewayTransactions.Add(objPaymentGatewayTransactionsModel);
                     objIUnitOfWorkAdd.commit();
                     TrasactionID = objPaymentGatewayTransactionsCoreEntity.TransactionID;
                 }
                 objIUnitOfWorkAdd = null;
             }
             objPaymentGatewayTransactionsModel = null;
         }
         PaymentProfileTransactionsCore objPaymentProfileTransactionsCore = new PaymentProfileTransactionsCore(_objLoggedInUser);
         using (objPaymentProfileTransactionsCore as IDisposable)
         {
             objPaymentProfileTransactionsCore.Add(ref objPaymentGatewayTransactionsCoreEntity);
         }
         objPaymentProfileTransactionsCore       = null;
         objPaymentGatewayTransactionsCoreEntity = null;
     }
     catch (Exception objEx)
     {
         Helpers.LogExceptionInFlatFile(objEx);
     }
     return(0);
 }
コード例 #2
0
        private int getPaymentGatewayTransactionsCoreEntity(string EncryptedString, ref PaymentGatewayTransactionsCoreEntity objPaymentGatewayTransactionsCoreEntity)
        {
            NameValueCollection Params = new NameValueCollection();

            try
            {
                string    DecryptedValue = string.Empty;
                string    workingKey     = Constants.ccAvenueworkingKeyTest; //put in the 32bit alpha numeric key in the quotes provided here
                CCACrypto objccaCrypto   = new CCACrypto();
                using (objccaCrypto as IDisposable)
                {
                    DecryptedValue = objccaCrypto.Decrypt(EncryptedString, workingKey);
                }
                objccaCrypto = null;
                string[] segments = DecryptedValue.Split('&');
                foreach (string seg in segments)
                {
                    string[] parts = seg.Split('=');
                    if (parts.Length > 0)
                    {
                        string Key   = parts[0].Trim();
                        string Value = parts[1].Trim();
                        Params.Add(Key, Value);
                    }
                }
                objPaymentGatewayTransactionsCoreEntity.TransactionID = Helpers.primaryKey;
                objPaymentGatewayTransactionsCoreEntity.CreatedDate   = DateTime.Now;
                objPaymentGatewayTransactionsCoreEntity.CreatedBy     = _objLoggedInUser.LoginID;
                objPaymentGatewayTransactionsCoreEntity.TranDate      = DateTime.Now;
                objPaymentGatewayTransactionsCoreEntity.EncryptedText = EncryptedString;
                objPaymentGatewayTransactionsCoreEntity.DecryptedText = DecryptedValue;
                for (int i = 0; i < Params.Count; i++)
                {
                    //Helpers.LogMessageInFlatFile(Params.Keys[i] + " = " + Params[i] + "<br>");
                    switch (Params.Keys[i])
                    {
                    case "order_id":
                        objPaymentGatewayTransactionsCoreEntity.OrderID = Params[i];
                        break;

                    case "tracking_id":
                        objPaymentGatewayTransactionsCoreEntity.TrackingID = Params[i];
                        break;

                    case "bank_ref_no":
                        objPaymentGatewayTransactionsCoreEntity.BankRefNo = Params[i];
                        break;

                    case "order_status":
                        objPaymentGatewayTransactionsCoreEntity.OrderStatus = Params[i];
                        break;

                    case "failure_message":
                        objPaymentGatewayTransactionsCoreEntity.FailureMessage = Params[i];
                        break;

                    case "payment_mode":
                        objPaymentGatewayTransactionsCoreEntity.PaymentMode = Params[i];
                        break;

                    case "card_name":
                        objPaymentGatewayTransactionsCoreEntity.CardName = Params[i];
                        break;

                    case "status_code":
                        objPaymentGatewayTransactionsCoreEntity.StatusCode = Params[i];
                        break;

                    case "status_message":
                        objPaymentGatewayTransactionsCoreEntity.StatusMessage = Params[i];
                        break;

                    case "currency":
                        objPaymentGatewayTransactionsCoreEntity.Currency = Params[i];
                        break;

                    case "amount":
                    {
                        decimal amount = 0;
                        if (!string.IsNullOrEmpty(Params[i]))
                        {
                            amount = Convert.ToDecimal(Params[i]);
                        }
                        objPaymentGatewayTransactionsCoreEntity.Amount = amount;
                    }
                    break;

                    case "billing_name":
                        objPaymentGatewayTransactionsCoreEntity.BillingName = Params[i];
                        break;

                    case "billing_address":
                        objPaymentGatewayTransactionsCoreEntity.BillingAddress = Params[i];
                        break;

                    case "billing_city":
                        objPaymentGatewayTransactionsCoreEntity.BillingCity = Params[i];
                        break;

                    case "billing_state":
                        objPaymentGatewayTransactionsCoreEntity.BillingState = Params[i];
                        break;

                    case "billing_zip":
                        objPaymentGatewayTransactionsCoreEntity.BillingZip = Params[i];
                        break;

                    case "billing_country":
                        objPaymentGatewayTransactionsCoreEntity.BillingCountry = Params[i];
                        break;

                    case "billing_tel":
                        objPaymentGatewayTransactionsCoreEntity.BillingTel = Params[i];
                        break;

                    case "billing_email":
                        objPaymentGatewayTransactionsCoreEntity.BillingEmail = Params[i];
                        break;

                    case "delivery_name":
                        objPaymentGatewayTransactionsCoreEntity.DeliveryName = Params[i];
                        break;

                    case "delivery_address":
                        objPaymentGatewayTransactionsCoreEntity.DeliveryAddress = Params[i];
                        break;

                    case "delivery_city":
                        objPaymentGatewayTransactionsCoreEntity.DeliveryCity = Params[i];
                        break;

                    case "delivery_state":
                        objPaymentGatewayTransactionsCoreEntity.DeliveryState = Params[i];
                        break;

                    case "delivery_zip":
                        objPaymentGatewayTransactionsCoreEntity.DeliveryZip = Params[i];
                        break;

                    case "delivery_country":
                        objPaymentGatewayTransactionsCoreEntity.DeliveryCountry = Params[i];
                        break;

                    case "delivery_tel":
                        objPaymentGatewayTransactionsCoreEntity.DeliveryTel = Params[i];
                        break;

                    case "mer_amount":
                    {
                        decimal merAmount = 0;
                        if (!string.IsNullOrEmpty(Params[i]))
                        {
                            merAmount = Convert.ToDecimal(Params[i]);
                        }
                        objPaymentGatewayTransactionsCoreEntity.MerAmount = merAmount;
                    }
                    break;

                    case "merchant_param1":
                        objPaymentGatewayTransactionsCoreEntity.MerchantParam1 = Params[i];
                        break;

                    case "merchant_param2":
                        objPaymentGatewayTransactionsCoreEntity.MerchantParam2 = Params[i];
                        break;

                    case "merchant_param3":
                        objPaymentGatewayTransactionsCoreEntity.MerchantParam3 = Params[i];
                        break;

                    case "merchant_param4":
                        objPaymentGatewayTransactionsCoreEntity.MerchantParam4 = Params[i];
                        break;

                    case "merchant_param5":
                        objPaymentGatewayTransactionsCoreEntity.MerchantParam5 = Params[i];
                        break;

                    case "vault":
                        objPaymentGatewayTransactionsCoreEntity.Vault = Params[i];
                        break;

                    case "OfferType":
                        objPaymentGatewayTransactionsCoreEntity.OfferType = Params[i];
                        break;

                    case "OfferCode":
                        objPaymentGatewayTransactionsCoreEntity.OfferCode = Params[i];
                        break;

                    case "discount_value":
                        objPaymentGatewayTransactionsCoreEntity.DiscountValue = Params[i];
                        break;

                    case "ECIValue":
                        objPaymentGatewayTransactionsCoreEntity.ECIValue = Params[i];
                        break;

                    case "retry":
                        objPaymentGatewayTransactionsCoreEntity.Retry = Params[i];
                        break;

                    case "response_code":
                        objPaymentGatewayTransactionsCoreEntity.ResponseCode = Params[i];
                        break;

                    case "billing_notes":
                        objPaymentGatewayTransactionsCoreEntity.BillingNotes = Params[i];
                        break;

                    /* case "trans_date":
                     *   {
                     *       DateTime dtTarnsdate;
                     *       if (!string.IsNullOrEmpty(Params[i]))
                     *       {
                     *           dtTarnsdate = Convert.ToDateTime(Params[i]);
                     *           objPaymentGatewayTransactionsCoreEntity.TranDate = dtTarnsdate;
                     *       }
                     *       //objPaymentGatewayTransactionsCoreEntity.TranDate = Params[i];
                     *   }
                     *   break;*/
                    case "bin_country":
                        objPaymentGatewayTransactionsCoreEntity.BillingCountry = Params[i];
                        break;
                    }
                }
            }
            catch (Exception objEx)
            {
                Helpers.LogExceptionInFlatFile(objEx);
            }
            finally
            {
                if (Params != null)
                {
                    Params = null;
                }
                // ((IDisposable)Params).Dispose();
            }
            return(0);
        }
コード例 #3
0
 private int AssignModelFromEntity(
     ref PaymentGatewayTransactionsCoreEntity objPaymentGatewayTransactionsEntity,
     ref PaymentGatewayTransactionsModel objPaymentGatewayTransactionsModel
     )
 {
     try
     {
         objPaymentGatewayTransactionsModel.Amount          = objPaymentGatewayTransactionsEntity.Amount;
         objPaymentGatewayTransactionsModel.BankRefNo       = objPaymentGatewayTransactionsEntity.BankRefNo;
         objPaymentGatewayTransactionsModel.BillingAddress  = objPaymentGatewayTransactionsEntity.BillingAddress;
         objPaymentGatewayTransactionsModel.BillingCity     = objPaymentGatewayTransactionsEntity.BillingCity;
         objPaymentGatewayTransactionsModel.BillingCountry  = objPaymentGatewayTransactionsEntity.BillingCountry;
         objPaymentGatewayTransactionsModel.BillingEmail    = objPaymentGatewayTransactionsEntity.BillingEmail;
         objPaymentGatewayTransactionsModel.BillingName     = objPaymentGatewayTransactionsEntity.BillingName;
         objPaymentGatewayTransactionsModel.BillingNotes    = objPaymentGatewayTransactionsEntity.BillingNotes;
         objPaymentGatewayTransactionsModel.BillingState    = objPaymentGatewayTransactionsEntity.BillingState;
         objPaymentGatewayTransactionsModel.BillingTel      = objPaymentGatewayTransactionsEntity.BillingTel;
         objPaymentGatewayTransactionsModel.BillingZip      = objPaymentGatewayTransactionsEntity.BillingZip;
         objPaymentGatewayTransactionsModel.BinCountry      = objPaymentGatewayTransactionsEntity.BinCountry;
         objPaymentGatewayTransactionsModel.CardName        = objPaymentGatewayTransactionsEntity.CardName;
         objPaymentGatewayTransactionsModel.CreatedBy       = objPaymentGatewayTransactionsEntity.CreatedBy;
         objPaymentGatewayTransactionsModel.CreatedDate     = objPaymentGatewayTransactionsEntity.CreatedDate;
         objPaymentGatewayTransactionsModel.Currency        = objPaymentGatewayTransactionsEntity.Currency;
         objPaymentGatewayTransactionsModel.DeliveryAddress = objPaymentGatewayTransactionsEntity.DeliveryAddress;
         objPaymentGatewayTransactionsModel.DeliveryCity    = objPaymentGatewayTransactionsEntity.DeliveryCity;
         objPaymentGatewayTransactionsModel.DeliveryCountry = objPaymentGatewayTransactionsEntity.DeliveryCountry;
         objPaymentGatewayTransactionsModel.DeliveryName    = objPaymentGatewayTransactionsEntity.DeliveryName;
         objPaymentGatewayTransactionsModel.DeliveryState   = objPaymentGatewayTransactionsEntity.DeliveryState;
         objPaymentGatewayTransactionsModel.DeliveryTel     = objPaymentGatewayTransactionsEntity.DeliveryTel;
         objPaymentGatewayTransactionsModel.DeliveryZip     = objPaymentGatewayTransactionsEntity.DeliveryZip;
         objPaymentGatewayTransactionsModel.DiscountValue   = objPaymentGatewayTransactionsEntity.DiscountValue;
         objPaymentGatewayTransactionsModel.ECIValue        = objPaymentGatewayTransactionsEntity.ECIValue;
         objPaymentGatewayTransactionsModel.EncryptedText   = objPaymentGatewayTransactionsEntity.EncryptedText;
         objPaymentGatewayTransactionsModel.DecryptedText   = objPaymentGatewayTransactionsEntity.DecryptedText;
         objPaymentGatewayTransactionsModel.FailureMessage  = objPaymentGatewayTransactionsEntity.FailureMessage;
         objPaymentGatewayTransactionsModel.TransactionID   = objPaymentGatewayTransactionsEntity.TransactionID;
         objPaymentGatewayTransactionsModel.MerAmount       = objPaymentGatewayTransactionsEntity.MerAmount;
         objPaymentGatewayTransactionsModel.MerchantParam1  = objPaymentGatewayTransactionsEntity.MerchantParam1;
         objPaymentGatewayTransactionsModel.MerchantParam2  = objPaymentGatewayTransactionsEntity.MerchantParam2;
         objPaymentGatewayTransactionsModel.MerchantParam3  = objPaymentGatewayTransactionsEntity.MerchantParam3;
         objPaymentGatewayTransactionsModel.MerchantParam4  = objPaymentGatewayTransactionsEntity.MerchantParam4;
         objPaymentGatewayTransactionsModel.MerchantParam5  = objPaymentGatewayTransactionsEntity.MerchantParam5;
         objPaymentGatewayTransactionsModel.OfferCode       = objPaymentGatewayTransactionsEntity.OfferCode;
         objPaymentGatewayTransactionsModel.OfferType       = objPaymentGatewayTransactionsEntity.OfferType;
         objPaymentGatewayTransactionsModel.OrderID         = objPaymentGatewayTransactionsEntity.OrderID;
         objPaymentGatewayTransactionsModel.OrderStatus     = objPaymentGatewayTransactionsEntity.OrderStatus;
         objPaymentGatewayTransactionsModel.PaymentMode     = objPaymentGatewayTransactionsEntity.PaymentMode;
         objPaymentGatewayTransactionsModel.ResponseCode    = objPaymentGatewayTransactionsEntity.ResponseCode;
         objPaymentGatewayTransactionsModel.Retry           = objPaymentGatewayTransactionsEntity.Retry;
         objPaymentGatewayTransactionsModel.StatusCode      = objPaymentGatewayTransactionsEntity.StatusCode;
         objPaymentGatewayTransactionsModel.StatusMessage   = objPaymentGatewayTransactionsEntity.StatusMessage;
         objPaymentGatewayTransactionsModel.TrackingID      = objPaymentGatewayTransactionsEntity.TrackingID;
         objPaymentGatewayTransactionsModel.TranDate        = objPaymentGatewayTransactionsEntity.TranDate;
         objPaymentGatewayTransactionsModel.TransactionID   = objPaymentGatewayTransactionsEntity.TransactionID;
         objPaymentGatewayTransactionsModel.Vault           = objPaymentGatewayTransactionsEntity.Vault;
     }
     catch (Exception objEx)
     {
         Helpers.LogExceptionInFlatFile(objEx);
     }
     return(0);
 }