diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f4dabeb..23fd7186 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) ------------------ diff --git a/src/constants.ts b/src/constants.ts index a73a6f79..0addccf9 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -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', /** diff --git a/src/index.ts b/src/index.ts index 993522bb..1572120c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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, diff --git a/src/request/account.ts b/src/request/account.ts index db02c5de..ab200050 100644 --- a/src/request/account.ts +++ b/src/request/account.ts @@ -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 diff --git a/src/request/device.ts b/src/request/device.ts index 3964c575..394ad29b 100644 --- a/src/request/device.ts +++ b/src/request/device.ts @@ -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. diff --git a/src/request/email.ts b/src/request/email.ts index 7e0f51ef..41dcf7d8 100644 --- a/src/request/email.ts +++ b/src/request/email.ts @@ -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. */ @@ -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 + * 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; } @@ -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 } = { diff --git a/src/request/event.ts b/src/request/event.ts index fc75648a..6789c15c 100644 --- a/src/request/event.ts +++ b/src/request/event.ts @@ -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. */ diff --git a/src/request/location.ts b/src/request/location.ts index d14db010..d8abb0b0 100644 --- a/src/request/location.ts +++ b/src/request/location.ts @@ -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; } diff --git a/src/request/order.ts b/src/request/order.ts index 48fdf3e9..a950ec4d 100644 --- a/src/request/order.ts +++ b/src/request/order.ts @@ -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. */ diff --git a/src/request/payment.ts b/src/request/payment.ts index 3e874f7b..4fc7e707 100644 --- a/src/request/payment.ts +++ b/src/request/payment.ts @@ -1,6 +1,6 @@ import { PaymentMethod, Processor } from '../constants.js'; -interface PaymentProps { +export interface PaymentProps { /** * The payment method associated with the transaction. */ diff --git a/src/request/shipping.ts b/src/request/shipping.ts index 36697cef..edc4ffe5 100644 --- a/src/request/shipping.ts +++ b/src/request/shipping.ts @@ -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. */ diff --git a/src/request/shopping-cart-item.ts b/src/request/shopping-cart-item.ts index 39cf2c38..eb8ae9e3 100644 --- a/src/request/shopping-cart-item.ts +++ b/src/request/shopping-cart-item.ts @@ -1,6 +1,6 @@ import { ArgumentError } from '../errors.js'; -interface ShoppingCartItemProps { +export interface ShoppingCartItemProps { /** * The category of the item. */ diff --git a/src/request/transaction-report.ts b/src/request/transaction-report.ts index f45f2092..136a788c 100644 --- a/src/request/transaction-report.ts +++ b/src/request/transaction-report.ts @@ -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. diff --git a/tsconfig.json b/tsconfig.json index d93f2d84..f8f4d3c0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,7 +10,6 @@ "moduleResolution": "NodeNext", "outDir": "dist", "pretty": true, - "removeComments": true, "resolveJsonModule": true, "skipLibCheck": true, "strict": true,