我正在尝试使用 Authorize.Net CIM API 使用 GetCustomerPaymentProfile 检索付款信息。特别是,我需要屏蔽的信用卡号和信用卡类型或屏蔽的支票帐号。我已阅读 API 文档并遵循它,但没有智能感知,因此我的项目无法编译。
var data = Service.GetCustomerPaymentProfile(MerchantAuthentication, profileId, customerPaymentProfileId);
var creditCard = data.creditCard... (nothing here)
使用 C#,我将如何做到这一点?
编辑:看起来付款对象是动态的。这是我最终使用的代码。谢谢您的帮助!
if (data.paymentProfile.payment.Item.GetType() == typeof(CreditCardMaskedType))
{
var obj = (CreditCardMaskedType) data.paymentProfile.payment.Item;
retval.CreditCardNumber = obj.cardNumber;
retval.CreditCardType = obj.cardType;
}
if (data.paymentProfile.payment.Item.GetType() == typeof(BankAccountMaskedType))
{
var obj = (BankAccountMaskedType)data.paymentProfile.payment.Item;
retval.BankAccountNumber = obj.accountNumber;
retval.BankRoutingNumber = obj.routingNumber;
}