Skip to content

Commit 8db0c07

Browse files
authored
Merge pull request #100 from AuthorizeNet/axios-fix
Updates to use new version of axios
2 parents 7a547fc + dbc0a0c commit 8db0c07

3 files changed

Lines changed: 56 additions & 10 deletions

File tree

README.md

Lines changed: 52 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,62 +4,78 @@
44
[![NPM version](https://badge.fury.io/js/authorizenet.png)](http://badge.fury.io/js/authorizenet)
55

66

7-
## Requirements
7+
## Requirements
8+
89
* Node.js version 14.x.x or higher
910
* An Authorize.Net account (see _Registration & Configuration_ section below)
1011

11-
### Contribution
12+
### Contribution
13+
1214
- If you need information or clarification about Authorize.Net features, create an issue with your question. You can also search the [Authorize.Net developer community](https://community.developer.authorize.net/) for discussions related to your question.
15+
1316
- Before creating pull requests, please read [the contributors guide](CONTRIBUTING.md).
1417

1518
### TLS 1.2
16-
The Authorize.Net APIs only support connections using the TLS 1.2 security protocol. Make sure to upgrade all required components to support TLS 1.2. Keep these components up to date to mitigate the risk of new security flaws.
1719

20+
The Authorize.Net APIs only support connections using the TLS 1.2 security protocol. Make sure to upgrade all required components to support TLS 1.2. Keep these components up to date to mitigate the risk of new security flaws.
1821

1922
## Installation
20-
To install AuthorizeNet
23+
24+
To install AuthorizeNet
2125

2226
`npm install authorizenet`
2327

2428

2529
## Registration & Configuration
30+
2631
Use of this SDK and the Authorize.Net APIs requires having an account on the Authorize.Net system. You can find these details in the Settings section.
32+
2733
If you don't currently have a production Authorize.Net account, [sign up for a sandbox account](https://developer.authorize.net/sandbox/).
2834

2935
### Authentication
36+
3037
To authenticate with the Authorize.Net API, use your account's API Login ID and Transaction Key. If you don't have these credentials, you can obtain them from our Merchant Interface site. For production accounts, the Merchant Interface is located at (https://account.authorize.net/); and for sandbox accounts, at (https://sandbox.authorize.net).
3138

3239
Once you have your keys simply load them into the appropriate variables in your code, as per the below sample code dealing with the authentication part of the API request.
3340

3441
#### To set your API credentials for an API request:
42+
3543
```javascript
3644
var merchantAuthenticationType = new ApiContracts.MerchantAuthenticationType();
3745
merchantAuthenticationType.setName('YOUR_API_LOGIN_ID');
3846
merchantAuthenticationType.setTransactionKey('YOUR_TRANSACTION_KEY');
3947
```
4048

4149
An authentication test sample is provided and can be run with the following command:
50+
4251
`node sample/test.js`
4352

4453
Never include your Login ID and Transaction Key directly in a file that's in a publicly accessible portion of your website. As a best practice, define the API Login ID and Transaction Key in a constants file, and reference those constants in the appropriate place in your code.
4554

4655
### Switching between the sandbox environment and the production environment
47-
Authorize.Net maintains a complete sandbox environment for testing and development purposes. The sandbox environment is an exact replica of our production environment, with simulated transaction authorization and settlement. By default, this SDK is configured to use with the sandbox environment. To switch to the production environment, call `setEnvironment` on the controller variable before execute. For example:
56+
57+
Authorize.Net maintains a complete sandbox environment for testing and development purposes. The sandbox environment is an exact replica of our production environment, with simulated transaction authorization and settlement. By default, this SDK is configured to use with the sandbox environment. To switch to the production environment, call `setEnvironment` on the controller variable before execute.
58+
59+
For example:
60+
4861
```javascript
49-
// For PRODUCTION use
50-
ctrl.setEnvironment(SDKConstants.endpoint.production);
62+
// For PRODUCTION use
63+
ctrl.setEnvironment(SDKConstants.endpoint.production);
5164
```
5265

5366
API credentials are different for each environment, so be sure to switch to the appropriate credentials when switching environments.
5467

5568

5669
## SDK Usage Examples and Sample Code
70+
5771
When using this SDK, downloading the Authorize.Net sample code repository is recommended.
72+
5873
* [Authorize.Net Node.js Sample Code Repository (on GitHub)](https://github.com/AuthorizeNet/sample-code-node)
5974

6075
The repository contains comprehensive sample code for all common uses of the Authorize.Net API:
6176

6277
The API Reference contains details and examples of the structure and formatting of the Authorize.Net API.
78+
6379
* [Developer Center API Reference](http://developer.authorize.net/api/reference/index.html)
6480

6581
Use the examples in the API Reference to determine which methods and information to include in an API request using this SDK.
@@ -69,6 +85,7 @@ Use the examples in the API Reference to determine which methods and information
6985
Use this method to authorize and capture a payment using a tokenized credit card number issued by Chase Pay. Chase Pay transactions are only available to merchants using the Paymentech processor.
7086

7187
The following information is required in the request:
88+
7289
- **payment token**
7390
- **expiration date**
7491
- **cryptogram** received from the token provider
@@ -77,6 +94,7 @@ The following information is required in the request:
7794
- **tokenRequestorEci**
7895

7996
When using the SDK to submit Chase Pay transactions, consider the following points:
97+
8098
- `tokenRequesterName` must be populated with **`”CHASE_PAY”`**
8199
- `tokenRequestorId` must be populated with the **`Token Requestor ID`** provided by Chase Pay services for each transaction during consumer checkout
82100
- `tokenRequesterEci` must be populated with the **`ECI Indicator`** provided by Chase Pay services for each transaction during consumer checkout
@@ -85,16 +103,42 @@ When using the SDK to submit Chase Pay transactions, consider the following poin
85103
## Building & Testing the SDK
86104

87105
### Running the SDK Tests
106+
88107
`mocha`
89108

90-
### Run Particular Tests
109+
### Run Particular Tests
110+
91111
`mocha test/<testfile>`
92112

113+
114+
### For using behind proxy
115+
116+
1. Create a `config` object as follows:
117+
```javascript
118+
config = {
119+
'proxy': {
120+
'setProxy': true,
121+
'proxyUrl': 'http://<username>:<password>@<proxyHost>:<proxyPort>'
122+
}
123+
}
124+
```
125+
126+
2. Pass this `config` object to the controller constructor.
127+
128+
For example,
129+
130+
```javascript
131+
var ctrl = new ApiControllers.CreateTransactionController(createRequest.getJSON(), config);
132+
```
133+
93134
### Testing Guide
135+
94136
For additional help in testing your own code, Authorize.Net maintains a [comprehensive testing guide](http://developer.authorize.net/hello_world/testing_guide/) that includes test credit card numbers to use and special triggers to generate certain responses from the sandbox environment.
95137

96138
### Transaction Hash Upgrade
139+
97140
Authorize.Net is phasing out the MD5 based `transHash` element in favor of the SHA-512 based `transHashSHA2`. The setting in the Merchant Interface which controlled the MD5 Hash option is no longer available, and the `transHash` element will stop returning values at a later date to be determined. For information on how to use `transHashSHA2`, see the [Transaction Hash Upgrade Guide] (https://developer.authorize.net/support/hash_upgrade/).
98141

99142
## License
143+
100144
This repository is distributed under a proprietary license. See the provided [`LICENSE.txt`](/LICENSE.txt) file.

lib/apicontrollersbase.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ class APIOperationBase {
1818
this._error = null;
1919
this._endpoint = constants.endpoint.sandbox;
2020

21+
if (externalConfig) config = externalConfig;
22+
2123
if (null == apiRequest)
2224
logger.error('Input request cannot be null');
2325

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "authorizenet",
3-
"version": "1.0.9",
3+
"version": "1.0.10",
44
"description": "nodejs sdk for Authorize.Net",
55
"main": "lib/authorizenet.js",
66
"directories": {
77
"test": "tests"
88
},
99
"dependencies": {
10-
"axios": "1.7.4",
10+
"axios": "1.8.3",
1111
"https-proxy-agent": "^7.0.0",
1212
"winston": "^3.11.0",
1313
"winston-daily-rotate-file": "^4.7.1"

0 commit comments

Comments
 (0)