Ejemplo n.º 1
0
        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");
            }
        }