После игры с образцом кода CIF XML API С# для авторизованного использования я начал использовать Authorize.Net С# SDK. Я могу добавить кредитные карты и банковские счета в профили клиентов, используя пример кода CIM XML API. Я не вижу, как добавить банковские счета, используя SDK, хотя.
Добавление банковского счета в XML-API CIM:
...
customerPaymentProfileType new_payment_profile = new customerPaymentProfileType();
paymentType new_payment = new paymentType();
bankAccountType new_bank = new bankAccountType();
new_bank.nameOnAccount = "xyz";
new_bank.accountNumber = "4111111";
new_bank.routingNumber = "325070760";
new_payment.Item = new_bank;
new_payment_profile.payment = new_payment;
createCustomerPaymentProfileRequest request = new createCustomerPaymentProfileRequest();
XmlAPIUtilities.PopulateMerchantAuthentication((ANetApiRequest)request);
request.customerProfileId = profile_id.ToString();
request.paymentProfile = new_payment_profile;
request.validationMode = validationModeEnum.testMode;
...
Используя SDK, я вижу только метод .AddCreditCard()
, но никак не могу добавить банковский счет. Когда я прохожу через все мои PaymentProfiles
, он выдает исключение, когда он встречается с банковским счетом:
CustomerGateway cg = new CustomerGateway("xxx", "yyy");
foreach (string cid in cg.GetCustomerIDs())
{
Customer c = cg.GetCustomer(cid);
foreach (PaymentProfile pp in c.PaymentProfiles)
{
Console.WriteLine(pp.ToString());
}
}
Исключение:
Unable to cast object of type 'AuthorizeNet.APICore.bankAccountMaskedType' to type 'AuthorizeNet.APICore.creditCardMaskedType'.
Как добавить банковскую учетную запись в профиль CIM с помощью SDK Authorize.Net С#?
Update:
Доказательство того, что CIM может хранить информацию о банковском счете: