Added additional gateway config options, fixed returning invalid response for grant API. (#43910)

Co-authored-by: matejss <matejss@inova.si>
This commit is contained in:
MatejSkrbis 2020-04-16 01:26:22 +02:00 committed by GitHub
parent f86c9d86ce
commit 537903f44e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,13 +25,24 @@ declare namespace braintree {
Sandbox = 'Sandbox',
}
export interface GatewayConfig {
export type GatewayConfig = KeyGatewayConfig | ClientGatewayConfig | AccessTokenGatewayConfig;
export interface KeyGatewayConfig {
environment: Environment;
merchantId: string;
publicKey: string;
privateKey: string;
}
export interface ClientGatewayConfig {
clientId: string;
clientSecret: string;
}
export interface AccessTokenGatewayConfig {
accessToken: string;
}
export class BraintreeGateway {
constructor(config: GatewayConfig);
config: any;
@ -75,6 +86,7 @@ declare namespace braintree {
subscription: T extends Subscription ? Subscription : never;
transaction: T extends Transaction ? Transaction : never;
clientToken: T extends ClientToken ? string : never;
credentials: T extends OAuthToken ? OAuthToken : never;
}
/**
@ -165,7 +177,7 @@ declare namespace braintree {
grant(
sharedPaymentMethodToken: string,
options: { allowVaulting?: boolean; includeBillingPostalCode?: boolean; revokeAfter?: Date },
): Promise<Readonly<string>>;
): Promise<ValidatedResponse<PaymentMethodNonce>>;
revoke(sharedPaymentMethodToken: string): Promise<void>;
update(token: string, updates: PaymentMethodUpdateRequest): Promise<ValidatedResponse<PaymentMethod>>;
}
@ -732,11 +744,9 @@ declare namespace braintree {
*/
export interface OAuthToken {
credentials: {
accessToken: string;
expiresAt: string;
refreshToken: string;
};
accessToken: string;
expiresAt: string;
refreshToken: string;
}
export interface OAuthCreateTokenFromCodeRequest {