protected override PaymentResult ExecutePaymentProcess(BasePaymentData paymentData) { CreditCardPaymentData creditCardData = paymentData as CreditCardPaymentData; CreditCardResult authResult = this.creditCardService.AuthorizeCreditCard(creditCardData.CreditCardNumber, creditCardData.ExpirationDate, creditCardData.Cvv, creditCardData.BillingZipCode, creditCardData.Amount); if (authResult.Authorized == true) { int referenceNumber = paymentsDao.SaveSuccessfulCreditCardPayment(creditCardData, authResult); PaymentResult paymentResult = new PaymentResult() { CustomerAccountNumber = creditCardData.CustomerAccountNumber, PaymentDate = creditCardData.PaymentDate, Success = authResult.Authorized, ReferenceNumber = referenceNumber }; return(paymentResult); } else { int referenceNumber = paymentsDao.SaveFailedCreditCardPayment(creditCardData, authResult); PaymentResult paymentResult = new PaymentResult() { CustomerAccountNumber = creditCardData.CustomerAccountNumber, PaymentDate = creditCardData.PaymentDate, Success = authResult.Authorized, ReferenceNumber = referenceNumber }; return(paymentResult); } }
public int SaveFailedCreditCardPayment(CreditCardPaymentData creditCardData, CreditCardResult result) { // This would save to a database return(15); }
public int SaveSuccessfulCreditCardPayment(CreditCardPaymentData creditCardData, CreditCardResult result) { // This would save to a database return(10); }