Merge branch 'trunk' into e2e/add-missing-entries-to-default-json

This commit is contained in:
Lucas Bustamante 2021-12-27 08:40:28 -03:00
commit a700531d12
7 changed files with 20 additions and 4 deletions

View File

@ -1,5 +1,9 @@
# Unreleased
## Added
- Added low stock threshold field for products
# 0.2.0
## Added

View File

@ -34,7 +34,7 @@ abstract class AbstractProductInventory extends Model {
*
* @type {StockStatus}
*/
public readonly stockStatus: StockStatus = ''
public readonly stockStatus: StockStatus = '';
/**
* The status of backordering for a product.
@ -56,6 +56,13 @@ abstract class AbstractProductInventory extends Model {
* @type {boolean}
*/
public readonly isOnBackorder: boolean = false;
/**
* Indicates the threshold for when the low stock notification will be sent to the merchant.
*
* @type {number}
*/
public readonly lowStockThreshold: number = -1;
}
export interface IProductInventory extends AbstractProductInventory {}

View File

@ -53,7 +53,7 @@ export type ProductGroupedUpdateParams = 'groupedProducts';
* Properties related to tracking inventory.
*/
export type ProductInventoryUpdateParams = 'backorderStatus' | 'canBackorder' | 'trackInventory'
| 'onePerOrder' | 'remainingStock';
| 'onePerOrder' | 'remainingStock' | 'lowStockThreshold';
/**
* Properties related to sales tax.

View File

@ -130,10 +130,11 @@ export class SimpleProduct extends AbstractProduct implements
public readonly onePerOrder: boolean = false;
public readonly trackInventory: boolean = false;
public readonly remainingStock: number = -1;
public readonly stockStatus: StockStatus = ''
public readonly stockStatus: StockStatus = '';
public readonly backorderStatus: BackorderStatus = BackorderStatus.Allowed;
public readonly canBackorder: boolean = false;
public readonly isOnBackorder: boolean = false;
public readonly lowStockThreshold: number = -1;
/**
* @see ./abstracts/price.ts

View File

@ -115,10 +115,11 @@ export class VariableProduct extends AbstractProduct implements
public readonly onePerOrder: boolean = false;
public readonly trackInventory: boolean = false;
public readonly remainingStock: number = -1;
public readonly stockStatus: StockStatus = ''
public readonly stockStatus: StockStatus = '';
public readonly backorderStatus: BackorderStatus = BackorderStatus.Allowed;
public readonly canBackorder: boolean = false;
public readonly isOnBackorder: boolean = false;
public readonly lowStockThreshold: number = -1;
/**
* @see ./abstracts/sales-tax.ts

View File

@ -118,6 +118,7 @@ export class ProductVariation extends AbstractProductData implements
public readonly backorderStatus: BackorderStatus = BackorderStatus.Allowed;
public readonly canBackorder: boolean = false;
public readonly isOnBackorder: boolean = false;
public readonly lowStockThreshold: number = -1;
/**
* @see ./abstracts/price.ts

View File

@ -345,6 +345,7 @@ export function createProductInventoryTransformation(): ModelTransformation[] {
onePerOrder: PropertyType.Boolean,
stockStatus: PropertyType.String,
backOrderStatus: PropertyType.String,
lowStockThreshold: PropertyType.Integer,
},
),
new KeyChangeTransformation< IProductInventory >(
@ -356,6 +357,7 @@ export function createProductInventoryTransformation(): ModelTransformation[] {
backorderStatus: 'backorders',
canBackorder: 'backorders_allowed',
isOnBackorder: 'backordered',
lowStockThreshold: 'low_stock_amount',
},
),
];