Palaten-Studios / docs

Documentation for Palaten-Studio's services
https://docs.palaten.de
MIT License
1 stars 0 forks source link

Product API #20

Open lbirkert opened 1 year ago

lbirkert commented 1 year ago

An API that helps fetching product configurations and prices.

Product Object

{
  key: "servers_mc",
  ram: {
// The config key, also used for generating the Cart payload (key=value)
    type: "enum",
    values: {
// name: price
      1:  100,
      2:  200,
      3:  300
  },
  currency: "EUR"
}

We'd add currency headers to all these Requests, including the Cart API. (As we do not want bring our site between a paywall just for the users to see the prices)

GET /product/{key:string}
Product
GET /product
[ Product ]

When configuring these values will be shown to the user as + price and - price values dynamically.

The config payload (in Cart API terms data payload) will look like this:

ram=1&key=value

Note that not the prices are used in the payload as these might change while the website is running.

lbirkert commented 1 year ago

We should also consider adding VAT fields (Steuern)

lbirkert commented 1 year ago
GET /product/{key:string}?ram=1&key=value

->

{
  currency: "EUR",
  total: 1027.3,
  vat: 0.19,
  total_vat: 1027.3 * 1.19
}
lbirkert commented 1 year ago

Currently planned is following:

GET /product?currency=EUR
[ Product ]
GET /product/{key:string}?currency=EUR&ram=1&key=value

->

{
  currency: "EUR",
  total: 1027.3,
  vat: 0.19,
  total_vat: 1027.3 * 1.19
}

This however needs further thinking as i don't know if i am happy with the ?currency yet, also needs aproval from @CraftingDragon007

CraftingDragon007 commented 1 year ago

For now Im ok with this, maybe we'll change this in the future

CraftingDragon007 commented 1 year ago

I think the vat fields should only contain the multiplier/percentage, that is used and not the full calculation

lbirkert commented 1 year ago

I think the vat fields should only contain the multiplier/percentage, that is used and not the full calculation

I understand where you are comming from but you need to consider that this is critical information, you know how javascript sometimes tends to be, it would be safer.

CraftingDragon007 commented 1 year ago

Then I would create a seperate field for this information instead of packing it into an arbitary string

lbirkert commented 1 year ago

Then I would create a seperate field for this information instead of packing it into an arbitary string

What do you mean? total_vat is an extra field