public WalletAddressInfo CreateWallet(string cryptoCode, Guid accountId, AccountTypeEnum accountType, string email = null, string cellphone = null)
        {
            var url = $"{URL}/Wallet/Create";

            _log.Info($"URL--{url}");

            var parameters = new
            {
                CryptoName  = cryptoCode,
                AccountID   = accountId,
                AccountType = accountType,
                Email       = email,
                Cellphone   = cellphone
            };
            var paramString = JsonConvert.SerializeObject(parameters);

            _log.Info($"Parameters--{paramString}");

            var dic = new Dictionary <string, string> {
                { "Authorization", "Bearer " + GenerateToken() }
            };

            var result = RestUtilities.PostJson(url, dic, paramString);

            _log.Info($"Result--{result}");

            var data = JsonConvert.DeserializeObject <ServiceResult <WalletAddressInfo> >(result);

            if (data.Code == 0)
            {
                return(data.Data);
            }
            throw new CommonException(10000, data.Message);
        }
        internal static Account FindOrAddAccount(ServiceContext context, AccountTypeEnum accountType, AccountClassificationEnum classification)
        {
            Account        typeOfAccount = null;
            List <Account> listOfAccount = FindAll <Account>(context, new Account(), 1, 500);

            if (listOfAccount.Count > 0)
            {
                foreach (Account acc in listOfAccount)
                {
                    if (acc.AccountType == accountType && acc.Classification == classification && acc.status != EntityStatusEnum.SyncError)
                    {
                        typeOfAccount = acc;
                        break;
                    }
                }
            }

            if (typeOfAccount == null)
            {
                DataService service = new DataService(context);
                Account     account;

                account = QBOHelper.CreateAccount(context, accountType, classification);
                account.Classification = classification;
                account.AccountType    = accountType;
                Account createdAccount = service.Add <Account>(account);
                typeOfAccount = createdAccount;
            }

            return(typeOfAccount);
        }
Beispiel #3
0
        public static string CreateAccountNumber(AccountTypeEnum accountType, int contractNumber)
        {
            long result = contractNumber * 10 % 1_000_000_000;

            switch (accountType)
            {
            case AccountTypeEnum.Cashier:
                result += 1010_000_000_000;
                break;

            case AccountTypeEnum.BankDevelopmentFund:
                result += 7327_000_000_000;
                break;

            case AccountTypeEnum.CurrentAccount:
                result += 3014_000_000_000;
                break;

            case AccountTypeEnum.PercentAccount:
                result += 2400_000_000_000;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(accountType), accountType, null);
            }

            result += result.GetDigitSum() % 10;
            return(result.ToString());
        }
 internal Account(AccountTypeEnum accountType, Money initialDeposit)
 {
     this.accountType = accountType;
     ledger           = new Ledger(accountType);
     this.accountType.ValidateBalance(initialDeposit);
     ledger.DepositMoney(initialDeposit);
 }
 internal Account(AccountTypeEnum accountType, Money initialDeposit)
 {
     this.accountType = accountType;
     ledger = new Ledger(accountType);
     this.accountType.ValidateBalance(initialDeposit);
     ledger.DepositMoney(initialDeposit);
 }
Beispiel #6
0
        private Account FindOrAddAccount(AccountTypeEnum accountType, AccountClassificationEnum classification)
        {
            Account        typeOfAccount = null;
            List <Account> listOfAccount = FindAll <Account>(new Account(), 1, 500);

            if (listOfAccount.Count > 0)
            {
                foreach (Account acc in listOfAccount)
                {
                    if (acc.AccountType == accountType && acc.Classification == classification && acc.status != EntityStatusEnum.SyncError)
                    {
                        typeOfAccount = acc;
                        break;
                    }
                }
            }
            if (typeOfAccount == null)
            {
                Account account;
                account = CreateAccount(accountType, classification);
                account.Classification = classification;
                account.AccountType    = accountType;
                Account createdAccount = dataService.Add <Account>(account);
                typeOfAccount = createdAccount;
            }
            return(typeOfAccount);
        }
Beispiel #7
0
 public AdditionalAmount(AccountTypeEnum accountType, AmountTypeEnum amountType, string currencyCode, double amount)
 {
     this.AccountType  = accountType;
     this.AmountType   = amountType;
     this.CurrencyCode = currencyCode;
     this.Amount       = amount;
 }
Beispiel #8
0
 public RequiredAccountTypeAttribute(AccountTypeEnum accountType = AccountTypeEnum.Admin)
 {
     _accountTypeAsStringFormat = new List <string>()
     {
         ((int)accountType).ToString()
     };
 }
Beispiel #9
0
        public override ISavingAccount CreateSavingAccount(AccountTypeEnum accountType, string accountNumber)
        {
            ISavingAccountFactory factory = new SavingAccountFactory();

            return(factory.CreateAccount(accountType: accountType
                                         , accountNumber: accountNumber));
        }
        public static void SetSessionAccountType(AccountTypeEnum type)
        {
            WeixinAccountIdentity wai = accountIdentity;

            wai.type        = type;
            accountIdentity = wai;
        }
Beispiel #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ContactAttributes" /> class.
 /// </summary>
 /// <param name="email">E-posta.</param>
 /// <param name="name">Müşteri/tedarikçi ismi (required).</param>
 /// <param name="shortName">shortName.</param>
 /// <param name="contactType">Tip.</param>
 /// <param name="taxOffice">Vergi dairesi.</param>
 /// <param name="taxNumber">Vergi numarası/TC kimlik no.</param>
 /// <param name="district">İlçe.</param>
 /// <param name="city">İl.</param>
 /// <param name="address">address.</param>
 /// <param name="phone">phone.</param>
 /// <param name="fax">fax.</param>
 /// <param name="isAbroad">isAbroad.</param>
 /// <param name="archived">archived.</param>
 /// <param name="iban">iban.</param>
 /// <param name="accountType">accountType (required).</param>
 public ContactAttributes(string email = default(string), string name = default(string), string shortName = default(string), ContactTypeEnum?contactType = default(ContactTypeEnum?), string taxOffice = default(string), string taxNumber = default(string), string district = default(string), string city = default(string), string address = default(string), string phone = default(string), string fax = default(string), bool?isAbroad = default(bool?), bool?archived = default(bool?), string iban = default(string), AccountTypeEnum accountType = default(AccountTypeEnum))
 {
     // to ensure "name" is required (not null)
     if (name == null)
     {
         throw new InvalidDataException("name is a required property for ContactAttributes and cannot be null");
     }
     else
     {
         this.Name = name;
     }
     // to ensure "accountType" is required (not null)
     if (accountType == null)
     {
         throw new InvalidDataException("accountType is a required property for ContactAttributes and cannot be null");
     }
     else
     {
         this.AccountType = accountType;
     }
     this.Email       = email;
     this.ShortName   = shortName;
     this.ContactType = contactType;
     this.TaxOffice   = taxOffice;
     this.TaxNumber   = taxNumber;
     this.District    = district;
     this.City        = city;
     this.Address     = address;
     this.Phone       = phone;
     this.Fax         = fax;
     this.IsAbroad    = isAbroad;
     this.Archived    = archived;
     this.Iban        = iban;
 }
Beispiel #12
0
 public void Update(string accountHolderName, string bankName, string bankCode, string accountNumber, AccountTypeEnum accountType)
 {
     AccountHolderName = accountHolderName;
     BankName          = bankName;
     BankCode          = bankCode;
     AccountNumber     = accountNumber;
     AccountType       = accountType;
 }
        IList <Account> FindByType(AccountTypeEnum type)
        {
            IQuery query = NHibernateHelper.OpenSession().CreateQuery("from Account where type = :type and inactive = :inactive order by type, name");

            query.SetInt32("type", (int)type);
            query.SetBoolean("inactive", false);
            return(query.List <Account>());
        }
Beispiel #14
0
        private void InitStrings(string tranType, string fromAccount, string toAccount)
        {
            this.TransactionType = EFTProperties <TransactionTypeEnum> .Enum(tranType);

            this.FromAccount = EFTProperties <AccountTypeEnum> .Enum(fromAccount);

            this.ToAccount = EFTProperties <AccountTypeEnum> .Enum(toAccount);
        }
Beispiel #15
0
        public Customer FindByExternalId(string externalId, AccountTypeEnum accountTypeEnum)
        {
            var criteria = DetachedCriteria.For(typeof(Customer))
                .Add(Restrictions.Eq("ExternalId", externalId.Trim()))
                .Add(Restrictions.Eq("AccountType", accountTypeEnum));

            return CustomerRepo.FindOne(criteria);
        }
Beispiel #16
0
 public VendorBankDetail(string accountHolderName, string bankName, string bankCode, string accountNumber, AccountTypeEnum accountType)
 {
     AccountHolderName = accountHolderName;
     BankName          = bankName;
     BankCode          = bankCode;
     AccountNumber     = accountNumber;
     AccountType       = accountType;
 }
Beispiel #17
0
        public Account OpenAccount(AccountTypeEnum accountType, decimal initialDeposit)
        {
            if (GetCurrentAge() < 18)
            {
                throw new InvalidOperationException("Must be older than 18 to open an account");
            }

            return(new Account(accountType, initialDeposit));
        }
        public Account OpenAccount(AccountTypeEnum accountType, Money initialDeposit)
        {
            if (dateOfBirth.GetCurrentAge() < 18)
            {
                throw new InvalidOperationException("Must be older than 18 to open an account");
            }

            return new Account(accountType, initialDeposit);
        }
Beispiel #19
0
        private void CreateAccountAddress(
            IOrganizationService organizationService
            , ITracingService tracingService
            , Guid accountId
            , AccountKonturFocusModel accountData
            , AccountTypeEnum accountType
            , AddressTypeEnum addressType
            )
        {
            tracingService.Trace("enter konturfocussynchronizationplugin.createaccountaddress");
            ParsedAddressRF addressObj = null;

            if (accountData.UL != null)
            {
                addressObj = accountData.UL.legalAddress?.parsedAddressRF;
            }

            if (accountData.IP != null)
            {
                addressObj = accountData.IP.legalAddress?.parsedAddressRF;
            }

            if (addressObj == null)
            {
                if (accountType == AccountTypeEnum.IP && accountData != null)
                {
                    ParsedAddressRF shortenedAddress = accountData.IP?.shortenedAddress;
                    if (shortenedAddress == null)
                    {
                        return;
                    }
                    addressObj = shortenedAddress;
                }
                else
                {
                    return;
                }
            }

            CustomerAddress customerAddress = new CustomerAddress
            {
                Line1    = GetAddressLine(addressObj, accountData, accountType, addressType, tracingService),
                ParentId = new EntityReference(Account.EntityLogicalName, accountId)
            };

            customerAddress.Id = organizationService.Create(customerAddress);

            Account account = new Account
            {
                Id = accountId
            };

            FillAddress(account, tracingService, accountData, accountType, addressType);

            organizationService.Update(account);
            tracingService.Trace("exit konturfocussynchronizationplugin.createaccountaddress");
        }
Beispiel #20
0
 public Account(string number, string bank, string branch, float amount, string ifscCode, AccountTypeEnum typeEnum)
 {
     AccountNumber = number;
     Bank          = bank;
     Branch        = branch;
     Amount        = amount;
     IfscCode      = ifscCode;
     TypeEnum      = typeEnum;
 }
Beispiel #21
0
 public Account(Session session, int credit, AccountTypeEnum type, string name, string code) : this(session)
 {
     this.Customer = null;
     Credit        = credit;
     Debit         = 0;
     Balance       = Credit - Debit;
     Name          = name;
     Type          = type;
 }
Beispiel #22
0
        public AccountType(AccountTypeEnum accountType)
            : this()
        {
            if (accountType == AccountTypeEnum.Unknown)
            {
                throw new InvalidOperationException("Please specifiy a valid account type");
            }

            this.accountType = accountType;
        }
Beispiel #23
0
 /// <summary>
 /// Internal ctor - to construct object with all properties.
 /// Initializes a new instance of the <see cref="Account" /> class.
 /// </summary>
 /// <param name="type">The account type.</param>
 /// <param name="id">The account identifier.</param>
 /// <param name="bankId">The bank identifier.</param>
 /// <param name="description">The description.</param>
 /// <param name="phone">The phone.</param>
 /// <param name="subType">Type of the sub.</param>
 /// <param name="status">The status.</param>
 internal Account(AccountTypeEnum type, string id, string bankId, string description, string phone, string subType, string status)
 {
     Status      = status;
     SubType     = subType;
     Description = description;
     BankId      = bankId;
     Id          = id;
     Type        = type;
     Phone       = phone;
 }
Beispiel #24
0
        public async Task <Account> GetAccountWithType(AccountTypeEnum accountType)
        {
            await using var context = ContextFactory.CreateDbContext();
            var entity = await context.Set <Account>()
                         .Include(x => x.AccountType)
                         .FirstOrDefaultAsync(x => x.AccountType.Name == accountType)
                         .ConfigureAwait(false);

            return(entity);
        }
Beispiel #25
0
        public IAccount CreateInstance(AccountTypeEnum accountToCreate)
        {
            Type t = GetAccountType(accountToCreate);

            if (t == null)
            {
                return(null); //TODO:  implement NULL object pattern
            }
            return(Activator.CreateInstance(t) as IAccount);
        }
Beispiel #26
0
        private Account CreateAccount(AccountTypeEnum accountType, AccountClassificationEnum classification)
        {
            //Note: Have not removed comments because it will help in understanding the parameters.
            //
            Account account = new Account();
            String  guid    = Guid.NewGuid().ToString("N");

            account.Name = "Name_" + guid;
            //account.SubAccount = true;
            //account.SubAccountSpecified = true;
            //account.ParentRef = new ReferenceType()
            //{
            //name =
            //type =
            //Value =
            //};
            //account.Description = "Description";
            account.FullyQualifiedName = account.Name;
            //account.Active = true;
            //account.ActiveSpecified = true;
            account.Classification          = classification;
            account.ClassificationSpecified = true;
            account.AccountType             = accountType;
            account.AccountTypeSpecified    = true;
            //account.AccountSubType = "AccountSubType";
            //account.AcctNum = "AcctNum";
            //account.BankNum = "BankNum";
            if (accountType != AccountTypeEnum.Expense && accountType != AccountTypeEnum.AccountsPayable && accountType != AccountTypeEnum.AccountsReceivable)
            {
                //TestComment:  Opening Balances not working for QBO Item tests
                //account.OpeningBalance = new Decimal(100.00);
                //account.OpeningBalanceSpecified = true;
                //account.OpeningBalanceDate = DateTime.UtcNow.Date;
                //account.OpeningBalanceDateSpecified = true;
            }
            //account.CurrentBalance = new Decimal(100.00);
            //account.CurrentBalanceSpecified = true;
            //account.CurrentBalanceWithSubAccounts = new Decimal(100.00);
            //account.CurrentBalanceWithSubAccountsSpecified = true;
            account.CurrencyRef = new ReferenceType()
            {
                name  = "United States Dollar",
                Value = "USD"
            };
            //account.TaxAccount = true;
            //account.TaxAccountSpecified = true;
            //account.TaxCodeRef = new ReferenceType()
            //{
            //name =
            //type =
            //Value =
            //};
            //account.AccountEx =
            return(account);
        }
Beispiel #27
0
 private Type GetAccountType(AccountTypeEnum accountToCreate)
 {
     foreach (var acct in _accounts)
     {
         if (acct.Key.Contains(accountToCreate.ToString().ToLower()))
         {
             return(_accounts[acct.Key]);
         }
     }
     return(null);
 }
 public AccountBag(DataContext dataContext, AccountTypeEnum accountType)
 {
     // AccountType = accountType;
     Account = new Entity.account
     {
         AccountID      = dataContext.UserId + DateTime.Now.Random().ToString(),
         Balance        = 0,
         LastUpdateTime = DateTime.Now,
         AccType        = accountType.ToString()
     };
 }
 public AccountBag(string accountId, AccountTypeEnum accountType)
 {
     // AccountType = accountType;
     Account = new Entity.account
     {
         AccountID      = accountId,
         Balance        = 0,
         LastUpdateTime = DateTime.Now,
         AccType        = accountType.ToString()
     };
 }
        internal Account(AccountTypeEnum accountType, decimal initialDeposit)
        {
            if (accountType == AccountTypeEnum.Unknown)
            {
                throw new InvalidOperationException("Please specifiy a valid account type");
            }

            this.accountType = accountType;
            ledger = new Ledger(accountType);
            ValidateBalance(initialDeposit);
            ledger.DepositMoney(initialDeposit);
        }
Beispiel #31
0
        internal Account(AccountTypeEnum accountType, decimal initialDeposit)
        {
            if (accountType == AccountTypeEnum.Unknown)
            {
                throw new InvalidOperationException("Please specifiy a valid account type");
            }

            this.accountType = accountType;
            ledger           = new Ledger(accountType);
            ValidateBalance(initialDeposit);
            ledger.DepositMoney(initialDeposit);
        }
Beispiel #32
0
 public AccountInfo(string userid,
                    string lastname,
                    string firstname,
                    string middlename,
                    AccountTypeEnum accounttype,
                    Image avatar)
 {
     UserId      = userid;
     Lastname    = lastname;
     Firstname   = firstname;
     Middlename  = middlename;
     AccountType = accounttype;
     Avatar      = avatar;
 }
        public static string GetString(AccountTypeEnum state)
        {
            switch (state)
            {
            case AccountTypeEnum.Admin: return(AccountRes.ACCOUNT_TYPE_ADMIN);

            case AccountTypeEnum.Payed: return(AccountRes.ACCOUNT_TYPE_PAYING);

            case AccountTypeEnum.Standard: return(AccountRes.ACCOUNT_TYPE_STANDARD);

            case AccountTypeEnum.Demo: return(AccountRes.ACCOUNT_TYPE_DEMO);
            }
            return(null);
        }
Beispiel #34
0
        internal static Account QueryOrAddAccount(DataService dataService, QueryService <Account> queryService,
                                                  string query, AccountTypeEnum accountType, AccountClassificationEnum classification,
                                                  AccountSubTypeEnum subType)
        {
            var queryResponse = queryService.ExecuteIdsQuery(query).ToList();

            if (queryResponse.Count == 0)
            {
                var account = AccountCreate(dataService, accountType, classification, subType);
                return(account);
            }

            return(queryResponse[0]);
        }
 internal Ledger(AccountTypeEnum accountType)
 {
     transactions = new HashSet<Transaction>();
     this.accountType = accountType;
 }