public void ReedemTokenWithMissmatchedAmount() { this.userInfo = GetDelegatedUserCredentials(); this.delegatedClient = AspenClient.Initialize(AppScope.Delegated) .RoutingTo(this.delegatedAppInfoProvider) .WithIdentity(this.delegatedAppInfoProvider) .Authenticate(this.userInfo) .GetClient(); this.autonomousClient = AspenClient.Initialize() .RoutingTo(this.autonomousAppInfoProvider) .WithIdentity(this.autonomousAppInfoProvider) .Authenticate(useCache: false) .GetClient(); this.docType = this.userInfo["DocType"].ToString(); this.docNumber = this.userInfo["DocNumber"].ToString(); int amount = new Random().Next(1, 10000); ITokenResponseInfo token1 = this.GetToken(amount: amount); this.ReeemTokenWithMissmatchedAmount(token1.Token, amount + 1); ITokenResponseInfo token2 = this.GetToken(amount: amount); this.ReeemTokenWithMissmatchedAmount(token2.Token, amount - 1); }
private ITokenResponseInfo GetToken(string metadata = null, int?amount = null, string accountType = null) { ITokenResponseInfo tokenInfo = this.delegatedClient.Financial.GetSingleUseToken(WellKnownPin, metadata, amount, accountType); Assert.IsNotEmpty(tokenInfo.Token); Assert.IsTrue(tokenInfo.ExpirationMinutes > 0); Assert.IsTrue(tokenInfo.ExpiresAt > DateTimeOffset.Now); return(tokenInfo); }
public void TokenLifeCycleWorks() { this.userInfo = GetDelegatedUserCredentials(); this.delegatedClient = AspenClient.Initialize(AppScope.Delegated) .RoutingTo(this.delegatedAppInfoProvider) .WithIdentity(this.delegatedAppInfoProvider) .Authenticate(this.userInfo) .GetClient(); this.autonomousClient = AspenClient.Initialize() .RoutingTo(this.autonomousAppInfoProvider) .WithIdentity(this.autonomousAppInfoProvider) .Authenticate(useCache: false) .GetClient(); this.docType = this.userInfo["DocType"].ToString(); this.docNumber = this.userInfo["DocNumber"].ToString(); string metadata = Guid.NewGuid().ToString("B"); int amount = new Random().Next(1, 10000); ITokenResponseInfo token1 = this.GetToken(); this.RedeemToken(token1.Token, amount); ITokenResponseInfo token3 = this.GetToken(metadata, amount); this.RedeemTokenNoAmount(token3.Token); ITokenResponseInfo token4 = this.GetToken(metadata, amount); this.RedeemTokenNegativeAmount(token4.Token); int accountTypesLength = 6; int index = new Random(Guid.NewGuid().GetHashCode()).Next(0, accountTypesLength); string accountType = Enumerable.Range(80, accountTypesLength).ToList()[index].ToString(); ITokenResponseInfo token5 = this.GetToken(metadata, amount, accountType); this.RedeemToken(token5.Token, amount, metadata, accountType); ITokenResponseInfo token6 = this.GetToken(null, amount, accountType); this.ReeemTokenWithMissmatchedAccountType(token6.Token, amount); ITokenResponseInfo token7 = this.GetToken(); this.ReeemTokenWithInvalidDocType(token7.Token); }
public void ReedemTokenWithMissmatchedMetadata() { this.userInfo = GetDelegatedUserCredentials(); this.delegatedClient = AspenClient.Initialize(AppScope.Delegated) .RoutingTo(this.delegatedAppInfoProvider) .WithIdentity(this.delegatedAppInfoProvider) .Authenticate(this.userInfo) .GetClient(); this.autonomousClient = AspenClient.Initialize() .RoutingTo(this.autonomousAppInfoProvider) .WithIdentity(this.autonomousAppInfoProvider) .Authenticate(useCache: false) .GetClient(); this.docType = this.userInfo["DocType"].ToString(); this.docNumber = this.userInfo["DocNumber"].ToString(); string metadata = Guid.NewGuid().ToString("B"); var amount = new Random().Next(1, 10000); ITokenResponseInfo token = this.GetToken(metadata); this.ReeemTokenWithMissmatchedMetadata(token.Token, amount); }