Skip to content

Commit d3db751

Browse files
ryangibbsiisaduan
andauthored
🤖 Merge PR DefinitelyTyped#74172 fix: braintree - Update response Date types to be strings as they are… by @ryangibbs
Co-authored-by: Isabel Duan <isabelduan@microsoft.com>
1 parent f4fccd3 commit d3db751

File tree

2 files changed

+32
-27
lines changed

2 files changed

+32
-27
lines changed

‎types/braintree/braintree-tests.ts‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,9 @@ const gateway: BraintreeGateway = new braintree.BraintreeGateway({
170170
escrowStatus === Transaction.EscrowStatus.Refunded;
171171

172172
// Assert overlap between source and static field
173-
"Api" === Transaction.Source.Api;
174-
"Recurring" === Transaction.Source.Recurring;
175-
"ControlPanel" === Transaction.Source.ControlPanel;
173+
"api" === Transaction.Source.Api;
174+
"recurring" === Transaction.Source.Recurring;
175+
"control_panel" === Transaction.Source.ControlPanel;
176176

177177
// Assert overlap between created using and static field
178178
"token" === Transaction.CreatedUsing.Token;
@@ -262,13 +262,17 @@ const gateway: BraintreeGateway = new braintree.BraintreeGateway({
262262

263263
// $ExpectType string
264264
subscription.nextBillingDate;
265+
subscription.firstBillingDate;
265266

266267
// Assert overlap between subscription status and static field
267268
subscription.status === braintree.Subscription.Status.Active;
268269
subscription.status === braintree.Subscription.Status.Canceled;
269270
subscription.status === braintree.Subscription.Status.Expired;
270271
subscription.status === braintree.Subscription.Status.PastDue;
271272
subscription.status === braintree.Subscription.Status.Pending;
273+
274+
// $ExpectType ValidatedResponse<Subscription>
275+
const cancelResult = await gateway.subscription.cancel("subscriptionId");
272276
})();
273277

274278
// $ExpectType () => string[]

‎types/braintree/index.d.ts‎

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ declare namespace braintree {
325325
}
326326

327327
interface SubscriptionGateway {
328-
cancel(subscriptionId: string): Promise<Subscription>;
328+
cancel(subscriptionId: string): Promise<ValidatedResponse<Subscription>>;
329329
create(request: SubscriptionCreateRequest): Promise<ValidatedResponse<Subscription>>;
330330
find(subscriptionId: string): Promise<Subscription>;
331331
retryCharge(
@@ -793,9 +793,9 @@ declare namespace braintree {
793793
reason: string;
794794
reasonCode: string;
795795
reasonDescription: string;
796-
receivedDate: Date;
796+
receivedDate: string;
797797
referenceNumber: string;
798-
replyByDate: Date;
798+
replyByDate: string;
799799
status: DisputeStatus;
800800
statusHistory: DisputeStatusHistory[];
801801
transaction: {
@@ -812,17 +812,17 @@ declare namespace braintree {
812812
export type DisputeStatus = "Accepted" | "Disputed" | "Expired" | "Open" | "Lost" | "Won";
813813

814814
export interface DisputeStatusHistory {
815-
disbursementDate: Date;
816-
effectiveDate: Date;
815+
disbursementDate: string;
816+
effectiveDate: string;
817817
status: DisputeStatus;
818-
timestamp: Date;
818+
timestamp: string;
819819
}
820820

821821
export interface Evidence {
822822
comment?: string | undefined;
823823
createdAt: string;
824824
id: string;
825-
sendToProcessorAt: Date;
825+
sendToProcessorAt: string;
826826
url?: string | undefined;
827827
}
828828

@@ -838,7 +838,7 @@ declare namespace braintree {
838838

839839
id: string;
840840
amount: string;
841-
disbursementDate: Date;
841+
disbursementDate: string;
842842
disbursementType: DisbursementType;
843843
transactionIds: string[];
844844
merchantAccount: DisbursementMerchantAccount;
@@ -1127,7 +1127,7 @@ declare namespace braintree {
11271127
* Account Updater
11281128
*/
11291129
export class AccountUpdaterDailyReport {
1130-
reportDate: Date;
1130+
reportDate: string;
11311131
reportUrl: string;
11321132
}
11331133

@@ -1142,7 +1142,7 @@ declare namespace braintree {
11421142

11431143
export interface BaseWebhookNotification {
11441144
kind: WebhookNotificationKind;
1145-
timestamp: Date;
1145+
timestamp: string;
11461146
}
11471147

11481148
export interface TransactionNotification extends BaseWebhookNotification {
@@ -1218,7 +1218,8 @@ declare namespace braintree {
12181218
| "subscription_expired"
12191219
| "subscription_trial_ended"
12201220
| "subscription_went_active"
1221-
| "subscription_went_past_due";
1221+
| "subscription_went_past_due"
1222+
| "subscription_billing_skipped";
12221223

12231224
export type SubMerchantAccountApprovedNotificationKind = "sub_merchant_account_approved";
12241225

@@ -1339,15 +1340,15 @@ declare namespace braintree {
13391340
descriptor?: Descriptor | undefined;
13401341
discounts?: Discount[] | undefined;
13411342
failureCount?: number | undefined;
1342-
firstBillingDate?: Date | undefined;
1343+
firstBillingDate?: string | undefined;
13431344
id: string;
13441345
merchantAccountId: string;
13451346
neverExpires?: boolean | undefined;
13461347
nextBillAmount: string;
13471348
nextBillingDate: string;
13481349
nextBillingPeriodAmount: string;
13491350
numberOfBillingCycles?: number | undefined;
1350-
paidThroughDate?: Date | undefined;
1351+
paidThroughDate?: string | undefined;
13511352
paymentMethodToken: string;
13521353
planId: string;
13531354
price?: string | undefined;
@@ -1451,9 +1452,9 @@ declare namespace braintree {
14511452
};
14521453

14531454
static Source: {
1454-
Api: "Api";
1455-
ControlPanel: "ControlPanel";
1456-
Recurring: "Recurring";
1455+
Api: "api";
1456+
ControlPanel: "control_panel";
1457+
Recurring: "recurring";
14571458
};
14581459

14591460
static CreatedUsing: {
@@ -1540,7 +1541,7 @@ declare namespace braintree {
15401541
}
15411542
| undefined;
15421543
authorizationAdjustments?: AuthorizationAdjustment[] | undefined;
1543-
authorizationExpiresAt?: Date | undefined;
1544+
authorizationExpiresAt?: string | undefined;
15441545
avsErrorResponseCode: string;
15451546
avsPostalCodeResponseCode: string;
15461547
avsStreetAddressResponseCode: string;
@@ -1726,8 +1727,8 @@ declare namespace braintree {
17261727
statusHistory?: TransactionStatusHistory[] | undefined;
17271728
subscription?:
17281729
| {
1729-
billingPeriodEndDate: Date;
1730-
billingPeriodStartDate: Date;
1730+
billingPeriodEndDate: string;
1731+
billingPeriodStartDate: string;
17311732
}
17321733
| undefined;
17331734
subscriptionId?: string | undefined;
@@ -1913,7 +1914,7 @@ declare namespace braintree {
19131914
export interface AuthorizationAdjustment {
19141915
amount: string;
19151916
success: boolean;
1916-
timestamp: Date;
1917+
timestamp: string;
19171918
processorResponseType: string;
19181919
processorResponseCode: string;
19191920
processorResponseText: string;
@@ -1926,7 +1927,7 @@ declare namespace braintree {
19261927
}
19271928

19281929
export interface DisbursementDetails {
1929-
disbursementDate: Date;
1930+
disbursementDate: string;
19301931
fundsHeld: boolean;
19311932
settlementAmount: string;
19321933
settlementCurrencyExchangeRate: string;
@@ -1998,12 +1999,12 @@ declare namespace braintree {
19981999
export interface TransactionStatusHistory {
19992000
amount: string;
20002001
status: TransactionStatus;
2001-
timestamp: Date;
2002-
transactionsource: TransactionSource;
2002+
timestamp: string;
2003+
transactionSource: TransactionSource;
20032004
user: string;
20042005
}
20052006

2006-
export type TransactionSource = "Api" | "ControlPanel" | "Recurring";
2007+
export type TransactionSource = "api" | "control_panel" | "recurring";
20072008

20082009
export interface TransactionThreeDSecureInfo {
20092010
enrolled: string;

0 commit comments

Comments
 (0)