microsoft / Dynamics365Commerce.Solutions

Repository for hosting the Dynamics 365 Commerce end to end sample solutions
Other
58 stars 26 forks source link

Payment Connector throws System.NullReferenceException when using CardPaymentManager with CommerceSDK #323

Open ja1m1n8hatt opened 1 month ago

ja1m1n8hatt commented 1 month ago

Other Development Issue

Summary

Describe the issue We have a Payment Connector that works with RetailSDK in our current implementation. We have migrated the source code to CommerceSDK and are able to compile successfully. This payment connector uses Microsoft.Dynamics.Commerce.HardwareStation.CardPayment.CardPaymentManager.GetPaymentProcessor during BeginTransactionAsync in PaymentDevice implementation. It also uses this library in other Payment Device methods. The CardPaymentManager is not available as a part of the CommerceSDK nuget packages, however, we were able to locate it within RetailSDK local nuget references and import them to build successfully. When executing the Store Commerce App, it throws the null reference exception. Please see full trace below. Most documentation for payment connector still points to RetailSDK and there are not enough samples or documentation for CommerceSDK for payment connectors. We would like to know why CardPaymentManager is throwing errors and if there is an alternate implementation or library that needs to be used with CommerceSDK.

Version and Error Info Commerce SDK Component: Payment Connector Component Version: Commerce SDK Version: 9.47 Exception/Error Details:

System.NullReferenceException HResult=0x80004003 Message=Object reference not set to an instance of an object. Source=Microsoft.Dynamics.Commerce.HardwareStation.CardPayment StackTrace: at Microsoft.Dynamics.Commerce.HardwareStation.CardPayment.CardPaymentManager.d58.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Dynamics.Commerce.HardwareStation.CardPayment.CardPaymentManager.d18.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult() at DXC.PaymentConnector.VerifoneSCA.PaymentDevice.d__68.MoveNext() in C:\DXXXXXTS\EXS\src\EXS\DXX.PaymentConnector.VerifoneSCA\DXX.PaymentConnector.VerifoneSCA.PaymentDevice\PaymentDevice.cs:line 976

This exception was originally thrown at this call stack: Microsoft.Dynamics.Commerce.HardwareStation.CardPayment.CardPaymentManager.LoadConnectors(Microsoft.Dynamics.Commerce.Runtime.RequestContext, System.Collections.Generic.List) Microsoft.Dynamics.Commerce.HardwareStation.CardPayment.CardPaymentManager.GetPaymentProcessor(Microsoft.Dynamics.Retail.PaymentSDK.Portable.PaymentProperty[], string, Microsoft.Dynamics.Commerce.Runtime.RequestContext) DXX.PaymentConnector.VerifoneSCA.PaymentDevice.BeginTransactionAsync(Microsoft.Dynamics.Commerce.HardwareStation.BeginTransactionPaymentTerminalDeviceRequest, Microsoft.Dynamics.Retail.PaymentSDK.Portable.PaymentProperty[], string, string, bool) in PaymentDevice.cs

Reproducing the Issue

Link to GitHub repo/solution where the issue is reproducible: GitHub samples for payment device sample do not contain the extent of code that can be used to reproduce a real life payment device interaction. Please provide guidance on what further data or information I can provide to assist.

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Run command '....'
  4. See error

Screenshots

Please include any screenshots that would help us understand the issue.