fix(core): honor correctly-spelled 'environment' option (with back-compat)#2
Open
MukundaKatta wants to merge 1 commit intoAuthorizeNet:mainfrom
Open
Conversation
…mpat for 'enviornment') Per AuthorizeNet#1, the authorizenet-base code read options.enviornment (typo — missing 'n' before 'i'), but the correctly-spelled 'environment' key passed in medusa-config.ts was silently ignored. Merchants setting environment: 'production' were hitting the sandbox endpoint, which rejects live Accept.js nonces — orders created, payment never captured. This PR: - Adds an 'environment?' field to Options (canonical spelling). - Keeps the legacy 'enviornment?' field, marked @deprecated, so existing configs continue to work without breaking. - Both call sites (solutionID init, getEnvironment()) now read the correct key first, falling back to the legacy one. Closes AuthorizeNet#1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Per #1, `authorizenet-base.ts` reads `options.enviornment` (typo — missing `n` before `i`), so a Medusa config that sets the canonical `environment: "production"` is silently treated as sandbox. Live Accept.js nonces are rejected by sandbox, orders get created but payment is never captured — a real production-mode bug.
Non-breaking fix:
Existing merchants who currently use the `enviornment` workaround keep working; anyone using the documented `environment` field starts behaving correctly.
Closes #1
Testing