-
Notifications
You must be signed in to change notification settings - Fork 5.6k
[Components] etermin #13290 #18415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
[Components] etermin #13290 #18415
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
db4f28b
Added actions
lcaresia 1b4f3b2
Added actions
lcaresia 5522706
Added actions
lcaresia 4632009
Merge branch 'master' into issue-13290
lcaresia ad6e1ca
Merge branch 'master' into issue-13290
lcaresia 4f1ade2
Added actions
lcaresia d4e19fa
Update components/etermin/etermin.app.mjs
michelle0927 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
86 changes: 86 additions & 0 deletions
86
components/etermin/actions/create-contact/create-contact.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| import app from "../../etermin.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "etermin-create-contact", | ||
| name: "Create Contact", | ||
| description: "Create a new contact on eTermin. [See the documentation](https://app.swaggerhub.com/apis/etermin.net/eTermin-API/1.0.0#/Contact/post_contact)", | ||
| version: "0.0.1", | ||
| annotations: { | ||
| openWorldHint: true, | ||
| destructiveHint: false, | ||
| readOnlyHint: false, | ||
| }, | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| updateWhenExistsgdt: { | ||
| propDefinition: [ | ||
| app, | ||
| "updateWhenExistsgdt", | ||
| ], | ||
| }, | ||
| salutation: { | ||
| propDefinition: [ | ||
| app, | ||
| "salutation", | ||
| ], | ||
| }, | ||
| title: { | ||
| propDefinition: [ | ||
| app, | ||
| "title", | ||
| ], | ||
| }, | ||
| lastname: { | ||
| propDefinition: [ | ||
| app, | ||
| "lastName", | ||
| ], | ||
| }, | ||
| firstname: { | ||
| propDefinition: [ | ||
| app, | ||
| "firstName", | ||
| ], | ||
| }, | ||
| company: { | ||
| propDefinition: [ | ||
| app, | ||
| "company", | ||
| ], | ||
| }, | ||
| birthday: { | ||
| propDefinition: [ | ||
| app, | ||
| "birthday", | ||
| ], | ||
| }, | ||
| email: { | ||
| propDefinition: [ | ||
| app, | ||
| "email", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const updateWhenExistsgdt = this.updateWhenExistsgdt === true || this.updateWhenExistsgdt === "true" | ||
| ? 1 | ||
| : 0; | ||
|
|
||
| const response = await this.app.createContact({ | ||
| $, | ||
| params: { | ||
| updatewhenexistsgdt: updateWhenExistsgdt, | ||
| salutation: this.salutation, | ||
| title: this.title, | ||
| lastname: this.lastname, | ||
| firstname: this.firstname, | ||
| company: this.company, | ||
| birthday: this.birthday, | ||
| email: this.email, | ||
| }, | ||
| }); | ||
| $.export("$summary", "Successfully created the new contact"); | ||
| return response; | ||
| }, | ||
| }; | ||
78 changes: 78 additions & 0 deletions
78
components/etermin/actions/create-voucher/create-voucher.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| import app from "../../etermin.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "etermin-create-voucher", | ||
| name: "Create Voucher", | ||
| description: "Create a new voucher on eTermin. [See the documentation](https://app.swaggerhub.com/apis/etermin.net/eTermin-API/1.0.0#/Voucher/post_api_voucher)", | ||
| version: "0.0.1", | ||
| annotations: { | ||
| openWorldHint: true, | ||
| destructiveHint: false, | ||
| readOnlyHint: false, | ||
| }, | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| id: { | ||
| propDefinition: [ | ||
| app, | ||
| "id", | ||
| ], | ||
| }, | ||
| description: { | ||
| propDefinition: [ | ||
| app, | ||
| "description", | ||
| ], | ||
| }, | ||
| priceInclVat: { | ||
| propDefinition: [ | ||
| app, | ||
| "priceInclVat", | ||
| ], | ||
| }, | ||
| isPercentage: { | ||
| propDefinition: [ | ||
| app, | ||
| "isPercentage", | ||
| ], | ||
| }, | ||
| customerEmail: { | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| propDefinition: [ | ||
| app, | ||
| "customerEmail", | ||
| ], | ||
| }, | ||
| validFrom: { | ||
| propDefinition: [ | ||
| app, | ||
| "validFrom", | ||
| ], | ||
| }, | ||
| validUntil: { | ||
| propDefinition: [ | ||
| app, | ||
| "validUntil", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.app.createVoucher({ | ||
| $, | ||
| params: { | ||
| id: this.id, | ||
| description: this.description, | ||
| priceinclvat: this.priceInclVat, | ||
| priceoriginal: this.priceInclVat, // Docs: Should be the same value as in priceinclvat, important with contingent | ||
| ispercentage: this.isPercentage | ||
| ? 1 | ||
| : 0, | ||
| customeremail: this.customerEmail, | ||
| validfrom: this.validFrom, | ||
| validuntil: this.validUntil, | ||
| }, | ||
| }); | ||
| $.export("$summary", "Successfully created the new voucher"); | ||
| return response; | ||
| }, | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,123 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
|
|
||
| export default { | ||
| type: "app", | ||
| app: "etermin", | ||
| propDefinitions: {}, | ||
| propDefinitions: { | ||
| updateWhenExistsgdt: { | ||
| type: "boolean", | ||
| label: "Update When Exists", | ||
| description: "Set to 1 to check if the contact is already existing. If so the existing contact gets updated. Needs email or firstname, lastname and birthday", | ||
michelle0927 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }, | ||
| salutation: { | ||
| type: "string", | ||
| label: "Salutation", | ||
| description: "Salutation or greeting prefix", | ||
| }, | ||
| title: { | ||
| type: "string", | ||
| label: "Title", | ||
| description: "Title of the contact", | ||
| }, | ||
| lastName: { | ||
| type: "string", | ||
| label: "Last Name", | ||
| description: "Contact's last name", | ||
| }, | ||
| firstName: { | ||
| type: "string", | ||
| label: "First Name", | ||
| description: "Contact's first name", | ||
| }, | ||
| company: { | ||
| type: "string", | ||
| label: "Company", | ||
| description: "Name of the company associated with the contact", | ||
| }, | ||
| birthday: { | ||
| type: "string", | ||
| label: "Birthday", | ||
| description: "Contact's date of birth in YYYY-MM-DD format", | ||
| }, | ||
| email: { | ||
| type: "string", | ||
| label: "Email", | ||
| description: "Email address of the contact", | ||
| }, | ||
| id: { | ||
| type: "string", | ||
| label: "ID", | ||
| description: "ID of the voucher", | ||
| }, | ||
lcaresia marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| description: { | ||
| type: "string", | ||
| label: "Description", | ||
| description: "Description of the voucher", | ||
| }, | ||
| priceInclVat: { | ||
| type: "string", | ||
| label: "Price Including VAT", | ||
| description: "Price including VAT of the voucher", | ||
| }, | ||
| isPercentage: { | ||
| type: "boolean", | ||
| label: "Is Percentage", | ||
| description: "Indicates if the value of the voucher is a percentage", | ||
| }, | ||
| customerEmail: { | ||
| type: "string", | ||
| label: "Customer Email", | ||
| description: "Email address of the customer receiving the offer", | ||
| }, | ||
| validFrom: { | ||
| type: "string", | ||
| label: "Valid From", | ||
| description: "Start date of validity in YYYY-MM-DD format", | ||
| }, | ||
| validUntil: { | ||
| type: "string", | ||
| label: "Valid Until", | ||
| description: "End date of validity in YYYY-MM-DD format", | ||
| }, | ||
| }, | ||
| methods: { | ||
| // this.$auth contains connected account data | ||
| authKeys() { | ||
| console.log(Object.keys(this.$auth)); | ||
| _baseUrl() { | ||
| return "https://www.etermin.net/api"; | ||
| }, | ||
| async _makeRequest(opts = {}) { | ||
| const { | ||
| $, | ||
| path, | ||
| headers, | ||
| ...otherOpts | ||
| } = opts; | ||
| return axios($, { | ||
| ...otherOpts, | ||
| url: this._baseUrl() + path, | ||
| headers: { | ||
| "publickey": `${this.$auth.public_key}`, | ||
| "salt": `${this.$auth.salt}`, | ||
| "signature": `${this.$auth.signature}`, | ||
| "accept": "application/json", | ||
| "content-type": "application/json", | ||
| ...headers, | ||
| }, | ||
| }); | ||
| }, | ||
|
|
||
| async createContact(args = {}) { | ||
| return this._makeRequest({ | ||
| path: "/contact", | ||
| method: "post", | ||
| ...args, | ||
| }); | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| async createVoucher(args = {}) { | ||
| return this._makeRequest({ | ||
| path: "/voucher", | ||
| method: "post", | ||
| ...args, | ||
| }); | ||
| }, | ||
| }, | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.