Пример #1
0
        public static PaymentRequestResult CreateRequestResult(
            string webServiceResponse,
            Invoice invoice,
            HttpContext httpContext,
            MellatGatewayOptions gatewayOptions,
            MessagesOptions messagesOptions,
            GatewayAccount account)
        {
            var result = XmlHelper.GetNodeValueFromXml(webServiceResponse, "return");

            var arrayResult = result.Split(',');

            var resCode = arrayResult[0];
            var refId   = arrayResult.Length > 1 ? arrayResult[1] : string.Empty;

            var isSucceed = resCode == OkResult;

            if (!isSucceed)
            {
                var message = resCode == DuplicateOrderNumberResult
                    ? messagesOptions.DuplicateTrackingNumber
                    : MellatGatewayResultTranslator.Translate(resCode, messagesOptions);

                return(PaymentRequestResult.Failed(message, account.Name));
            }

            var form = new Dictionary <string, string>
            {
                { "RefId", refId }
            };

            var mobileNumber = invoice.GetMellatMobileNumber();

            if (!string.IsNullOrEmpty(mobileNumber))
            {
                form.Add("MobileNo", mobileNumber);
            }

            return(PaymentRequestResult.SucceedWithPost(
                       account.Name,
                       httpContext,
                       gatewayOptions.PaymentPageUrl,
                       form));
        }
Пример #2
0
        public SaveResult UpdatePassword(Guid accountId, string newPassord, int userId, string userName)
        {
            GatewayAccount oldAccount = FiiiPayEnterpriseDB.AccountsDb.GetById(accountId);

            oldAccount.Password = PasswordHasher.HashPassword(newPassord);

            RedisHelper.KeyDelete(3, "FiiiEnterpriseWeb:LoginVerification:" + oldAccount.Username);

            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(AccountBLL).FullName + ".UpdatePIN";
            actionLog.Username   = userName;
            actionLog.LogContent = "Update Gateway Acount PIN " + accountId;
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);

            return(new SaveResult(FiiiPayEnterpriseDB.AccountsDb.Update(oldAccount)));
        }
 public DuplicateAccountException(GatewayAccount account)
     : base($"There is an account already with the name {account.Name}. Make sure to use different names for accounts.")
 {
 }
 private void LoadGateways()
 {
     if (this.CCPaymentGatewayNameSetting.Trim() != string.Empty)
     {
         try
         {
             this.ccGatewayAcct = new GatewayAccount(int.Parse(this.CCPaymentGatewayNameSetting.Trim()));
         }
         catch
         {
         }
     }
     if (this.ACHPaymentGatewayNameSetting.Trim() != string.Empty)
     {
         try
         {
             this.achGatewayAcct = new GatewayAccount(int.Parse(this.ACHPaymentGatewayNameSetting.Trim()));
         }
         catch
         {
         }
     }
 }
Пример #5
0
        public JsonResult InsertAccount([System.Web.Http.FromBody] Models.GatewayAccountJsonModel json, bool IsInsert)
        {
            var paymentProcesses = CurrentDatabase.PaymentProcess.ToList();
            var paymentProcess   = paymentProcesses.Single(x => x.ProcessId == json.ProcessId);

            if (IsInsert)
            {
                var gtAccount       = new GatewayAccount();
                var gtDetailAccount = new GatewayDetails();

                gtAccount.GatewayAccountName = json.GatewayAccountName;
                gtAccount.GatewayId          = json.GatewayId;
                CurrentDatabase.GatewayAccount.InsertOnSubmit(gtAccount);
                CurrentDatabase.SubmitChanges();

                for (int i = 0; i < json.GatewayAccountInputs.Count(); i++)
                {
                    gtDetailAccount.GatewayAccountId   = gtAccount.GatewayAccountId;
                    gtDetailAccount.GatewayDetailName  = json.GatewayAccountInputs[i];
                    gtDetailAccount.GatewayDetailValue = json.GatewayAccountValues[i];
                    gtDetailAccount.IsBoolean          = json.GatewayAccountValues[i] == "true" || json.GatewayAccountValues[i] == "false" ? true : false;
                    CurrentDatabase.GatewayDetails.InsertOnSubmit(gtDetailAccount);
                    gtDetailAccount = new GatewayDetails();
                }

                if (json.UseForAll)
                {
                    foreach (var process in paymentProcesses.Where(p => p.ProcessId != (int)PaymentProcessTypes.TemporaryRecurringGiving))
                    {
                        process.GatewayAccountId = gtAccount.GatewayAccountId;
                    }
                }
                else
                {
                    paymentProcess.GatewayAccountId = gtAccount.GatewayAccountId;
                }
            }
            else
            {
                for (int i = 0; i < json.GatewayAccountInputs.Count(); i++)
                {
                    var gtDetailAccount = CurrentDatabase.GatewayDetails.Single(
                        x => x.GatewayDetailName == json.GatewayAccountInputs[i] &&
                        x.GatewayAccountId == json.GatewayAccountId);

                    gtDetailAccount.GatewayDetailValue = json.GatewayAccountValues[i];
                }

                if (json.UseForAll)
                {
                    foreach (var process in paymentProcesses.Where(p => p.ProcessId != (int)PaymentProcessTypes.TemporaryRecurringGiving))
                    {
                        process.GatewayAccountId = json.GatewayAccountId;
                    }
                }
                else
                {
                    paymentProcess.GatewayAccountId = json.GatewayAccountId;
                }
            }
            CurrentDatabase.SubmitChanges();

            return(GetGatewayAccounts());
        }