本文整理汇总了C#中Payment.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Payment.GetType方法的具体用法?C# Payment.GetType怎么用?C# Payment.GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Payment
的用法示例。
在下文中一共展示了Payment.GetType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PostProcessPayment
/// <summary>
/// Pres the process payment. Unencrypts the data if needed.
/// </summary>
private void PostProcessPayment(Payment payment)
{
// We only care about credit cards here, all other payment types should be encrypted by default
if (payment.GetType() == typeof(CreditCardPayment))
{
// for partial type, remove everything but last 4 digits
if (OrderConfiguration.Instance.SensitiveDataMode == SensitiveDataPersistance.Partial)
{
string ccNumber = ((CreditCardPayment)payment).CreditCardNumber;
if (!String.IsNullOrEmpty(ccNumber) && ccNumber.Length > 4)
{
ccNumber = ccNumber.Substring(ccNumber.Length - 4);
((CreditCardPayment)payment).CreditCardNumber = ccNumber;
}
}
else if (OrderConfiguration.Instance.SensitiveDataMode == SensitiveDataPersistance.DoNotPersist)
{
((CreditCardPayment)payment).CreditCardNumber = String.Empty;
}
// Always remove pin
((CreditCardPayment)payment).CreditCardSecurityCode = String.Empty;
}
}