/// <summary>
        /// Cancels a transfer token.
        /// </summary>
        /// <param name="payer">payer Token member</param>
        /// <param name="tokenId">token ID to cancel</param>
        /// <returns>operation result</returns>
        public static TokenOperationResult CancelTransferToken(UserMember payer, string tokenId)
        {
            // Retrieve a transfer token to cancel.
            Token transferToken = payer.GetTokenBlocking(tokenId);

            // Cancel transfer token.
            return(payer.CancelTokenBlocking(transferToken));
        }
Exemple #2
0
        /// <summary>
        /// Cancels an access token.
        /// </summary>
        /// <param name="grantor">grantor Token member</param>
        /// <param name="tokenId">token ID to cancel</param>
        /// <returns>operation result</returns>
        public static TokenOperationResult CancelAccessToken(UserMember grantor, string tokenId)
        {
            // Retrieve an access token to cancel.
            Token accessToken = grantor.GetTokenBlocking(tokenId);

            // Cancel access token.
            return(grantor.CancelTokenBlocking(accessToken));
        }
Exemple #3
0
        /// <summary>
        /// Gets a token by ID.
        /// </summary>
        /// <param name="member">member represented by the token (payer/payee/grantor/grantee)</param>
        /// <param name="tokenId">token ID</param>
        /// <returns>token</returns>
        public static Token GetToken(UserMember member, string tokenId)
        {
            Token token = member.GetTokenBlocking(tokenId);

            // get token payload
            TokenPayload payload = token.Payload;

            // get signatures
            var signatures = token.PayloadSignatures;

            return(token);
        }
Exemple #4
0
        /// <summary>
        /// Redeems a standing order token to make a series of transfers from payer bank account
        /// to payee bank account.
        /// </summary>
        /// <param name="payee">payee Token member</param>
        /// <param name="tokenId">ID of the token to redeem</param>
        /// <returns>standing order submission record</returns>
        public static StandingOrderSubmission RedeemStandingOrderToken(
            UserMember payee,
            string tokenId) // ID of token to redeem
        {
            // Retrieve a standing order token to redeem.
            Token token = payee.GetTokenBlocking(tokenId);
            // Payee redeems a standing order token.
            // Money is transferred in many installments to a payee bank account.
            StandingOrderSubmission submission = payee.RedeemStandingOrderTokenBlocking(token.Id);

            return(submission);
        }
Exemple #5
0
        /// <summary>
        /// Redeems a transfer token to transfer money from payer bank account to payee bank account.
        /// </summary>
        /// <param name="payee">payee Token member</param>
        /// <param name="accountId">account id of the payee</param>
        /// <param name="tokenId">ID of the token to redeem</param>
        /// <returns>a transfer Transfer</returns>
        public static Transfer RedeemTransferToken(
            UserMember payee,
            string accountId, // account ID of the payee
            string tokenId)
        {                     // ID of token to redeem
          // We'll use this as a reference ID. Normally, a payee who
          // explicitly sets a reference ID would use an ID from a db.
          // E.g., an online merchant might use the ID of a "shopping cart".
          // We don't have a db, so we fake it with a random string:
            string cartId = Util.Nonce();

            // Retrieve a transfer token to redeem.
            Token transferToken = payee.GetTokenBlocking(tokenId);

            // Set token destination
            TransferDestination tokenDestination = new TransferDestination
            {
                Token = new TransferDestination.Types.Token
                {
                    MemberId  = payee.MemberId(),
                    AccountId = accountId
                }
            };



            // Payee redeems a transfer token.
            // Money is transferred to a payee bank account.
            Transfer transfer = payee.RedeemTokenBlocking(
                transferToken,
                tokenDestination,
                // if refId not set, transfer will have random refID:
                cartId);

            return(transfer);
        }