Esempio n. 1
0
        /*
         * protected bool Validate(SignedTransaction signed, MultiSignature declaration)
         * {
         *  MultiSignatureAddress multi;
         *  if (MultiSignatureManager.TryGetAddress(declaration.Address, out multi))
         *      return false;
         *  return true;
         * }
         */

        // validates the inputs are spending money that exists
        public bool ValidateBalance(ILedgerState state, IEnumerable <TxInput> inputs)
        {
            // we cannot have duplicate (account + currency). In fact we can since we use fees in input
            var amounts = new Dictionary <AddressCurrency, Amount>();

            foreach (var input in inputs)
            {
                var currency = input.Currency;
                var address  = input.Address;

                // no need to check we have enough balance if we are issuer
                if (LiveService.IssuerManager.IsIssuer(currency, address))
                {
                    continue;
                }

                if (!state.TryGetAccount(address, out var account))
                {
                    return(false);
                }

                // TODO looks not good
                var key    = new AddressCurrency(address, currency);
                var amount = amounts[key] = amounts.GetOrCreate(key, () => 0) + input.Amount;
                if (account.GetBalance(currency) < amount)
                {
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 2
0
        }         // GetAmlDataCustom

        private bool GetAml(
            AddressCurrency nCurrency,
            out string result,
            out decimal authentication,
            out string description
            )
        {
            AuthenticationResults authenticationResults = this.idHubService.Authenticate(
                this.firstName,
                null,
                this.lastName,
                this.gender,
                this.dateOfBirth,
                this.customerAddress[1, nCurrency],
                this.customerAddress[2, nCurrency],
                this.customerAddress[3, nCurrency],
                this.customerAddress[4, nCurrency],
                null,
                this.customerAddress[6, nCurrency],
                this.customerId
                );

            return(CreateAmlResultFromAuthenticationReuslts(
                       authenticationResults,
                       out result,
                       out authentication,
                       out description
                       ));
        }         // GetAml
Esempio n. 3
0
        }         // CanUsePrevAddress

        private bool GetConsumerInfoAndSave(AddressCurrency oAddressCurrency)
        {
            InputLocationDetailsMultiLineLocation location = this.addressLines.GetLocation(oAddressCurrency);

            var ukAddress = new Models.CustomerAddressModel {
                Line1    = location.LocationLine1,
                Line2    = location.LocationLine2,
                Line3    = location.LocationLine3,
                PostCode = location.LocationLine6,
                City     = location.LocationLine4
            };

            ukAddress.FillDetails();

            InputLocationDetailsUKLocation ukLokation = new InputLocationDetailsUKLocation {
                Postcode    = ukAddress.PostCode,
                HouseName   = ukAddress.HouseName,
                HouseNumber = ukAddress.HouseNumber,
                Flat        = ukAddress.FlatOrApartmentNumber,
                PostTown    = ukAddress.City,
                Street      = ukAddress.Address1,
                Street2     = ukAddress.Address2,
                POBox       = ukAddress.POBox
            };
            var consumerService = new ConsumerService();

            Result = consumerService.GetConsumerInfo(
                this.personalData.FirstName,
                this.personalData.Surname,
                this.personalData.Gender,
                this.personalData.DateOfBirth,
                ukLokation,
                location,
                "PL", this.customerId, this.directorId,
                false, this.directorId != null, this.forceCheck
                );

            if (Result != null && !Result.HasExperianError)
            {
                Score = Result.BureauScore.HasValue ? Result.BureauScore.Value : 0;
            }

            return(Result == null || !Result.HasExperianError);
        }         // GetConsumerInfoAndSave
Esempio n. 4
0
            }                                                                                                  // Line6Prev

            public string this[int nIdx, AddressCurrency oCurrency] {
                get {
                    if ((nIdx < 1) || (nIdx > 6))
                    {
                        throw new ArgumentOutOfRangeException("nIdx", "Unsupported value: " + nIdx.ToString());
                    }

                    switch (oCurrency)
                    {
                    case AddressCurrency.Current:
                        return(m_aryCurrent[nIdx]);

                    case AddressCurrency.Previous:
                        return(m_aryPrev[nIdx]);

                    default:
                        throw new ArgumentOutOfRangeException("oCurrency", "Unsupported value: " + oCurrency.ToString());
                    }     // switch
                }         // get
            }             // indexer
Esempio n. 5
0
        public static InputLocationDetailsMultiLineLocation GetLocation(
            this GetCustomerAddresses.ResultRow oAddr,
            AddressCurrency oCurrency
            )
        {
            if (oAddr == null)
            {
                throw new ArgumentNullException("oAddr", "Address row not specified.");
            }

            switch (oCurrency)
            {
            case AddressCurrency.Current:
                return(new InputLocationDetailsMultiLineLocation {
                    LocationLine1 = oAddr.Line1,
                    LocationLine2 = oAddr.Line2,
                    LocationLine3 = oAddr.Line3,
                    LocationLine4 = oAddr.Line4,
                    LocationLine5 = oAddr.Line5,
                    LocationLine6 = oAddr.Line6,
                });

            case AddressCurrency.Previous:
                return(new InputLocationDetailsMultiLineLocation {
                    LocationLine1 = oAddr.Line1Prev,
                    LocationLine2 = oAddr.Line2Prev,
                    LocationLine3 = oAddr.Line3Prev,
                    LocationLine4 = oAddr.Line4Prev,
                    LocationLine5 = oAddr.Line5Prev,
                    LocationLine6 = oAddr.Line6Prev,
                });

            default:
                throw new ArgumentOutOfRangeException("oCurrency", "Unsupported value: " + oCurrency);
            } // switch
        }     // GetLocation
 protected bool Equals(AddressCurrency other)
 {
     return(Equals(Address, other.Address) && Equals(Currency, other.Currency));
 }