diff --git a/components/acronis_cyber_protect_cloud/acronis_cyber_protect_cloud.app.mjs b/components/acronis_cyber_protect_cloud/acronis_cyber_protect_cloud.app.mjs index 745d1de9c2d55..43191262b5d24 100644 --- a/components/acronis_cyber_protect_cloud/acronis_cyber_protect_cloud.app.mjs +++ b/components/acronis_cyber_protect_cloud/acronis_cyber_protect_cloud.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/bitdefender_gravityzone/bitdefender_gravityzone.app.mjs b/components/bitdefender_gravityzone/bitdefender_gravityzone.app.mjs index 03334504881b3..711b49f8a7886 100644 --- a/components/bitdefender_gravityzone/bitdefender_gravityzone.app.mjs +++ b/components/bitdefender_gravityzone/bitdefender_gravityzone.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/demandbase/demandbase.app.mjs b/components/demandbase/demandbase.app.mjs index 15d850a7ead94..de53a87b7d83f 100644 --- a/components/demandbase/demandbase.app.mjs +++ b/components/demandbase/demandbase.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/goto_meeting/goto_meeting.app.mjs b/components/goto_meeting/goto_meeting.app.mjs index 838a2e1120627..aae71d3197a52 100644 --- a/components/goto_meeting/goto_meeting.app.mjs +++ b/components/goto_meeting/goto_meeting.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/recruiterflow/recruiterflow.app.mjs b/components/recruiterflow/recruiterflow.app.mjs index 82e5ab3d2bde3..2ed913a9dd926 100644 --- a/components/recruiterflow/recruiterflow.app.mjs +++ b/components/recruiterflow/recruiterflow.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/wolfram_alpha/wolfram_alpha.app.mjs b/components/wolfram_alpha/wolfram_alpha.app.mjs index 4e89c2271c21c..6bfa6b5006c3e 100644 --- a/components/wolfram_alpha/wolfram_alpha.app.mjs +++ b/components/wolfram_alpha/wolfram_alpha.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/zoho_subscriptions/actions/create-customer/create-customer.mjs b/components/zoho_subscriptions/actions/create-customer/create-customer.mjs index be5f8533f5e96..bd78d6dd473d6 100644 --- a/components/zoho_subscriptions/actions/create-customer/create-customer.mjs +++ b/components/zoho_subscriptions/actions/create-customer/create-customer.mjs @@ -3,8 +3,8 @@ import zohoSubscriptions from "../../zoho_subscriptions.app.mjs"; export default { key: "zoho_subscriptions-create-customer", name: "Create Customer", - version: "0.0.1", - description: "Create a new customer. [See the documentation](https://www.zoho.com/subscriptions/api/v1/customers/#create-a-customer)", + version: "0.0.2", + description: "Create a new customer. [See the documentation](https://www.zoho.com/billing/api/v1/customers/#create-a-customer)", type: "action", props: { zohoSubscriptions, @@ -80,97 +80,97 @@ export default { }, billingAddressAttention: { type: "string", - label: "Attention", + label: "Billing Address - Attention", description: "Attention of the customer's billing address.", optional: true, }, billingAddressStreet: { type: "string", - label: "Street", + label: "Billing Address - Street", description: "Street of the customer's billing address.", optional: true, }, billingAddressCity: { type: "string", - label: "City", + label: "Billing Address - City", description: "City of the customer's billing address.", optional: true, }, billingAddressState: { type: "string", - label: "State", + label: "Billing Address - State", description: "State of the customer's billing address.", optional: true, }, billingAddressZip: { type: "string", - label: "Zip", + label: "Billing Address - Zip", description: "Zip of the customer's billing address.", optional: true, }, billingAddressCountry: { type: "string", - label: "Country", + label: "Billing Address - Country", description: "Country of the customer's billing address.", optional: true, }, billingAddressStateCode: { type: "string", - label: "State Code", + label: "Billing Address - State Code", description: "State Code of the customer's billing address.", optional: true, }, billingAddressFax: { type: "string", - label: "Fax", + label: "Billing Address - Fax", description: "Fax of the customer's billing address.", optional: true, }, shippingAddressAttention: { type: "string", - label: "Attention", + label: "Shipping Address - Attention", description: "Attention of the customer's shipping address.", optional: true, }, shippingAddressStreet: { type: "string", - label: "Street", + label: "Shipping Address - Street", description: "Street of the customer's shipping address.", optional: true, }, shippingAddressCity: { type: "string", - label: "City", + label: "Shipping Address - City", description: "City of the customer's shipping address.", optional: true, }, shippingAddressState: { type: "string", - label: "State", + label: "Shipping Address - State", description: "State of the customer's shipping address.", optional: true, }, shippingAddressZip: { type: "string", - label: "Zip", + label: "Shipping Address - Zip", description: "Zip of the customer's shipping address.", optional: true, }, shippingAddressCountry: { type: "string", - label: "Country", + label: "Shipping Address - Country", description: "Country of the customer's shipping address.", optional: true, }, shippingAddressStateCode: { type: "string", - label: "State Code", + label: "Shipping Address - State Code", description: "State Code of the customer's shipping address.", optional: true, }, shippingAddressFax: { type: "string", - label: "Fax", + label: "Shipping Address - Fax", description: "Fax of the customer's shipping address.", optional: true, }, diff --git a/components/zoho_subscriptions/actions/create-subscription/create-subscription.mjs b/components/zoho_subscriptions/actions/create-subscription/create-subscription.mjs index 83e4de39cc071..64dbd3423b41a 100644 --- a/components/zoho_subscriptions/actions/create-subscription/create-subscription.mjs +++ b/components/zoho_subscriptions/actions/create-subscription/create-subscription.mjs @@ -4,8 +4,8 @@ import zohoSubscriptions from "../../zoho_subscriptions.app.mjs"; export default { key: "zoho_subscriptions-create-subscription", name: "Create Subscription", - version: "0.0.1", - description: "Create a new subscription. [See the documentation](https://www.zoho.com/subscriptions/api/v1/subscription/#create-a-subscription)", + version: "0.0.2", + description: "Create a new subscription. [See the documentation](https://www.zoho.com/billing/api/v1/subscription/#create-a-subscription)", type: "action", props: { zohoSubscriptions, @@ -29,6 +29,7 @@ export default { organizationId, }), ], + reloadProps: true, }, paymentTerms: { propDefinition: [ @@ -322,6 +323,35 @@ export default { optional: true, }, }, + async additionalProps(existingProps) { + const props = {}; + if (!this.customerId) { + return props; + } + try { + const { customer } = await this.zohoSubscriptions.getCustomer({ + customerId: this.customerId, + }); + const { contact_person: contactperson } = await this.zohoSubscriptions.getContactPerson({ + customerId: this.customerId, + contactpersonId: customer.primary_contactperson_id, + }); + if (!customer.email && !contactperson.email) { + existingProps.contactpersons.hidden = true; + props.contactEmail = { + type: "string", + label: "Contact Email", + }; + } + } catch { + props.contactEmail = { + type: "string", + label: "Contact Email", + optional: true, + }; + } + return props; + }, async run({ $ }) { const { zohoSubscriptions, @@ -367,14 +397,15 @@ export default { cfdiUsage, allowPartialPayments, accountId, + contactEmail, } = this; if (autoCollect && !cardId) { - throw new ConfigurationError("By setting Auto-Collect to `true`, you must to fill in the card Id."); + throw new ConfigurationError("If setting Auto-Collect to `true`, you must fill in the card Id."); } if (autoCollect && !accountId) { - throw new ConfigurationError("By setting Auto-Collect to `true`, you must to fill in the Account Id."); + throw new ConfigurationError("If setting Auto-Collect to `true`, you must fill in the Account Id."); } let exchangeRateFloat = null; @@ -404,6 +435,27 @@ export default { } } + const { customer } = await zohoSubscriptions.getCustomer({ + customerId, + }); + if (contactEmail) { + await zohoSubscriptions.updateCustomer({ + customerId, + data: { + display_name: customer.display_name, + email: contactEmail, + }, + }); + } else { + const { contact_person: contactperson } = await zohoSubscriptions.getContactPerson({ + customerId, + contactpersonId: customer.primary_contactperson_id, + }); + if (!customer.email && !contactperson.email) { + throw new ConfigurationError("Customer must have an email address"); + } + } + const response = await zohoSubscriptions.createSubscription({ $, organizationId, diff --git a/components/zoho_subscriptions/package.json b/components/zoho_subscriptions/package.json index 6ab6dc147349b..5638c7d5ff781 100644 --- a/components/zoho_subscriptions/package.json +++ b/components/zoho_subscriptions/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/zoho_subscriptions", - "version": "0.1.0", + "version": "0.1.1", "description": "Pipedream Zoho Subscriptions Components", "main": "zoho_subscriptions.app.mjs", "keywords": [ @@ -13,6 +13,7 @@ "access": "public" }, "dependencies": { + "@pipedream/platform": "^3.0.3", "moment": "^2.29.4" } } diff --git a/components/zoho_subscriptions/sources/payment-failure/payment-failure.mjs b/components/zoho_subscriptions/sources/payment-failure/payment-failure.mjs index 075a280f000be..04ec2e056303b 100644 --- a/components/zoho_subscriptions/sources/payment-failure/payment-failure.mjs +++ b/components/zoho_subscriptions/sources/payment-failure/payment-failure.mjs @@ -5,7 +5,7 @@ import zohoSubscriptions from "../../zoho_subscriptions.app.mjs"; export default { key: "zoho_subscriptions-payment-failure", name: "New Payment Failure", - version: "0.0.1", + version: "0.0.2", description: "Emit new event when a payment fails to process.", type: "source", dedupe: "unique", diff --git a/components/zoho_subscriptions/sources/subscription-created/subscription-created.mjs b/components/zoho_subscriptions/sources/subscription-created/subscription-created.mjs index 582b3774da36b..ed2da52f00052 100644 --- a/components/zoho_subscriptions/sources/subscription-created/subscription-created.mjs +++ b/components/zoho_subscriptions/sources/subscription-created/subscription-created.mjs @@ -5,7 +5,7 @@ import zohoSubscriptions from "../../zoho_subscriptions.app.mjs"; export default { key: "zoho_subscriptions-subscription-created", name: "New Subscription Created", - version: "0.0.1", + version: "0.0.2", description: "Emit new event when a new subscription is created.", type: "source", dedupe: "unique", diff --git a/components/zoho_subscriptions/zoho_subscriptions.app.mjs b/components/zoho_subscriptions/zoho_subscriptions.app.mjs index c806b505c00bc..1b6500f8ed732 100644 --- a/components/zoho_subscriptions/zoho_subscriptions.app.mjs +++ b/components/zoho_subscriptions/zoho_subscriptions.app.mjs @@ -8,7 +8,7 @@ export default { cardId: { type: "string", label: "Card Id", - description: "Enter the card Id of the card which has to be updated..", + description: "Enter the card Id of the card which is to be updated.", async options({ page, customerId, organizationId, }) { @@ -134,7 +134,7 @@ export default { }, methods: { _apiUrl() { - return `${this.$auth.api_domain}/subscriptions/v1`; + return `${this.$auth.api_domain}/billing/v1`; }, _getHeaders(organizationId = null) { const headers = { @@ -157,6 +157,22 @@ export default { return axios($, clearObj(config)); }, + getCustomer({ + customerId, ...args + }) { + return this._makeRequest({ + path: `customers/${customerId}`, + ...args, + }); + }, + getContactPerson({ + customerId, contactpersonId, ...args + }) { + return this._makeRequest({ + path: `customers/${customerId}/contactpersons/${contactpersonId}`, + ...args, + }); + }, createCustomer(args = {}) { return this._makeRequest({ method: "POST", @@ -164,6 +180,15 @@ export default { ...args, }); }, + updateCustomer({ + customerId, ...args + }) { + return this._makeRequest({ + method: "PUT", + path: `customers/${customerId}`, + ...args, + }); + }, createSubscription(args = {}) { return this._makeRequest({ method: "POST", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c1b694f96cefb..cc8e363dabe31 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -216,8 +216,7 @@ importers: components/acelle_mail: {} - components/acronis_cyber_protect_cloud: - specifiers: {} + components/acronis_cyber_protect_cloud: {} components/action_builder: {} @@ -1183,8 +1182,7 @@ importers: specifier: ^0.0.4 version: 0.0.4 - components/bitdefender_gravityzone: - specifiers: {} + components/bitdefender_gravityzone: {} components/bitport: {} @@ -2559,8 +2557,7 @@ importers: specifier: ^2.1.0 version: 2.1.0 - components/demandbase: - specifiers: {} + components/demandbase: {} components/demio: dependencies: @@ -4490,8 +4487,7 @@ importers: specifier: ^1.5.1 version: 1.6.6 - components/goto_meeting: - specifiers: {} + components/goto_meeting: {} components/gotowebinar: dependencies: @@ -8443,8 +8439,7 @@ importers: specifier: ^1.5.1 version: 1.6.6 - components/recruiterflow: - specifiers: {} + components/recruiterflow: {} components/recruitis: dependencies: @@ -11666,8 +11661,7 @@ importers: specifier: ^1.6.5 version: 1.6.6 - components/wolfram_alpha: - specifiers: {} + components/wolfram_alpha: {} components/wonderchat: {} @@ -12224,6 +12218,9 @@ importers: components/zoho_subscriptions: dependencies: + '@pipedream/platform': + specifier: ^3.0.3 + version: 3.0.3 moment: specifier: ^2.29.4 version: 2.30.1 @@ -24678,22 +24675,22 @@ packages: superagent@3.8.1: resolution: {integrity: sha512-VMBFLYgFuRdfeNQSMLbxGSLfmXL/xc+OO+BZp41Za/NRDBet/BNbkRJrYzCUu0u4GU0i/ml2dtT8b9qgkw9z6Q==} engines: {node: '>= 4.0'} - deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net + 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 . superagent@4.1.0: resolution: {integrity: sha512-FT3QLMasz0YyCd4uIi5HNe+3t/onxMyEho7C3PSqmti3Twgy2rXT4fmkTz6wRL6bTF4uzPcfkUCa8u4JWHw8Ag==} engines: {node: '>= 6.0'} - deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net + 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 . superagent@5.3.1: resolution: {integrity: sha512-wjJ/MoTid2/RuGCOFtlacyGNxN9QLMgcpYLDQlWFIhhdJ93kNscFonGvrpAHSCVjRVj++DGCglocF7Aej1KHvQ==} engines: {node: '>= 7.0.0'} - deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net + 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 . superagent@7.1.6: resolution: {integrity: sha512-gZkVCQR1gy/oUXr+kxJMLDjla434KmSOKbx5iGD30Ql+AkJQ/YlPKECJy2nhqOsHLjGHzoDTXNSjhnvWhzKk7g==} engines: {node: '>=6.4.0 <13 || >=14'} - deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net + 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) supports-color@2.0.0: resolution: {integrity: sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==}