public void AddAndGetTransferTokenRequest() { var storedPayload = new TokenRequestPayload { UserRefId = Util.Nonce(), RefId = Util.Nonce(), RedirectUrl = tokenUrl, To = new TokenMember { Id = member.MemberId() }, Description = Util.Nonce(), CallbackState = Util.Nonce(), TransferBody = new TokenRequestPayload.Types.TransferBody { Amount = "10.0", Currency = "EUR", Instructions = new TransferInstructions(), } }; var storedOptions = new Tokenio.Proto.Common.TokenProtos.TokenRequestOptions { BankId = "iron", ReceiptRequested = false }; var requestId = member.StoreTokenRequestBlocking(storedPayload, storedOptions); Assert.NotEmpty(requestId); var retrievedRequest = tokenClient.RetrieveTokenRequestBlocking(requestId); Assert.Equal(storedPayload, retrievedRequest.GetTokenRequestPayload()); Assert.Equal(storedOptions, retrievedRequest.GetTokenRequestOptions()); }
public void AddAndGetTokenRequest_WrongMember() { var storedPayload = new TokenRequestPayload { UserRefId = Util.Nonce(), RedirectUrl = tokenUrl, To = new TokenMember { Id = tokenClient.CreateMemberBlocking().MemberId() }, Description = Util.Nonce(), CallbackState = Util.Nonce(), TransferBody = new TokenRequestPayload.Types.TransferBody { Amount = "10.0", Currency = "EUR" } }; var storedOptions = new Tokenio.Proto.Common.TokenProtos.TokenRequestOptions { BankId = "iron", ReceiptRequested = false }; Assert.Throws <AggregateException>(() => member.StoreTokenRequestBlocking(storedPayload, storedOptions)); }
public void AddAndGetAccessTokenRequest() { IList <ResourceType> types = new List <ResourceType>(); types.Add(ResourceType.Accounts); var resourcesList = new ResourceTypeList(); resourcesList.Resources.Add(types); var storedPayload = new TokenRequestPayload { UserRefId = Util.Nonce(), RefId = Util.Nonce(), RedirectUrl = Util.Nonce(), To = new TokenMember { Id = member.MemberId() }, Description = Util.Nonce(), CallbackState = Util.Nonce(), AccessBody = new TokenRequestPayload.Types.AccessBody { Type = { types }, ResourceTypeList = resourcesList, } }; var storedOptions = new Tokenio.Proto.Common.TokenProtos.TokenRequestOptions { BankId = "iron", ReceiptRequested = false }; var requestId = member.StoreTokenRequestBlocking(storedPayload, storedOptions); Assert.NotEmpty(requestId); var retrievedRequest = tokenClient.RetrieveTokenRequestBlocking(requestId); Assert.Equal(storedPayload, retrievedRequest.GetTokenRequestPayload()); Assert.Equal(storedOptions, retrievedRequest.GetTokenRequestOptions()); }