示例#1
0
 public Payment(HyperWalletLibrary.Model.Payment payment)
 {
     Token            = payment.Token;
     Amount           = payment.Amount;
     Id               = payment.ClientPaymentId;
     DestinationToken = payment.DestinationToken;
     ExpiresOn        = payment.ExpiresOn;
     Notes            = payment.Notes;
 }
示例#2
0
        public async Task <Payment> GetAsync(string token)
        {
            try
            {
                HyperWalletLibrary.Model.Payment response = await _api.GetAsync(token);

                Payment payment = new Payment(response);
                return(payment);
            }
            catch (Exception)
            {
                return(null);
            }
        }
        public void Convert_Token_NotNull()
        {
            //Arrange
            Payment payment = new Payment()
            {
                Token = "Token"
            };
            PaymentToApiPaymentConverter converter = new PaymentToApiPaymentConverter(payment);

            //Act
            HyperWalletLibrary.Model.Payment result = converter.Convert();

            //Assert
            Assert.True(result.Token != null);
        }
示例#4
0
        public async Task <Payment> PostAsync(Payment item)
        {
            try
            {
                _paymentToApiPayment.Content = item;
                HyperWalletLibrary.Model.Payment newItem  = _paymentToApiPayment.Convert();
                HyperWalletLibrary.Model.Payment response = await _api.PostAsync(newItem);

                Payment payment = new Payment(response);
                return(payment);
            }
            catch (Exception)
            {
                return(null);
            }
        }