public static Transfer RedeemTransferToken(
            Member payee,
            string accountId, // account ID of the payee
            string tokenId)
        {
            var cartId = Util.Nonce();

            var transferToken = payee.GetToken(tokenId).Result;

            var transfer = payee.RedeemToken(
                transferToken,
                new TransferEndpoint
            {
                Account = new BankAccount
                {
                    Token = new Token
                    {
                        MemberId  = payee.MemberId(),
                        AccountId = accountId
                    }
                }
            },
                cartId).Result;

            return(transfer);
        }
        /// <summary>
        /// Stores a transfer token request.
        /// </summary>
        /// <param name="payee">Payee Token member (the member requesting the transfer token be created)</param>
        /// <returns>a token request id</returns>
        public static string StoreTransferTokenRequest(Member payee)
        {
            var request = TokenRequest.TransferTokenRequestBuilder(100, "EUR")
                          .SetToMemberId(payee.MemberId())
                          .SetDescription("Book purchase")
                          .SetRedirectUrl("https://token.io/callback")
                          .SetFromAlias(new Alias
            {
                Value = "[email protected],",
                Type  = Alias.Types.Type.Email,
            })
                          .SetBankId("iron")
                          .SetCsrfToken(Util.Nonce())
                          .AddDestination(new TransferDestination
            {
                Sepa = new TransferDestination.Types.Sepa
                {
                    Bic  = "XUIWC2489",
                    Iban = "DE89370400440532013000"
                }
            })
                          .build();

            return(payee.StoreTokenRequestBlocking(request));
        }
Пример #3
0
        public static Transfer RedeemTransferToken(
            Member payee,
            string accountId, // account ID of the payee
            string tokenId)
        {
            var cartId = Util.Nonce();

            var transferToken = payee.GetToken(tokenId).Result;

            var transferDestination = new TransferDestination
            {
                Token = new TransferDestination.Types.Token
                {
                    MemberId  = payee.MemberId(),
                    AccountId = accountId
                }
            };

            var transfer = payee.RedeemToken(
                transferToken,
                transferDestination,
                cartId).Result;

            return(transfer);
        }
        /// <summary>
        /// Stores a transfer token request.
        /// </summary>
        /// <param name="payee">Payee Token member (the member requesting the transfer token be created)</param>
        /// <returns>a token request id</returns>
        public static string StoreTransferTokenRequest(Member payee)
        {
            var request = TokenRequest.TransferTokenRequestBuilder(100, "EUR")
                          .SetToMemberId(payee.MemberId())
                          .SetDescription("Book purchase")
                          .SetRedirectUrl("https://token.io/callback")
                          .SetFromAlias(new Alias
            {
                Value = "[email protected],",
                Type  = Alias.Types.Type.Email,
            })
                          .SetBankId("iron")
                          .SetCsrfToken(Util.Nonce())
                          .build();

            return(payee.StoreTokenRequestBlocking(request));
        }
        /// <summary>
        /// Stores an access token request.
        /// </summary>
        /// <param name="grantee">Token member requesting the access token be created</param>
        /// <returns>a token request id</returns>
        public static string StoreAccessTokenRequest(Member grantee)
        {
            var request = TokenRequest.AccessTokenRequestBuilder(
                TokenRequestPayload.Types.AccessBody.Types.ResourceType.Accounts,
                TokenRequestPayload.Types.AccessBody.Types.ResourceType.Balances)
                          .SetToMemberId(grantee.MemberId())
                          .SetRedirectUrl("https://token.io/callback")
                          .SetFromAlias(new Alias
            {
                Value = "*****@*****.**",
                Type  = Alias.Types.Type.Email
            })
                          .SetBankId("iron")
                          .SetCsrfToken(Util.Nonce())
                          .build();

            return(grantee.StoreTokenRequestBlocking(request));
        }