@@ -120,6 +120,10 @@ declare namespace braintree {
120120 voidedAt : RangeFieldSearchFn < Date > ;
121121 } ) => void ;
122122
123+ export type DisputeSearchFn = ( search : {
124+ status : MultiValueSearchFn < DisputeStatus > ;
125+ } ) => void ;
126+
123127 export type GatewayConfig = KeyGatewayConfig | ClientGatewayConfig | AccessTokenGatewayConfig ;
124128
125129 export class Environment {
@@ -262,7 +266,7 @@ declare namespace braintree {
262266 finalize ( disputeId : string ) : Promise < ValidatedResponse < Dispute > > ;
263267 find ( disputeId : string ) : Promise < Dispute > ;
264268 removeEvidence ( disputeId : string , evidenceId : string ) : Promise < ValidatedResponse < Dispute > > ;
265- search ( searchFn : any ) : stream . Readable ;
269+ search ( searchFn : DisputeSearchFn ) : stream . Readable ;
266270 }
267271
268272 interface MerchantAccountGateway {
@@ -307,7 +311,10 @@ declare namespace braintree {
307311 }
308312
309313 interface PlanGateway {
310- all ( ) : Promise < { plans : Plan [ ] } > ;
314+ all ( ) : Promise < Plan [ ] > ;
315+ find ( planId : string ) : Promise < Plan > ;
316+ create ( request : PlanCreateRequest ) : Promise < ValidatedResponse < Plan > > ;
317+ update ( planId : string , updates : PlanCreateRequest ) : Promise < ValidatedResponse < Plan > > ;
311318 }
312319
313320 interface SettlementBatchSummaryGateway {
@@ -318,14 +325,14 @@ declare namespace braintree {
318325 }
319326
320327 interface SubscriptionGateway {
321- cancel ( subscriptionId : string ) : Promise < void > ;
328+ cancel ( subscriptionId : string ) : Promise < Subscription > ;
322329 create ( request : SubscriptionCreateRequest ) : Promise < ValidatedResponse < Subscription > > ;
323330 find ( subscriptionId : string ) : Promise < Subscription > ;
324331 retryCharge (
325332 subscriptionId : string ,
326333 amount ?: string ,
327334 submitForSettlement ?: boolean ,
328- ) : Promise < ValidatedResponse < Subscription > > ;
335+ ) : Promise < ValidatedResponse < Transaction > > ;
329336 search ( searchFn : any ) : stream . Readable ;
330337 update ( subscriptionId : string , updates : SubscriptionUpdateRequest ) : Promise < ValidatedResponse < Subscription > > ;
331338 }
@@ -1269,6 +1276,36 @@ declare namespace braintree {
12691276 updatedAt : string ;
12701277 }
12711278
1279+ export interface PlanCreateRequest {
1280+ addOns ?:
1281+ | {
1282+ add ?: AddOnAddRequest [ ] | undefined ;
1283+ remove ?: string [ ] | undefined ;
1284+ update ?: AddOnUpdateRequest [ ] | undefined ;
1285+ } [ ]
1286+ | undefined ;
1287+ billingDayOfMonth ?: number | string | undefined ;
1288+ billingFrequency : number | string ;
1289+ currencyIsoCode : string ;
1290+ description ?: string | undefined ;
1291+ discounts ?:
1292+ | {
1293+ add ?: DiscountAddRequest [ ] | undefined ;
1294+ remove ?: string [ ] | undefined ;
1295+ update ?: DiscountUpdateRequest [ ] | undefined ;
1296+ } [ ]
1297+ | undefined ;
1298+ id ?: string | undefined ;
1299+ modificationTokens ?: string | undefined ;
1300+ name : string ;
1301+ neverExpires ?: boolean | string | undefined ;
1302+ numberOfBillingCycles ?: number | string | undefined ;
1303+ price : string | number ;
1304+ trialDuration ?: number | undefined ;
1305+ trialDurationUnit ?: string | undefined ;
1306+ trialPeriod ?: boolean | undefined ;
1307+ }
1308+
12721309 /**
12731310 * Settlement Batch Summary
12741311 */
@@ -2306,20 +2343,41 @@ declare namespace braintree {
23062343 * Errors
23072344 */
23082345
2309- export interface AuthenticationError extends Error { }
2310- export interface AuthorizationError extends Error { }
2311- export interface GatewayTimeoutError extends Error { }
2312- export interface InvalidChallengeError extends Error { }
2313- export interface InvalidKeysError extends Error { }
2314- export interface InvalidSignatureError extends Error { }
2315- export interface NotFoundError extends Error { }
2316- export interface RequestTimeoutError extends Error { }
2317- export interface ServerError extends Error { }
2318- export interface ServiceUnavailableError extends Error { }
2319- export interface TestOperationPerformedInProductionError extends Error { }
2320- export interface TooManyRequestsError extends Error { }
2321- export interface UnexpectedError extends Error { }
2322- export interface UpgradeRequired extends Error { }
2346+ type ErrorType =
2347+ | "authenticationError"
2348+ | "authorizationError"
2349+ | "gatewayTimeoutError"
2350+ | "invalidChallengeError"
2351+ | "invalidKeysError"
2352+ | "invalidSignatureError"
2353+ | "notFoundError"
2354+ | "requestTimeoutError"
2355+ | "serverError"
2356+ | "serviceUnavailableError"
2357+ | "testOperationPerformedInProductionError"
2358+ | "tooManyRequestsError"
2359+ | "unexpectedError"
2360+ | "upgradeRequired" ;
2361+
2362+ export interface BraintreeError < T extends ErrorType > extends Error {
2363+ type : T ;
2364+ }
2365+ export interface AuthenticationError extends BraintreeError < "authenticationError" > { }
2366+ export interface AuthorizationError extends BraintreeError < "authorizationError" > { }
2367+ export interface GatewayTimeoutError extends BraintreeError < "gatewayTimeoutError" > { }
2368+ export interface InvalidChallengeError extends BraintreeError < "invalidChallengeError" > { }
2369+ export interface InvalidKeysError extends BraintreeError < "invalidKeysError" > { }
2370+ export interface InvalidSignatureError extends BraintreeError < "invalidSignatureError" > { }
2371+ export interface NotFoundError extends BraintreeError < "notFoundError" > { }
2372+ export interface RequestTimeoutError extends BraintreeError < "requestTimeoutError" > { }
2373+ export interface ServerError extends BraintreeError < "serverError" > { }
2374+ export interface ServiceUnavailableError extends BraintreeError < "serviceUnavailableError" > { }
2375+ export interface TestOperationPerformedInProductionError
2376+ extends BraintreeError < "testOperationPerformedInProductionError" >
2377+ { }
2378+ export interface TooManyRequestsError extends BraintreeError < "tooManyRequestsError" > { }
2379+ export interface UnexpectedError extends BraintreeError < "unexpectedError" > { }
2380+ export interface UpgradeRequired extends BraintreeError < "upgradeRequired" > { }
23232381
23242382 /**
23252383 * Validation errors
0 commit comments