Exemple #1
0
        public async Task <CardPaymentResponse> CreateCardPayment(CardPaymentRequest payment)
        {
            var serializePayment = JsonSerializer.Serialize(payment);

            var httpContent = new StringContent(serializePayment, Encoding.UTF8, "application/json");
            var response    = await _httpClient.PostAsync("cardpayment", httpContent);

            var stringResponse = await response.Content.ReadAsStringAsync();

            var result = JsonSerializer.Deserialize <CardPaymentResponse>(stringResponse);

            return(result);
        }
Exemple #2
0
        private CardPaymentRequest BuildBankRequest(Domain.Payment payment)
        {
            if (payment is null)
            {
                throw new ArgumentNullException(nameof(payment));
            }

            var bankRequest = new CardPaymentRequest()
            {
                PaymentId        = payment.PaymentId.Value,
                Amount           = payment.Amount.ToDecimal(),
                Currency         = payment.Amount.Currency.ToString(),
                BeneficiaryAlias = payment.BeneficiaryAlias,
                Card             = new Card()
                {
                    CardNumber     = payment.Card.CardNumber.ToString(),
                    CVV            = payment.Card.CVV.ToString(),
                    ExpirationDate = payment.Card.ExpirationDate.Value
                }
            };

            return(bankRequest);
        }