public void PostProcessPayment(PostProcessPaymentRequest postProcessPaymentRequest)
        {
            var addressHelper = new AddressHelper(_addressAttributeParser, _workContext);

            var invoiceDate = DateTime.Now.AddDays(3);

            string urlRedirect = string.Empty;

            // Act
            using (var apiInvoice = new Invoice())
            {
                string number     = string.Empty;
                string complement = string.Empty;
                string cnpjcpf    = string.Empty;

                addressHelper.GetCustomNumberAndComplement(postProcessPaymentRequest.Order.BillingAddress.CustomAttributes,
                                                           out number, out complement, out cnpjcpf);

                InvoiceModel invoice;

                var customVariables = new List <CustomVariables>
                {
                    new CustomVariables {
                        name  = IuguHelper.CODIGO_PEDIDO,
                        value = postProcessPaymentRequest.Order.Id.ToString()
                    }
                };

                var addressModel = new AddressModel()
                {
                    ZipCode  = postProcessPaymentRequest.Order.BillingAddress.ZipPostalCode,
                    District = postProcessPaymentRequest.Order.BillingAddress.Address2,
                    State    = postProcessPaymentRequest.Order.BillingAddress.StateProvince.Name,
                    Street   = postProcessPaymentRequest.Order.BillingAddress.Address1,
                    Number   = number,
                    City     = postProcessPaymentRequest.Order.BillingAddress.City,
                    Country  = postProcessPaymentRequest.Order.BillingAddress.Country.Name
                };

                var invoiceItems = new Item[postProcessPaymentRequest.Order.OrderItems.Count + 1];
                int i            = 0;
                var cartItems    = postProcessPaymentRequest.Order.OrderItems;
                foreach (var item in cartItems)
                {
                    var productID = string.IsNullOrWhiteSpace(item.Product.Sku)
                        ? item.Product.Id.ToString()
                        : item.Product.Sku;

                    var productName = ProductHelper.GetProcuctName(item);

                    productName = ProductHelper.AddItemDescrition(productName, item);

                    invoiceItems[i] = new Item()
                    {
                        description = productName,
                        price_cents = ObterPrecoCentavos(decimal.Round(item.UnitPriceInclTax, 2)),
                        quantity    = item.Quantity
                    };
                    i++;
                }

                invoiceItems[i] = new Item()
                {
                    description = postProcessPaymentRequest.Order.ShippingMethod,
                    price_cents = ObterPrecoCentavos(decimal.Round(postProcessPaymentRequest.Order.OrderShippingInclTax, 2)),
                    quantity    = 1
                };


                string email = !string.IsNullOrWhiteSpace(postProcessPaymentRequest.Order.Customer.Email)?
                               postProcessPaymentRequest.Order.Customer.Email:
                               postProcessPaymentRequest.Order.BillingAddress.Email;
                string name  = AddressHelper.GetFullName(postProcessPaymentRequest.Order.BillingAddress);
                string phone = AddressHelper.FormatarCelular(postProcessPaymentRequest.Order.BillingAddress.PhoneNumber);

                string phoneNumber     = AddressHelper.ObterNumeroTelefone(phone);
                string phonePrefix     = AddressHelper.ObterAreaTelefone(postProcessPaymentRequest.Order.BillingAddress.PhoneNumber);
                string urlRetorno      = _storeContext.CurrentStore.Url + "checkout/completed/" + postProcessPaymentRequest.Order.Id.ToString();
                string urlNotification = _storeContext.CurrentStore.Url + "Plugins/PaymentIugu/PaymentReturn";

                int descontoCentavos = 0;

                //Desconto aplicado na ordem subtotal
                if (postProcessPaymentRequest.Order.OrderSubTotalDiscountExclTax > 0)
                {
                    var discount = postProcessPaymentRequest.Order.OrderSubTotalDiscountExclTax;
                    discount          = Math.Round(discount, 2);
                    descontoCentavos += ObterPrecoCentavos(decimal.Round(discount, 2));
                }

                //desconto fixo, dado por cupom, os descontos podem ser cumulativos
                if (postProcessPaymentRequest.Order.OrderDiscount > 0)
                {
                    var discount = postProcessPaymentRequest.Order.OrderDiscount;
                    discount          = Math.Round(discount, 2);
                    descontoCentavos += ObterPrecoCentavos(decimal.Round(discount, 2));
                }


                var payer = new PayerModel()
                {
                    CpfOrCnpj   = cnpjcpf,
                    Address     = addressModel,
                    Email       = email,
                    Name        = name,
                    Phone       = phone,
                    PhonePrefix = phonePrefix
                };

                var invoiceRequest = new InvoiceRequestMessage(email, invoiceDate, invoiceItems)
                {
                    Payer           = payer,
                    ReturnUrl       = urlRetorno,
                    NotificationUrl = urlNotification,
                    DiscountCents   = descontoCentavos,
                    CustomVariables = customVariables.ToArray()
                };

                invoice = apiInvoice.CreateAsync(invoiceRequest, _iuguPaymentSettings.CustomApiToken).ConfigureAwait(false).GetAwaiter().GetResult();

                urlRedirect = invoice.secure_url;
            };


            _orderNoteService.AddOrderNote("Fatura IUGU Bradesco gerada.", true, postProcessPaymentRequest.Order);

            System.Web.HttpContext.Current.Response.Redirect(urlRedirect);
        }