Exemple #1
0
        public async Task <string> AddEditPlanDetails(PlanViewModel model, string clientIpAddress)
        {
            try
            {
                var progIssuerId = (await _program.FindAsync(new { id = model.programId }))?.JPOS_IssuerId;
                var accounts     = await _programAccounts.GetAccountsDetailsByIds(model.PlanProgramAccount.Select(x => x.programAccountId).ToList());

                var pId = await AddEditPlan(model);

                if (pId > 0)
                {
                    if (model.id == 0)
                    {
                        var id        = model.Jpos_PlanId;
                        var planId    = "P1000-" + pId.ToString();
                        var oPlanJPOS = new PlanJposDto()
                        {
                            clientId    = model.clientId,
                            active      = true,
                            description = model.description,
                            endDate     = model.endDate.Value,
                            issuer      = progIssuerId,
                            startDate   = model.startDate.Value,
                            name        = model.name,
                            accounts    = accounts.Count > 0 ? String.Join(", ", accounts.Select(x => x.accountName).ToList()) : ""
                        };
                        int result = await _sharedJPOSService.PostRespectiveDataJPOS(JPOSAPIURLConstants.Plans, oPlanJPOS, id, clientIpAddress, JPOSAPIConstants.Plans);

                        var chkExist = await FindAsync(new { id = pId });

                        chkExist.planId      = planId;
                        chkExist.Jpos_PlanId = Convert.ToString(result);
                        await UpdateAsync(chkExist, new { id = pId });
                    }
                    var planprogramAccount = _mapper.Map <List <PlanProgramAccountsLinking> >(model.PlanProgramAccount);
                    planprogramAccount.ToList().ForEach(x => x.planId = pId);
                    await _planProgramAccount.AddUpdatePlanProgramAccount(planprogramAccount);

                    return(Cryptography.EncryptPlainToCipher(pId.ToString()));
                }
                return("0");
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Exemple #2
0
        public async Task <int> AddUpdateAccountHolderDetail(User model, List <UserPlans> programPackageIds, string userImagePath, string clientIpAddress, string issuerId)
        {
            try
            {
                var id       = model.Jpos_AccountHolderId;
                var oACHJPOS = new AccountHolderJposDto()
                {
                    active    = true,
                    birthDate = model.dateOfBirth.HasValue ? model.dateOfBirth : null,
                    email     = model.Email,
                    firstName = model.FirstName,
                    lastName  = model.LastName,
                    address1  = model.Address,
                    phone     = model.PhoneNumber,
                    realId    = model.UserCode,
                    gender    = model.genderId == 1 ? "M" : "F",
                    issuer    = issuerId
                };
                int result = await _sharedJPOSService.PostRespectiveDataJPOS(JPOSAPIURLConstants.AccountHolder, oACHJPOS, id, clientIpAddress, JPOSAPIConstants.AccountHolder);

                if (result > 0 && model.Id <= 0)
                {
                    model.Jpos_AccountHolderId = result.ToString();
                }
                var userId = await AddUpdateUser(model);

                if (userId > 0)
                {
                    await _photos.SaveUpdateImage(userImagePath, userId, userId, (int)PhotoEntityType.UserProfile);

                    if (programPackageIds.Count > 0)
                    {
                        programPackageIds.ToList().ForEach(x => x.userId = userId);
                        await _userPlanService.AddUpdateUserPlans(programPackageIds);
                    }
                    return(userId);
                }
                return(0);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public async Task <string> AddEditProgramAccoutDetails(ProgramAccountViewModel model, string clientIpAddress)
        {
            try
            {
                var Id = await AddEditProgramAccount(model);

                if (Id > 0)
                {
                    if (model.id == 0)
                    {
                        var id           = model.Jpos_ProgramAccountId;
                        var progIssuerId = (await _program.FindAsync(new { id = model.programId }))?.JPOS_IssuerId;
                        var paid         = "PA1000-" + Id.ToString();
                        var oPlanJPOS    = new AccountsJposDto()
                        {
                            dailyLimit     = Convert.ToDouble(model.flexMaxSpendPerDay.Value),
                            weeklyLimit    = Convert.ToDouble(model.flexMaxSpendPerWeek.Value),
                            initialBalance = Convert.ToDouble(model.intialBalanceCount),
                            monthlyLimit   = Convert.ToDouble(model.flexMaxSpendPerMonth),
                            issuer         = progIssuerId,
                            active         = true,
                            name           = model.accountName,
                            layer          = "001",
                            roleOver       = model.isRollOver.HasValue && model.isRollOver.Value ? "Y" : "N"

                                             // accounts = accounts.Count > 0 ? String.Join(", ", accounts.Select(x => x.accountName).ToList()) : ""
                        };
                        int result = await _sharedJPOSService.PostRespectiveDataJPOS(JPOSAPIURLConstants.Accounts, oPlanJPOS, id, clientIpAddress, JPOSAPIConstants.Accounts);

                        var chkExist = await FindAsync(new { id = Id });

                        chkExist.ProgramAccountId = paid;
                        await UpdateAsync(chkExist, new { id = Id });
                    }
                    return(Cryptography.EncryptPlainToCipher(Id.ToString()));
                }
                return("0");
            }
            catch (Exception)
            {
                throw;
            }
        }
        public async Task <int> AddEditMerchantTerminal(List <OrganisationMerchantTerminalModel> model, string clientIpAddress)
        {
            int isSucces = 0;

            try
            {
                var orgid = model.FirstOrDefault().organisationId;
                var org   = await _organisation.FindAsync(new { id = orgid });

                var orgPrg = await _organisationProgram.FindAsync(new { organisationId = orgid });

                var prd = await _program.FindAsync(new { id = orgPrg?.programId });

                var result = await GetMultipleDataByConditionAsync(new { organisationId = orgid });

                var DeletionChk     = result.ToList().Where(x => !model.Select(m => m.id).ToList().Contains(x.id));
                var JposTerminalURL = JPOSAPIURLConstants.Terminals.Replace("{issuer}", prd?.JPOS_IssuerId).Replace("{merchant}", org?.JPOS_MerchantId);
                if (DeletionChk.ToList().Count > 0)
                {
                    foreach (var itemDelete in DeletionChk)
                    {
                        var             jposId        = itemDelete.Jpos_TerminalId;
                        TerminalJposDto oTerminalJpos = new TerminalJposDto()
                        {
                            active = false
                        };
                        await _sharedJPOSService.DeleteRespectiveDataJPOS(JposTerminalURL, oTerminalJpos, jposId, clientIpAddress, JPOSAPIConstants.Terminals);
                        await DeleteEntityAsync(new { itemDelete.id });
                    }
                }
                foreach (var item in model)
                {
                    var merchantExistCheck = await FindAsync(new { item.id });

                    var terminalTypeVal = (await _organisation.GetTerminalTypeList()).FirstOrDefault(x => x.Id == item.terminalType.Value).TerminalType;
                    if (merchantExistCheck != null)
                    {
                        merchantExistCheck.id = item.id;
                        merchantExistCheck.Jpos_TerminalId = item.Jpos_TerminalId;
                        merchantExistCheck.organisationId  = item.organisationId;
                        merchantExistCheck.terminalId      = item.terminalId;
                        merchantExistCheck.terminalName    = item.terminalName;
                        merchantExistCheck.terminalType    = item.terminalType;
                        await UpdateAsync(merchantExistCheck, new { item.id });

                        var             jposId        = item.Jpos_TerminalId;
                        TerminalJposDto oTerminalJpos = new TerminalJposDto()
                        {
                            active      = true,
                            info        = item.terminalName,
                            softVersion = terminalTypeVal,
                            terminalId  = item.terminalId
                        };
                        await _sharedJPOSService.PostRespectiveDataJPOS(JposTerminalURL, oTerminalJpos, jposId, clientIpAddress, JPOSAPIConstants.Terminals);
                    }
                    else
                    {
                        TerminalJposDto oTerminalJpos = new TerminalJposDto()
                        {
                            active      = true,
                            info        = item.terminalName,
                            softVersion = terminalTypeVal,
                            terminalId  = item.terminalId
                        };
                        int resultAdd = await _sharedJPOSService.PostRespectiveDataJPOS(JposTerminalURL, oTerminalJpos, null, clientIpAddress, JPOSAPIConstants.Terminals);

                        var obj = new MerchantTerminal();
                        obj.id              = item.id;
                        obj.organisationId  = item.organisationId;
                        obj.terminalId      = item.terminalId;
                        obj.terminalName    = item.terminalName;
                        obj.terminalType    = item.terminalType;
                        obj.Jpos_TerminalId = resultAdd.ToString();
                        await AddAsync(obj);
                    }
                }
                return(isSucces);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #5
0
        public async Task <string> AddEditProgramInfo(ProgramInfoDto model, string clientIpAddress)
        {
            try
            {
                string prgTp   = string.Empty;
                var    id      = model.JPOS_IssuerId;
                var    prgType = (await _programTypeService.GetProgramTypesDetailByIds(new List <int> {
                    model.ProgramTypeId.Value
                })).ToList();
                if (prgType.Count > 0)
                {
                    prgTp = prgType.Select(x => x.ProgramTypeName).FirstOrDefault();
                }
                var oIssuerJPOS = new IssuerJPOSDto()
                {
                    active         = true,
                    programId      = model.ProgramCodeId,
                    name           = model.name,
                    tz             = model.timeZone,
                    organizationId = model.OrganisationJPOSId,
                    address1       = model.address,
                    city           = model.city,
                    country        = model.country,
                    programType    = prgTp,
                    state          = model.state,
                    website        = model.website,
                    zip            = model.zipcode
                };
                int result = await _sharedJPOSService.PostRespectiveDataJPOS(JPOSAPIURLConstants.Issuers, oIssuerJPOS, id, clientIpAddress, JPOSAPIConstants.Issuers);

                if (result > 0 && model.id <= 0)
                {
                    model.JPOS_IssuerId = result.ToString();
                }
                var chkExist = await FindAsync(new { model.id });

                if (chkExist == null)
                {
                    chkExist = new Program();
                }
                if (model.name != null)
                {
                    chkExist.name = model.name;
                }
                chkExist.organisationId        = model.organisationId;
                chkExist.AccountHolderGroups   = model.AccountHolderGroups;
                chkExist.AccountHolderUniqueId = model.AccountHolderUniqueId;
                chkExist.address   = model.address;
                chkExist.city      = model.city;
                chkExist.colorCode = model.colorCode;
                chkExist.country   = model.country;
                if (model.createdBy != null)
                {
                    chkExist.createdBy = model.createdBy;
                }
                if (model.createdDate != null)
                {
                    chkExist.createdDate = model.createdDate;
                }
                chkExist.customErrorMessaging = model.customErrorMessaging;
                chkExist.customInputMask      = model.customInputMask;
                chkExist.customInstructions   = model.customInstructions;
                chkExist.customName           = model.customName;
                chkExist.description          = model.description;
                if (model.isActive != null)
                {
                    chkExist.isActive = model.isActive;
                }
                if (model.isDeleted != null)
                {
                    chkExist.isDeleted = model.isDeleted;
                }
                if (model.modifiedBy != null)
                {
                    chkExist.modifiedBy = model.modifiedBy;
                }
                if (model.modifiedDate != null)
                {
                    chkExist.modifiedDate = model.modifiedDate;
                }
                if (model.ProgramCodeId != null)
                {
                    chkExist.ProgramCodeId = model.ProgramCodeId;
                }
                chkExist.programCustomFields = model.programCustomFields;
                chkExist.ProgramTypeId       = model.ProgramTypeId;
                chkExist.state    = model.state;
                chkExist.timeZone = model.timeZone;
                chkExist.website  = model.website;
                chkExist.zipcode  = model.zipcode;
                chkExist.id       = model.id;
                chkExist.IsAllNotificationShow = model.IsAllNotificationShow;
                chkExist.IsRewardsShowInApp    = model.IsRewardsShowInApp;
                chkExist.JPOS_IssuerId         = model.JPOS_IssuerId;
                var resultPrg = await InsertOrUpdateAsync(chkExist, new { model.id });

                await _orgProgram.AddSpecificOrganisationProgram(resultPrg, model.organisationId);

                return(Cryptography.EncryptPlainToCipher(Convert.ToString(resultPrg)));
            }
            catch (Exception)
            {
                throw;
            }
        }