Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/core/authorizenet-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@ abstract class AuthorizenetBase extends AbstractPaymentProvider {
this.options_ = options;
this.logger = container.logger as Logger;
this.container_ = container;
// Accept both the correct 'environment' key and the legacy misspelled
// 'enviornment' (see #1) so existing configs keep working.
const envOption =
this.options_.environment ?? this.options_.enviornment;
this.solutionID =
this.options_.enviornment === "production" ? "AAA201051" : "AAA198606";
envOption === "production" ? "AAA201051" : "AAA198606";
}

static validateOptions(options: AuthorizenetOptions): void {
Expand Down Expand Up @@ -91,7 +95,10 @@ abstract class AuthorizenetBase extends AbstractPaymentProvider {
}
// START GENAI
private getEnvironment() {
return this.options_.enviornment === "production"
// Accept both 'environment' and the legacy misspelling 'enviornment' (#1).
const envOption =
this.options_.environment ?? this.options_.enviornment;
return envOption === "production"
? Constants.endpoint.production
: Constants.endpoint.sandbox;
}
Expand Down
5 changes: 5 additions & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ export interface Options {
api_login_id: string;
transaction_key: string;
capture?: boolean;
environment?: string;
/**
* @deprecated Typo preserved for backward compatibility. Use `environment`.
* Will be removed in a future major version.
*/
enviornment?: string;
}

Expand Down