private void buttonSubmit_Click(object sender, RoutedEventArgs e) { var customer = new Customer { Name = textBoxCustName.Text, Telephone = textBoxCustTel.Text }; var creditCard = new CreditCard { CardNum = textBoxCCNum.Text, Expiration = textBoxExpiration.Text }; try { bool success = MoneyService.Charge(customer, creditCard, decimal.Parse(textBoxAmount.Text)); if (success) { MainWindow.SuccessfulTransaction(); SmsService.SendSms(textBoxCustTel.Text, "Payment Successful: $"+textBoxAmount.Text); this.Close(); } } catch (Exception f) { MessageBox.Show(f.Message+"\n\n Please retry the transaction"); SmsService.SendSms(textBoxCustTel.Text, f.Message); } }
private void completeTransactionButton_Click(object sender, RoutedEventArgs e) { Customer customer = new Customer { name = nameTextBox.Text, phoneNumber = phoneNumberTextBox.Text }; CreditCard creditCard = new CreditCard { creditCardNumber = creditCardNumberTextBox.Text, expiryDateMonth = expiryMonthTextBox.Text, expiryDateYear = expiryYearTextBox.Text, securityCode = securityTextBox.Text }; try { bool success = MoneyService.Charge(customer, creditCard, decimal.Parse(amountTextBox.Text)); if (success) { MessageBox.Show("Payment from " + customer.name + " succesful."); MessageService.Text("You have received $" + amountTextBox.Text +" from " + customer.name + "."); } } catch (Exception error) { MessageBox.Show(error.Message); } }
private void buttonCharge_Click(object sender, RoutedEventArgs e) { Address shipping = new Address { Line1 = textBoxAddressLine1.Text, Line2 = textBoxAddressLine2.Text, Line3 = textBoxAddressLine3.Text, City = textBoxAddressCity.Text, State = textBoxAddressState.Text, Zipcode = textBoxAddressZipcode.Text }; var customer = new Customer { CustomerName = textBoxCustomerName.Text, CustomerTelephone = textBoxCustomerTelephone.Text, ShippingAddress = shipping }; var creditCard = new CreditCard { CreditCardNumber = textBoxCreditCardNumber.Text, CVC = textBoxCVC.Text, ExpiryDate = DateTime.Parse(textBoxExpiryDate.Text) }; bool success = MoneyServices.Charge(customer, creditCard, decimal.Parse(textBoxChargeAmount.Text)); string message = "Hi " + customer.CustomerName + "! Your transaction for $" + textBoxChargeAmount.Text + " has been approved. Your pokemon will be delivered to " + shipping.Line1 + shipping.Line2 + shipping.Line3 + shipping.City + shipping.State + shipping.Zipcode; SmsService.SendSMS("+17038640171", message); MessageBox.Show("Your purchase has been approved! Your confirmation will be sent to your phone."); }
private void TransactionButton_Click(object sender, RoutedEventArgs e) { var customer = new Customer { Name = CustomerBox.Text, Telephone = TelephoneBox.Text, }; var creditCard = new CreditCard { CardNumber = CardNumberBox.Text, SecurityCode = SCodeBox.Text, ExpiryDate = DateTime.Parse(ExpiryBox.Text), }; try { bool success = MoneyService.Charge(customer, creditCard, decimal.Parse(CreditBox.Text)); if (success) { MessageBox.Show("Payment successful!"); SmsService.SendSms($"+1{TelephoneBox.Text}", $"Payment successful! You have paid {CreditBox.Text} dollars via your card."); } else { MessageBox.Show("Payment not successful."); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button_Click(object sender, RoutedEventArgs e) { var customer = new Customer { Name = textBoxCustomerName.Text, Telephone = textBoxCustomerPhone.Text }; var creditCard = new CreditCard { CardNumber = textBoxCreditCard.Text, Cvc = textBoxSecurityCode.Text, ExpireyDate = DateTime.Parse(textBoxExpireyDate.Text), }; bool success = MoneyService.Charge(customer, creditCard, decimal.Parse(textBoxAmount.Text)); if(success) { SmsService.SendSms("+18184348962", "Payment Successful"); MessageBox.Show("Payment Successful"); } else { SmsService.SendSms("+18184348962", "Payment Unsuccessful"); MessageBox.Show("Payment Unsuccessful"); } }
private void button_Click(object sender, RoutedEventArgs e) { var customer = new Customer { FirstName = textBoxFirstName.Text, LastName = textBoxLastName.Text, PhoneNumber = textBoxTelephone.Text }; var creditCard = new CreditCard { CardNumber = passwordBox.Password, Cvc = textBoxCvc.Text, ExpirationDate = DateTime.Parse(textBoxExpiration.Text) }; try { bool success = TransactionService.Charge(customer, creditCard, decimal.Parse(textBoxAmount.Text)); if (success) { MessageBox.Show("Transaction successful."); var message = "\n" + "Your transaction was successful for the amount $" + decimal.Parse(textBoxAmount.Text); SendSms.SendMessage(textBoxTelephone.Text, message); textBoxAmount.Clear(); textBoxCvc.Clear(); textBoxExpiration.Clear(); textBoxFirstName.Clear(); textBoxLastName.Clear(); textBoxTelephone.Clear(); passwordBox.Clear(); } else { MessageBox.Show("Transaction unsuccessful."); var message = "\n" + "Your transaction was unsuccessful."; SendSms.SendMessage(textBoxTelephone.Text, message); } } catch (Exception exception) { MessageBox.Show(exception.Message); var message = "\n" + "Your transaction was unsuccessful. \n" + exception.Message; SendSms.SendMessage(textBoxTelephone.Text, message); } }