Exemplo n.º 1
0
        private void SendPaymentReceiptEmail(CreditCardViewModel viewModel, StringBuilder oLineItems, IAPayment oIAPayment)
        {
            // Email receipt to payer
             var sGreeting = string.Empty;
             if (_transientCardEntry && m_txtFirstName.Text == string.Empty && m_txtLastName.Text == string.Empty)
             {
            sGreeting = "Hello,";
             }
             else if (viewModel.FirstName == string.Empty)
             {
            sGreeting = "Hello,";
             }
             else
             {
            sGreeting = string.Format("{0} {1},", viewModel.FirstName, viewModel.LastName);
             }

             var oBody = new StringBuilder();
             oBody.AppendLine(sGreeting);
             oBody.AppendLine();
             oBody.AppendLine("Thank you for making a payment on SpeedySpots.com.");
             oBody.AppendLine();
             oBody.AppendLine("Payments:");
             oBody.Append(oLineItems);
             oBody.AppendLine();
             oBody.AppendLine(string.Format("Amount: {0:c}", oIAPayment.Total));
             oBody.AppendLine(string.Format("Card: {0}", viewModel.CardType));
             oBody.AppendLine(string.Format("Card Number: xxxx-xxxx-xxxx-{0}", viewModel.LastFourOfCardNumber));
             oBody.AppendLine(string.Format("Paid On: {0:MMMM dd, yyyy} at {0:h:mm tt}", DateTime.Now));
             if (m_txtInstructions.Text.Length > 0)
             {
            oBody.AppendLine(String.Format("Special Instructions: {0}", m_txtInstructions.Text));
             }
             oBody.AppendLine();
             oBody.AppendLine("Thank you again for using SpeedySpots.com");

             EmailCommunicationService.PaymentCustomerReceiptSend(oBody, viewModel.ReceiptEmailAddressCsv);
        }
Exemplo n.º 2
0
        private void SendBillingEmail(CreditCardViewModel viewModel, bool bIsPaymentAutoImported, StringBuilder oSpeedySpotsLineItems,
                                    IAPayment oIAPayment)
        {
            StringBuilder oBody;
             // Email SpeedySpots
             oBody = new StringBuilder();
             if (!bIsPaymentAutoImported)
             {
            oBody.AppendLine("** This payment will NOT be auto-imported **");
            oBody.AppendLine();
             }
             oBody.AppendLine("Payments:");
             oBody.Append(oSpeedySpotsLineItems);
             oBody.AppendLine();
             oBody.AppendLine(string.Format("Customer Name: {0} {1}", viewModel.FirstName, viewModel.LastName));
             oBody.AppendLine(string.Format("Company Name: {0}", viewModel.CompanyName));
             oBody.AppendLine(string.Format("Customer Email(s): {0}", viewModel.ReceiptEmailAddressCsv));
             oBody.AppendLine();
             oBody.AppendLine(string.Format("Amount: {0:c}", oIAPayment.Total));

             if (m_txtInstructions.Text.Length > 0)
             {
            oBody.AppendLine(String.Format("Special Instructions: {0}", m_txtInstructions.Text));
             }
             oBody.AppendLine();
             oBody.AppendLine(string.Format("Card: {0}", viewModel.CardType));
             oBody.AppendLine(string.Format("Card Number: xxxx-xxxx-xxxx-{0}", viewModel.LastFourOfCardNumber));
             oBody.AppendLine(string.Format("Paid On: {0:MMMM dd, yyyy} at {0:h:mm tt}", DateTime.Now));

             EmailCommunicationService.PaymentBillingNoticeSend(oBody);
        }
Exemplo n.º 3
0
        private StringBuilder SaveLineItems(IAPayment oIAPayment, out StringBuilder oSpeedySpotsLineItems)
        {
            // Save the individual line items
             var oLineItems = new StringBuilder();
             oSpeedySpotsLineItems = new StringBuilder();
             foreach (RepeaterItem oItem in m_oRepeaterInvoices.Items)
             {
            var m_txtNumber = oItem.FindControl("m_txtNumber") as TextBox;
            var m_txtAmount = oItem.FindControl("m_txtAmount") as RadNumericTextBox;

            // Check to see if any payment has been made in the past against the given invoice
            var iPreviousPayments = 0;
            if (m_txtNumber.Text != string.Empty)
            {
               iPreviousPayments = DataAccess.IAPaymentLineItems.Count(row => row.Invoice == m_txtNumber.Text);
            }

            var oIAPaymentLineItem = new IAPaymentLineItem
            {
               IAPaymentID = oIAPayment.IAPaymentID,
               Invoice = iPreviousPayments == 0 ? m_txtNumber.Text : string.Empty,
               Amount = MemberProtect.Utility.ValidateDecimal(m_txtAmount.Text)
            };

            var oQBInvoice = DataAccess.QBInvoices.SingleOrDefault(row => row.InvoiceNumber == m_txtNumber.Text);
            if (oQBInvoice != null && iPreviousPayments == 0)
            {
               oIAPaymentLineItem.QBInvoiceID = oQBInvoice.QBInvoiceID;
            }
            else
            {
               oIAPaymentLineItem.QBInvoiceID = 0;
            }

            oIAPayment.IAPaymentLineItems.Insert(0, oIAPaymentLineItem);
            DataAccess.SubmitChanges();

            if (m_txtNumber.Text != string.Empty)
            {
               oLineItems.AppendLine(string.Format("Invoice# {0}: {1:c}", m_txtNumber.Text, MemberProtect.Utility.ValidateDecimal(m_txtAmount.Text)));
            }
            else
            {
               oLineItems.AppendLine(string.Format("{0:c}", MemberProtect.Utility.ValidateDecimal(m_txtAmount.Text)));
            }

            if (oIAPaymentLineItem.QBInvoiceID == 0)
            {
               var sInvoiceNumber = (string.IsNullOrEmpty(m_txtNumber.Text) ? "# N/A" : m_txtNumber.Text);
               if (iPreviousPayments > 0)
               {
                  oSpeedySpotsLineItems.AppendLine(string.Format("{0}: {1:c} (additional attempt to pay invoice #{2})", sInvoiceNumber,
                                                                 MemberProtect.Utility.ValidateDecimal(m_txtAmount.Text), m_txtNumber.Text));
               }
               else
               {
                  oSpeedySpotsLineItems.AppendLine(string.Format("{0}: {1:c}", sInvoiceNumber,
                                                                 MemberProtect.Utility.ValidateDecimal(m_txtAmount.Text)));
               }
            }
            else
            {
               oSpeedySpotsLineItems.AppendLine(string.Format("{0}: {1:c}", oIAPaymentLineItem.Invoice,
                                                              MemberProtect.Utility.ValidateDecimal(m_txtAmount.Text)));
            }
             }
             return oLineItems;
        }
Exemplo n.º 4
0
 private IAPayment SavePayment(PaymentGatewayResponse paymentGatewayResponse)
 {
     var oIAPayment = new IAPayment
      {
     Total = GetTotal(),
     Email = CardProfile.ReceiptEmailAddressCsv,
     Company = m_txtCompany.Text,
     Instructions = m_txtInstructions.Text,
     CreditCardFirstName = MemberProtect.Cryptography.Encrypt(CardProfile.FirstName),
     CreditCardLastName = MemberProtect.Cryptography.Encrypt(CardProfile.LastName),
     CreditCardType = MemberProtect.Cryptography.Encrypt(CardProfile.CardType),
     CreditCardNumber = MemberProtect.Cryptography.Encrypt(CardProfile.CreditCardNumber),
     AuthorizeNetTransactionID = paymentGatewayResponse.GetValue(PaymentGatewayResponse.FieldNames.TransactionId),
     AuthorizeNetProcessResponse = paymentGatewayResponse.GetValue(PaymentGatewayResponse.FieldNames.ResponseReasonText),
     CreatedDateTime = DateTime.Now,
     Zip = ""
      };
      DataAccess.IAPayments.InsertOnSubmit(oIAPayment);
      DataAccess.SubmitChanges();
      return oIAPayment;
 }
Exemplo n.º 5
0
        private bool QuickBooksInvoiceMatching(IAPayment oIAPayment)
        {
            // the payment doesn't get automatically imported into Quickbooks via the Connector.
             var bIsPaymentAutoImported = true;
             var oMPOrgID = Guid.Empty;
             foreach (var oIALineItem in oIAPayment.IAPaymentLineItems)
             {
            var oQBInvoice = DataAccess.QBInvoices.SingleOrDefault(row => row.InvoiceNumber == oIALineItem.Invoice);
            if (oQBInvoice != null)
            {
               if (oMPOrgID == Guid.Empty)
               {
                  oMPOrgID = ApplicationContext.GetOrgID(oQBInvoice.IAJob.IARequest.MPUserID);
               }
               else if (oMPOrgID != ApplicationContext.GetOrgID(oQBInvoice.IAJob.IARequest.MPUserID))
               {
                  bIsPaymentAutoImported = false;
                  break;
               }

               if (oQBInvoice.Amount != oIALineItem.Amount)
               {
                  bIsPaymentAutoImported = false;
                  break;
               }
            }
            else
            {
               bIsPaymentAutoImported = false;
               break;
            }
             }

             if (!bIsPaymentAutoImported)
             {
            foreach (var oIALineItem in oIAPayment.IAPaymentLineItems)
            {
               oIALineItem.QBInvoiceID = 0;
            }

            DataAccess.SubmitChanges();
             }
             return bIsPaymentAutoImported;
        }