diff --git a/CHANGELOG.md b/CHANGELOG.md index 4188e466..80c9b354 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ CHANGELOG ========= +5.1.0 (2023-08-10) +------------------ + +* Add `host` parameter to `Client` constructor to allow for use of the + Sandbox environment. + 5.0.0 (2023-05-16) ------------------ diff --git a/README.md b/README.md index 54d451c0..c2fba8b3 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,13 @@ takes your MaxMind account ID and license key. For example: const client = new minFraud.Client("1234", "LICENSEKEY"); ``` +If you would like to use the Sandbox environment, you can +set the `host` parameter to `sandbox.minfraud.com`: + +```js +const client = new minFraud.Client("1234", "LICENSEKEY", 3000, 'sandbox.minfraud.com'); +``` + Then create a new `Transaction` object. This represents the transaction that you are sending to minFraud. Each transaction property is instantiated by creating a new instance of each property's class. For example: diff --git a/src/webServiceClient.ts b/src/webServiceClient.ts index 95ab3d89..ca546ed8 100644 --- a/src/webServiceClient.ts +++ b/src/webServiceClient.ts @@ -19,11 +19,16 @@ export default class WebServiceClient { private licenseKey: string; private timeout: number; - public constructor(accountID: string, licenseKey: string, timeout = 3000) { + public constructor( + accountID: string, + licenseKey: string, + timeout = 3000, + host = 'minfraud.maxmind.com' + ) { this.accountID = accountID; this.licenseKey = licenseKey; this.timeout = timeout; - this.host = 'minfraud.maxmind.com'; + this.host = host; } public factors(transaction: Transaction): Promise {