Skip to content

Authorize.Net Refactoring#3

Merged
StanislavSmetaninSSM merged 17 commits into
mainfrom
ssm/27013-authorize_net_refactoring
Mar 11, 2026
Merged

Authorize.Net Refactoring#3
StanislavSmetaninSSM merged 17 commits into
mainfrom
ssm/27013-authorize_net_refactoring

Conversation

@StanislavSmetaninSSM

@StanislavSmetaninSSM StanislavSmetaninSSM commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

The task is to make the Authorize.Net version workable in the DW10.

What was did:

Refactoring: The codebase was fully refactored to align with the DW10 architecture.

Webhooks Integration: Added comprehensive webhook support. The provider interface now includes two new options:

Enable auto webhook registration: Webhooks are automatically registered during the first checkout transaction.
Force webhook re-registration: Resets existing webhook notifications associated with the current site URL and triggers a fresh registration. This setting automatically unchecks itself once the process is complete.

image

Security & Cleanup: Removed legacy settings for various checkout form templates. The integration now exclusively uses the Authorize.Net Hosted Payment Form, ensuring a more secure and standardized checkout process.

NOTE: The webhooks support is mandatory for this provider! It doesn't set the transaction number after redirect user back to DW site, so the only way to set it is a webhook notification!

The original task: https://dev.azure.com/dynamicwebsoftware/Dynamicweb/_workitems/edit/27013

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR is a comprehensive refactoring of the Authorize.Net checkout handler to align with the DW10 architecture. It replaces legacy model classes (in src/Model/, src/Enum/, src/API/) with properly structured models using DataContract/DataMember serialization, introduces a service layer architecture, and adds webhook support for transaction notifications.

Changes:

  • Replaced legacy plain model/enum/API classes with PascalCase-named models using DataContract attributes, organized under src/Models/, src/Helpers/, src/Constants/, src/Services/, and src/Exceptions/ directories.
  • Added comprehensive webhook management support including registration, update, deletion, and event type validation through AuthorizeNetService and related webhook models.
  • Introduced security helpers (HMAC validation, sensitive data masking), a structured logging system (AuthorizeNetLogger, AuthorizeNetRequestLogger), and organized constants for endpoints, response codes, and security settings.

Reviewed changes

Copilot reviewed 210 out of 212 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/Dynamicweb.Ecommerce.CheckoutHandlers.AuthorizeNetApi.csproj Updated package versions, tags, copyright year, and added package icon
src/Services/AuthorizeNetService.cs New core service handling Authorize.Net API interactions (payments, profiles, webhooks)
src/Services/AuthorizeNetHttpService.cs New HTTP service wrapping HttpClient for API communication
src/Services/AuthorizeNetLogger.cs New structured logger for Authorize.Net operations
src/Helpers/AuthorizeNetModelFactory.cs New factory for creating billing/shipping address and line item models from orders
src/Helpers/*.cs Various new helpers: security, HMAC, string manipulation, amount rounding, enum conversion
src/Models/*.cs ~60+ new model classes replacing legacy models with proper DataContract serialization
src/Constants/*.cs New constants for endpoints, response codes, security settings, template folders, tags
src/Exceptions/AuthorizeNetApiException.cs New custom exception for API errors
src/Model/*.cs (deleted) Removed all legacy model classes
src/Enum/*.cs (deleted) Removed all legacy enum classes
src/API/*.cs (deleted) Removed all legacy API classes
src/Helper.cs (deleted) Removed legacy monolithic helper class

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Helpers/AuthorizeNetModelFactory.cs Outdated
Comment thread src/Services/AuthorizeNetHttpService.cs Outdated
Comment thread src/Services/AuthorizeNetLogger.cs

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 210 out of 212 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Services/AuthorizeNetService.cs Outdated
Comment thread src/Models/Messages.cs Outdated
Comment thread src/Constants/PreparedMessages.cs Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 209 out of 211 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Services/AuthorizeNetHttpService.cs Outdated
Comment thread src/Models/NotificationPayload.cs Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 209 out of 211 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Helpers/SecurityHelper.cs
Comment thread src/Models/NotificationEventType.cs Outdated
1) Made NotificationEventType internal
2) Removed from SecuritySettings the MinSecureKeyLength - the AuthorizeNet will check it by itself and send an error if needed.
3)  Added check for signatureKey in the ValidateSecurityConfiguration function

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 209 out of 211 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@MatthiasSort

Copy link
Copy Markdown

I've had some chats with AI.

Main areas to watch in QA:
• webhook/order correlation
• webhook retry behavior under slow or failing back-end processing
• fraud/held-for-review event handling
• auto-registration behavior on already-configured merchants
• saved card flows and refund/capture edge cases

@StanislavSmetaninSSM StanislavSmetaninSSM merged commit 1dc0c1b into main Mar 11, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants