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,38 @@
{
"Key ID": "Schlüssel-ID",
"Key Secret": "Schlüsselgeheimnis",
"\n Enter your Key ID and Key Secret\n\n Login to your Dashboard with appropriate credentials.\n Select the mode (Test or Live) for which you want to generate the API key\n Navigate to Settings > API Keys > Generate Key to generate keys for the selected mode.\n\n The Key ID and Key Secret appear in a pop-out window.\n ": "\n Geben Sie Ihre Schlüssel-ID und Schlüsselgeheimnis\n\n ein und melden Sie sich in Ihrem Dashboard mit entsprechenden Anmeldedaten an.\n Wählen Sie den Modus (Test oder Live), für den Sie den API-Schlüssel generieren möchten\n Navigieren Sie zu Einstellungen > API-Schlüssel > Generieren um Schlüssel für den ausgewählten Modus zu generieren.\n\n Die Schlüssel-ID und das Schlüsselgeheimnis erscheinen in einem Pop-out-Fenster.\n ",
"Custom API Call": "Eigener API-Aufruf",
"Create Payment Link": "Zahlungslink erstellen",
"Make a custom API call to a specific endpoint": "Einen benutzerdefinierten API-Aufruf an einen bestimmten Endpunkt machen",
"Create a payment link": "Zahlungslink erstellen",
"Method": "Methode",
"Headers": "Kopfzeilen",
"Query Parameters": "Abfrageparameter",
"Body": "Körper",
"Response is Binary ?": "Antwort ist binär?",
"No Error on Failure": "Kein Fehler bei Fehler",
"Timeout (in seconds)": "Timeout (in Sekunden)",
"Amount": "Betrag",
"Currency": "Währung",
"Reference ID": "Referenz-ID",
"Description": "Beschreibung",
"Customer Name": "Kundenname",
"Customer Contact": "Kundenkontakt",
"Notify via SMS": "Per SMS benachrichtigen",
"Customer Email": "Kunden-E-Mail",
"Notify via Email": "Per E-Mail benachrichtigen",
"Notes": "Notizen",
"Callback URL": "Callback URL",
"Callback Method": "Rückrufmethode",
"Authorization headers are injected automatically from your connection.": "Autorisierungs-Header werden automatisch von Ihrer Verbindung injiziert.",
"Enable for files like PDFs, images, etc..": "Aktivieren für Dateien wie PDFs, Bilder, etc..",
"Send notification via SMS": "Benachrichtigung per SMS senden",
"Send notification via Email": "Benachrichtigung per E-Mail senden",
"GET": "ERHALTEN",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "LÖSCHEN",
"HEAD": "HEAD"
}

View File

@@ -0,0 +1,38 @@
{
"Key ID": "Clave ID",
"Key Secret": "Clave secreta",
"\n Enter your Key ID and Key Secret\n\n Login to your Dashboard with appropriate credentials.\n Select the mode (Test or Live) for which you want to generate the API key\n Navigate to Settings > API Keys > Generate Key to generate keys for the selected mode.\n\n The Key ID and Key Secret appear in a pop-out window.\n ": "\n Enter your Key ID and Key Secret\n\n Login to your Dashboard with appropriate credentials.\n Select the mode (Test or Live) for which you want to generate the API key\n Navigate to Settings > API Keys > Generate Key to generate keys for the selected mode.\n\n The Key ID and Key Secret appear in a pop-out window.\n ",
"Custom API Call": "Llamada API personalizada",
"Create Payment Link": "Crear enlace de pago",
"Make a custom API call to a specific endpoint": "Hacer una llamada API personalizada a un extremo específico",
"Create a payment link": "Crear un enlace de pago",
"Method": "Método",
"Headers": "Encabezados",
"Query Parameters": "Parámetros de consulta",
"Body": "Cuerpo",
"Response is Binary ?": "¿Respuesta es binaria?",
"No Error on Failure": "No hay ningún error en fallo",
"Timeout (in seconds)": "Tiempo de espera (en segundos)",
"Amount": "Cantidad",
"Currency": "Moneda",
"Reference ID": "ID de referencia",
"Description": "Descripción",
"Customer Name": "Nombre del cliente",
"Customer Contact": "Contacto del cliente",
"Notify via SMS": "Notificar vía SMS",
"Customer Email": "Email del cliente",
"Notify via Email": "Notificar por email",
"Notes": "Notas",
"Callback URL": "Callback URL",
"Callback Method": "Método de llamada",
"Authorization headers are injected automatically from your connection.": "Las cabeceras de autorización se inyectan automáticamente desde tu conexión.",
"Enable for files like PDFs, images, etc..": "Activar para archivos como PDFs, imágenes, etc.",
"Send notification via SMS": "Enviar notificación vía SMS",
"Send notification via Email": "Enviar notificación por email",
"GET": "RECOGER",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "BORRAR",
"HEAD": "LIMPIO"
}

View File

@@ -0,0 +1,38 @@
{
"Key ID": "ID de la clé",
"Key Secret": "Secret de la clé",
"\n Enter your Key ID and Key Secret\n\n Login to your Dashboard with appropriate credentials.\n Select the mode (Test or Live) for which you want to generate the API key\n Navigate to Settings > API Keys > Generate Key to generate keys for the selected mode.\n\n The Key ID and Key Secret appear in a pop-out window.\n ": "\n Enter your Key ID and Key Secret\n\n Login to your Dashboard with appropriate credentials.\n Select the mode (Test or Live) for which you want to generate the API key\n Navigate to Settings > API Keys > Generate Key to generate keys for the selected mode.\n\n The Key ID and Key Secret appear in a pop-out window.\n ",
"Custom API Call": "Appel d'API personnalisé",
"Create Payment Link": "Créer un lien de paiement",
"Make a custom API call to a specific endpoint": "Passer un appel API personnalisé à un endpoint spécifique",
"Create a payment link": "Créer un lien de paiement",
"Method": "Méthode",
"Headers": "En-têtes",
"Query Parameters": "Paramètres de requête",
"Body": "Corps",
"Response is Binary ?": "La réponse est Binaire ?",
"No Error on Failure": "Aucune erreur en cas d'échec",
"Timeout (in seconds)": "Délai d'expiration (en secondes)",
"Amount": "Montant",
"Currency": "Devise",
"Reference ID": "ID de référence",
"Description": "Libellé",
"Customer Name": "Nom du client",
"Customer Contact": "Contact client",
"Notify via SMS": "Notifier par SMS",
"Customer Email": "E-mail du client",
"Notify via Email": "Notifier par e-mail",
"Notes": "Notes",
"Callback URL": "Callback URL",
"Callback Method": "Méthode de rappel",
"Authorization headers are injected automatically from your connection.": "Les en-têtes d'autorisation sont injectés automatiquement à partir de votre connexion.",
"Enable for files like PDFs, images, etc..": "Activer pour les fichiers comme les PDFs, les images, etc.",
"Send notification via SMS": "Envoyer une notification par SMS",
"Send notification via Email": "Envoyer une notification par e-mail",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
"HEAD": "HEAD"
}

View File

@@ -0,0 +1,38 @@
{
"Key ID": "キー ID",
"Key Secret": "キーシークレット",
"\n Enter your Key ID and Key Secret\n\n Login to your Dashboard with appropriate credentials.\n Select the mode (Test or Live) for which you want to generate the API key\n Navigate to Settings > API Keys > Generate Key to generate keys for the selected mode.\n\n The Key ID and Key Secret appear in a pop-out window.\n ": "\n Enter your Key ID and Key Secret\n\n Login to your Dashboard with appropriate credentials.\n Select the mode (Test or Live) for which you want to generate the API key\n Navigate to Settings > API Keys > Generate Key to generate keys for the selected mode.\n\n The Key ID and Key Secret appear in a pop-out window.\n ",
"Custom API Call": "カスタムAPI通話",
"Create Payment Link": "支払いリンクを作成",
"Make a custom API call to a specific endpoint": "特定のエンドポイントへのカスタム API コールを実行します。",
"Create a payment link": "支払いリンクを作成する",
"Method": "方法",
"Headers": "ヘッダー",
"Query Parameters": "クエリパラメータ",
"Body": "本文",
"Response is Binary ?": "応答はバイナリですか?",
"No Error on Failure": "失敗時にエラーはありません",
"Timeout (in seconds)": "タイムアウト(秒)",
"Amount": "金額",
"Currency": "通貨",
"Reference ID": "参照ID",
"Description": "説明",
"Customer Name": "顧客名",
"Customer Contact": "お客様の連絡先",
"Notify via SMS": "SMS経由で通知",
"Customer Email": "顧客のメールアドレス",
"Notify via Email": "メールで通知",
"Notes": "メモ",
"Callback URL": "Callback URL",
"Callback Method": "コールバックメソッド",
"Authorization headers are injected automatically from your connection.": "認証ヘッダは接続から自動的に注入されます。",
"Enable for files like PDFs, images, etc..": "PDF、画像などのファイルを有効にします。",
"Send notification via SMS": "SMSで通知を送信",
"Send notification via Email": "電子メールで通知を送信",
"GET": "取得",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "削除",
"HEAD": "頭"
}

View File

@@ -0,0 +1,38 @@
{
"Key ID": "Sleutel ID",
"Key Secret": "Sleutel geheim",
"\n Enter your Key ID and Key Secret\n\n Login to your Dashboard with appropriate credentials.\n Select the mode (Test or Live) for which you want to generate the API key\n Navigate to Settings > API Keys > Generate Key to generate keys for the selected mode.\n\n The Key ID and Key Secret appear in a pop-out window.\n ": "\n Voer uw Key ID en Key Secret\n\n Login in uw Dashboard met de juiste gegevens.\n Selecteer de modus (Test of Live) waarvoor u de API-sleutel\n wilt genereren Ga naar Instellingen > API-sleutels > Genereer sleutels voor de geselecteerde modus.\n\n De Key ID en Key Secret verschijnen in een pop-out venster.\n ",
"Custom API Call": "Custom API Call",
"Create Payment Link": "Maak Payment Link",
"Make a custom API call to a specific endpoint": "Maak een aangepaste API call naar een specifiek eindpunt",
"Create a payment link": "Maak een betalingslink",
"Method": "Methode",
"Headers": "Kopteksten",
"Query Parameters": "Query parameters",
"Body": "Lichaam",
"Response is Binary ?": "Antwoord is binair?",
"No Error on Failure": "Geen fout bij fout",
"Timeout (in seconds)": "Time-out (in seconden)",
"Amount": "Hoeveelheid",
"Currency": "valuta",
"Reference ID": "Referentie ID",
"Description": "Beschrijving",
"Customer Name": "Klant naam",
"Customer Contact": "Contactpersoon klant",
"Notify via SMS": "Melden via SMS",
"Customer Email": "Klant e-mail",
"Notify via Email": "Melden via e-mail",
"Notes": "Opmerkingen",
"Callback URL": "Callback URL",
"Callback Method": "Terugbelnummer methode",
"Authorization headers are injected automatically from your connection.": "Autorisatie headers worden automatisch geïnjecteerd vanuit uw verbinding.",
"Enable for files like PDFs, images, etc..": "Inschakelen voor bestanden zoals PDF's, afbeeldingen etc..",
"Send notification via SMS": "Melding verzenden via SMS",
"Send notification via Email": "Melding verzenden via e-mail",
"GET": "KRIJG",
"POST": "POSTE",
"PATCH": "BEKIJK",
"PUT": "PUT",
"DELETE": "VERWIJDEREN",
"HEAD": "HOOFD"
}

View File

@@ -0,0 +1,38 @@
{
"Key ID": "ID da chave",
"Key Secret": "Segredo Chave",
"\n Enter your Key ID and Key Secret\n\n Login to your Dashboard with appropriate credentials.\n Select the mode (Test or Live) for which you want to generate the API key\n Navigate to Settings > API Keys > Generate Key to generate keys for the selected mode.\n\n The Key ID and Key Secret appear in a pop-out window.\n ": "\n Enter your Key ID and Key Secret\n\n Login to your Dashboard with appropriate credentials.\n Select the mode (Test or Live) for which you want to generate the API key\n Navigate to Settings > API Keys > Generate Key to generate keys for the selected mode.\n\n The Key ID and Key Secret appear in a pop-out window.\n ",
"Custom API Call": "Chamada de API personalizada",
"Create Payment Link": "Criar Link de Pagamento",
"Make a custom API call to a specific endpoint": "Faça uma chamada de API personalizada para um ponto de extremidade específico",
"Create a payment link": "Criar um link de pagamento",
"Method": "Método",
"Headers": "Cabeçalhos",
"Query Parameters": "Parâmetros da consulta",
"Body": "Conteúdo",
"Response is Binary ?": "A resposta é binária ?",
"No Error on Failure": "Nenhum erro no Failure",
"Timeout (in seconds)": "Tempo limite (em segundos)",
"Amount": "Quantidade",
"Currency": "moeda",
"Reference ID": "ID de Referência",
"Description": "Descrição",
"Customer Name": "Nome do cliente",
"Customer Contact": "Contato do cliente",
"Notify via SMS": "Notificar por SMS",
"Customer Email": "E-mail do Cliente",
"Notify via Email": "Notificar via E-mail",
"Notes": "Observações",
"Callback URL": "Callback URL",
"Callback Method": "Método de retorno",
"Authorization headers are injected automatically from your connection.": "Os cabeçalhos de autorização são inseridos automaticamente a partir da sua conexão.",
"Enable for files like PDFs, images, etc..": "Habilitar para arquivos como PDFs, imagens, etc..",
"Send notification via SMS": "Enviar notificação por SMS",
"Send notification via Email": "Enviar notificação por e-mail",
"GET": "OBTER",
"POST": "POSTAR",
"PATCH": "COMPRAR",
"PUT": "COLOCAR",
"DELETE": "EXCLUIR",
"HEAD": "CABEÇA"
}

View File

@@ -0,0 +1,37 @@
{
"Razorpay": "Razorpay",
"Key ID": "ID ключа",
"Key Secret": "Секретный ключ",
"\n Enter your Key ID and Key Secret\n\n Login to your Dashboard with appropriate credentials.\n Select the mode (Test or Live) for which you want to generate the API key\n Navigate to Settings > API Keys > Generate Key to generate keys for the selected mode.\n\n The Key ID and Key Secret appear in a pop-out window.\n ": "\n Enter your Key ID and Key Secret\n\n Login to your Dashboard with appropriate credentials.\n Select the mode (Test or Live) for which you want to generate the API key\n Navigate to Settings > API Keys > Generate Key to generate keys for the selected mode.\n\n The Key ID and Key Secret appear in a pop-out window.\n ",
"Custom API Call": "Пользовательский вызов API",
"Create Payment Link": "Создать платёжную ссылку",
"Make a custom API call to a specific endpoint": "Сделать пользовательский API вызов к определенной конечной точке",
"Create a payment link": "Создать платёжную ссылку",
"Method": "Метод",
"Headers": "Заголовки",
"Query Parameters": "Параметры запроса",
"Body": "Тело",
"No Error on Failure": "Нет ошибок при ошибке",
"Timeout (in seconds)": "Таймаут (в секундах)",
"Amount": "Сумма",
"Currency": "Валюта",
"Reference ID": "ID ссылки",
"Description": "Описание",
"Customer Name": "Имя клиента",
"Customer Contact": "Контакты клиента",
"Notify via SMS": "Уведомлять по СМС",
"Customer Email": "Email клиента",
"Notify via Email": "Уведомлять по электронной почте",
"Notes": "Примечания",
"Callback URL": "Callback URL",
"Callback Method": "Способ обратного вызова",
"Authorization headers are injected automatically from your connection.": "Заголовки авторизации включаются автоматически из вашего соединения.",
"Send notification via SMS": "Отправить уведомление по СМС",
"Send notification via Email": "Отправить уведомление по электронной почте",
"GET": "ПОЛУЧИТЬ",
"POST": "ПОСТ",
"PATCH": "ПАТЧ",
"PUT": "ПОКУПИТЬ",
"DELETE": "УДАЛИТЬ",
"HEAD": "HEAD"
}

View File

@@ -0,0 +1,38 @@
{
"Key ID": "Key ID",
"Key Secret": "Key Secret",
"\n Enter your Key ID and Key Secret\n\n Login to your Dashboard with appropriate credentials.\n Select the mode (Test or Live) for which you want to generate the API key\n Navigate to Settings > API Keys > Generate Key to generate keys for the selected mode.\n\n The Key ID and Key Secret appear in a pop-out window.\n ": "\n Enter your Key ID and Key Secret\n\n Login to your Dashboard with appropriate credentials.\n Select the mode (Test or Live) for which you want to generate the API key\n Navigate to Settings > API Keys > Generate Key to generate keys for the selected mode.\n\n The Key ID and Key Secret appear in a pop-out window.\n ",
"Custom API Call": "Custom API Call",
"Create Payment Link": "Create Payment Link",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"Create a payment link": "Create a payment link",
"Method": "Method",
"Headers": "Headers",
"Query Parameters": "Query Parameters",
"Body": "Body",
"Response is Binary ?": "Response is Binary ?",
"No Error on Failure": "No Error on Failure",
"Timeout (in seconds)": "Timeout (in seconds)",
"Amount": "Amount",
"Currency": "Currency",
"Reference ID": "Reference ID",
"Description": "Description",
"Customer Name": "Customer Name",
"Customer Contact": "Customer Contact",
"Notify via SMS": "Notify via SMS",
"Customer Email": "Customer Email",
"Notify via Email": "Notify via Email",
"Notes": "Notes",
"Callback URL": "Callback URL",
"Callback Method": "Callback Method",
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
"Enable for files like PDFs, images, etc..": "Enable for files like PDFs, images, etc..",
"Send notification via SMS": "Send notification via SMS",
"Send notification via Email": "Send notification via Email",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
"HEAD": "HEAD"
}

View File

@@ -0,0 +1,37 @@
{
"Razorpay": "Razorpay",
"Key ID": "Key ID",
"Key Secret": "Key Secret",
"\n Enter your Key ID and Key Secret\n\n Login to your Dashboard with appropriate credentials.\n Select the mode (Test or Live) for which you want to generate the API key\n Navigate to Settings > API Keys > Generate Key to generate keys for the selected mode.\n\n The Key ID and Key Secret appear in a pop-out window.\n ": "\n Enter your Key ID and Key Secret\n\n Login to your Dashboard with appropriate credentials.\n Select the mode (Test or Live) for which you want to generate the API key\n Navigate to Settings > API Keys > Generate Key to generate keys for the selected mode.\n\n The Key ID and Key Secret appear in a pop-out window.\n ",
"Custom API Call": "Custom API Call",
"Create Payment Link": "Create Payment Link",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"Create a payment link": "Create a payment link",
"Method": "Method",
"Headers": "Headers",
"Query Parameters": "Query Parameters",
"Body": "Body",
"No Error on Failure": "No Error on Failure",
"Timeout (in seconds)": "Timeout (in seconds)",
"Amount": "Amount",
"Currency": "Currency",
"Reference ID": "Reference ID",
"Description": "Description",
"Customer Name": "Customer Name",
"Customer Contact": "Customer Contact",
"Notify via SMS": "Notify via SMS",
"Customer Email": "Customer Email",
"Notify via Email": "Notify via Email",
"Notes": "Notes",
"Callback URL": "Callback URL",
"Callback Method": "Callback Method",
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
"Send notification via SMS": "Send notification via SMS",
"Send notification via Email": "Send notification via Email",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
"HEAD": "HEAD"
}

View File

@@ -0,0 +1,38 @@
{
"Key ID": "Key ID",
"Key Secret": "Key Secret",
"\n Enter your Key ID and Key Secret\n\n Login to your Dashboard with appropriate credentials.\n Select the mode (Test or Live) for which you want to generate the API key\n Navigate to Settings > API Keys > Generate Key to generate keys for the selected mode.\n\n The Key ID and Key Secret appear in a pop-out window.\n ": "\n Enter your Key ID and Key Secret\n\n Login to your Dashboard with appropriate credentials.\n Select the mode (Test or Live) for which you want to generate the API key\n Navigate to Settings > API Keys > Generate Key to generate keys for the selected mode.\n\n The Key ID and Key Secret appear in a pop-out window.\n ",
"Custom API Call": "自定义 API 呼叫",
"Create Payment Link": "Create Payment Link",
"Make a custom API call to a specific endpoint": "将一个自定义 API 调用到一个特定的终点",
"Create a payment link": "Create a payment link",
"Method": "方法",
"Headers": "信头",
"Query Parameters": "查询参数",
"Body": "正文内容",
"Response is Binary ?": "Response is Binary ?",
"No Error on Failure": "失败时没有错误",
"Timeout (in seconds)": "超时(秒)",
"Amount": "Amount",
"Currency": "Currency",
"Reference ID": "Reference ID",
"Description": "描述",
"Customer Name": "Customer Name",
"Customer Contact": "Customer Contact",
"Notify via SMS": "Notify via SMS",
"Customer Email": "Customer Email",
"Notify via Email": "Notify via Email",
"Notes": "Notes",
"Callback URL": "Callback URL",
"Callback Method": "Callback Method",
"Authorization headers are injected automatically from your connection.": "授权头自动从您的连接中注入。",
"Enable for files like PDFs, images, etc..": "Enable for files like PDFs, images, etc..",
"Send notification via SMS": "Send notification via SMS",
"Send notification via Email": "Send notification via Email",
"GET": "获取",
"POST": "帖子",
"PATCH": "PATCH",
"PUT": "弹出",
"DELETE": "删除",
"HEAD": "黑色"
}

View File

@@ -0,0 +1,45 @@
import { createCustomApiCallAction } from "@activepieces/pieces-common";
import { createPiece, PieceAuth, Property } from "@activepieces/pieces-framework";
import { generateRazorpayAuthHeader, RazorpayCredentials, razorpayURL } from "./lib/common/utils";
import { createPaymentlink } from "./lib/actions/create-payment-link";
export const razorpayAuth = PieceAuth.CustomAuth({
description: `
Enter your Key ID and Key Secret
Login to your Dashboard with appropriate credentials.
Select the mode (Test or Live) for which you want to generate the API key
Navigate to Settings > API Keys > Generate Key to generate keys for the selected mode.
The Key ID and Key Secret appear in a pop-out window.
`,
required: true,
props: {
keyID: Property.ShortText({
displayName: 'Key ID',
required: true,
}),
keySecret: PieceAuth.SecretText({
displayName: 'Key Secret',
required: true,
}),
}
})
export const razorpay = createPiece({
displayName: "Razorpay",
auth: razorpayAuth,
minimumSupportedRelease: '0.30.0',
logoUrl: "https://cdn.activepieces.com/pieces/razorpay.png",
authors: ['drona2938'],
actions: [
createCustomApiCallAction({
baseUrl: () => razorpayURL.apiURL,
auth: razorpayAuth,
authMapping: (auth) => generateRazorpayAuthHeader(auth.props),
}),
createPaymentlink
],
triggers: [],
});

View File

@@ -0,0 +1,108 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { generateRazorpayAuthHeader, RazorpayCredentials } from '../common/utils';
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { razorpayAuth } from '../..';
export const createPaymentlink = createAction({
name: 'create-payment-link',
auth: razorpayAuth,
displayName: 'Create Payment Link',
description: 'Create a payment link',
props: {
amount: Property.Number({
displayName: 'Amount',
required: true,
}),
currency: Property.ShortText({
displayName: 'Currency',
required: true,
defaultValue: 'INR',
}),
reference_id: Property.ShortText({
displayName: 'Reference ID',
required: false,
}),
description: Property.LongText({
displayName: 'Description',
required: false,
}),
customer_name: Property.ShortText({
displayName: 'Customer Name',
required: false,
}),
customer_contact: Property.ShortText({
displayName: 'Customer Contact',
required: true,
defaultValue: '+91',
}),
notify_sms: Property.Checkbox({
displayName: 'Notify via SMS',
description: 'Send notification via SMS',
required: false,
defaultValue: true,
}),
customer_email: Property.ShortText({
displayName: 'Customer Email',
required: false,
}),
notify_email: Property.Checkbox({
displayName: 'Notify via Email',
description: 'Send notification via Email',
required: false,
defaultValue: true,
}),
metafield_notes: Property.ShortText({
displayName: 'Notes',
required: false,
}),
callback_url: Property.ShortText({
displayName: 'Callback URL',
required: false,
}),
callback_method: Property.ShortText({
displayName: 'Callback Method',
required: false,
}),
},
async run(context) {
// Convert amount from rupee format to the format expected by Razorpay
const amountWithoutDecimal = Math.round(context.propsValue.amount * 100);
const paymentLinkData = {
amount: amountWithoutDecimal,
currency: context.propsValue.currency,
reference_id: context.propsValue.reference_id,
description: context.propsValue.description,
customer: {
name: context.propsValue.customer_name,
contact: context.propsValue.customer_contact,
email: context.propsValue.customer_email,
},
notify: {
sms: context.propsValue.notify_sms,
email: context.propsValue.notify_email,
},
notes: {
policy_name: context.propsValue.metafield_notes,
},
callback_url: context.propsValue.callback_url,
callback_method: context.propsValue.callback_method,
};
const authHeader = await generateRazorpayAuthHeader(context.auth.props);
const response = await httpClient.sendRequest({
method: HttpMethod.POST,
url: 'https://api.razorpay.com/v1/payment_links',
headers: {
...authHeader,
'Content-Type': 'application/json',
},
body: JSON.stringify(paymentLinkData),
});
return response.body;
},
});

View File

@@ -0,0 +1,17 @@
export type RazorpayCredentials = {
keyID: string;
keySecret: string;
};
export const generateRazorpayAuthHeader = (credentials: RazorpayCredentials): Promise<{ Authorization: string }> => {
const { keyID, keySecret } = credentials;
const encodedCredentials = Buffer.from(`${keyID}:${keySecret}`).toString('base64');
return Promise.resolve({
Authorization: `Basic ${encodedCredentials}`,
});
};
export const razorpayURL = {
apiURL: 'https://api.razorpay.com/v1/'
};