} // PayUsingCreditCard() /// <summary> /// This method provides functionality to pay a statement using /// a pinless debit card as the method of payment. /// </summary> /// <param name="debitCardNumber"> /// The customer debit card number used to pay the bill. /// </param> /// <param name="nameOnCard"> /// The name on the customer debit card. /// </param> /// <param name="amount"> /// The amount to be paid to the customer service account. /// </param> /// <returns> /// A payment receipt instance is returned with the results from /// the requested payment. /// </returns> public PaymentReceipt PayUsingPinlessDebitCard( [RequiredItem()][RegEx(@"^\d{12,19}$", RegexOptions.None)] string debitCardNumber, [RequiredItem()][StringLength(1, 32)] string nameOnCard, [RequiredItem()][DoubleRange(0.00, 9999999.99)] double amount) { BillingLogEntry logEntry = new BillingLogEntry( eBillingActivityType.PayPinlessDebit, this.m_can.AccountNumber16, amount); using (Log log = CreateLog(logEntry)) { try { MethodValidator validator = new MethodValidator( MethodBase.GetCurrentMethod(), debitCardNumber, nameOnCard, amount); validator.Validate(); // See if debit card number exists in BIN file. // If not, it's invalid...need to throw an // exception. if (!_IsDebitCardNumberValid(debitCardNumber)) { throw new InvalidDebitCardNumberException(__debitCardNotFoundInBinFileMessage); } // Debit card validation logEntry.PaymentType = ePaymentType.PinlessDebit; // set the siteId information logEntry.SiteId = SiteId; // Set to false since it's a pinless debit transaction checkNSFStatus(false); // Create a DAL to transalate Mop codes DalMethodOfPayment dal = new DalMethodOfPayment(); DalPaymentReceipt dalPaymentReceipt = new DalPaymentReceipt(); string paymentReceiptType = dalPaymentReceipt.GetPaymentReceiptType(_userId); paymentReceiptType = paymentReceiptType == string.Empty?CmConstant.kstrDefaultReceiptType:paymentReceiptType; // assure that the length of the customer name does NOT exceed 32 characters! if (nameOnCard.Length >= 32) { nameOnCard = nameOnCard.Substring(0, 31); } // Build input elements Request.INL00072 inl72 = new INL00072Helper( amount, amount, CmConstant.kstrNegative, debitCardNumber, nameOnCard, __icomsSpecialDate, dal.GetMopByUserPaymentType(UserName, (int)ePaymentType.PinlessDebit), CmConstant.kstrNegative, m_can.StatementCode, paymentReceiptType, CmConstant.kstrDefaultWorkstation); Request.MAC00027 mac27 = new Mac00027Helper( SiteId.ToString(), m_can.AccountNumber9, CmConstant.kstrDefaultTaskCode, inl72); // Use inherited functions to get a response Response.MAC00027 mac27Response = (Response.MAC00027) this.Invoke((Request.MAC00027)mac27); Response.INL00072 inl72Response = mac27Response.Items[0] as Response.INL00072; int intErrorCode = toInt32(inl72Response.IGIRTRNCODE); if (intErrorCode > 0) { throw TranslateCmException( intErrorCode, string.Format("Authorization failed with error - ErrorCode: {0} ErrorText: {1}", inl72Response.IGIRTRNCODE, inl72Response.IGIMESGTEXT), null); } PaymentReceipt rcpt = new PaymentReceipt(); rcpt.AccountNumber16 = m_can.AccountNumber16; rcpt.AmountPaid = (inl72Response.AMNTTOAPLY.Length > 0) ? Double.Parse(inl72Response.AMNTTOAPLY): 0.00; rcpt.PaymentType = (ePaymentType) new MopPaymentType(this.UserName, inl72Response.MTHDOFPAYCODE); rcpt.Status = ePaymentStatus.Success; rcpt.TransactionDate = new IcomsDate(inl72Response.ATHRZTNDATE).Date; return(rcpt); } catch (BusinessLogicLayerException blle) { //the dal threw an exception logEntry.SetError(blle.Message); throw; } catch (DataSourceException excDSE) { //the dal threw an exception logEntry.SetError(excDSE.Message); throw new DataSourceUnavailableException(excDSE); } catch (CmErrorException excCm) { logEntry.SetError(excCm.Message, excCm.ErrorCode); throw TranslateCmException(excCm); } catch (Exception exc) { logEntry.SetError(exc.Message); throw; } } }
} // PayUsingElectronicCheck() /// <summary> /// This method provides functionality to pay a statement using /// a credit card as the method of payment. /// </summary> /// <param name="strCreditCardNumber"> /// Thie customer credit card number used to pay the bill. /// </param> /// <param name="strNameOnCard"> /// The name on the customer credit card. /// </param> /// <param name="strExpirationDate"> /// The expiration date of the customer credit card. /// </param> /// <param name="dblAmount"> /// The amount to be paid to the customer service account. /// </param> /// <returns> /// A payment receipt instance is returned with the results from /// the requested payment. /// </returns> public PaymentReceipt PayUsingCreditCard( [RequiredItem()][CreditCardNumberAttribute()] string strCreditCardNumber, [RequiredItem()] string strNameOnCard, [RequiredItem()][ValidCCDate()] string strExpirationDate, [RequiredItem()][DoubleRange(0.00, 9999999.99)] double dblAmount) { BillingLogEntry logEntry = new BillingLogEntry( eBillingActivityType.PayCredit, this.m_can.AccountNumber16, dblAmount); using (Log log = CreateLog(logEntry)) { try { MethodValidator validator = new MethodValidator(MethodBase.GetCurrentMethod(), strCreditCardNumber, strNameOnCard, strExpirationDate, dblAmount); validator.Validate(); // convert the accountNumber. CreditCardNumber creditCardNumber = (CreditCardNumber)TypeDescriptor.GetConverter( typeof(CreditCardNumber)).ConvertFrom(strCreditCardNumber); // Credit card validation logEntry.PaymentType = creditCardNumber.PaymentType; DateTime dttmExpirationDate = ValidCCDateAttribute.ToDate(strExpirationDate); // set the siteId information logEntry.SiteId = SiteId; checkNSFStatus(true); // Create a DAL to transalate Mop codes DalMethodOfPayment dal = new DalMethodOfPayment(); DalPaymentReceipt dalPaymentReceipt = new DalPaymentReceipt(); string paymentReceiptType = dalPaymentReceipt.GetPaymentReceiptType(_userId); paymentReceiptType = paymentReceiptType == string.Empty?CmConstant.kstrDefaultReceiptType:paymentReceiptType; PaymentReceipt rcpt = new PaymentReceipt(); // assure that the length of the customer name does NOT exceed 32 characters! if (strNameOnCard.Length >= 32) { strNameOnCard = strNameOnCard.Substring(0, 31); } // Build input elements Request.INL00072 inl72 = new INL00072Helper( dblAmount, dblAmount, CmConstant.kstrNegative, creditCardNumber.AccountNumber, strNameOnCard, dttmExpirationDate, dal.GetMopByUserPaymentType(UserName, (int)creditCardNumber.PaymentType), CmConstant.kstrNegative, m_can.StatementCode, paymentReceiptType, CmConstant.kstrDefaultWorkstation); Request.MAC00027 mac27 = new Mac00027Helper( SiteId.ToString(), m_can.AccountNumber9, CmConstant.kstrDefaultTaskCode, inl72); // Use inherited functions to get a response Response.MAC00027 mac27Response = (Response.MAC00027) this.Invoke((Request.MAC00027)mac27); Response.INL00072 inl72Response = mac27Response.Items[0] as Response.INL00072; int intErrorCode = toInt32(inl72Response.IGIRTRNCODE); if (intErrorCode > 0) { throw TranslateCmException( intErrorCode, string.Format("Authorization failed with error - ErrorCode: {0} ErrorText: {1}", inl72Response.IGIRTRNCODE, inl72Response.IGIMESGTEXT), null); } rcpt.AccountNumber16 = m_can.AccountNumber16; rcpt.AmountPaid = (inl72Response.AMNTTOAPLY.Length > 0) ? Double.Parse(inl72Response.AMNTTOAPLY): 0.00; rcpt.PaymentType = (ePaymentType) new MopPaymentType(this.UserName, inl72Response.MTHDOFPAYCODE); rcpt.Status = ePaymentStatus.Success; rcpt.TransactionDate = new IcomsDate(inl72Response.ATHRZTNDATE).Date; return(rcpt); } // try catch (BusinessLogicLayerException blle) { //the dal threw an exception logEntry.SetError(blle.Message); throw; } catch (DataSourceException excDSE) { //the dal threw an exception logEntry.SetError(excDSE.Message); throw new DataSourceUnavailableException(excDSE); } catch (CmErrorException excCm) { logEntry.SetError(excCm.Message, excCm.ErrorCode); throw TranslateCmException(excCm); } // catch( CmErrorException excCm ) catch (Exception exc) { logEntry.SetError(exc.Message); throw; } // catch( Exception exc ) } // using( Log log = CreateLog( logEntry ) ) } // PayUsingCreditCard()