@dutchfurniturefulfilment/skik-client
Version:
Javascript package for integrating a SKIK configurator inside web projects.
59 lines (46 loc) • 1.84 kB
Markdown
# SKIK Client / Data interfaces / Prices
## `ProductPrices`
A ProductPrices interface associates vendor-specific prices for a certain product with the product's EAN code. this data is optionally injected in real-time into the configurator, to activate automated price calculations.
```typescript
interface ProductPrices {
EANCode: string;
originalPrice: number;
discountPrice: number;
}
```
**Description**
| Property | Description |
|:--------------- |:----------- |
| `EANCode` | The EAN code for the product. |
| `originalPrice` | The original selling price in cents, including VAT. |
| `discountPrice` | A discount price in cents, including VAT. If no discount should be applied to the product's price, discountPrice must equal originalPrice. |
## `Price`
A plain Javascript object representing a certain price.
```typescript
interface Price {
readonly cents: number;
readonly formatted: string;
}
```
| Property | Description |
|:----------- |:----------- |
| `cents` | The amount of cents the price represents. Expected to be a positive integer. |
| `formatted` | A pre-formatted string representing the price in euros for display purposes. For example, `1250` is represented as `"€12,50"`. |
## `PriceMutationReport`
`SKIKClient.PriceMutationReport` interfaces are the payload for [`"price-changed"`](event-channels#price-changed) events.
```typescript
interface PriceMutationReport {
readonly before: {
originalPrice: Price;
discountPrice: Price;
};
readonly after: {
originalPrice: Price;
discountPrice: Price;
};
}
```
| Property | Description |
|:-------- |:----------- |
| `before` | The original and discount prices before the mutation happened. |
| `after` | The original and discount prices after the mutation happened. |