Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Failed to parse the response: Cannot convert null value to System.DateTime. Path 'due_at', line 1, position 222." ao gerar a cobrança #82

Open
profalves opened this issue Oct 2, 2020 · 1 comment

Comments

@profalves
Copy link

profalves commented Oct 2, 2020

public object SendCreditCardPayment(dynamic body, dynamic order)
        {
            try
            {
                string orderID = GetOrderID(order);

                string basicAuthUserName = "sk_test_algumcodigo"; // sua secret key 
                string basicAuthPassword = "";

                MundiAPIClient client = new MundiAPIClient(basicAuthUserName, basicAuthPassword);

                //string customerId = "cus_6l5dMWZ0hkHZ4XnE";

                //var query = client.Customers.GetCustomer(customerId);

                //if() ... tratar cliente

                var customer = new CreateCustomerRequest
                {
                    Name = "Consumidor",
                    Email = "[email protected]",
                };



                var request = new CreateChargeRequest()
                {
                    Amount = body.amount,
                    Code = orderID,
                    Customer = customer,
                    Payment = new CreatePaymentRequest()
                    {
                        PaymentMethod = body.paymentMethod,
                        CreditCard = new CreateCreditCardPaymentRequest()
                        {
                            Card = new CreateCardRequest
                            {
                                Number = "4000000000000010",
                                HolderName = body.card.holderName,
                                ExpMonth = body.card.expMonth,
                                ExpYear = body.card.expYear,
                                Cvv = body.card.cvv,
                            }
                        }
                    }
                };

                GetChargeResponse response = client.Charges.CreateCharge(request);

                var result = JObject.FromObject(response);

                return result;
            }
            catch (Exception ex)
            {

                throw ex;
            }

Quando vou obter a resposta dá erro de parse no campo due_at pois retorna nulo. Eu vejo que a cobrança é gerada mas não consegue associar na resposta. Já usei até var no lugar do tipo GetChargeResponse, mas o erro é o mesmo. Como pode ser resolvido essa situação?

@jonas1307
Copy link

Estou com o mesmo erro, porém consumindo a Biblioteca Mundipagg.Standard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants