Add Activepieces integration for workflow automation

- Add Activepieces fork with SmoothSchedule custom piece
- Create integrations app with Activepieces service layer
- Add embed token endpoint for iframe integration
- Create Automations page with embedded workflow builder
- Add sidebar visibility fix for embed mode
- Add list inactive customers endpoint to Public API
- Include SmoothSchedule triggers: event created/updated/cancelled
- Include SmoothSchedule actions: create/update/cancel events, list resources/services/customers

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
poduck
2025-12-18 22:59:37 -05:00
parent 9848268d34
commit 3aa7199503
16292 changed files with 1284892 additions and 4708 deletions

View File

@@ -0,0 +1,29 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const submitPaymentsProviderReturnParameters = createAction({
auth: trueLayerCommon.auth,
name: 'submit-payments-provider-return-parameters',
displayName: 'Submit payments return parameters',
description: 'Submit direct return query and fragment parameters returned from the provider.',
props: {
IdempotencyKeyHeader: Property.ShortText({
displayName: 'Idempotency Key Header',
description: 'Used to ensure idempotent requests',
required: false,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.POST,
url: `${trueLayerCommon.baseUrl}/v3/payments-provider-return`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
'Idempotency-Key': ctx.propsValue.IdempotencyKeyHeader,
},
body: ctx.propsValue,
})
return response.body
},
});

View File

@@ -0,0 +1,42 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const confirmMandateFunds = createAction({
auth: trueLayerCommon.auth,
name: 'confirm-mandate-funds',
displayName: 'Confirm Mandate Funds',
description: 'Confirm that the PSU has the given funds. This API can be called using the mandate_token associated with the mandate or using a backend bearer token.',
props: {
id: Property.ShortText({
displayName: 'Mandate ID',
description: 'ID of the Mandate to be confirmed.',
required: true,
}),
amount_in_minor: Property.ShortText({
displayName: 'Amount in Minor Units',
description: 'A "cent" value representing the amount. For example, 100 == 1 GBP.',
required: true,
}),
currency: Property.ShortText({
displayName: 'Currency',
description: 'Currency code (e.g., GBP, EUR).',
required: true,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.GET,
url: `${trueLayerCommon.baseUrl}/v3/mandates/${ctx.propsValue.id}/funds`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
},
body: {
amount_in_minor: ctx.propsValue.amount_in_minor,
currency: ctx.propsValue.currency,
},
})
return response.body;
},
});

View File

@@ -0,0 +1,36 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const createMandate = createAction({
auth: trueLayerCommon.auth,
name: 'create-mandate',
displayName: 'Create Mandate',
description: 'Create a new mandate. This API must be called using a backend bearer token.',
props: {
IdempotencyKeyHeader: Property.ShortText({
displayName: 'Idempotency Key Header',
description: 'Used to ensure idempotent requests',
required: false,
}),
SignatureHeader: Property.ShortText({
displayName: 'Signature Header',
description: 'Used for request signature verification',
required: false,
}),
},
run: async (ctx) => {
const response =await httpClient.sendRequest({
method: HttpMethod.POST,
url: `${trueLayerCommon.baseUrl}/v3/mandates`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
'Idempotency-Key': ctx.propsValue.IdempotencyKeyHeader,
'Signature': ctx.propsValue.SignatureHeader,
},
body: ctx.propsValue,
})
return response.body;
},
});

View File

@@ -0,0 +1,28 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const getConstraints = createAction({
auth: trueLayerCommon.auth,
name: 'get-constraints',
displayName: 'Get Mandate Constraints',
description: 'Retrieve the constraints defined on the mandate, as well as the current utilization of those constraints within the periods.',
props: {
id: Property.ShortText({
displayName: 'Mandate ID',
description: 'The ID of the mandate to retrieve the constraints for.',
required: true,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.GET,
url: `${trueLayerCommon.baseUrl}/v3/mandates/${ctx.propsValue.id}/constraints`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
},
})
return response.body
},
});

View File

@@ -0,0 +1,28 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const getMandate = createAction({
auth: trueLayerCommon.auth,
name: 'get-mandate',
displayName: 'Get Mandate',
description: 'Returns a mandate with the stated ID. This endpoint can be called either by the regular `backend token` or the `mandate token` for that mandate.',
props: {
id: Property.ShortText({
displayName: 'Mandate ID',
description: 'The ID of the mandate to retrieve.',
required: true,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.GET,
url: `${trueLayerCommon.baseUrl}/v3/mandates/${ctx.propsValue.id}`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
},
})
return response.body;
},
});

View File

@@ -0,0 +1,43 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const listMandate = createAction({
auth: trueLayerCommon.auth,
name: 'list-mandate',
displayName: 'List Mandates',
description: 'List all the mandates associated with the client. This API must be called using a backend bearer token.',
props: {
user_id: Property.ShortText({
displayName: 'User ID',
description: 'Optional ID of the user whose mandates you want to list.',
required: false,
}),
cursor: Property.ShortText({
displayName: 'Cursor',
description: 'Optional cursor for pagination.',
required: false,
}),
limit: Property.ShortText({
displayName: 'Limit',
description: 'Optional limit on the number of mandates to return.',
required: false,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.GET,
url: `${trueLayerCommon.baseUrl}/v3/mandates`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
},
queryParams: {
user_id: ctx.propsValue.user_id || '',
cursor: ctx.propsValue.cursor || '',
limit: ctx.propsValue.limit || '',
},
})
return response.body;
},
});

View File

@@ -0,0 +1,28 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const revokeMandate = createAction({
auth: trueLayerCommon.auth,
name: 'revoke-mandate',
displayName: 'Revoke Mandate',
description: 'Revoke a mandate. This API must be called using a backend bearer token.',
props: {
id: Property.ShortText({
displayName: 'Mandate ID',
description: 'The ID of the mandate to revoke.',
required: true,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.POST,
url: `${trueLayerCommon.baseUrl}/v3/mandates/${ctx.propsValue.id}/revoke`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
},
})
return response.body;
},
});

View File

@@ -0,0 +1,29 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const startMandateAuthorizationFlow = createAction({
auth: trueLayerCommon.auth,
name: 'start-mandate-authorization-flow',
displayName: 'Start Authorization Flow',
description: 'Start the authorization flow for a mandate. This API can be called using either the mandate_token associated with the mandate or a backend bearer token.',
props: {
id: Property.ShortText({
displayName: 'Mandate ID',
description: 'The ID of the mandate to start the authorization flow for.',
required: true,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.POST,
url: `${trueLayerCommon.baseUrl}/v3/mandates/${ctx.propsValue.id}/authorization-flow`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
},
body: ctx.propsValue,
})
return response.body;
},
});

View File

@@ -0,0 +1,29 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const submitConsentMandate = createAction({
auth: trueLayerCommon.auth,
name: 'submit-consent-mandate',
displayName: 'Submit consent',
description: 'Submit the consent given by the user. This API can be called using either the mandate_token associated with the mandate or a backend bearer token.',
props: {
id: Property.ShortText({
displayName: 'Mandate ID',
description: 'The ID of the mandate for which consent is being submitted.',
required: true,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.POST,
url: `${trueLayerCommon.baseUrl}/v3/mandates/${ctx.propsValue.id}/authorization-flow/actions/consent`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
},
body: ctx.propsValue,
})
return response.body;
},
});

View File

@@ -0,0 +1,29 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const submitMandateProviderSelection = createAction({
auth: trueLayerCommon.auth,
name: 'submit-mandate-provider-selection',
displayName: 'Submit provider selection',
description: 'Submit the provider details selected by the PSU. This API can be called using either the mandate_token associated with the mandate or a backend bearer token.',
props: {
id: Property.ShortText({
displayName: 'Mandate ID',
description: 'The ID of the mandate for which provider selection is being submitted.',
required: true,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.POST,
url: `${trueLayerCommon.baseUrl}/v3/mandates/${ctx.propsValue.id}/authorization-flow/actions/provider-selection`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
},
body: ctx.propsValue,
})
return response.body;
},
});

View File

@@ -0,0 +1,36 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const getMerchantAccountPaymentSources = createAction({
auth: trueLayerCommon.auth,
name: 'get-merchant-account-payment-sources',
displayName: 'Get Payment Sources',
description: 'Get the payment sources from which the merchant account has received payments.',
props: {
id: Property.ShortText({
displayName: 'Merchant Account ID',
description: 'The ID of the merchant account into which payments were made.',
required: true,
}),
user_id: Property.ShortText({
displayName: 'User ID',
description: 'The ID of the user whose payment sources are being retrieved.',
required: true,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.GET,
url: `${trueLayerCommon.baseUrl}/v3/merchant-accounts/${ctx.propsValue.id}/payment-sources`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
},
queryParams: {
user_id: ctx.propsValue.user_id,
},
})
return response.body;
},
});

View File

@@ -0,0 +1,28 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const getOperatingAccount = createAction({
auth: trueLayerCommon.auth,
name: 'get-operating-account',
displayName: 'Get Merchant Account',
description: 'Get the details of a single merchant account.',
props: {
id: Property.ShortText({
displayName: 'Merchant Account ID',
description: 'The ID of the merchant account to be retrieved.',
required: true,
}),
},
run: async (ctx) => {
const response =await httpClient.sendRequest({
method: HttpMethod.GET,
url: `${trueLayerCommon.baseUrl}/v3/merchant-accounts/${ctx.propsValue.id}`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
},
})
return response.body;
},
});

View File

@@ -0,0 +1,22 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const listOperatingAccounts = createAction({
auth: trueLayerCommon.auth,
name: 'list-operating-accounts',
displayName: 'List Merchant Accounts',
description: 'List all your TrueLayer merchant accounts. There might be more than one account per currency.',
props: {},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.GET,
url: `${trueLayerCommon.baseUrl}/v3/merchant-accounts`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
},
})
return response.body
},
});

View File

@@ -0,0 +1,28 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const merchantAccountDisableSweeping = createAction({
auth: trueLayerCommon.auth,
name: 'merchant-account-disable-sweeping',
displayName: 'Disable Sweeping',
description: 'Disable automatic sweeping for a merchant account.',
props: {
id: Property.ShortText({
displayName: 'Merchant Account ID',
description: 'The ID of the merchant account to disable sweeping for.',
required: true,
}),
},
run: async (ctx) => {
const response = await await httpClient.sendRequest({
method: HttpMethod.DELETE,
url: `${trueLayerCommon.baseUrl}/v3/merchant-accounts/${ctx.propsValue.id}/sweeping`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
},
})
return response.body
},
});

View File

@@ -0,0 +1,28 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const merchantAccountGetSweeping = createAction({
auth: trueLayerCommon.auth,
name: 'merchant-account-get-sweeping',
displayName: 'Get Sweeping Settings',
description: 'Get the automatic sweeping settings for a merchant account.',
props: {
id: Property.ShortText({
displayName: 'Merchant Account ID',
description: 'The ID of the merchant account to fetch the sweeping settings for.',
required: true,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.GET,
url: `${trueLayerCommon.baseUrl}/v3/merchant-accounts/${ctx.propsValue.id}/sweeping`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
},
})
return response.body
},
});

View File

@@ -0,0 +1,55 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const merchantAccountGetTransactions = createAction({
auth: trueLayerCommon.auth,
name: 'merchant-account-get-transactions',
displayName: 'Get Transactions',
description: 'Get the transactions of a single merchant account. If pagination is missing, add a header `tl-enable-pagination: true` to enable pagination.',
props: {
id: Property.ShortText({
displayName: 'Merchant Account ID',
description: 'The ID of the merchant account to return the transactions for.',
required: true,
}),
from: Property.ShortText({
displayName: 'Start Timestamp',
description: 'Timestamp for the start of the range to query (inclusive). Uses the ISO-8601 format of YYYY-MM-DDTHH:MM:SS±HHMM.',
required: true,
}),
to: Property.ShortText({
displayName: 'End Timestamp',
description: 'Timestamp for the end of the range to query (inclusive). Uses the ISO-8601 format of YYYY-MM-DDTHH:MM:SS±HHMM.',
required: true,
}),
cursor: Property.ShortText({
displayName: 'Cursor',
description: 'Cursor used for pagination purposes, returned as `next_cursor` in the response payload of the initial request. Not required for the first page.',
required: false,
}),
type: Property.ShortText({
displayName: 'Transaction Type',
description: 'Filters transactions by payments or payouts. If omitted, both are returned.',
required: false,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.GET,
url: `${trueLayerCommon.baseUrl}/v3/merchant-accounts/${ctx.propsValue.id}/transactions`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
'tl-enable-pagination': 'true',
},
queryParams: {
from: ctx.propsValue.from,
to: ctx.propsValue.to,
cursor: ctx.propsValue.cursor || '',
type: ctx.propsValue.type || '',
},
})
return response.body;
},
});

View File

@@ -0,0 +1,48 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const merchantAccountSetupSweeping = createAction({
auth: trueLayerCommon.auth,
name: 'merchant-account-setup-sweeping',
displayName: 'Set Up or Update Sweeping',
description: 'Set the automatic sweeping settings for a merchant account. At regular intervals, any available balance in excess of the configured `max_amount_in_minor` is withdrawn to a pre-configured IBAN.',
props: {
id: Property.ShortText({
displayName: 'Merchant Account ID',
description: 'The ID of the merchant account to set or update sweeping settings for.',
required: true,
}),
max_amount_in_minor: Property.ShortText({
displayName: 'Max Amount in Minor Units',
description: 'The amount above which sweeping will occur, expressed in minor units (e.g., 100 means 1 GBP).',
required: true,
}),
frequency: Property.ShortText({
displayName: 'Sweeping Frequency',
description: 'The frequency of the sweeping operation (e.g., daily, weekly).',
required: true,
}),
iban: Property.ShortText({
displayName: 'IBAN',
description: 'The IBAN to which sweeping funds will be transferred.',
required: true,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.POST,
url: `${trueLayerCommon.baseUrl}/v3/merchant-accounts/${ctx.propsValue.id}/sweeping`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
},
body: {
max_amount_in_minor: ctx.propsValue.max_amount_in_minor,
frequency: ctx.propsValue.frequency,
iban: ctx.propsValue.iban,
},
})
return response.body;
},
});

View File

@@ -0,0 +1,36 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const createPaymentLink = createAction({
auth: trueLayerCommon.auth,
name: 'create-payment-link',
displayName: 'Create Payment Link',
description: 'Create a new payment link. This API must be called using a backend bearer token.',
props: {
IdempotencyKeyHeader: Property.ShortText({
displayName: 'Idempotency Key Header',
description: 'Used to ensure idempotent requests.',
required: false,
}),
SignatureHeader: Property.ShortText({
displayName: 'Signature Header',
description: 'Used for request signature verification.',
required: false,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.POST,
url: `${trueLayerCommon.baseUrl}/v3/payment-links`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
'Idempotency-Key': ctx.propsValue.IdempotencyKeyHeader,
'Signature': ctx.propsValue.SignatureHeader,
},
body: ctx.propsValue,
})
return response.body;
},
});

View File

@@ -0,0 +1,42 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const getPaymentLinkPayments = createAction({
auth: trueLayerCommon.auth,
name: 'get-payment-link-payments',
displayName: 'Get Payments',
description: 'List all the payments associated with the payment link. This API must be called using a backend bearer token.',
props: {
id: Property.ShortText({
displayName: 'Payment Link ID',
description: 'The ID of the payment link for which payments are being retrieved.',
required: true,
}),
cursor: Property.ShortText({
displayName: 'Cursor',
description: 'Cursor used for pagination purposes, returned as `next_cursor` in the response payload of the initial request. Not required for the first page of items.',
required: false,
}),
limit: Property.ShortText({
displayName: 'Limit',
description: 'Optional limit on the number of payments to return.',
required: false,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.GET,
url: `${trueLayerCommon.baseUrl}/v3/payment-links/${ctx.propsValue.id}/payments`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
},
queryParams: {
cursor: ctx.propsValue.cursor || '',
limit: ctx.propsValue.limit || '',
},
})
return response.body;
},
});

View File

@@ -0,0 +1,28 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const getPaymentLink = createAction({
auth: trueLayerCommon.auth,
name: 'get-payment-link',
displayName: 'Get Payment Link',
description: 'Retrieves payment link details. This API must be called using a backend bearer token.',
props: {
id: Property.ShortText({
displayName: 'Payment Link ID',
description: 'The ID of the payment link to retrieve.',
required: true,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.GET,
url: `${trueLayerCommon.baseUrl}/v3/payment-links/${ctx.propsValue.id}`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
},
})
return response.body;
},
});

View File

@@ -0,0 +1,44 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const getPaymentProvider = createAction({
auth: trueLayerCommon.auth,
name: 'get-payment-provider',
displayName: 'Get Payment Provider',
description: 'Returns payment provider details. This API can be called without the need for authentication.',
props: {
id: Property.ShortText({
displayName: 'Payment Provider ID',
description: 'The ID of the payment provider to retrieve details for.',
required: true,
}),
client_id: Property.ShortText({
displayName: 'Client ID',
description: 'Optional client ID to retrieve specific provider details.',
required: false,
}),
icon_type: Property.ShortText({
displayName: 'Icon Type',
description: `Optional configuration for the type of icon:
- \`default\`: Default icon with no background (SVG).
- \`extended\`: Extended to a square with an appropriate background color (SVG).
- \`extended_small\`: Extended icon with 192x192 px size (JPEG).
- \`extended_medium\`: Extended icon with 432x432 px size (JPEG).
- \`extended_large\`: Extended icon jpeg with 864x864 px size (JPEG).`,
required: false,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.GET,
url: `${trueLayerCommon.baseUrl}/v3/payments-providers/${ctx.propsValue.id}`,
queryParams: {
client_id: ctx.propsValue.client_id || '',
icon_type: ctx.propsValue.icon_type || '',
},
})
return response.body;
},
});

View File

@@ -0,0 +1,20 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const searchPaymentProviders = createAction({
auth: trueLayerCommon.auth,
name: 'search-payment-providers',
displayName: 'Search Payment Providers',
description: 'Returns a list of payment providers.',
props: {},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.POST,
url: `${trueLayerCommon.baseUrl}/v3/payments-providers/search`,
body: ctx.propsValue,
})
return response.body;
},
});

View File

@@ -0,0 +1,28 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const cancelPayment = createAction({
auth: trueLayerCommon.auth,
name: 'cancel-payment',
displayName: 'Cancel Payment',
description: 'Cancel a payment. This API can be called using the `resource_token` associated with the payment or a backend bearer token.',
props: {
id: Property.ShortText({
displayName: 'Payment ID',
description: 'The ID of the payment to cancel.',
required: true,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.POST,
url: `${trueLayerCommon.baseUrl}/v3/payments/${ctx.propsValue.id}/actions/cancel`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
},
})
return response.body;
},
});

View File

@@ -0,0 +1,36 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const createPaymentRefund = createAction({
auth: trueLayerCommon.auth,
name: 'create-payment-refund',
displayName: 'Create Payment Refund',
description: 'Refund a merchant account payment, either fully or partially.',
props: {
id: Property.ShortText({
displayName: 'Payment ID',
description: 'The payment ID for the payment to be fully or partially refunded.',
required: true,
}),
amount_in_minor: Property.ShortText({
displayName: 'Amount in Minor Units',
description: 'The amount to refund, expressed in minor units (e.g., 100 means 1 GBP).',
required: false,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.POST,
url: `${trueLayerCommon.baseUrl}/v3/payments/${ctx.propsValue.id}/refunds`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
},
body: {
amount_in_minor: ctx.propsValue.amount_in_minor,
},
})
return response.body;
},
});

View File

@@ -0,0 +1,47 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const createPayment = createAction({
auth: trueLayerCommon.auth,
name: 'create-payment',
displayName: 'Create Payment',
description: 'Create a new payment. This API must be called using a backend bearer token.',
props: {
IdempotencyKeyHeader: Property.ShortText({
displayName: 'Idempotency Key',
description: 'A key that uniquely identifies the request. If the same key is sent in another request, the operation will have the same result as the first request.',
required: true,
}),
SignatureHeader: Property.ShortText({
displayName: 'Signature Header',
description: 'Header containing the signature of the request payload for authentication purposes.',
required: true,
}),
PsuIpAddressHeader: Property.ShortText({
displayName: 'PSU IP Address',
description: 'Used to collect and record the end-user\'s IP address. Only considered if the authorization_flow object in the request body is specified.',
required: false,
}),
DeviceUserAgentHeader: Property.ShortText({
displayName: 'Device User Agent',
description: 'Used to improve the end-user\'s authentication experience based on the device type. If omitted, the `User-Agent` header will be used instead. Only considered if the authorization_flow object in the request body is specified.',
required: false,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.POST,
url: `${trueLayerCommon.baseUrl}/v3/payments`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
'Idempotency-Key': ctx.propsValue.IdempotencyKeyHeader,
'Signature': ctx.propsValue.SignatureHeader,
'PSU-IP-Address': ctx.propsValue.PsuIpAddressHeader,
'Device-User-Agent': ctx.propsValue.DeviceUserAgentHeader,
},
body: ctx.propsValue,
});
return response.body;
}});

View File

@@ -0,0 +1,33 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const getPaymentRefund = createAction({
auth: trueLayerCommon.auth,
name: 'get-payment-refund',
displayName: 'Get Payment Refund',
description: 'Returns refund details for a specific payment.',
props: {
payment_id: Property.ShortText({
displayName: 'Payment ID',
description: 'The ID of the payment for which the refund was made.',
required: true,
}),
refund_id: Property.ShortText({
displayName: 'Refund ID',
description: 'The ID of the refund to retrieve details for.',
required: true,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.GET,
url: `${trueLayerCommon.baseUrl}/v3/payments/${ctx.propsValue.payment_id}/refunds/${ctx.propsValue.refund_id}`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
},
})
return response.body;
},
});

View File

@@ -0,0 +1,28 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const getPaymentRefunds = createAction({
auth: trueLayerCommon.auth,
name: 'get-payment-refunds',
displayName: 'Get Payment Refunds',
description: 'Returns all refunds of a payment.',
props: {
id: Property.ShortText({
displayName: 'Payment ID',
description: 'The ID of the merchant account payment to retrieve all refunds for.',
required: true,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.GET,
url: `${trueLayerCommon.baseUrl}/v3/payments/${ctx.propsValue.id}/refunds`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
},
})
return response.body
},
});

View File

@@ -0,0 +1,28 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const getPayment = createAction({
auth: trueLayerCommon.auth,
name: 'get-payment',
displayName: 'Get Payment',
description: 'Returns payment details. This API can be called using either the `resource_token` associated with the payment or a backend bearer token.',
props: {
id: Property.ShortText({
displayName: 'Payment ID',
description: 'The ID of the payment to retrieve.',
required: true,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.GET,
url: `${trueLayerCommon.baseUrl}/v3/payments/${ctx.propsValue.id}`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
},
})
return response.body;
},
});

View File

@@ -0,0 +1,29 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const saveUserAccountPayment = createAction({
auth: trueLayerCommon.auth,
name: 'save-user-account-payment',
displayName: 'Save Payment Account',
description: 'Save the account details associated with a payment for subsequent re-use. This API can be called using the `resource_token` associated with the payment or a backend bearer token.',
props: {
id: Property.ShortText({
displayName: 'Payment ID',
description: 'The ID of the payment to save the account details for.',
required: true,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.POST,
url: `${trueLayerCommon.baseUrl}/v3/payments/${ctx.propsValue.id}/actions/save-user-account`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
},
body: ctx.propsValue,
})
return response.body;
},
});

View File

@@ -0,0 +1,29 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const startPaymentAuthorizationFlow = createAction({
auth: trueLayerCommon.auth,
name: 'start-payment-authorization-flow',
displayName: 'Start Payment Authorization Flow',
description: 'Start the authorization flow for a payment. This API can be called using the `resource_token` associated with the payment or a backend bearer token.',
props: {
id: Property.ShortText({
displayName: 'Payment ID',
description: 'The ID of the payment for which to start the authorization flow.',
required: true,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.POST,
url: `${trueLayerCommon.baseUrl}/v3/payments/${ctx.propsValue.id}/authorization-flow`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
},
body: ctx.propsValue,
})
return response.body;
},
});

View File

@@ -0,0 +1,29 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const submitConsent = createAction({
auth: trueLayerCommon.auth,
name: 'submit-consent',
displayName: 'Submit Consent',
description: 'Submit the consent given by the user. This API can be called using the `resource_token` associated with the payment or a backend bearer token.',
props: {
id: Property.ShortText({
displayName: 'Payment ID',
description: 'The ID of the payment for which consent is being submitted.',
required: true,
}),
},
run: async (ctx) => {
const response = await await httpClient.sendRequest({
method: HttpMethod.POST,
url: `${trueLayerCommon.baseUrl}/v3/payments/${ctx.propsValue.id}/authorization-flow/actions/consent`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
},
body: ctx.propsValue,
})
return response.body
},
});

View File

@@ -0,0 +1,29 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const submitForm = createAction({
auth: trueLayerCommon.auth,
name: 'submit-form',
displayName: 'Submit Form',
description: 'Submit form details filled by the PSU. This API can be called using the `resource_token` associated with the payment or a backend bearer token.',
props: {
id: Property.ShortText({
displayName: 'Payment ID',
description: 'The ID of the payment for which the form is being submitted.',
required: true,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.POST,
url: `${trueLayerCommon.baseUrl}/v3/payments/${ctx.propsValue.id}/authorization-flow/actions/form`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
},
body: ctx.propsValue,
})
return response.body;
},
});

View File

@@ -0,0 +1,29 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const submitProviderSelection = createAction({
auth: trueLayerCommon.auth,
name: 'submit-provider-selection',
displayName: 'Submit Provider Selection',
description: 'Submit the provider details selected by the PSU. This API can be called using the `resource_token` associated with the payment or a backend bearer token.',
props: {
id: Property.ShortText({
displayName: 'Payment ID',
description: 'The ID of the payment for which provider selection is being submitted.',
required: true,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.POST,
url: `${trueLayerCommon.baseUrl}/v3/payments/${ctx.propsValue.id}/authorization-flow/actions/provider-selection`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
},
body: ctx.propsValue,
})
return response.body
},
});

View File

@@ -0,0 +1,29 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const submitSchemeSelection = createAction({
auth: trueLayerCommon.auth,
name: 'submit-scheme-selection',
displayName: 'Submit Scheme Selection',
description: 'Submit the scheme details selected by the PSU. This API can be called using the `resource_token` associated with the payment or a backend bearer token.',
props: {
id: Property.ShortText({
displayName: 'Payment ID',
description: 'The ID of the payment for which the scheme details are being submitted.',
required: true,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.POST,
url: `${trueLayerCommon.baseUrl}/v3/payments/${ctx.propsValue.id}/authorization-flow/actions/scheme-selection`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
},
body: ctx.propsValue,
})
return response.body
},
});

View File

@@ -0,0 +1,28 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const submitUserAccountSelection = createAction({
auth: trueLayerCommon.auth,
name: 'submit-user-account-selection',
displayName: 'Submit User Account Selection',
description: 'Submit the user account selection option given by the user. This API can be called using the `resource_token` associated with the payment or a backend bearer token.',
props: {
id: Property.ShortText({
displayName: 'Payment ID',
description: 'The ID of the payment for which the user account selection is being submitted.',
required: true,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.POST,
url: `${trueLayerCommon.baseUrl}/v3/payments/${ctx.propsValue.id}/authorization-flow/actions/user-account-selection`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
},
body: ctx.propsValue,
})
return response.body;}
});

View File

@@ -0,0 +1,35 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const createPayout = createAction({
auth: trueLayerCommon.auth,
name: 'create-payout',
displayName: 'Create payout',
description: 'Pay out from one of your merchant accounts. ',
props: {
IdempotencyKeyHeader: Property.ShortText({
displayName: 'Used to ensure idempotent requests',
required: true,
}),
SignatureHeader: Property.ShortText({
displayName: 'Used for request signature verification',
required: true,
}),
},
run: async (ctx) => {
const response = await await httpClient.sendRequest({
method: HttpMethod.POST,
url: `${trueLayerCommon.baseUrl}/v3/payouts`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
'Idempotency-Key': ctx.propsValue.IdempotencyKeyHeader,
'Signature': ctx.propsValue.SignatureHeader,
},
body: ctx.propsValue,
})
return response.body
},
});

View File

@@ -0,0 +1,29 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const getPayout = createAction({
auth: trueLayerCommon.auth,
name: 'get-payout',
displayName: 'Get payout',
description: 'Returns payout details. ',
props: {
id: Property.ShortText({
displayName: 'ID of the payout',
required: true,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.GET,
url: `${trueLayerCommon.baseUrl}/v3/payouts/${ctx.propsValue.id}`,
headers: {
Authorization: `${ctx.auth}`,
}
})
return response.body;
},
});

View File

@@ -0,0 +1,29 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const startPayoutAuthorizationFlow = createAction({
auth: trueLayerCommon.auth,
name: 'start-payout-authorization-flow',
displayName: 'Start authorization flow',
description: 'Start the authorization flow for a payout. This API can be called using the `resource_token` associated with the payout you are trying to fetch.',
props: {
id: Property.ShortText({
displayName: 'ID of the payout',
required: true,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.POST,
url: `${trueLayerCommon.baseUrl}/v3/payouts/${ctx.propsValue.id}/authorization-flow`,
headers: {
Authorization: `${ctx.auth}`,
},
body: ctx.propsValue,
})
return response.body;
},
});

View File

@@ -0,0 +1,23 @@
import { PieceAuth } from '@activepieces/pieces-framework';
export const trueLayerCommon = {
baseUrl: 'https://api.truelayer.com',
auth: PieceAuth.OAuth2({
description: 'Authentication for TrueLayer API',
authUrl:'https://auth.truelayer.com',
tokenUrl: 'https://auth.truelayer.com/connect/token',
required: true,
scope: [
'info',
'accounts',
'balance',
'cards',
'transactions',
'direct_debits',
'standing_orders',
'offline_access',
'signupplus',
'verification'
],
})
};