:tap: Fix environment typo in PayPal node (#1310)

This commit is contained in:
Iván Ovejero 2021-01-07 09:43:42 -03:00 committed by GitHub
parent 2fed026523
commit a13a7487cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -22,7 +22,7 @@ export class PayPalApi implements ICredentialType {
default: '',
},
{
displayName: 'Enviroment',
displayName: 'Environment',
name: 'env',
type: 'options' as NodePropertyTypes,
default: 'live',

View file

@ -15,7 +15,7 @@ import {
export async function payPalApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions | IWebhookFunctions, endpoint: string, method: string, body: any = {}, query?: IDataObject, uri?: string): Promise<any> { // tslint:disable-line:no-any
const credentials = this.getCredentials('payPalApi');
const env = getEnviroment(credentials!.env as string);
const env = getEnvironment(credentials!.env as string);
const tokenInfo = await getAccessToken.call(this);
const headerWithAuthentication = Object.assign({ },
{ Authorization: `Bearer ${tokenInfo.access_token}`, 'Content-Type': 'application/json' });
@ -43,7 +43,7 @@ export async function payPalApiRequest(this: IHookFunctions | IExecuteFunctions
}
}
function getEnviroment(env: string): string {
function getEnvironment(env: string): string {
// @ts-ignore
return {
'sanbox': 'https://api.sandbox.paypal.com',
@ -56,7 +56,7 @@ async function getAccessToken(this: IHookFunctions | IExecuteFunctions | IExecut
if (credentials === undefined) {
throw new Error('No credentials got returned!');
}
const env = getEnviroment(credentials!.env as string);
const env = getEnvironment(credentials!.env as string);
const data = Buffer.from(`${credentials!.clientId}:${credentials!.secret}`).toString(BINARY_ENCODING);
const headerWithAuthentication = Object.assign({},
{ Authorization: `Basic ${data}`, 'Content-Type': 'application/x-www-form-urlencoded' });