Smaller changes and add wildcard-event

This commit is contained in:
Jan Oberhauser
2019-12-01 20:19:38 +01:00
parent 246429b09d
commit ee8d63f34a
4 changed files with 40 additions and 24 deletions

View File

@@ -21,9 +21,9 @@ import {
RecipientWallet,
} from './PaymentInteface';
import {
payPalApiRequest,
payPalApiRequestAllItems,
validateJSON,
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)}`);
}