public Task TransferRequestMessageReceivedAsync(string sessionId, TransferRequestMessage message) { var transaction = new Core.Models.Transaction { Status = TransactionStatus.TransferRequested, OriginatorPostalAddress = new Core.Models.PostalAddress { Street = message.Originator.PostalAddress.StreetName, AddressLine = message.Originator.PostalAddress.AddressLine, Building = message.Originator.PostalAddress.BuildingNumber, Country = message.Originator.PostalAddress.Country, PostCode = message.Originator.PostalAddress.PostCode, Town = message.Originator.PostalAddress.TownName }, OriginatorPlaceOfBirth = new Core.Models.PlaceOfBirth { Country = message.Originator.PlaceOfBirth.CountryOfBirth, Date = message.Originator.PlaceOfBirth.DateOfBirth, Town = message.Originator.PlaceOfBirth.CityOfBirth }, Amount = decimal.Parse(message.Transfer.Amount), Asset = message.Transfer.VirtualAssetType, Id = Guid.NewGuid().ToString(), CreationDateTime = DateTime.UtcNow, BeneficiaryVaan = message.Beneficiary.VAAN.Replace(" ", ""), OriginatorVaan = message.Originator.VAAN.Replace(" ", ""), OriginatorFullName = message.Originator.Name, BeneficiaryFullName = message.Beneficiary.Name, SessionId = sessionId }; lock (_outgoingTransactions) { _incomingTransactions.Add(transaction); } return(Task.CompletedTask); }
public async Task <Core.Models.Transaction> CreateOutgoingTransactionAsync( string originatorFullName, string originatorVaan, Core.Models.PlaceOfBirth originatorPlaceOfBirth, Core.Models.PostalAddress originatorPostalAddress, string beneficiaryFullName, string beneficiaryVaan, VirtualAssetType asset, decimal amount) { var sanitizedBeneficiaryVaan = beneficiaryVaan.Replace(" ", ""); var sanitizedOriginatorVaan = originatorVaan.Replace(" ", ""); var beneficiaryVaspCode = sanitizedBeneficiaryVaan.Substring(0, 8); var beneficiaryCustomerSpecificNumber = sanitizedBeneficiaryVaan.Substring(8, 14); var transaction = new Core.Models.Transaction { Status = TransactionStatus.Created, OriginatorPostalAddress = originatorPostalAddress, OriginatorPlaceOfBirth = originatorPlaceOfBirth, Amount = amount, Asset = asset, Id = Guid.NewGuid().ToString(), CreationDateTime = DateTime.UtcNow, BeneficiaryVaan = sanitizedBeneficiaryVaan, OriginatorVaan = sanitizedOriginatorVaan, OriginatorFullName = originatorFullName, BeneficiaryFullName = beneficiaryFullName, SessionId = await _vaspSessionsManager.CreateSessionAsync( new Originator( originatorFullName, originatorVaan, new OpenVASP.Messaging.Messages.Entities.PostalAddress ( originatorPostalAddress.Street, originatorPostalAddress.Building, originatorPostalAddress.AddressLine, originatorPostalAddress.PostCode, originatorPostalAddress.Town, originatorPostalAddress.Country ), new OpenVASP.Messaging.Messages.Entities.PlaceOfBirth ( originatorPlaceOfBirth.Date, originatorPlaceOfBirth.Town, originatorPlaceOfBirth.Country ), null, null, null ), VirtualAssetsAccountNumber.Create(beneficiaryVaspCode, beneficiaryCustomerSpecificNumber)) }; transaction.Status = TransactionStatus.SessionRequested; lock (_outgoingTransactions) { _outgoingTransactions.Add(transaction); } return(transaction); }