sync upstream

This commit is contained in:
Ricardo Espinoza 2019-12-01 10:59:11 -05:00
parent c1edcc9e56
commit 246429b09d
4 changed files with 10 additions and 16 deletions

View file

@ -76,7 +76,7 @@ async function getAccessToken(this: IHookFunctions | IExecuteFunctions | IExecut
* Make an API request to paginated paypal endpoint
* and return all results
*/
export async function payPalApiRequestAllItems(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, propertyName: string, endpoint: string, method: string, body: any = {}, query?: IDataObject, uri?: string): Promise<any> { // tslint:disable-line:no-any
export async function paypalApiRequestAllItems(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, propertyName: string, endpoint: string, method: string, body: any = {}, query?: IDataObject, uri?: string): Promise<any> { // tslint:disable-line:no-any
const returnData: IDataObject[] = [];
@ -85,7 +85,7 @@ export async function payPalApiRequestAllItems(this: IHookFunctions | IExecuteFu
query!.page_size = 1000;
do {
responseData = await payPalApiRequest.call(this, endpoint, method, body, query, uri);
responseData = await paypalApiRequest.call(this, endpoint, method, body, query, uri);
uri = getNext(responseData.links);
returnData.push.apply(returnData, responseData[propertyName]);
} while (

View file

@ -22,8 +22,8 @@ import {
} from './PaymentInteface';
import {
validateJSON,
payPalApiRequest,
payPalApiRequestAllItems
paypalApiRequest,
paypalApiRequestAllItems
} from './GenericFunctions';
export class PayPal implements INodeType {
@ -129,7 +129,7 @@ export class PayPal implements INodeType {
body.items = itemsJson;
}
try {
responseData = await payPalApiRequest.call(this, '/payments/payouts', 'POST', body);
responseData = await paypalApiRequest.call(this, '/payments/payouts', 'POST', body);
} catch (err) {
throw new Error(`PayPal Error: ${JSON.stringify(err)}`);
}
@ -139,10 +139,10 @@ export class PayPal implements INodeType {
const returnAll = this.getNodeParameter('returnAll', 0) as boolean;
try {
if (returnAll === true) {
responseData = await payPalApiRequestAllItems.call(this, 'items', `/payments/payouts/${payoutBatchId}`, 'GET', {}, qs);
responseData = await paypalApiRequestAllItems.call(this, 'items', `/payments/payouts/${payoutBatchId}`, 'GET', {}, qs);
} else {
qs.page_size = this.getNodeParameter('limit', i) as number;
responseData = await payPalApiRequest.call(this, `/payments/payouts/${payoutBatchId}`, 'GET', {}, qs);
responseData = await paypalApiRequest.call(this, `/payments/payouts/${payoutBatchId}`, 'GET', {}, qs);
responseData = responseData.items;
}
} catch (err) {
@ -153,7 +153,7 @@ export class PayPal implements INodeType {
if (operation === 'get') {
const payoutItemId = this.getNodeParameter('payoutItemId', i) as string;
try {
responseData = await payPalApiRequest.call(this,`/payments/payouts-item/${payoutItemId}`, 'GET', {}, qs);
responseData = await paypalApiRequest.call(this,`/payments/payouts-item/${payoutItemId}`, 'GET', {}, qs);
} catch (err) {
throw new Error(`PayPal Error: ${JSON.stringify(err)}`);
}
@ -161,7 +161,7 @@ export class PayPal implements INodeType {
if (operation === 'cancel') {
const payoutItemId = this.getNodeParameter('payoutItemId', i) as string;
try {
responseData = await payPalApiRequest.call(this,`/payments/payouts-item/${payoutItemId}/cancel`, 'POST', {}, qs);
responseData = await paypalApiRequest.call(this,`/payments/payouts-item/${payoutItemId}/cancel`, 'POST', {}, qs);
} catch (err) {
throw new Error(`PayPal Error: ${JSON.stringify(err)}`);
}

View file

@ -15,7 +15,6 @@ import {
paypalApiRequest,
upperFist
} from './GenericFunctions';
import { queryResult } from 'pg-promise';
export class PayPalTrigger implements INodeType {
description: INodeTypeDescription = {

View file

@ -115,14 +115,9 @@
"dist/nodes/OpenWeatherMap.node.js",
"dist/nodes/Pipedrive/Pipedrive.node.js",
"dist/nodes/Pipedrive/PipedriveTrigger.node.js",
<<<<<<< HEAD
"dist/nodes/Postgres/Postgres.node.js",
"dist/nodes/Paypal/PayPal.node.js",
"dist/nodes/Paypal/PayPalTrigger.node.js",
=======
"dist/nodes/Postgres/Postgres.node.js",
"dist/nodes/PayPal/PayPal.node.js",
>>>>>>> master
"dist/nodes/PayPal/PayPalTrigger.node.js",
"dist/nodes/Rocketchat/Rocketchat.node.js",
"dist/nodes/ReadBinaryFile.node.js",
"dist/nodes/ReadBinaryFiles.node.js",