Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions components/etermin/actions/create-contact/create-contact.mjs
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 components/etermin/actions/create-voucher/create-voucher.mjs
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: {
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;
},
};
120 changes: 116 additions & 4 deletions components/etermin/etermin.app.mjs
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",
},
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",
},
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,
});
},
async createVoucher(args = {}) {
return this._makeRequest({
path: "/voucher",
method: "post",
...args,
});
},
},
};
4 changes: 2 additions & 2 deletions components/etermin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/etermin",
"version": "0.6.0",
"version": "0.7.0",
"description": "Pipedream etermin Components",
"main": "etermin.app.mjs",
"keywords": [
Expand All @@ -13,6 +13,6 @@
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.0.0"
"@pipedream/platform": "^3.1.0"
}
}
4 changes: 2 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading