public PaymentResult ProcessPayment(BasePaymentData paymentData)
        {
            EftPaymentData eftPaymentData = paymentData as EftPaymentData;

            EftAuthorization eftResult = this.eftProcessor.AuthorizeEftPayment(eftPaymentData.RoutingNumber,
                                                                               eftPaymentData.BankAccountNumber, eftPaymentData.AccountType, eftPaymentData.Amount);

            if (eftResult.Authorized)
            {
                int referenceNumber = paymentsDao.SaveSuccessfulEftPayment(eftPaymentData, eftResult);

                PaymentResult paymentResult = new PaymentResult()
                {
                    CustomerAccountNumber = eftPaymentData.CustomerAccountNumber,
                    PaymentDate           = eftPaymentData.PaymentDate,
                    Success         = eftResult.Authorized,
                    ReferenceNumber = referenceNumber
                };

                return(paymentResult);
            }
            else
            {
                int referenceNumber = paymentsDao.SaveFailedEftPayment(eftPaymentData, eftResult);

                PaymentResult paymentResult = new PaymentResult()
                {
                    CustomerAccountNumber = eftPaymentData.CustomerAccountNumber,
                    PaymentDate           = eftPaymentData.PaymentDate,
                    Success         = eftResult.Authorized,
                    ReferenceNumber = referenceNumber
                };
                return(paymentResult);
            }
        }
示例#2
0
 public int SaveFailedEftPayment(EftPaymentData eftData, EftAuthorization result)
 {
     // This would save to a database
     return(25);
 }
示例#3
0
        public int SaveSuccessfulEftPayment(EftPaymentData eftData, EftAuthorization result)
        {
            // This would save to a database

            return(20);
        }