From d307c2082a3f5ae9d15ca38e5530b69329980c5d Mon Sep 17 00:00:00 2001 From: Michelle Bergeron Date: Thu, 2 Oct 2025 15:22:21 -0400 Subject: [PATCH 1/3] new components --- .../actions/create-gateway/create-gateway.mjs | 62 ++++++++ .../create-manual-payout.mjs | 54 +++++++ .../actions/create-paylink/create-paylink.mjs | 80 ++++++++++ .../actions/delete-gateway/delete-gateway.mjs | 33 ++++ .../actions/delete-invoice/delete-invoice.mjs | 35 +++++ .../actions/list-invoices/list-invoices.mjs | 26 +++ .../actions/remove-paylink/remove-paylink.mjs | 32 ++++ components/payrexx/package.json | 7 +- components/payrexx/payrexx.app.mjs | 148 +++++++++++++++++- 9 files changed, 471 insertions(+), 6 deletions(-) create mode 100644 components/payrexx/actions/create-gateway/create-gateway.mjs create mode 100644 components/payrexx/actions/create-manual-payout/create-manual-payout.mjs create mode 100644 components/payrexx/actions/create-paylink/create-paylink.mjs create mode 100644 components/payrexx/actions/delete-gateway/delete-gateway.mjs create mode 100644 components/payrexx/actions/delete-invoice/delete-invoice.mjs create mode 100644 components/payrexx/actions/list-invoices/list-invoices.mjs create mode 100644 components/payrexx/actions/remove-paylink/remove-paylink.mjs diff --git a/components/payrexx/actions/create-gateway/create-gateway.mjs b/components/payrexx/actions/create-gateway/create-gateway.mjs new file mode 100644 index 0000000000000..f9c3853ac3524 --- /dev/null +++ b/components/payrexx/actions/create-gateway/create-gateway.mjs @@ -0,0 +1,62 @@ +import payrexx from "../../payrexx.app.mjs"; + +export default { + key: "payrexx-create-gateway", + name: "Create Gateway", + description: "Create a new gateway. [See the documentation](https://developers.payrexx.com/reference/create-a-gateway)", + type: "action", + version: "0.0.1", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: false, + }, + props: { + payrexx, + amount: { + propDefinition: [ + payrexx, + "amount", + ], + }, + currency: { + propDefinition: [ + payrexx, + "currency", + ], + }, + sku: { + propDefinition: [ + payrexx, + "sku", + ], + }, + purpose: { + propDefinition: [ + payrexx, + "purpose", + ], + }, + vatRate: { + propDefinition: [ + payrexx, + "vatRate", + ], + }, + }, + async run({ $ }) { + const response = await this.payrexx.createGateway({ + $, + data: { + amount: this.amount, + currency: this.currency, + sku: this.sku, + purpose: this.purpose, + vatRate: this.vatRate, + }, + }); + + $.export("$summary", `Successfully created gateway with ID: ${response.data[0]?.id}`); + return response; + }, +}; diff --git a/components/payrexx/actions/create-manual-payout/create-manual-payout.mjs b/components/payrexx/actions/create-manual-payout/create-manual-payout.mjs new file mode 100644 index 0000000000000..9d0aad1dcb59c --- /dev/null +++ b/components/payrexx/actions/create-manual-payout/create-manual-payout.mjs @@ -0,0 +1,54 @@ +import payrexx from "../../payrexx.app.mjs"; + +export default { + key: "payrexx-create-manual-payout", + name: "Create Manual Payout", + description: "Create a manual payout. [See the documentation](https://developers.payrexx.com/reference/create-manual-payout)", + type: "action", + version: "0.0.1", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: false, + }, + props: { + payrexx, + amount: { + propDefinition: [ + payrexx, + "amount", + ], + }, + currency: { + propDefinition: [ + payrexx, + "currency", + ], + }, + pspId: { + type: "string", + label: "PSP ID", + description: "ID of the PSP from which the payout is to be triggered. 44 for Swiss Collecting and 36 for Payrexx Direct", + }, + statementDescriptor: { + type: "string", + label: "Statement Descriptor", + description: "Statement of the payout. Visible in bank statement.", + optional: true, + }, + }, + async run({ $ }) { + const response = await this.payrexx.createManualPayout({ + $, + data: { + amount: this.amount, + currency: this.currency, + pspId: this.pspId, + statementDescriptor: this.statementDescriptor, + }, + }); + + $.export("$summary", `Successfully created manual payout with ID: ${response.data[0]?.id}`); + return response; + }, +}; diff --git a/components/payrexx/actions/create-paylink/create-paylink.mjs b/components/payrexx/actions/create-paylink/create-paylink.mjs new file mode 100644 index 0000000000000..06b921bb2f8f2 --- /dev/null +++ b/components/payrexx/actions/create-paylink/create-paylink.mjs @@ -0,0 +1,80 @@ +import payrexx from "../../payrexx.app.mjs"; + +export default { + key: "payrexx-create-paylink", + name: "Create Paylink", + description: "Create a paylink. [See the documentation](https://developers.payrexx.com/reference/create-a-paylink)", + type: "action", + version: "0.0.1", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: false, + }, + props: { + payrexx, + title: { + type: "string", + label: "Title", + description: "This is the page title which will be shown on the payment page", + }, + description: { + type: "string", + label: "Description", + description: "This is a description which will be shown on the payment page", + }, + referenceId: { + type: "string", + label: "Reference ID", + description: "An internal reference id used by your system", + }, + purpose: { + propDefinition: [ + payrexx, + "purpose", + ], + }, + amount: { + propDefinition: [ + payrexx, + "amount", + ], + }, + currency: { + propDefinition: [ + payrexx, + "currency", + ], + }, + vatRate: { + propDefinition: [ + payrexx, + "vatRate", + ], + }, + sku: { + propDefinition: [ + payrexx, + "sku", + ], + }, + }, + async run({ $ }) { + const response = await this.payrexx.createPaylink({ + $, + data: { + title: this.title, + description: this.description, + referenceId: this.referenceId, + purpose: this.purpose, + amount: this.amount, + currency: this.currency, + vatRate: this.vatRate, + sku: this.sku, + }, + }); + + $.export("$summary", `Successfully created paylink with ID: ${response.data[0]?.id}`); + return response; + }, +}; diff --git a/components/payrexx/actions/delete-gateway/delete-gateway.mjs b/components/payrexx/actions/delete-gateway/delete-gateway.mjs new file mode 100644 index 0000000000000..29daa3f61230b --- /dev/null +++ b/components/payrexx/actions/delete-gateway/delete-gateway.mjs @@ -0,0 +1,33 @@ +import payrexx from "../../payrexx.app.mjs"; + +export default { + key: "payrexx-delete-gateway", + name: "Delete Gateway", + description: "Delete a gateway. [See the documentation](https://developers.payrexx.com/reference/delete-a-gateway)", + type: "action", + version: "0.0.1", + annotations: { + destructiveHint: true, + openWorldHint: true, + readOnlyHint: false, + }, + props: { + payrexx, + gatewayId: { + propDefinition: [ + payrexx, + "gatewayId", + ], + }, + }, + async run({ $ }) { + const response = await this.payrexx.deleteGateway({ + $, + gatewayId: this.gatewayId, + }); + + $.export("$summary", `Successfully deleted gateway with ID ${this.gatewayId}.`); + + return response; + }, +}; diff --git a/components/payrexx/actions/delete-invoice/delete-invoice.mjs b/components/payrexx/actions/delete-invoice/delete-invoice.mjs new file mode 100644 index 0000000000000..1f2c6b7e41be4 --- /dev/null +++ b/components/payrexx/actions/delete-invoice/delete-invoice.mjs @@ -0,0 +1,35 @@ +import payrexx from "../../payrexx.app.mjs"; + +export default { + key: "payrexx-delete-invoice", + name: "Delete Invoice", + description: "Delete an invoice. [See the documentation](https://payrexxserviceapi.readme.io/reference/delete-an-invoice)", + type: "action", + version: "0.0.1", + annotations: { + destructiveHint: true, + openWorldHint: true, + readOnlyHint: false, + }, + props: { + payrexx, + invoiceId: { + propDefinition: [ + payrexx, + "invoiceId", + (c) => ({ + merchantId: c.merchantId, + }), + ], + }, + }, + async run({ $ }) { + const response = await this.payrexx.deleteInvoice({ + $, + invoiceId: this.invoiceId, + }); + + $.export("$summary", `Successfully deleted invoice with ID ${this.invoiceId}.`); + return response; + }, +}; diff --git a/components/payrexx/actions/list-invoices/list-invoices.mjs b/components/payrexx/actions/list-invoices/list-invoices.mjs new file mode 100644 index 0000000000000..f4d00e04f776f --- /dev/null +++ b/components/payrexx/actions/list-invoices/list-invoices.mjs @@ -0,0 +1,26 @@ +import payrexx from "../../payrexx.app.mjs"; + +export default { + key: "payrexx-list-invoices", + name: "List Invoices", + description: "List all invoices for a merchant. [See the documentation](https://payrexxserviceapi.readme.io/reference/list-all-invoices)", + type: "action", + version: "0.0.1", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + props: { + payrexx, + }, + async run({ $ }) { + const response = await this.payrexx.listInvoices({ + $, + }); + + $.export("$summary", `Successfully fetched ${response.data?.length} invoices`); + + return response; + }, +}; diff --git a/components/payrexx/actions/remove-paylink/remove-paylink.mjs b/components/payrexx/actions/remove-paylink/remove-paylink.mjs new file mode 100644 index 0000000000000..421cbb076d192 --- /dev/null +++ b/components/payrexx/actions/remove-paylink/remove-paylink.mjs @@ -0,0 +1,32 @@ +import payrexx from "../../payrexx.app.mjs"; + +export default { + key: "payrexx-remove-paylink", + name: "Remove Paylink", + description: "Remove a paylink. [See the documentation](https://developers.payrexx.com/reference/remove-a-paylink)", + type: "action", + version: "0.0.1", + annotations: { + destructiveHint: true, + openWorldHint: true, + readOnlyHint: false, + }, + props: { + payrexx, + paylinkId: { + propDefinition: [ + payrexx, + "paylinkId", + ], + }, + }, + async run({ $ }) { + const response = await this.payrexx.removePaylink({ + $, + paylinkId: this.paylinkId, + }); + + $.export("$summary", `Successfully removed paylink with ID ${this.paylinkId}.`); + return response; + }, +}; diff --git a/components/payrexx/package.json b/components/payrexx/package.json index f07ddd62d0302..39ddf26983bef 100644 --- a/components/payrexx/package.json +++ b/components/payrexx/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/payrexx", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream Payrexx Components", "main": "payrexx.app.mjs", "keywords": [ @@ -11,5 +11,8 @@ "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.1.0" } -} \ No newline at end of file +} diff --git a/components/payrexx/payrexx.app.mjs b/components/payrexx/payrexx.app.mjs index f7706b077d480..f96441e9a2270 100644 --- a/components/payrexx/payrexx.app.mjs +++ b/components/payrexx/payrexx.app.mjs @@ -1,11 +1,151 @@ +import { + axios, ConfigurationError, +} from "@pipedream/platform"; +import crypto from "crypto"; + export default { type: "app", app: "payrexx", - propDefinitions: {}, + propDefinitions: { + invoiceId: { + type: "string", + label: "Invoice ID", + description: "The ID of the invoice", + async options() { + const { data } = await this.listInvoices(); + return data?.map(({ + id, number, + }) => ({ + label: `Invoice #${number}`, + value: id, + })) || []; + }, + }, + gatewayId: { + type: "string", + label: "Gateway ID", + description: "The ID of the gateway", + }, + paylinkId: { + type: "string", + label: "Paylink ID", + description: "The ID of the paylink", + }, + amount: { + type: "string", + label: "Amount", + description: "Amount of payment in cents", + }, + purpose: { + type: "string", + label: "Purpose", + description: "The purpose of the payment", + }, + currency: { + type: "string", + label: "Currency", + description: "Currency of payment (ISO code)", + }, + vatRate: { + type: "string", + label: "VAT Rate", + description: "VAT Rate Percentage", + optional: true, + }, + sku: { + type: "string", + label: "SKU", + description: "Product stock keeping unit", + optional: true, + }, + }, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + _baseUrl() { + return "https://api.payrexx.com/v1.11"; + }, + _authParams() { + const apiSignature = crypto + .createHmac("sha256", this.$auth.api_key) + .update("") + .digest("base64"); + + return { + instance: this.$auth.instance_name, + ApiSignature: apiSignature, + }; + }, + async _makeRequest({ + $ = this, path, params, ...opts + }) { + const response = await axios($, { + url: `${this._baseUrl()}${path}`, + headers: { + "X-API-KEY": this.$auth.api_key, + }, + params: { + ...params, + ...this._authParams(), + }, + ...opts, + }); + if (response?.status === "error") { + throw new ConfigurationError(response.message); + } + return response; + }, + listInvoices(opts = {}) { + return this._makeRequest({ + path: "/Bill/", + ...opts, + }); + }, + createGateway(opts = {}) { + return this._makeRequest({ + path: "/Gateway/", + method: "POST", + ...opts, + }); + }, + createPaylink(opts = {}) { + return this._makeRequest({ + path: "/Invoice/", + method: "POST", + ...opts, + }); + }, + createManualPayout(opts = {}) { + return this._makeRequest({ + path: "/Payout/", + method: "POST", + ...opts, + }); + }, + deleteGateway({ + gatewayId, ...opts + }) { + return this._makeRequest({ + path: `/Gateway/${gatewayId}/`, + method: "DELETE", + ...opts, + }); + }, + deleteInvoice({ + invoiceId, ...opts + }) { + return this._makeRequest({ + path: `/Bill/${invoiceId}/`, + method: "DELETE", + ...opts, + }); + }, + removePaylink({ + paylinkId, ...opts + }) { + return this._makeRequest({ + path: `/Invoice/${paylinkId}`, + method: "DELETE", + ...opts, + }); }, }, }; From d1b8327a2d0530876883022e81fa0a673dfaafe3 Mon Sep 17 00:00:00 2001 From: Michelle Bergeron Date: Thu, 2 Oct 2025 15:23:04 -0400 Subject: [PATCH 2/3] pnpm-lock.yaml --- pnpm-lock.yaml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ea44693291448..39005d9260a5c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10421,7 +10421,11 @@ importers: components/paypro: {} - components/payrexx: {} + components/payrexx: + dependencies: + '@pipedream/platform': + specifier: ^3.1.0 + version: 3.1.0 components/paystack: dependencies: @@ -31341,22 +31345,22 @@ packages: superagent@3.8.1: resolution: {integrity: sha512-VMBFLYgFuRdfeNQSMLbxGSLfmXL/xc+OO+BZp41Za/NRDBet/BNbkRJrYzCUu0u4GU0i/ml2dtT8b9qgkw9z6Q==} engines: {node: '>= 4.0'} - deprecated: Please upgrade to v7.0.2+ of superagent. We have fixed numerous issues with streams, form-data, attach(), filesystem errors not bubbling up (ENOENT on attach()), and all tests are now passing. See the releases tab for more information at . + deprecated: Please upgrade to superagent v10.2.2+, see release notes at https://github.com/forwardemail/superagent/releases/tag/v10.2.2 - maintenance is supported by Forward Email @ https://forwardemail.net superagent@4.1.0: resolution: {integrity: sha512-FT3QLMasz0YyCd4uIi5HNe+3t/onxMyEho7C3PSqmti3Twgy2rXT4fmkTz6wRL6bTF4uzPcfkUCa8u4JWHw8Ag==} engines: {node: '>= 6.0'} - deprecated: Please upgrade to v7.0.2+ of superagent. We have fixed numerous issues with streams, form-data, attach(), filesystem errors not bubbling up (ENOENT on attach()), and all tests are now passing. See the releases tab for more information at . + deprecated: Please upgrade to superagent v10.2.2+, see release notes at https://github.com/forwardemail/superagent/releases/tag/v10.2.2 - maintenance is supported by Forward Email @ https://forwardemail.net superagent@5.3.1: resolution: {integrity: sha512-wjJ/MoTid2/RuGCOFtlacyGNxN9QLMgcpYLDQlWFIhhdJ93kNscFonGvrpAHSCVjRVj++DGCglocF7Aej1KHvQ==} engines: {node: '>= 7.0.0'} - deprecated: Please upgrade to v7.0.2+ of superagent. We have fixed numerous issues with streams, form-data, attach(), filesystem errors not bubbling up (ENOENT on attach()), and all tests are now passing. See the releases tab for more information at . + deprecated: Please upgrade to superagent v10.2.2+, see release notes at https://github.com/forwardemail/superagent/releases/tag/v10.2.2 - maintenance is supported by Forward Email @ https://forwardemail.net superagent@7.1.6: resolution: {integrity: sha512-gZkVCQR1gy/oUXr+kxJMLDjla434KmSOKbx5iGD30Ql+AkJQ/YlPKECJy2nhqOsHLjGHzoDTXNSjhnvWhzKk7g==} engines: {node: '>=6.4.0 <13 || >=14'} - deprecated: Please downgrade to v7.1.5 if you need IE/ActiveXObject support OR upgrade to v8.0.0 as we no longer support IE and published an incorrect patch version (see https://github.com/visionmedia/superagent/issues/1731) + deprecated: Please upgrade to superagent v10.2.2+, see release notes at https://github.com/forwardemail/superagent/releases/tag/v10.2.2 - maintenance is supported by Forward Email @ https://forwardemail.net supports-color@10.0.0: resolution: {integrity: sha512-HRVVSbCCMbj7/kdWF9Q+bbckjBHLtHMEoJWlkmYzzdwhYMkjkOwubLM6t7NbWKjgKamGDrWL1++KrjUO1t9oAQ==} From 3461c4df388fb77eae53cc22a0dec8c1977840ab Mon Sep 17 00:00:00 2001 From: Michelle Bergeron Date: Thu, 2 Oct 2025 15:35:23 -0400 Subject: [PATCH 3/3] updates --- components/payrexx/actions/delete-invoice/delete-invoice.mjs | 3 --- components/payrexx/payrexx.app.mjs | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/components/payrexx/actions/delete-invoice/delete-invoice.mjs b/components/payrexx/actions/delete-invoice/delete-invoice.mjs index 1f2c6b7e41be4..abc389ad7ca39 100644 --- a/components/payrexx/actions/delete-invoice/delete-invoice.mjs +++ b/components/payrexx/actions/delete-invoice/delete-invoice.mjs @@ -17,9 +17,6 @@ export default { propDefinition: [ payrexx, "invoiceId", - (c) => ({ - merchantId: c.merchantId, - }), ], }, }, diff --git a/components/payrexx/payrexx.app.mjs b/components/payrexx/payrexx.app.mjs index f96441e9a2270..f3df747235c8e 100644 --- a/components/payrexx/payrexx.app.mjs +++ b/components/payrexx/payrexx.app.mjs @@ -32,7 +32,7 @@ export default { description: "The ID of the paylink", }, amount: { - type: "string", + type: "integer", label: "Amount", description: "Amount of payment in cents", },