How to create signature in asp.net with pagseguro

1

Hello, I've researched all over the place and I have not found how to integrate a signature into my system in ASP.NET MVC with the pagseguro. I used this code and my feedback is not working when I add this preapproval!

 //**********************Inicio do procedimento para gerar uma compra pela API do pagseguro
                    DateTime now = new DateTime();
                    var payment = new PaymentRequest();

                    payment.Items.Add(new Item("0001", "Notebook Prata", 1, 2430.00m));
                    payment.Items.Add(new Item("0002", "Mochila", 1, 150.99m));

                    payment.Sender = new Sender("José Comprador","[email protected]",new Phone("11","56273440"));

                    payment.PreApproval = new PreApproval
                    {
                        Charge = Charge.Auto,
                        Name = "Seguro contra roubo do Notebook",
                        AmountPerPayment = 100.00m,
                        MaxAmountPerPeriod = 100.00m,
                        Details = string.Format("test"),
                        Period = Period.Monthly,
                        DayOfMonth = now.Day,
                        InitialDate = now,
                        FinalDate = now.AddMonths(6),
                        MaxTotalAmount = 600.00m,
                        MaxPaymentsPerPeriod = 1,

                    };

                    payment.Currency = Currency.Brl;

                    SenderDocument senderCPF = new SenderDocument(Documents.GetDocumentByType("CPF"), "12345678909");
                    payment.Sender.Documents.Add(senderCPF);
                    AccountCredentials credentials = new AccountCredentials("[email protected]","ABC1234DEF");

                    Uri paymentRedirectUri = payment.Register(credentials);

                    return Redirect(paymentRedirectUri.AbsoluteUri);


                    //**************************************************************************

I've already looked at the @CiganoMorissonMendez which I help quite a bit but it is my first project and I have no concept on the subject.

    
asked by anonymous 08.07.2016 / 19:04

1 answer

1

I solved the subscription problem without needing items:

I used and Pre-approved which is in the dotnet-> source-> instance-> preapproval-> createPreapproval
folder In this I had to change PreapprovalSerializer.cs because of a date problem that was generated
As explained by the Margatho I added the dateRead

namespace Uol.PagSeguro.XmlParse <- NameSpace
internal static class PreApprovalSerializer <- Classe
internal static void Read(XmlReader reader, PreApprovalRequestResponse preApprovalResponse) <- Método

switch (reader.Name)
                    {
                        case PreApprovalSerializer.Date: <- Ini
                            DateTime dateRead;                           
                            DateTime.TryParse(reader.ReadElementContentAsString(), out dateRead);
                            preApprovalResponse.RegistrationDate = dateRead;
                            break; <- fim
                        case PreApprovalSerializer.Code:
                            preApprovalResponse.Code = reader.ReadElementContentAsString();
                            break;
                        case PreApprovalSerializer.Status:
                            preApprovalResponse.Status = reader.ReadElementContentAsString();
                            break;
                        default:
                            XMLParserUtils.SkipElement(reader);
                            break;
                    }

As such, a signature without product was created! But I would not have found this result without understanding the previous conversation.

    
14.07.2016 / 18:38