Skip to content

Commit

Permalink
fix: handle null response from stored cards
Browse files Browse the repository at this point in the history
  • Loading branch information
mewajda committed Oct 27, 2021
1 parent 5c836e5 commit a8409e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Nixtus.Plugin.Payments.Nmi/Components/NmiViewComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private void PopulateStoredCards(PaymentInfoModel model)
if (response.IsSuccessStatusCode)
{
var nmiQueryResponse = DeserializeXml(response.Content.ReadAsStringAsync().Result);
if (nmiQueryResponse != null)
if (nmiQueryResponse?.CustomerVault != null)
{
foreach (var billing in nmiQueryResponse.CustomerVault.Customer.Billing ?? new List<Billing>())
{
Expand All @@ -88,6 +88,10 @@ private void PopulateStoredCards(PaymentInfoModel model)
});
}
}
else
{
_logger.Information("No saved cards where found in the response from NMI");
}
}

}
Expand Down
2 changes: 1 addition & 1 deletion Nixtus.Plugin.Payments.Nmi/NmiPaymentProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ public override void Install()
_localizationService.AddOrUpdatePluginLocaleResource("Plugins.Payments.Nmi.Fields.Password", "Password");
_localizationService.AddOrUpdatePluginLocaleResource("Plugins.Payments.Nmi.Fields.Password.Hint", "Password assigned to the merchant account");
_localizationService.AddOrUpdatePluginLocaleResource("Plugins.Payments.Nmi.Fields.SecurityKey", "Security Key");
_localizationService.AddOrUpdatePluginLocaleResource("Plugins.Payments.Nmi.Fields.SecurityKey.Hint", "API security key assigned to the merchant account, using this combined with username/password will result in an error");
_localizationService.AddOrUpdatePluginLocaleResource("Plugins.Payments.Nmi.Fields.SecurityKey.Hint", "API security key assigned to the merchant account, using this combined with username/password will result in an error. If you want to save cards, then select that checkbox and enter username/password");
_localizationService.AddOrUpdatePluginLocaleResource("Plugins.Payments.Nmi.Fields.CollectJsTokenizationKey", "Collect JS Tokenization Key");
_localizationService.AddOrUpdatePluginLocaleResource("Plugins.Payments.Nmi.Fields.CollectJsTokenizationKey.Hint", "Tokenization key used for Collect.js library");
_localizationService.AddOrUpdatePluginLocaleResource("Plugins.Payments.Nmi.Fields.TransactModeValues", "Transaction mode");
Expand Down

0 comments on commit a8409e3

Please sign in to comment.