myinvois-sdk
Version:
TypeScript SDK for interacting with the Malaysia e-invoicing system (MyInvois) API
85 lines (84 loc) • 2.28 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Item = void 0;
const base_model_1 = require("./base-model");
/**
* Represents an item in an invoice line
*/
class Item extends base_model_1.BaseModel {
constructor() {
super(...arguments);
this._name = '';
this._description = '';
this._classificationCode = '';
this._classificationScheme = 'CLASS';
this._countryOfOrigin = 'MYS';
}
// Getter and Setter for name
get name() {
return this._name;
}
set name(value) {
this._name = value;
}
// Getter and Setter for description
get description() {
return this._description;
}
set description(value) {
this._description = value;
}
// Getter and Setter for classificationCode
get classificationCode() {
return this._classificationCode;
}
set classificationCode(value) {
this._classificationCode = value;
}
// Getter and Setter for classificationScheme
get classificationScheme() {
return this._classificationScheme;
}
set classificationScheme(value) {
this._classificationScheme = value;
}
// Getter and Setter for countryOfOrigin
get countryOfOrigin() {
return this._countryOfOrigin;
}
set countryOfOrigin(value) {
this._countryOfOrigin = value;
}
/**
* Converts the item to a JSON representation
*/
toJSON() {
return {
"CommodityClassification": [
{
"ItemClassificationCode": [
{
"_": this._classificationCode,
"listID": this._classificationScheme
}
]
}
],
"Description": [
{
"_": this._description || this._name
}
],
"OriginCountry": [
{
"IdentificationCode": [
{
"_": this._countryOfOrigin
}
]
}
]
};
}
}
exports.Item = Item;