Exemplo n.º 1
0
        public void NotifyPaymentRequestSampleTest()
        {
            using (Tokenio.User.TokenClient tokenClient = TestUtil.CreateClient())
            {
                UserMember payer = TestUtil.CreateMemberAndLinkAccounts(tokenClient);

                UserMember           payee      = PollNotificationsSample.CreateMember(tokenClient);
                Alias                payeeAlias = payee.GetFirstAliasBlocking();
                Tokenio.User.Account account    = LinkMemberAndBankSample.LinkBankAccounts(payer);
                LinkMemberAndBankSample.LinkBankAccounts(payee);

                TransferDestination tokenDestination = new TransferDestination
                {
                    Token = new TransferDestination.Types.Token
                    {
                        MemberId = payee.MemberId()
                    }
                };

                TransferTokenBuilder builder = payer.CreateTransferTokenBuilder(100.00, "EUR")
                                               .SetAccountId(account.Id())
                                               .SetToAlias(payeeAlias)
                                               .AddDestination(tokenDestination);

                PrepareTokenResult result = payer.PrepareTransferTokenBlocking(builder);
                Token    token            = payer.CreateTokenBlocking(result.TokenPayload, Key.Types.Level.Standard);
                Transfer transfer         = payee.RedeemTokenBlocking(token);

                var notification = PollNotificationsSample.Poll(payee);

                Assert.NotNull(notification);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Finds a previously-created access token from grantor to grantee.
        /// </summary>
        /// <param name="tokenClient">initialized SDK</param>
        /// <param name="grantor">Token member granting access to her accounts</param>
        /// <param name="granteeAlias">Token member alias acquiring information access</param>
        /// <returns>an access Token</returns>
        public static Token FindAccessToken(
            Tokenio.User.TokenClient tokenClient,
            UserMember grantor,
            Alias granteeAlias)
        {
            string granteeMemberId = tokenClient.GetMemberIdBlocking(granteeAlias);

            return(grantor.GetActiveAccessTokenBlocking(granteeMemberId));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates the user member.
        /// </summary>
        /// <returns>The user member.</returns>
        public static UserMember CreateUserMember()
        {
            Tokenio.User.TokenClient
                       client = Tokenio.User.TokenClient.Create(Tokenio.TokenCluster.DEVELOPMENT, DEV_KEY);
            Alias      alias  = RandomUserAlias();
            UserMember member = client.CreateMemberBlocking(alias);

            member.CreateTestBankAccountBlocking(1000.0, "EUR");
            return(member);
        }