public static PublicAddressResultModel Failed(PublicAddressError error, PublicAddressStatus status = PublicAddressStatus.NotLinked)
 {
     return(new PublicAddressResultModel
     {
         Error = error,
         PublicAddress = null,
         Status = status
     });
 }
 public static PublicAddressResultModel Succeeded(string address, PublicAddressStatus status)
 {
     return(new PublicAddressResultModel
     {
         Error = PublicAddressError.None,
         PublicAddress = address,
         Status = status
     });
 }
        public static PublicAddressLinkingStatus ToLinkingStatus(this PublicAddressStatus src)
        {
            switch (src)
            {
            case PublicAddressStatus.Linked:
                return(PublicAddressLinkingStatus.Linked);

            case PublicAddressStatus.NotLinked:
                return(PublicAddressLinkingStatus.NotLinked);

            case PublicAddressStatus.PendingCustomerApproval:
                return(PublicAddressLinkingStatus.PendingCustomerApproval);

            case PublicAddressStatus.PendingConfirmation:
                return(PublicAddressLinkingStatus.PendingConfirmationInBlockchain);

            default:
                throw new ArgumentOutOfRangeException(nameof(src), $"Public address status not expected: {src.ToString()}");
            }
        }
Beispiel #4
0
        public async Task TransferToExternalAsync_WalletIsNotLinked_ErrorCodeReturned(PublicAddressStatus status)
        {
            _wmClientMock.Setup(x => x.Api.GetCustomerWalletBlockStateAsync(FakeCustomerId))
            .ReturnsAsync(new CustomerWalletBlockStatusResponse {
                Status = CustomerWalletActivityStatus.Active
            });

            _pbfClientMock.Setup(x => x.CustomersApi.GetBalanceAsync(Guid.Parse(FakeCustomerId)))
            .ReturnsAsync(new CustomerBalanceResponseModel {
                Total = (long)FakeAmount
            });

            _walletLinkerClientMock.Setup(x => x.CustomersApi.GetLinkedPublicAddressAsync(Guid.Parse(FakeCustomerId)))
            .ReturnsAsync(new PublicAddressResponseModel {
                Status = status
            });

            var sut = CreateSutInstance();

            var result = await sut.TransferToExternalAsync(FakeCustomerId, FakeAmount);

            Assert.Equal(TransferToExternalErrorCodes.WalletIsNotLinked, result);
        }