microsoft / microsoft/Dynamics365Commerce.Solutions

Payment Connector throws System.NullReferenceException when using CardPaymentManager with CommerceSDK

Open
#323 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
80
Forks
38
PR merge metrics
No merged PRs in 30d

Description

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.d__58.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Dynamics.Commerce.HardwareStation.CardPayment.CardPaymentManager.d__18.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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with PaymentDevice.cs at line 976 and trace the calls to CardPaymentManager.GetPaymentProcessor and LoadConnectors shown in the stack trace. Reproduce the CommerceSDK 9.47 payment-connector scenario if possible, then document the cause of the null reference and identify the supported CommerceSDK implementation or required library.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend, payments
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.