Ejemplo n.º 1
0
 private object SetJsonForBraspag(PaymentMOD payment)
 {
     return(new
     {
         MerchantOrderId = payment.Customer.Id,
         Customer = new
         {
             Name = payment.Customer.Name
         },
         Payment = new
         {
             Capture = true,
             Type = payment.Type,
             Amount = payment.Amount,
             Provider = payment.Provider,
             Installments = payment.Installments,
             CreditCard = new
             {
                 CardNumber = payment.Card.Number,
                 Holder = payment.Card.Name,
                 ExpirationDate = payment.Card.Expiration,
                 SecurityCode = payment.Card.Code,
                 Brand = payment.Card.Flag
             }
         }
     });
 }
Ejemplo n.º 2
0
        public async Task <ResponseMOD> PayWithBraspagAsync(PaymentMOD payment)
        {
            using (HttpClient httpClient = new HttpClient())
            {
                SetAuthForBraspag(httpClient);

                return(await SendPaymentToBraspagAsync(httpClient, payment));
            }
        }
Ejemplo n.º 3
0
        public async Task<ResponseMOD> PayWithBraspagAsync(PaymentMOD payment)
        {
            using (HttpClient httpClient = new HttpClient())
            {
                SetAuthForBraspag(httpClient);

                return await SendPaymentToBraspagAsync(httpClient, payment);
            }
        }
Ejemplo n.º 4
0
        private async Task<ResponseMOD> SendPaymentToBraspagAsync(HttpClient httpClient, PaymentMOD payment)
        {
            try
            {
                HttpResponseMessage httpResponseMessage = await httpClient.PostAsJsonAsync(UtilityMOD.API_BRASPAG_URL, SetJsonForBraspag(payment));

                ResponseMOD response = await ValidateResponseFromBraspagAsync(httpResponseMessage);

                return response;
            }
            catch (Exception exception)
            {
                return SetCurrentException(exception);
            }
        }
Ejemplo n.º 5
0
        private async Task <ResponseMOD> SendPaymentToBraspagAsync(HttpClient httpClient, PaymentMOD payment)
        {
            try
            {
                HttpResponseMessage httpResponseMessage = await httpClient.PostAsJsonAsync(UtilityMOD.API_BRASPAG_URL, SetJsonForBraspag(payment));

                ResponseMOD response = await ValidateResponseFromBraspagAsync(httpResponseMessage);

                return(response);
            }
            catch (Exception exception)
            {
                return(SetCurrentException(exception));
            }
        }
Ejemplo n.º 6
0
 private object SetJsonForBraspag(PaymentMOD payment)
 {
     return new
     {
         MerchantOrderId = payment.Customer.Id,
         Customer = new
         {
             Name = payment.Customer.Name
         },
         Payment = new
         {
             Capture = true,
             Type = payment.Type,
             Amount = payment.Amount,
             Provider = payment.Provider,
             Installments = payment.Installments,
             CreditCard = new
             {
                 CardNumber = payment.Card.Number,
                 Holder = payment.Card.Name,
                 ExpirationDate = payment.Card.Expiration,
                 SecurityCode = payment.Card.Code,
                 Brand = payment.Card.Flag
             }
         }
     };
 }