myinvois-sdk
Version:
TypeScript SDK for interacting with the Malaysia e-invoicing system (MyInvois) API
111 lines (110 loc) • 2.77 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Address = void 0;
const base_model_1 = require("./base-model");
/**
* Represents a postal address
*/
class Address extends base_model_1.BaseModel {
constructor() {
super(...arguments);
this._addressLine1 = '';
this._addressLine2 = '';
this._city = '';
this._postalCode = '';
this._stateCode = '';
this._countryCode = 'MYS';
}
// Getter and Setter for addressLine1
get addressLine1() {
return this._addressLine1;
}
set addressLine1(value) {
this._addressLine1 = value;
}
// Getter and Setter for addressLine2
get addressLine2() {
return this._addressLine2;
}
set addressLine2(value) {
this._addressLine2 = value;
}
// Getter and Setter for city
get city() {
return this._city;
}
set city(value) {
this._city = value;
}
// Getter and Setter for postalCode
get postalCode() {
return this._postalCode;
}
set postalCode(value) {
this._postalCode = value;
}
// Getter and Setter for stateCode
get stateCode() {
return this._stateCode;
}
set stateCode(value) {
this._stateCode = value;
}
// Getter and Setter for countryCode
get countryCode() {
return this._countryCode;
}
set countryCode(value) {
this._countryCode = value;
}
/**
* Converts the address to a JSON representation
*/
toJSON() {
return {
"CityName": [
{
"_": this._city
}
],
"PostalZone": [
{
"_": this._postalCode
}
],
"CountrySubentityCode": [
{
"_": this._stateCode
}
],
"AddressLine": [
{
"Line": [
{
"_": this._addressLine1
}
]
},
{
"Line": [
{
"_": this._addressLine2
}
]
}
],
"Country": [
{
"IdentificationCode": [
{
"_": this._countryCode,
"listID": "ISO3166-1",
"listAgencyID": "6"
}
]
}
]
};
}
}
exports.Address = Address;