Skip to content

Commit

Permalink
[QR + Reader Settings + DCC] Update types (#81)
Browse files Browse the repository at this point in the history
* [QR] update QR fields

* add dcc field to collect configuration

* add set reader settings

* add docs for new api methods
  • Loading branch information
henryx-stripe committed Sep 5, 2024
1 parent 0b68fc3 commit f37a13c
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stripe/terminal-js",
"version": "0.12.0",
"version": "0.14.0",
"description": "Stripe Terminal loading utility",
"main": "dist/terminal.js",
"module": "dist/terminal.esm.js",
Expand Down
40 changes: 40 additions & 0 deletions types/proto.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,9 @@ export interface IPaymentMethodDetails {

/** PaymentMethodDetails interac_present */
interac_present?: ICardPresent | null;

/** PaymentMethodDetails wechat_pay */
wechat_pay?: IWechatPay | null;
}
/** Properties of a Refund. */
interface IRefund {
Expand Down Expand Up @@ -474,7 +477,23 @@ interface ICardPresent {

/** CardPresent authorization_code */
authorization_code?: string | null;

/** CardPresent location */
location?: string | null;
}

interface IWechatPay {

/** WechatPay reader */
reader?: string | null;

/** WechatPay location */
location?: string | null;

/** WeChat Pay transactionId */
transactionId?: string | null;
}

/** Properties of a Source. */
export interface ISource {
/** Unique identifier for the source card object. */
Expand Down Expand Up @@ -537,6 +556,9 @@ export interface IPaymentIntent {

/** ID for payment method */
payment_method?: string | null;

/** PaymentMethod types supported on the payment intent */
payment_method_types?: (string[]|null);
}

export interface ISetupIntent {
Expand Down Expand Up @@ -834,3 +856,21 @@ type Request3dSecureType = "automatic"| "any";
/** Method enum. */
type Method =
"automatic"| "manual";

type ITextToSpeechStatus = 'off' | 'headphones' | 'speakers';

export interface IAccessibilitySettings {
textToSpeechStatus: ITextToSpeechStatus;
}

export interface IReaderSettings {
accessibilitySettings: IAccessibilitySettings | IErrorResponse;
}

export interface IAccessibilityParameters {
enableTextToSpeechSpeakers: boolean;
}

export interface ISetReaderSettingsRequest {
accessibility_parameters?: null | IAccessibilityParameters;
}
16 changes: 16 additions & 0 deletions types/terminal.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
ITipConfiguration,
IRefund,
IPaymentIntentExpandedMethod,
IReaderSettings, ISetReaderSettingsRequest,
} from './proto';

export {
Expand Down Expand Up @@ -108,6 +109,9 @@ export interface ICollectConfig {

// Optional notice to display on the payment collection screen to inform the customer of a surcharge.
surcharge_notice?: string | null;

// Request ability to offer dynamic currency conversion (DCC) if the card is eligible.
request_dynamic_currency_conversion?: boolean | null;
}

// Contains per-transaction configuration information relevant to collecting tips
Expand Down Expand Up @@ -489,4 +493,16 @@ export class Terminal {
setSimulatorConfiguration(config: any): void;
getSimulatorConfiguration(): SimulatorConfiguration;
overrideBaseURL(url: string): void;

/**
* Changes settings on the connected reader.
*
* @param request The request with the values to set on the reader.
*/
setReaderSettings(request: ISetReaderSettingsRequest): Promise<IReaderSettings>;

/**
* Retrieves current settings from the connected reader.
*/
getReaderSettings(): Promise<IReaderSettings>;
}

0 comments on commit f37a13c

Please sign in to comment.