Skip to content

Commit

Permalink
Adds tsdoc comments for types
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrudner committed Jul 21, 2020
1 parent f40249a commit feadcd1
Show file tree
Hide file tree
Showing 10 changed files with 494 additions and 4 deletions.
16 changes: 15 additions & 1 deletion types/lib/3d-secure.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,27 @@ import { Emitter } from './emitter';
export type ThreeDSecureEvent = 'token' | 'error';

export interface ThreeDSecureEmitter extends Emitter<ThreeDSecureEvent> {
/**
* @see {@link https://developers.recurly.com/reference/recurly-js/index.html#fn-threedsecureattach|ThreeDSecure.attach}
*/
attach: (el: HTMLElement) => void;
}

export type RiskOptions = {
/**
* `three_d_secure_action_token_id` returned by the Recurly API when 3-D Secure authentication is required for a
* transaction.
*
* @see {@link https://developers.recurly.com/reference/recurly-js/index.html#fn-recurlythreedsecure|ThreeDSecure}
*/
actionTokenId?: string;
};

export type ThreeDSecure = (riskOptions: RiskOptions) => ThreeDSecureEmitter;

export type Risk = () => { ThreeDSecure: ThreeDSecure };
export type Risk = () => {
/**
* @see {@link https://developers.recurly.com/reference/recurly-js/index.html#fn-recurlythreedsecure|ThreeDSecure}
*/
ThreeDSecure: ThreeDSecure
};
39 changes: 39 additions & 0 deletions types/lib/address.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,51 @@
export type Address = {
/**
* Cardholder first name
*/
first_name: string;

/**
* Cardholder last name
*/
last_name: string;

/**
* First line of a street address
*/
address1?: string;

/**
* Second line of a street address
*/
address2?: string;

/**
* Town or locality
*/
city?: string;

/**
* Province or region
*/
state?: string;

/**
* Postal code
*/
postal_code?: string;

/**
* {@link http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2| [ISO 3166-1 alpha-2]} country code
*/
country?: string;

/**
* Phone number
*/
phone?: string;

/**
* Customer VAT number. Used for VAT exclusion
*/
vat_number?: string;
};
18 changes: 18 additions & 0 deletions types/lib/adyen.d.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
import { Emitter } from './emitter';

export type AdyenOptions = {
/**
* Invoice Uuid from PendingPurchase
*/
invoiceUuid: string;

/**
* 2 Digit Country Code
*/
countryCode?: string;

/**
* Shopper locale for Payment Modal
*/
shopperLocale?: string;

/**
* Skin code provided by Adyen
*/
skinCode?: string;
};

export type AdyenEvent = 'token' | 'error';

export interface AdyenInstance extends Emitter<AdyenEvent> {
/**
* Invokes the Adyen Payment Modal
*/
start: (adyenOptions: AdyenOptions) => void;
}

Expand Down
31 changes: 31 additions & 0 deletions types/lib/apple-pay.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,39 @@ import { Emitter } from './emitter';
import { CheckoutPricingInstance } from './pricing/checkout';

export type ApplePayConfig = {
/**
* Your ISO 3166 country code (ex: ‘US’). This is your country code as the merchant.
*/
country: string;

/**
* ISO 4217 purchase currency (ex: ‘USD’)
*/
currency: string;

/**
* Purchase description to display in the Apple Pay payment sheet.
*/
label: string;

/**
* Total cost to display in the Apple Pay payment sheet. Required if `options.pricing` is not provided.
*/
total: string;

/**
* If provided, will override `options.total` and provide the current total price on the CheckoutPricing instance
* when the Apple Pay flow is initiated.
*/
pricing?: CheckoutPricingInstance;

/**
* If provided, tokens generated by the `recurly.ApplePay` instance will include customer billing address from the
* form, overriding any billing address gathered from Apple Pay.
*
* See {@link https://developers.recurly.com/reference/recurly-js/index.html#getting-a-token|Getting a Token} for all
* compatible fields.
*/
form?: HTMLFormElement;
};

Expand All @@ -20,6 +48,9 @@ export type ApplePayEvent =
| 'cancel';

export interface ApplePayInstance extends Emitter<ApplePayEvent> {
/**
* @see {@link https://developers.recurly.com/reference/recurly-js/index.html#fn-applepayready|ApplePay.ready}
*/
ready: (cb?: VoidFunction) => void;
begin: (cb?: VoidFunction) => void;
}
Expand Down
13 changes: 13 additions & 0 deletions types/lib/bank-account.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,16 @@ export type BillingInfo = {
};

export type BankInfoOptions = {
/**
* The routing number for a bank (ex: ‘123456780’)
*/
routingNumber: string;
};

export type BankInfoPayload = {
/**
* Bank institution name (ex: Bank of Recurly)
*/
bank_name: string;
};

Expand All @@ -32,6 +38,13 @@ export type BankInfoHandler = (err: RecurlyError, bankInfo: BankInfoPayload) =>
export type BankInfo = (bankInfoOptions: BankInfoOptions, BankInfoHandler: BankInfoHandler) => void;

export type BankAccount = {
/**
* @see {@link https://developers.recurly.com/reference/recurly-js/index.html#getting-a-token-1|Getting a token}
*/
token: (data: HTMLFormElement | BillingInfo, tokenHandler: TokenHandler) => void;

/**
* @see {@link https://developers.recurly.com/reference/recurly-js/index.html#recurlybankaccountbankinfo|BankInfo}
*/
bankInfo: BankInfo;
};
Loading

0 comments on commit feadcd1

Please sign in to comment.