-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[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
base: master
Are you sure you want to change the base?
[Components] etermin #13290 #18415
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,77 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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 response = await this.app.createContact({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
params: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
updatewhenexistsgdt: this.updateWhenExistsgdt, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
salutation: this.salutation, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
title: this.title, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
lastname: this.lastName, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
firstname: this.firstName, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
company: this.company, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
birthday: this.birthday, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
email: this.email, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+64
to
+71
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrong identifiers: last/first name come through as undefined. Props are Apply this diff: - lastname: this.lastName,
- firstname: this.firstName,
+ lastname: this.lastname,
+ firstname: this.firstname, 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with coderabbit. The props are There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @michelle0927 Thank you for confirming! You're absolutely right - the props are indeed defined as The fix CodeRabbit suggested will resolve the undefined values issue and ensure the contact creation works as intended. 🐰✨ If you found this review helpful, would you consider giving us a shout-out on X? Thank you for using CodeRabbit!
Comment on lines
+64
to
+71
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix broken mappings for last/first name. Props are params: {
updatewhenexistsgdt: this.updateWhenExistsgdt,
salutation: this.salutation,
title: this.title,
- lastname: this.lastName,
- firstname: this.firstName,
+ lastname: this.lastname,
+ firstname: this.firstname,
company: this.company,
birthday: this.birthday,
email: this.email,
}, 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$.export("$summary", "Successfully created the new contact"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return response; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}; |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,71 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
type: "action", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
props: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
app, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
id: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
propDefinition: [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
app, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"id", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
description: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
propDefinition: [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
app, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"description", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
priceInclVat: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
propDefinition: [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
app, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"priceInclVat", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
isPercentage: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
propDefinition: [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
app, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"isPercentage", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
customerEmail: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+23
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add missing priceOriginal prop to match payload. If the API expects Apply this diff (insert after priceInclVat): priceInclVat: {
propDefinition: [
app,
"priceInclVat",
],
},
+ priceOriginal: {
+ propDefinition: [
+ app,
+ "priceOriginal",
+ ],
+ }, Note: You'll also need to add 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with coderabbit. Prop There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @michelle0927 Thank you for confirming! Yes, the |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.priceOriginal, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+60
to
+61
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Broken payload mapping: typo and missing prop.
Apply this diff: - priceinclvat: this.priceInClvat,
- priceoriginal: this.priceOriginal,
+ priceinclvat: this.priceInclVat,
+ // priceoriginal requires a prop; see follow-up comment to add it in app + action 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with coderabbit. Need to fix typo in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed:
Length of output: 0 🏁 Script executed:
Length of output: 3097 @michelle0927 Thank you for confirming! You're absolutely right about the typo. I've checked the app file and confirmed there are two issues that need fixing:
Looking at the available propDefinitions, I only see these voucher-related props:
For the Option 1: Add a Could you clarify what the // Current broken code:
priceinclvat: this.priceInClvat, // typo
priceoriginal: this.priceOriginal, // missing prop
// Fix for typo:
priceinclvat: this.priceInclVat, // ✅
// Still need to decide what to do with priceoriginal |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ispercentage: this.isPercentage, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
customeremail: this.customerEmail, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
validfrom: this.validFrom, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
validuntil: this.validUntil, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+60
to
+66
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainFix typos and remove/define missing fields to prevent runtime errors.
params: {
id: this.id,
description: this.description,
- priceinclvat: this.priceInClvat,
- priceoriginal: this.priceOriginal,
- ispercentage: this.isPercentage,
+ priceinclvat: this.priceInclVat,
+ // priceoriginal: this.priceOriginal, // Uncomment only if you add a prop and API requires it
+ ispercentage: this.isPercentage ? 1 : 0,
customeremail: this.customerEmail,
validfrom: this.validFrom,
validuntil: this.validUntil,
}, 🏁 Script executed: #!/bin/bash
# Find other typos/mismatches
rg -n -C1 'priceInClvat|priceOriginal|priceoriginal|priceinclvat|ispercentage|customeremail|validfrom|validuntil' components/etermin Length of output: 799 🌐 Web query:
💡 Result: Short answer: No — eTermin’s voucher endpoints do not use a field called priceoriginal. eTermin’s docs/Integrations show voucher fields like "Price (incl. VAT)" / "Price Incl. VAT" when creating vouchers (e.g., in eTermin support articles and the Zapier eTermin "Create Voucher" action). [1][2] Sources:
Fix typo, remove unused field, and optionally normalize boolean in create-voucher.
params: {
id: this.id,
description: this.description,
- priceinclvat: this.priceInClvat,
- priceoriginal: this.priceOriginal,
- ispercentage: this.isPercentage,
+ priceinclvat: this.priceInclVat,
+ // priceoriginal: this.priceOriginal, // remove unless you add a prop and API requires it
+ ispercentage: this.isPercentage ? 1 : 0, // use numeric only if API expects it
customeremail: this.customerEmail,
validfrom: this.validFrom,
validuntil: this.validUntil,
}, 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+55
to
+67
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainPII in query string; send body as JSON instead. POSTing customer data via Apply this diff: - const response = await this.app.createVoucher({
- $,
- params: {
+ const response = await this.app.createVoucher({
+ $,
+ data: {
id: this.id,
description: this.description,
- priceinclvat: this.priceInClvat,
- priceoriginal: this.priceOriginal,
+ priceinclvat: this.priceInclVat,
+ ...(this.priceOriginal != null ? { priceoriginal: this.priceOriginal } : {}),
ispercentage: this.isPercentage,
customeremail: this.customerEmail,
validfrom: this.validFrom,
validuntil: this.validUntil,
},
}); Confirm the eTermin endpoint accepts JSON; if it requires form-encoded, set 🏁 Script executed: #!/bin/bash
# Search for the definition and implementation of createVoucher in the codebase
rg -nP "\bcreateVoucher\b" -n -C3 . Length of output: 1036 🏁 Script executed: #!/bin/bash
sed -n '1,260p' components/etermin/etermin.app.mjs Length of output: 3097 🏁 Script executed: #!/bin/bash
rg -n "swagger" -i -C3 .
rg -n "openapi" -i -C3 .
rg -n "docs" -i -C3 . Length of output: 265540 🏁 Script executed: #!/bin/bash
# Fetch eTermin API spec and inspect /voucher POST request details
curl -s https://api.swaggerhub.com/apis/etermin.net/eTermin-API/1.0.0/swagger.json \
| jq '.paths["/voucher"].post | {parameters, requestBody}' Length of output: 47 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "Dumping /voucher path from SwaggerHub JSON (if present)..."
curl -sS "https://api.swaggerhub.com/apis/etermin.net/eTermin-API/1.0.0/swagger.json" -o /tmp/etermin_swagger.json || true
jq 'paths | map(tostring) | .[]' /tmp/etermin_swagger.json | head -n 20 || true
echo "--- Searching for 'voucher' in swagger JSON ---"
jq '.. | objects | select(has("paths") or has("components"))' /tmp/etermin_swagger.json | head -n 1 || true
jq '.. | select(type=="object" and (.path? // .) | tostring | test("voucher"; "i") )' /tmp/etermin_swagger.json | jq -c '.' | head -n 10 || true
echo "--- Full /voucher entry (if exists) ---"
jq '.paths["/voucher"]' /tmp/etermin_swagger.json || true
echo "--- All paths containing voucher ---"
jq 'keys[] as $k | select($k | test("voucher"; "i")) | $k' /tmp/etermin_swagger.json.paths || true Length of output: 456 🏁 Script executed: #!/bin/bash
sed -n '1,240p' components/etermin/actions/create-voucher/create-voucher.mjs Length of output: 1503 Move PII out of the query string — send POST body (data) and fix typos
- const response = await this.app.createVoucher({
- $,
- params: {
+ const response = await this.app.createVoucher({
+ $,
+ data: {
id: this.id,
description: this.description,
- priceinclvat: this.priceInClvat,
- priceoriginal: this.priceOriginal,
+ priceinclvat: this.priceInclVat,
+ ...(this.priceOriginal != null ? { priceoriginal: this.priceOriginal } : {}),
ispercentage: this.isPercentage,
customeremail: this.customerEmail,
validfrom: this.validFrom,
validuntil: this.validUntil,
},
});
📝 Committable suggestion
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with coderabbit. Need to send There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @michelle0927 Thank you for confirming! Yes, sending customer email and other sensitive data via query parameters ( The suggested fix also resolves the typos ( If you found this review helpful, would you consider giving us a shout-out on X? Thank you for using CodeRabbit! |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$.export("$summary", "Successfully created the new voucher"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return response; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export default { | ||
UPDATE_OPTIONS: [ | ||
1, | ||
2, | ||
], | ||
}; |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,11 +1,123 @@ | ||||||||||||||||||||||||||
import { axios } from "@pipedream/platform"; | ||||||||||||||||||||||||||
import constants from "./common/constants.mjs"; | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
export default { | ||||||||||||||||||||||||||
type: "app", | ||||||||||||||||||||||||||
app: "etermin", | ||||||||||||||||||||||||||
propDefinitions: {}, | ||||||||||||||||||||||||||
propDefinitions: { | ||||||||||||||||||||||||||
updateWhenExistsgdt: { | ||||||||||||||||||||||||||
type: "string", | ||||||||||||||||||||||||||
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", | ||||||||||||||||||||||||||
options: constants.UPDATE_OPTIONS, | ||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||
Comment on lines
+8
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainTypo in prop key: “updateWhenExistsgdt” likely unintended; also tighten copy The key name looks misspelled and will leak into action props. Rename to Apply: - updateWhenExistsgdt: {
+ updateWhenExists: {
type: "string",
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",
+ description: "Set to 1 to check if the contact already exists. If found, the existing contact is updated. Requires email, or first name + last name + birthday.",
options: constants.UPDATE_OPTIONS,
}, If actions reference the old key, update them accordingly: 🏁 Script executed: #!/bin/bash
# Find usages of the old key in eTermin actions
rg -nC2 '\bupdateWhenExistsgdt\b' --type=ts --type=js --type=jsx --type=tsx components/etermin Length of output: 27 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== rg search for 'updateWhenExistsgdt' =="
if command -v rg >/dev/null 2>&1; then
rg -nC2 'updateWhenExistsgdt' || true
else
echo "rg not found; falling back to grep"
grep -R -n --line-number -C2 'updateWhenExistsgdt' . || true
fi
echo "== rg search for 'updateWhenExists' =="
if command -v rg >/dev/null 2>&1; then
rg -nC2 '\bupdateWhenExists\b' -S || true
else
grep -R -n --line-number -C2 'updateWhenExists' . || true
fi
echo "== list components/etermin files =="
if [ -d components/etermin ]; then
find components/etermin -maxdepth 2 -type f -print || true
if [ -f components/etermin/etermin.app.mjs ]; then
echo "== head of components/etermin/etermin.app.mjs =="
sed -n '1,200p' components/etermin/etermin.app.mjs || true
else
echo "components/etermin/etermin.app.mjs not found"
fi
else
echo "components/etermin directory not found"
fi Length of output: 4820 Rename prop key to
- updateWhenExistsgdt: {
+ updateWhenExists: {
type: "string",
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",
+ description: "Set to 1 to check if the contact already exists. If found, the existing contact is updated. Requires email, or first name + last name + birthday.",
options: constants.UPDATE_OPTIONS,
},
📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree with coderabbit. Need to fix the prop description. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain@michelle0927 Thanks for confirming! Let me check for all references to the misspelled prop and provide the complete fix. Based on the search results and the need to fix the prop key, here's the complete fix: 1. Fix the prop definition in updateWhenExists: {
type: "string",
label: "Update When Exists",
description: "Set to 1 to check if the contact already exists. If found, the existing contact is updated. Requires email, or first name + last name + birthday.",
options: constants.UPDATE_OPTIONS,
}, 2. Update the action file
This ensures consistency across the codebase while maintaining API compatibility. 🏁 Script executed:
Length of output: 991 Perfect! I can see exactly where the misspelled prop is used. Here's the complete fix for all affected files: 1. Fix in updateWhenExists: {
type: "string",
label: "Update When Exists",
description: "Set to 1 to check if the contact already exists. If found, the existing contact is updated. Requires email, or first name + last name + birthday.",
options: constants.UPDATE_OPTIONS,
}, 2. Fix in You'll need to update 3 places in this file:
updateWhenExists: {
"updateWhenExists",
updatewhenexistsgdt: this.updateWhenExists, This maintains API compatibility by keeping the parameter key The create-voucher action doesn't use this prop, so no changes are needed there. 🧠 Learnings used
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @michelle0927 Thank you for confirming! The fix is already outlined in the previous comment. The misspelled prop key
The API parameter key 🧠 Learnings used
michelle0927 marked this conversation as resolved.
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", | ||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||
Comment on lines
+49
to
+53
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Prop |
||||||||||||||||||||||||||
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 vaucher is a percentage", | ||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||
Comment on lines
+65
to
+68
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. User-facing typo: “vaucher” → “voucher” Fix the typo in the description. Apply: - description: "Indicates if the value of the vaucher is a percentage",
+ description: "Indicates if the value of the voucher is a percentage", 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree with coderabbit. Need to fix typo. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @michelle0927 Thank you for confirming! You're absolutely right - the typo needs to be fixed. The correction needed is in Line 66 of description: "Indicates if the value of the voucher is a percentage", Simply change "vaucher" to "voucher" in the description string for the |
||||||||||||||||||||||||||
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 { | ||||||||||||||||||||||||||
$ = this, | ||||||||||||||||||||||||||
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}`, | ||||||||||||||||||||||||||
...headers, | ||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
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, | ||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.