Ejemplo n.º 1
0
        public static UserProfileReply AccountDetailsToUserProfileReply(AccountDetailsResponse accountResponse)
        {
            UserProfileReply reply = new UserProfileReply(true);

            reply.id   = accountResponse.UserId;
            reply.fbid = accountResponse.ExternalIds.GetString("FB").ToString();
            reply.name = accountResponse.DisplayName;

            GSData profile = accountResponse.ScriptData.GetObject("profile");
            GSData stats   = accountResponse.ScriptData.GetObject("stats");
            GSData bidding = accountResponse.ScriptData.GetObject("bidding");

            reply.countryCode = profile.GetString("country");
            reply.mood        = profile.GetInt("mood").Value;
            reply.price       = stats.GetInt("price").Value;

            reply.status = profile.GetString("status");
            reply.pics   = profile.GetStringList("pics");
            reply.videos = profile.GetStringList("videos");

            reply.exp    = stats.GetInt("exp").Value;
            reply.energy = stats.GetInt("energy").Value;
            reply.money  = stats.GetInt("money").Value;
            reply.tokens = stats.GetInt("tokens").Value;

            reply.newMessages = reply.newGifts = 0;

            reply.bidderId      = bidding.GetString("bidderId");
            reply.bidderFbid    = bidding.GetString("bidderFbid");
            reply.bidderName    = bidding.GetString("bidderName");
            reply.bidderCountry = bidding.GetString("bidderCountry");
            reply.lastAction    = bidding.GetDate("lastAction");
            reply.lockEnd       = bidding.GetDate("lockEnd");
            return(reply);
        }
Ejemplo n.º 2
0
        private static Response AccountDetailResponse(AccountDetails accountDetails)
        {
            Response resp = new Response()
            {
                Type = ResponseType.AccountDetails, Status = "OK"
            };
            string          query    = "SELECT * FROM account_data WHERE username='******'";
            DatabaseManager database = new DatabaseManager();

            (MySqlDataReader reader, var Connection) = database.RunQuery(query);
            AccountDetailsResponse response = new AccountDetailsResponse();

            if (reader != null)
            {
                reader.Read();

                response.Username     = reader.GetString(0);
                response.FullName     = reader.GetString(1);
                response.AccType      = reader.GetString(2);
                response.Type         = int.Parse(reader.GetString(3)) == 0 ? UserType.Student : UserType.Professional;
                response.ProfileImage = reader.GetString(4);
                resp.Content          = response;
            }
            Connection.Close();
            return(resp);
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> GetFavouritesForUserId([FromRoute] int accountNumber)
        {
            var account = await _userAccountsService.GetAccountByAcNumAsync(accountNumber);

            if (account == null)
            {
                return(NotFound(new GenericResponse {
                    Status = "Failed", Message = "You do not have any Accounts"
                }));
            }

            var profile = await _userProfileService.GetProfileByIdAcNum(accountNumber);

            var response = new AccountDetailsResponse
            {
                FirstName     = profile.FirstName,
                LastName      = profile.LastName,
                Email         = profile.Email,
                Address       = profile.Address,
                ProfilePcture = profile.ProfilePicture,
                DOB           = profile.DOB,
                AccountData   = new AccountData
                {
                    AccountNumber  = accountNumber,
                    CurrentBalance = account.CurrentBalance,
                    LedgerBalance  = account.LedgerBalance
                }
            };

            return(Ok(response));
        }
Ejemplo n.º 4
0
        public void AccountAccountDetailsResponseFromJson()
        {
            AccountDetailsResponse response = AccountDetailsResponse.FromJson(@"{""account_state"":""active"",""plan"":""Growth"",""minutes_used"":12549,""minutes_included"":25000,""billing_state"":""active"",""integration_mode"":true}");

            Assert.AreEqual("active", response.AccountState);
            Assert.AreEqual(true, response.IntegrationMode);
            Assert.AreEqual(12549, response.MinutesUsed);
        }
Ejemplo n.º 5
0
        public void AccountAccountDetailsRequest()
        {
            AccountDetailsResponse response = Zencoder.AccountDetails();

            Assert.IsTrue(response.Success);

            AutoResetEvent[] handles = new AutoResetEvent[] { new AutoResetEvent(false) };

            Zencoder.AccountDetails(r =>
            {
                Assert.IsTrue(r.Success);
                handles[0].Set();
            });

            WaitHandle.WaitAll(handles);
        }
Ejemplo n.º 6
0
        private CustomerDetails GetAccountData(AccountDetailsResponse response)
        {
            CustomerDetails customerDetails = new CustomerDetails();

            if (response != null)
            {
                customerDetails.LoginId            = response.Login?.Id ?? Guid.Empty;
                customerDetails.RequestId          = response.RequestId;
                customerDetails.Holder             = GetHolderInformarmation(response.Accounts);
                customerDetails.OperationAccounts  = GetAccountNumbers(response.Accounts);
                customerDetails.USDAccounts        = GetUsdAccountDetails(response.Accounts);
                customerDetails.BiggestCreditTrxId = GetLargestTranscationId(response.Accounts);
            }

            return(customerDetails);
        }
Ejemplo n.º 7
0
        private CustomerResponseMessage_sync CreateCustomerQuery(string externalId)
        {
            AccountDetailsResponse response = new AccountDetailsResponse();

            var query = new CustomerByElementsQueryMessage_sync();
            CustomerSelectionByInternalID id = new CustomerSelectionByInternalID();

            id.InclusionExclusionCode   = "I";
            id.IntervalBoundaryTypeCode = "1";
            id.LowerBoundaryInternalID  = externalId;
            CustomerSelectionByInternalID[] ids = new CustomerSelectionByInternalID[10];
            ids[0] = id;
            CustomerSelectionByElements selectById = new CustomerSelectionByElements();

            selectById.SelectionByInternalID  = ids;
            query.CustomerSelectionByElements = selectById;

            return(_queryClient.FindByElements(query));
        }
Ejemplo n.º 8
0
        private async Task fetchAccountInfo(string username, string ssid)
        {
            AccountDetails details = new AccountDetails()
            {
                Username = username, SessionID = ssid
            };
            Object resp = new JObject();

            resp = await ConnectionManager.SendRequestAsync(details, RequestType.AccountDetails, ResponseType.AccountDetails);

            if (resp != null)
            {
                AccountDetailsResponse Response = ((JObject)resp).ToObject <AccountDetailsResponse>();
                SettingsManager.ProfilePath = "http://" + SettingsManager.ServerIp + "/root" + Response.ProfileImage;
                SettingsManager.AccountType = Response.AccType;
                SettingsManager.Username    = Response.Username;
                SettingsManager.FullName    = Response.FullName;
                CallerWindow.SetUpAccount(Response.Type);
            }
        }
Ejemplo n.º 9
0
        public void SetLocationAndContactIds(AccountDetailsResponse returnResponse, CustomerResponseMessage_sync queryResponse)
        {
            if (queryResponse.Customer[0].AddressInformation != null)
            {
                returnResponse.LocationExternalIds = new List <string>();
                int locationCount = queryResponse.Customer[0].AddressInformation.Length;
                for (int i = 0; i < locationCount; i++)
                {
                    returnResponse.LocationExternalIds.Add(queryResponse.Customer[0].AddressInformation[i].UUID.Value);
                }
            }

            if (queryResponse.Customer[0].ContactPerson != null)
            {
                returnResponse.ContactExternalIds = new List <string>();
                int contactCount = queryResponse.Customer[0].ContactPerson.Length;
                for (int i = 0; i < contactCount; i++)
                {
                    returnResponse.ContactExternalIds.Add(queryResponse.Customer[0].ContactPerson[i].BusinessPartnerContactInternalID);
                }
            }
        }
Ejemplo n.º 10
0
        public async Task Returns_ValidData_OnValidLoginId()
        {
            var loginId   = Guid.NewGuid();
            var requestId = Guid.NewGuid();
            var guid1     = Guid.NewGuid();
            var guid2     = Guid.NewGuid();
            var guid3     = Guid.NewGuid();
            var guid4     = Guid.NewGuid();

            var accountDetails = new AccountDetailsResponse()
            {
                Login = new Login()
                {
                    Id = loginId
                },
                RequestId   = requestId,
                Institution = "P-Test",
                Accounts    = new System.Collections.Generic.List <Accounts>()
                {
                    new Accounts()
                    {
                        AccountNumber = "1212",
                        Balance       = new Balance()
                        {
                            Available = 100.23,
                            Current   = 10000,
                            Limit     = 300.02
                        },
                        Category = "chequing us",
                        Currency = "Cad",
                        Holder   = new FlinksAppServices.Response.Holder()
                        {
                            Name = "Test", Email = "*****@*****.**"
                        },
                        Id = loginId,
                        InstitutionNumber = "12132323",
                        OverdraftLimit    = 205.10,
                        Title             = "test",
                        Transactions      = new System.Collections.Generic.List <Transactions>()
                        {
                            new Transactions()
                            {
                                Id      = guid1,
                                Balance = 100.232,
                                Credit  = 10121212,
                                Debit   = null,
                            },
                            new Transactions()
                            {
                                Id      = guid2,
                                Balance = 100.232,
                                Credit  = null,
                                Debit   = 1222,
                            },
                            new Transactions()
                            {
                                Id      = guid3,
                                Balance = 100.232,
                                Credit  = 23445,
                                Debit   = null,
                            },
                            new Transactions()
                            {
                                Id      = guid4,
                                Balance = 100.232,
                                Credit  = 2323,
                                Debit   = null,
                            }
                        },
                        TransitNumber = "1222323",
                        Type          = "Usa"
                    }
                },
            };

            _apiServices.Setup(x => x.Authenticate(It.Is <AuthorizeRequest>(y => y.LoginId == loginId.ToString()))).Returns(Task.FromResult(new AuthorizeResponse()
            {
                RequestId = requestId
            }));
            _apiServices.Setup(x => x.GetAccountDetails(It.Is <GetAccountDetailsRequest>(gt => gt.RequestId == requestId))).Returns(Task.FromResult(accountDetails));
            var result  = _homeController.GetCustomerData(loginId.ToString()) as ContentResult;
            var results = JsonConvert.DeserializeObject <CustomerDetails>(result.Content);

            Assert.AreEqual(results.LoginId, loginId);
            Assert.AreEqual(results.RequestId, requestId);
            Assert.AreEqual(results.Holder.Email, "*****@*****.**");
            Assert.AreEqual(results.Holder.Name, "Test");
            Assert.AreEqual(results.OperationAccounts.FirstOrDefault().AccountNumber, 1212);
            Assert.AreEqual(results.USDAccounts.FirstOrDefault(), null);
            Assert.AreEqual(results.BiggestCreditTrxId, guid1);
        }