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
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
CHANGELOG
=========

9.3.0 (unreleased)
------------------

* Updated the documentation for the email and phone verification inputs. Set
`wasVerificationSuccessful` and `phoneWasVerificationSuccessful` to `true`
if your system considers the email address or phone number verified as of
the time of the event. Set them to `false` if it is not verified, for
example if its only verification is pending or failed. If your system does
not track verification, leave them unset. Set a verification time only when
the value is `true`.
* Exported the request property types from the package root: `AccountProps`,
`CreditCardProps`, `DeviceProps`, `EmailProps`, `EventProps`,
`LocationProps`, `OrderProps`, `PaymentProps`, `ShippingProps`,
`ShoppingCartItemProps`, `TransactionProps`, and `TransactionReportProps`.
The API documentation now shows the descriptions of the request properties
that inherit them from these types.
* The package now keeps the documentation comments in its type declarations,
so editors show them.

9.2.1 (2026-11-18)
------------------

Expand Down
2 changes: 1 addition & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export enum DeliverySpeed {
export enum PhoneVerificationMethod {
/**
* A one-time code delivered to the phone number by SMS, an automated voice
* call, or a messaging app, and entered by the user.
* call, or a messaging app, for the user to enter.
*/
DeliveredCode = 'delivered_code',
/**
Expand Down
12 changes: 12 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ export {
WebServiceError,
};

export type { AccountProps } from './request/account.js';
export type { CreditCardProps } from './request/credit-card.js';
export type { DeviceProps } from './request/device.js';
export type { EmailProps } from './request/email.js';
export type { EventProps } from './request/event.js';
export type { LocationProps } from './request/location.js';
export type { OrderProps } from './request/order.js';
export type { PaymentProps } from './request/payment.js';
export type { ShippingProps } from './request/shipping.js';
export type { ShoppingCartItemProps } from './request/shopping-cart-item.js';
export type { TransactionProps } from './request/transaction.js';
export type { TransactionReportProps } from './request/transaction-report.js';
export type {
ClientErrorCode,
WebServiceClientError,
Expand Down
2 changes: 1 addition & 1 deletion src/request/account.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import crypto from 'node:crypto';

interface AccountProps {
export interface AccountProps {
/**
* A unique user ID associated with the end-user in your system. If your
* system allows the login name for the account to be changed, this should
Expand Down
2 changes: 1 addition & 1 deletion src/request/device.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { isIP } from 'node:net';
import { ArgumentError } from '../errors.js';

interface DeviceProps {
export interface DeviceProps {
/**
* The IP address associated with the device used by the customer in the
* transaction.
Expand Down
36 changes: 17 additions & 19 deletions src/request/email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const isEmail = (value: string): boolean => {
return match !== null && isFQDN(match[2]);
};

interface EmailProps {
export interface EmailProps {
/**
* The email address used in the transaction.
*/
Expand All @@ -53,16 +53,23 @@ interface EmailProps {
*/
hashAddress?: boolean;
/**
* The date and time of the most recent attempt to verify the email address,
* if known. The time must not be before 1970-01-01T00:00:00Z or more than two
* days in the future. The web service ignores a time outside this range and
* returns a warning.
* The date and time that the end user completed the most recent verification
* of the email address, if known. Set this only if
* `wasVerificationSuccessful` is `true`. The time must not be before
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
* 1970-01-01T00:00:00Z or more than two days in the future. The web service
* ignores a time outside this range and returns a warning.
*/
verificationTime?: Date;
/**
* Whether the most recent verification that the end user controls the email
* address succeeded, for example by confirming a link sent to the address.
* Omit this if no verification was attempted.
* Whether the end user has verified that they control the email address, as
* of the time of the event, for example by confirming a link sent to the
* address. Set this to `true` if your system considers the email address
* verified as of the time of the event. An earlier completed verification
* still counts, even if a newer attempt is pending or failed. Set it to
* `false` if the email address is not verified. This includes one whose only
* verification is pending or failed, and one that you did not try to verify.
* Omitting this is not equivalent to `false`. If your system does not track
* email verification, omit this.
*/
wasVerificationSuccessful?: boolean;
}
Expand All @@ -78,18 +85,9 @@ export default class Email implements EmailProps {
public address?: string;
/** @inheritDoc EmailProps.domain */
public domain?: string;
/**
* The date and time of the most recent attempt to verify the email address,
* if known. The time must not be before 1970-01-01T00:00:00Z or more than two
* days in the future. The web service ignores a time outside this range and
* returns a warning.
*/
/** @inheritDoc EmailProps.verificationTime */
public verificationTime?: Date;
/**
* Whether the most recent verification that the end user controls the email
* address succeeded, for example by confirming a link sent to the address.
* Omit this if no verification was attempted.
*/
/** @inheritDoc EmailProps.wasVerificationSuccessful */
public wasVerificationSuccessful?: boolean;

private static readonly typoDomains: { [key: string]: string } = {
Expand Down
2 changes: 1 addition & 1 deletion src/request/event.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { EventParty, EventType } from '../constants.js';
import { assertValidDate } from '../utils.js';

interface EventProps {
export interface EventProps {
/**
* The party submitting the transaction.
*/
Expand Down
24 changes: 17 additions & 7 deletions src/request/location.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,29 @@ export interface LocationProps {
*/
phoneCountryCode?: string;
/**
* The most recent method used to verify the phone number.
* The method used for the most recent completed verification of the phone
* number. If the phone number is not verified, you can set the method of the
* most recent attempt if your system records it. Do not set this if you did
* not try to verify the phone number.
*/
phoneVerificationMethod?: PhoneVerificationMethod;
/**
* The date and time of the most recent verification of the phone number.
* The time must not be before 1970-01-01T00:00:00Z or more than two days in
* the future. The web service ignores a time outside this range and returns
* a warning.
* The date and time that the end user completed the most recent verification
* of the phone number, if known. Set this only if
* `phoneWasVerificationSuccessful` is `true`. The time must not be before
* 1970-01-01T00:00:00Z or more than two days in the future. The web service
* ignores a time outside this range and returns a warning.
*/
phoneVerificationTime?: Date;
/**
* Whether the most recent verification of the phone number succeeded. Omit
* this if no verification was attempted.
* Whether the end user has verified that they control the phone number, as of
* the time of the event. Set this to `true` if your system considers the
* phone number verified as of the time of the event. An earlier completed
* verification still counts, even if a newer attempt is pending or failed.
* Set it to `false` if the phone number is not verified. This includes one
* whose only verification is pending or failed, and one that you did not try
* to verify. Omitting this is not equivalent to `false`. If your system does
* not track phone verification, omit this.
*/
phoneWasVerificationSuccessful?: boolean;
}
Expand Down
2 changes: 1 addition & 1 deletion src/request/order.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { isIP } from 'node:net';
import { ArgumentError } from '../errors.js';

interface OrderProps {
export interface OrderProps {
/**
* The total order amount for the transaction.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/request/payment.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PaymentMethod, Processor } from '../constants.js';

interface PaymentProps {
export interface PaymentProps {
/**
* The payment method associated with the transaction.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/request/shipping.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DeliverySpeed } from '../constants.js';
import Location, { LocationProps } from './location.js';

interface ShippingProps extends LocationProps {
export interface ShippingProps extends LocationProps {
/**
* The shipping delivery speed for the order.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/request/shopping-cart-item.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ArgumentError } from '../errors.js';

interface ShoppingCartItemProps {
export interface ShoppingCartItemProps {
/**
* The category of the item.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/request/transaction-report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Tag } from '../constants.js';
import { ArgumentError } from '../errors.js';
import { snakecaseKeys } from '../utils.js';

interface TransactionReportProps {
export interface TransactionReportProps {
/**
* A string which is provided by your payment processor indicating the
* reason for the chargeback.
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"moduleResolution": "NodeNext",
"outDir": "dist",
"pretty": true,
"removeComments": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
Expand Down