private EmailInvoice BuildEmailInvoice(EmailInvoice emailInvoice) { emailInvoice.CountryId = emailInvoice.CountryId; emailInvoice.Country = _countryRepository.Return(emailInvoice.CountryId); emailInvoice.USStateId = emailInvoice.USStateId; emailInvoice.USState = _usStateRepository.Return(emailInvoice.USStateId); return(emailInvoice); }
private TransactionOutput ProcessPaymentForEmailInvoice(EmailInvoice emailInvoice, PaymentEntity paymentEntity, bool sendEmailFlag) { _paymentSystem.InsertPaymentEntity(paymentEntity); var output = _paymentSystem.ProcessCardPayment(emailInvoice, paymentEntity); ProcessPaymentOutputForEmailInvoice(emailInvoice, output, sendEmailFlag); return(output); }
private void CustomerSelected(CustomersInvoiceView obj) { _customerInvoiceView = obj; CreateNewInvoiceCommand.RaiseCanExecuteChanged(); _invoiceListItemView = null; PreviewInvoiceCommand.RaiseCanExecuteChanged(); PreviewSpecificationCommand.RaiseCanExecuteChanged(); CreditNoteCommand.RaiseCanExecuteChanged(); Recalculateinvoice.RaiseCanExecuteChanged(); EmailInvoice.RaiseCanExecuteChanged(); RegenerateFiles.RaiseCanExecuteChanged(); }
private void ProcessPaymentOutputForEmailInvoice(EmailInvoice emailInvoice, TransactionOutput output, bool sendEmailFlag) { if (output.Status && !output.Has3DSecure) { // Create order payment var orderPayment = new OrderPayment { OrderId = emailInvoice.OrderId, TimeStamp = DateTime.Now, Amount = emailInvoice.Amount, CurrencyCode = emailInvoice.CurrencyCode, ExchangeRate = emailInvoice.ExchangeRate, IsCompleted = true }; int orderPaymentId = _orderPaymentRepository.Create(orderPayment); // Update email invoice emailInvoice.OrderPaymentId = orderPaymentId; emailInvoice.Paid = true; emailInvoice.DatePaid = DateTime.Now; _emailInvoiceRepository.Update(emailInvoice); // Save to comment StringBuilder sb = new StringBuilder(); sb.AppendFormat("<b>{0}</b>", "Payment Complete"); string address = BuildEmailInvoiceBillingAddress(emailInvoice); string amount = string.Format("{0}{1:0.00}", emailInvoice.CurrencyCode, Math.Round(emailInvoice.Amount * emailInvoice.ExchangeRate, 2, MidpointRounding.AwayFromZero)); string message = string.Format("Payment Reference:<br/>{0}<br/><br/>Ammount:<br/>{1}<br/><br/>{2}", emailInvoice.PaymentRef, amount, address); _orderService.ProcessOrderCommentInsertion(emailInvoice.OrderId, emailInvoice.ProfileId, emailInvoice.FirstName, "Payment Complete", message, string.Empty); // Send confirmation email if needed if (sendEmailFlag) { _emailManager.SendPaymentInvoiceConfirmationEmail(emailInvoice.Email, emailInvoice.FirstName, amount); } } }
private void InvoiceSelected(InvoiceListItemView obj) { ActionPanels.Clear(); var invoiceActions = new InvoiceActionPanelViewFactory(obj); ActionPanels.Add(invoiceActions.CreateActionPanelView()); _invoiceListItemView = obj; PreviewInvoiceCommand.RaiseCanExecuteChanged(); PreviewSpecificationCommand.RaiseCanExecuteChanged(); CreditNoteCommand.RaiseCanExecuteChanged(); Recalculateinvoice.RaiseCanExecuteChanged(); EmailInvoice.RaiseCanExecuteChanged(); RegenerateFiles.RaiseCanExecuteChanged(); }
public void should_call_EmailInvoice() { //arrange var request = new EmailInvoice { Email = "*****@*****.**" }; //act var actual = Sut.EmailInvoice(TakeInvoice(), request); //assert Assert.AreEqual(200, actual.Code); Assert.IsEmpty(actual.Message); Assert.AreEqual("OK", actual.Status); }
public void should_call_EmailReceipt() { //arrange var request = new EmailInvoice { Email = "*****@*****.**" }; var customer = AddCustomer(); //act var actual = Sut.EmailReceipt(AddTransaction(customer), request); //assert Assert.AreEqual(200, actual.Code); Assert.IsEmpty(actual.Message); Assert.AreEqual("OK", actual.Status); }
private string BuildEmailInvoiceBillingAddress(EmailInvoice emailInvoice) { var sb = new StringBuilder(); sb.Append("Billing address:<br/>"); sb.AppendFormat("{0}<br/>", emailInvoice.BillTo); sb.AppendFormat("{0}<br/>", emailInvoice.AddressLine1); sb.AppendFormat("{0}<br/>", emailInvoice.AddressLine2); sb.AppendFormat("<br/>", emailInvoice.City); if (emailInvoice.USState != null) { sb.AppendFormat("{0}<br/>", emailInvoice.USState.State); } sb.AppendFormat("{0}<br/>", emailInvoice.PostCode); sb.AppendFormat("{0}<br/>", emailInvoice.Country.Name); return(sb.ToString()); }
private void RaiseSendEmailCanExecute() { EmailInvoice.RaiseCanExecuteChanged(); }
/// <summary> /// Email an invoice /// details: https://developer.chargeover.com/apidocs/rest/#email-an-invoice /// </summary> public ICustomResponse <bool> EmailInvoice(int invoiceId, EmailInvoice request) { return(new CustomResponse <bool>(Request <EmailInvoice, CustomChargeOverResponse <bool> >(MethodType.POST, $"/invoice/{invoiceId}?action=email", request))); }
/// <summary> /// Email a receipt /// details: https://developer.chargeover.com/apidocs/rest/#email-a-transaction /// </summary> public ICustomResponse <bool> EmailReceipt(int id, EmailInvoice request) { return(new CustomResponse <bool>(Request <EmailInvoice, CustomChargeOverResponse <bool> >(MethodType.POST, $"/transaction/{id}?action=email", request))); }